google_cloudresourcemanager3/
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_cloudresourcemanager3 as cloudresourcemanager3;
55/// use cloudresourcemanager3::api::TagKey;
56/// use cloudresourcemanager3::{Result, Error};
57/// # async fn dox() {
58/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
59///
60/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
61/// // `client_secret`, among other things.
62/// let secret: yup_oauth2::ApplicationSecret = Default::default();
63/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
64/// // unless you replace  `None` with the desired Flow.
65/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
66/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
67/// // retrieve them from storage.
68/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
69///     .with_native_roots()
70///     .unwrap()
71///     .https_only()
72///     .enable_http2()
73///     .build();
74///
75/// let executor = hyper_util::rt::TokioExecutor::new();
76/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
77///     secret,
78///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
79///     yup_oauth2::client::CustomHyperClientBuilder::from(
80///         hyper_util::client::legacy::Client::builder(executor).build(connector),
81///     ),
82/// ).build().await.unwrap();
83///
84/// let client = hyper_util::client::legacy::Client::builder(
85///     hyper_util::rt::TokioExecutor::new()
86/// )
87/// .build(
88///     hyper_rustls::HttpsConnectorBuilder::new()
89///         .with_native_roots()
90///         .unwrap()
91///         .https_or_http()
92///         .enable_http2()
93///         .build()
94/// );
95/// let mut hub = CloudResourceManager::new(client, auth);
96/// // As the method needs a request, you would usually fill it with the desired information
97/// // into the respective structure. Some of the parts shown here might not be applicable !
98/// // Values shown here are possibly random and not representative !
99/// let mut req = TagKey::default();
100///
101/// // You can configure optional parameters by calling the respective setters at will, and
102/// // execute the final call using `doit()`.
103/// // Values shown here are possibly random and not representative !
104/// let result = hub.tag_keys().patch(req, "name")
105///              .validate_only(true)
106///              .update_mask(FieldMask::new::<&str>(&[]))
107///              .doit().await;
108///
109/// match result {
110///     Err(e) => match e {
111///         // The Error enum provides details about what exactly happened.
112///         // You can also just use its `Debug`, `Display` or `Error` traits
113///          Error::HttpError(_)
114///         |Error::Io(_)
115///         |Error::MissingAPIKey
116///         |Error::MissingToken(_)
117///         |Error::Cancelled
118///         |Error::UploadSizeLimitExceeded(_, _)
119///         |Error::Failure(_)
120///         |Error::BadRequest(_)
121///         |Error::FieldClash(_)
122///         |Error::JsonDecodeError(_, _) => println!("{}", e),
123///     },
124///     Ok(res) => println!("Success: {:?}", res),
125/// }
126/// # }
127/// ```
128#[derive(Clone)]
129pub struct CloudResourceManager<C> {
130    pub client: common::Client<C>,
131    pub auth: Box<dyn common::GetToken>,
132    _user_agent: String,
133    _base_url: String,
134    _root_url: String,
135}
136
137impl<C> common::Hub for CloudResourceManager<C> {}
138
139impl<'a, C> CloudResourceManager<C> {
140    pub fn new<A: 'static + common::GetToken>(
141        client: common::Client<C>,
142        auth: A,
143    ) -> CloudResourceManager<C> {
144        CloudResourceManager {
145            client,
146            auth: Box::new(auth),
147            _user_agent: "google-api-rust-client/7.0.0".to_string(),
148            _base_url: "https://cloudresourcemanager.googleapis.com/".to_string(),
149            _root_url: "https://cloudresourcemanager.googleapis.com/".to_string(),
150        }
151    }
152
153    pub fn effective_tags(&'a self) -> EffectiveTagMethods<'a, C> {
154        EffectiveTagMethods { hub: self }
155    }
156    pub fn folders(&'a self) -> FolderMethods<'a, C> {
157        FolderMethods { hub: self }
158    }
159    pub fn liens(&'a self) -> LienMethods<'a, C> {
160        LienMethods { hub: self }
161    }
162    pub fn locations(&'a self) -> LocationMethods<'a, C> {
163        LocationMethods { hub: self }
164    }
165    pub fn operations(&'a self) -> OperationMethods<'a, C> {
166        OperationMethods { hub: self }
167    }
168    pub fn organizations(&'a self) -> OrganizationMethods<'a, C> {
169        OrganizationMethods { hub: self }
170    }
171    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
172        ProjectMethods { hub: self }
173    }
174    pub fn tag_bindings(&'a self) -> TagBindingMethods<'a, C> {
175        TagBindingMethods { hub: self }
176    }
177    pub fn tag_keys(&'a self) -> TagKeyMethods<'a, C> {
178        TagKeyMethods { hub: self }
179    }
180    pub fn tag_values(&'a self) -> TagValueMethods<'a, C> {
181        TagValueMethods { hub: self }
182    }
183
184    /// Set the user-agent header field to use in all requests to the server.
185    /// It defaults to `google-api-rust-client/7.0.0`.
186    ///
187    /// Returns the previously set user-agent.
188    pub fn user_agent(&mut self, agent_name: String) -> String {
189        std::mem::replace(&mut self._user_agent, agent_name)
190    }
191
192    /// Set the base url to use in all requests to the server.
193    /// It defaults to `https://cloudresourcemanager.googleapis.com/`.
194    ///
195    /// Returns the previously set base url.
196    pub fn base_url(&mut self, new_base_url: String) -> String {
197        std::mem::replace(&mut self._base_url, new_base_url)
198    }
199
200    /// Set the root url to use in all requests to the server.
201    /// It defaults to `https://cloudresourcemanager.googleapis.com/`.
202    ///
203    /// Returns the previously set root url.
204    pub fn root_url(&mut self, new_root_url: String) -> String {
205        std::mem::replace(&mut self._root_url, new_root_url)
206    }
207}
208
209// ############
210// SCHEMAS ###
211// ##########
212/// 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.
213///
214/// This type is not used in any activity, and only used as *part* of another schema.
215///
216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
217#[serde_with::serde_as]
218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
219pub struct AuditConfig {
220    /// The configuration for logging of each type of permission.
221    #[serde(rename = "auditLogConfigs")]
222    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
223    /// 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.
224    pub service: Option<String>,
225}
226
227impl common::Part for AuditConfig {}
228
229/// 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.
230///
231/// This type is not used in any activity, and only used as *part* of another schema.
232///
233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
234#[serde_with::serde_as]
235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
236pub struct AuditLogConfig {
237    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
238    #[serde(rename = "exemptedMembers")]
239    pub exempted_members: Option<Vec<String>>,
240    /// The log type that this config enables.
241    #[serde(rename = "logType")]
242    pub log_type: Option<String>,
243}
244
245impl common::Part for AuditLogConfig {}
246
247/// Associates `members`, or principals, with a `role`.
248///
249/// This type is not used in any activity, and only used as *part* of another schema.
250///
251#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
252#[serde_with::serde_as]
253#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
254pub struct Binding {
255    /// 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).
256    pub condition: Option<Expr>,
257    /// 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`.
258    pub members: Option<Vec<String>>,
259    /// 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).
260    pub role: Option<String>,
261}
262
263impl common::Part for Binding {}
264
265/// Representation of a Capability.
266///
267/// # Activities
268///
269/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
270/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
271///
272/// * [capabilities get folders](FolderCapabilityGetCall) (response)
273/// * [capabilities patch folders](FolderCapabilityPatchCall) (request)
274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
275#[serde_with::serde_as]
276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
277pub struct Capability {
278    /// Immutable. Identifier. The resource name of the capability. Must be in the following form: * `folders/{folder_id}/capabilities/{capability_name}` For example, `folders/123/capabilities/app-management` Following are the allowed {capability_name} values: * `app-management`
279    pub name: Option<String>,
280    /// Required. The configured value of the capability at the given parent resource.
281    pub value: Option<bool>,
282}
283
284impl common::RequestValue for Capability {}
285impl common::ResponseResult for Capability {}
286
287/// An EffectiveTag represents a tag that applies to a resource during policy evaluation. Tags can be either directly bound to a resource or inherited from its ancestor. EffectiveTag contains the name and namespaced_name of the tag value and tag key, with additional fields of `inherited` to indicate the inheritance status of the effective tag.
288///
289/// # Activities
290///
291/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
292/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
293///
294/// * [list effective tags](EffectiveTagListCall) (none)
295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
296#[serde_with::serde_as]
297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
298pub struct EffectiveTag {
299    /// Indicates the inheritance status of a tag value attached to the given resource. If the tag value is inherited from one of the resource's ancestors, inherited will be true. If false, then the tag value is directly attached to the resource, inherited will be false.
300    pub inherited: Option<bool>,
301    /// The namespaced name of the TagKey. Can be in the form `{organization_id}/{tag_key_short_name}` or `{project_id}/{tag_key_short_name}` or `{project_number}/{tag_key_short_name}`.
302    #[serde(rename = "namespacedTagKey")]
303    pub namespaced_tag_key: Option<String>,
304    /// The namespaced name of the TagValue. Can be in the form `{organization_id}/{tag_key_short_name}/{tag_value_short_name}` or `{project_id}/{tag_key_short_name}/{tag_value_short_name}` or `{project_number}/{tag_key_short_name}/{tag_value_short_name}`.
305    #[serde(rename = "namespacedTagValue")]
306    pub namespaced_tag_value: Option<String>,
307    /// The name of the TagKey, in the format `tagKeys/{id}`, such as `tagKeys/123`.
308    #[serde(rename = "tagKey")]
309    pub tag_key: Option<String>,
310    /// The parent name of the tag key. Must be in the format `organizations/{organization_id}` or `projects/{project_number}`
311    #[serde(rename = "tagKeyParentName")]
312    pub tag_key_parent_name: Option<String>,
313    /// Resource name for TagValue in the format `tagValues/456`.
314    #[serde(rename = "tagValue")]
315    pub tag_value: Option<String>,
316}
317
318impl common::Resource for EffectiveTag {}
319
320/// Represents a collection of effective tag bindings for a GCP resource.
321///
322/// # Activities
323///
324/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
325/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
326///
327/// * [effective tag binding collections get locations](LocationEffectiveTagBindingCollectionGetCall) (response)
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct EffectiveTagBindingCollection {
332    /// Tag keys/values effectively bound to this resource, specified in namespaced format. For example: "123/environment": "production"
333    #[serde(rename = "effectiveTags")]
334    pub effective_tags: Option<HashMap<String, String>>,
335    /// The full resource name of the resource the TagBindings are bound to. E.g. `//cloudresourcemanager.googleapis.com/projects/123`
336    #[serde(rename = "fullResourceName")]
337    pub full_resource_name: Option<String>,
338    /// Identifier. The name of the EffectiveTagBindingCollection, following the convention: `locations/{location}/effectiveTagBindingCollections/{encoded-full-resource-name}` where the encoded-full-resource-name is the UTF-8 encoded name of the GCP resource the TagBindings are bound to. E.g. "locations/global/effectiveTagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
339    pub name: Option<String>,
340}
341
342impl common::ResponseResult for EffectiveTagBindingCollection {}
343
344/// 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); }
345///
346/// # Activities
347///
348/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
349/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
350///
351/// * [delete liens](LienDeleteCall) (response)
352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
353#[serde_with::serde_as]
354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
355pub struct Empty {
356    _never_set: Option<bool>,
357}
358
359impl common::ResponseResult for Empty {}
360
361/// 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.
362///
363/// This type is not used in any activity, and only used as *part* of another schema.
364///
365#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
366#[serde_with::serde_as]
367#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
368pub struct Expr {
369    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
370    pub description: Option<String>,
371    /// Textual representation of an expression in Common Expression Language syntax.
372    pub expression: Option<String>,
373    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
374    pub location: Option<String>,
375    /// 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.
376    pub title: Option<String>,
377}
378
379impl common::Part for Expr {}
380
381/// A folder in an organization’s resource hierarchy, used to organize that organization’s resources.
382///
383/// # Activities
384///
385/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
386/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
387///
388/// * [capabilities get folders](FolderCapabilityGetCall) (none)
389/// * [capabilities patch folders](FolderCapabilityPatchCall) (none)
390/// * [create folders](FolderCreateCall) (request)
391/// * [delete folders](FolderDeleteCall) (none)
392/// * [get folders](FolderGetCall) (response)
393/// * [get iam policy folders](FolderGetIamPolicyCall) (none)
394/// * [list folders](FolderListCall) (none)
395/// * [move folders](FolderMoveCall) (none)
396/// * [patch folders](FolderPatchCall) (request)
397/// * [search folders](FolderSearchCall) (none)
398/// * [set iam policy folders](FolderSetIamPolicyCall) (none)
399/// * [test iam permissions folders](FolderTestIamPermissionCall) (none)
400/// * [undelete folders](FolderUndeleteCall) (none)
401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
402#[serde_with::serde_as]
403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
404pub struct Folder {
405    /// Output only. Optional capabilities configured for this folder (via UpdateCapability API). Example: `folders/123/capabilities/app-management`.
406    #[serde(rename = "configuredCapabilities")]
407    pub configured_capabilities: Option<Vec<String>>,
408    /// Output only. Timestamp when the folder was created.
409    #[serde(rename = "createTime")]
410    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
411    /// Output only. Timestamp when the folder was requested to be deleted.
412    #[serde(rename = "deleteTime")]
413    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
414    /// The folder’s display name. A folder’s display name must be unique amongst its siblings. For example, no two folders with the same parent can share the same display name. The display name must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be no longer than 30 characters. This is captured by the regular expression: `[\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?`.
415    #[serde(rename = "displayName")]
416    pub display_name: Option<String>,
417    /// Output only. A checksum computed by the server based on the current value of the folder resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
418    pub etag: Option<String>,
419    /// Output only. Management Project associated with this folder (if app-management capability is enabled). Example: `projects/google-mp-123` OUTPUT ONLY.
420    #[serde(rename = "managementProject")]
421    pub management_project: Option<String>,
422    /// Identifier. The resource name of the folder. Its format is `folders/{folder_id}`, for example: "folders/1234".
423    pub name: Option<String>,
424    /// Required. The folder's parent's resource name. Updates to the folder's parent must be performed using MoveFolder.
425    pub parent: Option<String>,
426    /// Output only. The lifecycle state of the folder. Updates to the state must be performed using DeleteFolder and UndeleteFolder.
427    pub state: Option<String>,
428    /// Optional. Input only. Immutable. Tag keys/values directly bound to this folder. Each item in the map must be expressed as " : ". For example: "123/environment" : "production", "123/costCenter" : "marketing" Note: Currently this field is in Preview.
429    pub tags: Option<HashMap<String, String>>,
430    /// Output only. Timestamp when the folder was last modified.
431    #[serde(rename = "updateTime")]
432    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
433}
434
435impl common::RequestValue for Folder {}
436impl common::Resource for Folder {}
437impl common::ResponseResult for Folder {}
438
439/// Request message for `GetIamPolicy` method.
440///
441/// # Activities
442///
443/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
444/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
445///
446/// * [get iam policy folders](FolderGetIamPolicyCall) (request)
447/// * [get iam policy organizations](OrganizationGetIamPolicyCall) (request)
448/// * [get iam policy projects](ProjectGetIamPolicyCall) (request)
449/// * [get iam policy tag keys](TagKeyGetIamPolicyCall) (request)
450/// * [get iam policy tag values](TagValueGetIamPolicyCall) (request)
451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
452#[serde_with::serde_as]
453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
454pub struct GetIamPolicyRequest {
455    /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`.
456    pub options: Option<GetPolicyOptions>,
457}
458
459impl common::RequestValue for GetIamPolicyRequest {}
460
461/// Encapsulates settings provided to GetIamPolicy.
462///
463/// This type is not used in any activity, and only used as *part* of another schema.
464///
465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
466#[serde_with::serde_as]
467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
468pub struct GetPolicyOptions {
469    /// 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).
470    #[serde(rename = "requestedPolicyVersion")]
471    pub requested_policy_version: Option<i32>,
472}
473
474impl common::Part for GetPolicyOptions {}
475
476/// A Lien represents an encumbrance on the actions that can be performed on a resource.
477///
478/// # Activities
479///
480/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
481/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
482///
483/// * [create liens](LienCreateCall) (request|response)
484/// * [delete liens](LienDeleteCall) (none)
485/// * [get liens](LienGetCall) (response)
486/// * [list liens](LienListCall) (none)
487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
488#[serde_with::serde_as]
489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
490pub struct Lien {
491    /// The creation time of this Lien.
492    #[serde(rename = "createTime")]
493    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
494    /// A system-generated unique identifier for this Lien. Example: `liens/1234abcd`
495    pub name: Option<String>,
496    /// A stable, user-visible/meaningful string identifying the origin of the Lien, intended to be inspected programmatically. Maximum length of 200 characters. Example: 'compute.googleapis.com'
497    pub origin: Option<String>,
498    /// A reference to the resource this Lien is attached to. The server will validate the parent against those for which Liens are supported. Example: `projects/1234`
499    pub parent: Option<String>,
500    /// Concise user-visible strings indicating why an action cannot be performed on a resource. Maximum length of 200 characters. Example: 'Holds production API key'
501    pub reason: Option<String>,
502    /// The types of operations which should be blocked as a result of this Lien. Each value should correspond to an IAM permission. The server will validate the permissions against those for which Liens are supported. An empty list is meaningless and will be rejected. Example: ['resourcemanager.projects.delete']
503    pub restrictions: Option<Vec<String>>,
504}
505
506impl common::RequestValue for Lien {}
507impl common::Resource for Lien {}
508impl common::ResponseResult for Lien {}
509
510/// The response of ListEffectiveTags.
511///
512/// # Activities
513///
514/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
515/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
516///
517/// * [list effective tags](EffectiveTagListCall) (response)
518#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
519#[serde_with::serde_as]
520#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
521pub struct ListEffectiveTagsResponse {
522    /// A possibly paginated list of effective tags for the specified resource.
523    #[serde(rename = "effectiveTags")]
524    pub effective_tags: Option<Vec<EffectiveTag>>,
525    /// 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.
526    #[serde(rename = "nextPageToken")]
527    pub next_page_token: Option<String>,
528}
529
530impl common::ResponseResult for ListEffectiveTagsResponse {}
531
532/// The ListFolders response message.
533///
534/// # Activities
535///
536/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
537/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
538///
539/// * [list folders](FolderListCall) (response)
540#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
541#[serde_with::serde_as]
542#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
543pub struct ListFoldersResponse {
544    /// A possibly paginated list of folders that are direct descendants of the specified parent resource.
545    pub folders: Option<Vec<Folder>>,
546    /// A pagination token returned from a previous call to `ListFolders` that indicates from where listing should continue.
547    #[serde(rename = "nextPageToken")]
548    pub next_page_token: Option<String>,
549}
550
551impl common::ResponseResult for ListFoldersResponse {}
552
553/// The response message for Liens.ListLiens.
554///
555/// # Activities
556///
557/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
558/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
559///
560/// * [list liens](LienListCall) (response)
561#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
562#[serde_with::serde_as]
563#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
564pub struct ListLiensResponse {
565    /// A list of Liens.
566    pub liens: Option<Vec<Lien>>,
567    /// Token to retrieve the next page of results, or empty if there are no more results in the list.
568    #[serde(rename = "nextPageToken")]
569    pub next_page_token: Option<String>,
570}
571
572impl common::ResponseResult for ListLiensResponse {}
573
574/// 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. NOTE: A response may contain fewer elements than the request `page_size` and still have a `next_page_token`.
575///
576/// # Activities
577///
578/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
579/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
580///
581/// * [list projects](ProjectListCall) (response)
582#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
583#[serde_with::serde_as]
584#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
585pub struct ListProjectsResponse {
586    /// 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.
587    #[serde(rename = "nextPageToken")]
588    pub next_page_token: Option<String>,
589    /// The list of Projects under the parent. This list can be paginated.
590    pub projects: Option<Vec<Project>>,
591}
592
593impl common::ResponseResult for ListProjectsResponse {}
594
595/// The ListTagBindings response.
596///
597/// # Activities
598///
599/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
600/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
601///
602/// * [list tag bindings](TagBindingListCall) (response)
603#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
604#[serde_with::serde_as]
605#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
606pub struct ListTagBindingsResponse {
607    /// 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.
608    #[serde(rename = "nextPageToken")]
609    pub next_page_token: Option<String>,
610    /// A possibly paginated list of TagBindings for the specified resource.
611    #[serde(rename = "tagBindings")]
612    pub tag_bindings: Option<Vec<TagBinding>>,
613}
614
615impl common::ResponseResult for ListTagBindingsResponse {}
616
617/// The ListTagHolds response.
618///
619/// # Activities
620///
621/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
622/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
623///
624/// * [tag holds list tag values](TagValueTagHoldListCall) (response)
625#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
626#[serde_with::serde_as]
627#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
628pub struct ListTagHoldsResponse {
629    /// 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.
630    #[serde(rename = "nextPageToken")]
631    pub next_page_token: Option<String>,
632    /// A possibly paginated list of TagHolds.
633    #[serde(rename = "tagHolds")]
634    pub tag_holds: Option<Vec<TagHold>>,
635}
636
637impl common::ResponseResult for ListTagHoldsResponse {}
638
639/// The ListTagKeys response message.
640///
641/// # Activities
642///
643/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
644/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
645///
646/// * [list tag keys](TagKeyListCall) (response)
647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
648#[serde_with::serde_as]
649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
650pub struct ListTagKeysResponse {
651    /// A pagination token returned from a previous call to `ListTagKeys` that indicates from where listing should continue.
652    #[serde(rename = "nextPageToken")]
653    pub next_page_token: Option<String>,
654    /// List of TagKeys that live under the specified parent in the request.
655    #[serde(rename = "tagKeys")]
656    pub tag_keys: Option<Vec<TagKey>>,
657}
658
659impl common::ResponseResult for ListTagKeysResponse {}
660
661/// The ListTagValues response.
662///
663/// # Activities
664///
665/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
666/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
667///
668/// * [list tag values](TagValueListCall) (response)
669#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
670#[serde_with::serde_as]
671#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
672pub struct ListTagValuesResponse {
673    /// A pagination token returned from a previous call to `ListTagValues` that indicates from where listing should continue.
674    #[serde(rename = "nextPageToken")]
675    pub next_page_token: Option<String>,
676    /// A possibly paginated list of TagValues that are direct descendants of the specified parent TagKey.
677    #[serde(rename = "tagValues")]
678    pub tag_values: Option<Vec<TagValue>>,
679}
680
681impl common::ResponseResult for ListTagValuesResponse {}
682
683/// The MoveFolder request message.
684///
685/// # Activities
686///
687/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
688/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
689///
690/// * [move folders](FolderMoveCall) (request)
691#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
692#[serde_with::serde_as]
693#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
694pub struct MoveFolderRequest {
695    /// Required. The resource name of the folder or organization which should be the folder's new parent. Must be of the form `folders/{folder_id}` or `organizations/{org_id}`.
696    #[serde(rename = "destinationParent")]
697    pub destination_parent: Option<String>,
698}
699
700impl common::RequestValue for MoveFolderRequest {}
701
702/// The request sent to MoveProject method.
703///
704/// # Activities
705///
706/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
707/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
708///
709/// * [move projects](ProjectMoveCall) (request)
710#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
711#[serde_with::serde_as]
712#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
713pub struct MoveProjectRequest {
714    /// Required. The new parent to move the Project under.
715    #[serde(rename = "destinationParent")]
716    pub destination_parent: Option<String>,
717}
718
719impl common::RequestValue for MoveProjectRequest {}
720
721/// This resource represents a long-running operation that is the result of a network API call.
722///
723/// # Activities
724///
725/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
726/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
727///
728/// * [capabilities patch folders](FolderCapabilityPatchCall) (response)
729/// * [create folders](FolderCreateCall) (response)
730/// * [delete folders](FolderDeleteCall) (response)
731/// * [move folders](FolderMoveCall) (response)
732/// * [patch folders](FolderPatchCall) (response)
733/// * [undelete folders](FolderUndeleteCall) (response)
734/// * [tag binding collections patch locations](LocationTagBindingCollectionPatchCall) (response)
735/// * [get operations](OperationGetCall) (response)
736/// * [create projects](ProjectCreateCall) (response)
737/// * [delete projects](ProjectDeleteCall) (response)
738/// * [move projects](ProjectMoveCall) (response)
739/// * [patch projects](ProjectPatchCall) (response)
740/// * [undelete projects](ProjectUndeleteCall) (response)
741/// * [create tag bindings](TagBindingCreateCall) (response)
742/// * [delete tag bindings](TagBindingDeleteCall) (response)
743/// * [create tag keys](TagKeyCreateCall) (response)
744/// * [delete tag keys](TagKeyDeleteCall) (response)
745/// * [patch tag keys](TagKeyPatchCall) (response)
746/// * [tag holds create tag values](TagValueTagHoldCreateCall) (response)
747/// * [tag holds delete tag values](TagValueTagHoldDeleteCall) (response)
748/// * [create tag values](TagValueCreateCall) (response)
749/// * [delete tag values](TagValueDeleteCall) (response)
750/// * [patch tag values](TagValuePatchCall) (response)
751#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
752#[serde_with::serde_as]
753#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
754pub struct Operation {
755    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
756    pub done: Option<bool>,
757    /// The error result of the operation in case of failure or cancellation.
758    pub error: Option<Status>,
759    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
760    pub metadata: Option<HashMap<String, serde_json::Value>>,
761    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
762    pub name: Option<String>,
763    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
764    pub response: Option<HashMap<String, serde_json::Value>>,
765}
766
767impl common::Resource for Operation {}
768impl common::ResponseResult for Operation {}
769
770/// The root node in the resource hierarchy to which a particular entity’s (a company, for example) resources belong.
771///
772/// # Activities
773///
774/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
775/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
776///
777/// * [get organizations](OrganizationGetCall) (response)
778/// * [get iam policy organizations](OrganizationGetIamPolicyCall) (none)
779/// * [search organizations](OrganizationSearchCall) (none)
780/// * [set iam policy organizations](OrganizationSetIamPolicyCall) (none)
781/// * [test iam permissions organizations](OrganizationTestIamPermissionCall) (none)
782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
783#[serde_with::serde_as]
784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
785pub struct Organization {
786    /// Output only. Timestamp when the Organization was created.
787    #[serde(rename = "createTime")]
788    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
789    /// Output only. Timestamp when the Organization was requested for deletion.
790    #[serde(rename = "deleteTime")]
791    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
792    /// Immutable. The G Suite / Workspace customer id used in the Directory API.
793    #[serde(rename = "directoryCustomerId")]
794    pub directory_customer_id: Option<String>,
795    /// Output only. 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 Google Workspace customer that owns the organization.
796    #[serde(rename = "displayName")]
797    pub display_name: Option<String>,
798    /// Output only. A checksum computed by the server based on the current value of the Organization resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
799    pub etag: Option<String>,
800    /// 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".
801    pub name: Option<String>,
802    /// Output only. The organization's current lifecycle state.
803    pub state: Option<String>,
804    /// Output only. Timestamp when the Organization was last modified.
805    #[serde(rename = "updateTime")]
806    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
807}
808
809impl common::Resource for Organization {}
810impl common::ResponseResult for Organization {}
811
812/// 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/).
813///
814/// # Activities
815///
816/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
817/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
818///
819/// * [get iam policy folders](FolderGetIamPolicyCall) (response)
820/// * [set iam policy folders](FolderSetIamPolicyCall) (response)
821/// * [get iam policy organizations](OrganizationGetIamPolicyCall) (response)
822/// * [set iam policy organizations](OrganizationSetIamPolicyCall) (response)
823/// * [get iam policy projects](ProjectGetIamPolicyCall) (response)
824/// * [set iam policy projects](ProjectSetIamPolicyCall) (response)
825/// * [get iam policy tag keys](TagKeyGetIamPolicyCall) (response)
826/// * [set iam policy tag keys](TagKeySetIamPolicyCall) (response)
827/// * [get iam policy tag values](TagValueGetIamPolicyCall) (response)
828/// * [set iam policy tag values](TagValueSetIamPolicyCall) (response)
829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
830#[serde_with::serde_as]
831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
832pub struct Policy {
833    /// Specifies cloud audit logging configuration for this policy.
834    #[serde(rename = "auditConfigs")]
835    pub audit_configs: Option<Vec<AuditConfig>>,
836    /// 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`.
837    pub bindings: Option<Vec<Binding>>,
838    /// `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.
839    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
840    pub etag: Option<Vec<u8>>,
841    /// 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).
842    pub version: Option<i32>,
843}
844
845impl common::ResponseResult for Policy {}
846
847/// A project is a high-level Google Cloud entity. It is a container for ACLs, APIs, App Engine Apps, VMs, and other Google Cloud Platform resources.
848///
849/// # Activities
850///
851/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
852/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
853///
854/// * [create projects](ProjectCreateCall) (request)
855/// * [delete projects](ProjectDeleteCall) (none)
856/// * [get projects](ProjectGetCall) (response)
857/// * [get iam policy projects](ProjectGetIamPolicyCall) (none)
858/// * [list projects](ProjectListCall) (none)
859/// * [move projects](ProjectMoveCall) (none)
860/// * [patch projects](ProjectPatchCall) (request)
861/// * [search projects](ProjectSearchCall) (none)
862/// * [set iam policy projects](ProjectSetIamPolicyCall) (none)
863/// * [test iam permissions projects](ProjectTestIamPermissionCall) (none)
864/// * [undelete projects](ProjectUndeleteCall) (none)
865#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
866#[serde_with::serde_as]
867#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
868pub struct Project {
869    /// 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.
870    #[serde(rename = "configuredCapabilities")]
871    pub configured_capabilities: Option<Vec<String>>,
872    /// Output only. Creation time.
873    #[serde(rename = "createTime")]
874    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
875    /// Output only. The time at which this resource was requested for deletion.
876    #[serde(rename = "deleteTime")]
877    pub delete_time: Option<chrono::DateTime<chrono::offset::Utc>>,
878    /// Optional. A 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`
879    #[serde(rename = "displayName")]
880    pub display_name: Option<String>,
881    /// Output only. A checksum computed by the server based on the current value of the Project resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
882    pub etag: Option<String>,
883    /// Optional. 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\](\[-a-z0-9\]*\[a-z0-9\])?. Label values must be between 0 and 63 characters long and must conform to the regular expression (\[a-z\](\[-a-z0-9\]*\[a-z0-9\])?)?. No more than 64 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: `"myBusinessDimension" : "businessValue"`
884    pub labels: Option<HashMap<String, String>>,
885    /// Output only. The unique resource name of the project. It is an int64 generated number prefixed by "projects/". Example: `projects/415104041262`
886    pub name: Option<String>,
887    /// Optional. A reference to a parent Resource. eg., `organizations/123` or `folders/876`.
888    pub parent: Option<String>,
889    /// Immutable. The unique, user-assigned id of the project. It must be 6 to 30 lowercase ASCII letters, digits, or hyphens. It must start with a letter. Trailing hyphens are prohibited. Example: `tokyo-rain-123`
890    #[serde(rename = "projectId")]
891    pub project_id: Option<String>,
892    /// Output only. The project lifecycle state.
893    pub state: Option<String>,
894    /// Optional. Input only. Immutable. Tag keys/values directly bound to this project. Each item in the map must be expressed as " : ". For example: "123/environment" : "production", "123/costCenter" : "marketing" Note: Currently this field is in Preview.
895    pub tags: Option<HashMap<String, String>>,
896    /// Output only. The most recent time this resource was modified.
897    #[serde(rename = "updateTime")]
898    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
899}
900
901impl common::RequestValue for Project {}
902impl common::Resource for Project {}
903impl common::ResponseResult for Project {}
904
905/// The response message for searching folders.
906///
907/// # Activities
908///
909/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
910/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
911///
912/// * [search folders](FolderSearchCall) (response)
913#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
914#[serde_with::serde_as]
915#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
916pub struct SearchFoldersResponse {
917    /// A possibly paginated folder search results. the specified parent resource.
918    pub folders: Option<Vec<Folder>>,
919    /// A pagination token returned from a previous call to `SearchFolders` that indicates from where searching should continue.
920    #[serde(rename = "nextPageToken")]
921    pub next_page_token: Option<String>,
922}
923
924impl common::ResponseResult for SearchFoldersResponse {}
925
926/// The response returned from the `SearchOrganizations` method.
927///
928/// # Activities
929///
930/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
931/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
932///
933/// * [search organizations](OrganizationSearchCall) (response)
934#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
935#[serde_with::serde_as]
936#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
937pub struct SearchOrganizationsResponse {
938    /// 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.
939    #[serde(rename = "nextPageToken")]
940    pub next_page_token: Option<String>,
941    /// The list of Organizations that matched the search query, possibly paginated.
942    pub organizations: Option<Vec<Organization>>,
943}
944
945impl common::ResponseResult for SearchOrganizationsResponse {}
946
947/// A page of the response received from the SearchProjects 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.
948///
949/// # Activities
950///
951/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
952/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
953///
954/// * [search projects](ProjectSearchCall) (response)
955#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
956#[serde_with::serde_as]
957#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
958pub struct SearchProjectsResponse {
959    /// 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.
960    #[serde(rename = "nextPageToken")]
961    pub next_page_token: Option<String>,
962    /// The list of Projects that matched the list filter query. This list can be paginated.
963    pub projects: Option<Vec<Project>>,
964}
965
966impl common::ResponseResult for SearchProjectsResponse {}
967
968/// Request message for `SetIamPolicy` method.
969///
970/// # Activities
971///
972/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
973/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
974///
975/// * [set iam policy folders](FolderSetIamPolicyCall) (request)
976/// * [set iam policy organizations](OrganizationSetIamPolicyCall) (request)
977/// * [set iam policy projects](ProjectSetIamPolicyCall) (request)
978/// * [set iam policy tag keys](TagKeySetIamPolicyCall) (request)
979/// * [set iam policy tag values](TagValueSetIamPolicyCall) (request)
980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
981#[serde_with::serde_as]
982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
983pub struct SetIamPolicyRequest {
984    /// 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.
985    pub policy: Option<Policy>,
986    /// 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"`
987    #[serde(rename = "updateMask")]
988    pub update_mask: Option<common::FieldMask>,
989}
990
991impl common::RequestValue for SetIamPolicyRequest {}
992
993/// The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
994///
995/// This type is not used in any activity, and only used as *part* of another schema.
996///
997#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
998#[serde_with::serde_as]
999#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1000pub struct Status {
1001    /// The status code, which should be an enum value of google.rpc.Code.
1002    pub code: Option<i32>,
1003    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1004    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1005    /// A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
1006    pub message: Option<String>,
1007}
1008
1009impl common::Part for Status {}
1010
1011/// A TagBinding represents a connection between a TagValue and a cloud resource Once a TagBinding is created, the TagValue is applied to all the descendants of the Google Cloud resource.
1012///
1013/// # Activities
1014///
1015/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1016/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1017///
1018/// * [create tag bindings](TagBindingCreateCall) (request)
1019/// * [delete tag bindings](TagBindingDeleteCall) (none)
1020/// * [list tag bindings](TagBindingListCall) (none)
1021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1022#[serde_with::serde_as]
1023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1024pub struct TagBinding {
1025    /// Output only. The name of the TagBinding. This is a String of the form: `tagBindings/{full-resource-name}/{tag-value-name}` (e.g. `tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456`).
1026    pub name: Option<String>,
1027    /// The full resource name of the resource the TagValue is bound to. E.g. `//cloudresourcemanager.googleapis.com/projects/123`
1028    pub parent: Option<String>,
1029    /// The TagValue of the TagBinding. Must be of the form `tagValues/456`.
1030    #[serde(rename = "tagValue")]
1031    pub tag_value: Option<String>,
1032    /// The namespaced name for the TagValue of the TagBinding. Must be in the format `{parent_id}/{tag_key_short_name}/{short_name}`. For methods that support TagValue namespaced name, only one of tag_value_namespaced_name or tag_value may be filled. Requests with both fields will be rejected.
1033    #[serde(rename = "tagValueNamespacedName")]
1034    pub tag_value_namespaced_name: Option<String>,
1035}
1036
1037impl common::RequestValue for TagBinding {}
1038impl common::Resource for TagBinding {}
1039
1040/// Represents a collection of tags directly bound to a GCP resource.
1041///
1042/// # Activities
1043///
1044/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1045/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1046///
1047/// * [tag binding collections get locations](LocationTagBindingCollectionGetCall) (response)
1048/// * [tag binding collections patch locations](LocationTagBindingCollectionPatchCall) (request)
1049#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1050#[serde_with::serde_as]
1051#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1052pub struct TagBindingCollection {
1053    /// Optional. A checksum based on the current bindings which can be passed to prevent race conditions. This field is always set in server responses.
1054    pub etag: Option<String>,
1055    /// The full resource name of the resource the TagBindings are bound to. E.g. `//cloudresourcemanager.googleapis.com/projects/123`
1056    #[serde(rename = "fullResourceName")]
1057    pub full_resource_name: Option<String>,
1058    /// Identifier. The name of the TagBindingCollection, following the convention: `locations/{location}/tagBindingCollections/{encoded-full-resource-name}` where the encoded-full-resource-name is the UTF-8 encoded name of the GCP resource the TagBindings are bound to. "locations/global/tagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
1059    pub name: Option<String>,
1060    /// Tag keys/values directly bound to this resource, specified in namespaced format. For example: "123/environment": "production"
1061    pub tags: Option<HashMap<String, String>>,
1062}
1063
1064impl common::RequestValue for TagBindingCollection {}
1065impl common::ResponseResult for TagBindingCollection {}
1066
1067/// A TagHold represents the use of a TagValue that is not captured by TagBindings. If a TagValue has any TagHolds, deletion will be blocked. This resource is intended to be created in the same cloud location as the `holder`.
1068///
1069/// # Activities
1070///
1071/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1072/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1073///
1074/// * [tag holds create tag values](TagValueTagHoldCreateCall) (request)
1075#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1076#[serde_with::serde_as]
1077#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1078pub struct TagHold {
1079    /// Output only. The time this TagHold was created.
1080    #[serde(rename = "createTime")]
1081    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1082    /// Optional. A URL where an end user can learn more about removing this hold. E.g. `https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing`
1083    #[serde(rename = "helpLink")]
1084    pub help_link: Option<String>,
1085    /// Required. The name of the resource where the TagValue is being used. Must be less than 200 characters. E.g. `//compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group`
1086    pub holder: Option<String>,
1087    /// Output only. The resource name of a TagHold. This is a String of the form: `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}` (e.g. `tagValues/123/tagHolds/456`). This resource name is generated by the server.
1088    pub name: Option<String>,
1089    /// Optional. An optional string representing the origin of this request. This field should include human-understandable information to distinguish origins from each other. Must be less than 200 characters. E.g. `migs-35678234`
1090    pub origin: Option<String>,
1091}
1092
1093impl common::RequestValue for TagHold {}
1094
1095/// A TagKey, used to group a set of TagValues.
1096///
1097/// # Activities
1098///
1099/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1100/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1101///
1102/// * [create tag keys](TagKeyCreateCall) (request)
1103/// * [delete tag keys](TagKeyDeleteCall) (none)
1104/// * [get tag keys](TagKeyGetCall) (response)
1105/// * [get iam policy tag keys](TagKeyGetIamPolicyCall) (none)
1106/// * [get namespaced tag keys](TagKeyGetNamespacedCall) (response)
1107/// * [list tag keys](TagKeyListCall) (none)
1108/// * [patch tag keys](TagKeyPatchCall) (request)
1109/// * [set iam policy tag keys](TagKeySetIamPolicyCall) (none)
1110/// * [test iam permissions tag keys](TagKeyTestIamPermissionCall) (none)
1111#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1112#[serde_with::serde_as]
1113#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1114pub struct TagKey {
1115    /// Optional. Regular expression constraint for freeform tag values. If present, it implicitly allows freeform values (constrained by the regex).
1116    #[serde(rename = "allowedValuesRegex")]
1117    pub allowed_values_regex: Option<String>,
1118    /// Output only. Creation time.
1119    #[serde(rename = "createTime")]
1120    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1121    /// Optional. User-assigned description of the TagKey. Must not exceed 256 characters. Read-write.
1122    pub description: Option<String>,
1123    /// Optional. Entity tag which users can pass to prevent race conditions. This field is always set in server responses. See UpdateTagKeyRequest for details.
1124    pub etag: Option<String>,
1125    /// Immutable. The resource name for a TagKey. Must be in the format `tagKeys/{tag_key_id}`, where `tag_key_id` is the generated numeric id for the TagKey.
1126    pub name: Option<String>,
1127    /// Output only. Immutable. Namespaced name of the TagKey.
1128    #[serde(rename = "namespacedName")]
1129    pub namespaced_name: Option<String>,
1130    /// Immutable. The resource name of the TagKey's parent. A TagKey can be parented by an Organization or a Project. For a TagKey parented by an Organization, its parent must be in the form `organizations/{org_id}`. For a TagKey parented by a Project, its parent can be in the form `projects/{project_id}` or `projects/{project_number}`.
1131    pub parent: Option<String>,
1132    /// Optional. A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. A purpose does not grant a policy engine exclusive rights to the Tag, and it may be referenced by other policy engines. A purpose cannot be changed once set.
1133    pub purpose: Option<String>,
1134    /// Optional. Purpose data corresponds to the policy system that the tag is intended for. See documentation for `Purpose` for formatting of this field. Purpose data cannot be changed once set.
1135    #[serde(rename = "purposeData")]
1136    pub purpose_data: Option<HashMap<String, String>>,
1137    /// Required. Immutable. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace. The short name must be 1-256 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
1138    #[serde(rename = "shortName")]
1139    pub short_name: Option<String>,
1140    /// Output only. Update time.
1141    #[serde(rename = "updateTime")]
1142    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1143}
1144
1145impl common::RequestValue for TagKey {}
1146impl common::Resource for TagKey {}
1147impl common::ResponseResult for TagKey {}
1148
1149/// A TagValue is a child of a particular TagKey. This is used to group cloud resources for the purpose of controlling them using policies.
1150///
1151/// # Activities
1152///
1153/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1154/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1155///
1156/// * [tag holds create tag values](TagValueTagHoldCreateCall) (none)
1157/// * [tag holds delete tag values](TagValueTagHoldDeleteCall) (none)
1158/// * [tag holds list tag values](TagValueTagHoldListCall) (none)
1159/// * [create tag values](TagValueCreateCall) (request)
1160/// * [delete tag values](TagValueDeleteCall) (none)
1161/// * [get tag values](TagValueGetCall) (response)
1162/// * [get iam policy tag values](TagValueGetIamPolicyCall) (none)
1163/// * [get namespaced tag values](TagValueGetNamespacedCall) (response)
1164/// * [list tag values](TagValueListCall) (none)
1165/// * [patch tag values](TagValuePatchCall) (request)
1166/// * [set iam policy tag values](TagValueSetIamPolicyCall) (none)
1167/// * [test iam permissions tag values](TagValueTestIamPermissionCall) (none)
1168#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1169#[serde_with::serde_as]
1170#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1171pub struct TagValue {
1172    /// Output only. Creation time.
1173    #[serde(rename = "createTime")]
1174    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1175    /// Optional. User-assigned description of the TagValue. Must not exceed 256 characters. Read-write.
1176    pub description: Option<String>,
1177    /// Optional. Entity tag which users can pass to prevent race conditions. This field is always set in server responses. See UpdateTagValueRequest for details.
1178    pub etag: Option<String>,
1179    /// Immutable. Resource name for TagValue in the format `tagValues/456`.
1180    pub name: Option<String>,
1181    /// Output only. The namespaced name of the TagValue. Can be in the form `{organization_id}/{tag_key_short_name}/{tag_value_short_name}` or `{project_id}/{tag_key_short_name}/{tag_value_short_name}` or `{project_number}/{tag_key_short_name}/{tag_value_short_name}`.
1182    #[serde(rename = "namespacedName")]
1183    pub namespaced_name: Option<String>,
1184    /// Immutable. The resource name of the new TagValue's parent TagKey. Must be of the form `tagKeys/{tag_key_id}`.
1185    pub parent: Option<String>,
1186    /// Required. Immutable. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey. The short name must be 256 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between.
1187    #[serde(rename = "shortName")]
1188    pub short_name: Option<String>,
1189    /// Output only. Update time.
1190    #[serde(rename = "updateTime")]
1191    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1192}
1193
1194impl common::RequestValue for TagValue {}
1195impl common::Resource for TagValue {}
1196impl common::ResponseResult for TagValue {}
1197
1198/// Request message for `TestIamPermissions` method.
1199///
1200/// # Activities
1201///
1202/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1203/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1204///
1205/// * [test iam permissions folders](FolderTestIamPermissionCall) (request)
1206/// * [test iam permissions organizations](OrganizationTestIamPermissionCall) (request)
1207/// * [test iam permissions projects](ProjectTestIamPermissionCall) (request)
1208/// * [test iam permissions tag keys](TagKeyTestIamPermissionCall) (request)
1209/// * [test iam permissions tag values](TagValueTestIamPermissionCall) (request)
1210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1211#[serde_with::serde_as]
1212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1213pub struct TestIamPermissionsRequest {
1214    /// 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).
1215    pub permissions: Option<Vec<String>>,
1216}
1217
1218impl common::RequestValue for TestIamPermissionsRequest {}
1219
1220/// Response message for `TestIamPermissions` method.
1221///
1222/// # Activities
1223///
1224/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1225/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1226///
1227/// * [test iam permissions folders](FolderTestIamPermissionCall) (response)
1228/// * [test iam permissions organizations](OrganizationTestIamPermissionCall) (response)
1229/// * [test iam permissions projects](ProjectTestIamPermissionCall) (response)
1230/// * [test iam permissions tag keys](TagKeyTestIamPermissionCall) (response)
1231/// * [test iam permissions tag values](TagValueTestIamPermissionCall) (response)
1232#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1233#[serde_with::serde_as]
1234#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1235pub struct TestIamPermissionsResponse {
1236    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1237    pub permissions: Option<Vec<String>>,
1238}
1239
1240impl common::ResponseResult for TestIamPermissionsResponse {}
1241
1242/// The UndeleteFolder request message.
1243///
1244/// # Activities
1245///
1246/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1247/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1248///
1249/// * [undelete folders](FolderUndeleteCall) (request)
1250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1251#[serde_with::serde_as]
1252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1253pub struct UndeleteFolderRequest {
1254    _never_set: Option<bool>,
1255}
1256
1257impl common::RequestValue for UndeleteFolderRequest {}
1258
1259/// The request sent to the UndeleteProject method.
1260///
1261/// # Activities
1262///
1263/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1264/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1265///
1266/// * [undelete projects](ProjectUndeleteCall) (request)
1267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1268#[serde_with::serde_as]
1269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1270pub struct UndeleteProjectRequest {
1271    _never_set: Option<bool>,
1272}
1273
1274impl common::RequestValue for UndeleteProjectRequest {}
1275
1276// ###################
1277// MethodBuilders ###
1278// #################
1279
1280/// A builder providing access to all methods supported on *effectiveTag* resources.
1281/// It is not used directly, but through the [`CloudResourceManager`] hub.
1282///
1283/// # Example
1284///
1285/// Instantiate a resource builder
1286///
1287/// ```test_harness,no_run
1288/// extern crate hyper;
1289/// extern crate hyper_rustls;
1290/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
1291///
1292/// # async fn dox() {
1293/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1294///
1295/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1296/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1297///     .with_native_roots()
1298///     .unwrap()
1299///     .https_only()
1300///     .enable_http2()
1301///     .build();
1302///
1303/// let executor = hyper_util::rt::TokioExecutor::new();
1304/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1305///     secret,
1306///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1307///     yup_oauth2::client::CustomHyperClientBuilder::from(
1308///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1309///     ),
1310/// ).build().await.unwrap();
1311///
1312/// let client = hyper_util::client::legacy::Client::builder(
1313///     hyper_util::rt::TokioExecutor::new()
1314/// )
1315/// .build(
1316///     hyper_rustls::HttpsConnectorBuilder::new()
1317///         .with_native_roots()
1318///         .unwrap()
1319///         .https_or_http()
1320///         .enable_http2()
1321///         .build()
1322/// );
1323/// let mut hub = CloudResourceManager::new(client, auth);
1324/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1325/// // like `list(...)`
1326/// // to build up your call.
1327/// let rb = hub.effective_tags();
1328/// # }
1329/// ```
1330pub struct EffectiveTagMethods<'a, C>
1331where
1332    C: 'a,
1333{
1334    hub: &'a CloudResourceManager<C>,
1335}
1336
1337impl<'a, C> common::MethodsBuilder for EffectiveTagMethods<'a, C> {}
1338
1339impl<'a, C> EffectiveTagMethods<'a, C> {
1340    /// Create a builder to help you perform the following task:
1341    ///
1342    /// Return a list of effective tags for the given Google Cloud resource, as specified in `parent`.
1343    pub fn list(&self) -> EffectiveTagListCall<'a, C> {
1344        EffectiveTagListCall {
1345            hub: self.hub,
1346            _parent: Default::default(),
1347            _page_token: Default::default(),
1348            _page_size: Default::default(),
1349            _delegate: Default::default(),
1350            _additional_params: Default::default(),
1351            _scopes: Default::default(),
1352        }
1353    }
1354}
1355
1356/// A builder providing access to all methods supported on *folder* resources.
1357/// It is not used directly, but through the [`CloudResourceManager`] hub.
1358///
1359/// # Example
1360///
1361/// Instantiate a resource builder
1362///
1363/// ```test_harness,no_run
1364/// extern crate hyper;
1365/// extern crate hyper_rustls;
1366/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
1367///
1368/// # async fn dox() {
1369/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1370///
1371/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1372/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1373///     .with_native_roots()
1374///     .unwrap()
1375///     .https_only()
1376///     .enable_http2()
1377///     .build();
1378///
1379/// let executor = hyper_util::rt::TokioExecutor::new();
1380/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1381///     secret,
1382///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1383///     yup_oauth2::client::CustomHyperClientBuilder::from(
1384///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1385///     ),
1386/// ).build().await.unwrap();
1387///
1388/// let client = hyper_util::client::legacy::Client::builder(
1389///     hyper_util::rt::TokioExecutor::new()
1390/// )
1391/// .build(
1392///     hyper_rustls::HttpsConnectorBuilder::new()
1393///         .with_native_roots()
1394///         .unwrap()
1395///         .https_or_http()
1396///         .enable_http2()
1397///         .build()
1398/// );
1399/// let mut hub = CloudResourceManager::new(client, auth);
1400/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1401/// // like `capabilities_get(...)`, `capabilities_patch(...)`, `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `move_(...)`, `patch(...)`, `search(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` and `undelete(...)`
1402/// // to build up your call.
1403/// let rb = hub.folders();
1404/// # }
1405/// ```
1406pub struct FolderMethods<'a, C>
1407where
1408    C: 'a,
1409{
1410    hub: &'a CloudResourceManager<C>,
1411}
1412
1413impl<'a, C> common::MethodsBuilder for FolderMethods<'a, C> {}
1414
1415impl<'a, C> FolderMethods<'a, C> {
1416    /// Create a builder to help you perform the following task:
1417    ///
1418    /// Retrieves the Capability identified by the supplied resource name.
1419    ///
1420    /// # Arguments
1421    ///
1422    /// * `name` - Required. The name of the capability to get. For example, `folders/123/capabilities/app-management`
1423    pub fn capabilities_get(&self, name: &str) -> FolderCapabilityGetCall<'a, C> {
1424        FolderCapabilityGetCall {
1425            hub: self.hub,
1426            _name: name.to_string(),
1427            _delegate: Default::default(),
1428            _additional_params: Default::default(),
1429            _scopes: Default::default(),
1430        }
1431    }
1432
1433    /// Create a builder to help you perform the following task:
1434    ///
1435    /// Updates the Capability.
1436    ///
1437    /// # Arguments
1438    ///
1439    /// * `request` - No description provided.
1440    /// * `name` - Immutable. Identifier. The resource name of the capability. Must be in the following form: * `folders/{folder_id}/capabilities/{capability_name}` For example, `folders/123/capabilities/app-management` Following are the allowed {capability_name} values: * `app-management`
1441    pub fn capabilities_patch(
1442        &self,
1443        request: Capability,
1444        name: &str,
1445    ) -> FolderCapabilityPatchCall<'a, C> {
1446        FolderCapabilityPatchCall {
1447            hub: self.hub,
1448            _request: request,
1449            _name: name.to_string(),
1450            _update_mask: Default::default(),
1451            _delegate: Default::default(),
1452            _additional_params: Default::default(),
1453            _scopes: Default::default(),
1454        }
1455    }
1456
1457    /// Create a builder to help you perform the following task:
1458    ///
1459    /// Creates a folder in the resource hierarchy. Returns an `Operation` which can be used to track the progress of the folder creation workflow. Upon success, the `Operation.response` field will be populated with the created Folder. In order to succeed, the addition of this new folder must not violate the folder naming, height, or fanout constraints. + The folder's `display_name` must be distinct from all other folders that share its parent. + The addition of the folder must not cause the active folder hierarchy to exceed a height of 10. Note, the full active + deleted folder hierarchy is allowed to reach a height of 20; this provides additional headroom when moving folders that contain deleted folders. + The addition of the folder must not cause the total number of folders under its parent to exceed 300. If the operation fails due to a folder constraint violation, some errors may be returned by the `CreateFolder` request, with status code `FAILED_PRECONDITION` and an error description. Other folder constraint violations will be communicated in the `Operation`, with the specific `PreconditionFailure` returned in the details list in the `Operation.error` field. The caller must have `resourcemanager.folders.create` permission on the identified parent.
1460    ///
1461    /// # Arguments
1462    ///
1463    /// * `request` - No description provided.
1464    pub fn create(&self, request: Folder) -> FolderCreateCall<'a, C> {
1465        FolderCreateCall {
1466            hub: self.hub,
1467            _request: request,
1468            _delegate: Default::default(),
1469            _additional_params: Default::default(),
1470            _scopes: Default::default(),
1471        }
1472    }
1473
1474    /// Create a builder to help you perform the following task:
1475    ///
1476    /// Requests deletion of a folder. The folder is moved into the DELETE_REQUESTED state immediately, and is deleted approximately 30 days later. This method may only be called on an empty folder, where a folder is empty if it doesn't contain any folders or projects in the ACTIVE state. If called on a folder in DELETE_REQUESTED state the operation will result in a no-op success. The caller must have `resourcemanager.folders.delete` permission on the identified folder.
1477    ///
1478    /// # Arguments
1479    ///
1480    /// * `name` - Required. The resource name of the folder to be deleted. Must be of the form `folders/{folder_id}`.
1481    pub fn delete(&self, name: &str) -> FolderDeleteCall<'a, C> {
1482        FolderDeleteCall {
1483            hub: self.hub,
1484            _name: name.to_string(),
1485            _delegate: Default::default(),
1486            _additional_params: Default::default(),
1487            _scopes: Default::default(),
1488        }
1489    }
1490
1491    /// Create a builder to help you perform the following task:
1492    ///
1493    /// Retrieves a folder identified by the supplied resource name. Valid folder resource names have the format `folders/{folder_id}` (for example, `folders/1234`). The caller must have `resourcemanager.folders.get` permission on the identified folder.
1494    ///
1495    /// # Arguments
1496    ///
1497    /// * `name` - Required. The resource name of the folder to retrieve. Must be of the form `folders/{folder_id}`.
1498    pub fn get(&self, name: &str) -> FolderGetCall<'a, C> {
1499        FolderGetCall {
1500            hub: self.hub,
1501            _name: name.to_string(),
1502            _delegate: Default::default(),
1503            _additional_params: Default::default(),
1504            _scopes: Default::default(),
1505        }
1506    }
1507
1508    /// Create a builder to help you perform the following task:
1509    ///
1510    /// Gets the access control policy for a folder. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the folder's resource name, for example: "folders/1234". The caller must have `resourcemanager.folders.getIamPolicy` permission on the identified folder.
1511    ///
1512    /// # Arguments
1513    ///
1514    /// * `request` - No description provided.
1515    /// * `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.
1516    pub fn get_iam_policy(
1517        &self,
1518        request: GetIamPolicyRequest,
1519        resource: &str,
1520    ) -> FolderGetIamPolicyCall<'a, C> {
1521        FolderGetIamPolicyCall {
1522            hub: self.hub,
1523            _request: request,
1524            _resource: resource.to_string(),
1525            _delegate: Default::default(),
1526            _additional_params: Default::default(),
1527            _scopes: Default::default(),
1528        }
1529    }
1530
1531    /// Create a builder to help you perform the following task:
1532    ///
1533    /// Lists the folders that are direct descendants of supplied parent resource. `list()` provides a strongly consistent view of the folders underneath the specified parent resource. `list()` returns folders sorted based upon the (ascending) lexical ordering of their display_name. The caller must have `resourcemanager.folders.list` permission on the identified parent.
1534    pub fn list(&self) -> FolderListCall<'a, C> {
1535        FolderListCall {
1536            hub: self.hub,
1537            _show_deleted: Default::default(),
1538            _parent: Default::default(),
1539            _page_token: Default::default(),
1540            _page_size: Default::default(),
1541            _delegate: Default::default(),
1542            _additional_params: Default::default(),
1543            _scopes: Default::default(),
1544        }
1545    }
1546
1547    /// Create a builder to help you perform the following task:
1548    ///
1549    /// Moves a folder under a new resource parent. Returns an `Operation` which can be used to track the progress of the folder move workflow. Upon success, the `Operation.response` field will be populated with the moved folder. Upon failure, a `FolderOperationError` categorizing the failure cause will be returned - if the failure occurs synchronously then the `FolderOperationError` will be returned in the `Status.details` field. If it occurs asynchronously, then the FolderOperation will be returned in the `Operation.error` field. In addition, the `Operation.metadata` field will be populated with a `FolderOperation` message as an aid to stateless clients. Folder moves will be rejected if they violate either the naming, height, or fanout constraints described in the CreateFolder documentation. The caller must have `resourcemanager.folders.move` permission on the folder's current and proposed new parent.
1550    ///
1551    /// # Arguments
1552    ///
1553    /// * `request` - No description provided.
1554    /// * `name` - Required. The resource name of the Folder to move. Must be of the form folders/{folder_id}
1555    pub fn move_(&self, request: MoveFolderRequest, name: &str) -> FolderMoveCall<'a, C> {
1556        FolderMoveCall {
1557            hub: self.hub,
1558            _request: request,
1559            _name: name.to_string(),
1560            _delegate: Default::default(),
1561            _additional_params: Default::default(),
1562            _scopes: Default::default(),
1563        }
1564    }
1565
1566    /// Create a builder to help you perform the following task:
1567    ///
1568    /// Updates a folder, changing its `display_name`. Changes to the folder `display_name` will be rejected if they violate either the `display_name` formatting rules or the naming constraints described in the CreateFolder documentation. The folder's `display_name` must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be between 3 and 30 characters. This is captured by the regular expression: `\p{L}\p{N}{1,28}[\p{L}\p{N}]`. The caller must have `resourcemanager.folders.update` permission on the identified folder. If the update fails due to the unique name constraint then a `PreconditionFailure` explaining this violation will be returned in the Status.details field.
1569    ///
1570    /// # Arguments
1571    ///
1572    /// * `request` - No description provided.
1573    /// * `name` - Identifier. The resource name of the folder. Its format is `folders/{folder_id}`, for example: "folders/1234".
1574    pub fn patch(&self, request: Folder, name: &str) -> FolderPatchCall<'a, C> {
1575        FolderPatchCall {
1576            hub: self.hub,
1577            _request: request,
1578            _name: name.to_string(),
1579            _update_mask: Default::default(),
1580            _delegate: Default::default(),
1581            _additional_params: Default::default(),
1582            _scopes: Default::default(),
1583        }
1584    }
1585
1586    /// Create a builder to help you perform the following task:
1587    ///
1588    /// Search for folders that match specific filter criteria. `search()` provides an eventually consistent view of the folders a user has access to which meet the specified filter criteria. This will only return folders on which the caller has the permission `resourcemanager.folders.get`.
1589    pub fn search(&self) -> FolderSearchCall<'a, C> {
1590        FolderSearchCall {
1591            hub: self.hub,
1592            _query: Default::default(),
1593            _page_token: Default::default(),
1594            _page_size: Default::default(),
1595            _delegate: Default::default(),
1596            _additional_params: Default::default(),
1597            _scopes: Default::default(),
1598        }
1599    }
1600
1601    /// Create a builder to help you perform the following task:
1602    ///
1603    /// Sets the access control policy on a folder, replacing any existing policy. The `resource` field should be the folder's resource name, for example: "folders/1234". The caller must have `resourcemanager.folders.setIamPolicy` permission on the identified folder.
1604    ///
1605    /// # Arguments
1606    ///
1607    /// * `request` - No description provided.
1608    /// * `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.
1609    pub fn set_iam_policy(
1610        &self,
1611        request: SetIamPolicyRequest,
1612        resource: &str,
1613    ) -> FolderSetIamPolicyCall<'a, C> {
1614        FolderSetIamPolicyCall {
1615            hub: self.hub,
1616            _request: request,
1617            _resource: resource.to_string(),
1618            _delegate: Default::default(),
1619            _additional_params: Default::default(),
1620            _scopes: Default::default(),
1621        }
1622    }
1623
1624    /// Create a builder to help you perform the following task:
1625    ///
1626    /// Returns permissions that a caller has on the specified folder. The `resource` field should be the folder's resource name, for example: "folders/1234". There are no permissions required for making this API call.
1627    ///
1628    /// # Arguments
1629    ///
1630    /// * `request` - No description provided.
1631    /// * `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.
1632    pub fn test_iam_permissions(
1633        &self,
1634        request: TestIamPermissionsRequest,
1635        resource: &str,
1636    ) -> FolderTestIamPermissionCall<'a, C> {
1637        FolderTestIamPermissionCall {
1638            hub: self.hub,
1639            _request: request,
1640            _resource: resource.to_string(),
1641            _delegate: Default::default(),
1642            _additional_params: Default::default(),
1643            _scopes: Default::default(),
1644        }
1645    }
1646
1647    /// Create a builder to help you perform the following task:
1648    ///
1649    /// Cancels the deletion request for a folder. This method may be called on a folder in any state. If the folder is in the ACTIVE state the result will be a no-op success. In order to succeed, the folder's parent must be in the ACTIVE state. In addition, reintroducing the folder into the tree must not violate folder naming, height, and fanout constraints described in the CreateFolder documentation. The caller must have `resourcemanager.folders.undelete` permission on the identified folder.
1650    ///
1651    /// # Arguments
1652    ///
1653    /// * `request` - No description provided.
1654    /// * `name` - Required. The resource name of the folder to undelete. Must be of the form `folders/{folder_id}`.
1655    pub fn undelete(
1656        &self,
1657        request: UndeleteFolderRequest,
1658        name: &str,
1659    ) -> FolderUndeleteCall<'a, C> {
1660        FolderUndeleteCall {
1661            hub: self.hub,
1662            _request: request,
1663            _name: name.to_string(),
1664            _delegate: Default::default(),
1665            _additional_params: Default::default(),
1666            _scopes: Default::default(),
1667        }
1668    }
1669}
1670
1671/// A builder providing access to all methods supported on *lien* resources.
1672/// It is not used directly, but through the [`CloudResourceManager`] hub.
1673///
1674/// # Example
1675///
1676/// Instantiate a resource builder
1677///
1678/// ```test_harness,no_run
1679/// extern crate hyper;
1680/// extern crate hyper_rustls;
1681/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
1682///
1683/// # async fn dox() {
1684/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1685///
1686/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1687/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1688///     .with_native_roots()
1689///     .unwrap()
1690///     .https_only()
1691///     .enable_http2()
1692///     .build();
1693///
1694/// let executor = hyper_util::rt::TokioExecutor::new();
1695/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1696///     secret,
1697///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1698///     yup_oauth2::client::CustomHyperClientBuilder::from(
1699///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1700///     ),
1701/// ).build().await.unwrap();
1702///
1703/// let client = hyper_util::client::legacy::Client::builder(
1704///     hyper_util::rt::TokioExecutor::new()
1705/// )
1706/// .build(
1707///     hyper_rustls::HttpsConnectorBuilder::new()
1708///         .with_native_roots()
1709///         .unwrap()
1710///         .https_or_http()
1711///         .enable_http2()
1712///         .build()
1713/// );
1714/// let mut hub = CloudResourceManager::new(client, auth);
1715/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1716/// // like `create(...)`, `delete(...)`, `get(...)` and `list(...)`
1717/// // to build up your call.
1718/// let rb = hub.liens();
1719/// # }
1720/// ```
1721pub struct LienMethods<'a, C>
1722where
1723    C: 'a,
1724{
1725    hub: &'a CloudResourceManager<C>,
1726}
1727
1728impl<'a, C> common::MethodsBuilder for LienMethods<'a, C> {}
1729
1730impl<'a, C> LienMethods<'a, C> {
1731    /// Create a builder to help you perform the following task:
1732    ///
1733    /// Create a Lien which applies to the resource denoted by the `parent` field. Callers of this method will require permission on the `parent` resource. For example, applying to `projects/1234` requires permission `resourcemanager.projects.updateLiens`. NOTE: Some resources may limit the number of Liens which may be applied.
1734    ///
1735    /// # Arguments
1736    ///
1737    /// * `request` - No description provided.
1738    pub fn create(&self, request: Lien) -> LienCreateCall<'a, C> {
1739        LienCreateCall {
1740            hub: self.hub,
1741            _request: request,
1742            _delegate: Default::default(),
1743            _additional_params: Default::default(),
1744            _scopes: Default::default(),
1745        }
1746    }
1747
1748    /// Create a builder to help you perform the following task:
1749    ///
1750    /// Delete a Lien by `name`. Callers of this method will require permission on the `parent` resource. For example, a Lien with a `parent` of `projects/1234` requires permission `resourcemanager.projects.updateLiens`.
1751    ///
1752    /// # Arguments
1753    ///
1754    /// * `name` - Required. The name/identifier of the Lien to delete.
1755    pub fn delete(&self, name: &str) -> LienDeleteCall<'a, C> {
1756        LienDeleteCall {
1757            hub: self.hub,
1758            _name: name.to_string(),
1759            _delegate: Default::default(),
1760            _additional_params: Default::default(),
1761            _scopes: Default::default(),
1762        }
1763    }
1764
1765    /// Create a builder to help you perform the following task:
1766    ///
1767    /// Retrieve a Lien by `name`. Callers of this method will require permission on the `parent` resource. For example, a Lien with a `parent` of `projects/1234` requires permission `resourcemanager.projects.get`
1768    ///
1769    /// # Arguments
1770    ///
1771    /// * `name` - Required. The name/identifier of the Lien.
1772    pub fn get(&self, name: &str) -> LienGetCall<'a, C> {
1773        LienGetCall {
1774            hub: self.hub,
1775            _name: name.to_string(),
1776            _delegate: Default::default(),
1777            _additional_params: Default::default(),
1778            _scopes: Default::default(),
1779        }
1780    }
1781
1782    /// Create a builder to help you perform the following task:
1783    ///
1784    /// List all Liens applied to the `parent` resource. Callers of this method will require permission on the `parent` resource. For example, a Lien with a `parent` of `projects/1234` requires permission `resourcemanager.projects.get`.
1785    pub fn list(&self) -> LienListCall<'a, C> {
1786        LienListCall {
1787            hub: self.hub,
1788            _parent: Default::default(),
1789            _page_token: Default::default(),
1790            _page_size: Default::default(),
1791            _delegate: Default::default(),
1792            _additional_params: Default::default(),
1793            _scopes: Default::default(),
1794        }
1795    }
1796}
1797
1798/// A builder providing access to all methods supported on *location* resources.
1799/// It is not used directly, but through the [`CloudResourceManager`] hub.
1800///
1801/// # Example
1802///
1803/// Instantiate a resource builder
1804///
1805/// ```test_harness,no_run
1806/// extern crate hyper;
1807/// extern crate hyper_rustls;
1808/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
1809///
1810/// # async fn dox() {
1811/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1812///
1813/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1814/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1815///     .with_native_roots()
1816///     .unwrap()
1817///     .https_only()
1818///     .enable_http2()
1819///     .build();
1820///
1821/// let executor = hyper_util::rt::TokioExecutor::new();
1822/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1823///     secret,
1824///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1825///     yup_oauth2::client::CustomHyperClientBuilder::from(
1826///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1827///     ),
1828/// ).build().await.unwrap();
1829///
1830/// let client = hyper_util::client::legacy::Client::builder(
1831///     hyper_util::rt::TokioExecutor::new()
1832/// )
1833/// .build(
1834///     hyper_rustls::HttpsConnectorBuilder::new()
1835///         .with_native_roots()
1836///         .unwrap()
1837///         .https_or_http()
1838///         .enable_http2()
1839///         .build()
1840/// );
1841/// let mut hub = CloudResourceManager::new(client, auth);
1842/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1843/// // like `effective_tag_binding_collections_get(...)`, `tag_binding_collections_get(...)` and `tag_binding_collections_patch(...)`
1844/// // to build up your call.
1845/// let rb = hub.locations();
1846/// # }
1847/// ```
1848pub struct LocationMethods<'a, C>
1849where
1850    C: 'a,
1851{
1852    hub: &'a CloudResourceManager<C>,
1853}
1854
1855impl<'a, C> common::MethodsBuilder for LocationMethods<'a, C> {}
1856
1857impl<'a, C> LocationMethods<'a, C> {
1858    /// Create a builder to help you perform the following task:
1859    ///
1860    /// Returns effective tag bindings on a GCP resource.
1861    ///
1862    /// # Arguments
1863    ///
1864    /// * `name` - Required. The full name of the EffectiveTagBindingCollection in format: `locations/{location}/effectiveTagBindingCollections/{encoded-full-resource-name}` where the encoded-full-resource-name is the UTF-8 encoded name of the resource the TagBindings are bound to. E.g. "locations/global/effectiveTagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
1865    pub fn effective_tag_binding_collections_get(
1866        &self,
1867        name: &str,
1868    ) -> LocationEffectiveTagBindingCollectionGetCall<'a, C> {
1869        LocationEffectiveTagBindingCollectionGetCall {
1870            hub: self.hub,
1871            _name: name.to_string(),
1872            _delegate: Default::default(),
1873            _additional_params: Default::default(),
1874            _scopes: Default::default(),
1875        }
1876    }
1877
1878    /// Create a builder to help you perform the following task:
1879    ///
1880    /// Returns tag bindings directly attached to a GCP resource.
1881    ///
1882    /// # Arguments
1883    ///
1884    /// * `name` - Required. The full name of the TagBindingCollection in format: `locations/{location}/tagBindingCollections/{encoded-full-resource-name}` where the enoded-full-resource-name is the UTF-8 encoded name of the resource the TagBindings are bound to. E.g. "locations/global/tagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
1885    pub fn tag_binding_collections_get(
1886        &self,
1887        name: &str,
1888    ) -> LocationTagBindingCollectionGetCall<'a, C> {
1889        LocationTagBindingCollectionGetCall {
1890            hub: self.hub,
1891            _name: name.to_string(),
1892            _delegate: Default::default(),
1893            _additional_params: Default::default(),
1894            _scopes: Default::default(),
1895        }
1896    }
1897
1898    /// Create a builder to help you perform the following task:
1899    ///
1900    /// Updates tag bindings directly attached to a GCP resource. Update_mask can be kept empty or "*".
1901    ///
1902    /// # Arguments
1903    ///
1904    /// * `request` - No description provided.
1905    /// * `name` - Identifier. The name of the TagBindingCollection, following the convention: `locations/{location}/tagBindingCollections/{encoded-full-resource-name}` where the encoded-full-resource-name is the UTF-8 encoded name of the GCP resource the TagBindings are bound to. "locations/global/tagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
1906    pub fn tag_binding_collections_patch(
1907        &self,
1908        request: TagBindingCollection,
1909        name: &str,
1910    ) -> LocationTagBindingCollectionPatchCall<'a, C> {
1911        LocationTagBindingCollectionPatchCall {
1912            hub: self.hub,
1913            _request: request,
1914            _name: name.to_string(),
1915            _update_mask: Default::default(),
1916            _delegate: Default::default(),
1917            _additional_params: Default::default(),
1918            _scopes: Default::default(),
1919        }
1920    }
1921}
1922
1923/// A builder providing access to all methods supported on *operation* resources.
1924/// It is not used directly, but through the [`CloudResourceManager`] hub.
1925///
1926/// # Example
1927///
1928/// Instantiate a resource builder
1929///
1930/// ```test_harness,no_run
1931/// extern crate hyper;
1932/// extern crate hyper_rustls;
1933/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
1934///
1935/// # async fn dox() {
1936/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1937///
1938/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1939/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1940///     .with_native_roots()
1941///     .unwrap()
1942///     .https_only()
1943///     .enable_http2()
1944///     .build();
1945///
1946/// let executor = hyper_util::rt::TokioExecutor::new();
1947/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1948///     secret,
1949///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1950///     yup_oauth2::client::CustomHyperClientBuilder::from(
1951///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1952///     ),
1953/// ).build().await.unwrap();
1954///
1955/// let client = hyper_util::client::legacy::Client::builder(
1956///     hyper_util::rt::TokioExecutor::new()
1957/// )
1958/// .build(
1959///     hyper_rustls::HttpsConnectorBuilder::new()
1960///         .with_native_roots()
1961///         .unwrap()
1962///         .https_or_http()
1963///         .enable_http2()
1964///         .build()
1965/// );
1966/// let mut hub = CloudResourceManager::new(client, auth);
1967/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1968/// // like `get(...)`
1969/// // to build up your call.
1970/// let rb = hub.operations();
1971/// # }
1972/// ```
1973pub struct OperationMethods<'a, C>
1974where
1975    C: 'a,
1976{
1977    hub: &'a CloudResourceManager<C>,
1978}
1979
1980impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
1981
1982impl<'a, C> OperationMethods<'a, C> {
1983    /// Create a builder to help you perform the following task:
1984    ///
1985    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
1986    ///
1987    /// # Arguments
1988    ///
1989    /// * `name` - The name of the operation resource.
1990    pub fn get(&self, name: &str) -> OperationGetCall<'a, C> {
1991        OperationGetCall {
1992            hub: self.hub,
1993            _name: name.to_string(),
1994            _delegate: Default::default(),
1995            _additional_params: Default::default(),
1996            _scopes: Default::default(),
1997        }
1998    }
1999}
2000
2001/// A builder providing access to all methods supported on *organization* resources.
2002/// It is not used directly, but through the [`CloudResourceManager`] hub.
2003///
2004/// # Example
2005///
2006/// Instantiate a resource builder
2007///
2008/// ```test_harness,no_run
2009/// extern crate hyper;
2010/// extern crate hyper_rustls;
2011/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
2012///
2013/// # async fn dox() {
2014/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2015///
2016/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2017/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2018///     .with_native_roots()
2019///     .unwrap()
2020///     .https_only()
2021///     .enable_http2()
2022///     .build();
2023///
2024/// let executor = hyper_util::rt::TokioExecutor::new();
2025/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2026///     secret,
2027///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2028///     yup_oauth2::client::CustomHyperClientBuilder::from(
2029///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2030///     ),
2031/// ).build().await.unwrap();
2032///
2033/// let client = hyper_util::client::legacy::Client::builder(
2034///     hyper_util::rt::TokioExecutor::new()
2035/// )
2036/// .build(
2037///     hyper_rustls::HttpsConnectorBuilder::new()
2038///         .with_native_roots()
2039///         .unwrap()
2040///         .https_or_http()
2041///         .enable_http2()
2042///         .build()
2043/// );
2044/// let mut hub = CloudResourceManager::new(client, auth);
2045/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2046/// // like `get(...)`, `get_iam_policy(...)`, `search(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)`
2047/// // to build up your call.
2048/// let rb = hub.organizations();
2049/// # }
2050/// ```
2051pub struct OrganizationMethods<'a, C>
2052where
2053    C: 'a,
2054{
2055    hub: &'a CloudResourceManager<C>,
2056}
2057
2058impl<'a, C> common::MethodsBuilder for OrganizationMethods<'a, C> {}
2059
2060impl<'a, C> OrganizationMethods<'a, C> {
2061    /// Create a builder to help you perform the following task:
2062    ///
2063    /// Fetches an organization resource identified by the specified resource name.
2064    ///
2065    /// # Arguments
2066    ///
2067    /// * `name` - Required. 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".
2068    pub fn get(&self, name: &str) -> OrganizationGetCall<'a, C> {
2069        OrganizationGetCall {
2070            hub: self.hub,
2071            _name: name.to_string(),
2072            _delegate: Default::default(),
2073            _additional_params: Default::default(),
2074            _scopes: Default::default(),
2075        }
2076    }
2077
2078    /// Create a builder to help you perform the following task:
2079    ///
2080    /// Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, for example: "organizations/123". Authorization requires the IAM permission `resourcemanager.organizations.getIamPolicy` on the specified organization.
2081    ///
2082    /// # Arguments
2083    ///
2084    /// * `request` - No description provided.
2085    /// * `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.
2086    pub fn get_iam_policy(
2087        &self,
2088        request: GetIamPolicyRequest,
2089        resource: &str,
2090    ) -> OrganizationGetIamPolicyCall<'a, C> {
2091        OrganizationGetIamPolicyCall {
2092            hub: self.hub,
2093            _request: request,
2094            _resource: resource.to_string(),
2095            _delegate: Default::default(),
2096            _additional_params: Default::default(),
2097            _scopes: Default::default(),
2098        }
2099    }
2100
2101    /// Create a builder to help you perform the following task:
2102    ///
2103    /// Searches 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 results, and may take a small amount of time to appear. Search will only return organizations on which the user has the permission `resourcemanager.organizations.get` or has super admin privileges.
2104    pub fn search(&self) -> OrganizationSearchCall<'a, C> {
2105        OrganizationSearchCall {
2106            hub: self.hub,
2107            _query: Default::default(),
2108            _page_token: Default::default(),
2109            _page_size: Default::default(),
2110            _delegate: Default::default(),
2111            _additional_params: Default::default(),
2112            _scopes: Default::default(),
2113        }
2114    }
2115
2116    /// Create a builder to help you perform the following task:
2117    ///
2118    /// Sets the access control policy on an organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, for example: "organizations/123". Authorization requires the IAM permission `resourcemanager.organizations.setIamPolicy` on the specified organization.
2119    ///
2120    /// # Arguments
2121    ///
2122    /// * `request` - No description provided.
2123    /// * `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.
2124    pub fn set_iam_policy(
2125        &self,
2126        request: SetIamPolicyRequest,
2127        resource: &str,
2128    ) -> OrganizationSetIamPolicyCall<'a, C> {
2129        OrganizationSetIamPolicyCall {
2130            hub: self.hub,
2131            _request: request,
2132            _resource: resource.to_string(),
2133            _delegate: Default::default(),
2134            _additional_params: Default::default(),
2135            _scopes: Default::default(),
2136        }
2137    }
2138
2139    /// Create a builder to help you perform the following task:
2140    ///
2141    /// Returns the permissions that a caller has on the specified organization. The `resource` field should be the organization's resource name, for example: "organizations/123". There are no permissions required for making this API call.
2142    ///
2143    /// # Arguments
2144    ///
2145    /// * `request` - No description provided.
2146    /// * `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.
2147    pub fn test_iam_permissions(
2148        &self,
2149        request: TestIamPermissionsRequest,
2150        resource: &str,
2151    ) -> OrganizationTestIamPermissionCall<'a, C> {
2152        OrganizationTestIamPermissionCall {
2153            hub: self.hub,
2154            _request: request,
2155            _resource: resource.to_string(),
2156            _delegate: Default::default(),
2157            _additional_params: Default::default(),
2158            _scopes: Default::default(),
2159        }
2160    }
2161}
2162
2163/// A builder providing access to all methods supported on *project* resources.
2164/// It is not used directly, but through the [`CloudResourceManager`] hub.
2165///
2166/// # Example
2167///
2168/// Instantiate a resource builder
2169///
2170/// ```test_harness,no_run
2171/// extern crate hyper;
2172/// extern crate hyper_rustls;
2173/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
2174///
2175/// # async fn dox() {
2176/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2177///
2178/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2179/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2180///     .with_native_roots()
2181///     .unwrap()
2182///     .https_only()
2183///     .enable_http2()
2184///     .build();
2185///
2186/// let executor = hyper_util::rt::TokioExecutor::new();
2187/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2188///     secret,
2189///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2190///     yup_oauth2::client::CustomHyperClientBuilder::from(
2191///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2192///     ),
2193/// ).build().await.unwrap();
2194///
2195/// let client = hyper_util::client::legacy::Client::builder(
2196///     hyper_util::rt::TokioExecutor::new()
2197/// )
2198/// .build(
2199///     hyper_rustls::HttpsConnectorBuilder::new()
2200///         .with_native_roots()
2201///         .unwrap()
2202///         .https_or_http()
2203///         .enable_http2()
2204///         .build()
2205/// );
2206/// let mut hub = CloudResourceManager::new(client, auth);
2207/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2208/// // like `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `move_(...)`, `patch(...)`, `search(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` and `undelete(...)`
2209/// // to build up your call.
2210/// let rb = hub.projects();
2211/// # }
2212/// ```
2213pub struct ProjectMethods<'a, C>
2214where
2215    C: 'a,
2216{
2217    hub: &'a CloudResourceManager<C>,
2218}
2219
2220impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
2221
2222impl<'a, C> ProjectMethods<'a, C> {
2223    /// Create a builder to help you perform the following task:
2224    ///
2225    /// Request that a new project be created. The result is an `Operation` which can be used to track the creation process. This process usually takes a few seconds, but can sometimes take much longer. The tracking `Operation` is automatically deleted after a few hours, so there is no need to call `DeleteOperation`.
2226    ///
2227    /// # Arguments
2228    ///
2229    /// * `request` - No description provided.
2230    pub fn create(&self, request: Project) -> ProjectCreateCall<'a, C> {
2231        ProjectCreateCall {
2232            hub: self.hub,
2233            _request: request,
2234            _delegate: Default::default(),
2235            _additional_params: Default::default(),
2236            _scopes: Default::default(),
2237        }
2238    }
2239
2240    /// Create a builder to help you perform the following task:
2241    ///
2242    /// Marks the project identified by the specified `name` (for example, `projects/415104041262`) 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, ListProjects, and SearchProjects methods. The caller must have `resourcemanager.projects.delete` permissions for this project.
2243    ///
2244    /// # Arguments
2245    ///
2246    /// * `name` - Required. The name of the Project (for example, `projects/415104041262`).
2247    pub fn delete(&self, name: &str) -> ProjectDeleteCall<'a, C> {
2248        ProjectDeleteCall {
2249            hub: self.hub,
2250            _name: name.to_string(),
2251            _delegate: Default::default(),
2252            _additional_params: Default::default(),
2253            _scopes: Default::default(),
2254        }
2255    }
2256
2257    /// Create a builder to help you perform the following task:
2258    ///
2259    /// Retrieves the project identified by the specified `name` (for example, `projects/415104041262`). The caller must have `resourcemanager.projects.get` permission for this project.
2260    ///
2261    /// # Arguments
2262    ///
2263    /// * `name` - Required. The name of the project (for example, `projects/415104041262`).
2264    pub fn get(&self, name: &str) -> ProjectGetCall<'a, C> {
2265        ProjectGetCall {
2266            hub: self.hub,
2267            _name: name.to_string(),
2268            _delegate: Default::default(),
2269            _additional_params: Default::default(),
2270            _scopes: Default::default(),
2271        }
2272    }
2273
2274    /// Create a builder to help you perform the following task:
2275    ///
2276    /// Returns the IAM access control policy for the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123. Permission is denied if the policy or the resource do not exist.
2277    ///
2278    /// # Arguments
2279    ///
2280    /// * `request` - No description provided.
2281    /// * `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.
2282    pub fn get_iam_policy(
2283        &self,
2284        request: GetIamPolicyRequest,
2285        resource: &str,
2286    ) -> ProjectGetIamPolicyCall<'a, C> {
2287        ProjectGetIamPolicyCall {
2288            hub: self.hub,
2289            _request: request,
2290            _resource: resource.to_string(),
2291            _delegate: Default::default(),
2292            _additional_params: Default::default(),
2293            _scopes: Default::default(),
2294        }
2295    }
2296
2297    /// Create a builder to help you perform the following task:
2298    ///
2299    /// Lists projects that are direct children of the specified folder or organization resource. `list()` provides a strongly consistent view of the projects underneath the specified parent resource. `list()` returns projects sorted based upon the (ascending) lexical ordering of their `display_name`. The caller must have `resourcemanager.projects.list` permission on the identified parent.
2300    pub fn list(&self) -> ProjectListCall<'a, C> {
2301        ProjectListCall {
2302            hub: self.hub,
2303            _show_deleted: Default::default(),
2304            _parent: Default::default(),
2305            _page_token: Default::default(),
2306            _page_size: Default::default(),
2307            _delegate: Default::default(),
2308            _additional_params: Default::default(),
2309            _scopes: Default::default(),
2310        }
2311    }
2312
2313    /// Create a builder to help you perform the following task:
2314    ///
2315    /// Move a project to another place in your resource hierarchy, under a new resource parent. Returns an operation which can be used to track the process of the project move workflow. Upon success, the `Operation.response` field will be populated with the moved project. The caller must have `resourcemanager.projects.move` permission on the project, on the project's current and proposed new parent. If project has no current parent, or it currently does not have an associated organization resource, you will also need the `resourcemanager.projects.setIamPolicy` permission in the project.
2316    ///
2317    /// # Arguments
2318    ///
2319    /// * `request` - No description provided.
2320    /// * `name` - Required. The name of the project to move.
2321    pub fn move_(&self, request: MoveProjectRequest, name: &str) -> ProjectMoveCall<'a, C> {
2322        ProjectMoveCall {
2323            hub: self.hub,
2324            _request: request,
2325            _name: name.to_string(),
2326            _delegate: Default::default(),
2327            _additional_params: Default::default(),
2328            _scopes: Default::default(),
2329        }
2330    }
2331
2332    /// Create a builder to help you perform the following task:
2333    ///
2334    /// Updates the `display_name` and labels of the project identified by the specified `name` (for example, `projects/415104041262`). Deleting all labels requires an update mask for labels field. The caller must have `resourcemanager.projects.update` permission for this project.
2335    ///
2336    /// # Arguments
2337    ///
2338    /// * `request` - No description provided.
2339    /// * `name` - Output only. The unique resource name of the project. It is an int64 generated number prefixed by "projects/". Example: `projects/415104041262`
2340    pub fn patch(&self, request: Project, name: &str) -> ProjectPatchCall<'a, C> {
2341        ProjectPatchCall {
2342            hub: self.hub,
2343            _request: request,
2344            _name: name.to_string(),
2345            _update_mask: Default::default(),
2346            _delegate: Default::default(),
2347            _additional_params: Default::default(),
2348            _scopes: Default::default(),
2349        }
2350    }
2351
2352    /// Create a builder to help you perform the following task:
2353    ///
2354    /// Search for projects that the caller has the `resourcemanager.projects.get` permission on, and also satisfy the specified query. 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.
2355    pub fn search(&self) -> ProjectSearchCall<'a, C> {
2356        ProjectSearchCall {
2357            hub: self.hub,
2358            _query: Default::default(),
2359            _page_token: Default::default(),
2360            _page_size: Default::default(),
2361            _delegate: Default::default(),
2362            _additional_params: Default::default(),
2363            _scopes: Default::default(),
2364        }
2365    }
2366
2367    /// Create a builder to help you perform the following task:
2368    ///
2369    /// Sets the IAM access control policy for the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123. 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 using the 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. + 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. If the project is part of an organization, you can remove all owners, potentially making the organization inaccessible.
2370    ///
2371    /// # Arguments
2372    ///
2373    /// * `request` - No description provided.
2374    /// * `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.
2375    pub fn set_iam_policy(
2376        &self,
2377        request: SetIamPolicyRequest,
2378        resource: &str,
2379    ) -> ProjectSetIamPolicyCall<'a, C> {
2380        ProjectSetIamPolicyCall {
2381            hub: self.hub,
2382            _request: request,
2383            _resource: resource.to_string(),
2384            _delegate: Default::default(),
2385            _additional_params: Default::default(),
2386            _scopes: Default::default(),
2387        }
2388    }
2389
2390    /// Create a builder to help you perform the following task:
2391    ///
2392    /// Returns permissions that a caller has on the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123..
2393    ///
2394    /// # Arguments
2395    ///
2396    /// * `request` - No description provided.
2397    /// * `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.
2398    pub fn test_iam_permissions(
2399        &self,
2400        request: TestIamPermissionsRequest,
2401        resource: &str,
2402    ) -> ProjectTestIamPermissionCall<'a, C> {
2403        ProjectTestIamPermissionCall {
2404            hub: self.hub,
2405            _request: request,
2406            _resource: resource.to_string(),
2407            _delegate: Default::default(),
2408            _additional_params: Default::default(),
2409            _scopes: Default::default(),
2410        }
2411    }
2412
2413    /// Create a builder to help you perform the following task:
2414    ///
2415    /// Restores the project identified by the specified `name` (for example, `projects/415104041262`). 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 `resourcemanager.projects.undelete` permission for this project.
2416    ///
2417    /// # Arguments
2418    ///
2419    /// * `request` - No description provided.
2420    /// * `name` - Required. The name of the project (for example, `projects/415104041262`). Required.
2421    pub fn undelete(
2422        &self,
2423        request: UndeleteProjectRequest,
2424        name: &str,
2425    ) -> ProjectUndeleteCall<'a, C> {
2426        ProjectUndeleteCall {
2427            hub: self.hub,
2428            _request: request,
2429            _name: name.to_string(),
2430            _delegate: Default::default(),
2431            _additional_params: Default::default(),
2432            _scopes: Default::default(),
2433        }
2434    }
2435}
2436
2437/// A builder providing access to all methods supported on *tagBinding* resources.
2438/// It is not used directly, but through the [`CloudResourceManager`] hub.
2439///
2440/// # Example
2441///
2442/// Instantiate a resource builder
2443///
2444/// ```test_harness,no_run
2445/// extern crate hyper;
2446/// extern crate hyper_rustls;
2447/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
2448///
2449/// # async fn dox() {
2450/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2451///
2452/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2453/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2454///     .with_native_roots()
2455///     .unwrap()
2456///     .https_only()
2457///     .enable_http2()
2458///     .build();
2459///
2460/// let executor = hyper_util::rt::TokioExecutor::new();
2461/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2462///     secret,
2463///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2464///     yup_oauth2::client::CustomHyperClientBuilder::from(
2465///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2466///     ),
2467/// ).build().await.unwrap();
2468///
2469/// let client = hyper_util::client::legacy::Client::builder(
2470///     hyper_util::rt::TokioExecutor::new()
2471/// )
2472/// .build(
2473///     hyper_rustls::HttpsConnectorBuilder::new()
2474///         .with_native_roots()
2475///         .unwrap()
2476///         .https_or_http()
2477///         .enable_http2()
2478///         .build()
2479/// );
2480/// let mut hub = CloudResourceManager::new(client, auth);
2481/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2482/// // like `create(...)`, `delete(...)` and `list(...)`
2483/// // to build up your call.
2484/// let rb = hub.tag_bindings();
2485/// # }
2486/// ```
2487pub struct TagBindingMethods<'a, C>
2488where
2489    C: 'a,
2490{
2491    hub: &'a CloudResourceManager<C>,
2492}
2493
2494impl<'a, C> common::MethodsBuilder for TagBindingMethods<'a, C> {}
2495
2496impl<'a, C> TagBindingMethods<'a, C> {
2497    /// Create a builder to help you perform the following task:
2498    ///
2499    /// Creates a TagBinding between a TagValue and a Google Cloud resource.
2500    ///
2501    /// # Arguments
2502    ///
2503    /// * `request` - No description provided.
2504    pub fn create(&self, request: TagBinding) -> TagBindingCreateCall<'a, C> {
2505        TagBindingCreateCall {
2506            hub: self.hub,
2507            _request: request,
2508            _validate_only: Default::default(),
2509            _delegate: Default::default(),
2510            _additional_params: Default::default(),
2511            _scopes: Default::default(),
2512        }
2513    }
2514
2515    /// Create a builder to help you perform the following task:
2516    ///
2517    /// Deletes a TagBinding.
2518    ///
2519    /// # Arguments
2520    ///
2521    /// * `name` - Required. The name of the TagBinding. This is a String of the form: `tagBindings/{id}` (e.g. `tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456`).
2522    pub fn delete(&self, name: &str) -> TagBindingDeleteCall<'a, C> {
2523        TagBindingDeleteCall {
2524            hub: self.hub,
2525            _name: name.to_string(),
2526            _delegate: Default::default(),
2527            _additional_params: Default::default(),
2528            _scopes: Default::default(),
2529        }
2530    }
2531
2532    /// Create a builder to help you perform the following task:
2533    ///
2534    /// Lists the TagBindings for the given Google Cloud resource, as specified with `parent`. NOTE: The `parent` field is expected to be a full resource name: https://cloud.google.com/apis/design/resource_names#full_resource_name
2535    pub fn list(&self) -> TagBindingListCall<'a, C> {
2536        TagBindingListCall {
2537            hub: self.hub,
2538            _parent: Default::default(),
2539            _page_token: Default::default(),
2540            _page_size: Default::default(),
2541            _delegate: Default::default(),
2542            _additional_params: Default::default(),
2543            _scopes: Default::default(),
2544        }
2545    }
2546}
2547
2548/// A builder providing access to all methods supported on *tagKey* resources.
2549/// It is not used directly, but through the [`CloudResourceManager`] hub.
2550///
2551/// # Example
2552///
2553/// Instantiate a resource builder
2554///
2555/// ```test_harness,no_run
2556/// extern crate hyper;
2557/// extern crate hyper_rustls;
2558/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
2559///
2560/// # async fn dox() {
2561/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2562///
2563/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2564/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2565///     .with_native_roots()
2566///     .unwrap()
2567///     .https_only()
2568///     .enable_http2()
2569///     .build();
2570///
2571/// let executor = hyper_util::rt::TokioExecutor::new();
2572/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2573///     secret,
2574///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2575///     yup_oauth2::client::CustomHyperClientBuilder::from(
2576///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2577///     ),
2578/// ).build().await.unwrap();
2579///
2580/// let client = hyper_util::client::legacy::Client::builder(
2581///     hyper_util::rt::TokioExecutor::new()
2582/// )
2583/// .build(
2584///     hyper_rustls::HttpsConnectorBuilder::new()
2585///         .with_native_roots()
2586///         .unwrap()
2587///         .https_or_http()
2588///         .enable_http2()
2589///         .build()
2590/// );
2591/// let mut hub = CloudResourceManager::new(client, auth);
2592/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2593/// // like `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `get_namespaced(...)`, `list(...)`, `patch(...)`, `set_iam_policy(...)` and `test_iam_permissions(...)`
2594/// // to build up your call.
2595/// let rb = hub.tag_keys();
2596/// # }
2597/// ```
2598pub struct TagKeyMethods<'a, C>
2599where
2600    C: 'a,
2601{
2602    hub: &'a CloudResourceManager<C>,
2603}
2604
2605impl<'a, C> common::MethodsBuilder for TagKeyMethods<'a, C> {}
2606
2607impl<'a, C> TagKeyMethods<'a, C> {
2608    /// Create a builder to help you perform the following task:
2609    ///
2610    /// Creates a new TagKey. If another request with the same parameters is sent while the original request is in process, the second request will receive an error. A maximum of 1000 TagKeys can exist under a parent at any given time.
2611    ///
2612    /// # Arguments
2613    ///
2614    /// * `request` - No description provided.
2615    pub fn create(&self, request: TagKey) -> TagKeyCreateCall<'a, C> {
2616        TagKeyCreateCall {
2617            hub: self.hub,
2618            _request: request,
2619            _validate_only: Default::default(),
2620            _delegate: Default::default(),
2621            _additional_params: Default::default(),
2622            _scopes: Default::default(),
2623        }
2624    }
2625
2626    /// Create a builder to help you perform the following task:
2627    ///
2628    /// Deletes a TagKey. The TagKey cannot be deleted if it has any child TagValues.
2629    ///
2630    /// # Arguments
2631    ///
2632    /// * `name` - Required. The resource name of a TagKey to be deleted in the format `tagKeys/123`. The TagKey cannot be a parent of any existing TagValues or it will not be deleted successfully.
2633    pub fn delete(&self, name: &str) -> TagKeyDeleteCall<'a, C> {
2634        TagKeyDeleteCall {
2635            hub: self.hub,
2636            _name: name.to_string(),
2637            _validate_only: Default::default(),
2638            _etag: Default::default(),
2639            _delegate: Default::default(),
2640            _additional_params: Default::default(),
2641            _scopes: Default::default(),
2642        }
2643    }
2644
2645    /// Create a builder to help you perform the following task:
2646    ///
2647    /// Retrieves a TagKey. This method will return `PERMISSION_DENIED` if the key does not exist or the user does not have permission to view it.
2648    ///
2649    /// # Arguments
2650    ///
2651    /// * `name` - Required. A resource name in the format `tagKeys/{id}`, such as `tagKeys/123`.
2652    pub fn get(&self, name: &str) -> TagKeyGetCall<'a, C> {
2653        TagKeyGetCall {
2654            hub: self.hub,
2655            _name: name.to_string(),
2656            _delegate: Default::default(),
2657            _additional_params: Default::default(),
2658            _scopes: Default::default(),
2659        }
2660    }
2661
2662    /// Create a builder to help you perform the following task:
2663    ///
2664    /// Gets the access control policy for a TagKey. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the TagKey's resource name. For example, "tagKeys/1234". The caller must have `cloudresourcemanager.googleapis.com/tagKeys.getIamPolicy` permission on the specified TagKey.
2665    ///
2666    /// # Arguments
2667    ///
2668    /// * `request` - No description provided.
2669    /// * `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.
2670    pub fn get_iam_policy(
2671        &self,
2672        request: GetIamPolicyRequest,
2673        resource: &str,
2674    ) -> TagKeyGetIamPolicyCall<'a, C> {
2675        TagKeyGetIamPolicyCall {
2676            hub: self.hub,
2677            _request: request,
2678            _resource: resource.to_string(),
2679            _delegate: Default::default(),
2680            _additional_params: Default::default(),
2681            _scopes: Default::default(),
2682        }
2683    }
2684
2685    /// Create a builder to help you perform the following task:
2686    ///
2687    /// Retrieves a TagKey by its namespaced name. This method will return `PERMISSION_DENIED` if the key does not exist or the user does not have permission to view it.
2688    pub fn get_namespaced(&self) -> TagKeyGetNamespacedCall<'a, C> {
2689        TagKeyGetNamespacedCall {
2690            hub: self.hub,
2691            _name: Default::default(),
2692            _delegate: Default::default(),
2693            _additional_params: Default::default(),
2694            _scopes: Default::default(),
2695        }
2696    }
2697
2698    /// Create a builder to help you perform the following task:
2699    ///
2700    /// Lists all TagKeys for a parent resource.
2701    pub fn list(&self) -> TagKeyListCall<'a, C> {
2702        TagKeyListCall {
2703            hub: self.hub,
2704            _parent: Default::default(),
2705            _page_token: Default::default(),
2706            _page_size: Default::default(),
2707            _delegate: Default::default(),
2708            _additional_params: Default::default(),
2709            _scopes: Default::default(),
2710        }
2711    }
2712
2713    /// Create a builder to help you perform the following task:
2714    ///
2715    /// Updates the attributes of the TagKey resource.
2716    ///
2717    /// # Arguments
2718    ///
2719    /// * `request` - No description provided.
2720    /// * `name` - Immutable. The resource name for a TagKey. Must be in the format `tagKeys/{tag_key_id}`, where `tag_key_id` is the generated numeric id for the TagKey.
2721    pub fn patch(&self, request: TagKey, name: &str) -> TagKeyPatchCall<'a, C> {
2722        TagKeyPatchCall {
2723            hub: self.hub,
2724            _request: request,
2725            _name: name.to_string(),
2726            _validate_only: Default::default(),
2727            _update_mask: Default::default(),
2728            _delegate: Default::default(),
2729            _additional_params: Default::default(),
2730            _scopes: Default::default(),
2731        }
2732    }
2733
2734    /// Create a builder to help you perform the following task:
2735    ///
2736    /// Sets the access control policy on a TagKey, replacing any existing policy. The `resource` field should be the TagKey's resource name. For example, "tagKeys/1234". The caller must have `resourcemanager.tagKeys.setIamPolicy` permission on the identified tagValue.
2737    ///
2738    /// # Arguments
2739    ///
2740    /// * `request` - No description provided.
2741    /// * `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.
2742    pub fn set_iam_policy(
2743        &self,
2744        request: SetIamPolicyRequest,
2745        resource: &str,
2746    ) -> TagKeySetIamPolicyCall<'a, C> {
2747        TagKeySetIamPolicyCall {
2748            hub: self.hub,
2749            _request: request,
2750            _resource: resource.to_string(),
2751            _delegate: Default::default(),
2752            _additional_params: Default::default(),
2753            _scopes: Default::default(),
2754        }
2755    }
2756
2757    /// Create a builder to help you perform the following task:
2758    ///
2759    /// Returns permissions that a caller has on the specified TagKey. The `resource` field should be the TagKey's resource name. For example, "tagKeys/1234". There are no permissions required for making this API call.
2760    ///
2761    /// # Arguments
2762    ///
2763    /// * `request` - No description provided.
2764    /// * `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.
2765    pub fn test_iam_permissions(
2766        &self,
2767        request: TestIamPermissionsRequest,
2768        resource: &str,
2769    ) -> TagKeyTestIamPermissionCall<'a, C> {
2770        TagKeyTestIamPermissionCall {
2771            hub: self.hub,
2772            _request: request,
2773            _resource: resource.to_string(),
2774            _delegate: Default::default(),
2775            _additional_params: Default::default(),
2776            _scopes: Default::default(),
2777        }
2778    }
2779}
2780
2781/// A builder providing access to all methods supported on *tagValue* resources.
2782/// It is not used directly, but through the [`CloudResourceManager`] hub.
2783///
2784/// # Example
2785///
2786/// Instantiate a resource builder
2787///
2788/// ```test_harness,no_run
2789/// extern crate hyper;
2790/// extern crate hyper_rustls;
2791/// extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
2792///
2793/// # async fn dox() {
2794/// use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2795///
2796/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2797/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2798///     .with_native_roots()
2799///     .unwrap()
2800///     .https_only()
2801///     .enable_http2()
2802///     .build();
2803///
2804/// let executor = hyper_util::rt::TokioExecutor::new();
2805/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2806///     secret,
2807///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2808///     yup_oauth2::client::CustomHyperClientBuilder::from(
2809///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2810///     ),
2811/// ).build().await.unwrap();
2812///
2813/// let client = hyper_util::client::legacy::Client::builder(
2814///     hyper_util::rt::TokioExecutor::new()
2815/// )
2816/// .build(
2817///     hyper_rustls::HttpsConnectorBuilder::new()
2818///         .with_native_roots()
2819///         .unwrap()
2820///         .https_or_http()
2821///         .enable_http2()
2822///         .build()
2823/// );
2824/// let mut hub = CloudResourceManager::new(client, auth);
2825/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2826/// // like `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `get_namespaced(...)`, `list(...)`, `patch(...)`, `set_iam_policy(...)`, `tag_holds_create(...)`, `tag_holds_delete(...)`, `tag_holds_list(...)` and `test_iam_permissions(...)`
2827/// // to build up your call.
2828/// let rb = hub.tag_values();
2829/// # }
2830/// ```
2831pub struct TagValueMethods<'a, C>
2832where
2833    C: 'a,
2834{
2835    hub: &'a CloudResourceManager<C>,
2836}
2837
2838impl<'a, C> common::MethodsBuilder for TagValueMethods<'a, C> {}
2839
2840impl<'a, C> TagValueMethods<'a, C> {
2841    /// Create a builder to help you perform the following task:
2842    ///
2843    /// Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same TagValue.
2844    ///
2845    /// # Arguments
2846    ///
2847    /// * `request` - No description provided.
2848    /// * `parent` - Required. The resource name of the TagHold's parent TagValue. Must be of the form: `tagValues/{tag-value-id}`.
2849    pub fn tag_holds_create(
2850        &self,
2851        request: TagHold,
2852        parent: &str,
2853    ) -> TagValueTagHoldCreateCall<'a, C> {
2854        TagValueTagHoldCreateCall {
2855            hub: self.hub,
2856            _request: request,
2857            _parent: parent.to_string(),
2858            _validate_only: Default::default(),
2859            _delegate: Default::default(),
2860            _additional_params: Default::default(),
2861            _scopes: Default::default(),
2862        }
2863    }
2864
2865    /// Create a builder to help you perform the following task:
2866    ///
2867    /// Deletes a TagHold.
2868    ///
2869    /// # Arguments
2870    ///
2871    /// * `name` - Required. The resource name of the TagHold to delete. Must be of the form: `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`.
2872    pub fn tag_holds_delete(&self, name: &str) -> TagValueTagHoldDeleteCall<'a, C> {
2873        TagValueTagHoldDeleteCall {
2874            hub: self.hub,
2875            _name: name.to_string(),
2876            _validate_only: Default::default(),
2877            _delegate: Default::default(),
2878            _additional_params: Default::default(),
2879            _scopes: Default::default(),
2880        }
2881    }
2882
2883    /// Create a builder to help you perform the following task:
2884    ///
2885    /// Lists TagHolds under a TagValue.
2886    ///
2887    /// # Arguments
2888    ///
2889    /// * `parent` - Required. The resource name of the parent TagValue. Must be of the form: `tagValues/{tag-value-id}`.
2890    pub fn tag_holds_list(&self, parent: &str) -> TagValueTagHoldListCall<'a, C> {
2891        TagValueTagHoldListCall {
2892            hub: self.hub,
2893            _parent: parent.to_string(),
2894            _page_token: Default::default(),
2895            _page_size: Default::default(),
2896            _filter: Default::default(),
2897            _delegate: Default::default(),
2898            _additional_params: Default::default(),
2899            _scopes: Default::default(),
2900        }
2901    }
2902
2903    /// Create a builder to help you perform the following task:
2904    ///
2905    /// Creates a TagValue as a child of the specified TagKey. If a another request with the same parameters is sent while the original request is in process the second request will receive an error. A maximum of 1000 TagValues can exist under a TagKey at any given time.
2906    ///
2907    /// # Arguments
2908    ///
2909    /// * `request` - No description provided.
2910    pub fn create(&self, request: TagValue) -> TagValueCreateCall<'a, C> {
2911        TagValueCreateCall {
2912            hub: self.hub,
2913            _request: request,
2914            _validate_only: Default::default(),
2915            _delegate: Default::default(),
2916            _additional_params: Default::default(),
2917            _scopes: Default::default(),
2918        }
2919    }
2920
2921    /// Create a builder to help you perform the following task:
2922    ///
2923    /// Deletes a TagValue. The TagValue cannot have any bindings when it is deleted.
2924    ///
2925    /// # Arguments
2926    ///
2927    /// * `name` - Required. Resource name for TagValue to be deleted in the format tagValues/456.
2928    pub fn delete(&self, name: &str) -> TagValueDeleteCall<'a, C> {
2929        TagValueDeleteCall {
2930            hub: self.hub,
2931            _name: name.to_string(),
2932            _validate_only: Default::default(),
2933            _etag: Default::default(),
2934            _delegate: Default::default(),
2935            _additional_params: Default::default(),
2936            _scopes: Default::default(),
2937        }
2938    }
2939
2940    /// Create a builder to help you perform the following task:
2941    ///
2942    /// Retrieves a TagValue. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it.
2943    ///
2944    /// # Arguments
2945    ///
2946    /// * `name` - Required. Resource name for TagValue to be fetched in the format `tagValues/456`.
2947    pub fn get(&self, name: &str) -> TagValueGetCall<'a, C> {
2948        TagValueGetCall {
2949            hub: self.hub,
2950            _name: name.to_string(),
2951            _delegate: Default::default(),
2952            _additional_params: Default::default(),
2953            _scopes: Default::default(),
2954        }
2955    }
2956
2957    /// Create a builder to help you perform the following task:
2958    ///
2959    /// Gets the access control policy for a TagValue. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. The caller must have the `cloudresourcemanager.googleapis.com/tagValues.getIamPolicy` permission on the identified TagValue to get the access control policy.
2960    ///
2961    /// # Arguments
2962    ///
2963    /// * `request` - No description provided.
2964    /// * `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.
2965    pub fn get_iam_policy(
2966        &self,
2967        request: GetIamPolicyRequest,
2968        resource: &str,
2969    ) -> TagValueGetIamPolicyCall<'a, C> {
2970        TagValueGetIamPolicyCall {
2971            hub: self.hub,
2972            _request: request,
2973            _resource: resource.to_string(),
2974            _delegate: Default::default(),
2975            _additional_params: Default::default(),
2976            _scopes: Default::default(),
2977        }
2978    }
2979
2980    /// Create a builder to help you perform the following task:
2981    ///
2982    /// Retrieves a TagValue by its namespaced name. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it.
2983    pub fn get_namespaced(&self) -> TagValueGetNamespacedCall<'a, C> {
2984        TagValueGetNamespacedCall {
2985            hub: self.hub,
2986            _name: Default::default(),
2987            _delegate: Default::default(),
2988            _additional_params: Default::default(),
2989            _scopes: Default::default(),
2990        }
2991    }
2992
2993    /// Create a builder to help you perform the following task:
2994    ///
2995    /// Lists all TagValues for a specific TagKey.
2996    pub fn list(&self) -> TagValueListCall<'a, C> {
2997        TagValueListCall {
2998            hub: self.hub,
2999            _parent: Default::default(),
3000            _page_token: Default::default(),
3001            _page_size: Default::default(),
3002            _delegate: Default::default(),
3003            _additional_params: Default::default(),
3004            _scopes: Default::default(),
3005        }
3006    }
3007
3008    /// Create a builder to help you perform the following task:
3009    ///
3010    /// Updates the attributes of the TagValue resource.
3011    ///
3012    /// # Arguments
3013    ///
3014    /// * `request` - No description provided.
3015    /// * `name` - Immutable. Resource name for TagValue in the format `tagValues/456`.
3016    pub fn patch(&self, request: TagValue, name: &str) -> TagValuePatchCall<'a, C> {
3017        TagValuePatchCall {
3018            hub: self.hub,
3019            _request: request,
3020            _name: name.to_string(),
3021            _validate_only: Default::default(),
3022            _update_mask: Default::default(),
3023            _delegate: Default::default(),
3024            _additional_params: Default::default(),
3025            _scopes: Default::default(),
3026        }
3027    }
3028
3029    /// Create a builder to help you perform the following task:
3030    ///
3031    /// Sets the access control policy on a TagValue, replacing any existing policy. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. The caller must have `resourcemanager.tagValues.setIamPolicy` permission on the identified tagValue.
3032    ///
3033    /// # Arguments
3034    ///
3035    /// * `request` - No description provided.
3036    /// * `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.
3037    pub fn set_iam_policy(
3038        &self,
3039        request: SetIamPolicyRequest,
3040        resource: &str,
3041    ) -> TagValueSetIamPolicyCall<'a, C> {
3042        TagValueSetIamPolicyCall {
3043            hub: self.hub,
3044            _request: request,
3045            _resource: resource.to_string(),
3046            _delegate: Default::default(),
3047            _additional_params: Default::default(),
3048            _scopes: Default::default(),
3049        }
3050    }
3051
3052    /// Create a builder to help you perform the following task:
3053    ///
3054    /// Returns permissions that a caller has on the specified TagValue. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. There are no permissions required for making this API call.
3055    ///
3056    /// # Arguments
3057    ///
3058    /// * `request` - No description provided.
3059    /// * `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.
3060    pub fn test_iam_permissions(
3061        &self,
3062        request: TestIamPermissionsRequest,
3063        resource: &str,
3064    ) -> TagValueTestIamPermissionCall<'a, C> {
3065        TagValueTestIamPermissionCall {
3066            hub: self.hub,
3067            _request: request,
3068            _resource: resource.to_string(),
3069            _delegate: Default::default(),
3070            _additional_params: Default::default(),
3071            _scopes: Default::default(),
3072        }
3073    }
3074}
3075
3076// ###################
3077// CallBuilders   ###
3078// #################
3079
3080/// Return a list of effective tags for the given Google Cloud resource, as specified in `parent`.
3081///
3082/// A builder for the *list* method supported by a *effectiveTag* resource.
3083/// It is not used directly, but through a [`EffectiveTagMethods`] instance.
3084///
3085/// # Example
3086///
3087/// Instantiate a resource method builder
3088///
3089/// ```test_harness,no_run
3090/// # extern crate hyper;
3091/// # extern crate hyper_rustls;
3092/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
3093/// # async fn dox() {
3094/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3095///
3096/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3097/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3098/// #     .with_native_roots()
3099/// #     .unwrap()
3100/// #     .https_only()
3101/// #     .enable_http2()
3102/// #     .build();
3103///
3104/// # let executor = hyper_util::rt::TokioExecutor::new();
3105/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3106/// #     secret,
3107/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3108/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3109/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3110/// #     ),
3111/// # ).build().await.unwrap();
3112///
3113/// # let client = hyper_util::client::legacy::Client::builder(
3114/// #     hyper_util::rt::TokioExecutor::new()
3115/// # )
3116/// # .build(
3117/// #     hyper_rustls::HttpsConnectorBuilder::new()
3118/// #         .with_native_roots()
3119/// #         .unwrap()
3120/// #         .https_or_http()
3121/// #         .enable_http2()
3122/// #         .build()
3123/// # );
3124/// # let mut hub = CloudResourceManager::new(client, auth);
3125/// // You can configure optional parameters by calling the respective setters at will, and
3126/// // execute the final call using `doit()`.
3127/// // Values shown here are possibly random and not representative !
3128/// let result = hub.effective_tags().list()
3129///              .parent("amet.")
3130///              .page_token("duo")
3131///              .page_size(-55)
3132///              .doit().await;
3133/// # }
3134/// ```
3135pub struct EffectiveTagListCall<'a, C>
3136where
3137    C: 'a,
3138{
3139    hub: &'a CloudResourceManager<C>,
3140    _parent: Option<String>,
3141    _page_token: Option<String>,
3142    _page_size: Option<i32>,
3143    _delegate: Option<&'a mut dyn common::Delegate>,
3144    _additional_params: HashMap<String, String>,
3145    _scopes: BTreeSet<String>,
3146}
3147
3148impl<'a, C> common::CallBuilder for EffectiveTagListCall<'a, C> {}
3149
3150impl<'a, C> EffectiveTagListCall<'a, C>
3151where
3152    C: common::Connector,
3153{
3154    /// Perform the operation you have build so far.
3155    pub async fn doit(mut self) -> common::Result<(common::Response, ListEffectiveTagsResponse)> {
3156        use std::borrow::Cow;
3157        use std::io::{Read, Seek};
3158
3159        use common::{url::Params, ToParts};
3160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3161
3162        let mut dd = common::DefaultDelegate;
3163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3164        dlg.begin(common::MethodInfo {
3165            id: "cloudresourcemanager.effectiveTags.list",
3166            http_method: hyper::Method::GET,
3167        });
3168
3169        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3170            if self._additional_params.contains_key(field) {
3171                dlg.finished(false);
3172                return Err(common::Error::FieldClash(field));
3173            }
3174        }
3175
3176        let mut params = Params::with_capacity(5 + self._additional_params.len());
3177        if let Some(value) = self._parent.as_ref() {
3178            params.push("parent", value);
3179        }
3180        if let Some(value) = self._page_token.as_ref() {
3181            params.push("pageToken", value);
3182        }
3183        if let Some(value) = self._page_size.as_ref() {
3184            params.push("pageSize", value.to_string());
3185        }
3186
3187        params.extend(self._additional_params.iter());
3188
3189        params.push("alt", "json");
3190        let mut url = self.hub._base_url.clone() + "v3/effectiveTags";
3191        if self._scopes.is_empty() {
3192            self._scopes
3193                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
3194        }
3195
3196        let url = params.parse_with_url(&url);
3197
3198        loop {
3199            let token = match self
3200                .hub
3201                .auth
3202                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3203                .await
3204            {
3205                Ok(token) => token,
3206                Err(e) => match dlg.token(e) {
3207                    Ok(token) => token,
3208                    Err(e) => {
3209                        dlg.finished(false);
3210                        return Err(common::Error::MissingToken(e));
3211                    }
3212                },
3213            };
3214            let mut req_result = {
3215                let client = &self.hub.client;
3216                dlg.pre_request();
3217                let mut req_builder = hyper::Request::builder()
3218                    .method(hyper::Method::GET)
3219                    .uri(url.as_str())
3220                    .header(USER_AGENT, self.hub._user_agent.clone());
3221
3222                if let Some(token) = token.as_ref() {
3223                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3224                }
3225
3226                let request = req_builder
3227                    .header(CONTENT_LENGTH, 0_u64)
3228                    .body(common::to_body::<String>(None));
3229
3230                client.request(request.unwrap()).await
3231            };
3232
3233            match req_result {
3234                Err(err) => {
3235                    if let common::Retry::After(d) = dlg.http_error(&err) {
3236                        sleep(d).await;
3237                        continue;
3238                    }
3239                    dlg.finished(false);
3240                    return Err(common::Error::HttpError(err));
3241                }
3242                Ok(res) => {
3243                    let (mut parts, body) = res.into_parts();
3244                    let mut body = common::Body::new(body);
3245                    if !parts.status.is_success() {
3246                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3247                        let error = serde_json::from_str(&common::to_string(&bytes));
3248                        let response = common::to_response(parts, bytes.into());
3249
3250                        if let common::Retry::After(d) =
3251                            dlg.http_failure(&response, error.as_ref().ok())
3252                        {
3253                            sleep(d).await;
3254                            continue;
3255                        }
3256
3257                        dlg.finished(false);
3258
3259                        return Err(match error {
3260                            Ok(value) => common::Error::BadRequest(value),
3261                            _ => common::Error::Failure(response),
3262                        });
3263                    }
3264                    let response = {
3265                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3266                        let encoded = common::to_string(&bytes);
3267                        match serde_json::from_str(&encoded) {
3268                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3269                            Err(error) => {
3270                                dlg.response_json_decode_error(&encoded, &error);
3271                                return Err(common::Error::JsonDecodeError(
3272                                    encoded.to_string(),
3273                                    error,
3274                                ));
3275                            }
3276                        }
3277                    };
3278
3279                    dlg.finished(true);
3280                    return Ok(response);
3281                }
3282            }
3283        }
3284    }
3285
3286    /// Required. The full resource name of a resource for which you want to list the effective tags. E.g. "//cloudresourcemanager.googleapis.com/projects/123"
3287    ///
3288    /// Sets the *parent* query property to the given value.
3289    pub fn parent(mut self, new_value: &str) -> EffectiveTagListCall<'a, C> {
3290        self._parent = Some(new_value.to_string());
3291        self
3292    }
3293    /// Optional. A pagination token returned from a previous call to `ListEffectiveTags` that indicates from where this listing should continue.
3294    ///
3295    /// Sets the *page token* query property to the given value.
3296    pub fn page_token(mut self, new_value: &str) -> EffectiveTagListCall<'a, C> {
3297        self._page_token = Some(new_value.to_string());
3298        self
3299    }
3300    /// Optional. The maximum number of effective tags to return in the response. The server allows a maximum of 300 effective tags to return in a single page. If unspecified, the server will use 100 as the default.
3301    ///
3302    /// Sets the *page size* query property to the given value.
3303    pub fn page_size(mut self, new_value: i32) -> EffectiveTagListCall<'a, C> {
3304        self._page_size = Some(new_value);
3305        self
3306    }
3307    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3308    /// while executing the actual API request.
3309    ///
3310    /// ````text
3311    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3312    /// ````
3313    ///
3314    /// Sets the *delegate* property to the given value.
3315    pub fn delegate(
3316        mut self,
3317        new_value: &'a mut dyn common::Delegate,
3318    ) -> EffectiveTagListCall<'a, C> {
3319        self._delegate = Some(new_value);
3320        self
3321    }
3322
3323    /// Set any additional parameter of the query string used in the request.
3324    /// It should be used to set parameters which are not yet available through their own
3325    /// setters.
3326    ///
3327    /// Please note that this method must not be used to set any of the known parameters
3328    /// which have their own setter method. If done anyway, the request will fail.
3329    ///
3330    /// # Additional Parameters
3331    ///
3332    /// * *$.xgafv* (query-string) - V1 error format.
3333    /// * *access_token* (query-string) - OAuth access token.
3334    /// * *alt* (query-string) - Data format for response.
3335    /// * *callback* (query-string) - JSONP
3336    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3337    /// * *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.
3338    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3339    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3340    /// * *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.
3341    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3342    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3343    pub fn param<T>(mut self, name: T, value: T) -> EffectiveTagListCall<'a, C>
3344    where
3345        T: AsRef<str>,
3346    {
3347        self._additional_params
3348            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3349        self
3350    }
3351
3352    /// Identifies the authorization scope for the method you are building.
3353    ///
3354    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3355    /// [`Scope::CloudPlatformReadOnly`].
3356    ///
3357    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3358    /// tokens for more than one scope.
3359    ///
3360    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3361    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3362    /// sufficient, a read-write scope will do as well.
3363    pub fn add_scope<St>(mut self, scope: St) -> EffectiveTagListCall<'a, C>
3364    where
3365        St: AsRef<str>,
3366    {
3367        self._scopes.insert(String::from(scope.as_ref()));
3368        self
3369    }
3370    /// Identifies the authorization scope(s) for the method you are building.
3371    ///
3372    /// See [`Self::add_scope()`] for details.
3373    pub fn add_scopes<I, St>(mut self, scopes: I) -> EffectiveTagListCall<'a, C>
3374    where
3375        I: IntoIterator<Item = St>,
3376        St: AsRef<str>,
3377    {
3378        self._scopes
3379            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3380        self
3381    }
3382
3383    /// Removes all scopes, and no default scope will be used either.
3384    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3385    /// for details).
3386    pub fn clear_scopes(mut self) -> EffectiveTagListCall<'a, C> {
3387        self._scopes.clear();
3388        self
3389    }
3390}
3391
3392/// Retrieves the Capability identified by the supplied resource name.
3393///
3394/// A builder for the *capabilities.get* method supported by a *folder* resource.
3395/// It is not used directly, but through a [`FolderMethods`] instance.
3396///
3397/// # Example
3398///
3399/// Instantiate a resource method builder
3400///
3401/// ```test_harness,no_run
3402/// # extern crate hyper;
3403/// # extern crate hyper_rustls;
3404/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
3405/// # async fn dox() {
3406/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3407///
3408/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3409/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3410/// #     .with_native_roots()
3411/// #     .unwrap()
3412/// #     .https_only()
3413/// #     .enable_http2()
3414/// #     .build();
3415///
3416/// # let executor = hyper_util::rt::TokioExecutor::new();
3417/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3418/// #     secret,
3419/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3420/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3421/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3422/// #     ),
3423/// # ).build().await.unwrap();
3424///
3425/// # let client = hyper_util::client::legacy::Client::builder(
3426/// #     hyper_util::rt::TokioExecutor::new()
3427/// # )
3428/// # .build(
3429/// #     hyper_rustls::HttpsConnectorBuilder::new()
3430/// #         .with_native_roots()
3431/// #         .unwrap()
3432/// #         .https_or_http()
3433/// #         .enable_http2()
3434/// #         .build()
3435/// # );
3436/// # let mut hub = CloudResourceManager::new(client, auth);
3437/// // You can configure optional parameters by calling the respective setters at will, and
3438/// // execute the final call using `doit()`.
3439/// // Values shown here are possibly random and not representative !
3440/// let result = hub.folders().capabilities_get("name")
3441///              .doit().await;
3442/// # }
3443/// ```
3444pub struct FolderCapabilityGetCall<'a, C>
3445where
3446    C: 'a,
3447{
3448    hub: &'a CloudResourceManager<C>,
3449    _name: String,
3450    _delegate: Option<&'a mut dyn common::Delegate>,
3451    _additional_params: HashMap<String, String>,
3452    _scopes: BTreeSet<String>,
3453}
3454
3455impl<'a, C> common::CallBuilder for FolderCapabilityGetCall<'a, C> {}
3456
3457impl<'a, C> FolderCapabilityGetCall<'a, C>
3458where
3459    C: common::Connector,
3460{
3461    /// Perform the operation you have build so far.
3462    pub async fn doit(mut self) -> common::Result<(common::Response, Capability)> {
3463        use std::borrow::Cow;
3464        use std::io::{Read, Seek};
3465
3466        use common::{url::Params, ToParts};
3467        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3468
3469        let mut dd = common::DefaultDelegate;
3470        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3471        dlg.begin(common::MethodInfo {
3472            id: "cloudresourcemanager.folders.capabilities.get",
3473            http_method: hyper::Method::GET,
3474        });
3475
3476        for &field in ["alt", "name"].iter() {
3477            if self._additional_params.contains_key(field) {
3478                dlg.finished(false);
3479                return Err(common::Error::FieldClash(field));
3480            }
3481        }
3482
3483        let mut params = Params::with_capacity(3 + self._additional_params.len());
3484        params.push("name", self._name);
3485
3486        params.extend(self._additional_params.iter());
3487
3488        params.push("alt", "json");
3489        let mut url = self.hub._base_url.clone() + "v3/{+name}";
3490        if self._scopes.is_empty() {
3491            self._scopes
3492                .insert(Scope::CloudPlatform.as_ref().to_string());
3493        }
3494
3495        #[allow(clippy::single_element_loop)]
3496        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3497            url = params.uri_replacement(url, param_name, find_this, true);
3498        }
3499        {
3500            let to_remove = ["name"];
3501            params.remove_params(&to_remove);
3502        }
3503
3504        let url = params.parse_with_url(&url);
3505
3506        loop {
3507            let token = match self
3508                .hub
3509                .auth
3510                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3511                .await
3512            {
3513                Ok(token) => token,
3514                Err(e) => match dlg.token(e) {
3515                    Ok(token) => token,
3516                    Err(e) => {
3517                        dlg.finished(false);
3518                        return Err(common::Error::MissingToken(e));
3519                    }
3520                },
3521            };
3522            let mut req_result = {
3523                let client = &self.hub.client;
3524                dlg.pre_request();
3525                let mut req_builder = hyper::Request::builder()
3526                    .method(hyper::Method::GET)
3527                    .uri(url.as_str())
3528                    .header(USER_AGENT, self.hub._user_agent.clone());
3529
3530                if let Some(token) = token.as_ref() {
3531                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3532                }
3533
3534                let request = req_builder
3535                    .header(CONTENT_LENGTH, 0_u64)
3536                    .body(common::to_body::<String>(None));
3537
3538                client.request(request.unwrap()).await
3539            };
3540
3541            match req_result {
3542                Err(err) => {
3543                    if let common::Retry::After(d) = dlg.http_error(&err) {
3544                        sleep(d).await;
3545                        continue;
3546                    }
3547                    dlg.finished(false);
3548                    return Err(common::Error::HttpError(err));
3549                }
3550                Ok(res) => {
3551                    let (mut parts, body) = res.into_parts();
3552                    let mut body = common::Body::new(body);
3553                    if !parts.status.is_success() {
3554                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3555                        let error = serde_json::from_str(&common::to_string(&bytes));
3556                        let response = common::to_response(parts, bytes.into());
3557
3558                        if let common::Retry::After(d) =
3559                            dlg.http_failure(&response, error.as_ref().ok())
3560                        {
3561                            sleep(d).await;
3562                            continue;
3563                        }
3564
3565                        dlg.finished(false);
3566
3567                        return Err(match error {
3568                            Ok(value) => common::Error::BadRequest(value),
3569                            _ => common::Error::Failure(response),
3570                        });
3571                    }
3572                    let response = {
3573                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3574                        let encoded = common::to_string(&bytes);
3575                        match serde_json::from_str(&encoded) {
3576                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3577                            Err(error) => {
3578                                dlg.response_json_decode_error(&encoded, &error);
3579                                return Err(common::Error::JsonDecodeError(
3580                                    encoded.to_string(),
3581                                    error,
3582                                ));
3583                            }
3584                        }
3585                    };
3586
3587                    dlg.finished(true);
3588                    return Ok(response);
3589                }
3590            }
3591        }
3592    }
3593
3594    /// Required. The name of the capability to get. For example, `folders/123/capabilities/app-management`
3595    ///
3596    /// Sets the *name* path property to the given value.
3597    ///
3598    /// Even though the property as already been set when instantiating this call,
3599    /// we provide this method for API completeness.
3600    pub fn name(mut self, new_value: &str) -> FolderCapabilityGetCall<'a, C> {
3601        self._name = new_value.to_string();
3602        self
3603    }
3604    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3605    /// while executing the actual API request.
3606    ///
3607    /// ````text
3608    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3609    /// ````
3610    ///
3611    /// Sets the *delegate* property to the given value.
3612    pub fn delegate(
3613        mut self,
3614        new_value: &'a mut dyn common::Delegate,
3615    ) -> FolderCapabilityGetCall<'a, C> {
3616        self._delegate = Some(new_value);
3617        self
3618    }
3619
3620    /// Set any additional parameter of the query string used in the request.
3621    /// It should be used to set parameters which are not yet available through their own
3622    /// setters.
3623    ///
3624    /// Please note that this method must not be used to set any of the known parameters
3625    /// which have their own setter method. If done anyway, the request will fail.
3626    ///
3627    /// # Additional Parameters
3628    ///
3629    /// * *$.xgafv* (query-string) - V1 error format.
3630    /// * *access_token* (query-string) - OAuth access token.
3631    /// * *alt* (query-string) - Data format for response.
3632    /// * *callback* (query-string) - JSONP
3633    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3634    /// * *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.
3635    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3636    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3637    /// * *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.
3638    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3639    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3640    pub fn param<T>(mut self, name: T, value: T) -> FolderCapabilityGetCall<'a, C>
3641    where
3642        T: AsRef<str>,
3643    {
3644        self._additional_params
3645            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3646        self
3647    }
3648
3649    /// Identifies the authorization scope for the method you are building.
3650    ///
3651    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3652    /// [`Scope::CloudPlatform`].
3653    ///
3654    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3655    /// tokens for more than one scope.
3656    ///
3657    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3658    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3659    /// sufficient, a read-write scope will do as well.
3660    pub fn add_scope<St>(mut self, scope: St) -> FolderCapabilityGetCall<'a, C>
3661    where
3662        St: AsRef<str>,
3663    {
3664        self._scopes.insert(String::from(scope.as_ref()));
3665        self
3666    }
3667    /// Identifies the authorization scope(s) for the method you are building.
3668    ///
3669    /// See [`Self::add_scope()`] for details.
3670    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderCapabilityGetCall<'a, C>
3671    where
3672        I: IntoIterator<Item = St>,
3673        St: AsRef<str>,
3674    {
3675        self._scopes
3676            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3677        self
3678    }
3679
3680    /// Removes all scopes, and no default scope will be used either.
3681    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3682    /// for details).
3683    pub fn clear_scopes(mut self) -> FolderCapabilityGetCall<'a, C> {
3684        self._scopes.clear();
3685        self
3686    }
3687}
3688
3689/// Updates the Capability.
3690///
3691/// A builder for the *capabilities.patch* method supported by a *folder* resource.
3692/// It is not used directly, but through a [`FolderMethods`] instance.
3693///
3694/// # Example
3695///
3696/// Instantiate a resource method builder
3697///
3698/// ```test_harness,no_run
3699/// # extern crate hyper;
3700/// # extern crate hyper_rustls;
3701/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
3702/// use cloudresourcemanager3::api::Capability;
3703/// # async fn dox() {
3704/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3705///
3706/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3707/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3708/// #     .with_native_roots()
3709/// #     .unwrap()
3710/// #     .https_only()
3711/// #     .enable_http2()
3712/// #     .build();
3713///
3714/// # let executor = hyper_util::rt::TokioExecutor::new();
3715/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3716/// #     secret,
3717/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3718/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3719/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3720/// #     ),
3721/// # ).build().await.unwrap();
3722///
3723/// # let client = hyper_util::client::legacy::Client::builder(
3724/// #     hyper_util::rt::TokioExecutor::new()
3725/// # )
3726/// # .build(
3727/// #     hyper_rustls::HttpsConnectorBuilder::new()
3728/// #         .with_native_roots()
3729/// #         .unwrap()
3730/// #         .https_or_http()
3731/// #         .enable_http2()
3732/// #         .build()
3733/// # );
3734/// # let mut hub = CloudResourceManager::new(client, auth);
3735/// // As the method needs a request, you would usually fill it with the desired information
3736/// // into the respective structure. Some of the parts shown here might not be applicable !
3737/// // Values shown here are possibly random and not representative !
3738/// let mut req = Capability::default();
3739///
3740/// // You can configure optional parameters by calling the respective setters at will, and
3741/// // execute the final call using `doit()`.
3742/// // Values shown here are possibly random and not representative !
3743/// let result = hub.folders().capabilities_patch(req, "name")
3744///              .update_mask(FieldMask::new::<&str>(&[]))
3745///              .doit().await;
3746/// # }
3747/// ```
3748pub struct FolderCapabilityPatchCall<'a, C>
3749where
3750    C: 'a,
3751{
3752    hub: &'a CloudResourceManager<C>,
3753    _request: Capability,
3754    _name: String,
3755    _update_mask: Option<common::FieldMask>,
3756    _delegate: Option<&'a mut dyn common::Delegate>,
3757    _additional_params: HashMap<String, String>,
3758    _scopes: BTreeSet<String>,
3759}
3760
3761impl<'a, C> common::CallBuilder for FolderCapabilityPatchCall<'a, C> {}
3762
3763impl<'a, C> FolderCapabilityPatchCall<'a, C>
3764where
3765    C: common::Connector,
3766{
3767    /// Perform the operation you have build so far.
3768    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3769        use std::borrow::Cow;
3770        use std::io::{Read, Seek};
3771
3772        use common::{url::Params, ToParts};
3773        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3774
3775        let mut dd = common::DefaultDelegate;
3776        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3777        dlg.begin(common::MethodInfo {
3778            id: "cloudresourcemanager.folders.capabilities.patch",
3779            http_method: hyper::Method::PATCH,
3780        });
3781
3782        for &field in ["alt", "name", "updateMask"].iter() {
3783            if self._additional_params.contains_key(field) {
3784                dlg.finished(false);
3785                return Err(common::Error::FieldClash(field));
3786            }
3787        }
3788
3789        let mut params = Params::with_capacity(5 + self._additional_params.len());
3790        params.push("name", self._name);
3791        if let Some(value) = self._update_mask.as_ref() {
3792            params.push("updateMask", value.to_string());
3793        }
3794
3795        params.extend(self._additional_params.iter());
3796
3797        params.push("alt", "json");
3798        let mut url = self.hub._base_url.clone() + "v3/{+name}";
3799        if self._scopes.is_empty() {
3800            self._scopes
3801                .insert(Scope::CloudPlatform.as_ref().to_string());
3802        }
3803
3804        #[allow(clippy::single_element_loop)]
3805        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3806            url = params.uri_replacement(url, param_name, find_this, true);
3807        }
3808        {
3809            let to_remove = ["name"];
3810            params.remove_params(&to_remove);
3811        }
3812
3813        let url = params.parse_with_url(&url);
3814
3815        let mut json_mime_type = mime::APPLICATION_JSON;
3816        let mut request_value_reader = {
3817            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3818            common::remove_json_null_values(&mut value);
3819            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3820            serde_json::to_writer(&mut dst, &value).unwrap();
3821            dst
3822        };
3823        let request_size = request_value_reader
3824            .seek(std::io::SeekFrom::End(0))
3825            .unwrap();
3826        request_value_reader
3827            .seek(std::io::SeekFrom::Start(0))
3828            .unwrap();
3829
3830        loop {
3831            let token = match self
3832                .hub
3833                .auth
3834                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3835                .await
3836            {
3837                Ok(token) => token,
3838                Err(e) => match dlg.token(e) {
3839                    Ok(token) => token,
3840                    Err(e) => {
3841                        dlg.finished(false);
3842                        return Err(common::Error::MissingToken(e));
3843                    }
3844                },
3845            };
3846            request_value_reader
3847                .seek(std::io::SeekFrom::Start(0))
3848                .unwrap();
3849            let mut req_result = {
3850                let client = &self.hub.client;
3851                dlg.pre_request();
3852                let mut req_builder = hyper::Request::builder()
3853                    .method(hyper::Method::PATCH)
3854                    .uri(url.as_str())
3855                    .header(USER_AGENT, self.hub._user_agent.clone());
3856
3857                if let Some(token) = token.as_ref() {
3858                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3859                }
3860
3861                let request = req_builder
3862                    .header(CONTENT_TYPE, json_mime_type.to_string())
3863                    .header(CONTENT_LENGTH, request_size as u64)
3864                    .body(common::to_body(
3865                        request_value_reader.get_ref().clone().into(),
3866                    ));
3867
3868                client.request(request.unwrap()).await
3869            };
3870
3871            match req_result {
3872                Err(err) => {
3873                    if let common::Retry::After(d) = dlg.http_error(&err) {
3874                        sleep(d).await;
3875                        continue;
3876                    }
3877                    dlg.finished(false);
3878                    return Err(common::Error::HttpError(err));
3879                }
3880                Ok(res) => {
3881                    let (mut parts, body) = res.into_parts();
3882                    let mut body = common::Body::new(body);
3883                    if !parts.status.is_success() {
3884                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3885                        let error = serde_json::from_str(&common::to_string(&bytes));
3886                        let response = common::to_response(parts, bytes.into());
3887
3888                        if let common::Retry::After(d) =
3889                            dlg.http_failure(&response, error.as_ref().ok())
3890                        {
3891                            sleep(d).await;
3892                            continue;
3893                        }
3894
3895                        dlg.finished(false);
3896
3897                        return Err(match error {
3898                            Ok(value) => common::Error::BadRequest(value),
3899                            _ => common::Error::Failure(response),
3900                        });
3901                    }
3902                    let response = {
3903                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3904                        let encoded = common::to_string(&bytes);
3905                        match serde_json::from_str(&encoded) {
3906                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3907                            Err(error) => {
3908                                dlg.response_json_decode_error(&encoded, &error);
3909                                return Err(common::Error::JsonDecodeError(
3910                                    encoded.to_string(),
3911                                    error,
3912                                ));
3913                            }
3914                        }
3915                    };
3916
3917                    dlg.finished(true);
3918                    return Ok(response);
3919                }
3920            }
3921        }
3922    }
3923
3924    ///
3925    /// Sets the *request* property to the given value.
3926    ///
3927    /// Even though the property as already been set when instantiating this call,
3928    /// we provide this method for API completeness.
3929    pub fn request(mut self, new_value: Capability) -> FolderCapabilityPatchCall<'a, C> {
3930        self._request = new_value;
3931        self
3932    }
3933    /// Immutable. Identifier. The resource name of the capability. Must be in the following form: * `folders/{folder_id}/capabilities/{capability_name}` For example, `folders/123/capabilities/app-management` Following are the allowed {capability_name} values: * `app-management`
3934    ///
3935    /// Sets the *name* path property to the given value.
3936    ///
3937    /// Even though the property as already been set when instantiating this call,
3938    /// we provide this method for API completeness.
3939    pub fn name(mut self, new_value: &str) -> FolderCapabilityPatchCall<'a, C> {
3940        self._name = new_value.to_string();
3941        self
3942    }
3943    /// Optional. The list of fields to update. Only [Capability.value] can be updated.
3944    ///
3945    /// Sets the *update mask* query property to the given value.
3946    pub fn update_mask(mut self, new_value: common::FieldMask) -> FolderCapabilityPatchCall<'a, C> {
3947        self._update_mask = Some(new_value);
3948        self
3949    }
3950    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3951    /// while executing the actual API request.
3952    ///
3953    /// ````text
3954    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3955    /// ````
3956    ///
3957    /// Sets the *delegate* property to the given value.
3958    pub fn delegate(
3959        mut self,
3960        new_value: &'a mut dyn common::Delegate,
3961    ) -> FolderCapabilityPatchCall<'a, C> {
3962        self._delegate = Some(new_value);
3963        self
3964    }
3965
3966    /// Set any additional parameter of the query string used in the request.
3967    /// It should be used to set parameters which are not yet available through their own
3968    /// setters.
3969    ///
3970    /// Please note that this method must not be used to set any of the known parameters
3971    /// which have their own setter method. If done anyway, the request will fail.
3972    ///
3973    /// # Additional Parameters
3974    ///
3975    /// * *$.xgafv* (query-string) - V1 error format.
3976    /// * *access_token* (query-string) - OAuth access token.
3977    /// * *alt* (query-string) - Data format for response.
3978    /// * *callback* (query-string) - JSONP
3979    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3980    /// * *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.
3981    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3982    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3983    /// * *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.
3984    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3985    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3986    pub fn param<T>(mut self, name: T, value: T) -> FolderCapabilityPatchCall<'a, C>
3987    where
3988        T: AsRef<str>,
3989    {
3990        self._additional_params
3991            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3992        self
3993    }
3994
3995    /// Identifies the authorization scope for the method you are building.
3996    ///
3997    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3998    /// [`Scope::CloudPlatform`].
3999    ///
4000    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4001    /// tokens for more than one scope.
4002    ///
4003    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4004    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4005    /// sufficient, a read-write scope will do as well.
4006    pub fn add_scope<St>(mut self, scope: St) -> FolderCapabilityPatchCall<'a, C>
4007    where
4008        St: AsRef<str>,
4009    {
4010        self._scopes.insert(String::from(scope.as_ref()));
4011        self
4012    }
4013    /// Identifies the authorization scope(s) for the method you are building.
4014    ///
4015    /// See [`Self::add_scope()`] for details.
4016    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderCapabilityPatchCall<'a, C>
4017    where
4018        I: IntoIterator<Item = St>,
4019        St: AsRef<str>,
4020    {
4021        self._scopes
4022            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4023        self
4024    }
4025
4026    /// Removes all scopes, and no default scope will be used either.
4027    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4028    /// for details).
4029    pub fn clear_scopes(mut self) -> FolderCapabilityPatchCall<'a, C> {
4030        self._scopes.clear();
4031        self
4032    }
4033}
4034
4035/// Creates a folder in the resource hierarchy. Returns an `Operation` which can be used to track the progress of the folder creation workflow. Upon success, the `Operation.response` field will be populated with the created Folder. In order to succeed, the addition of this new folder must not violate the folder naming, height, or fanout constraints. + The folder's `display_name` must be distinct from all other folders that share its parent. + The addition of the folder must not cause the active folder hierarchy to exceed a height of 10. Note, the full active + deleted folder hierarchy is allowed to reach a height of 20; this provides additional headroom when moving folders that contain deleted folders. + The addition of the folder must not cause the total number of folders under its parent to exceed 300. If the operation fails due to a folder constraint violation, some errors may be returned by the `CreateFolder` request, with status code `FAILED_PRECONDITION` and an error description. Other folder constraint violations will be communicated in the `Operation`, with the specific `PreconditionFailure` returned in the details list in the `Operation.error` field. The caller must have `resourcemanager.folders.create` permission on the identified parent.
4036///
4037/// A builder for the *create* method supported by a *folder* resource.
4038/// It is not used directly, but through a [`FolderMethods`] instance.
4039///
4040/// # Example
4041///
4042/// Instantiate a resource method builder
4043///
4044/// ```test_harness,no_run
4045/// # extern crate hyper;
4046/// # extern crate hyper_rustls;
4047/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
4048/// use cloudresourcemanager3::api::Folder;
4049/// # async fn dox() {
4050/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4051///
4052/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4053/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4054/// #     .with_native_roots()
4055/// #     .unwrap()
4056/// #     .https_only()
4057/// #     .enable_http2()
4058/// #     .build();
4059///
4060/// # let executor = hyper_util::rt::TokioExecutor::new();
4061/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4062/// #     secret,
4063/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4064/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4065/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4066/// #     ),
4067/// # ).build().await.unwrap();
4068///
4069/// # let client = hyper_util::client::legacy::Client::builder(
4070/// #     hyper_util::rt::TokioExecutor::new()
4071/// # )
4072/// # .build(
4073/// #     hyper_rustls::HttpsConnectorBuilder::new()
4074/// #         .with_native_roots()
4075/// #         .unwrap()
4076/// #         .https_or_http()
4077/// #         .enable_http2()
4078/// #         .build()
4079/// # );
4080/// # let mut hub = CloudResourceManager::new(client, auth);
4081/// // As the method needs a request, you would usually fill it with the desired information
4082/// // into the respective structure. Some of the parts shown here might not be applicable !
4083/// // Values shown here are possibly random and not representative !
4084/// let mut req = Folder::default();
4085///
4086/// // You can configure optional parameters by calling the respective setters at will, and
4087/// // execute the final call using `doit()`.
4088/// // Values shown here are possibly random and not representative !
4089/// let result = hub.folders().create(req)
4090///              .doit().await;
4091/// # }
4092/// ```
4093pub struct FolderCreateCall<'a, C>
4094where
4095    C: 'a,
4096{
4097    hub: &'a CloudResourceManager<C>,
4098    _request: Folder,
4099    _delegate: Option<&'a mut dyn common::Delegate>,
4100    _additional_params: HashMap<String, String>,
4101    _scopes: BTreeSet<String>,
4102}
4103
4104impl<'a, C> common::CallBuilder for FolderCreateCall<'a, C> {}
4105
4106impl<'a, C> FolderCreateCall<'a, C>
4107where
4108    C: common::Connector,
4109{
4110    /// Perform the operation you have build so far.
4111    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4112        use std::borrow::Cow;
4113        use std::io::{Read, Seek};
4114
4115        use common::{url::Params, ToParts};
4116        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4117
4118        let mut dd = common::DefaultDelegate;
4119        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4120        dlg.begin(common::MethodInfo {
4121            id: "cloudresourcemanager.folders.create",
4122            http_method: hyper::Method::POST,
4123        });
4124
4125        for &field in ["alt"].iter() {
4126            if self._additional_params.contains_key(field) {
4127                dlg.finished(false);
4128                return Err(common::Error::FieldClash(field));
4129            }
4130        }
4131
4132        let mut params = Params::with_capacity(3 + self._additional_params.len());
4133
4134        params.extend(self._additional_params.iter());
4135
4136        params.push("alt", "json");
4137        let mut url = self.hub._base_url.clone() + "v3/folders";
4138        if self._scopes.is_empty() {
4139            self._scopes
4140                .insert(Scope::CloudPlatform.as_ref().to_string());
4141        }
4142
4143        let url = params.parse_with_url(&url);
4144
4145        let mut json_mime_type = mime::APPLICATION_JSON;
4146        let mut request_value_reader = {
4147            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4148            common::remove_json_null_values(&mut value);
4149            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4150            serde_json::to_writer(&mut dst, &value).unwrap();
4151            dst
4152        };
4153        let request_size = request_value_reader
4154            .seek(std::io::SeekFrom::End(0))
4155            .unwrap();
4156        request_value_reader
4157            .seek(std::io::SeekFrom::Start(0))
4158            .unwrap();
4159
4160        loop {
4161            let token = match self
4162                .hub
4163                .auth
4164                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4165                .await
4166            {
4167                Ok(token) => token,
4168                Err(e) => match dlg.token(e) {
4169                    Ok(token) => token,
4170                    Err(e) => {
4171                        dlg.finished(false);
4172                        return Err(common::Error::MissingToken(e));
4173                    }
4174                },
4175            };
4176            request_value_reader
4177                .seek(std::io::SeekFrom::Start(0))
4178                .unwrap();
4179            let mut req_result = {
4180                let client = &self.hub.client;
4181                dlg.pre_request();
4182                let mut req_builder = hyper::Request::builder()
4183                    .method(hyper::Method::POST)
4184                    .uri(url.as_str())
4185                    .header(USER_AGENT, self.hub._user_agent.clone());
4186
4187                if let Some(token) = token.as_ref() {
4188                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4189                }
4190
4191                let request = req_builder
4192                    .header(CONTENT_TYPE, json_mime_type.to_string())
4193                    .header(CONTENT_LENGTH, request_size as u64)
4194                    .body(common::to_body(
4195                        request_value_reader.get_ref().clone().into(),
4196                    ));
4197
4198                client.request(request.unwrap()).await
4199            };
4200
4201            match req_result {
4202                Err(err) => {
4203                    if let common::Retry::After(d) = dlg.http_error(&err) {
4204                        sleep(d).await;
4205                        continue;
4206                    }
4207                    dlg.finished(false);
4208                    return Err(common::Error::HttpError(err));
4209                }
4210                Ok(res) => {
4211                    let (mut parts, body) = res.into_parts();
4212                    let mut body = common::Body::new(body);
4213                    if !parts.status.is_success() {
4214                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4215                        let error = serde_json::from_str(&common::to_string(&bytes));
4216                        let response = common::to_response(parts, bytes.into());
4217
4218                        if let common::Retry::After(d) =
4219                            dlg.http_failure(&response, error.as_ref().ok())
4220                        {
4221                            sleep(d).await;
4222                            continue;
4223                        }
4224
4225                        dlg.finished(false);
4226
4227                        return Err(match error {
4228                            Ok(value) => common::Error::BadRequest(value),
4229                            _ => common::Error::Failure(response),
4230                        });
4231                    }
4232                    let response = {
4233                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4234                        let encoded = common::to_string(&bytes);
4235                        match serde_json::from_str(&encoded) {
4236                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4237                            Err(error) => {
4238                                dlg.response_json_decode_error(&encoded, &error);
4239                                return Err(common::Error::JsonDecodeError(
4240                                    encoded.to_string(),
4241                                    error,
4242                                ));
4243                            }
4244                        }
4245                    };
4246
4247                    dlg.finished(true);
4248                    return Ok(response);
4249                }
4250            }
4251        }
4252    }
4253
4254    ///
4255    /// Sets the *request* property to the given value.
4256    ///
4257    /// Even though the property as already been set when instantiating this call,
4258    /// we provide this method for API completeness.
4259    pub fn request(mut self, new_value: Folder) -> FolderCreateCall<'a, C> {
4260        self._request = new_value;
4261        self
4262    }
4263    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4264    /// while executing the actual API request.
4265    ///
4266    /// ````text
4267    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4268    /// ````
4269    ///
4270    /// Sets the *delegate* property to the given value.
4271    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FolderCreateCall<'a, C> {
4272        self._delegate = Some(new_value);
4273        self
4274    }
4275
4276    /// Set any additional parameter of the query string used in the request.
4277    /// It should be used to set parameters which are not yet available through their own
4278    /// setters.
4279    ///
4280    /// Please note that this method must not be used to set any of the known parameters
4281    /// which have their own setter method. If done anyway, the request will fail.
4282    ///
4283    /// # Additional Parameters
4284    ///
4285    /// * *$.xgafv* (query-string) - V1 error format.
4286    /// * *access_token* (query-string) - OAuth access token.
4287    /// * *alt* (query-string) - Data format for response.
4288    /// * *callback* (query-string) - JSONP
4289    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4290    /// * *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.
4291    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4292    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4293    /// * *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.
4294    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4295    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4296    pub fn param<T>(mut self, name: T, value: T) -> FolderCreateCall<'a, C>
4297    where
4298        T: AsRef<str>,
4299    {
4300        self._additional_params
4301            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4302        self
4303    }
4304
4305    /// Identifies the authorization scope for the method you are building.
4306    ///
4307    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4308    /// [`Scope::CloudPlatform`].
4309    ///
4310    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4311    /// tokens for more than one scope.
4312    ///
4313    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4314    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4315    /// sufficient, a read-write scope will do as well.
4316    pub fn add_scope<St>(mut self, scope: St) -> FolderCreateCall<'a, C>
4317    where
4318        St: AsRef<str>,
4319    {
4320        self._scopes.insert(String::from(scope.as_ref()));
4321        self
4322    }
4323    /// Identifies the authorization scope(s) for the method you are building.
4324    ///
4325    /// See [`Self::add_scope()`] for details.
4326    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderCreateCall<'a, C>
4327    where
4328        I: IntoIterator<Item = St>,
4329        St: AsRef<str>,
4330    {
4331        self._scopes
4332            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4333        self
4334    }
4335
4336    /// Removes all scopes, and no default scope will be used either.
4337    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4338    /// for details).
4339    pub fn clear_scopes(mut self) -> FolderCreateCall<'a, C> {
4340        self._scopes.clear();
4341        self
4342    }
4343}
4344
4345/// Requests deletion of a folder. The folder is moved into the DELETE_REQUESTED state immediately, and is deleted approximately 30 days later. This method may only be called on an empty folder, where a folder is empty if it doesn't contain any folders or projects in the ACTIVE state. If called on a folder in DELETE_REQUESTED state the operation will result in a no-op success. The caller must have `resourcemanager.folders.delete` permission on the identified folder.
4346///
4347/// A builder for the *delete* method supported by a *folder* resource.
4348/// It is not used directly, but through a [`FolderMethods`] instance.
4349///
4350/// # Example
4351///
4352/// Instantiate a resource method builder
4353///
4354/// ```test_harness,no_run
4355/// # extern crate hyper;
4356/// # extern crate hyper_rustls;
4357/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
4358/// # async fn dox() {
4359/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4360///
4361/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4362/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4363/// #     .with_native_roots()
4364/// #     .unwrap()
4365/// #     .https_only()
4366/// #     .enable_http2()
4367/// #     .build();
4368///
4369/// # let executor = hyper_util::rt::TokioExecutor::new();
4370/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4371/// #     secret,
4372/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4373/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4374/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4375/// #     ),
4376/// # ).build().await.unwrap();
4377///
4378/// # let client = hyper_util::client::legacy::Client::builder(
4379/// #     hyper_util::rt::TokioExecutor::new()
4380/// # )
4381/// # .build(
4382/// #     hyper_rustls::HttpsConnectorBuilder::new()
4383/// #         .with_native_roots()
4384/// #         .unwrap()
4385/// #         .https_or_http()
4386/// #         .enable_http2()
4387/// #         .build()
4388/// # );
4389/// # let mut hub = CloudResourceManager::new(client, auth);
4390/// // You can configure optional parameters by calling the respective setters at will, and
4391/// // execute the final call using `doit()`.
4392/// // Values shown here are possibly random and not representative !
4393/// let result = hub.folders().delete("name")
4394///              .doit().await;
4395/// # }
4396/// ```
4397pub struct FolderDeleteCall<'a, C>
4398where
4399    C: 'a,
4400{
4401    hub: &'a CloudResourceManager<C>,
4402    _name: String,
4403    _delegate: Option<&'a mut dyn common::Delegate>,
4404    _additional_params: HashMap<String, String>,
4405    _scopes: BTreeSet<String>,
4406}
4407
4408impl<'a, C> common::CallBuilder for FolderDeleteCall<'a, C> {}
4409
4410impl<'a, C> FolderDeleteCall<'a, C>
4411where
4412    C: common::Connector,
4413{
4414    /// Perform the operation you have build so far.
4415    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4416        use std::borrow::Cow;
4417        use std::io::{Read, Seek};
4418
4419        use common::{url::Params, ToParts};
4420        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4421
4422        let mut dd = common::DefaultDelegate;
4423        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4424        dlg.begin(common::MethodInfo {
4425            id: "cloudresourcemanager.folders.delete",
4426            http_method: hyper::Method::DELETE,
4427        });
4428
4429        for &field in ["alt", "name"].iter() {
4430            if self._additional_params.contains_key(field) {
4431                dlg.finished(false);
4432                return Err(common::Error::FieldClash(field));
4433            }
4434        }
4435
4436        let mut params = Params::with_capacity(3 + self._additional_params.len());
4437        params.push("name", self._name);
4438
4439        params.extend(self._additional_params.iter());
4440
4441        params.push("alt", "json");
4442        let mut url = self.hub._base_url.clone() + "v3/{+name}";
4443        if self._scopes.is_empty() {
4444            self._scopes
4445                .insert(Scope::CloudPlatform.as_ref().to_string());
4446        }
4447
4448        #[allow(clippy::single_element_loop)]
4449        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4450            url = params.uri_replacement(url, param_name, find_this, true);
4451        }
4452        {
4453            let to_remove = ["name"];
4454            params.remove_params(&to_remove);
4455        }
4456
4457        let url = params.parse_with_url(&url);
4458
4459        loop {
4460            let token = match self
4461                .hub
4462                .auth
4463                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4464                .await
4465            {
4466                Ok(token) => token,
4467                Err(e) => match dlg.token(e) {
4468                    Ok(token) => token,
4469                    Err(e) => {
4470                        dlg.finished(false);
4471                        return Err(common::Error::MissingToken(e));
4472                    }
4473                },
4474            };
4475            let mut req_result = {
4476                let client = &self.hub.client;
4477                dlg.pre_request();
4478                let mut req_builder = hyper::Request::builder()
4479                    .method(hyper::Method::DELETE)
4480                    .uri(url.as_str())
4481                    .header(USER_AGENT, self.hub._user_agent.clone());
4482
4483                if let Some(token) = token.as_ref() {
4484                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4485                }
4486
4487                let request = req_builder
4488                    .header(CONTENT_LENGTH, 0_u64)
4489                    .body(common::to_body::<String>(None));
4490
4491                client.request(request.unwrap()).await
4492            };
4493
4494            match req_result {
4495                Err(err) => {
4496                    if let common::Retry::After(d) = dlg.http_error(&err) {
4497                        sleep(d).await;
4498                        continue;
4499                    }
4500                    dlg.finished(false);
4501                    return Err(common::Error::HttpError(err));
4502                }
4503                Ok(res) => {
4504                    let (mut parts, body) = res.into_parts();
4505                    let mut body = common::Body::new(body);
4506                    if !parts.status.is_success() {
4507                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4508                        let error = serde_json::from_str(&common::to_string(&bytes));
4509                        let response = common::to_response(parts, bytes.into());
4510
4511                        if let common::Retry::After(d) =
4512                            dlg.http_failure(&response, error.as_ref().ok())
4513                        {
4514                            sleep(d).await;
4515                            continue;
4516                        }
4517
4518                        dlg.finished(false);
4519
4520                        return Err(match error {
4521                            Ok(value) => common::Error::BadRequest(value),
4522                            _ => common::Error::Failure(response),
4523                        });
4524                    }
4525                    let response = {
4526                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4527                        let encoded = common::to_string(&bytes);
4528                        match serde_json::from_str(&encoded) {
4529                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4530                            Err(error) => {
4531                                dlg.response_json_decode_error(&encoded, &error);
4532                                return Err(common::Error::JsonDecodeError(
4533                                    encoded.to_string(),
4534                                    error,
4535                                ));
4536                            }
4537                        }
4538                    };
4539
4540                    dlg.finished(true);
4541                    return Ok(response);
4542                }
4543            }
4544        }
4545    }
4546
4547    /// Required. The resource name of the folder to be deleted. Must be of the form `folders/{folder_id}`.
4548    ///
4549    /// Sets the *name* path property to the given value.
4550    ///
4551    /// Even though the property as already been set when instantiating this call,
4552    /// we provide this method for API completeness.
4553    pub fn name(mut self, new_value: &str) -> FolderDeleteCall<'a, C> {
4554        self._name = new_value.to_string();
4555        self
4556    }
4557    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4558    /// while executing the actual API request.
4559    ///
4560    /// ````text
4561    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4562    /// ````
4563    ///
4564    /// Sets the *delegate* property to the given value.
4565    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FolderDeleteCall<'a, C> {
4566        self._delegate = Some(new_value);
4567        self
4568    }
4569
4570    /// Set any additional parameter of the query string used in the request.
4571    /// It should be used to set parameters which are not yet available through their own
4572    /// setters.
4573    ///
4574    /// Please note that this method must not be used to set any of the known parameters
4575    /// which have their own setter method. If done anyway, the request will fail.
4576    ///
4577    /// # Additional Parameters
4578    ///
4579    /// * *$.xgafv* (query-string) - V1 error format.
4580    /// * *access_token* (query-string) - OAuth access token.
4581    /// * *alt* (query-string) - Data format for response.
4582    /// * *callback* (query-string) - JSONP
4583    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4584    /// * *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.
4585    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4586    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4587    /// * *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.
4588    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4589    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4590    pub fn param<T>(mut self, name: T, value: T) -> FolderDeleteCall<'a, C>
4591    where
4592        T: AsRef<str>,
4593    {
4594        self._additional_params
4595            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4596        self
4597    }
4598
4599    /// Identifies the authorization scope for the method you are building.
4600    ///
4601    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4602    /// [`Scope::CloudPlatform`].
4603    ///
4604    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4605    /// tokens for more than one scope.
4606    ///
4607    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4608    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4609    /// sufficient, a read-write scope will do as well.
4610    pub fn add_scope<St>(mut self, scope: St) -> FolderDeleteCall<'a, C>
4611    where
4612        St: AsRef<str>,
4613    {
4614        self._scopes.insert(String::from(scope.as_ref()));
4615        self
4616    }
4617    /// Identifies the authorization scope(s) for the method you are building.
4618    ///
4619    /// See [`Self::add_scope()`] for details.
4620    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderDeleteCall<'a, C>
4621    where
4622        I: IntoIterator<Item = St>,
4623        St: AsRef<str>,
4624    {
4625        self._scopes
4626            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4627        self
4628    }
4629
4630    /// Removes all scopes, and no default scope will be used either.
4631    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4632    /// for details).
4633    pub fn clear_scopes(mut self) -> FolderDeleteCall<'a, C> {
4634        self._scopes.clear();
4635        self
4636    }
4637}
4638
4639/// Retrieves a folder identified by the supplied resource name. Valid folder resource names have the format `folders/{folder_id}` (for example, `folders/1234`). The caller must have `resourcemanager.folders.get` permission on the identified folder.
4640///
4641/// A builder for the *get* method supported by a *folder* resource.
4642/// It is not used directly, but through a [`FolderMethods`] instance.
4643///
4644/// # Example
4645///
4646/// Instantiate a resource method builder
4647///
4648/// ```test_harness,no_run
4649/// # extern crate hyper;
4650/// # extern crate hyper_rustls;
4651/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
4652/// # async fn dox() {
4653/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4654///
4655/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4656/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4657/// #     .with_native_roots()
4658/// #     .unwrap()
4659/// #     .https_only()
4660/// #     .enable_http2()
4661/// #     .build();
4662///
4663/// # let executor = hyper_util::rt::TokioExecutor::new();
4664/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4665/// #     secret,
4666/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4667/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4668/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4669/// #     ),
4670/// # ).build().await.unwrap();
4671///
4672/// # let client = hyper_util::client::legacy::Client::builder(
4673/// #     hyper_util::rt::TokioExecutor::new()
4674/// # )
4675/// # .build(
4676/// #     hyper_rustls::HttpsConnectorBuilder::new()
4677/// #         .with_native_roots()
4678/// #         .unwrap()
4679/// #         .https_or_http()
4680/// #         .enable_http2()
4681/// #         .build()
4682/// # );
4683/// # let mut hub = CloudResourceManager::new(client, auth);
4684/// // You can configure optional parameters by calling the respective setters at will, and
4685/// // execute the final call using `doit()`.
4686/// // Values shown here are possibly random and not representative !
4687/// let result = hub.folders().get("name")
4688///              .doit().await;
4689/// # }
4690/// ```
4691pub struct FolderGetCall<'a, C>
4692where
4693    C: 'a,
4694{
4695    hub: &'a CloudResourceManager<C>,
4696    _name: String,
4697    _delegate: Option<&'a mut dyn common::Delegate>,
4698    _additional_params: HashMap<String, String>,
4699    _scopes: BTreeSet<String>,
4700}
4701
4702impl<'a, C> common::CallBuilder for FolderGetCall<'a, C> {}
4703
4704impl<'a, C> FolderGetCall<'a, C>
4705where
4706    C: common::Connector,
4707{
4708    /// Perform the operation you have build so far.
4709    pub async fn doit(mut self) -> common::Result<(common::Response, Folder)> {
4710        use std::borrow::Cow;
4711        use std::io::{Read, Seek};
4712
4713        use common::{url::Params, ToParts};
4714        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4715
4716        let mut dd = common::DefaultDelegate;
4717        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4718        dlg.begin(common::MethodInfo {
4719            id: "cloudresourcemanager.folders.get",
4720            http_method: hyper::Method::GET,
4721        });
4722
4723        for &field in ["alt", "name"].iter() {
4724            if self._additional_params.contains_key(field) {
4725                dlg.finished(false);
4726                return Err(common::Error::FieldClash(field));
4727            }
4728        }
4729
4730        let mut params = Params::with_capacity(3 + self._additional_params.len());
4731        params.push("name", self._name);
4732
4733        params.extend(self._additional_params.iter());
4734
4735        params.push("alt", "json");
4736        let mut url = self.hub._base_url.clone() + "v3/{+name}";
4737        if self._scopes.is_empty() {
4738            self._scopes
4739                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
4740        }
4741
4742        #[allow(clippy::single_element_loop)]
4743        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4744            url = params.uri_replacement(url, param_name, find_this, true);
4745        }
4746        {
4747            let to_remove = ["name"];
4748            params.remove_params(&to_remove);
4749        }
4750
4751        let url = params.parse_with_url(&url);
4752
4753        loop {
4754            let token = match self
4755                .hub
4756                .auth
4757                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4758                .await
4759            {
4760                Ok(token) => token,
4761                Err(e) => match dlg.token(e) {
4762                    Ok(token) => token,
4763                    Err(e) => {
4764                        dlg.finished(false);
4765                        return Err(common::Error::MissingToken(e));
4766                    }
4767                },
4768            };
4769            let mut req_result = {
4770                let client = &self.hub.client;
4771                dlg.pre_request();
4772                let mut req_builder = hyper::Request::builder()
4773                    .method(hyper::Method::GET)
4774                    .uri(url.as_str())
4775                    .header(USER_AGENT, self.hub._user_agent.clone());
4776
4777                if let Some(token) = token.as_ref() {
4778                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4779                }
4780
4781                let request = req_builder
4782                    .header(CONTENT_LENGTH, 0_u64)
4783                    .body(common::to_body::<String>(None));
4784
4785                client.request(request.unwrap()).await
4786            };
4787
4788            match req_result {
4789                Err(err) => {
4790                    if let common::Retry::After(d) = dlg.http_error(&err) {
4791                        sleep(d).await;
4792                        continue;
4793                    }
4794                    dlg.finished(false);
4795                    return Err(common::Error::HttpError(err));
4796                }
4797                Ok(res) => {
4798                    let (mut parts, body) = res.into_parts();
4799                    let mut body = common::Body::new(body);
4800                    if !parts.status.is_success() {
4801                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4802                        let error = serde_json::from_str(&common::to_string(&bytes));
4803                        let response = common::to_response(parts, bytes.into());
4804
4805                        if let common::Retry::After(d) =
4806                            dlg.http_failure(&response, error.as_ref().ok())
4807                        {
4808                            sleep(d).await;
4809                            continue;
4810                        }
4811
4812                        dlg.finished(false);
4813
4814                        return Err(match error {
4815                            Ok(value) => common::Error::BadRequest(value),
4816                            _ => common::Error::Failure(response),
4817                        });
4818                    }
4819                    let response = {
4820                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4821                        let encoded = common::to_string(&bytes);
4822                        match serde_json::from_str(&encoded) {
4823                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4824                            Err(error) => {
4825                                dlg.response_json_decode_error(&encoded, &error);
4826                                return Err(common::Error::JsonDecodeError(
4827                                    encoded.to_string(),
4828                                    error,
4829                                ));
4830                            }
4831                        }
4832                    };
4833
4834                    dlg.finished(true);
4835                    return Ok(response);
4836                }
4837            }
4838        }
4839    }
4840
4841    /// Required. The resource name of the folder to retrieve. Must be of the form `folders/{folder_id}`.
4842    ///
4843    /// Sets the *name* path property to the given value.
4844    ///
4845    /// Even though the property as already been set when instantiating this call,
4846    /// we provide this method for API completeness.
4847    pub fn name(mut self, new_value: &str) -> FolderGetCall<'a, C> {
4848        self._name = new_value.to_string();
4849        self
4850    }
4851    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4852    /// while executing the actual API request.
4853    ///
4854    /// ````text
4855    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4856    /// ````
4857    ///
4858    /// Sets the *delegate* property to the given value.
4859    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FolderGetCall<'a, C> {
4860        self._delegate = Some(new_value);
4861        self
4862    }
4863
4864    /// Set any additional parameter of the query string used in the request.
4865    /// It should be used to set parameters which are not yet available through their own
4866    /// setters.
4867    ///
4868    /// Please note that this method must not be used to set any of the known parameters
4869    /// which have their own setter method. If done anyway, the request will fail.
4870    ///
4871    /// # Additional Parameters
4872    ///
4873    /// * *$.xgafv* (query-string) - V1 error format.
4874    /// * *access_token* (query-string) - OAuth access token.
4875    /// * *alt* (query-string) - Data format for response.
4876    /// * *callback* (query-string) - JSONP
4877    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4878    /// * *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.
4879    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4880    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4881    /// * *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.
4882    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4883    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4884    pub fn param<T>(mut self, name: T, value: T) -> FolderGetCall<'a, C>
4885    where
4886        T: AsRef<str>,
4887    {
4888        self._additional_params
4889            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4890        self
4891    }
4892
4893    /// Identifies the authorization scope for the method you are building.
4894    ///
4895    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4896    /// [`Scope::CloudPlatformReadOnly`].
4897    ///
4898    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4899    /// tokens for more than one scope.
4900    ///
4901    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4902    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4903    /// sufficient, a read-write scope will do as well.
4904    pub fn add_scope<St>(mut self, scope: St) -> FolderGetCall<'a, C>
4905    where
4906        St: AsRef<str>,
4907    {
4908        self._scopes.insert(String::from(scope.as_ref()));
4909        self
4910    }
4911    /// Identifies the authorization scope(s) for the method you are building.
4912    ///
4913    /// See [`Self::add_scope()`] for details.
4914    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderGetCall<'a, C>
4915    where
4916        I: IntoIterator<Item = St>,
4917        St: AsRef<str>,
4918    {
4919        self._scopes
4920            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4921        self
4922    }
4923
4924    /// Removes all scopes, and no default scope will be used either.
4925    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4926    /// for details).
4927    pub fn clear_scopes(mut self) -> FolderGetCall<'a, C> {
4928        self._scopes.clear();
4929        self
4930    }
4931}
4932
4933/// Gets the access control policy for a folder. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the folder's resource name, for example: "folders/1234". The caller must have `resourcemanager.folders.getIamPolicy` permission on the identified folder.
4934///
4935/// A builder for the *getIamPolicy* method supported by a *folder* resource.
4936/// It is not used directly, but through a [`FolderMethods`] instance.
4937///
4938/// # Example
4939///
4940/// Instantiate a resource method builder
4941///
4942/// ```test_harness,no_run
4943/// # extern crate hyper;
4944/// # extern crate hyper_rustls;
4945/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
4946/// use cloudresourcemanager3::api::GetIamPolicyRequest;
4947/// # async fn dox() {
4948/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4949///
4950/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4951/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4952/// #     .with_native_roots()
4953/// #     .unwrap()
4954/// #     .https_only()
4955/// #     .enable_http2()
4956/// #     .build();
4957///
4958/// # let executor = hyper_util::rt::TokioExecutor::new();
4959/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4960/// #     secret,
4961/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4962/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4963/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4964/// #     ),
4965/// # ).build().await.unwrap();
4966///
4967/// # let client = hyper_util::client::legacy::Client::builder(
4968/// #     hyper_util::rt::TokioExecutor::new()
4969/// # )
4970/// # .build(
4971/// #     hyper_rustls::HttpsConnectorBuilder::new()
4972/// #         .with_native_roots()
4973/// #         .unwrap()
4974/// #         .https_or_http()
4975/// #         .enable_http2()
4976/// #         .build()
4977/// # );
4978/// # let mut hub = CloudResourceManager::new(client, auth);
4979/// // As the method needs a request, you would usually fill it with the desired information
4980/// // into the respective structure. Some of the parts shown here might not be applicable !
4981/// // Values shown here are possibly random and not representative !
4982/// let mut req = GetIamPolicyRequest::default();
4983///
4984/// // You can configure optional parameters by calling the respective setters at will, and
4985/// // execute the final call using `doit()`.
4986/// // Values shown here are possibly random and not representative !
4987/// let result = hub.folders().get_iam_policy(req, "resource")
4988///              .doit().await;
4989/// # }
4990/// ```
4991pub struct FolderGetIamPolicyCall<'a, C>
4992where
4993    C: 'a,
4994{
4995    hub: &'a CloudResourceManager<C>,
4996    _request: GetIamPolicyRequest,
4997    _resource: String,
4998    _delegate: Option<&'a mut dyn common::Delegate>,
4999    _additional_params: HashMap<String, String>,
5000    _scopes: BTreeSet<String>,
5001}
5002
5003impl<'a, C> common::CallBuilder for FolderGetIamPolicyCall<'a, C> {}
5004
5005impl<'a, C> FolderGetIamPolicyCall<'a, C>
5006where
5007    C: common::Connector,
5008{
5009    /// Perform the operation you have build so far.
5010    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5011        use std::borrow::Cow;
5012        use std::io::{Read, Seek};
5013
5014        use common::{url::Params, ToParts};
5015        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5016
5017        let mut dd = common::DefaultDelegate;
5018        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5019        dlg.begin(common::MethodInfo {
5020            id: "cloudresourcemanager.folders.getIamPolicy",
5021            http_method: hyper::Method::POST,
5022        });
5023
5024        for &field in ["alt", "resource"].iter() {
5025            if self._additional_params.contains_key(field) {
5026                dlg.finished(false);
5027                return Err(common::Error::FieldClash(field));
5028            }
5029        }
5030
5031        let mut params = Params::with_capacity(4 + self._additional_params.len());
5032        params.push("resource", self._resource);
5033
5034        params.extend(self._additional_params.iter());
5035
5036        params.push("alt", "json");
5037        let mut url = self.hub._base_url.clone() + "v3/{+resource}:getIamPolicy";
5038        if self._scopes.is_empty() {
5039            self._scopes
5040                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5041        }
5042
5043        #[allow(clippy::single_element_loop)]
5044        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5045            url = params.uri_replacement(url, param_name, find_this, true);
5046        }
5047        {
5048            let to_remove = ["resource"];
5049            params.remove_params(&to_remove);
5050        }
5051
5052        let url = params.parse_with_url(&url);
5053
5054        let mut json_mime_type = mime::APPLICATION_JSON;
5055        let mut request_value_reader = {
5056            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5057            common::remove_json_null_values(&mut value);
5058            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5059            serde_json::to_writer(&mut dst, &value).unwrap();
5060            dst
5061        };
5062        let request_size = request_value_reader
5063            .seek(std::io::SeekFrom::End(0))
5064            .unwrap();
5065        request_value_reader
5066            .seek(std::io::SeekFrom::Start(0))
5067            .unwrap();
5068
5069        loop {
5070            let token = match self
5071                .hub
5072                .auth
5073                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5074                .await
5075            {
5076                Ok(token) => token,
5077                Err(e) => match dlg.token(e) {
5078                    Ok(token) => token,
5079                    Err(e) => {
5080                        dlg.finished(false);
5081                        return Err(common::Error::MissingToken(e));
5082                    }
5083                },
5084            };
5085            request_value_reader
5086                .seek(std::io::SeekFrom::Start(0))
5087                .unwrap();
5088            let mut req_result = {
5089                let client = &self.hub.client;
5090                dlg.pre_request();
5091                let mut req_builder = hyper::Request::builder()
5092                    .method(hyper::Method::POST)
5093                    .uri(url.as_str())
5094                    .header(USER_AGENT, self.hub._user_agent.clone());
5095
5096                if let Some(token) = token.as_ref() {
5097                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5098                }
5099
5100                let request = req_builder
5101                    .header(CONTENT_TYPE, json_mime_type.to_string())
5102                    .header(CONTENT_LENGTH, request_size as u64)
5103                    .body(common::to_body(
5104                        request_value_reader.get_ref().clone().into(),
5105                    ));
5106
5107                client.request(request.unwrap()).await
5108            };
5109
5110            match req_result {
5111                Err(err) => {
5112                    if let common::Retry::After(d) = dlg.http_error(&err) {
5113                        sleep(d).await;
5114                        continue;
5115                    }
5116                    dlg.finished(false);
5117                    return Err(common::Error::HttpError(err));
5118                }
5119                Ok(res) => {
5120                    let (mut parts, body) = res.into_parts();
5121                    let mut body = common::Body::new(body);
5122                    if !parts.status.is_success() {
5123                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5124                        let error = serde_json::from_str(&common::to_string(&bytes));
5125                        let response = common::to_response(parts, bytes.into());
5126
5127                        if let common::Retry::After(d) =
5128                            dlg.http_failure(&response, error.as_ref().ok())
5129                        {
5130                            sleep(d).await;
5131                            continue;
5132                        }
5133
5134                        dlg.finished(false);
5135
5136                        return Err(match error {
5137                            Ok(value) => common::Error::BadRequest(value),
5138                            _ => common::Error::Failure(response),
5139                        });
5140                    }
5141                    let response = {
5142                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5143                        let encoded = common::to_string(&bytes);
5144                        match serde_json::from_str(&encoded) {
5145                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5146                            Err(error) => {
5147                                dlg.response_json_decode_error(&encoded, &error);
5148                                return Err(common::Error::JsonDecodeError(
5149                                    encoded.to_string(),
5150                                    error,
5151                                ));
5152                            }
5153                        }
5154                    };
5155
5156                    dlg.finished(true);
5157                    return Ok(response);
5158                }
5159            }
5160        }
5161    }
5162
5163    ///
5164    /// Sets the *request* property to the given value.
5165    ///
5166    /// Even though the property as already been set when instantiating this call,
5167    /// we provide this method for API completeness.
5168    pub fn request(mut self, new_value: GetIamPolicyRequest) -> FolderGetIamPolicyCall<'a, C> {
5169        self._request = new_value;
5170        self
5171    }
5172    /// 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.
5173    ///
5174    /// Sets the *resource* path property to the given value.
5175    ///
5176    /// Even though the property as already been set when instantiating this call,
5177    /// we provide this method for API completeness.
5178    pub fn resource(mut self, new_value: &str) -> FolderGetIamPolicyCall<'a, C> {
5179        self._resource = new_value.to_string();
5180        self
5181    }
5182    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5183    /// while executing the actual API request.
5184    ///
5185    /// ````text
5186    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5187    /// ````
5188    ///
5189    /// Sets the *delegate* property to the given value.
5190    pub fn delegate(
5191        mut self,
5192        new_value: &'a mut dyn common::Delegate,
5193    ) -> FolderGetIamPolicyCall<'a, C> {
5194        self._delegate = Some(new_value);
5195        self
5196    }
5197
5198    /// Set any additional parameter of the query string used in the request.
5199    /// It should be used to set parameters which are not yet available through their own
5200    /// setters.
5201    ///
5202    /// Please note that this method must not be used to set any of the known parameters
5203    /// which have their own setter method. If done anyway, the request will fail.
5204    ///
5205    /// # Additional Parameters
5206    ///
5207    /// * *$.xgafv* (query-string) - V1 error format.
5208    /// * *access_token* (query-string) - OAuth access token.
5209    /// * *alt* (query-string) - Data format for response.
5210    /// * *callback* (query-string) - JSONP
5211    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5212    /// * *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.
5213    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5214    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5215    /// * *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.
5216    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5217    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5218    pub fn param<T>(mut self, name: T, value: T) -> FolderGetIamPolicyCall<'a, C>
5219    where
5220        T: AsRef<str>,
5221    {
5222        self._additional_params
5223            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5224        self
5225    }
5226
5227    /// Identifies the authorization scope for the method you are building.
5228    ///
5229    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5230    /// [`Scope::CloudPlatformReadOnly`].
5231    ///
5232    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5233    /// tokens for more than one scope.
5234    ///
5235    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5236    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5237    /// sufficient, a read-write scope will do as well.
5238    pub fn add_scope<St>(mut self, scope: St) -> FolderGetIamPolicyCall<'a, C>
5239    where
5240        St: AsRef<str>,
5241    {
5242        self._scopes.insert(String::from(scope.as_ref()));
5243        self
5244    }
5245    /// Identifies the authorization scope(s) for the method you are building.
5246    ///
5247    /// See [`Self::add_scope()`] for details.
5248    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderGetIamPolicyCall<'a, C>
5249    where
5250        I: IntoIterator<Item = St>,
5251        St: AsRef<str>,
5252    {
5253        self._scopes
5254            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5255        self
5256    }
5257
5258    /// Removes all scopes, and no default scope will be used either.
5259    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5260    /// for details).
5261    pub fn clear_scopes(mut self) -> FolderGetIamPolicyCall<'a, C> {
5262        self._scopes.clear();
5263        self
5264    }
5265}
5266
5267/// Lists the folders that are direct descendants of supplied parent resource. `list()` provides a strongly consistent view of the folders underneath the specified parent resource. `list()` returns folders sorted based upon the (ascending) lexical ordering of their display_name. The caller must have `resourcemanager.folders.list` permission on the identified parent.
5268///
5269/// A builder for the *list* method supported by a *folder* resource.
5270/// It is not used directly, but through a [`FolderMethods`] instance.
5271///
5272/// # Example
5273///
5274/// Instantiate a resource method builder
5275///
5276/// ```test_harness,no_run
5277/// # extern crate hyper;
5278/// # extern crate hyper_rustls;
5279/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
5280/// # async fn dox() {
5281/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5282///
5283/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5284/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5285/// #     .with_native_roots()
5286/// #     .unwrap()
5287/// #     .https_only()
5288/// #     .enable_http2()
5289/// #     .build();
5290///
5291/// # let executor = hyper_util::rt::TokioExecutor::new();
5292/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5293/// #     secret,
5294/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5295/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5296/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5297/// #     ),
5298/// # ).build().await.unwrap();
5299///
5300/// # let client = hyper_util::client::legacy::Client::builder(
5301/// #     hyper_util::rt::TokioExecutor::new()
5302/// # )
5303/// # .build(
5304/// #     hyper_rustls::HttpsConnectorBuilder::new()
5305/// #         .with_native_roots()
5306/// #         .unwrap()
5307/// #         .https_or_http()
5308/// #         .enable_http2()
5309/// #         .build()
5310/// # );
5311/// # let mut hub = CloudResourceManager::new(client, auth);
5312/// // You can configure optional parameters by calling the respective setters at will, and
5313/// // execute the final call using `doit()`.
5314/// // Values shown here are possibly random and not representative !
5315/// let result = hub.folders().list()
5316///              .show_deleted(true)
5317///              .parent("invidunt")
5318///              .page_token("amet")
5319///              .page_size(-20)
5320///              .doit().await;
5321/// # }
5322/// ```
5323pub struct FolderListCall<'a, C>
5324where
5325    C: 'a,
5326{
5327    hub: &'a CloudResourceManager<C>,
5328    _show_deleted: Option<bool>,
5329    _parent: Option<String>,
5330    _page_token: Option<String>,
5331    _page_size: Option<i32>,
5332    _delegate: Option<&'a mut dyn common::Delegate>,
5333    _additional_params: HashMap<String, String>,
5334    _scopes: BTreeSet<String>,
5335}
5336
5337impl<'a, C> common::CallBuilder for FolderListCall<'a, C> {}
5338
5339impl<'a, C> FolderListCall<'a, C>
5340where
5341    C: common::Connector,
5342{
5343    /// Perform the operation you have build so far.
5344    pub async fn doit(mut self) -> common::Result<(common::Response, ListFoldersResponse)> {
5345        use std::borrow::Cow;
5346        use std::io::{Read, Seek};
5347
5348        use common::{url::Params, ToParts};
5349        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5350
5351        let mut dd = common::DefaultDelegate;
5352        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5353        dlg.begin(common::MethodInfo {
5354            id: "cloudresourcemanager.folders.list",
5355            http_method: hyper::Method::GET,
5356        });
5357
5358        for &field in ["alt", "showDeleted", "parent", "pageToken", "pageSize"].iter() {
5359            if self._additional_params.contains_key(field) {
5360                dlg.finished(false);
5361                return Err(common::Error::FieldClash(field));
5362            }
5363        }
5364
5365        let mut params = Params::with_capacity(6 + self._additional_params.len());
5366        if let Some(value) = self._show_deleted.as_ref() {
5367            params.push("showDeleted", value.to_string());
5368        }
5369        if let Some(value) = self._parent.as_ref() {
5370            params.push("parent", value);
5371        }
5372        if let Some(value) = self._page_token.as_ref() {
5373            params.push("pageToken", value);
5374        }
5375        if let Some(value) = self._page_size.as_ref() {
5376            params.push("pageSize", value.to_string());
5377        }
5378
5379        params.extend(self._additional_params.iter());
5380
5381        params.push("alt", "json");
5382        let mut url = self.hub._base_url.clone() + "v3/folders";
5383        if self._scopes.is_empty() {
5384            self._scopes
5385                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
5386        }
5387
5388        let url = params.parse_with_url(&url);
5389
5390        loop {
5391            let token = match self
5392                .hub
5393                .auth
5394                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5395                .await
5396            {
5397                Ok(token) => token,
5398                Err(e) => match dlg.token(e) {
5399                    Ok(token) => token,
5400                    Err(e) => {
5401                        dlg.finished(false);
5402                        return Err(common::Error::MissingToken(e));
5403                    }
5404                },
5405            };
5406            let mut req_result = {
5407                let client = &self.hub.client;
5408                dlg.pre_request();
5409                let mut req_builder = hyper::Request::builder()
5410                    .method(hyper::Method::GET)
5411                    .uri(url.as_str())
5412                    .header(USER_AGENT, self.hub._user_agent.clone());
5413
5414                if let Some(token) = token.as_ref() {
5415                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5416                }
5417
5418                let request = req_builder
5419                    .header(CONTENT_LENGTH, 0_u64)
5420                    .body(common::to_body::<String>(None));
5421
5422                client.request(request.unwrap()).await
5423            };
5424
5425            match req_result {
5426                Err(err) => {
5427                    if let common::Retry::After(d) = dlg.http_error(&err) {
5428                        sleep(d).await;
5429                        continue;
5430                    }
5431                    dlg.finished(false);
5432                    return Err(common::Error::HttpError(err));
5433                }
5434                Ok(res) => {
5435                    let (mut parts, body) = res.into_parts();
5436                    let mut body = common::Body::new(body);
5437                    if !parts.status.is_success() {
5438                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5439                        let error = serde_json::from_str(&common::to_string(&bytes));
5440                        let response = common::to_response(parts, bytes.into());
5441
5442                        if let common::Retry::After(d) =
5443                            dlg.http_failure(&response, error.as_ref().ok())
5444                        {
5445                            sleep(d).await;
5446                            continue;
5447                        }
5448
5449                        dlg.finished(false);
5450
5451                        return Err(match error {
5452                            Ok(value) => common::Error::BadRequest(value),
5453                            _ => common::Error::Failure(response),
5454                        });
5455                    }
5456                    let response = {
5457                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5458                        let encoded = common::to_string(&bytes);
5459                        match serde_json::from_str(&encoded) {
5460                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5461                            Err(error) => {
5462                                dlg.response_json_decode_error(&encoded, &error);
5463                                return Err(common::Error::JsonDecodeError(
5464                                    encoded.to_string(),
5465                                    error,
5466                                ));
5467                            }
5468                        }
5469                    };
5470
5471                    dlg.finished(true);
5472                    return Ok(response);
5473                }
5474            }
5475        }
5476    }
5477
5478    /// Optional. Controls whether folders in the DELETE_REQUESTED state should be returned. Defaults to false.
5479    ///
5480    /// Sets the *show deleted* query property to the given value.
5481    pub fn show_deleted(mut self, new_value: bool) -> FolderListCall<'a, C> {
5482        self._show_deleted = Some(new_value);
5483        self
5484    }
5485    /// Required. The name of the parent resource whose folders are being listed. Only children of this parent resource are listed; descendants are not listed. If the parent is a folder, use the value `folders/{folder_id}`. If the parent is an organization, use the value `organizations/{org_id}`. Access to this method is controlled by checking the `resourcemanager.folders.list` permission on the `parent`.
5486    ///
5487    /// Sets the *parent* query property to the given value.
5488    pub fn parent(mut self, new_value: &str) -> FolderListCall<'a, C> {
5489        self._parent = Some(new_value.to_string());
5490        self
5491    }
5492    /// Optional. A pagination token returned from a previous call to `ListFolders` that indicates where this listing should continue from.
5493    ///
5494    /// Sets the *page token* query property to the given value.
5495    pub fn page_token(mut self, new_value: &str) -> FolderListCall<'a, C> {
5496        self._page_token = Some(new_value.to_string());
5497        self
5498    }
5499    /// Optional. The maximum number of folders to return in the response. The server can return fewer folders than requested. If unspecified, server picks an appropriate default.
5500    ///
5501    /// Sets the *page size* query property to the given value.
5502    pub fn page_size(mut self, new_value: i32) -> FolderListCall<'a, C> {
5503        self._page_size = Some(new_value);
5504        self
5505    }
5506    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5507    /// while executing the actual API request.
5508    ///
5509    /// ````text
5510    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5511    /// ````
5512    ///
5513    /// Sets the *delegate* property to the given value.
5514    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FolderListCall<'a, C> {
5515        self._delegate = Some(new_value);
5516        self
5517    }
5518
5519    /// Set any additional parameter of the query string used in the request.
5520    /// It should be used to set parameters which are not yet available through their own
5521    /// setters.
5522    ///
5523    /// Please note that this method must not be used to set any of the known parameters
5524    /// which have their own setter method. If done anyway, the request will fail.
5525    ///
5526    /// # Additional Parameters
5527    ///
5528    /// * *$.xgafv* (query-string) - V1 error format.
5529    /// * *access_token* (query-string) - OAuth access token.
5530    /// * *alt* (query-string) - Data format for response.
5531    /// * *callback* (query-string) - JSONP
5532    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5533    /// * *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.
5534    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5535    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5536    /// * *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.
5537    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5538    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5539    pub fn param<T>(mut self, name: T, value: T) -> FolderListCall<'a, C>
5540    where
5541        T: AsRef<str>,
5542    {
5543        self._additional_params
5544            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5545        self
5546    }
5547
5548    /// Identifies the authorization scope for the method you are building.
5549    ///
5550    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5551    /// [`Scope::CloudPlatformReadOnly`].
5552    ///
5553    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5554    /// tokens for more than one scope.
5555    ///
5556    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5557    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5558    /// sufficient, a read-write scope will do as well.
5559    pub fn add_scope<St>(mut self, scope: St) -> FolderListCall<'a, C>
5560    where
5561        St: AsRef<str>,
5562    {
5563        self._scopes.insert(String::from(scope.as_ref()));
5564        self
5565    }
5566    /// Identifies the authorization scope(s) for the method you are building.
5567    ///
5568    /// See [`Self::add_scope()`] for details.
5569    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderListCall<'a, C>
5570    where
5571        I: IntoIterator<Item = St>,
5572        St: AsRef<str>,
5573    {
5574        self._scopes
5575            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5576        self
5577    }
5578
5579    /// Removes all scopes, and no default scope will be used either.
5580    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5581    /// for details).
5582    pub fn clear_scopes(mut self) -> FolderListCall<'a, C> {
5583        self._scopes.clear();
5584        self
5585    }
5586}
5587
5588/// Moves a folder under a new resource parent. Returns an `Operation` which can be used to track the progress of the folder move workflow. Upon success, the `Operation.response` field will be populated with the moved folder. Upon failure, a `FolderOperationError` categorizing the failure cause will be returned - if the failure occurs synchronously then the `FolderOperationError` will be returned in the `Status.details` field. If it occurs asynchronously, then the FolderOperation will be returned in the `Operation.error` field. In addition, the `Operation.metadata` field will be populated with a `FolderOperation` message as an aid to stateless clients. Folder moves will be rejected if they violate either the naming, height, or fanout constraints described in the CreateFolder documentation. The caller must have `resourcemanager.folders.move` permission on the folder's current and proposed new parent.
5589///
5590/// A builder for the *move* method supported by a *folder* resource.
5591/// It is not used directly, but through a [`FolderMethods`] instance.
5592///
5593/// # Example
5594///
5595/// Instantiate a resource method builder
5596///
5597/// ```test_harness,no_run
5598/// # extern crate hyper;
5599/// # extern crate hyper_rustls;
5600/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
5601/// use cloudresourcemanager3::api::MoveFolderRequest;
5602/// # async fn dox() {
5603/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5604///
5605/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5606/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5607/// #     .with_native_roots()
5608/// #     .unwrap()
5609/// #     .https_only()
5610/// #     .enable_http2()
5611/// #     .build();
5612///
5613/// # let executor = hyper_util::rt::TokioExecutor::new();
5614/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5615/// #     secret,
5616/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5617/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5618/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5619/// #     ),
5620/// # ).build().await.unwrap();
5621///
5622/// # let client = hyper_util::client::legacy::Client::builder(
5623/// #     hyper_util::rt::TokioExecutor::new()
5624/// # )
5625/// # .build(
5626/// #     hyper_rustls::HttpsConnectorBuilder::new()
5627/// #         .with_native_roots()
5628/// #         .unwrap()
5629/// #         .https_or_http()
5630/// #         .enable_http2()
5631/// #         .build()
5632/// # );
5633/// # let mut hub = CloudResourceManager::new(client, auth);
5634/// // As the method needs a request, you would usually fill it with the desired information
5635/// // into the respective structure. Some of the parts shown here might not be applicable !
5636/// // Values shown here are possibly random and not representative !
5637/// let mut req = MoveFolderRequest::default();
5638///
5639/// // You can configure optional parameters by calling the respective setters at will, and
5640/// // execute the final call using `doit()`.
5641/// // Values shown here are possibly random and not representative !
5642/// let result = hub.folders().move_(req, "name")
5643///              .doit().await;
5644/// # }
5645/// ```
5646pub struct FolderMoveCall<'a, C>
5647where
5648    C: 'a,
5649{
5650    hub: &'a CloudResourceManager<C>,
5651    _request: MoveFolderRequest,
5652    _name: String,
5653    _delegate: Option<&'a mut dyn common::Delegate>,
5654    _additional_params: HashMap<String, String>,
5655    _scopes: BTreeSet<String>,
5656}
5657
5658impl<'a, C> common::CallBuilder for FolderMoveCall<'a, C> {}
5659
5660impl<'a, C> FolderMoveCall<'a, C>
5661where
5662    C: common::Connector,
5663{
5664    /// Perform the operation you have build so far.
5665    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5666        use std::borrow::Cow;
5667        use std::io::{Read, Seek};
5668
5669        use common::{url::Params, ToParts};
5670        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5671
5672        let mut dd = common::DefaultDelegate;
5673        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5674        dlg.begin(common::MethodInfo {
5675            id: "cloudresourcemanager.folders.move",
5676            http_method: hyper::Method::POST,
5677        });
5678
5679        for &field in ["alt", "name"].iter() {
5680            if self._additional_params.contains_key(field) {
5681                dlg.finished(false);
5682                return Err(common::Error::FieldClash(field));
5683            }
5684        }
5685
5686        let mut params = Params::with_capacity(4 + self._additional_params.len());
5687        params.push("name", self._name);
5688
5689        params.extend(self._additional_params.iter());
5690
5691        params.push("alt", "json");
5692        let mut url = self.hub._base_url.clone() + "v3/{+name}:move";
5693        if self._scopes.is_empty() {
5694            self._scopes
5695                .insert(Scope::CloudPlatform.as_ref().to_string());
5696        }
5697
5698        #[allow(clippy::single_element_loop)]
5699        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5700            url = params.uri_replacement(url, param_name, find_this, true);
5701        }
5702        {
5703            let to_remove = ["name"];
5704            params.remove_params(&to_remove);
5705        }
5706
5707        let url = params.parse_with_url(&url);
5708
5709        let mut json_mime_type = mime::APPLICATION_JSON;
5710        let mut request_value_reader = {
5711            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5712            common::remove_json_null_values(&mut value);
5713            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5714            serde_json::to_writer(&mut dst, &value).unwrap();
5715            dst
5716        };
5717        let request_size = request_value_reader
5718            .seek(std::io::SeekFrom::End(0))
5719            .unwrap();
5720        request_value_reader
5721            .seek(std::io::SeekFrom::Start(0))
5722            .unwrap();
5723
5724        loop {
5725            let token = match self
5726                .hub
5727                .auth
5728                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5729                .await
5730            {
5731                Ok(token) => token,
5732                Err(e) => match dlg.token(e) {
5733                    Ok(token) => token,
5734                    Err(e) => {
5735                        dlg.finished(false);
5736                        return Err(common::Error::MissingToken(e));
5737                    }
5738                },
5739            };
5740            request_value_reader
5741                .seek(std::io::SeekFrom::Start(0))
5742                .unwrap();
5743            let mut req_result = {
5744                let client = &self.hub.client;
5745                dlg.pre_request();
5746                let mut req_builder = hyper::Request::builder()
5747                    .method(hyper::Method::POST)
5748                    .uri(url.as_str())
5749                    .header(USER_AGENT, self.hub._user_agent.clone());
5750
5751                if let Some(token) = token.as_ref() {
5752                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5753                }
5754
5755                let request = req_builder
5756                    .header(CONTENT_TYPE, json_mime_type.to_string())
5757                    .header(CONTENT_LENGTH, request_size as u64)
5758                    .body(common::to_body(
5759                        request_value_reader.get_ref().clone().into(),
5760                    ));
5761
5762                client.request(request.unwrap()).await
5763            };
5764
5765            match req_result {
5766                Err(err) => {
5767                    if let common::Retry::After(d) = dlg.http_error(&err) {
5768                        sleep(d).await;
5769                        continue;
5770                    }
5771                    dlg.finished(false);
5772                    return Err(common::Error::HttpError(err));
5773                }
5774                Ok(res) => {
5775                    let (mut parts, body) = res.into_parts();
5776                    let mut body = common::Body::new(body);
5777                    if !parts.status.is_success() {
5778                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5779                        let error = serde_json::from_str(&common::to_string(&bytes));
5780                        let response = common::to_response(parts, bytes.into());
5781
5782                        if let common::Retry::After(d) =
5783                            dlg.http_failure(&response, error.as_ref().ok())
5784                        {
5785                            sleep(d).await;
5786                            continue;
5787                        }
5788
5789                        dlg.finished(false);
5790
5791                        return Err(match error {
5792                            Ok(value) => common::Error::BadRequest(value),
5793                            _ => common::Error::Failure(response),
5794                        });
5795                    }
5796                    let response = {
5797                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5798                        let encoded = common::to_string(&bytes);
5799                        match serde_json::from_str(&encoded) {
5800                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5801                            Err(error) => {
5802                                dlg.response_json_decode_error(&encoded, &error);
5803                                return Err(common::Error::JsonDecodeError(
5804                                    encoded.to_string(),
5805                                    error,
5806                                ));
5807                            }
5808                        }
5809                    };
5810
5811                    dlg.finished(true);
5812                    return Ok(response);
5813                }
5814            }
5815        }
5816    }
5817
5818    ///
5819    /// Sets the *request* property to the given value.
5820    ///
5821    /// Even though the property as already been set when instantiating this call,
5822    /// we provide this method for API completeness.
5823    pub fn request(mut self, new_value: MoveFolderRequest) -> FolderMoveCall<'a, C> {
5824        self._request = new_value;
5825        self
5826    }
5827    /// Required. The resource name of the Folder to move. Must be of the form folders/{folder_id}
5828    ///
5829    /// Sets the *name* path property to the given value.
5830    ///
5831    /// Even though the property as already been set when instantiating this call,
5832    /// we provide this method for API completeness.
5833    pub fn name(mut self, new_value: &str) -> FolderMoveCall<'a, C> {
5834        self._name = new_value.to_string();
5835        self
5836    }
5837    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5838    /// while executing the actual API request.
5839    ///
5840    /// ````text
5841    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5842    /// ````
5843    ///
5844    /// Sets the *delegate* property to the given value.
5845    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FolderMoveCall<'a, C> {
5846        self._delegate = Some(new_value);
5847        self
5848    }
5849
5850    /// Set any additional parameter of the query string used in the request.
5851    /// It should be used to set parameters which are not yet available through their own
5852    /// setters.
5853    ///
5854    /// Please note that this method must not be used to set any of the known parameters
5855    /// which have their own setter method. If done anyway, the request will fail.
5856    ///
5857    /// # Additional Parameters
5858    ///
5859    /// * *$.xgafv* (query-string) - V1 error format.
5860    /// * *access_token* (query-string) - OAuth access token.
5861    /// * *alt* (query-string) - Data format for response.
5862    /// * *callback* (query-string) - JSONP
5863    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5864    /// * *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.
5865    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5866    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5867    /// * *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.
5868    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5869    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5870    pub fn param<T>(mut self, name: T, value: T) -> FolderMoveCall<'a, C>
5871    where
5872        T: AsRef<str>,
5873    {
5874        self._additional_params
5875            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5876        self
5877    }
5878
5879    /// Identifies the authorization scope for the method you are building.
5880    ///
5881    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5882    /// [`Scope::CloudPlatform`].
5883    ///
5884    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5885    /// tokens for more than one scope.
5886    ///
5887    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5888    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5889    /// sufficient, a read-write scope will do as well.
5890    pub fn add_scope<St>(mut self, scope: St) -> FolderMoveCall<'a, C>
5891    where
5892        St: AsRef<str>,
5893    {
5894        self._scopes.insert(String::from(scope.as_ref()));
5895        self
5896    }
5897    /// Identifies the authorization scope(s) for the method you are building.
5898    ///
5899    /// See [`Self::add_scope()`] for details.
5900    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderMoveCall<'a, C>
5901    where
5902        I: IntoIterator<Item = St>,
5903        St: AsRef<str>,
5904    {
5905        self._scopes
5906            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5907        self
5908    }
5909
5910    /// Removes all scopes, and no default scope will be used either.
5911    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5912    /// for details).
5913    pub fn clear_scopes(mut self) -> FolderMoveCall<'a, C> {
5914        self._scopes.clear();
5915        self
5916    }
5917}
5918
5919/// Updates a folder, changing its `display_name`. Changes to the folder `display_name` will be rejected if they violate either the `display_name` formatting rules or the naming constraints described in the CreateFolder documentation. The folder's `display_name` must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be between 3 and 30 characters. This is captured by the regular expression: `\p{L}\p{N}{1,28}[\p{L}\p{N}]`. The caller must have `resourcemanager.folders.update` permission on the identified folder. If the update fails due to the unique name constraint then a `PreconditionFailure` explaining this violation will be returned in the Status.details field.
5920///
5921/// A builder for the *patch* method supported by a *folder* resource.
5922/// It is not used directly, but through a [`FolderMethods`] instance.
5923///
5924/// # Example
5925///
5926/// Instantiate a resource method builder
5927///
5928/// ```test_harness,no_run
5929/// # extern crate hyper;
5930/// # extern crate hyper_rustls;
5931/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
5932/// use cloudresourcemanager3::api::Folder;
5933/// # async fn dox() {
5934/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5935///
5936/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5937/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5938/// #     .with_native_roots()
5939/// #     .unwrap()
5940/// #     .https_only()
5941/// #     .enable_http2()
5942/// #     .build();
5943///
5944/// # let executor = hyper_util::rt::TokioExecutor::new();
5945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5946/// #     secret,
5947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5948/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5949/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5950/// #     ),
5951/// # ).build().await.unwrap();
5952///
5953/// # let client = hyper_util::client::legacy::Client::builder(
5954/// #     hyper_util::rt::TokioExecutor::new()
5955/// # )
5956/// # .build(
5957/// #     hyper_rustls::HttpsConnectorBuilder::new()
5958/// #         .with_native_roots()
5959/// #         .unwrap()
5960/// #         .https_or_http()
5961/// #         .enable_http2()
5962/// #         .build()
5963/// # );
5964/// # let mut hub = CloudResourceManager::new(client, auth);
5965/// // As the method needs a request, you would usually fill it with the desired information
5966/// // into the respective structure. Some of the parts shown here might not be applicable !
5967/// // Values shown here are possibly random and not representative !
5968/// let mut req = Folder::default();
5969///
5970/// // You can configure optional parameters by calling the respective setters at will, and
5971/// // execute the final call using `doit()`.
5972/// // Values shown here are possibly random and not representative !
5973/// let result = hub.folders().patch(req, "name")
5974///              .update_mask(FieldMask::new::<&str>(&[]))
5975///              .doit().await;
5976/// # }
5977/// ```
5978pub struct FolderPatchCall<'a, C>
5979where
5980    C: 'a,
5981{
5982    hub: &'a CloudResourceManager<C>,
5983    _request: Folder,
5984    _name: String,
5985    _update_mask: Option<common::FieldMask>,
5986    _delegate: Option<&'a mut dyn common::Delegate>,
5987    _additional_params: HashMap<String, String>,
5988    _scopes: BTreeSet<String>,
5989}
5990
5991impl<'a, C> common::CallBuilder for FolderPatchCall<'a, C> {}
5992
5993impl<'a, C> FolderPatchCall<'a, C>
5994where
5995    C: common::Connector,
5996{
5997    /// Perform the operation you have build so far.
5998    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5999        use std::borrow::Cow;
6000        use std::io::{Read, Seek};
6001
6002        use common::{url::Params, ToParts};
6003        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6004
6005        let mut dd = common::DefaultDelegate;
6006        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6007        dlg.begin(common::MethodInfo {
6008            id: "cloudresourcemanager.folders.patch",
6009            http_method: hyper::Method::PATCH,
6010        });
6011
6012        for &field in ["alt", "name", "updateMask"].iter() {
6013            if self._additional_params.contains_key(field) {
6014                dlg.finished(false);
6015                return Err(common::Error::FieldClash(field));
6016            }
6017        }
6018
6019        let mut params = Params::with_capacity(5 + self._additional_params.len());
6020        params.push("name", self._name);
6021        if let Some(value) = self._update_mask.as_ref() {
6022            params.push("updateMask", value.to_string());
6023        }
6024
6025        params.extend(self._additional_params.iter());
6026
6027        params.push("alt", "json");
6028        let mut url = self.hub._base_url.clone() + "v3/{+name}";
6029        if self._scopes.is_empty() {
6030            self._scopes
6031                .insert(Scope::CloudPlatform.as_ref().to_string());
6032        }
6033
6034        #[allow(clippy::single_element_loop)]
6035        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6036            url = params.uri_replacement(url, param_name, find_this, true);
6037        }
6038        {
6039            let to_remove = ["name"];
6040            params.remove_params(&to_remove);
6041        }
6042
6043        let url = params.parse_with_url(&url);
6044
6045        let mut json_mime_type = mime::APPLICATION_JSON;
6046        let mut request_value_reader = {
6047            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6048            common::remove_json_null_values(&mut value);
6049            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6050            serde_json::to_writer(&mut dst, &value).unwrap();
6051            dst
6052        };
6053        let request_size = request_value_reader
6054            .seek(std::io::SeekFrom::End(0))
6055            .unwrap();
6056        request_value_reader
6057            .seek(std::io::SeekFrom::Start(0))
6058            .unwrap();
6059
6060        loop {
6061            let token = match self
6062                .hub
6063                .auth
6064                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6065                .await
6066            {
6067                Ok(token) => token,
6068                Err(e) => match dlg.token(e) {
6069                    Ok(token) => token,
6070                    Err(e) => {
6071                        dlg.finished(false);
6072                        return Err(common::Error::MissingToken(e));
6073                    }
6074                },
6075            };
6076            request_value_reader
6077                .seek(std::io::SeekFrom::Start(0))
6078                .unwrap();
6079            let mut req_result = {
6080                let client = &self.hub.client;
6081                dlg.pre_request();
6082                let mut req_builder = hyper::Request::builder()
6083                    .method(hyper::Method::PATCH)
6084                    .uri(url.as_str())
6085                    .header(USER_AGENT, self.hub._user_agent.clone());
6086
6087                if let Some(token) = token.as_ref() {
6088                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6089                }
6090
6091                let request = req_builder
6092                    .header(CONTENT_TYPE, json_mime_type.to_string())
6093                    .header(CONTENT_LENGTH, request_size as u64)
6094                    .body(common::to_body(
6095                        request_value_reader.get_ref().clone().into(),
6096                    ));
6097
6098                client.request(request.unwrap()).await
6099            };
6100
6101            match req_result {
6102                Err(err) => {
6103                    if let common::Retry::After(d) = dlg.http_error(&err) {
6104                        sleep(d).await;
6105                        continue;
6106                    }
6107                    dlg.finished(false);
6108                    return Err(common::Error::HttpError(err));
6109                }
6110                Ok(res) => {
6111                    let (mut parts, body) = res.into_parts();
6112                    let mut body = common::Body::new(body);
6113                    if !parts.status.is_success() {
6114                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6115                        let error = serde_json::from_str(&common::to_string(&bytes));
6116                        let response = common::to_response(parts, bytes.into());
6117
6118                        if let common::Retry::After(d) =
6119                            dlg.http_failure(&response, error.as_ref().ok())
6120                        {
6121                            sleep(d).await;
6122                            continue;
6123                        }
6124
6125                        dlg.finished(false);
6126
6127                        return Err(match error {
6128                            Ok(value) => common::Error::BadRequest(value),
6129                            _ => common::Error::Failure(response),
6130                        });
6131                    }
6132                    let response = {
6133                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6134                        let encoded = common::to_string(&bytes);
6135                        match serde_json::from_str(&encoded) {
6136                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6137                            Err(error) => {
6138                                dlg.response_json_decode_error(&encoded, &error);
6139                                return Err(common::Error::JsonDecodeError(
6140                                    encoded.to_string(),
6141                                    error,
6142                                ));
6143                            }
6144                        }
6145                    };
6146
6147                    dlg.finished(true);
6148                    return Ok(response);
6149                }
6150            }
6151        }
6152    }
6153
6154    ///
6155    /// Sets the *request* property to the given value.
6156    ///
6157    /// Even though the property as already been set when instantiating this call,
6158    /// we provide this method for API completeness.
6159    pub fn request(mut self, new_value: Folder) -> FolderPatchCall<'a, C> {
6160        self._request = new_value;
6161        self
6162    }
6163    /// Identifier. The resource name of the folder. Its format is `folders/{folder_id}`, for example: "folders/1234".
6164    ///
6165    /// Sets the *name* path property to the given value.
6166    ///
6167    /// Even though the property as already been set when instantiating this call,
6168    /// we provide this method for API completeness.
6169    pub fn name(mut self, new_value: &str) -> FolderPatchCall<'a, C> {
6170        self._name = new_value.to_string();
6171        self
6172    }
6173    /// Required. Fields to be updated. Only the `display_name` can be updated.
6174    ///
6175    /// Sets the *update mask* query property to the given value.
6176    pub fn update_mask(mut self, new_value: common::FieldMask) -> FolderPatchCall<'a, C> {
6177        self._update_mask = Some(new_value);
6178        self
6179    }
6180    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6181    /// while executing the actual API request.
6182    ///
6183    /// ````text
6184    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6185    /// ````
6186    ///
6187    /// Sets the *delegate* property to the given value.
6188    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FolderPatchCall<'a, C> {
6189        self._delegate = Some(new_value);
6190        self
6191    }
6192
6193    /// Set any additional parameter of the query string used in the request.
6194    /// It should be used to set parameters which are not yet available through their own
6195    /// setters.
6196    ///
6197    /// Please note that this method must not be used to set any of the known parameters
6198    /// which have their own setter method. If done anyway, the request will fail.
6199    ///
6200    /// # Additional Parameters
6201    ///
6202    /// * *$.xgafv* (query-string) - V1 error format.
6203    /// * *access_token* (query-string) - OAuth access token.
6204    /// * *alt* (query-string) - Data format for response.
6205    /// * *callback* (query-string) - JSONP
6206    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6207    /// * *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.
6208    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6209    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6210    /// * *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.
6211    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6212    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6213    pub fn param<T>(mut self, name: T, value: T) -> FolderPatchCall<'a, C>
6214    where
6215        T: AsRef<str>,
6216    {
6217        self._additional_params
6218            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6219        self
6220    }
6221
6222    /// Identifies the authorization scope for the method you are building.
6223    ///
6224    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6225    /// [`Scope::CloudPlatform`].
6226    ///
6227    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6228    /// tokens for more than one scope.
6229    ///
6230    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6231    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6232    /// sufficient, a read-write scope will do as well.
6233    pub fn add_scope<St>(mut self, scope: St) -> FolderPatchCall<'a, C>
6234    where
6235        St: AsRef<str>,
6236    {
6237        self._scopes.insert(String::from(scope.as_ref()));
6238        self
6239    }
6240    /// Identifies the authorization scope(s) for the method you are building.
6241    ///
6242    /// See [`Self::add_scope()`] for details.
6243    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderPatchCall<'a, C>
6244    where
6245        I: IntoIterator<Item = St>,
6246        St: AsRef<str>,
6247    {
6248        self._scopes
6249            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6250        self
6251    }
6252
6253    /// Removes all scopes, and no default scope will be used either.
6254    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6255    /// for details).
6256    pub fn clear_scopes(mut self) -> FolderPatchCall<'a, C> {
6257        self._scopes.clear();
6258        self
6259    }
6260}
6261
6262/// Search for folders that match specific filter criteria. `search()` provides an eventually consistent view of the folders a user has access to which meet the specified filter criteria. This will only return folders on which the caller has the permission `resourcemanager.folders.get`.
6263///
6264/// A builder for the *search* method supported by a *folder* resource.
6265/// It is not used directly, but through a [`FolderMethods`] instance.
6266///
6267/// # Example
6268///
6269/// Instantiate a resource method builder
6270///
6271/// ```test_harness,no_run
6272/// # extern crate hyper;
6273/// # extern crate hyper_rustls;
6274/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
6275/// # async fn dox() {
6276/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6277///
6278/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6279/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6280/// #     .with_native_roots()
6281/// #     .unwrap()
6282/// #     .https_only()
6283/// #     .enable_http2()
6284/// #     .build();
6285///
6286/// # let executor = hyper_util::rt::TokioExecutor::new();
6287/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6288/// #     secret,
6289/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6290/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6291/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6292/// #     ),
6293/// # ).build().await.unwrap();
6294///
6295/// # let client = hyper_util::client::legacy::Client::builder(
6296/// #     hyper_util::rt::TokioExecutor::new()
6297/// # )
6298/// # .build(
6299/// #     hyper_rustls::HttpsConnectorBuilder::new()
6300/// #         .with_native_roots()
6301/// #         .unwrap()
6302/// #         .https_or_http()
6303/// #         .enable_http2()
6304/// #         .build()
6305/// # );
6306/// # let mut hub = CloudResourceManager::new(client, auth);
6307/// // You can configure optional parameters by calling the respective setters at will, and
6308/// // execute the final call using `doit()`.
6309/// // Values shown here are possibly random and not representative !
6310/// let result = hub.folders().search()
6311///              .query("ut")
6312///              .page_token("gubergren")
6313///              .page_size(-16)
6314///              .doit().await;
6315/// # }
6316/// ```
6317pub struct FolderSearchCall<'a, C>
6318where
6319    C: 'a,
6320{
6321    hub: &'a CloudResourceManager<C>,
6322    _query: Option<String>,
6323    _page_token: Option<String>,
6324    _page_size: Option<i32>,
6325    _delegate: Option<&'a mut dyn common::Delegate>,
6326    _additional_params: HashMap<String, String>,
6327    _scopes: BTreeSet<String>,
6328}
6329
6330impl<'a, C> common::CallBuilder for FolderSearchCall<'a, C> {}
6331
6332impl<'a, C> FolderSearchCall<'a, C>
6333where
6334    C: common::Connector,
6335{
6336    /// Perform the operation you have build so far.
6337    pub async fn doit(mut self) -> common::Result<(common::Response, SearchFoldersResponse)> {
6338        use std::borrow::Cow;
6339        use std::io::{Read, Seek};
6340
6341        use common::{url::Params, ToParts};
6342        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6343
6344        let mut dd = common::DefaultDelegate;
6345        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6346        dlg.begin(common::MethodInfo {
6347            id: "cloudresourcemanager.folders.search",
6348            http_method: hyper::Method::GET,
6349        });
6350
6351        for &field in ["alt", "query", "pageToken", "pageSize"].iter() {
6352            if self._additional_params.contains_key(field) {
6353                dlg.finished(false);
6354                return Err(common::Error::FieldClash(field));
6355            }
6356        }
6357
6358        let mut params = Params::with_capacity(5 + self._additional_params.len());
6359        if let Some(value) = self._query.as_ref() {
6360            params.push("query", value);
6361        }
6362        if let Some(value) = self._page_token.as_ref() {
6363            params.push("pageToken", value);
6364        }
6365        if let Some(value) = self._page_size.as_ref() {
6366            params.push("pageSize", value.to_string());
6367        }
6368
6369        params.extend(self._additional_params.iter());
6370
6371        params.push("alt", "json");
6372        let mut url = self.hub._base_url.clone() + "v3/folders:search";
6373        if self._scopes.is_empty() {
6374            self._scopes
6375                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
6376        }
6377
6378        let url = params.parse_with_url(&url);
6379
6380        loop {
6381            let token = match self
6382                .hub
6383                .auth
6384                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6385                .await
6386            {
6387                Ok(token) => token,
6388                Err(e) => match dlg.token(e) {
6389                    Ok(token) => token,
6390                    Err(e) => {
6391                        dlg.finished(false);
6392                        return Err(common::Error::MissingToken(e));
6393                    }
6394                },
6395            };
6396            let mut req_result = {
6397                let client = &self.hub.client;
6398                dlg.pre_request();
6399                let mut req_builder = hyper::Request::builder()
6400                    .method(hyper::Method::GET)
6401                    .uri(url.as_str())
6402                    .header(USER_AGENT, self.hub._user_agent.clone());
6403
6404                if let Some(token) = token.as_ref() {
6405                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6406                }
6407
6408                let request = req_builder
6409                    .header(CONTENT_LENGTH, 0_u64)
6410                    .body(common::to_body::<String>(None));
6411
6412                client.request(request.unwrap()).await
6413            };
6414
6415            match req_result {
6416                Err(err) => {
6417                    if let common::Retry::After(d) = dlg.http_error(&err) {
6418                        sleep(d).await;
6419                        continue;
6420                    }
6421                    dlg.finished(false);
6422                    return Err(common::Error::HttpError(err));
6423                }
6424                Ok(res) => {
6425                    let (mut parts, body) = res.into_parts();
6426                    let mut body = common::Body::new(body);
6427                    if !parts.status.is_success() {
6428                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6429                        let error = serde_json::from_str(&common::to_string(&bytes));
6430                        let response = common::to_response(parts, bytes.into());
6431
6432                        if let common::Retry::After(d) =
6433                            dlg.http_failure(&response, error.as_ref().ok())
6434                        {
6435                            sleep(d).await;
6436                            continue;
6437                        }
6438
6439                        dlg.finished(false);
6440
6441                        return Err(match error {
6442                            Ok(value) => common::Error::BadRequest(value),
6443                            _ => common::Error::Failure(response),
6444                        });
6445                    }
6446                    let response = {
6447                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6448                        let encoded = common::to_string(&bytes);
6449                        match serde_json::from_str(&encoded) {
6450                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6451                            Err(error) => {
6452                                dlg.response_json_decode_error(&encoded, &error);
6453                                return Err(common::Error::JsonDecodeError(
6454                                    encoded.to_string(),
6455                                    error,
6456                                ));
6457                            }
6458                        }
6459                    };
6460
6461                    dlg.finished(true);
6462                    return Ok(response);
6463                }
6464            }
6465        }
6466    }
6467
6468    /// Optional. Search criteria used to select the folders to return. If no search criteria is specified then all accessible folders will be returned. Query expressions can be used to restrict results based upon displayName, state and parent, where the operators `=` (`:`) `NOT`, `AND` and `OR` can be used along with the suffix wildcard symbol `*`. The `displayName` field in a query expression should use escaped quotes for values that include whitespace to prevent unexpected behavior. ``` | Field | Description | |-------------------------|----------------------------------------| | displayName | Filters by displayName. | | parent | Filters by parent (for example: folders/123). | | state, lifecycleState | Filters by state. | ``` Some example queries are: * Query `displayName=Test*` returns Folder resources whose display name starts with "Test". * Query `state=ACTIVE` returns Folder resources with `state` set to `ACTIVE`. * Query `parent=folders/123` returns Folder resources that have `folders/123` as a parent resource. * Query `parent=folders/123 AND state=ACTIVE` returns active Folder resources that have `folders/123` as a parent resource. * Query `displayName=\\"Test String\\"` returns Folder resources with display names that include both "Test" and "String".
6469    ///
6470    /// Sets the *query* query property to the given value.
6471    pub fn query(mut self, new_value: &str) -> FolderSearchCall<'a, C> {
6472        self._query = Some(new_value.to_string());
6473        self
6474    }
6475    /// Optional. A pagination token returned from a previous call to `SearchFolders` that indicates from where search should continue.
6476    ///
6477    /// Sets the *page token* query property to the given value.
6478    pub fn page_token(mut self, new_value: &str) -> FolderSearchCall<'a, C> {
6479        self._page_token = Some(new_value.to_string());
6480        self
6481    }
6482    /// Optional. The maximum number of folders to return in the response. The server can return fewer folders than requested. If unspecified, server picks an appropriate default.
6483    ///
6484    /// Sets the *page size* query property to the given value.
6485    pub fn page_size(mut self, new_value: i32) -> FolderSearchCall<'a, C> {
6486        self._page_size = Some(new_value);
6487        self
6488    }
6489    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6490    /// while executing the actual API request.
6491    ///
6492    /// ````text
6493    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6494    /// ````
6495    ///
6496    /// Sets the *delegate* property to the given value.
6497    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> FolderSearchCall<'a, C> {
6498        self._delegate = Some(new_value);
6499        self
6500    }
6501
6502    /// Set any additional parameter of the query string used in the request.
6503    /// It should be used to set parameters which are not yet available through their own
6504    /// setters.
6505    ///
6506    /// Please note that this method must not be used to set any of the known parameters
6507    /// which have their own setter method. If done anyway, the request will fail.
6508    ///
6509    /// # Additional Parameters
6510    ///
6511    /// * *$.xgafv* (query-string) - V1 error format.
6512    /// * *access_token* (query-string) - OAuth access token.
6513    /// * *alt* (query-string) - Data format for response.
6514    /// * *callback* (query-string) - JSONP
6515    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6516    /// * *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.
6517    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6518    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6519    /// * *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.
6520    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6521    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6522    pub fn param<T>(mut self, name: T, value: T) -> FolderSearchCall<'a, C>
6523    where
6524        T: AsRef<str>,
6525    {
6526        self._additional_params
6527            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6528        self
6529    }
6530
6531    /// Identifies the authorization scope for the method you are building.
6532    ///
6533    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6534    /// [`Scope::CloudPlatformReadOnly`].
6535    ///
6536    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6537    /// tokens for more than one scope.
6538    ///
6539    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6540    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6541    /// sufficient, a read-write scope will do as well.
6542    pub fn add_scope<St>(mut self, scope: St) -> FolderSearchCall<'a, C>
6543    where
6544        St: AsRef<str>,
6545    {
6546        self._scopes.insert(String::from(scope.as_ref()));
6547        self
6548    }
6549    /// Identifies the authorization scope(s) for the method you are building.
6550    ///
6551    /// See [`Self::add_scope()`] for details.
6552    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderSearchCall<'a, C>
6553    where
6554        I: IntoIterator<Item = St>,
6555        St: AsRef<str>,
6556    {
6557        self._scopes
6558            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6559        self
6560    }
6561
6562    /// Removes all scopes, and no default scope will be used either.
6563    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6564    /// for details).
6565    pub fn clear_scopes(mut self) -> FolderSearchCall<'a, C> {
6566        self._scopes.clear();
6567        self
6568    }
6569}
6570
6571/// Sets the access control policy on a folder, replacing any existing policy. The `resource` field should be the folder's resource name, for example: "folders/1234". The caller must have `resourcemanager.folders.setIamPolicy` permission on the identified folder.
6572///
6573/// A builder for the *setIamPolicy* method supported by a *folder* resource.
6574/// It is not used directly, but through a [`FolderMethods`] instance.
6575///
6576/// # Example
6577///
6578/// Instantiate a resource method builder
6579///
6580/// ```test_harness,no_run
6581/// # extern crate hyper;
6582/// # extern crate hyper_rustls;
6583/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
6584/// use cloudresourcemanager3::api::SetIamPolicyRequest;
6585/// # async fn dox() {
6586/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6587///
6588/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6589/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6590/// #     .with_native_roots()
6591/// #     .unwrap()
6592/// #     .https_only()
6593/// #     .enable_http2()
6594/// #     .build();
6595///
6596/// # let executor = hyper_util::rt::TokioExecutor::new();
6597/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6598/// #     secret,
6599/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6600/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6601/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6602/// #     ),
6603/// # ).build().await.unwrap();
6604///
6605/// # let client = hyper_util::client::legacy::Client::builder(
6606/// #     hyper_util::rt::TokioExecutor::new()
6607/// # )
6608/// # .build(
6609/// #     hyper_rustls::HttpsConnectorBuilder::new()
6610/// #         .with_native_roots()
6611/// #         .unwrap()
6612/// #         .https_or_http()
6613/// #         .enable_http2()
6614/// #         .build()
6615/// # );
6616/// # let mut hub = CloudResourceManager::new(client, auth);
6617/// // As the method needs a request, you would usually fill it with the desired information
6618/// // into the respective structure. Some of the parts shown here might not be applicable !
6619/// // Values shown here are possibly random and not representative !
6620/// let mut req = SetIamPolicyRequest::default();
6621///
6622/// // You can configure optional parameters by calling the respective setters at will, and
6623/// // execute the final call using `doit()`.
6624/// // Values shown here are possibly random and not representative !
6625/// let result = hub.folders().set_iam_policy(req, "resource")
6626///              .doit().await;
6627/// # }
6628/// ```
6629pub struct FolderSetIamPolicyCall<'a, C>
6630where
6631    C: 'a,
6632{
6633    hub: &'a CloudResourceManager<C>,
6634    _request: SetIamPolicyRequest,
6635    _resource: String,
6636    _delegate: Option<&'a mut dyn common::Delegate>,
6637    _additional_params: HashMap<String, String>,
6638    _scopes: BTreeSet<String>,
6639}
6640
6641impl<'a, C> common::CallBuilder for FolderSetIamPolicyCall<'a, C> {}
6642
6643impl<'a, C> FolderSetIamPolicyCall<'a, C>
6644where
6645    C: common::Connector,
6646{
6647    /// Perform the operation you have build so far.
6648    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6649        use std::borrow::Cow;
6650        use std::io::{Read, Seek};
6651
6652        use common::{url::Params, ToParts};
6653        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6654
6655        let mut dd = common::DefaultDelegate;
6656        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6657        dlg.begin(common::MethodInfo {
6658            id: "cloudresourcemanager.folders.setIamPolicy",
6659            http_method: hyper::Method::POST,
6660        });
6661
6662        for &field in ["alt", "resource"].iter() {
6663            if self._additional_params.contains_key(field) {
6664                dlg.finished(false);
6665                return Err(common::Error::FieldClash(field));
6666            }
6667        }
6668
6669        let mut params = Params::with_capacity(4 + self._additional_params.len());
6670        params.push("resource", self._resource);
6671
6672        params.extend(self._additional_params.iter());
6673
6674        params.push("alt", "json");
6675        let mut url = self.hub._base_url.clone() + "v3/{+resource}:setIamPolicy";
6676        if self._scopes.is_empty() {
6677            self._scopes
6678                .insert(Scope::CloudPlatform.as_ref().to_string());
6679        }
6680
6681        #[allow(clippy::single_element_loop)]
6682        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6683            url = params.uri_replacement(url, param_name, find_this, true);
6684        }
6685        {
6686            let to_remove = ["resource"];
6687            params.remove_params(&to_remove);
6688        }
6689
6690        let url = params.parse_with_url(&url);
6691
6692        let mut json_mime_type = mime::APPLICATION_JSON;
6693        let mut request_value_reader = {
6694            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6695            common::remove_json_null_values(&mut value);
6696            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6697            serde_json::to_writer(&mut dst, &value).unwrap();
6698            dst
6699        };
6700        let request_size = request_value_reader
6701            .seek(std::io::SeekFrom::End(0))
6702            .unwrap();
6703        request_value_reader
6704            .seek(std::io::SeekFrom::Start(0))
6705            .unwrap();
6706
6707        loop {
6708            let token = match self
6709                .hub
6710                .auth
6711                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6712                .await
6713            {
6714                Ok(token) => token,
6715                Err(e) => match dlg.token(e) {
6716                    Ok(token) => token,
6717                    Err(e) => {
6718                        dlg.finished(false);
6719                        return Err(common::Error::MissingToken(e));
6720                    }
6721                },
6722            };
6723            request_value_reader
6724                .seek(std::io::SeekFrom::Start(0))
6725                .unwrap();
6726            let mut req_result = {
6727                let client = &self.hub.client;
6728                dlg.pre_request();
6729                let mut req_builder = hyper::Request::builder()
6730                    .method(hyper::Method::POST)
6731                    .uri(url.as_str())
6732                    .header(USER_AGENT, self.hub._user_agent.clone());
6733
6734                if let Some(token) = token.as_ref() {
6735                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6736                }
6737
6738                let request = req_builder
6739                    .header(CONTENT_TYPE, json_mime_type.to_string())
6740                    .header(CONTENT_LENGTH, request_size as u64)
6741                    .body(common::to_body(
6742                        request_value_reader.get_ref().clone().into(),
6743                    ));
6744
6745                client.request(request.unwrap()).await
6746            };
6747
6748            match req_result {
6749                Err(err) => {
6750                    if let common::Retry::After(d) = dlg.http_error(&err) {
6751                        sleep(d).await;
6752                        continue;
6753                    }
6754                    dlg.finished(false);
6755                    return Err(common::Error::HttpError(err));
6756                }
6757                Ok(res) => {
6758                    let (mut parts, body) = res.into_parts();
6759                    let mut body = common::Body::new(body);
6760                    if !parts.status.is_success() {
6761                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6762                        let error = serde_json::from_str(&common::to_string(&bytes));
6763                        let response = common::to_response(parts, bytes.into());
6764
6765                        if let common::Retry::After(d) =
6766                            dlg.http_failure(&response, error.as_ref().ok())
6767                        {
6768                            sleep(d).await;
6769                            continue;
6770                        }
6771
6772                        dlg.finished(false);
6773
6774                        return Err(match error {
6775                            Ok(value) => common::Error::BadRequest(value),
6776                            _ => common::Error::Failure(response),
6777                        });
6778                    }
6779                    let response = {
6780                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6781                        let encoded = common::to_string(&bytes);
6782                        match serde_json::from_str(&encoded) {
6783                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6784                            Err(error) => {
6785                                dlg.response_json_decode_error(&encoded, &error);
6786                                return Err(common::Error::JsonDecodeError(
6787                                    encoded.to_string(),
6788                                    error,
6789                                ));
6790                            }
6791                        }
6792                    };
6793
6794                    dlg.finished(true);
6795                    return Ok(response);
6796                }
6797            }
6798        }
6799    }
6800
6801    ///
6802    /// Sets the *request* property to the given value.
6803    ///
6804    /// Even though the property as already been set when instantiating this call,
6805    /// we provide this method for API completeness.
6806    pub fn request(mut self, new_value: SetIamPolicyRequest) -> FolderSetIamPolicyCall<'a, C> {
6807        self._request = new_value;
6808        self
6809    }
6810    /// 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.
6811    ///
6812    /// Sets the *resource* path property to the given value.
6813    ///
6814    /// Even though the property as already been set when instantiating this call,
6815    /// we provide this method for API completeness.
6816    pub fn resource(mut self, new_value: &str) -> FolderSetIamPolicyCall<'a, C> {
6817        self._resource = new_value.to_string();
6818        self
6819    }
6820    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6821    /// while executing the actual API request.
6822    ///
6823    /// ````text
6824    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6825    /// ````
6826    ///
6827    /// Sets the *delegate* property to the given value.
6828    pub fn delegate(
6829        mut self,
6830        new_value: &'a mut dyn common::Delegate,
6831    ) -> FolderSetIamPolicyCall<'a, C> {
6832        self._delegate = Some(new_value);
6833        self
6834    }
6835
6836    /// Set any additional parameter of the query string used in the request.
6837    /// It should be used to set parameters which are not yet available through their own
6838    /// setters.
6839    ///
6840    /// Please note that this method must not be used to set any of the known parameters
6841    /// which have their own setter method. If done anyway, the request will fail.
6842    ///
6843    /// # Additional Parameters
6844    ///
6845    /// * *$.xgafv* (query-string) - V1 error format.
6846    /// * *access_token* (query-string) - OAuth access token.
6847    /// * *alt* (query-string) - Data format for response.
6848    /// * *callback* (query-string) - JSONP
6849    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6850    /// * *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.
6851    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6852    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6853    /// * *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.
6854    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6855    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6856    pub fn param<T>(mut self, name: T, value: T) -> FolderSetIamPolicyCall<'a, C>
6857    where
6858        T: AsRef<str>,
6859    {
6860        self._additional_params
6861            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6862        self
6863    }
6864
6865    /// Identifies the authorization scope for the method you are building.
6866    ///
6867    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6868    /// [`Scope::CloudPlatform`].
6869    ///
6870    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6871    /// tokens for more than one scope.
6872    ///
6873    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6874    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6875    /// sufficient, a read-write scope will do as well.
6876    pub fn add_scope<St>(mut self, scope: St) -> FolderSetIamPolicyCall<'a, C>
6877    where
6878        St: AsRef<str>,
6879    {
6880        self._scopes.insert(String::from(scope.as_ref()));
6881        self
6882    }
6883    /// Identifies the authorization scope(s) for the method you are building.
6884    ///
6885    /// See [`Self::add_scope()`] for details.
6886    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderSetIamPolicyCall<'a, C>
6887    where
6888        I: IntoIterator<Item = St>,
6889        St: AsRef<str>,
6890    {
6891        self._scopes
6892            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6893        self
6894    }
6895
6896    /// Removes all scopes, and no default scope will be used either.
6897    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6898    /// for details).
6899    pub fn clear_scopes(mut self) -> FolderSetIamPolicyCall<'a, C> {
6900        self._scopes.clear();
6901        self
6902    }
6903}
6904
6905/// Returns permissions that a caller has on the specified folder. The `resource` field should be the folder's resource name, for example: "folders/1234". There are no permissions required for making this API call.
6906///
6907/// A builder for the *testIamPermissions* method supported by a *folder* resource.
6908/// It is not used directly, but through a [`FolderMethods`] instance.
6909///
6910/// # Example
6911///
6912/// Instantiate a resource method builder
6913///
6914/// ```test_harness,no_run
6915/// # extern crate hyper;
6916/// # extern crate hyper_rustls;
6917/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
6918/// use cloudresourcemanager3::api::TestIamPermissionsRequest;
6919/// # async fn dox() {
6920/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6921///
6922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6923/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6924/// #     .with_native_roots()
6925/// #     .unwrap()
6926/// #     .https_only()
6927/// #     .enable_http2()
6928/// #     .build();
6929///
6930/// # let executor = hyper_util::rt::TokioExecutor::new();
6931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6932/// #     secret,
6933/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6934/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6935/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6936/// #     ),
6937/// # ).build().await.unwrap();
6938///
6939/// # let client = hyper_util::client::legacy::Client::builder(
6940/// #     hyper_util::rt::TokioExecutor::new()
6941/// # )
6942/// # .build(
6943/// #     hyper_rustls::HttpsConnectorBuilder::new()
6944/// #         .with_native_roots()
6945/// #         .unwrap()
6946/// #         .https_or_http()
6947/// #         .enable_http2()
6948/// #         .build()
6949/// # );
6950/// # let mut hub = CloudResourceManager::new(client, auth);
6951/// // As the method needs a request, you would usually fill it with the desired information
6952/// // into the respective structure. Some of the parts shown here might not be applicable !
6953/// // Values shown here are possibly random and not representative !
6954/// let mut req = TestIamPermissionsRequest::default();
6955///
6956/// // You can configure optional parameters by calling the respective setters at will, and
6957/// // execute the final call using `doit()`.
6958/// // Values shown here are possibly random and not representative !
6959/// let result = hub.folders().test_iam_permissions(req, "resource")
6960///              .doit().await;
6961/// # }
6962/// ```
6963pub struct FolderTestIamPermissionCall<'a, C>
6964where
6965    C: 'a,
6966{
6967    hub: &'a CloudResourceManager<C>,
6968    _request: TestIamPermissionsRequest,
6969    _resource: String,
6970    _delegate: Option<&'a mut dyn common::Delegate>,
6971    _additional_params: HashMap<String, String>,
6972    _scopes: BTreeSet<String>,
6973}
6974
6975impl<'a, C> common::CallBuilder for FolderTestIamPermissionCall<'a, C> {}
6976
6977impl<'a, C> FolderTestIamPermissionCall<'a, C>
6978where
6979    C: common::Connector,
6980{
6981    /// Perform the operation you have build so far.
6982    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
6983        use std::borrow::Cow;
6984        use std::io::{Read, Seek};
6985
6986        use common::{url::Params, ToParts};
6987        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6988
6989        let mut dd = common::DefaultDelegate;
6990        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6991        dlg.begin(common::MethodInfo {
6992            id: "cloudresourcemanager.folders.testIamPermissions",
6993            http_method: hyper::Method::POST,
6994        });
6995
6996        for &field in ["alt", "resource"].iter() {
6997            if self._additional_params.contains_key(field) {
6998                dlg.finished(false);
6999                return Err(common::Error::FieldClash(field));
7000            }
7001        }
7002
7003        let mut params = Params::with_capacity(4 + self._additional_params.len());
7004        params.push("resource", self._resource);
7005
7006        params.extend(self._additional_params.iter());
7007
7008        params.push("alt", "json");
7009        let mut url = self.hub._base_url.clone() + "v3/{+resource}:testIamPermissions";
7010        if self._scopes.is_empty() {
7011            self._scopes
7012                .insert(Scope::CloudPlatform.as_ref().to_string());
7013        }
7014
7015        #[allow(clippy::single_element_loop)]
7016        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7017            url = params.uri_replacement(url, param_name, find_this, true);
7018        }
7019        {
7020            let to_remove = ["resource"];
7021            params.remove_params(&to_remove);
7022        }
7023
7024        let url = params.parse_with_url(&url);
7025
7026        let mut json_mime_type = mime::APPLICATION_JSON;
7027        let mut request_value_reader = {
7028            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7029            common::remove_json_null_values(&mut value);
7030            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7031            serde_json::to_writer(&mut dst, &value).unwrap();
7032            dst
7033        };
7034        let request_size = request_value_reader
7035            .seek(std::io::SeekFrom::End(0))
7036            .unwrap();
7037        request_value_reader
7038            .seek(std::io::SeekFrom::Start(0))
7039            .unwrap();
7040
7041        loop {
7042            let token = match self
7043                .hub
7044                .auth
7045                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7046                .await
7047            {
7048                Ok(token) => token,
7049                Err(e) => match dlg.token(e) {
7050                    Ok(token) => token,
7051                    Err(e) => {
7052                        dlg.finished(false);
7053                        return Err(common::Error::MissingToken(e));
7054                    }
7055                },
7056            };
7057            request_value_reader
7058                .seek(std::io::SeekFrom::Start(0))
7059                .unwrap();
7060            let mut req_result = {
7061                let client = &self.hub.client;
7062                dlg.pre_request();
7063                let mut req_builder = hyper::Request::builder()
7064                    .method(hyper::Method::POST)
7065                    .uri(url.as_str())
7066                    .header(USER_AGENT, self.hub._user_agent.clone());
7067
7068                if let Some(token) = token.as_ref() {
7069                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7070                }
7071
7072                let request = req_builder
7073                    .header(CONTENT_TYPE, json_mime_type.to_string())
7074                    .header(CONTENT_LENGTH, request_size as u64)
7075                    .body(common::to_body(
7076                        request_value_reader.get_ref().clone().into(),
7077                    ));
7078
7079                client.request(request.unwrap()).await
7080            };
7081
7082            match req_result {
7083                Err(err) => {
7084                    if let common::Retry::After(d) = dlg.http_error(&err) {
7085                        sleep(d).await;
7086                        continue;
7087                    }
7088                    dlg.finished(false);
7089                    return Err(common::Error::HttpError(err));
7090                }
7091                Ok(res) => {
7092                    let (mut parts, body) = res.into_parts();
7093                    let mut body = common::Body::new(body);
7094                    if !parts.status.is_success() {
7095                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7096                        let error = serde_json::from_str(&common::to_string(&bytes));
7097                        let response = common::to_response(parts, bytes.into());
7098
7099                        if let common::Retry::After(d) =
7100                            dlg.http_failure(&response, error.as_ref().ok())
7101                        {
7102                            sleep(d).await;
7103                            continue;
7104                        }
7105
7106                        dlg.finished(false);
7107
7108                        return Err(match error {
7109                            Ok(value) => common::Error::BadRequest(value),
7110                            _ => common::Error::Failure(response),
7111                        });
7112                    }
7113                    let response = {
7114                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7115                        let encoded = common::to_string(&bytes);
7116                        match serde_json::from_str(&encoded) {
7117                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7118                            Err(error) => {
7119                                dlg.response_json_decode_error(&encoded, &error);
7120                                return Err(common::Error::JsonDecodeError(
7121                                    encoded.to_string(),
7122                                    error,
7123                                ));
7124                            }
7125                        }
7126                    };
7127
7128                    dlg.finished(true);
7129                    return Ok(response);
7130                }
7131            }
7132        }
7133    }
7134
7135    ///
7136    /// Sets the *request* property to the given value.
7137    ///
7138    /// Even though the property as already been set when instantiating this call,
7139    /// we provide this method for API completeness.
7140    pub fn request(
7141        mut self,
7142        new_value: TestIamPermissionsRequest,
7143    ) -> FolderTestIamPermissionCall<'a, C> {
7144        self._request = new_value;
7145        self
7146    }
7147    /// 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.
7148    ///
7149    /// Sets the *resource* path property to the given value.
7150    ///
7151    /// Even though the property as already been set when instantiating this call,
7152    /// we provide this method for API completeness.
7153    pub fn resource(mut self, new_value: &str) -> FolderTestIamPermissionCall<'a, C> {
7154        self._resource = new_value.to_string();
7155        self
7156    }
7157    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7158    /// while executing the actual API request.
7159    ///
7160    /// ````text
7161    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7162    /// ````
7163    ///
7164    /// Sets the *delegate* property to the given value.
7165    pub fn delegate(
7166        mut self,
7167        new_value: &'a mut dyn common::Delegate,
7168    ) -> FolderTestIamPermissionCall<'a, C> {
7169        self._delegate = Some(new_value);
7170        self
7171    }
7172
7173    /// Set any additional parameter of the query string used in the request.
7174    /// It should be used to set parameters which are not yet available through their own
7175    /// setters.
7176    ///
7177    /// Please note that this method must not be used to set any of the known parameters
7178    /// which have their own setter method. If done anyway, the request will fail.
7179    ///
7180    /// # Additional Parameters
7181    ///
7182    /// * *$.xgafv* (query-string) - V1 error format.
7183    /// * *access_token* (query-string) - OAuth access token.
7184    /// * *alt* (query-string) - Data format for response.
7185    /// * *callback* (query-string) - JSONP
7186    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7187    /// * *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.
7188    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7189    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7190    /// * *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.
7191    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7192    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7193    pub fn param<T>(mut self, name: T, value: T) -> FolderTestIamPermissionCall<'a, C>
7194    where
7195        T: AsRef<str>,
7196    {
7197        self._additional_params
7198            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7199        self
7200    }
7201
7202    /// Identifies the authorization scope for the method you are building.
7203    ///
7204    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7205    /// [`Scope::CloudPlatform`].
7206    ///
7207    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7208    /// tokens for more than one scope.
7209    ///
7210    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7211    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7212    /// sufficient, a read-write scope will do as well.
7213    pub fn add_scope<St>(mut self, scope: St) -> FolderTestIamPermissionCall<'a, C>
7214    where
7215        St: AsRef<str>,
7216    {
7217        self._scopes.insert(String::from(scope.as_ref()));
7218        self
7219    }
7220    /// Identifies the authorization scope(s) for the method you are building.
7221    ///
7222    /// See [`Self::add_scope()`] for details.
7223    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderTestIamPermissionCall<'a, C>
7224    where
7225        I: IntoIterator<Item = St>,
7226        St: AsRef<str>,
7227    {
7228        self._scopes
7229            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7230        self
7231    }
7232
7233    /// Removes all scopes, and no default scope will be used either.
7234    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7235    /// for details).
7236    pub fn clear_scopes(mut self) -> FolderTestIamPermissionCall<'a, C> {
7237        self._scopes.clear();
7238        self
7239    }
7240}
7241
7242/// Cancels the deletion request for a folder. This method may be called on a folder in any state. If the folder is in the ACTIVE state the result will be a no-op success. In order to succeed, the folder's parent must be in the ACTIVE state. In addition, reintroducing the folder into the tree must not violate folder naming, height, and fanout constraints described in the CreateFolder documentation. The caller must have `resourcemanager.folders.undelete` permission on the identified folder.
7243///
7244/// A builder for the *undelete* method supported by a *folder* resource.
7245/// It is not used directly, but through a [`FolderMethods`] instance.
7246///
7247/// # Example
7248///
7249/// Instantiate a resource method builder
7250///
7251/// ```test_harness,no_run
7252/// # extern crate hyper;
7253/// # extern crate hyper_rustls;
7254/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
7255/// use cloudresourcemanager3::api::UndeleteFolderRequest;
7256/// # async fn dox() {
7257/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7258///
7259/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7260/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7261/// #     .with_native_roots()
7262/// #     .unwrap()
7263/// #     .https_only()
7264/// #     .enable_http2()
7265/// #     .build();
7266///
7267/// # let executor = hyper_util::rt::TokioExecutor::new();
7268/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7269/// #     secret,
7270/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7271/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7272/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7273/// #     ),
7274/// # ).build().await.unwrap();
7275///
7276/// # let client = hyper_util::client::legacy::Client::builder(
7277/// #     hyper_util::rt::TokioExecutor::new()
7278/// # )
7279/// # .build(
7280/// #     hyper_rustls::HttpsConnectorBuilder::new()
7281/// #         .with_native_roots()
7282/// #         .unwrap()
7283/// #         .https_or_http()
7284/// #         .enable_http2()
7285/// #         .build()
7286/// # );
7287/// # let mut hub = CloudResourceManager::new(client, auth);
7288/// // As the method needs a request, you would usually fill it with the desired information
7289/// // into the respective structure. Some of the parts shown here might not be applicable !
7290/// // Values shown here are possibly random and not representative !
7291/// let mut req = UndeleteFolderRequest::default();
7292///
7293/// // You can configure optional parameters by calling the respective setters at will, and
7294/// // execute the final call using `doit()`.
7295/// // Values shown here are possibly random and not representative !
7296/// let result = hub.folders().undelete(req, "name")
7297///              .doit().await;
7298/// # }
7299/// ```
7300pub struct FolderUndeleteCall<'a, C>
7301where
7302    C: 'a,
7303{
7304    hub: &'a CloudResourceManager<C>,
7305    _request: UndeleteFolderRequest,
7306    _name: String,
7307    _delegate: Option<&'a mut dyn common::Delegate>,
7308    _additional_params: HashMap<String, String>,
7309    _scopes: BTreeSet<String>,
7310}
7311
7312impl<'a, C> common::CallBuilder for FolderUndeleteCall<'a, C> {}
7313
7314impl<'a, C> FolderUndeleteCall<'a, C>
7315where
7316    C: common::Connector,
7317{
7318    /// Perform the operation you have build so far.
7319    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7320        use std::borrow::Cow;
7321        use std::io::{Read, Seek};
7322
7323        use common::{url::Params, ToParts};
7324        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7325
7326        let mut dd = common::DefaultDelegate;
7327        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7328        dlg.begin(common::MethodInfo {
7329            id: "cloudresourcemanager.folders.undelete",
7330            http_method: hyper::Method::POST,
7331        });
7332
7333        for &field in ["alt", "name"].iter() {
7334            if self._additional_params.contains_key(field) {
7335                dlg.finished(false);
7336                return Err(common::Error::FieldClash(field));
7337            }
7338        }
7339
7340        let mut params = Params::with_capacity(4 + self._additional_params.len());
7341        params.push("name", self._name);
7342
7343        params.extend(self._additional_params.iter());
7344
7345        params.push("alt", "json");
7346        let mut url = self.hub._base_url.clone() + "v3/{+name}:undelete";
7347        if self._scopes.is_empty() {
7348            self._scopes
7349                .insert(Scope::CloudPlatform.as_ref().to_string());
7350        }
7351
7352        #[allow(clippy::single_element_loop)]
7353        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7354            url = params.uri_replacement(url, param_name, find_this, true);
7355        }
7356        {
7357            let to_remove = ["name"];
7358            params.remove_params(&to_remove);
7359        }
7360
7361        let url = params.parse_with_url(&url);
7362
7363        let mut json_mime_type = mime::APPLICATION_JSON;
7364        let mut request_value_reader = {
7365            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7366            common::remove_json_null_values(&mut value);
7367            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7368            serde_json::to_writer(&mut dst, &value).unwrap();
7369            dst
7370        };
7371        let request_size = request_value_reader
7372            .seek(std::io::SeekFrom::End(0))
7373            .unwrap();
7374        request_value_reader
7375            .seek(std::io::SeekFrom::Start(0))
7376            .unwrap();
7377
7378        loop {
7379            let token = match self
7380                .hub
7381                .auth
7382                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7383                .await
7384            {
7385                Ok(token) => token,
7386                Err(e) => match dlg.token(e) {
7387                    Ok(token) => token,
7388                    Err(e) => {
7389                        dlg.finished(false);
7390                        return Err(common::Error::MissingToken(e));
7391                    }
7392                },
7393            };
7394            request_value_reader
7395                .seek(std::io::SeekFrom::Start(0))
7396                .unwrap();
7397            let mut req_result = {
7398                let client = &self.hub.client;
7399                dlg.pre_request();
7400                let mut req_builder = hyper::Request::builder()
7401                    .method(hyper::Method::POST)
7402                    .uri(url.as_str())
7403                    .header(USER_AGENT, self.hub._user_agent.clone());
7404
7405                if let Some(token) = token.as_ref() {
7406                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7407                }
7408
7409                let request = req_builder
7410                    .header(CONTENT_TYPE, json_mime_type.to_string())
7411                    .header(CONTENT_LENGTH, request_size as u64)
7412                    .body(common::to_body(
7413                        request_value_reader.get_ref().clone().into(),
7414                    ));
7415
7416                client.request(request.unwrap()).await
7417            };
7418
7419            match req_result {
7420                Err(err) => {
7421                    if let common::Retry::After(d) = dlg.http_error(&err) {
7422                        sleep(d).await;
7423                        continue;
7424                    }
7425                    dlg.finished(false);
7426                    return Err(common::Error::HttpError(err));
7427                }
7428                Ok(res) => {
7429                    let (mut parts, body) = res.into_parts();
7430                    let mut body = common::Body::new(body);
7431                    if !parts.status.is_success() {
7432                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7433                        let error = serde_json::from_str(&common::to_string(&bytes));
7434                        let response = common::to_response(parts, bytes.into());
7435
7436                        if let common::Retry::After(d) =
7437                            dlg.http_failure(&response, error.as_ref().ok())
7438                        {
7439                            sleep(d).await;
7440                            continue;
7441                        }
7442
7443                        dlg.finished(false);
7444
7445                        return Err(match error {
7446                            Ok(value) => common::Error::BadRequest(value),
7447                            _ => common::Error::Failure(response),
7448                        });
7449                    }
7450                    let response = {
7451                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7452                        let encoded = common::to_string(&bytes);
7453                        match serde_json::from_str(&encoded) {
7454                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7455                            Err(error) => {
7456                                dlg.response_json_decode_error(&encoded, &error);
7457                                return Err(common::Error::JsonDecodeError(
7458                                    encoded.to_string(),
7459                                    error,
7460                                ));
7461                            }
7462                        }
7463                    };
7464
7465                    dlg.finished(true);
7466                    return Ok(response);
7467                }
7468            }
7469        }
7470    }
7471
7472    ///
7473    /// Sets the *request* property to the given value.
7474    ///
7475    /// Even though the property as already been set when instantiating this call,
7476    /// we provide this method for API completeness.
7477    pub fn request(mut self, new_value: UndeleteFolderRequest) -> FolderUndeleteCall<'a, C> {
7478        self._request = new_value;
7479        self
7480    }
7481    /// Required. The resource name of the folder to undelete. Must be of the form `folders/{folder_id}`.
7482    ///
7483    /// Sets the *name* path property to the given value.
7484    ///
7485    /// Even though the property as already been set when instantiating this call,
7486    /// we provide this method for API completeness.
7487    pub fn name(mut self, new_value: &str) -> FolderUndeleteCall<'a, C> {
7488        self._name = new_value.to_string();
7489        self
7490    }
7491    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7492    /// while executing the actual API request.
7493    ///
7494    /// ````text
7495    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7496    /// ````
7497    ///
7498    /// Sets the *delegate* property to the given value.
7499    pub fn delegate(
7500        mut self,
7501        new_value: &'a mut dyn common::Delegate,
7502    ) -> FolderUndeleteCall<'a, C> {
7503        self._delegate = Some(new_value);
7504        self
7505    }
7506
7507    /// Set any additional parameter of the query string used in the request.
7508    /// It should be used to set parameters which are not yet available through their own
7509    /// setters.
7510    ///
7511    /// Please note that this method must not be used to set any of the known parameters
7512    /// which have their own setter method. If done anyway, the request will fail.
7513    ///
7514    /// # Additional Parameters
7515    ///
7516    /// * *$.xgafv* (query-string) - V1 error format.
7517    /// * *access_token* (query-string) - OAuth access token.
7518    /// * *alt* (query-string) - Data format for response.
7519    /// * *callback* (query-string) - JSONP
7520    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7521    /// * *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.
7522    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7523    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7524    /// * *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.
7525    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7526    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7527    pub fn param<T>(mut self, name: T, value: T) -> FolderUndeleteCall<'a, C>
7528    where
7529        T: AsRef<str>,
7530    {
7531        self._additional_params
7532            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7533        self
7534    }
7535
7536    /// Identifies the authorization scope for the method you are building.
7537    ///
7538    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7539    /// [`Scope::CloudPlatform`].
7540    ///
7541    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7542    /// tokens for more than one scope.
7543    ///
7544    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7545    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7546    /// sufficient, a read-write scope will do as well.
7547    pub fn add_scope<St>(mut self, scope: St) -> FolderUndeleteCall<'a, C>
7548    where
7549        St: AsRef<str>,
7550    {
7551        self._scopes.insert(String::from(scope.as_ref()));
7552        self
7553    }
7554    /// Identifies the authorization scope(s) for the method you are building.
7555    ///
7556    /// See [`Self::add_scope()`] for details.
7557    pub fn add_scopes<I, St>(mut self, scopes: I) -> FolderUndeleteCall<'a, C>
7558    where
7559        I: IntoIterator<Item = St>,
7560        St: AsRef<str>,
7561    {
7562        self._scopes
7563            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7564        self
7565    }
7566
7567    /// Removes all scopes, and no default scope will be used either.
7568    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7569    /// for details).
7570    pub fn clear_scopes(mut self) -> FolderUndeleteCall<'a, C> {
7571        self._scopes.clear();
7572        self
7573    }
7574}
7575
7576/// Create a Lien which applies to the resource denoted by the `parent` field. Callers of this method will require permission on the `parent` resource. For example, applying to `projects/1234` requires permission `resourcemanager.projects.updateLiens`. NOTE: Some resources may limit the number of Liens which may be applied.
7577///
7578/// A builder for the *create* method supported by a *lien* resource.
7579/// It is not used directly, but through a [`LienMethods`] instance.
7580///
7581/// # Example
7582///
7583/// Instantiate a resource method builder
7584///
7585/// ```test_harness,no_run
7586/// # extern crate hyper;
7587/// # extern crate hyper_rustls;
7588/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
7589/// use cloudresourcemanager3::api::Lien;
7590/// # async fn dox() {
7591/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7592///
7593/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7594/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7595/// #     .with_native_roots()
7596/// #     .unwrap()
7597/// #     .https_only()
7598/// #     .enable_http2()
7599/// #     .build();
7600///
7601/// # let executor = hyper_util::rt::TokioExecutor::new();
7602/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7603/// #     secret,
7604/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7605/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7606/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7607/// #     ),
7608/// # ).build().await.unwrap();
7609///
7610/// # let client = hyper_util::client::legacy::Client::builder(
7611/// #     hyper_util::rt::TokioExecutor::new()
7612/// # )
7613/// # .build(
7614/// #     hyper_rustls::HttpsConnectorBuilder::new()
7615/// #         .with_native_roots()
7616/// #         .unwrap()
7617/// #         .https_or_http()
7618/// #         .enable_http2()
7619/// #         .build()
7620/// # );
7621/// # let mut hub = CloudResourceManager::new(client, auth);
7622/// // As the method needs a request, you would usually fill it with the desired information
7623/// // into the respective structure. Some of the parts shown here might not be applicable !
7624/// // Values shown here are possibly random and not representative !
7625/// let mut req = Lien::default();
7626///
7627/// // You can configure optional parameters by calling the respective setters at will, and
7628/// // execute the final call using `doit()`.
7629/// // Values shown here are possibly random and not representative !
7630/// let result = hub.liens().create(req)
7631///              .doit().await;
7632/// # }
7633/// ```
7634pub struct LienCreateCall<'a, C>
7635where
7636    C: 'a,
7637{
7638    hub: &'a CloudResourceManager<C>,
7639    _request: Lien,
7640    _delegate: Option<&'a mut dyn common::Delegate>,
7641    _additional_params: HashMap<String, String>,
7642    _scopes: BTreeSet<String>,
7643}
7644
7645impl<'a, C> common::CallBuilder for LienCreateCall<'a, C> {}
7646
7647impl<'a, C> LienCreateCall<'a, C>
7648where
7649    C: common::Connector,
7650{
7651    /// Perform the operation you have build so far.
7652    pub async fn doit(mut self) -> common::Result<(common::Response, Lien)> {
7653        use std::borrow::Cow;
7654        use std::io::{Read, Seek};
7655
7656        use common::{url::Params, ToParts};
7657        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7658
7659        let mut dd = common::DefaultDelegate;
7660        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7661        dlg.begin(common::MethodInfo {
7662            id: "cloudresourcemanager.liens.create",
7663            http_method: hyper::Method::POST,
7664        });
7665
7666        for &field in ["alt"].iter() {
7667            if self._additional_params.contains_key(field) {
7668                dlg.finished(false);
7669                return Err(common::Error::FieldClash(field));
7670            }
7671        }
7672
7673        let mut params = Params::with_capacity(3 + self._additional_params.len());
7674
7675        params.extend(self._additional_params.iter());
7676
7677        params.push("alt", "json");
7678        let mut url = self.hub._base_url.clone() + "v3/liens";
7679        if self._scopes.is_empty() {
7680            self._scopes
7681                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7682        }
7683
7684        let url = params.parse_with_url(&url);
7685
7686        let mut json_mime_type = mime::APPLICATION_JSON;
7687        let mut request_value_reader = {
7688            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7689            common::remove_json_null_values(&mut value);
7690            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7691            serde_json::to_writer(&mut dst, &value).unwrap();
7692            dst
7693        };
7694        let request_size = request_value_reader
7695            .seek(std::io::SeekFrom::End(0))
7696            .unwrap();
7697        request_value_reader
7698            .seek(std::io::SeekFrom::Start(0))
7699            .unwrap();
7700
7701        loop {
7702            let token = match self
7703                .hub
7704                .auth
7705                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7706                .await
7707            {
7708                Ok(token) => token,
7709                Err(e) => match dlg.token(e) {
7710                    Ok(token) => token,
7711                    Err(e) => {
7712                        dlg.finished(false);
7713                        return Err(common::Error::MissingToken(e));
7714                    }
7715                },
7716            };
7717            request_value_reader
7718                .seek(std::io::SeekFrom::Start(0))
7719                .unwrap();
7720            let mut req_result = {
7721                let client = &self.hub.client;
7722                dlg.pre_request();
7723                let mut req_builder = hyper::Request::builder()
7724                    .method(hyper::Method::POST)
7725                    .uri(url.as_str())
7726                    .header(USER_AGENT, self.hub._user_agent.clone());
7727
7728                if let Some(token) = token.as_ref() {
7729                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7730                }
7731
7732                let request = req_builder
7733                    .header(CONTENT_TYPE, json_mime_type.to_string())
7734                    .header(CONTENT_LENGTH, request_size as u64)
7735                    .body(common::to_body(
7736                        request_value_reader.get_ref().clone().into(),
7737                    ));
7738
7739                client.request(request.unwrap()).await
7740            };
7741
7742            match req_result {
7743                Err(err) => {
7744                    if let common::Retry::After(d) = dlg.http_error(&err) {
7745                        sleep(d).await;
7746                        continue;
7747                    }
7748                    dlg.finished(false);
7749                    return Err(common::Error::HttpError(err));
7750                }
7751                Ok(res) => {
7752                    let (mut parts, body) = res.into_parts();
7753                    let mut body = common::Body::new(body);
7754                    if !parts.status.is_success() {
7755                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7756                        let error = serde_json::from_str(&common::to_string(&bytes));
7757                        let response = common::to_response(parts, bytes.into());
7758
7759                        if let common::Retry::After(d) =
7760                            dlg.http_failure(&response, error.as_ref().ok())
7761                        {
7762                            sleep(d).await;
7763                            continue;
7764                        }
7765
7766                        dlg.finished(false);
7767
7768                        return Err(match error {
7769                            Ok(value) => common::Error::BadRequest(value),
7770                            _ => common::Error::Failure(response),
7771                        });
7772                    }
7773                    let response = {
7774                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7775                        let encoded = common::to_string(&bytes);
7776                        match serde_json::from_str(&encoded) {
7777                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7778                            Err(error) => {
7779                                dlg.response_json_decode_error(&encoded, &error);
7780                                return Err(common::Error::JsonDecodeError(
7781                                    encoded.to_string(),
7782                                    error,
7783                                ));
7784                            }
7785                        }
7786                    };
7787
7788                    dlg.finished(true);
7789                    return Ok(response);
7790                }
7791            }
7792        }
7793    }
7794
7795    ///
7796    /// Sets the *request* property to the given value.
7797    ///
7798    /// Even though the property as already been set when instantiating this call,
7799    /// we provide this method for API completeness.
7800    pub fn request(mut self, new_value: Lien) -> LienCreateCall<'a, C> {
7801        self._request = new_value;
7802        self
7803    }
7804    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7805    /// while executing the actual API request.
7806    ///
7807    /// ````text
7808    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7809    /// ````
7810    ///
7811    /// Sets the *delegate* property to the given value.
7812    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> LienCreateCall<'a, C> {
7813        self._delegate = Some(new_value);
7814        self
7815    }
7816
7817    /// Set any additional parameter of the query string used in the request.
7818    /// It should be used to set parameters which are not yet available through their own
7819    /// setters.
7820    ///
7821    /// Please note that this method must not be used to set any of the known parameters
7822    /// which have their own setter method. If done anyway, the request will fail.
7823    ///
7824    /// # Additional Parameters
7825    ///
7826    /// * *$.xgafv* (query-string) - V1 error format.
7827    /// * *access_token* (query-string) - OAuth access token.
7828    /// * *alt* (query-string) - Data format for response.
7829    /// * *callback* (query-string) - JSONP
7830    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7831    /// * *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.
7832    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7833    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7834    /// * *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.
7835    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7836    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7837    pub fn param<T>(mut self, name: T, value: T) -> LienCreateCall<'a, C>
7838    where
7839        T: AsRef<str>,
7840    {
7841        self._additional_params
7842            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7843        self
7844    }
7845
7846    /// Identifies the authorization scope for the method you are building.
7847    ///
7848    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7849    /// [`Scope::CloudPlatformReadOnly`].
7850    ///
7851    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7852    /// tokens for more than one scope.
7853    ///
7854    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7855    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7856    /// sufficient, a read-write scope will do as well.
7857    pub fn add_scope<St>(mut self, scope: St) -> LienCreateCall<'a, C>
7858    where
7859        St: AsRef<str>,
7860    {
7861        self._scopes.insert(String::from(scope.as_ref()));
7862        self
7863    }
7864    /// Identifies the authorization scope(s) for the method you are building.
7865    ///
7866    /// See [`Self::add_scope()`] for details.
7867    pub fn add_scopes<I, St>(mut self, scopes: I) -> LienCreateCall<'a, C>
7868    where
7869        I: IntoIterator<Item = St>,
7870        St: AsRef<str>,
7871    {
7872        self._scopes
7873            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7874        self
7875    }
7876
7877    /// Removes all scopes, and no default scope will be used either.
7878    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7879    /// for details).
7880    pub fn clear_scopes(mut self) -> LienCreateCall<'a, C> {
7881        self._scopes.clear();
7882        self
7883    }
7884}
7885
7886/// Delete a Lien by `name`. Callers of this method will require permission on the `parent` resource. For example, a Lien with a `parent` of `projects/1234` requires permission `resourcemanager.projects.updateLiens`.
7887///
7888/// A builder for the *delete* method supported by a *lien* resource.
7889/// It is not used directly, but through a [`LienMethods`] instance.
7890///
7891/// # Example
7892///
7893/// Instantiate a resource method builder
7894///
7895/// ```test_harness,no_run
7896/// # extern crate hyper;
7897/// # extern crate hyper_rustls;
7898/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
7899/// # async fn dox() {
7900/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7901///
7902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7903/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7904/// #     .with_native_roots()
7905/// #     .unwrap()
7906/// #     .https_only()
7907/// #     .enable_http2()
7908/// #     .build();
7909///
7910/// # let executor = hyper_util::rt::TokioExecutor::new();
7911/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7912/// #     secret,
7913/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7914/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7915/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7916/// #     ),
7917/// # ).build().await.unwrap();
7918///
7919/// # let client = hyper_util::client::legacy::Client::builder(
7920/// #     hyper_util::rt::TokioExecutor::new()
7921/// # )
7922/// # .build(
7923/// #     hyper_rustls::HttpsConnectorBuilder::new()
7924/// #         .with_native_roots()
7925/// #         .unwrap()
7926/// #         .https_or_http()
7927/// #         .enable_http2()
7928/// #         .build()
7929/// # );
7930/// # let mut hub = CloudResourceManager::new(client, auth);
7931/// // You can configure optional parameters by calling the respective setters at will, and
7932/// // execute the final call using `doit()`.
7933/// // Values shown here are possibly random and not representative !
7934/// let result = hub.liens().delete("name")
7935///              .doit().await;
7936/// # }
7937/// ```
7938pub struct LienDeleteCall<'a, C>
7939where
7940    C: 'a,
7941{
7942    hub: &'a CloudResourceManager<C>,
7943    _name: String,
7944    _delegate: Option<&'a mut dyn common::Delegate>,
7945    _additional_params: HashMap<String, String>,
7946    _scopes: BTreeSet<String>,
7947}
7948
7949impl<'a, C> common::CallBuilder for LienDeleteCall<'a, C> {}
7950
7951impl<'a, C> LienDeleteCall<'a, C>
7952where
7953    C: common::Connector,
7954{
7955    /// Perform the operation you have build so far.
7956    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7957        use std::borrow::Cow;
7958        use std::io::{Read, Seek};
7959
7960        use common::{url::Params, ToParts};
7961        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7962
7963        let mut dd = common::DefaultDelegate;
7964        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7965        dlg.begin(common::MethodInfo {
7966            id: "cloudresourcemanager.liens.delete",
7967            http_method: hyper::Method::DELETE,
7968        });
7969
7970        for &field in ["alt", "name"].iter() {
7971            if self._additional_params.contains_key(field) {
7972                dlg.finished(false);
7973                return Err(common::Error::FieldClash(field));
7974            }
7975        }
7976
7977        let mut params = Params::with_capacity(3 + self._additional_params.len());
7978        params.push("name", self._name);
7979
7980        params.extend(self._additional_params.iter());
7981
7982        params.push("alt", "json");
7983        let mut url = self.hub._base_url.clone() + "v3/{+name}";
7984        if self._scopes.is_empty() {
7985            self._scopes
7986                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
7987        }
7988
7989        #[allow(clippy::single_element_loop)]
7990        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7991            url = params.uri_replacement(url, param_name, find_this, true);
7992        }
7993        {
7994            let to_remove = ["name"];
7995            params.remove_params(&to_remove);
7996        }
7997
7998        let url = params.parse_with_url(&url);
7999
8000        loop {
8001            let token = match self
8002                .hub
8003                .auth
8004                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8005                .await
8006            {
8007                Ok(token) => token,
8008                Err(e) => match dlg.token(e) {
8009                    Ok(token) => token,
8010                    Err(e) => {
8011                        dlg.finished(false);
8012                        return Err(common::Error::MissingToken(e));
8013                    }
8014                },
8015            };
8016            let mut req_result = {
8017                let client = &self.hub.client;
8018                dlg.pre_request();
8019                let mut req_builder = hyper::Request::builder()
8020                    .method(hyper::Method::DELETE)
8021                    .uri(url.as_str())
8022                    .header(USER_AGENT, self.hub._user_agent.clone());
8023
8024                if let Some(token) = token.as_ref() {
8025                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8026                }
8027
8028                let request = req_builder
8029                    .header(CONTENT_LENGTH, 0_u64)
8030                    .body(common::to_body::<String>(None));
8031
8032                client.request(request.unwrap()).await
8033            };
8034
8035            match req_result {
8036                Err(err) => {
8037                    if let common::Retry::After(d) = dlg.http_error(&err) {
8038                        sleep(d).await;
8039                        continue;
8040                    }
8041                    dlg.finished(false);
8042                    return Err(common::Error::HttpError(err));
8043                }
8044                Ok(res) => {
8045                    let (mut parts, body) = res.into_parts();
8046                    let mut body = common::Body::new(body);
8047                    if !parts.status.is_success() {
8048                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8049                        let error = serde_json::from_str(&common::to_string(&bytes));
8050                        let response = common::to_response(parts, bytes.into());
8051
8052                        if let common::Retry::After(d) =
8053                            dlg.http_failure(&response, error.as_ref().ok())
8054                        {
8055                            sleep(d).await;
8056                            continue;
8057                        }
8058
8059                        dlg.finished(false);
8060
8061                        return Err(match error {
8062                            Ok(value) => common::Error::BadRequest(value),
8063                            _ => common::Error::Failure(response),
8064                        });
8065                    }
8066                    let response = {
8067                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8068                        let encoded = common::to_string(&bytes);
8069                        match serde_json::from_str(&encoded) {
8070                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8071                            Err(error) => {
8072                                dlg.response_json_decode_error(&encoded, &error);
8073                                return Err(common::Error::JsonDecodeError(
8074                                    encoded.to_string(),
8075                                    error,
8076                                ));
8077                            }
8078                        }
8079                    };
8080
8081                    dlg.finished(true);
8082                    return Ok(response);
8083                }
8084            }
8085        }
8086    }
8087
8088    /// Required. The name/identifier of the Lien to delete.
8089    ///
8090    /// Sets the *name* path property to the given value.
8091    ///
8092    /// Even though the property as already been set when instantiating this call,
8093    /// we provide this method for API completeness.
8094    pub fn name(mut self, new_value: &str) -> LienDeleteCall<'a, C> {
8095        self._name = new_value.to_string();
8096        self
8097    }
8098    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8099    /// while executing the actual API request.
8100    ///
8101    /// ````text
8102    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8103    /// ````
8104    ///
8105    /// Sets the *delegate* property to the given value.
8106    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> LienDeleteCall<'a, C> {
8107        self._delegate = Some(new_value);
8108        self
8109    }
8110
8111    /// Set any additional parameter of the query string used in the request.
8112    /// It should be used to set parameters which are not yet available through their own
8113    /// setters.
8114    ///
8115    /// Please note that this method must not be used to set any of the known parameters
8116    /// which have their own setter method. If done anyway, the request will fail.
8117    ///
8118    /// # Additional Parameters
8119    ///
8120    /// * *$.xgafv* (query-string) - V1 error format.
8121    /// * *access_token* (query-string) - OAuth access token.
8122    /// * *alt* (query-string) - Data format for response.
8123    /// * *callback* (query-string) - JSONP
8124    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8125    /// * *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.
8126    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8127    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8128    /// * *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.
8129    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8130    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8131    pub fn param<T>(mut self, name: T, value: T) -> LienDeleteCall<'a, C>
8132    where
8133        T: AsRef<str>,
8134    {
8135        self._additional_params
8136            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8137        self
8138    }
8139
8140    /// Identifies the authorization scope for the method you are building.
8141    ///
8142    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8143    /// [`Scope::CloudPlatformReadOnly`].
8144    ///
8145    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8146    /// tokens for more than one scope.
8147    ///
8148    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8149    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8150    /// sufficient, a read-write scope will do as well.
8151    pub fn add_scope<St>(mut self, scope: St) -> LienDeleteCall<'a, C>
8152    where
8153        St: AsRef<str>,
8154    {
8155        self._scopes.insert(String::from(scope.as_ref()));
8156        self
8157    }
8158    /// Identifies the authorization scope(s) for the method you are building.
8159    ///
8160    /// See [`Self::add_scope()`] for details.
8161    pub fn add_scopes<I, St>(mut self, scopes: I) -> LienDeleteCall<'a, C>
8162    where
8163        I: IntoIterator<Item = St>,
8164        St: AsRef<str>,
8165    {
8166        self._scopes
8167            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8168        self
8169    }
8170
8171    /// Removes all scopes, and no default scope will be used either.
8172    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8173    /// for details).
8174    pub fn clear_scopes(mut self) -> LienDeleteCall<'a, C> {
8175        self._scopes.clear();
8176        self
8177    }
8178}
8179
8180/// Retrieve a Lien by `name`. Callers of this method will require permission on the `parent` resource. For example, a Lien with a `parent` of `projects/1234` requires permission `resourcemanager.projects.get`
8181///
8182/// A builder for the *get* method supported by a *lien* resource.
8183/// It is not used directly, but through a [`LienMethods`] instance.
8184///
8185/// # Example
8186///
8187/// Instantiate a resource method builder
8188///
8189/// ```test_harness,no_run
8190/// # extern crate hyper;
8191/// # extern crate hyper_rustls;
8192/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
8193/// # async fn dox() {
8194/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8195///
8196/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8197/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8198/// #     .with_native_roots()
8199/// #     .unwrap()
8200/// #     .https_only()
8201/// #     .enable_http2()
8202/// #     .build();
8203///
8204/// # let executor = hyper_util::rt::TokioExecutor::new();
8205/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8206/// #     secret,
8207/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8208/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8209/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8210/// #     ),
8211/// # ).build().await.unwrap();
8212///
8213/// # let client = hyper_util::client::legacy::Client::builder(
8214/// #     hyper_util::rt::TokioExecutor::new()
8215/// # )
8216/// # .build(
8217/// #     hyper_rustls::HttpsConnectorBuilder::new()
8218/// #         .with_native_roots()
8219/// #         .unwrap()
8220/// #         .https_or_http()
8221/// #         .enable_http2()
8222/// #         .build()
8223/// # );
8224/// # let mut hub = CloudResourceManager::new(client, auth);
8225/// // You can configure optional parameters by calling the respective setters at will, and
8226/// // execute the final call using `doit()`.
8227/// // Values shown here are possibly random and not representative !
8228/// let result = hub.liens().get("name")
8229///              .doit().await;
8230/// # }
8231/// ```
8232pub struct LienGetCall<'a, C>
8233where
8234    C: 'a,
8235{
8236    hub: &'a CloudResourceManager<C>,
8237    _name: String,
8238    _delegate: Option<&'a mut dyn common::Delegate>,
8239    _additional_params: HashMap<String, String>,
8240    _scopes: BTreeSet<String>,
8241}
8242
8243impl<'a, C> common::CallBuilder for LienGetCall<'a, C> {}
8244
8245impl<'a, C> LienGetCall<'a, C>
8246where
8247    C: common::Connector,
8248{
8249    /// Perform the operation you have build so far.
8250    pub async fn doit(mut self) -> common::Result<(common::Response, Lien)> {
8251        use std::borrow::Cow;
8252        use std::io::{Read, Seek};
8253
8254        use common::{url::Params, ToParts};
8255        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8256
8257        let mut dd = common::DefaultDelegate;
8258        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8259        dlg.begin(common::MethodInfo {
8260            id: "cloudresourcemanager.liens.get",
8261            http_method: hyper::Method::GET,
8262        });
8263
8264        for &field in ["alt", "name"].iter() {
8265            if self._additional_params.contains_key(field) {
8266                dlg.finished(false);
8267                return Err(common::Error::FieldClash(field));
8268            }
8269        }
8270
8271        let mut params = Params::with_capacity(3 + self._additional_params.len());
8272        params.push("name", self._name);
8273
8274        params.extend(self._additional_params.iter());
8275
8276        params.push("alt", "json");
8277        let mut url = self.hub._base_url.clone() + "v3/{+name}";
8278        if self._scopes.is_empty() {
8279            self._scopes
8280                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8281        }
8282
8283        #[allow(clippy::single_element_loop)]
8284        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8285            url = params.uri_replacement(url, param_name, find_this, true);
8286        }
8287        {
8288            let to_remove = ["name"];
8289            params.remove_params(&to_remove);
8290        }
8291
8292        let url = params.parse_with_url(&url);
8293
8294        loop {
8295            let token = match self
8296                .hub
8297                .auth
8298                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8299                .await
8300            {
8301                Ok(token) => token,
8302                Err(e) => match dlg.token(e) {
8303                    Ok(token) => token,
8304                    Err(e) => {
8305                        dlg.finished(false);
8306                        return Err(common::Error::MissingToken(e));
8307                    }
8308                },
8309            };
8310            let mut req_result = {
8311                let client = &self.hub.client;
8312                dlg.pre_request();
8313                let mut req_builder = hyper::Request::builder()
8314                    .method(hyper::Method::GET)
8315                    .uri(url.as_str())
8316                    .header(USER_AGENT, self.hub._user_agent.clone());
8317
8318                if let Some(token) = token.as_ref() {
8319                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8320                }
8321
8322                let request = req_builder
8323                    .header(CONTENT_LENGTH, 0_u64)
8324                    .body(common::to_body::<String>(None));
8325
8326                client.request(request.unwrap()).await
8327            };
8328
8329            match req_result {
8330                Err(err) => {
8331                    if let common::Retry::After(d) = dlg.http_error(&err) {
8332                        sleep(d).await;
8333                        continue;
8334                    }
8335                    dlg.finished(false);
8336                    return Err(common::Error::HttpError(err));
8337                }
8338                Ok(res) => {
8339                    let (mut parts, body) = res.into_parts();
8340                    let mut body = common::Body::new(body);
8341                    if !parts.status.is_success() {
8342                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8343                        let error = serde_json::from_str(&common::to_string(&bytes));
8344                        let response = common::to_response(parts, bytes.into());
8345
8346                        if let common::Retry::After(d) =
8347                            dlg.http_failure(&response, error.as_ref().ok())
8348                        {
8349                            sleep(d).await;
8350                            continue;
8351                        }
8352
8353                        dlg.finished(false);
8354
8355                        return Err(match error {
8356                            Ok(value) => common::Error::BadRequest(value),
8357                            _ => common::Error::Failure(response),
8358                        });
8359                    }
8360                    let response = {
8361                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8362                        let encoded = common::to_string(&bytes);
8363                        match serde_json::from_str(&encoded) {
8364                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8365                            Err(error) => {
8366                                dlg.response_json_decode_error(&encoded, &error);
8367                                return Err(common::Error::JsonDecodeError(
8368                                    encoded.to_string(),
8369                                    error,
8370                                ));
8371                            }
8372                        }
8373                    };
8374
8375                    dlg.finished(true);
8376                    return Ok(response);
8377                }
8378            }
8379        }
8380    }
8381
8382    /// Required. The name/identifier of the Lien.
8383    ///
8384    /// Sets the *name* path property to the given value.
8385    ///
8386    /// Even though the property as already been set when instantiating this call,
8387    /// we provide this method for API completeness.
8388    pub fn name(mut self, new_value: &str) -> LienGetCall<'a, C> {
8389        self._name = new_value.to_string();
8390        self
8391    }
8392    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8393    /// while executing the actual API request.
8394    ///
8395    /// ````text
8396    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8397    /// ````
8398    ///
8399    /// Sets the *delegate* property to the given value.
8400    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> LienGetCall<'a, C> {
8401        self._delegate = Some(new_value);
8402        self
8403    }
8404
8405    /// Set any additional parameter of the query string used in the request.
8406    /// It should be used to set parameters which are not yet available through their own
8407    /// setters.
8408    ///
8409    /// Please note that this method must not be used to set any of the known parameters
8410    /// which have their own setter method. If done anyway, the request will fail.
8411    ///
8412    /// # Additional Parameters
8413    ///
8414    /// * *$.xgafv* (query-string) - V1 error format.
8415    /// * *access_token* (query-string) - OAuth access token.
8416    /// * *alt* (query-string) - Data format for response.
8417    /// * *callback* (query-string) - JSONP
8418    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8419    /// * *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.
8420    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8421    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8422    /// * *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.
8423    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8424    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8425    pub fn param<T>(mut self, name: T, value: T) -> LienGetCall<'a, C>
8426    where
8427        T: AsRef<str>,
8428    {
8429        self._additional_params
8430            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8431        self
8432    }
8433
8434    /// Identifies the authorization scope for the method you are building.
8435    ///
8436    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8437    /// [`Scope::CloudPlatformReadOnly`].
8438    ///
8439    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8440    /// tokens for more than one scope.
8441    ///
8442    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8443    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8444    /// sufficient, a read-write scope will do as well.
8445    pub fn add_scope<St>(mut self, scope: St) -> LienGetCall<'a, C>
8446    where
8447        St: AsRef<str>,
8448    {
8449        self._scopes.insert(String::from(scope.as_ref()));
8450        self
8451    }
8452    /// Identifies the authorization scope(s) for the method you are building.
8453    ///
8454    /// See [`Self::add_scope()`] for details.
8455    pub fn add_scopes<I, St>(mut self, scopes: I) -> LienGetCall<'a, C>
8456    where
8457        I: IntoIterator<Item = St>,
8458        St: AsRef<str>,
8459    {
8460        self._scopes
8461            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8462        self
8463    }
8464
8465    /// Removes all scopes, and no default scope will be used either.
8466    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8467    /// for details).
8468    pub fn clear_scopes(mut self) -> LienGetCall<'a, C> {
8469        self._scopes.clear();
8470        self
8471    }
8472}
8473
8474/// List all Liens applied to the `parent` resource. Callers of this method will require permission on the `parent` resource. For example, a Lien with a `parent` of `projects/1234` requires permission `resourcemanager.projects.get`.
8475///
8476/// A builder for the *list* method supported by a *lien* resource.
8477/// It is not used directly, but through a [`LienMethods`] instance.
8478///
8479/// # Example
8480///
8481/// Instantiate a resource method builder
8482///
8483/// ```test_harness,no_run
8484/// # extern crate hyper;
8485/// # extern crate hyper_rustls;
8486/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
8487/// # async fn dox() {
8488/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8489///
8490/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8491/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8492/// #     .with_native_roots()
8493/// #     .unwrap()
8494/// #     .https_only()
8495/// #     .enable_http2()
8496/// #     .build();
8497///
8498/// # let executor = hyper_util::rt::TokioExecutor::new();
8499/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8500/// #     secret,
8501/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8502/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8503/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8504/// #     ),
8505/// # ).build().await.unwrap();
8506///
8507/// # let client = hyper_util::client::legacy::Client::builder(
8508/// #     hyper_util::rt::TokioExecutor::new()
8509/// # )
8510/// # .build(
8511/// #     hyper_rustls::HttpsConnectorBuilder::new()
8512/// #         .with_native_roots()
8513/// #         .unwrap()
8514/// #         .https_or_http()
8515/// #         .enable_http2()
8516/// #         .build()
8517/// # );
8518/// # let mut hub = CloudResourceManager::new(client, auth);
8519/// // You can configure optional parameters by calling the respective setters at will, and
8520/// // execute the final call using `doit()`.
8521/// // Values shown here are possibly random and not representative !
8522/// let result = hub.liens().list()
8523///              .parent("ea")
8524///              .page_token("dolor")
8525///              .page_size(-56)
8526///              .doit().await;
8527/// # }
8528/// ```
8529pub struct LienListCall<'a, C>
8530where
8531    C: 'a,
8532{
8533    hub: &'a CloudResourceManager<C>,
8534    _parent: Option<String>,
8535    _page_token: Option<String>,
8536    _page_size: Option<i32>,
8537    _delegate: Option<&'a mut dyn common::Delegate>,
8538    _additional_params: HashMap<String, String>,
8539    _scopes: BTreeSet<String>,
8540}
8541
8542impl<'a, C> common::CallBuilder for LienListCall<'a, C> {}
8543
8544impl<'a, C> LienListCall<'a, C>
8545where
8546    C: common::Connector,
8547{
8548    /// Perform the operation you have build so far.
8549    pub async fn doit(mut self) -> common::Result<(common::Response, ListLiensResponse)> {
8550        use std::borrow::Cow;
8551        use std::io::{Read, Seek};
8552
8553        use common::{url::Params, ToParts};
8554        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8555
8556        let mut dd = common::DefaultDelegate;
8557        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8558        dlg.begin(common::MethodInfo {
8559            id: "cloudresourcemanager.liens.list",
8560            http_method: hyper::Method::GET,
8561        });
8562
8563        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8564            if self._additional_params.contains_key(field) {
8565                dlg.finished(false);
8566                return Err(common::Error::FieldClash(field));
8567            }
8568        }
8569
8570        let mut params = Params::with_capacity(5 + self._additional_params.len());
8571        if let Some(value) = self._parent.as_ref() {
8572            params.push("parent", value);
8573        }
8574        if let Some(value) = self._page_token.as_ref() {
8575            params.push("pageToken", value);
8576        }
8577        if let Some(value) = self._page_size.as_ref() {
8578            params.push("pageSize", value.to_string());
8579        }
8580
8581        params.extend(self._additional_params.iter());
8582
8583        params.push("alt", "json");
8584        let mut url = self.hub._base_url.clone() + "v3/liens";
8585        if self._scopes.is_empty() {
8586            self._scopes
8587                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8588        }
8589
8590        let url = params.parse_with_url(&url);
8591
8592        loop {
8593            let token = match self
8594                .hub
8595                .auth
8596                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8597                .await
8598            {
8599                Ok(token) => token,
8600                Err(e) => match dlg.token(e) {
8601                    Ok(token) => token,
8602                    Err(e) => {
8603                        dlg.finished(false);
8604                        return Err(common::Error::MissingToken(e));
8605                    }
8606                },
8607            };
8608            let mut req_result = {
8609                let client = &self.hub.client;
8610                dlg.pre_request();
8611                let mut req_builder = hyper::Request::builder()
8612                    .method(hyper::Method::GET)
8613                    .uri(url.as_str())
8614                    .header(USER_AGENT, self.hub._user_agent.clone());
8615
8616                if let Some(token) = token.as_ref() {
8617                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8618                }
8619
8620                let request = req_builder
8621                    .header(CONTENT_LENGTH, 0_u64)
8622                    .body(common::to_body::<String>(None));
8623
8624                client.request(request.unwrap()).await
8625            };
8626
8627            match req_result {
8628                Err(err) => {
8629                    if let common::Retry::After(d) = dlg.http_error(&err) {
8630                        sleep(d).await;
8631                        continue;
8632                    }
8633                    dlg.finished(false);
8634                    return Err(common::Error::HttpError(err));
8635                }
8636                Ok(res) => {
8637                    let (mut parts, body) = res.into_parts();
8638                    let mut body = common::Body::new(body);
8639                    if !parts.status.is_success() {
8640                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8641                        let error = serde_json::from_str(&common::to_string(&bytes));
8642                        let response = common::to_response(parts, bytes.into());
8643
8644                        if let common::Retry::After(d) =
8645                            dlg.http_failure(&response, error.as_ref().ok())
8646                        {
8647                            sleep(d).await;
8648                            continue;
8649                        }
8650
8651                        dlg.finished(false);
8652
8653                        return Err(match error {
8654                            Ok(value) => common::Error::BadRequest(value),
8655                            _ => common::Error::Failure(response),
8656                        });
8657                    }
8658                    let response = {
8659                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8660                        let encoded = common::to_string(&bytes);
8661                        match serde_json::from_str(&encoded) {
8662                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8663                            Err(error) => {
8664                                dlg.response_json_decode_error(&encoded, &error);
8665                                return Err(common::Error::JsonDecodeError(
8666                                    encoded.to_string(),
8667                                    error,
8668                                ));
8669                            }
8670                        }
8671                    };
8672
8673                    dlg.finished(true);
8674                    return Ok(response);
8675                }
8676            }
8677        }
8678    }
8679
8680    /// Required. The name of the resource to list all attached Liens. For example, `projects/1234`. (google.api.field_policy).resource_type annotation is not set since the parent depends on the meta api implementation. This field could be a project or other sub project resources.
8681    ///
8682    /// Sets the *parent* query property to the given value.
8683    pub fn parent(mut self, new_value: &str) -> LienListCall<'a, C> {
8684        self._parent = Some(new_value.to_string());
8685        self
8686    }
8687    /// The `next_page_token` value returned from a previous List request, if any.
8688    ///
8689    /// Sets the *page token* query property to the given value.
8690    pub fn page_token(mut self, new_value: &str) -> LienListCall<'a, C> {
8691        self._page_token = Some(new_value.to_string());
8692        self
8693    }
8694    /// The maximum number of items to return. This is a suggestion for the server. The server can return fewer liens than requested. If unspecified, server picks an appropriate default.
8695    ///
8696    /// Sets the *page size* query property to the given value.
8697    pub fn page_size(mut self, new_value: i32) -> LienListCall<'a, C> {
8698        self._page_size = Some(new_value);
8699        self
8700    }
8701    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8702    /// while executing the actual API request.
8703    ///
8704    /// ````text
8705    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8706    /// ````
8707    ///
8708    /// Sets the *delegate* property to the given value.
8709    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> LienListCall<'a, C> {
8710        self._delegate = Some(new_value);
8711        self
8712    }
8713
8714    /// Set any additional parameter of the query string used in the request.
8715    /// It should be used to set parameters which are not yet available through their own
8716    /// setters.
8717    ///
8718    /// Please note that this method must not be used to set any of the known parameters
8719    /// which have their own setter method. If done anyway, the request will fail.
8720    ///
8721    /// # Additional Parameters
8722    ///
8723    /// * *$.xgafv* (query-string) - V1 error format.
8724    /// * *access_token* (query-string) - OAuth access token.
8725    /// * *alt* (query-string) - Data format for response.
8726    /// * *callback* (query-string) - JSONP
8727    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8728    /// * *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.
8729    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8730    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8731    /// * *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.
8732    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8733    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8734    pub fn param<T>(mut self, name: T, value: T) -> LienListCall<'a, C>
8735    where
8736        T: AsRef<str>,
8737    {
8738        self._additional_params
8739            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8740        self
8741    }
8742
8743    /// Identifies the authorization scope for the method you are building.
8744    ///
8745    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8746    /// [`Scope::CloudPlatformReadOnly`].
8747    ///
8748    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8749    /// tokens for more than one scope.
8750    ///
8751    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8752    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8753    /// sufficient, a read-write scope will do as well.
8754    pub fn add_scope<St>(mut self, scope: St) -> LienListCall<'a, C>
8755    where
8756        St: AsRef<str>,
8757    {
8758        self._scopes.insert(String::from(scope.as_ref()));
8759        self
8760    }
8761    /// Identifies the authorization scope(s) for the method you are building.
8762    ///
8763    /// See [`Self::add_scope()`] for details.
8764    pub fn add_scopes<I, St>(mut self, scopes: I) -> LienListCall<'a, C>
8765    where
8766        I: IntoIterator<Item = St>,
8767        St: AsRef<str>,
8768    {
8769        self._scopes
8770            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8771        self
8772    }
8773
8774    /// Removes all scopes, and no default scope will be used either.
8775    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8776    /// for details).
8777    pub fn clear_scopes(mut self) -> LienListCall<'a, C> {
8778        self._scopes.clear();
8779        self
8780    }
8781}
8782
8783/// Returns effective tag bindings on a GCP resource.
8784///
8785/// A builder for the *effectiveTagBindingCollections.get* method supported by a *location* resource.
8786/// It is not used directly, but through a [`LocationMethods`] instance.
8787///
8788/// # Example
8789///
8790/// Instantiate a resource method builder
8791///
8792/// ```test_harness,no_run
8793/// # extern crate hyper;
8794/// # extern crate hyper_rustls;
8795/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
8796/// # async fn dox() {
8797/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8798///
8799/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8800/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8801/// #     .with_native_roots()
8802/// #     .unwrap()
8803/// #     .https_only()
8804/// #     .enable_http2()
8805/// #     .build();
8806///
8807/// # let executor = hyper_util::rt::TokioExecutor::new();
8808/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8809/// #     secret,
8810/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8811/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8812/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8813/// #     ),
8814/// # ).build().await.unwrap();
8815///
8816/// # let client = hyper_util::client::legacy::Client::builder(
8817/// #     hyper_util::rt::TokioExecutor::new()
8818/// # )
8819/// # .build(
8820/// #     hyper_rustls::HttpsConnectorBuilder::new()
8821/// #         .with_native_roots()
8822/// #         .unwrap()
8823/// #         .https_or_http()
8824/// #         .enable_http2()
8825/// #         .build()
8826/// # );
8827/// # let mut hub = CloudResourceManager::new(client, auth);
8828/// // You can configure optional parameters by calling the respective setters at will, and
8829/// // execute the final call using `doit()`.
8830/// // Values shown here are possibly random and not representative !
8831/// let result = hub.locations().effective_tag_binding_collections_get("name")
8832///              .doit().await;
8833/// # }
8834/// ```
8835pub struct LocationEffectiveTagBindingCollectionGetCall<'a, C>
8836where
8837    C: 'a,
8838{
8839    hub: &'a CloudResourceManager<C>,
8840    _name: String,
8841    _delegate: Option<&'a mut dyn common::Delegate>,
8842    _additional_params: HashMap<String, String>,
8843    _scopes: BTreeSet<String>,
8844}
8845
8846impl<'a, C> common::CallBuilder for LocationEffectiveTagBindingCollectionGetCall<'a, C> {}
8847
8848impl<'a, C> LocationEffectiveTagBindingCollectionGetCall<'a, C>
8849where
8850    C: common::Connector,
8851{
8852    /// Perform the operation you have build so far.
8853    pub async fn doit(
8854        mut self,
8855    ) -> common::Result<(common::Response, EffectiveTagBindingCollection)> {
8856        use std::borrow::Cow;
8857        use std::io::{Read, Seek};
8858
8859        use common::{url::Params, ToParts};
8860        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8861
8862        let mut dd = common::DefaultDelegate;
8863        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8864        dlg.begin(common::MethodInfo {
8865            id: "cloudresourcemanager.locations.effectiveTagBindingCollections.get",
8866            http_method: hyper::Method::GET,
8867        });
8868
8869        for &field in ["alt", "name"].iter() {
8870            if self._additional_params.contains_key(field) {
8871                dlg.finished(false);
8872                return Err(common::Error::FieldClash(field));
8873            }
8874        }
8875
8876        let mut params = Params::with_capacity(3 + self._additional_params.len());
8877        params.push("name", self._name);
8878
8879        params.extend(self._additional_params.iter());
8880
8881        params.push("alt", "json");
8882        let mut url = self.hub._base_url.clone() + "v3/{+name}";
8883        if self._scopes.is_empty() {
8884            self._scopes
8885                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
8886        }
8887
8888        #[allow(clippy::single_element_loop)]
8889        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8890            url = params.uri_replacement(url, param_name, find_this, true);
8891        }
8892        {
8893            let to_remove = ["name"];
8894            params.remove_params(&to_remove);
8895        }
8896
8897        let url = params.parse_with_url(&url);
8898
8899        loop {
8900            let token = match self
8901                .hub
8902                .auth
8903                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8904                .await
8905            {
8906                Ok(token) => token,
8907                Err(e) => match dlg.token(e) {
8908                    Ok(token) => token,
8909                    Err(e) => {
8910                        dlg.finished(false);
8911                        return Err(common::Error::MissingToken(e));
8912                    }
8913                },
8914            };
8915            let mut req_result = {
8916                let client = &self.hub.client;
8917                dlg.pre_request();
8918                let mut req_builder = hyper::Request::builder()
8919                    .method(hyper::Method::GET)
8920                    .uri(url.as_str())
8921                    .header(USER_AGENT, self.hub._user_agent.clone());
8922
8923                if let Some(token) = token.as_ref() {
8924                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8925                }
8926
8927                let request = req_builder
8928                    .header(CONTENT_LENGTH, 0_u64)
8929                    .body(common::to_body::<String>(None));
8930
8931                client.request(request.unwrap()).await
8932            };
8933
8934            match req_result {
8935                Err(err) => {
8936                    if let common::Retry::After(d) = dlg.http_error(&err) {
8937                        sleep(d).await;
8938                        continue;
8939                    }
8940                    dlg.finished(false);
8941                    return Err(common::Error::HttpError(err));
8942                }
8943                Ok(res) => {
8944                    let (mut parts, body) = res.into_parts();
8945                    let mut body = common::Body::new(body);
8946                    if !parts.status.is_success() {
8947                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8948                        let error = serde_json::from_str(&common::to_string(&bytes));
8949                        let response = common::to_response(parts, bytes.into());
8950
8951                        if let common::Retry::After(d) =
8952                            dlg.http_failure(&response, error.as_ref().ok())
8953                        {
8954                            sleep(d).await;
8955                            continue;
8956                        }
8957
8958                        dlg.finished(false);
8959
8960                        return Err(match error {
8961                            Ok(value) => common::Error::BadRequest(value),
8962                            _ => common::Error::Failure(response),
8963                        });
8964                    }
8965                    let response = {
8966                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8967                        let encoded = common::to_string(&bytes);
8968                        match serde_json::from_str(&encoded) {
8969                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8970                            Err(error) => {
8971                                dlg.response_json_decode_error(&encoded, &error);
8972                                return Err(common::Error::JsonDecodeError(
8973                                    encoded.to_string(),
8974                                    error,
8975                                ));
8976                            }
8977                        }
8978                    };
8979
8980                    dlg.finished(true);
8981                    return Ok(response);
8982                }
8983            }
8984        }
8985    }
8986
8987    /// Required. The full name of the EffectiveTagBindingCollection in format: `locations/{location}/effectiveTagBindingCollections/{encoded-full-resource-name}` where the encoded-full-resource-name is the UTF-8 encoded name of the resource the TagBindings are bound to. E.g. "locations/global/effectiveTagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
8988    ///
8989    /// Sets the *name* path property to the given value.
8990    ///
8991    /// Even though the property as already been set when instantiating this call,
8992    /// we provide this method for API completeness.
8993    pub fn name(mut self, new_value: &str) -> LocationEffectiveTagBindingCollectionGetCall<'a, C> {
8994        self._name = new_value.to_string();
8995        self
8996    }
8997    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8998    /// while executing the actual API request.
8999    ///
9000    /// ````text
9001    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9002    /// ````
9003    ///
9004    /// Sets the *delegate* property to the given value.
9005    pub fn delegate(
9006        mut self,
9007        new_value: &'a mut dyn common::Delegate,
9008    ) -> LocationEffectiveTagBindingCollectionGetCall<'a, C> {
9009        self._delegate = Some(new_value);
9010        self
9011    }
9012
9013    /// Set any additional parameter of the query string used in the request.
9014    /// It should be used to set parameters which are not yet available through their own
9015    /// setters.
9016    ///
9017    /// Please note that this method must not be used to set any of the known parameters
9018    /// which have their own setter method. If done anyway, the request will fail.
9019    ///
9020    /// # Additional Parameters
9021    ///
9022    /// * *$.xgafv* (query-string) - V1 error format.
9023    /// * *access_token* (query-string) - OAuth access token.
9024    /// * *alt* (query-string) - Data format for response.
9025    /// * *callback* (query-string) - JSONP
9026    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9027    /// * *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.
9028    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9029    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9030    /// * *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.
9031    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9032    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9033    pub fn param<T>(
9034        mut self,
9035        name: T,
9036        value: T,
9037    ) -> LocationEffectiveTagBindingCollectionGetCall<'a, C>
9038    where
9039        T: AsRef<str>,
9040    {
9041        self._additional_params
9042            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9043        self
9044    }
9045
9046    /// Identifies the authorization scope for the method you are building.
9047    ///
9048    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9049    /// [`Scope::CloudPlatformReadOnly`].
9050    ///
9051    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9052    /// tokens for more than one scope.
9053    ///
9054    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9055    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9056    /// sufficient, a read-write scope will do as well.
9057    pub fn add_scope<St>(mut self, scope: St) -> LocationEffectiveTagBindingCollectionGetCall<'a, C>
9058    where
9059        St: AsRef<str>,
9060    {
9061        self._scopes.insert(String::from(scope.as_ref()));
9062        self
9063    }
9064    /// Identifies the authorization scope(s) for the method you are building.
9065    ///
9066    /// See [`Self::add_scope()`] for details.
9067    pub fn add_scopes<I, St>(
9068        mut self,
9069        scopes: I,
9070    ) -> LocationEffectiveTagBindingCollectionGetCall<'a, C>
9071    where
9072        I: IntoIterator<Item = St>,
9073        St: AsRef<str>,
9074    {
9075        self._scopes
9076            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9077        self
9078    }
9079
9080    /// Removes all scopes, and no default scope will be used either.
9081    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9082    /// for details).
9083    pub fn clear_scopes(mut self) -> LocationEffectiveTagBindingCollectionGetCall<'a, C> {
9084        self._scopes.clear();
9085        self
9086    }
9087}
9088
9089/// Returns tag bindings directly attached to a GCP resource.
9090///
9091/// A builder for the *tagBindingCollections.get* method supported by a *location* resource.
9092/// It is not used directly, but through a [`LocationMethods`] instance.
9093///
9094/// # Example
9095///
9096/// Instantiate a resource method builder
9097///
9098/// ```test_harness,no_run
9099/// # extern crate hyper;
9100/// # extern crate hyper_rustls;
9101/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
9102/// # async fn dox() {
9103/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9104///
9105/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9106/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9107/// #     .with_native_roots()
9108/// #     .unwrap()
9109/// #     .https_only()
9110/// #     .enable_http2()
9111/// #     .build();
9112///
9113/// # let executor = hyper_util::rt::TokioExecutor::new();
9114/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9115/// #     secret,
9116/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9117/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9118/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9119/// #     ),
9120/// # ).build().await.unwrap();
9121///
9122/// # let client = hyper_util::client::legacy::Client::builder(
9123/// #     hyper_util::rt::TokioExecutor::new()
9124/// # )
9125/// # .build(
9126/// #     hyper_rustls::HttpsConnectorBuilder::new()
9127/// #         .with_native_roots()
9128/// #         .unwrap()
9129/// #         .https_or_http()
9130/// #         .enable_http2()
9131/// #         .build()
9132/// # );
9133/// # let mut hub = CloudResourceManager::new(client, auth);
9134/// // You can configure optional parameters by calling the respective setters at will, and
9135/// // execute the final call using `doit()`.
9136/// // Values shown here are possibly random and not representative !
9137/// let result = hub.locations().tag_binding_collections_get("name")
9138///              .doit().await;
9139/// # }
9140/// ```
9141pub struct LocationTagBindingCollectionGetCall<'a, C>
9142where
9143    C: 'a,
9144{
9145    hub: &'a CloudResourceManager<C>,
9146    _name: String,
9147    _delegate: Option<&'a mut dyn common::Delegate>,
9148    _additional_params: HashMap<String, String>,
9149    _scopes: BTreeSet<String>,
9150}
9151
9152impl<'a, C> common::CallBuilder for LocationTagBindingCollectionGetCall<'a, C> {}
9153
9154impl<'a, C> LocationTagBindingCollectionGetCall<'a, C>
9155where
9156    C: common::Connector,
9157{
9158    /// Perform the operation you have build so far.
9159    pub async fn doit(mut self) -> common::Result<(common::Response, TagBindingCollection)> {
9160        use std::borrow::Cow;
9161        use std::io::{Read, Seek};
9162
9163        use common::{url::Params, ToParts};
9164        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9165
9166        let mut dd = common::DefaultDelegate;
9167        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9168        dlg.begin(common::MethodInfo {
9169            id: "cloudresourcemanager.locations.tagBindingCollections.get",
9170            http_method: hyper::Method::GET,
9171        });
9172
9173        for &field in ["alt", "name"].iter() {
9174            if self._additional_params.contains_key(field) {
9175                dlg.finished(false);
9176                return Err(common::Error::FieldClash(field));
9177            }
9178        }
9179
9180        let mut params = Params::with_capacity(3 + self._additional_params.len());
9181        params.push("name", self._name);
9182
9183        params.extend(self._additional_params.iter());
9184
9185        params.push("alt", "json");
9186        let mut url = self.hub._base_url.clone() + "v3/{+name}";
9187        if self._scopes.is_empty() {
9188            self._scopes
9189                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9190        }
9191
9192        #[allow(clippy::single_element_loop)]
9193        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9194            url = params.uri_replacement(url, param_name, find_this, true);
9195        }
9196        {
9197            let to_remove = ["name"];
9198            params.remove_params(&to_remove);
9199        }
9200
9201        let url = params.parse_with_url(&url);
9202
9203        loop {
9204            let token = match self
9205                .hub
9206                .auth
9207                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9208                .await
9209            {
9210                Ok(token) => token,
9211                Err(e) => match dlg.token(e) {
9212                    Ok(token) => token,
9213                    Err(e) => {
9214                        dlg.finished(false);
9215                        return Err(common::Error::MissingToken(e));
9216                    }
9217                },
9218            };
9219            let mut req_result = {
9220                let client = &self.hub.client;
9221                dlg.pre_request();
9222                let mut req_builder = hyper::Request::builder()
9223                    .method(hyper::Method::GET)
9224                    .uri(url.as_str())
9225                    .header(USER_AGENT, self.hub._user_agent.clone());
9226
9227                if let Some(token) = token.as_ref() {
9228                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9229                }
9230
9231                let request = req_builder
9232                    .header(CONTENT_LENGTH, 0_u64)
9233                    .body(common::to_body::<String>(None));
9234
9235                client.request(request.unwrap()).await
9236            };
9237
9238            match req_result {
9239                Err(err) => {
9240                    if let common::Retry::After(d) = dlg.http_error(&err) {
9241                        sleep(d).await;
9242                        continue;
9243                    }
9244                    dlg.finished(false);
9245                    return Err(common::Error::HttpError(err));
9246                }
9247                Ok(res) => {
9248                    let (mut parts, body) = res.into_parts();
9249                    let mut body = common::Body::new(body);
9250                    if !parts.status.is_success() {
9251                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9252                        let error = serde_json::from_str(&common::to_string(&bytes));
9253                        let response = common::to_response(parts, bytes.into());
9254
9255                        if let common::Retry::After(d) =
9256                            dlg.http_failure(&response, error.as_ref().ok())
9257                        {
9258                            sleep(d).await;
9259                            continue;
9260                        }
9261
9262                        dlg.finished(false);
9263
9264                        return Err(match error {
9265                            Ok(value) => common::Error::BadRequest(value),
9266                            _ => common::Error::Failure(response),
9267                        });
9268                    }
9269                    let response = {
9270                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9271                        let encoded = common::to_string(&bytes);
9272                        match serde_json::from_str(&encoded) {
9273                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9274                            Err(error) => {
9275                                dlg.response_json_decode_error(&encoded, &error);
9276                                return Err(common::Error::JsonDecodeError(
9277                                    encoded.to_string(),
9278                                    error,
9279                                ));
9280                            }
9281                        }
9282                    };
9283
9284                    dlg.finished(true);
9285                    return Ok(response);
9286                }
9287            }
9288        }
9289    }
9290
9291    /// Required. The full name of the TagBindingCollection in format: `locations/{location}/tagBindingCollections/{encoded-full-resource-name}` where the enoded-full-resource-name is the UTF-8 encoded name of the resource the TagBindings are bound to. E.g. "locations/global/tagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
9292    ///
9293    /// Sets the *name* path property to the given value.
9294    ///
9295    /// Even though the property as already been set when instantiating this call,
9296    /// we provide this method for API completeness.
9297    pub fn name(mut self, new_value: &str) -> LocationTagBindingCollectionGetCall<'a, C> {
9298        self._name = new_value.to_string();
9299        self
9300    }
9301    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9302    /// while executing the actual API request.
9303    ///
9304    /// ````text
9305    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9306    /// ````
9307    ///
9308    /// Sets the *delegate* property to the given value.
9309    pub fn delegate(
9310        mut self,
9311        new_value: &'a mut dyn common::Delegate,
9312    ) -> LocationTagBindingCollectionGetCall<'a, C> {
9313        self._delegate = Some(new_value);
9314        self
9315    }
9316
9317    /// Set any additional parameter of the query string used in the request.
9318    /// It should be used to set parameters which are not yet available through their own
9319    /// setters.
9320    ///
9321    /// Please note that this method must not be used to set any of the known parameters
9322    /// which have their own setter method. If done anyway, the request will fail.
9323    ///
9324    /// # Additional Parameters
9325    ///
9326    /// * *$.xgafv* (query-string) - V1 error format.
9327    /// * *access_token* (query-string) - OAuth access token.
9328    /// * *alt* (query-string) - Data format for response.
9329    /// * *callback* (query-string) - JSONP
9330    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9331    /// * *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.
9332    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9333    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9334    /// * *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.
9335    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9336    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9337    pub fn param<T>(mut self, name: T, value: T) -> LocationTagBindingCollectionGetCall<'a, C>
9338    where
9339        T: AsRef<str>,
9340    {
9341        self._additional_params
9342            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9343        self
9344    }
9345
9346    /// Identifies the authorization scope for the method you are building.
9347    ///
9348    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9349    /// [`Scope::CloudPlatformReadOnly`].
9350    ///
9351    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9352    /// tokens for more than one scope.
9353    ///
9354    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9355    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9356    /// sufficient, a read-write scope will do as well.
9357    pub fn add_scope<St>(mut self, scope: St) -> LocationTagBindingCollectionGetCall<'a, C>
9358    where
9359        St: AsRef<str>,
9360    {
9361        self._scopes.insert(String::from(scope.as_ref()));
9362        self
9363    }
9364    /// Identifies the authorization scope(s) for the method you are building.
9365    ///
9366    /// See [`Self::add_scope()`] for details.
9367    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationTagBindingCollectionGetCall<'a, C>
9368    where
9369        I: IntoIterator<Item = St>,
9370        St: AsRef<str>,
9371    {
9372        self._scopes
9373            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9374        self
9375    }
9376
9377    /// Removes all scopes, and no default scope will be used either.
9378    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9379    /// for details).
9380    pub fn clear_scopes(mut self) -> LocationTagBindingCollectionGetCall<'a, C> {
9381        self._scopes.clear();
9382        self
9383    }
9384}
9385
9386/// Updates tag bindings directly attached to a GCP resource. Update_mask can be kept empty or "*".
9387///
9388/// A builder for the *tagBindingCollections.patch* method supported by a *location* resource.
9389/// It is not used directly, but through a [`LocationMethods`] instance.
9390///
9391/// # Example
9392///
9393/// Instantiate a resource method builder
9394///
9395/// ```test_harness,no_run
9396/// # extern crate hyper;
9397/// # extern crate hyper_rustls;
9398/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
9399/// use cloudresourcemanager3::api::TagBindingCollection;
9400/// # async fn dox() {
9401/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9402///
9403/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9404/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9405/// #     .with_native_roots()
9406/// #     .unwrap()
9407/// #     .https_only()
9408/// #     .enable_http2()
9409/// #     .build();
9410///
9411/// # let executor = hyper_util::rt::TokioExecutor::new();
9412/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9413/// #     secret,
9414/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9415/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9416/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9417/// #     ),
9418/// # ).build().await.unwrap();
9419///
9420/// # let client = hyper_util::client::legacy::Client::builder(
9421/// #     hyper_util::rt::TokioExecutor::new()
9422/// # )
9423/// # .build(
9424/// #     hyper_rustls::HttpsConnectorBuilder::new()
9425/// #         .with_native_roots()
9426/// #         .unwrap()
9427/// #         .https_or_http()
9428/// #         .enable_http2()
9429/// #         .build()
9430/// # );
9431/// # let mut hub = CloudResourceManager::new(client, auth);
9432/// // As the method needs a request, you would usually fill it with the desired information
9433/// // into the respective structure. Some of the parts shown here might not be applicable !
9434/// // Values shown here are possibly random and not representative !
9435/// let mut req = TagBindingCollection::default();
9436///
9437/// // You can configure optional parameters by calling the respective setters at will, and
9438/// // execute the final call using `doit()`.
9439/// // Values shown here are possibly random and not representative !
9440/// let result = hub.locations().tag_binding_collections_patch(req, "name")
9441///              .update_mask(FieldMask::new::<&str>(&[]))
9442///              .doit().await;
9443/// # }
9444/// ```
9445pub struct LocationTagBindingCollectionPatchCall<'a, C>
9446where
9447    C: 'a,
9448{
9449    hub: &'a CloudResourceManager<C>,
9450    _request: TagBindingCollection,
9451    _name: String,
9452    _update_mask: Option<common::FieldMask>,
9453    _delegate: Option<&'a mut dyn common::Delegate>,
9454    _additional_params: HashMap<String, String>,
9455    _scopes: BTreeSet<String>,
9456}
9457
9458impl<'a, C> common::CallBuilder for LocationTagBindingCollectionPatchCall<'a, C> {}
9459
9460impl<'a, C> LocationTagBindingCollectionPatchCall<'a, C>
9461where
9462    C: common::Connector,
9463{
9464    /// Perform the operation you have build so far.
9465    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9466        use std::borrow::Cow;
9467        use std::io::{Read, Seek};
9468
9469        use common::{url::Params, ToParts};
9470        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9471
9472        let mut dd = common::DefaultDelegate;
9473        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9474        dlg.begin(common::MethodInfo {
9475            id: "cloudresourcemanager.locations.tagBindingCollections.patch",
9476            http_method: hyper::Method::PATCH,
9477        });
9478
9479        for &field in ["alt", "name", "updateMask"].iter() {
9480            if self._additional_params.contains_key(field) {
9481                dlg.finished(false);
9482                return Err(common::Error::FieldClash(field));
9483            }
9484        }
9485
9486        let mut params = Params::with_capacity(5 + self._additional_params.len());
9487        params.push("name", self._name);
9488        if let Some(value) = self._update_mask.as_ref() {
9489            params.push("updateMask", value.to_string());
9490        }
9491
9492        params.extend(self._additional_params.iter());
9493
9494        params.push("alt", "json");
9495        let mut url = self.hub._base_url.clone() + "v3/{+name}";
9496        if self._scopes.is_empty() {
9497            self._scopes
9498                .insert(Scope::CloudPlatform.as_ref().to_string());
9499        }
9500
9501        #[allow(clippy::single_element_loop)]
9502        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9503            url = params.uri_replacement(url, param_name, find_this, true);
9504        }
9505        {
9506            let to_remove = ["name"];
9507            params.remove_params(&to_remove);
9508        }
9509
9510        let url = params.parse_with_url(&url);
9511
9512        let mut json_mime_type = mime::APPLICATION_JSON;
9513        let mut request_value_reader = {
9514            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9515            common::remove_json_null_values(&mut value);
9516            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9517            serde_json::to_writer(&mut dst, &value).unwrap();
9518            dst
9519        };
9520        let request_size = request_value_reader
9521            .seek(std::io::SeekFrom::End(0))
9522            .unwrap();
9523        request_value_reader
9524            .seek(std::io::SeekFrom::Start(0))
9525            .unwrap();
9526
9527        loop {
9528            let token = match self
9529                .hub
9530                .auth
9531                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9532                .await
9533            {
9534                Ok(token) => token,
9535                Err(e) => match dlg.token(e) {
9536                    Ok(token) => token,
9537                    Err(e) => {
9538                        dlg.finished(false);
9539                        return Err(common::Error::MissingToken(e));
9540                    }
9541                },
9542            };
9543            request_value_reader
9544                .seek(std::io::SeekFrom::Start(0))
9545                .unwrap();
9546            let mut req_result = {
9547                let client = &self.hub.client;
9548                dlg.pre_request();
9549                let mut req_builder = hyper::Request::builder()
9550                    .method(hyper::Method::PATCH)
9551                    .uri(url.as_str())
9552                    .header(USER_AGENT, self.hub._user_agent.clone());
9553
9554                if let Some(token) = token.as_ref() {
9555                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9556                }
9557
9558                let request = req_builder
9559                    .header(CONTENT_TYPE, json_mime_type.to_string())
9560                    .header(CONTENT_LENGTH, request_size as u64)
9561                    .body(common::to_body(
9562                        request_value_reader.get_ref().clone().into(),
9563                    ));
9564
9565                client.request(request.unwrap()).await
9566            };
9567
9568            match req_result {
9569                Err(err) => {
9570                    if let common::Retry::After(d) = dlg.http_error(&err) {
9571                        sleep(d).await;
9572                        continue;
9573                    }
9574                    dlg.finished(false);
9575                    return Err(common::Error::HttpError(err));
9576                }
9577                Ok(res) => {
9578                    let (mut parts, body) = res.into_parts();
9579                    let mut body = common::Body::new(body);
9580                    if !parts.status.is_success() {
9581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9582                        let error = serde_json::from_str(&common::to_string(&bytes));
9583                        let response = common::to_response(parts, bytes.into());
9584
9585                        if let common::Retry::After(d) =
9586                            dlg.http_failure(&response, error.as_ref().ok())
9587                        {
9588                            sleep(d).await;
9589                            continue;
9590                        }
9591
9592                        dlg.finished(false);
9593
9594                        return Err(match error {
9595                            Ok(value) => common::Error::BadRequest(value),
9596                            _ => common::Error::Failure(response),
9597                        });
9598                    }
9599                    let response = {
9600                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9601                        let encoded = common::to_string(&bytes);
9602                        match serde_json::from_str(&encoded) {
9603                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9604                            Err(error) => {
9605                                dlg.response_json_decode_error(&encoded, &error);
9606                                return Err(common::Error::JsonDecodeError(
9607                                    encoded.to_string(),
9608                                    error,
9609                                ));
9610                            }
9611                        }
9612                    };
9613
9614                    dlg.finished(true);
9615                    return Ok(response);
9616                }
9617            }
9618        }
9619    }
9620
9621    ///
9622    /// Sets the *request* property to the given value.
9623    ///
9624    /// Even though the property as already been set when instantiating this call,
9625    /// we provide this method for API completeness.
9626    pub fn request(
9627        mut self,
9628        new_value: TagBindingCollection,
9629    ) -> LocationTagBindingCollectionPatchCall<'a, C> {
9630        self._request = new_value;
9631        self
9632    }
9633    /// Identifier. The name of the TagBindingCollection, following the convention: `locations/{location}/tagBindingCollections/{encoded-full-resource-name}` where the encoded-full-resource-name is the UTF-8 encoded name of the GCP resource the TagBindings are bound to. "locations/global/tagBindingCollections/%2f%2fcloudresourcemanager.googleapis.com%2fprojects%2f123"
9634    ///
9635    /// Sets the *name* path property to the given value.
9636    ///
9637    /// Even though the property as already been set when instantiating this call,
9638    /// we provide this method for API completeness.
9639    pub fn name(mut self, new_value: &str) -> LocationTagBindingCollectionPatchCall<'a, C> {
9640        self._name = new_value.to_string();
9641        self
9642    }
9643    /// Optional. An update mask to selectively update fields.
9644    ///
9645    /// Sets the *update mask* query property to the given value.
9646    pub fn update_mask(
9647        mut self,
9648        new_value: common::FieldMask,
9649    ) -> LocationTagBindingCollectionPatchCall<'a, C> {
9650        self._update_mask = Some(new_value);
9651        self
9652    }
9653    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9654    /// while executing the actual API request.
9655    ///
9656    /// ````text
9657    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9658    /// ````
9659    ///
9660    /// Sets the *delegate* property to the given value.
9661    pub fn delegate(
9662        mut self,
9663        new_value: &'a mut dyn common::Delegate,
9664    ) -> LocationTagBindingCollectionPatchCall<'a, C> {
9665        self._delegate = Some(new_value);
9666        self
9667    }
9668
9669    /// Set any additional parameter of the query string used in the request.
9670    /// It should be used to set parameters which are not yet available through their own
9671    /// setters.
9672    ///
9673    /// Please note that this method must not be used to set any of the known parameters
9674    /// which have their own setter method. If done anyway, the request will fail.
9675    ///
9676    /// # Additional Parameters
9677    ///
9678    /// * *$.xgafv* (query-string) - V1 error format.
9679    /// * *access_token* (query-string) - OAuth access token.
9680    /// * *alt* (query-string) - Data format for response.
9681    /// * *callback* (query-string) - JSONP
9682    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9683    /// * *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.
9684    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9685    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9686    /// * *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.
9687    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9688    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9689    pub fn param<T>(mut self, name: T, value: T) -> LocationTagBindingCollectionPatchCall<'a, C>
9690    where
9691        T: AsRef<str>,
9692    {
9693        self._additional_params
9694            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9695        self
9696    }
9697
9698    /// Identifies the authorization scope for the method you are building.
9699    ///
9700    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9701    /// [`Scope::CloudPlatform`].
9702    ///
9703    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9704    /// tokens for more than one scope.
9705    ///
9706    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9707    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9708    /// sufficient, a read-write scope will do as well.
9709    pub fn add_scope<St>(mut self, scope: St) -> LocationTagBindingCollectionPatchCall<'a, C>
9710    where
9711        St: AsRef<str>,
9712    {
9713        self._scopes.insert(String::from(scope.as_ref()));
9714        self
9715    }
9716    /// Identifies the authorization scope(s) for the method you are building.
9717    ///
9718    /// See [`Self::add_scope()`] for details.
9719    pub fn add_scopes<I, St>(mut self, scopes: I) -> LocationTagBindingCollectionPatchCall<'a, C>
9720    where
9721        I: IntoIterator<Item = St>,
9722        St: AsRef<str>,
9723    {
9724        self._scopes
9725            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9726        self
9727    }
9728
9729    /// Removes all scopes, and no default scope will be used either.
9730    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9731    /// for details).
9732    pub fn clear_scopes(mut self) -> LocationTagBindingCollectionPatchCall<'a, C> {
9733        self._scopes.clear();
9734        self
9735    }
9736}
9737
9738/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
9739///
9740/// A builder for the *get* method supported by a *operation* resource.
9741/// It is not used directly, but through a [`OperationMethods`] instance.
9742///
9743/// # Example
9744///
9745/// Instantiate a resource method builder
9746///
9747/// ```test_harness,no_run
9748/// # extern crate hyper;
9749/// # extern crate hyper_rustls;
9750/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
9751/// # async fn dox() {
9752/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9753///
9754/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9755/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9756/// #     .with_native_roots()
9757/// #     .unwrap()
9758/// #     .https_only()
9759/// #     .enable_http2()
9760/// #     .build();
9761///
9762/// # let executor = hyper_util::rt::TokioExecutor::new();
9763/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9764/// #     secret,
9765/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9766/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
9767/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
9768/// #     ),
9769/// # ).build().await.unwrap();
9770///
9771/// # let client = hyper_util::client::legacy::Client::builder(
9772/// #     hyper_util::rt::TokioExecutor::new()
9773/// # )
9774/// # .build(
9775/// #     hyper_rustls::HttpsConnectorBuilder::new()
9776/// #         .with_native_roots()
9777/// #         .unwrap()
9778/// #         .https_or_http()
9779/// #         .enable_http2()
9780/// #         .build()
9781/// # );
9782/// # let mut hub = CloudResourceManager::new(client, auth);
9783/// // You can configure optional parameters by calling the respective setters at will, and
9784/// // execute the final call using `doit()`.
9785/// // Values shown here are possibly random and not representative !
9786/// let result = hub.operations().get("name")
9787///              .doit().await;
9788/// # }
9789/// ```
9790pub struct OperationGetCall<'a, C>
9791where
9792    C: 'a,
9793{
9794    hub: &'a CloudResourceManager<C>,
9795    _name: String,
9796    _delegate: Option<&'a mut dyn common::Delegate>,
9797    _additional_params: HashMap<String, String>,
9798    _scopes: BTreeSet<String>,
9799}
9800
9801impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
9802
9803impl<'a, C> OperationGetCall<'a, C>
9804where
9805    C: common::Connector,
9806{
9807    /// Perform the operation you have build so far.
9808    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9809        use std::borrow::Cow;
9810        use std::io::{Read, Seek};
9811
9812        use common::{url::Params, ToParts};
9813        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9814
9815        let mut dd = common::DefaultDelegate;
9816        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9817        dlg.begin(common::MethodInfo {
9818            id: "cloudresourcemanager.operations.get",
9819            http_method: hyper::Method::GET,
9820        });
9821
9822        for &field in ["alt", "name"].iter() {
9823            if self._additional_params.contains_key(field) {
9824                dlg.finished(false);
9825                return Err(common::Error::FieldClash(field));
9826            }
9827        }
9828
9829        let mut params = Params::with_capacity(3 + self._additional_params.len());
9830        params.push("name", self._name);
9831
9832        params.extend(self._additional_params.iter());
9833
9834        params.push("alt", "json");
9835        let mut url = self.hub._base_url.clone() + "v3/{+name}";
9836        if self._scopes.is_empty() {
9837            self._scopes
9838                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
9839        }
9840
9841        #[allow(clippy::single_element_loop)]
9842        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9843            url = params.uri_replacement(url, param_name, find_this, true);
9844        }
9845        {
9846            let to_remove = ["name"];
9847            params.remove_params(&to_remove);
9848        }
9849
9850        let url = params.parse_with_url(&url);
9851
9852        loop {
9853            let token = match self
9854                .hub
9855                .auth
9856                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9857                .await
9858            {
9859                Ok(token) => token,
9860                Err(e) => match dlg.token(e) {
9861                    Ok(token) => token,
9862                    Err(e) => {
9863                        dlg.finished(false);
9864                        return Err(common::Error::MissingToken(e));
9865                    }
9866                },
9867            };
9868            let mut req_result = {
9869                let client = &self.hub.client;
9870                dlg.pre_request();
9871                let mut req_builder = hyper::Request::builder()
9872                    .method(hyper::Method::GET)
9873                    .uri(url.as_str())
9874                    .header(USER_AGENT, self.hub._user_agent.clone());
9875
9876                if let Some(token) = token.as_ref() {
9877                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9878                }
9879
9880                let request = req_builder
9881                    .header(CONTENT_LENGTH, 0_u64)
9882                    .body(common::to_body::<String>(None));
9883
9884                client.request(request.unwrap()).await
9885            };
9886
9887            match req_result {
9888                Err(err) => {
9889                    if let common::Retry::After(d) = dlg.http_error(&err) {
9890                        sleep(d).await;
9891                        continue;
9892                    }
9893                    dlg.finished(false);
9894                    return Err(common::Error::HttpError(err));
9895                }
9896                Ok(res) => {
9897                    let (mut parts, body) = res.into_parts();
9898                    let mut body = common::Body::new(body);
9899                    if !parts.status.is_success() {
9900                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9901                        let error = serde_json::from_str(&common::to_string(&bytes));
9902                        let response = common::to_response(parts, bytes.into());
9903
9904                        if let common::Retry::After(d) =
9905                            dlg.http_failure(&response, error.as_ref().ok())
9906                        {
9907                            sleep(d).await;
9908                            continue;
9909                        }
9910
9911                        dlg.finished(false);
9912
9913                        return Err(match error {
9914                            Ok(value) => common::Error::BadRequest(value),
9915                            _ => common::Error::Failure(response),
9916                        });
9917                    }
9918                    let response = {
9919                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9920                        let encoded = common::to_string(&bytes);
9921                        match serde_json::from_str(&encoded) {
9922                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9923                            Err(error) => {
9924                                dlg.response_json_decode_error(&encoded, &error);
9925                                return Err(common::Error::JsonDecodeError(
9926                                    encoded.to_string(),
9927                                    error,
9928                                ));
9929                            }
9930                        }
9931                    };
9932
9933                    dlg.finished(true);
9934                    return Ok(response);
9935                }
9936            }
9937        }
9938    }
9939
9940    /// The name of the operation resource.
9941    ///
9942    /// Sets the *name* path property to the given value.
9943    ///
9944    /// Even though the property as already been set when instantiating this call,
9945    /// we provide this method for API completeness.
9946    pub fn name(mut self, new_value: &str) -> OperationGetCall<'a, C> {
9947        self._name = new_value.to_string();
9948        self
9949    }
9950    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9951    /// while executing the actual API request.
9952    ///
9953    /// ````text
9954    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9955    /// ````
9956    ///
9957    /// Sets the *delegate* property to the given value.
9958    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
9959        self._delegate = Some(new_value);
9960        self
9961    }
9962
9963    /// Set any additional parameter of the query string used in the request.
9964    /// It should be used to set parameters which are not yet available through their own
9965    /// setters.
9966    ///
9967    /// Please note that this method must not be used to set any of the known parameters
9968    /// which have their own setter method. If done anyway, the request will fail.
9969    ///
9970    /// # Additional Parameters
9971    ///
9972    /// * *$.xgafv* (query-string) - V1 error format.
9973    /// * *access_token* (query-string) - OAuth access token.
9974    /// * *alt* (query-string) - Data format for response.
9975    /// * *callback* (query-string) - JSONP
9976    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9977    /// * *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.
9978    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9979    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9980    /// * *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.
9981    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9982    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9983    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
9984    where
9985        T: AsRef<str>,
9986    {
9987        self._additional_params
9988            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9989        self
9990    }
9991
9992    /// Identifies the authorization scope for the method you are building.
9993    ///
9994    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9995    /// [`Scope::CloudPlatformReadOnly`].
9996    ///
9997    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9998    /// tokens for more than one scope.
9999    ///
10000    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10001    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10002    /// sufficient, a read-write scope will do as well.
10003    pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
10004    where
10005        St: AsRef<str>,
10006    {
10007        self._scopes.insert(String::from(scope.as_ref()));
10008        self
10009    }
10010    /// Identifies the authorization scope(s) for the method you are building.
10011    ///
10012    /// See [`Self::add_scope()`] for details.
10013    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
10014    where
10015        I: IntoIterator<Item = St>,
10016        St: AsRef<str>,
10017    {
10018        self._scopes
10019            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10020        self
10021    }
10022
10023    /// Removes all scopes, and no default scope will be used either.
10024    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10025    /// for details).
10026    pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
10027        self._scopes.clear();
10028        self
10029    }
10030}
10031
10032/// Fetches an organization resource identified by the specified resource name.
10033///
10034/// A builder for the *get* method supported by a *organization* resource.
10035/// It is not used directly, but through a [`OrganizationMethods`] instance.
10036///
10037/// # Example
10038///
10039/// Instantiate a resource method builder
10040///
10041/// ```test_harness,no_run
10042/// # extern crate hyper;
10043/// # extern crate hyper_rustls;
10044/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
10045/// # async fn dox() {
10046/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10047///
10048/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10049/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10050/// #     .with_native_roots()
10051/// #     .unwrap()
10052/// #     .https_only()
10053/// #     .enable_http2()
10054/// #     .build();
10055///
10056/// # let executor = hyper_util::rt::TokioExecutor::new();
10057/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10058/// #     secret,
10059/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10060/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10061/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10062/// #     ),
10063/// # ).build().await.unwrap();
10064///
10065/// # let client = hyper_util::client::legacy::Client::builder(
10066/// #     hyper_util::rt::TokioExecutor::new()
10067/// # )
10068/// # .build(
10069/// #     hyper_rustls::HttpsConnectorBuilder::new()
10070/// #         .with_native_roots()
10071/// #         .unwrap()
10072/// #         .https_or_http()
10073/// #         .enable_http2()
10074/// #         .build()
10075/// # );
10076/// # let mut hub = CloudResourceManager::new(client, auth);
10077/// // You can configure optional parameters by calling the respective setters at will, and
10078/// // execute the final call using `doit()`.
10079/// // Values shown here are possibly random and not representative !
10080/// let result = hub.organizations().get("name")
10081///              .doit().await;
10082/// # }
10083/// ```
10084pub struct OrganizationGetCall<'a, C>
10085where
10086    C: 'a,
10087{
10088    hub: &'a CloudResourceManager<C>,
10089    _name: String,
10090    _delegate: Option<&'a mut dyn common::Delegate>,
10091    _additional_params: HashMap<String, String>,
10092    _scopes: BTreeSet<String>,
10093}
10094
10095impl<'a, C> common::CallBuilder for OrganizationGetCall<'a, C> {}
10096
10097impl<'a, C> OrganizationGetCall<'a, C>
10098where
10099    C: common::Connector,
10100{
10101    /// Perform the operation you have build so far.
10102    pub async fn doit(mut self) -> common::Result<(common::Response, Organization)> {
10103        use std::borrow::Cow;
10104        use std::io::{Read, Seek};
10105
10106        use common::{url::Params, ToParts};
10107        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10108
10109        let mut dd = common::DefaultDelegate;
10110        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10111        dlg.begin(common::MethodInfo {
10112            id: "cloudresourcemanager.organizations.get",
10113            http_method: hyper::Method::GET,
10114        });
10115
10116        for &field in ["alt", "name"].iter() {
10117            if self._additional_params.contains_key(field) {
10118                dlg.finished(false);
10119                return Err(common::Error::FieldClash(field));
10120            }
10121        }
10122
10123        let mut params = Params::with_capacity(3 + self._additional_params.len());
10124        params.push("name", self._name);
10125
10126        params.extend(self._additional_params.iter());
10127
10128        params.push("alt", "json");
10129        let mut url = self.hub._base_url.clone() + "v3/{+name}";
10130        if self._scopes.is_empty() {
10131            self._scopes
10132                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
10133        }
10134
10135        #[allow(clippy::single_element_loop)]
10136        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10137            url = params.uri_replacement(url, param_name, find_this, true);
10138        }
10139        {
10140            let to_remove = ["name"];
10141            params.remove_params(&to_remove);
10142        }
10143
10144        let url = params.parse_with_url(&url);
10145
10146        loop {
10147            let token = match self
10148                .hub
10149                .auth
10150                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10151                .await
10152            {
10153                Ok(token) => token,
10154                Err(e) => match dlg.token(e) {
10155                    Ok(token) => token,
10156                    Err(e) => {
10157                        dlg.finished(false);
10158                        return Err(common::Error::MissingToken(e));
10159                    }
10160                },
10161            };
10162            let mut req_result = {
10163                let client = &self.hub.client;
10164                dlg.pre_request();
10165                let mut req_builder = hyper::Request::builder()
10166                    .method(hyper::Method::GET)
10167                    .uri(url.as_str())
10168                    .header(USER_AGENT, self.hub._user_agent.clone());
10169
10170                if let Some(token) = token.as_ref() {
10171                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10172                }
10173
10174                let request = req_builder
10175                    .header(CONTENT_LENGTH, 0_u64)
10176                    .body(common::to_body::<String>(None));
10177
10178                client.request(request.unwrap()).await
10179            };
10180
10181            match req_result {
10182                Err(err) => {
10183                    if let common::Retry::After(d) = dlg.http_error(&err) {
10184                        sleep(d).await;
10185                        continue;
10186                    }
10187                    dlg.finished(false);
10188                    return Err(common::Error::HttpError(err));
10189                }
10190                Ok(res) => {
10191                    let (mut parts, body) = res.into_parts();
10192                    let mut body = common::Body::new(body);
10193                    if !parts.status.is_success() {
10194                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10195                        let error = serde_json::from_str(&common::to_string(&bytes));
10196                        let response = common::to_response(parts, bytes.into());
10197
10198                        if let common::Retry::After(d) =
10199                            dlg.http_failure(&response, error.as_ref().ok())
10200                        {
10201                            sleep(d).await;
10202                            continue;
10203                        }
10204
10205                        dlg.finished(false);
10206
10207                        return Err(match error {
10208                            Ok(value) => common::Error::BadRequest(value),
10209                            _ => common::Error::Failure(response),
10210                        });
10211                    }
10212                    let response = {
10213                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10214                        let encoded = common::to_string(&bytes);
10215                        match serde_json::from_str(&encoded) {
10216                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10217                            Err(error) => {
10218                                dlg.response_json_decode_error(&encoded, &error);
10219                                return Err(common::Error::JsonDecodeError(
10220                                    encoded.to_string(),
10221                                    error,
10222                                ));
10223                            }
10224                        }
10225                    };
10226
10227                    dlg.finished(true);
10228                    return Ok(response);
10229                }
10230            }
10231        }
10232    }
10233
10234    /// Required. 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".
10235    ///
10236    /// Sets the *name* path property to the given value.
10237    ///
10238    /// Even though the property as already been set when instantiating this call,
10239    /// we provide this method for API completeness.
10240    pub fn name(mut self, new_value: &str) -> OrganizationGetCall<'a, C> {
10241        self._name = new_value.to_string();
10242        self
10243    }
10244    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10245    /// while executing the actual API request.
10246    ///
10247    /// ````text
10248    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10249    /// ````
10250    ///
10251    /// Sets the *delegate* property to the given value.
10252    pub fn delegate(
10253        mut self,
10254        new_value: &'a mut dyn common::Delegate,
10255    ) -> OrganizationGetCall<'a, C> {
10256        self._delegate = Some(new_value);
10257        self
10258    }
10259
10260    /// Set any additional parameter of the query string used in the request.
10261    /// It should be used to set parameters which are not yet available through their own
10262    /// setters.
10263    ///
10264    /// Please note that this method must not be used to set any of the known parameters
10265    /// which have their own setter method. If done anyway, the request will fail.
10266    ///
10267    /// # Additional Parameters
10268    ///
10269    /// * *$.xgafv* (query-string) - V1 error format.
10270    /// * *access_token* (query-string) - OAuth access token.
10271    /// * *alt* (query-string) - Data format for response.
10272    /// * *callback* (query-string) - JSONP
10273    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10274    /// * *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.
10275    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10276    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10277    /// * *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.
10278    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10279    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10280    pub fn param<T>(mut self, name: T, value: T) -> OrganizationGetCall<'a, C>
10281    where
10282        T: AsRef<str>,
10283    {
10284        self._additional_params
10285            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10286        self
10287    }
10288
10289    /// Identifies the authorization scope for the method you are building.
10290    ///
10291    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10292    /// [`Scope::CloudPlatformReadOnly`].
10293    ///
10294    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10295    /// tokens for more than one scope.
10296    ///
10297    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10298    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10299    /// sufficient, a read-write scope will do as well.
10300    pub fn add_scope<St>(mut self, scope: St) -> OrganizationGetCall<'a, C>
10301    where
10302        St: AsRef<str>,
10303    {
10304        self._scopes.insert(String::from(scope.as_ref()));
10305        self
10306    }
10307    /// Identifies the authorization scope(s) for the method you are building.
10308    ///
10309    /// See [`Self::add_scope()`] for details.
10310    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationGetCall<'a, C>
10311    where
10312        I: IntoIterator<Item = St>,
10313        St: AsRef<str>,
10314    {
10315        self._scopes
10316            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10317        self
10318    }
10319
10320    /// Removes all scopes, and no default scope will be used either.
10321    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10322    /// for details).
10323    pub fn clear_scopes(mut self) -> OrganizationGetCall<'a, C> {
10324        self._scopes.clear();
10325        self
10326    }
10327}
10328
10329/// Gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The `resource` field should be the organization's resource name, for example: "organizations/123". Authorization requires the IAM permission `resourcemanager.organizations.getIamPolicy` on the specified organization.
10330///
10331/// A builder for the *getIamPolicy* method supported by a *organization* resource.
10332/// It is not used directly, but through a [`OrganizationMethods`] instance.
10333///
10334/// # Example
10335///
10336/// Instantiate a resource method builder
10337///
10338/// ```test_harness,no_run
10339/// # extern crate hyper;
10340/// # extern crate hyper_rustls;
10341/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
10342/// use cloudresourcemanager3::api::GetIamPolicyRequest;
10343/// # async fn dox() {
10344/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10345///
10346/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10347/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10348/// #     .with_native_roots()
10349/// #     .unwrap()
10350/// #     .https_only()
10351/// #     .enable_http2()
10352/// #     .build();
10353///
10354/// # let executor = hyper_util::rt::TokioExecutor::new();
10355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10356/// #     secret,
10357/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10358/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10359/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10360/// #     ),
10361/// # ).build().await.unwrap();
10362///
10363/// # let client = hyper_util::client::legacy::Client::builder(
10364/// #     hyper_util::rt::TokioExecutor::new()
10365/// # )
10366/// # .build(
10367/// #     hyper_rustls::HttpsConnectorBuilder::new()
10368/// #         .with_native_roots()
10369/// #         .unwrap()
10370/// #         .https_or_http()
10371/// #         .enable_http2()
10372/// #         .build()
10373/// # );
10374/// # let mut hub = CloudResourceManager::new(client, auth);
10375/// // As the method needs a request, you would usually fill it with the desired information
10376/// // into the respective structure. Some of the parts shown here might not be applicable !
10377/// // Values shown here are possibly random and not representative !
10378/// let mut req = GetIamPolicyRequest::default();
10379///
10380/// // You can configure optional parameters by calling the respective setters at will, and
10381/// // execute the final call using `doit()`.
10382/// // Values shown here are possibly random and not representative !
10383/// let result = hub.organizations().get_iam_policy(req, "resource")
10384///              .doit().await;
10385/// # }
10386/// ```
10387pub struct OrganizationGetIamPolicyCall<'a, C>
10388where
10389    C: 'a,
10390{
10391    hub: &'a CloudResourceManager<C>,
10392    _request: GetIamPolicyRequest,
10393    _resource: String,
10394    _delegate: Option<&'a mut dyn common::Delegate>,
10395    _additional_params: HashMap<String, String>,
10396    _scopes: BTreeSet<String>,
10397}
10398
10399impl<'a, C> common::CallBuilder for OrganizationGetIamPolicyCall<'a, C> {}
10400
10401impl<'a, C> OrganizationGetIamPolicyCall<'a, C>
10402where
10403    C: common::Connector,
10404{
10405    /// Perform the operation you have build so far.
10406    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
10407        use std::borrow::Cow;
10408        use std::io::{Read, Seek};
10409
10410        use common::{url::Params, ToParts};
10411        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10412
10413        let mut dd = common::DefaultDelegate;
10414        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10415        dlg.begin(common::MethodInfo {
10416            id: "cloudresourcemanager.organizations.getIamPolicy",
10417            http_method: hyper::Method::POST,
10418        });
10419
10420        for &field in ["alt", "resource"].iter() {
10421            if self._additional_params.contains_key(field) {
10422                dlg.finished(false);
10423                return Err(common::Error::FieldClash(field));
10424            }
10425        }
10426
10427        let mut params = Params::with_capacity(4 + self._additional_params.len());
10428        params.push("resource", self._resource);
10429
10430        params.extend(self._additional_params.iter());
10431
10432        params.push("alt", "json");
10433        let mut url = self.hub._base_url.clone() + "v3/{+resource}:getIamPolicy";
10434        if self._scopes.is_empty() {
10435            self._scopes
10436                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
10437        }
10438
10439        #[allow(clippy::single_element_loop)]
10440        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
10441            url = params.uri_replacement(url, param_name, find_this, true);
10442        }
10443        {
10444            let to_remove = ["resource"];
10445            params.remove_params(&to_remove);
10446        }
10447
10448        let url = params.parse_with_url(&url);
10449
10450        let mut json_mime_type = mime::APPLICATION_JSON;
10451        let mut request_value_reader = {
10452            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10453            common::remove_json_null_values(&mut value);
10454            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10455            serde_json::to_writer(&mut dst, &value).unwrap();
10456            dst
10457        };
10458        let request_size = request_value_reader
10459            .seek(std::io::SeekFrom::End(0))
10460            .unwrap();
10461        request_value_reader
10462            .seek(std::io::SeekFrom::Start(0))
10463            .unwrap();
10464
10465        loop {
10466            let token = match self
10467                .hub
10468                .auth
10469                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10470                .await
10471            {
10472                Ok(token) => token,
10473                Err(e) => match dlg.token(e) {
10474                    Ok(token) => token,
10475                    Err(e) => {
10476                        dlg.finished(false);
10477                        return Err(common::Error::MissingToken(e));
10478                    }
10479                },
10480            };
10481            request_value_reader
10482                .seek(std::io::SeekFrom::Start(0))
10483                .unwrap();
10484            let mut req_result = {
10485                let client = &self.hub.client;
10486                dlg.pre_request();
10487                let mut req_builder = hyper::Request::builder()
10488                    .method(hyper::Method::POST)
10489                    .uri(url.as_str())
10490                    .header(USER_AGENT, self.hub._user_agent.clone());
10491
10492                if let Some(token) = token.as_ref() {
10493                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10494                }
10495
10496                let request = req_builder
10497                    .header(CONTENT_TYPE, json_mime_type.to_string())
10498                    .header(CONTENT_LENGTH, request_size as u64)
10499                    .body(common::to_body(
10500                        request_value_reader.get_ref().clone().into(),
10501                    ));
10502
10503                client.request(request.unwrap()).await
10504            };
10505
10506            match req_result {
10507                Err(err) => {
10508                    if let common::Retry::After(d) = dlg.http_error(&err) {
10509                        sleep(d).await;
10510                        continue;
10511                    }
10512                    dlg.finished(false);
10513                    return Err(common::Error::HttpError(err));
10514                }
10515                Ok(res) => {
10516                    let (mut parts, body) = res.into_parts();
10517                    let mut body = common::Body::new(body);
10518                    if !parts.status.is_success() {
10519                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10520                        let error = serde_json::from_str(&common::to_string(&bytes));
10521                        let response = common::to_response(parts, bytes.into());
10522
10523                        if let common::Retry::After(d) =
10524                            dlg.http_failure(&response, error.as_ref().ok())
10525                        {
10526                            sleep(d).await;
10527                            continue;
10528                        }
10529
10530                        dlg.finished(false);
10531
10532                        return Err(match error {
10533                            Ok(value) => common::Error::BadRequest(value),
10534                            _ => common::Error::Failure(response),
10535                        });
10536                    }
10537                    let response = {
10538                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10539                        let encoded = common::to_string(&bytes);
10540                        match serde_json::from_str(&encoded) {
10541                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10542                            Err(error) => {
10543                                dlg.response_json_decode_error(&encoded, &error);
10544                                return Err(common::Error::JsonDecodeError(
10545                                    encoded.to_string(),
10546                                    error,
10547                                ));
10548                            }
10549                        }
10550                    };
10551
10552                    dlg.finished(true);
10553                    return Ok(response);
10554                }
10555            }
10556        }
10557    }
10558
10559    ///
10560    /// Sets the *request* property to the given value.
10561    ///
10562    /// Even though the property as already been set when instantiating this call,
10563    /// we provide this method for API completeness.
10564    pub fn request(
10565        mut self,
10566        new_value: GetIamPolicyRequest,
10567    ) -> OrganizationGetIamPolicyCall<'a, C> {
10568        self._request = new_value;
10569        self
10570    }
10571    /// 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.
10572    ///
10573    /// Sets the *resource* path property to the given value.
10574    ///
10575    /// Even though the property as already been set when instantiating this call,
10576    /// we provide this method for API completeness.
10577    pub fn resource(mut self, new_value: &str) -> OrganizationGetIamPolicyCall<'a, C> {
10578        self._resource = new_value.to_string();
10579        self
10580    }
10581    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10582    /// while executing the actual API request.
10583    ///
10584    /// ````text
10585    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10586    /// ````
10587    ///
10588    /// Sets the *delegate* property to the given value.
10589    pub fn delegate(
10590        mut self,
10591        new_value: &'a mut dyn common::Delegate,
10592    ) -> OrganizationGetIamPolicyCall<'a, C> {
10593        self._delegate = Some(new_value);
10594        self
10595    }
10596
10597    /// Set any additional parameter of the query string used in the request.
10598    /// It should be used to set parameters which are not yet available through their own
10599    /// setters.
10600    ///
10601    /// Please note that this method must not be used to set any of the known parameters
10602    /// which have their own setter method. If done anyway, the request will fail.
10603    ///
10604    /// # Additional Parameters
10605    ///
10606    /// * *$.xgafv* (query-string) - V1 error format.
10607    /// * *access_token* (query-string) - OAuth access token.
10608    /// * *alt* (query-string) - Data format for response.
10609    /// * *callback* (query-string) - JSONP
10610    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10611    /// * *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.
10612    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10613    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10614    /// * *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.
10615    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10616    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10617    pub fn param<T>(mut self, name: T, value: T) -> OrganizationGetIamPolicyCall<'a, C>
10618    where
10619        T: AsRef<str>,
10620    {
10621        self._additional_params
10622            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10623        self
10624    }
10625
10626    /// Identifies the authorization scope for the method you are building.
10627    ///
10628    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10629    /// [`Scope::CloudPlatformReadOnly`].
10630    ///
10631    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10632    /// tokens for more than one scope.
10633    ///
10634    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10635    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10636    /// sufficient, a read-write scope will do as well.
10637    pub fn add_scope<St>(mut self, scope: St) -> OrganizationGetIamPolicyCall<'a, C>
10638    where
10639        St: AsRef<str>,
10640    {
10641        self._scopes.insert(String::from(scope.as_ref()));
10642        self
10643    }
10644    /// Identifies the authorization scope(s) for the method you are building.
10645    ///
10646    /// See [`Self::add_scope()`] for details.
10647    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationGetIamPolicyCall<'a, C>
10648    where
10649        I: IntoIterator<Item = St>,
10650        St: AsRef<str>,
10651    {
10652        self._scopes
10653            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10654        self
10655    }
10656
10657    /// Removes all scopes, and no default scope will be used either.
10658    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10659    /// for details).
10660    pub fn clear_scopes(mut self) -> OrganizationGetIamPolicyCall<'a, C> {
10661        self._scopes.clear();
10662        self
10663    }
10664}
10665
10666/// Searches 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 results, and may take a small amount of time to appear. Search will only return organizations on which the user has the permission `resourcemanager.organizations.get` or has super admin privileges.
10667///
10668/// A builder for the *search* method supported by a *organization* resource.
10669/// It is not used directly, but through a [`OrganizationMethods`] instance.
10670///
10671/// # Example
10672///
10673/// Instantiate a resource method builder
10674///
10675/// ```test_harness,no_run
10676/// # extern crate hyper;
10677/// # extern crate hyper_rustls;
10678/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
10679/// # async fn dox() {
10680/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10681///
10682/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10683/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10684/// #     .with_native_roots()
10685/// #     .unwrap()
10686/// #     .https_only()
10687/// #     .enable_http2()
10688/// #     .build();
10689///
10690/// # let executor = hyper_util::rt::TokioExecutor::new();
10691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10692/// #     secret,
10693/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10694/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
10695/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
10696/// #     ),
10697/// # ).build().await.unwrap();
10698///
10699/// # let client = hyper_util::client::legacy::Client::builder(
10700/// #     hyper_util::rt::TokioExecutor::new()
10701/// # )
10702/// # .build(
10703/// #     hyper_rustls::HttpsConnectorBuilder::new()
10704/// #         .with_native_roots()
10705/// #         .unwrap()
10706/// #         .https_or_http()
10707/// #         .enable_http2()
10708/// #         .build()
10709/// # );
10710/// # let mut hub = CloudResourceManager::new(client, auth);
10711/// // You can configure optional parameters by calling the respective setters at will, and
10712/// // execute the final call using `doit()`.
10713/// // Values shown here are possibly random and not representative !
10714/// let result = hub.organizations().search()
10715///              .query("Stet")
10716///              .page_token("kasd")
10717///              .page_size(-24)
10718///              .doit().await;
10719/// # }
10720/// ```
10721pub struct OrganizationSearchCall<'a, C>
10722where
10723    C: 'a,
10724{
10725    hub: &'a CloudResourceManager<C>,
10726    _query: Option<String>,
10727    _page_token: Option<String>,
10728    _page_size: Option<i32>,
10729    _delegate: Option<&'a mut dyn common::Delegate>,
10730    _additional_params: HashMap<String, String>,
10731    _scopes: BTreeSet<String>,
10732}
10733
10734impl<'a, C> common::CallBuilder for OrganizationSearchCall<'a, C> {}
10735
10736impl<'a, C> OrganizationSearchCall<'a, C>
10737where
10738    C: common::Connector,
10739{
10740    /// Perform the operation you have build so far.
10741    pub async fn doit(mut self) -> common::Result<(common::Response, SearchOrganizationsResponse)> {
10742        use std::borrow::Cow;
10743        use std::io::{Read, Seek};
10744
10745        use common::{url::Params, ToParts};
10746        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10747
10748        let mut dd = common::DefaultDelegate;
10749        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10750        dlg.begin(common::MethodInfo {
10751            id: "cloudresourcemanager.organizations.search",
10752            http_method: hyper::Method::GET,
10753        });
10754
10755        for &field in ["alt", "query", "pageToken", "pageSize"].iter() {
10756            if self._additional_params.contains_key(field) {
10757                dlg.finished(false);
10758                return Err(common::Error::FieldClash(field));
10759            }
10760        }
10761
10762        let mut params = Params::with_capacity(5 + self._additional_params.len());
10763        if let Some(value) = self._query.as_ref() {
10764            params.push("query", value);
10765        }
10766        if let Some(value) = self._page_token.as_ref() {
10767            params.push("pageToken", value);
10768        }
10769        if let Some(value) = self._page_size.as_ref() {
10770            params.push("pageSize", value.to_string());
10771        }
10772
10773        params.extend(self._additional_params.iter());
10774
10775        params.push("alt", "json");
10776        let mut url = self.hub._base_url.clone() + "v3/organizations:search";
10777        if self._scopes.is_empty() {
10778            self._scopes
10779                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
10780        }
10781
10782        let url = params.parse_with_url(&url);
10783
10784        loop {
10785            let token = match self
10786                .hub
10787                .auth
10788                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10789                .await
10790            {
10791                Ok(token) => token,
10792                Err(e) => match dlg.token(e) {
10793                    Ok(token) => token,
10794                    Err(e) => {
10795                        dlg.finished(false);
10796                        return Err(common::Error::MissingToken(e));
10797                    }
10798                },
10799            };
10800            let mut req_result = {
10801                let client = &self.hub.client;
10802                dlg.pre_request();
10803                let mut req_builder = hyper::Request::builder()
10804                    .method(hyper::Method::GET)
10805                    .uri(url.as_str())
10806                    .header(USER_AGENT, self.hub._user_agent.clone());
10807
10808                if let Some(token) = token.as_ref() {
10809                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10810                }
10811
10812                let request = req_builder
10813                    .header(CONTENT_LENGTH, 0_u64)
10814                    .body(common::to_body::<String>(None));
10815
10816                client.request(request.unwrap()).await
10817            };
10818
10819            match req_result {
10820                Err(err) => {
10821                    if let common::Retry::After(d) = dlg.http_error(&err) {
10822                        sleep(d).await;
10823                        continue;
10824                    }
10825                    dlg.finished(false);
10826                    return Err(common::Error::HttpError(err));
10827                }
10828                Ok(res) => {
10829                    let (mut parts, body) = res.into_parts();
10830                    let mut body = common::Body::new(body);
10831                    if !parts.status.is_success() {
10832                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10833                        let error = serde_json::from_str(&common::to_string(&bytes));
10834                        let response = common::to_response(parts, bytes.into());
10835
10836                        if let common::Retry::After(d) =
10837                            dlg.http_failure(&response, error.as_ref().ok())
10838                        {
10839                            sleep(d).await;
10840                            continue;
10841                        }
10842
10843                        dlg.finished(false);
10844
10845                        return Err(match error {
10846                            Ok(value) => common::Error::BadRequest(value),
10847                            _ => common::Error::Failure(response),
10848                        });
10849                    }
10850                    let response = {
10851                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10852                        let encoded = common::to_string(&bytes);
10853                        match serde_json::from_str(&encoded) {
10854                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10855                            Err(error) => {
10856                                dlg.response_json_decode_error(&encoded, &error);
10857                                return Err(common::Error::JsonDecodeError(
10858                                    encoded.to_string(),
10859                                    error,
10860                                ));
10861                            }
10862                        }
10863                    };
10864
10865                    dlg.finished(true);
10866                    return Ok(response);
10867                }
10868            }
10869        }
10870    }
10871
10872    /// Optional. An optional query string used to filter the Organizations to return in the response. Query rules are case-insensitive. ``` | Field | Description | |------------------|--------------------------------------------| | directoryCustomerId, owner.directoryCustomerId | Filters by directory customer id. | | domain | Filters by domain. | ``` Organizations may be queried by `directoryCustomerId` or by `domain`, where the domain is a G Suite domain, for example: * Query `directorycustomerid:123456789` returns Organization resources with `owner.directory_customer_id` equal to `123456789`. * Query `domain:google.com` returns Organization resources corresponding to the domain `google.com`.
10873    ///
10874    /// Sets the *query* query property to the given value.
10875    pub fn query(mut self, new_value: &str) -> OrganizationSearchCall<'a, C> {
10876        self._query = Some(new_value.to_string());
10877        self
10878    }
10879    /// Optional. A pagination token returned from a previous call to `SearchOrganizations` that indicates from where listing should continue.
10880    ///
10881    /// Sets the *page token* query property to the given value.
10882    pub fn page_token(mut self, new_value: &str) -> OrganizationSearchCall<'a, C> {
10883        self._page_token = Some(new_value.to_string());
10884        self
10885    }
10886    /// Optional. The maximum number of organizations to return in the response. The server can return fewer organizations than requested. If unspecified, server picks an appropriate default.
10887    ///
10888    /// Sets the *page size* query property to the given value.
10889    pub fn page_size(mut self, new_value: i32) -> OrganizationSearchCall<'a, C> {
10890        self._page_size = Some(new_value);
10891        self
10892    }
10893    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10894    /// while executing the actual API request.
10895    ///
10896    /// ````text
10897    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10898    /// ````
10899    ///
10900    /// Sets the *delegate* property to the given value.
10901    pub fn delegate(
10902        mut self,
10903        new_value: &'a mut dyn common::Delegate,
10904    ) -> OrganizationSearchCall<'a, C> {
10905        self._delegate = Some(new_value);
10906        self
10907    }
10908
10909    /// Set any additional parameter of the query string used in the request.
10910    /// It should be used to set parameters which are not yet available through their own
10911    /// setters.
10912    ///
10913    /// Please note that this method must not be used to set any of the known parameters
10914    /// which have their own setter method. If done anyway, the request will fail.
10915    ///
10916    /// # Additional Parameters
10917    ///
10918    /// * *$.xgafv* (query-string) - V1 error format.
10919    /// * *access_token* (query-string) - OAuth access token.
10920    /// * *alt* (query-string) - Data format for response.
10921    /// * *callback* (query-string) - JSONP
10922    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10923    /// * *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.
10924    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10925    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10926    /// * *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.
10927    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10928    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10929    pub fn param<T>(mut self, name: T, value: T) -> OrganizationSearchCall<'a, C>
10930    where
10931        T: AsRef<str>,
10932    {
10933        self._additional_params
10934            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10935        self
10936    }
10937
10938    /// Identifies the authorization scope for the method you are building.
10939    ///
10940    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10941    /// [`Scope::CloudPlatformReadOnly`].
10942    ///
10943    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10944    /// tokens for more than one scope.
10945    ///
10946    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10947    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10948    /// sufficient, a read-write scope will do as well.
10949    pub fn add_scope<St>(mut self, scope: St) -> OrganizationSearchCall<'a, C>
10950    where
10951        St: AsRef<str>,
10952    {
10953        self._scopes.insert(String::from(scope.as_ref()));
10954        self
10955    }
10956    /// Identifies the authorization scope(s) for the method you are building.
10957    ///
10958    /// See [`Self::add_scope()`] for details.
10959    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationSearchCall<'a, C>
10960    where
10961        I: IntoIterator<Item = St>,
10962        St: AsRef<str>,
10963    {
10964        self._scopes
10965            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10966        self
10967    }
10968
10969    /// Removes all scopes, and no default scope will be used either.
10970    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10971    /// for details).
10972    pub fn clear_scopes(mut self) -> OrganizationSearchCall<'a, C> {
10973        self._scopes.clear();
10974        self
10975    }
10976}
10977
10978/// Sets the access control policy on an organization resource. Replaces any existing policy. The `resource` field should be the organization's resource name, for example: "organizations/123". Authorization requires the IAM permission `resourcemanager.organizations.setIamPolicy` on the specified organization.
10979///
10980/// A builder for the *setIamPolicy* method supported by a *organization* resource.
10981/// It is not used directly, but through a [`OrganizationMethods`] instance.
10982///
10983/// # Example
10984///
10985/// Instantiate a resource method builder
10986///
10987/// ```test_harness,no_run
10988/// # extern crate hyper;
10989/// # extern crate hyper_rustls;
10990/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
10991/// use cloudresourcemanager3::api::SetIamPolicyRequest;
10992/// # async fn dox() {
10993/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10994///
10995/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10996/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10997/// #     .with_native_roots()
10998/// #     .unwrap()
10999/// #     .https_only()
11000/// #     .enable_http2()
11001/// #     .build();
11002///
11003/// # let executor = hyper_util::rt::TokioExecutor::new();
11004/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11005/// #     secret,
11006/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11007/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11008/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11009/// #     ),
11010/// # ).build().await.unwrap();
11011///
11012/// # let client = hyper_util::client::legacy::Client::builder(
11013/// #     hyper_util::rt::TokioExecutor::new()
11014/// # )
11015/// # .build(
11016/// #     hyper_rustls::HttpsConnectorBuilder::new()
11017/// #         .with_native_roots()
11018/// #         .unwrap()
11019/// #         .https_or_http()
11020/// #         .enable_http2()
11021/// #         .build()
11022/// # );
11023/// # let mut hub = CloudResourceManager::new(client, auth);
11024/// // As the method needs a request, you would usually fill it with the desired information
11025/// // into the respective structure. Some of the parts shown here might not be applicable !
11026/// // Values shown here are possibly random and not representative !
11027/// let mut req = SetIamPolicyRequest::default();
11028///
11029/// // You can configure optional parameters by calling the respective setters at will, and
11030/// // execute the final call using `doit()`.
11031/// // Values shown here are possibly random and not representative !
11032/// let result = hub.organizations().set_iam_policy(req, "resource")
11033///              .doit().await;
11034/// # }
11035/// ```
11036pub struct OrganizationSetIamPolicyCall<'a, C>
11037where
11038    C: 'a,
11039{
11040    hub: &'a CloudResourceManager<C>,
11041    _request: SetIamPolicyRequest,
11042    _resource: String,
11043    _delegate: Option<&'a mut dyn common::Delegate>,
11044    _additional_params: HashMap<String, String>,
11045    _scopes: BTreeSet<String>,
11046}
11047
11048impl<'a, C> common::CallBuilder for OrganizationSetIamPolicyCall<'a, C> {}
11049
11050impl<'a, C> OrganizationSetIamPolicyCall<'a, C>
11051where
11052    C: common::Connector,
11053{
11054    /// Perform the operation you have build so far.
11055    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
11056        use std::borrow::Cow;
11057        use std::io::{Read, Seek};
11058
11059        use common::{url::Params, ToParts};
11060        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11061
11062        let mut dd = common::DefaultDelegate;
11063        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11064        dlg.begin(common::MethodInfo {
11065            id: "cloudresourcemanager.organizations.setIamPolicy",
11066            http_method: hyper::Method::POST,
11067        });
11068
11069        for &field in ["alt", "resource"].iter() {
11070            if self._additional_params.contains_key(field) {
11071                dlg.finished(false);
11072                return Err(common::Error::FieldClash(field));
11073            }
11074        }
11075
11076        let mut params = Params::with_capacity(4 + self._additional_params.len());
11077        params.push("resource", self._resource);
11078
11079        params.extend(self._additional_params.iter());
11080
11081        params.push("alt", "json");
11082        let mut url = self.hub._base_url.clone() + "v3/{+resource}:setIamPolicy";
11083        if self._scopes.is_empty() {
11084            self._scopes
11085                .insert(Scope::CloudPlatform.as_ref().to_string());
11086        }
11087
11088        #[allow(clippy::single_element_loop)]
11089        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11090            url = params.uri_replacement(url, param_name, find_this, true);
11091        }
11092        {
11093            let to_remove = ["resource"];
11094            params.remove_params(&to_remove);
11095        }
11096
11097        let url = params.parse_with_url(&url);
11098
11099        let mut json_mime_type = mime::APPLICATION_JSON;
11100        let mut request_value_reader = {
11101            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11102            common::remove_json_null_values(&mut value);
11103            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11104            serde_json::to_writer(&mut dst, &value).unwrap();
11105            dst
11106        };
11107        let request_size = request_value_reader
11108            .seek(std::io::SeekFrom::End(0))
11109            .unwrap();
11110        request_value_reader
11111            .seek(std::io::SeekFrom::Start(0))
11112            .unwrap();
11113
11114        loop {
11115            let token = match self
11116                .hub
11117                .auth
11118                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11119                .await
11120            {
11121                Ok(token) => token,
11122                Err(e) => match dlg.token(e) {
11123                    Ok(token) => token,
11124                    Err(e) => {
11125                        dlg.finished(false);
11126                        return Err(common::Error::MissingToken(e));
11127                    }
11128                },
11129            };
11130            request_value_reader
11131                .seek(std::io::SeekFrom::Start(0))
11132                .unwrap();
11133            let mut req_result = {
11134                let client = &self.hub.client;
11135                dlg.pre_request();
11136                let mut req_builder = hyper::Request::builder()
11137                    .method(hyper::Method::POST)
11138                    .uri(url.as_str())
11139                    .header(USER_AGENT, self.hub._user_agent.clone());
11140
11141                if let Some(token) = token.as_ref() {
11142                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11143                }
11144
11145                let request = req_builder
11146                    .header(CONTENT_TYPE, json_mime_type.to_string())
11147                    .header(CONTENT_LENGTH, request_size as u64)
11148                    .body(common::to_body(
11149                        request_value_reader.get_ref().clone().into(),
11150                    ));
11151
11152                client.request(request.unwrap()).await
11153            };
11154
11155            match req_result {
11156                Err(err) => {
11157                    if let common::Retry::After(d) = dlg.http_error(&err) {
11158                        sleep(d).await;
11159                        continue;
11160                    }
11161                    dlg.finished(false);
11162                    return Err(common::Error::HttpError(err));
11163                }
11164                Ok(res) => {
11165                    let (mut parts, body) = res.into_parts();
11166                    let mut body = common::Body::new(body);
11167                    if !parts.status.is_success() {
11168                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11169                        let error = serde_json::from_str(&common::to_string(&bytes));
11170                        let response = common::to_response(parts, bytes.into());
11171
11172                        if let common::Retry::After(d) =
11173                            dlg.http_failure(&response, error.as_ref().ok())
11174                        {
11175                            sleep(d).await;
11176                            continue;
11177                        }
11178
11179                        dlg.finished(false);
11180
11181                        return Err(match error {
11182                            Ok(value) => common::Error::BadRequest(value),
11183                            _ => common::Error::Failure(response),
11184                        });
11185                    }
11186                    let response = {
11187                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11188                        let encoded = common::to_string(&bytes);
11189                        match serde_json::from_str(&encoded) {
11190                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11191                            Err(error) => {
11192                                dlg.response_json_decode_error(&encoded, &error);
11193                                return Err(common::Error::JsonDecodeError(
11194                                    encoded.to_string(),
11195                                    error,
11196                                ));
11197                            }
11198                        }
11199                    };
11200
11201                    dlg.finished(true);
11202                    return Ok(response);
11203                }
11204            }
11205        }
11206    }
11207
11208    ///
11209    /// Sets the *request* property to the given value.
11210    ///
11211    /// Even though the property as already been set when instantiating this call,
11212    /// we provide this method for API completeness.
11213    pub fn request(
11214        mut self,
11215        new_value: SetIamPolicyRequest,
11216    ) -> OrganizationSetIamPolicyCall<'a, C> {
11217        self._request = new_value;
11218        self
11219    }
11220    /// 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.
11221    ///
11222    /// Sets the *resource* path property to the given value.
11223    ///
11224    /// Even though the property as already been set when instantiating this call,
11225    /// we provide this method for API completeness.
11226    pub fn resource(mut self, new_value: &str) -> OrganizationSetIamPolicyCall<'a, C> {
11227        self._resource = new_value.to_string();
11228        self
11229    }
11230    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11231    /// while executing the actual API request.
11232    ///
11233    /// ````text
11234    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11235    /// ````
11236    ///
11237    /// Sets the *delegate* property to the given value.
11238    pub fn delegate(
11239        mut self,
11240        new_value: &'a mut dyn common::Delegate,
11241    ) -> OrganizationSetIamPolicyCall<'a, C> {
11242        self._delegate = Some(new_value);
11243        self
11244    }
11245
11246    /// Set any additional parameter of the query string used in the request.
11247    /// It should be used to set parameters which are not yet available through their own
11248    /// setters.
11249    ///
11250    /// Please note that this method must not be used to set any of the known parameters
11251    /// which have their own setter method. If done anyway, the request will fail.
11252    ///
11253    /// # Additional Parameters
11254    ///
11255    /// * *$.xgafv* (query-string) - V1 error format.
11256    /// * *access_token* (query-string) - OAuth access token.
11257    /// * *alt* (query-string) - Data format for response.
11258    /// * *callback* (query-string) - JSONP
11259    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11260    /// * *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.
11261    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11262    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11263    /// * *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.
11264    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11265    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11266    pub fn param<T>(mut self, name: T, value: T) -> OrganizationSetIamPolicyCall<'a, C>
11267    where
11268        T: AsRef<str>,
11269    {
11270        self._additional_params
11271            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11272        self
11273    }
11274
11275    /// Identifies the authorization scope for the method you are building.
11276    ///
11277    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11278    /// [`Scope::CloudPlatform`].
11279    ///
11280    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11281    /// tokens for more than one scope.
11282    ///
11283    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11284    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11285    /// sufficient, a read-write scope will do as well.
11286    pub fn add_scope<St>(mut self, scope: St) -> OrganizationSetIamPolicyCall<'a, C>
11287    where
11288        St: AsRef<str>,
11289    {
11290        self._scopes.insert(String::from(scope.as_ref()));
11291        self
11292    }
11293    /// Identifies the authorization scope(s) for the method you are building.
11294    ///
11295    /// See [`Self::add_scope()`] for details.
11296    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationSetIamPolicyCall<'a, C>
11297    where
11298        I: IntoIterator<Item = St>,
11299        St: AsRef<str>,
11300    {
11301        self._scopes
11302            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11303        self
11304    }
11305
11306    /// Removes all scopes, and no default scope will be used either.
11307    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11308    /// for details).
11309    pub fn clear_scopes(mut self) -> OrganizationSetIamPolicyCall<'a, C> {
11310        self._scopes.clear();
11311        self
11312    }
11313}
11314
11315/// Returns the permissions that a caller has on the specified organization. The `resource` field should be the organization's resource name, for example: "organizations/123". There are no permissions required for making this API call.
11316///
11317/// A builder for the *testIamPermissions* method supported by a *organization* resource.
11318/// It is not used directly, but through a [`OrganizationMethods`] instance.
11319///
11320/// # Example
11321///
11322/// Instantiate a resource method builder
11323///
11324/// ```test_harness,no_run
11325/// # extern crate hyper;
11326/// # extern crate hyper_rustls;
11327/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
11328/// use cloudresourcemanager3::api::TestIamPermissionsRequest;
11329/// # async fn dox() {
11330/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11331///
11332/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11333/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11334/// #     .with_native_roots()
11335/// #     .unwrap()
11336/// #     .https_only()
11337/// #     .enable_http2()
11338/// #     .build();
11339///
11340/// # let executor = hyper_util::rt::TokioExecutor::new();
11341/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11342/// #     secret,
11343/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11344/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11345/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11346/// #     ),
11347/// # ).build().await.unwrap();
11348///
11349/// # let client = hyper_util::client::legacy::Client::builder(
11350/// #     hyper_util::rt::TokioExecutor::new()
11351/// # )
11352/// # .build(
11353/// #     hyper_rustls::HttpsConnectorBuilder::new()
11354/// #         .with_native_roots()
11355/// #         .unwrap()
11356/// #         .https_or_http()
11357/// #         .enable_http2()
11358/// #         .build()
11359/// # );
11360/// # let mut hub = CloudResourceManager::new(client, auth);
11361/// // As the method needs a request, you would usually fill it with the desired information
11362/// // into the respective structure. Some of the parts shown here might not be applicable !
11363/// // Values shown here are possibly random and not representative !
11364/// let mut req = TestIamPermissionsRequest::default();
11365///
11366/// // You can configure optional parameters by calling the respective setters at will, and
11367/// // execute the final call using `doit()`.
11368/// // Values shown here are possibly random and not representative !
11369/// let result = hub.organizations().test_iam_permissions(req, "resource")
11370///              .doit().await;
11371/// # }
11372/// ```
11373pub struct OrganizationTestIamPermissionCall<'a, C>
11374where
11375    C: 'a,
11376{
11377    hub: &'a CloudResourceManager<C>,
11378    _request: TestIamPermissionsRequest,
11379    _resource: String,
11380    _delegate: Option<&'a mut dyn common::Delegate>,
11381    _additional_params: HashMap<String, String>,
11382    _scopes: BTreeSet<String>,
11383}
11384
11385impl<'a, C> common::CallBuilder for OrganizationTestIamPermissionCall<'a, C> {}
11386
11387impl<'a, C> OrganizationTestIamPermissionCall<'a, C>
11388where
11389    C: common::Connector,
11390{
11391    /// Perform the operation you have build so far.
11392    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
11393        use std::borrow::Cow;
11394        use std::io::{Read, Seek};
11395
11396        use common::{url::Params, ToParts};
11397        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11398
11399        let mut dd = common::DefaultDelegate;
11400        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11401        dlg.begin(common::MethodInfo {
11402            id: "cloudresourcemanager.organizations.testIamPermissions",
11403            http_method: hyper::Method::POST,
11404        });
11405
11406        for &field in ["alt", "resource"].iter() {
11407            if self._additional_params.contains_key(field) {
11408                dlg.finished(false);
11409                return Err(common::Error::FieldClash(field));
11410            }
11411        }
11412
11413        let mut params = Params::with_capacity(4 + self._additional_params.len());
11414        params.push("resource", self._resource);
11415
11416        params.extend(self._additional_params.iter());
11417
11418        params.push("alt", "json");
11419        let mut url = self.hub._base_url.clone() + "v3/{+resource}:testIamPermissions";
11420        if self._scopes.is_empty() {
11421            self._scopes
11422                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
11423        }
11424
11425        #[allow(clippy::single_element_loop)]
11426        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
11427            url = params.uri_replacement(url, param_name, find_this, true);
11428        }
11429        {
11430            let to_remove = ["resource"];
11431            params.remove_params(&to_remove);
11432        }
11433
11434        let url = params.parse_with_url(&url);
11435
11436        let mut json_mime_type = mime::APPLICATION_JSON;
11437        let mut request_value_reader = {
11438            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11439            common::remove_json_null_values(&mut value);
11440            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11441            serde_json::to_writer(&mut dst, &value).unwrap();
11442            dst
11443        };
11444        let request_size = request_value_reader
11445            .seek(std::io::SeekFrom::End(0))
11446            .unwrap();
11447        request_value_reader
11448            .seek(std::io::SeekFrom::Start(0))
11449            .unwrap();
11450
11451        loop {
11452            let token = match self
11453                .hub
11454                .auth
11455                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11456                .await
11457            {
11458                Ok(token) => token,
11459                Err(e) => match dlg.token(e) {
11460                    Ok(token) => token,
11461                    Err(e) => {
11462                        dlg.finished(false);
11463                        return Err(common::Error::MissingToken(e));
11464                    }
11465                },
11466            };
11467            request_value_reader
11468                .seek(std::io::SeekFrom::Start(0))
11469                .unwrap();
11470            let mut req_result = {
11471                let client = &self.hub.client;
11472                dlg.pre_request();
11473                let mut req_builder = hyper::Request::builder()
11474                    .method(hyper::Method::POST)
11475                    .uri(url.as_str())
11476                    .header(USER_AGENT, self.hub._user_agent.clone());
11477
11478                if let Some(token) = token.as_ref() {
11479                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11480                }
11481
11482                let request = req_builder
11483                    .header(CONTENT_TYPE, json_mime_type.to_string())
11484                    .header(CONTENT_LENGTH, request_size as u64)
11485                    .body(common::to_body(
11486                        request_value_reader.get_ref().clone().into(),
11487                    ));
11488
11489                client.request(request.unwrap()).await
11490            };
11491
11492            match req_result {
11493                Err(err) => {
11494                    if let common::Retry::After(d) = dlg.http_error(&err) {
11495                        sleep(d).await;
11496                        continue;
11497                    }
11498                    dlg.finished(false);
11499                    return Err(common::Error::HttpError(err));
11500                }
11501                Ok(res) => {
11502                    let (mut parts, body) = res.into_parts();
11503                    let mut body = common::Body::new(body);
11504                    if !parts.status.is_success() {
11505                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11506                        let error = serde_json::from_str(&common::to_string(&bytes));
11507                        let response = common::to_response(parts, bytes.into());
11508
11509                        if let common::Retry::After(d) =
11510                            dlg.http_failure(&response, error.as_ref().ok())
11511                        {
11512                            sleep(d).await;
11513                            continue;
11514                        }
11515
11516                        dlg.finished(false);
11517
11518                        return Err(match error {
11519                            Ok(value) => common::Error::BadRequest(value),
11520                            _ => common::Error::Failure(response),
11521                        });
11522                    }
11523                    let response = {
11524                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11525                        let encoded = common::to_string(&bytes);
11526                        match serde_json::from_str(&encoded) {
11527                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11528                            Err(error) => {
11529                                dlg.response_json_decode_error(&encoded, &error);
11530                                return Err(common::Error::JsonDecodeError(
11531                                    encoded.to_string(),
11532                                    error,
11533                                ));
11534                            }
11535                        }
11536                    };
11537
11538                    dlg.finished(true);
11539                    return Ok(response);
11540                }
11541            }
11542        }
11543    }
11544
11545    ///
11546    /// Sets the *request* property to the given value.
11547    ///
11548    /// Even though the property as already been set when instantiating this call,
11549    /// we provide this method for API completeness.
11550    pub fn request(
11551        mut self,
11552        new_value: TestIamPermissionsRequest,
11553    ) -> OrganizationTestIamPermissionCall<'a, C> {
11554        self._request = new_value;
11555        self
11556    }
11557    /// 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.
11558    ///
11559    /// Sets the *resource* path property to the given value.
11560    ///
11561    /// Even though the property as already been set when instantiating this call,
11562    /// we provide this method for API completeness.
11563    pub fn resource(mut self, new_value: &str) -> OrganizationTestIamPermissionCall<'a, C> {
11564        self._resource = new_value.to_string();
11565        self
11566    }
11567    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11568    /// while executing the actual API request.
11569    ///
11570    /// ````text
11571    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11572    /// ````
11573    ///
11574    /// Sets the *delegate* property to the given value.
11575    pub fn delegate(
11576        mut self,
11577        new_value: &'a mut dyn common::Delegate,
11578    ) -> OrganizationTestIamPermissionCall<'a, C> {
11579        self._delegate = Some(new_value);
11580        self
11581    }
11582
11583    /// Set any additional parameter of the query string used in the request.
11584    /// It should be used to set parameters which are not yet available through their own
11585    /// setters.
11586    ///
11587    /// Please note that this method must not be used to set any of the known parameters
11588    /// which have their own setter method. If done anyway, the request will fail.
11589    ///
11590    /// # Additional Parameters
11591    ///
11592    /// * *$.xgafv* (query-string) - V1 error format.
11593    /// * *access_token* (query-string) - OAuth access token.
11594    /// * *alt* (query-string) - Data format for response.
11595    /// * *callback* (query-string) - JSONP
11596    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11597    /// * *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.
11598    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11599    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11600    /// * *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.
11601    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11602    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11603    pub fn param<T>(mut self, name: T, value: T) -> OrganizationTestIamPermissionCall<'a, C>
11604    where
11605        T: AsRef<str>,
11606    {
11607        self._additional_params
11608            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11609        self
11610    }
11611
11612    /// Identifies the authorization scope for the method you are building.
11613    ///
11614    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11615    /// [`Scope::CloudPlatformReadOnly`].
11616    ///
11617    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11618    /// tokens for more than one scope.
11619    ///
11620    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11621    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11622    /// sufficient, a read-write scope will do as well.
11623    pub fn add_scope<St>(mut self, scope: St) -> OrganizationTestIamPermissionCall<'a, C>
11624    where
11625        St: AsRef<str>,
11626    {
11627        self._scopes.insert(String::from(scope.as_ref()));
11628        self
11629    }
11630    /// Identifies the authorization scope(s) for the method you are building.
11631    ///
11632    /// See [`Self::add_scope()`] for details.
11633    pub fn add_scopes<I, St>(mut self, scopes: I) -> OrganizationTestIamPermissionCall<'a, C>
11634    where
11635        I: IntoIterator<Item = St>,
11636        St: AsRef<str>,
11637    {
11638        self._scopes
11639            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11640        self
11641    }
11642
11643    /// Removes all scopes, and no default scope will be used either.
11644    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11645    /// for details).
11646    pub fn clear_scopes(mut self) -> OrganizationTestIamPermissionCall<'a, C> {
11647        self._scopes.clear();
11648        self
11649    }
11650}
11651
11652/// Request that a new project be created. The result is an `Operation` which can be used to track the creation process. This process usually takes a few seconds, but can sometimes take much longer. The tracking `Operation` is automatically deleted after a few hours, so there is no need to call `DeleteOperation`.
11653///
11654/// A builder for the *create* method supported by a *project* resource.
11655/// It is not used directly, but through a [`ProjectMethods`] instance.
11656///
11657/// # Example
11658///
11659/// Instantiate a resource method builder
11660///
11661/// ```test_harness,no_run
11662/// # extern crate hyper;
11663/// # extern crate hyper_rustls;
11664/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
11665/// use cloudresourcemanager3::api::Project;
11666/// # async fn dox() {
11667/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11668///
11669/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11670/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11671/// #     .with_native_roots()
11672/// #     .unwrap()
11673/// #     .https_only()
11674/// #     .enable_http2()
11675/// #     .build();
11676///
11677/// # let executor = hyper_util::rt::TokioExecutor::new();
11678/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11679/// #     secret,
11680/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11681/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11682/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11683/// #     ),
11684/// # ).build().await.unwrap();
11685///
11686/// # let client = hyper_util::client::legacy::Client::builder(
11687/// #     hyper_util::rt::TokioExecutor::new()
11688/// # )
11689/// # .build(
11690/// #     hyper_rustls::HttpsConnectorBuilder::new()
11691/// #         .with_native_roots()
11692/// #         .unwrap()
11693/// #         .https_or_http()
11694/// #         .enable_http2()
11695/// #         .build()
11696/// # );
11697/// # let mut hub = CloudResourceManager::new(client, auth);
11698/// // As the method needs a request, you would usually fill it with the desired information
11699/// // into the respective structure. Some of the parts shown here might not be applicable !
11700/// // Values shown here are possibly random and not representative !
11701/// let mut req = Project::default();
11702///
11703/// // You can configure optional parameters by calling the respective setters at will, and
11704/// // execute the final call using `doit()`.
11705/// // Values shown here are possibly random and not representative !
11706/// let result = hub.projects().create(req)
11707///              .doit().await;
11708/// # }
11709/// ```
11710pub struct ProjectCreateCall<'a, C>
11711where
11712    C: 'a,
11713{
11714    hub: &'a CloudResourceManager<C>,
11715    _request: Project,
11716    _delegate: Option<&'a mut dyn common::Delegate>,
11717    _additional_params: HashMap<String, String>,
11718    _scopes: BTreeSet<String>,
11719}
11720
11721impl<'a, C> common::CallBuilder for ProjectCreateCall<'a, C> {}
11722
11723impl<'a, C> ProjectCreateCall<'a, C>
11724where
11725    C: common::Connector,
11726{
11727    /// Perform the operation you have build so far.
11728    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11729        use std::borrow::Cow;
11730        use std::io::{Read, Seek};
11731
11732        use common::{url::Params, ToParts};
11733        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11734
11735        let mut dd = common::DefaultDelegate;
11736        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11737        dlg.begin(common::MethodInfo {
11738            id: "cloudresourcemanager.projects.create",
11739            http_method: hyper::Method::POST,
11740        });
11741
11742        for &field in ["alt"].iter() {
11743            if self._additional_params.contains_key(field) {
11744                dlg.finished(false);
11745                return Err(common::Error::FieldClash(field));
11746            }
11747        }
11748
11749        let mut params = Params::with_capacity(3 + self._additional_params.len());
11750
11751        params.extend(self._additional_params.iter());
11752
11753        params.push("alt", "json");
11754        let mut url = self.hub._base_url.clone() + "v3/projects";
11755        if self._scopes.is_empty() {
11756            self._scopes
11757                .insert(Scope::CloudPlatform.as_ref().to_string());
11758        }
11759
11760        let url = params.parse_with_url(&url);
11761
11762        let mut json_mime_type = mime::APPLICATION_JSON;
11763        let mut request_value_reader = {
11764            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11765            common::remove_json_null_values(&mut value);
11766            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11767            serde_json::to_writer(&mut dst, &value).unwrap();
11768            dst
11769        };
11770        let request_size = request_value_reader
11771            .seek(std::io::SeekFrom::End(0))
11772            .unwrap();
11773        request_value_reader
11774            .seek(std::io::SeekFrom::Start(0))
11775            .unwrap();
11776
11777        loop {
11778            let token = match self
11779                .hub
11780                .auth
11781                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11782                .await
11783            {
11784                Ok(token) => token,
11785                Err(e) => match dlg.token(e) {
11786                    Ok(token) => token,
11787                    Err(e) => {
11788                        dlg.finished(false);
11789                        return Err(common::Error::MissingToken(e));
11790                    }
11791                },
11792            };
11793            request_value_reader
11794                .seek(std::io::SeekFrom::Start(0))
11795                .unwrap();
11796            let mut req_result = {
11797                let client = &self.hub.client;
11798                dlg.pre_request();
11799                let mut req_builder = hyper::Request::builder()
11800                    .method(hyper::Method::POST)
11801                    .uri(url.as_str())
11802                    .header(USER_AGENT, self.hub._user_agent.clone());
11803
11804                if let Some(token) = token.as_ref() {
11805                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11806                }
11807
11808                let request = req_builder
11809                    .header(CONTENT_TYPE, json_mime_type.to_string())
11810                    .header(CONTENT_LENGTH, request_size as u64)
11811                    .body(common::to_body(
11812                        request_value_reader.get_ref().clone().into(),
11813                    ));
11814
11815                client.request(request.unwrap()).await
11816            };
11817
11818            match req_result {
11819                Err(err) => {
11820                    if let common::Retry::After(d) = dlg.http_error(&err) {
11821                        sleep(d).await;
11822                        continue;
11823                    }
11824                    dlg.finished(false);
11825                    return Err(common::Error::HttpError(err));
11826                }
11827                Ok(res) => {
11828                    let (mut parts, body) = res.into_parts();
11829                    let mut body = common::Body::new(body);
11830                    if !parts.status.is_success() {
11831                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11832                        let error = serde_json::from_str(&common::to_string(&bytes));
11833                        let response = common::to_response(parts, bytes.into());
11834
11835                        if let common::Retry::After(d) =
11836                            dlg.http_failure(&response, error.as_ref().ok())
11837                        {
11838                            sleep(d).await;
11839                            continue;
11840                        }
11841
11842                        dlg.finished(false);
11843
11844                        return Err(match error {
11845                            Ok(value) => common::Error::BadRequest(value),
11846                            _ => common::Error::Failure(response),
11847                        });
11848                    }
11849                    let response = {
11850                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11851                        let encoded = common::to_string(&bytes);
11852                        match serde_json::from_str(&encoded) {
11853                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11854                            Err(error) => {
11855                                dlg.response_json_decode_error(&encoded, &error);
11856                                return Err(common::Error::JsonDecodeError(
11857                                    encoded.to_string(),
11858                                    error,
11859                                ));
11860                            }
11861                        }
11862                    };
11863
11864                    dlg.finished(true);
11865                    return Ok(response);
11866                }
11867            }
11868        }
11869    }
11870
11871    ///
11872    /// Sets the *request* property to the given value.
11873    ///
11874    /// Even though the property as already been set when instantiating this call,
11875    /// we provide this method for API completeness.
11876    pub fn request(mut self, new_value: Project) -> ProjectCreateCall<'a, C> {
11877        self._request = new_value;
11878        self
11879    }
11880    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11881    /// while executing the actual API request.
11882    ///
11883    /// ````text
11884    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11885    /// ````
11886    ///
11887    /// Sets the *delegate* property to the given value.
11888    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectCreateCall<'a, C> {
11889        self._delegate = Some(new_value);
11890        self
11891    }
11892
11893    /// Set any additional parameter of the query string used in the request.
11894    /// It should be used to set parameters which are not yet available through their own
11895    /// setters.
11896    ///
11897    /// Please note that this method must not be used to set any of the known parameters
11898    /// which have their own setter method. If done anyway, the request will fail.
11899    ///
11900    /// # Additional Parameters
11901    ///
11902    /// * *$.xgafv* (query-string) - V1 error format.
11903    /// * *access_token* (query-string) - OAuth access token.
11904    /// * *alt* (query-string) - Data format for response.
11905    /// * *callback* (query-string) - JSONP
11906    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11907    /// * *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.
11908    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11909    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11910    /// * *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.
11911    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11912    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11913    pub fn param<T>(mut self, name: T, value: T) -> ProjectCreateCall<'a, C>
11914    where
11915        T: AsRef<str>,
11916    {
11917        self._additional_params
11918            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11919        self
11920    }
11921
11922    /// Identifies the authorization scope for the method you are building.
11923    ///
11924    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11925    /// [`Scope::CloudPlatform`].
11926    ///
11927    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11928    /// tokens for more than one scope.
11929    ///
11930    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11931    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11932    /// sufficient, a read-write scope will do as well.
11933    pub fn add_scope<St>(mut self, scope: St) -> ProjectCreateCall<'a, C>
11934    where
11935        St: AsRef<str>,
11936    {
11937        self._scopes.insert(String::from(scope.as_ref()));
11938        self
11939    }
11940    /// Identifies the authorization scope(s) for the method you are building.
11941    ///
11942    /// See [`Self::add_scope()`] for details.
11943    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectCreateCall<'a, C>
11944    where
11945        I: IntoIterator<Item = St>,
11946        St: AsRef<str>,
11947    {
11948        self._scopes
11949            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11950        self
11951    }
11952
11953    /// Removes all scopes, and no default scope will be used either.
11954    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11955    /// for details).
11956    pub fn clear_scopes(mut self) -> ProjectCreateCall<'a, C> {
11957        self._scopes.clear();
11958        self
11959    }
11960}
11961
11962/// Marks the project identified by the specified `name` (for example, `projects/415104041262`) 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, ListProjects, and SearchProjects methods. The caller must have `resourcemanager.projects.delete` permissions for this project.
11963///
11964/// A builder for the *delete* method supported by a *project* resource.
11965/// It is not used directly, but through a [`ProjectMethods`] instance.
11966///
11967/// # Example
11968///
11969/// Instantiate a resource method builder
11970///
11971/// ```test_harness,no_run
11972/// # extern crate hyper;
11973/// # extern crate hyper_rustls;
11974/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
11975/// # async fn dox() {
11976/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11977///
11978/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11979/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11980/// #     .with_native_roots()
11981/// #     .unwrap()
11982/// #     .https_only()
11983/// #     .enable_http2()
11984/// #     .build();
11985///
11986/// # let executor = hyper_util::rt::TokioExecutor::new();
11987/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11988/// #     secret,
11989/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11990/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
11991/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
11992/// #     ),
11993/// # ).build().await.unwrap();
11994///
11995/// # let client = hyper_util::client::legacy::Client::builder(
11996/// #     hyper_util::rt::TokioExecutor::new()
11997/// # )
11998/// # .build(
11999/// #     hyper_rustls::HttpsConnectorBuilder::new()
12000/// #         .with_native_roots()
12001/// #         .unwrap()
12002/// #         .https_or_http()
12003/// #         .enable_http2()
12004/// #         .build()
12005/// # );
12006/// # let mut hub = CloudResourceManager::new(client, auth);
12007/// // You can configure optional parameters by calling the respective setters at will, and
12008/// // execute the final call using `doit()`.
12009/// // Values shown here are possibly random and not representative !
12010/// let result = hub.projects().delete("name")
12011///              .doit().await;
12012/// # }
12013/// ```
12014pub struct ProjectDeleteCall<'a, C>
12015where
12016    C: 'a,
12017{
12018    hub: &'a CloudResourceManager<C>,
12019    _name: String,
12020    _delegate: Option<&'a mut dyn common::Delegate>,
12021    _additional_params: HashMap<String, String>,
12022    _scopes: BTreeSet<String>,
12023}
12024
12025impl<'a, C> common::CallBuilder for ProjectDeleteCall<'a, C> {}
12026
12027impl<'a, C> ProjectDeleteCall<'a, C>
12028where
12029    C: common::Connector,
12030{
12031    /// Perform the operation you have build so far.
12032    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12033        use std::borrow::Cow;
12034        use std::io::{Read, Seek};
12035
12036        use common::{url::Params, ToParts};
12037        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12038
12039        let mut dd = common::DefaultDelegate;
12040        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12041        dlg.begin(common::MethodInfo {
12042            id: "cloudresourcemanager.projects.delete",
12043            http_method: hyper::Method::DELETE,
12044        });
12045
12046        for &field in ["alt", "name"].iter() {
12047            if self._additional_params.contains_key(field) {
12048                dlg.finished(false);
12049                return Err(common::Error::FieldClash(field));
12050            }
12051        }
12052
12053        let mut params = Params::with_capacity(3 + self._additional_params.len());
12054        params.push("name", self._name);
12055
12056        params.extend(self._additional_params.iter());
12057
12058        params.push("alt", "json");
12059        let mut url = self.hub._base_url.clone() + "v3/{+name}";
12060        if self._scopes.is_empty() {
12061            self._scopes
12062                .insert(Scope::CloudPlatform.as_ref().to_string());
12063        }
12064
12065        #[allow(clippy::single_element_loop)]
12066        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12067            url = params.uri_replacement(url, param_name, find_this, true);
12068        }
12069        {
12070            let to_remove = ["name"];
12071            params.remove_params(&to_remove);
12072        }
12073
12074        let url = params.parse_with_url(&url);
12075
12076        loop {
12077            let token = match self
12078                .hub
12079                .auth
12080                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12081                .await
12082            {
12083                Ok(token) => token,
12084                Err(e) => match dlg.token(e) {
12085                    Ok(token) => token,
12086                    Err(e) => {
12087                        dlg.finished(false);
12088                        return Err(common::Error::MissingToken(e));
12089                    }
12090                },
12091            };
12092            let mut req_result = {
12093                let client = &self.hub.client;
12094                dlg.pre_request();
12095                let mut req_builder = hyper::Request::builder()
12096                    .method(hyper::Method::DELETE)
12097                    .uri(url.as_str())
12098                    .header(USER_AGENT, self.hub._user_agent.clone());
12099
12100                if let Some(token) = token.as_ref() {
12101                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12102                }
12103
12104                let request = req_builder
12105                    .header(CONTENT_LENGTH, 0_u64)
12106                    .body(common::to_body::<String>(None));
12107
12108                client.request(request.unwrap()).await
12109            };
12110
12111            match req_result {
12112                Err(err) => {
12113                    if let common::Retry::After(d) = dlg.http_error(&err) {
12114                        sleep(d).await;
12115                        continue;
12116                    }
12117                    dlg.finished(false);
12118                    return Err(common::Error::HttpError(err));
12119                }
12120                Ok(res) => {
12121                    let (mut parts, body) = res.into_parts();
12122                    let mut body = common::Body::new(body);
12123                    if !parts.status.is_success() {
12124                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12125                        let error = serde_json::from_str(&common::to_string(&bytes));
12126                        let response = common::to_response(parts, bytes.into());
12127
12128                        if let common::Retry::After(d) =
12129                            dlg.http_failure(&response, error.as_ref().ok())
12130                        {
12131                            sleep(d).await;
12132                            continue;
12133                        }
12134
12135                        dlg.finished(false);
12136
12137                        return Err(match error {
12138                            Ok(value) => common::Error::BadRequest(value),
12139                            _ => common::Error::Failure(response),
12140                        });
12141                    }
12142                    let response = {
12143                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12144                        let encoded = common::to_string(&bytes);
12145                        match serde_json::from_str(&encoded) {
12146                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12147                            Err(error) => {
12148                                dlg.response_json_decode_error(&encoded, &error);
12149                                return Err(common::Error::JsonDecodeError(
12150                                    encoded.to_string(),
12151                                    error,
12152                                ));
12153                            }
12154                        }
12155                    };
12156
12157                    dlg.finished(true);
12158                    return Ok(response);
12159                }
12160            }
12161        }
12162    }
12163
12164    /// Required. The name of the Project (for example, `projects/415104041262`).
12165    ///
12166    /// Sets the *name* path property to the given value.
12167    ///
12168    /// Even though the property as already been set when instantiating this call,
12169    /// we provide this method for API completeness.
12170    pub fn name(mut self, new_value: &str) -> ProjectDeleteCall<'a, C> {
12171        self._name = new_value.to_string();
12172        self
12173    }
12174    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12175    /// while executing the actual API request.
12176    ///
12177    /// ````text
12178    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12179    /// ````
12180    ///
12181    /// Sets the *delegate* property to the given value.
12182    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectDeleteCall<'a, C> {
12183        self._delegate = Some(new_value);
12184        self
12185    }
12186
12187    /// Set any additional parameter of the query string used in the request.
12188    /// It should be used to set parameters which are not yet available through their own
12189    /// setters.
12190    ///
12191    /// Please note that this method must not be used to set any of the known parameters
12192    /// which have their own setter method. If done anyway, the request will fail.
12193    ///
12194    /// # Additional Parameters
12195    ///
12196    /// * *$.xgafv* (query-string) - V1 error format.
12197    /// * *access_token* (query-string) - OAuth access token.
12198    /// * *alt* (query-string) - Data format for response.
12199    /// * *callback* (query-string) - JSONP
12200    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12201    /// * *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.
12202    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12203    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12204    /// * *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.
12205    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12206    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12207    pub fn param<T>(mut self, name: T, value: T) -> ProjectDeleteCall<'a, C>
12208    where
12209        T: AsRef<str>,
12210    {
12211        self._additional_params
12212            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12213        self
12214    }
12215
12216    /// Identifies the authorization scope for the method you are building.
12217    ///
12218    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12219    /// [`Scope::CloudPlatform`].
12220    ///
12221    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12222    /// tokens for more than one scope.
12223    ///
12224    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12225    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12226    /// sufficient, a read-write scope will do as well.
12227    pub fn add_scope<St>(mut self, scope: St) -> ProjectDeleteCall<'a, C>
12228    where
12229        St: AsRef<str>,
12230    {
12231        self._scopes.insert(String::from(scope.as_ref()));
12232        self
12233    }
12234    /// Identifies the authorization scope(s) for the method you are building.
12235    ///
12236    /// See [`Self::add_scope()`] for details.
12237    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectDeleteCall<'a, C>
12238    where
12239        I: IntoIterator<Item = St>,
12240        St: AsRef<str>,
12241    {
12242        self._scopes
12243            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12244        self
12245    }
12246
12247    /// Removes all scopes, and no default scope will be used either.
12248    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12249    /// for details).
12250    pub fn clear_scopes(mut self) -> ProjectDeleteCall<'a, C> {
12251        self._scopes.clear();
12252        self
12253    }
12254}
12255
12256/// Retrieves the project identified by the specified `name` (for example, `projects/415104041262`). The caller must have `resourcemanager.projects.get` permission for this project.
12257///
12258/// A builder for the *get* method supported by a *project* resource.
12259/// It is not used directly, but through a [`ProjectMethods`] instance.
12260///
12261/// # Example
12262///
12263/// Instantiate a resource method builder
12264///
12265/// ```test_harness,no_run
12266/// # extern crate hyper;
12267/// # extern crate hyper_rustls;
12268/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
12269/// # async fn dox() {
12270/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12271///
12272/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12273/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12274/// #     .with_native_roots()
12275/// #     .unwrap()
12276/// #     .https_only()
12277/// #     .enable_http2()
12278/// #     .build();
12279///
12280/// # let executor = hyper_util::rt::TokioExecutor::new();
12281/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12282/// #     secret,
12283/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12284/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12285/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12286/// #     ),
12287/// # ).build().await.unwrap();
12288///
12289/// # let client = hyper_util::client::legacy::Client::builder(
12290/// #     hyper_util::rt::TokioExecutor::new()
12291/// # )
12292/// # .build(
12293/// #     hyper_rustls::HttpsConnectorBuilder::new()
12294/// #         .with_native_roots()
12295/// #         .unwrap()
12296/// #         .https_or_http()
12297/// #         .enable_http2()
12298/// #         .build()
12299/// # );
12300/// # let mut hub = CloudResourceManager::new(client, auth);
12301/// // You can configure optional parameters by calling the respective setters at will, and
12302/// // execute the final call using `doit()`.
12303/// // Values shown here are possibly random and not representative !
12304/// let result = hub.projects().get("name")
12305///              .doit().await;
12306/// # }
12307/// ```
12308pub struct ProjectGetCall<'a, C>
12309where
12310    C: 'a,
12311{
12312    hub: &'a CloudResourceManager<C>,
12313    _name: String,
12314    _delegate: Option<&'a mut dyn common::Delegate>,
12315    _additional_params: HashMap<String, String>,
12316    _scopes: BTreeSet<String>,
12317}
12318
12319impl<'a, C> common::CallBuilder for ProjectGetCall<'a, C> {}
12320
12321impl<'a, C> ProjectGetCall<'a, C>
12322where
12323    C: common::Connector,
12324{
12325    /// Perform the operation you have build so far.
12326    pub async fn doit(mut self) -> common::Result<(common::Response, Project)> {
12327        use std::borrow::Cow;
12328        use std::io::{Read, Seek};
12329
12330        use common::{url::Params, ToParts};
12331        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12332
12333        let mut dd = common::DefaultDelegate;
12334        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12335        dlg.begin(common::MethodInfo {
12336            id: "cloudresourcemanager.projects.get",
12337            http_method: hyper::Method::GET,
12338        });
12339
12340        for &field in ["alt", "name"].iter() {
12341            if self._additional_params.contains_key(field) {
12342                dlg.finished(false);
12343                return Err(common::Error::FieldClash(field));
12344            }
12345        }
12346
12347        let mut params = Params::with_capacity(3 + self._additional_params.len());
12348        params.push("name", self._name);
12349
12350        params.extend(self._additional_params.iter());
12351
12352        params.push("alt", "json");
12353        let mut url = self.hub._base_url.clone() + "v3/{+name}";
12354        if self._scopes.is_empty() {
12355            self._scopes
12356                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
12357        }
12358
12359        #[allow(clippy::single_element_loop)]
12360        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12361            url = params.uri_replacement(url, param_name, find_this, true);
12362        }
12363        {
12364            let to_remove = ["name"];
12365            params.remove_params(&to_remove);
12366        }
12367
12368        let url = params.parse_with_url(&url);
12369
12370        loop {
12371            let token = match self
12372                .hub
12373                .auth
12374                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12375                .await
12376            {
12377                Ok(token) => token,
12378                Err(e) => match dlg.token(e) {
12379                    Ok(token) => token,
12380                    Err(e) => {
12381                        dlg.finished(false);
12382                        return Err(common::Error::MissingToken(e));
12383                    }
12384                },
12385            };
12386            let mut req_result = {
12387                let client = &self.hub.client;
12388                dlg.pre_request();
12389                let mut req_builder = hyper::Request::builder()
12390                    .method(hyper::Method::GET)
12391                    .uri(url.as_str())
12392                    .header(USER_AGENT, self.hub._user_agent.clone());
12393
12394                if let Some(token) = token.as_ref() {
12395                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12396                }
12397
12398                let request = req_builder
12399                    .header(CONTENT_LENGTH, 0_u64)
12400                    .body(common::to_body::<String>(None));
12401
12402                client.request(request.unwrap()).await
12403            };
12404
12405            match req_result {
12406                Err(err) => {
12407                    if let common::Retry::After(d) = dlg.http_error(&err) {
12408                        sleep(d).await;
12409                        continue;
12410                    }
12411                    dlg.finished(false);
12412                    return Err(common::Error::HttpError(err));
12413                }
12414                Ok(res) => {
12415                    let (mut parts, body) = res.into_parts();
12416                    let mut body = common::Body::new(body);
12417                    if !parts.status.is_success() {
12418                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12419                        let error = serde_json::from_str(&common::to_string(&bytes));
12420                        let response = common::to_response(parts, bytes.into());
12421
12422                        if let common::Retry::After(d) =
12423                            dlg.http_failure(&response, error.as_ref().ok())
12424                        {
12425                            sleep(d).await;
12426                            continue;
12427                        }
12428
12429                        dlg.finished(false);
12430
12431                        return Err(match error {
12432                            Ok(value) => common::Error::BadRequest(value),
12433                            _ => common::Error::Failure(response),
12434                        });
12435                    }
12436                    let response = {
12437                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12438                        let encoded = common::to_string(&bytes);
12439                        match serde_json::from_str(&encoded) {
12440                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12441                            Err(error) => {
12442                                dlg.response_json_decode_error(&encoded, &error);
12443                                return Err(common::Error::JsonDecodeError(
12444                                    encoded.to_string(),
12445                                    error,
12446                                ));
12447                            }
12448                        }
12449                    };
12450
12451                    dlg.finished(true);
12452                    return Ok(response);
12453                }
12454            }
12455        }
12456    }
12457
12458    /// Required. The name of the project (for example, `projects/415104041262`).
12459    ///
12460    /// Sets the *name* path property to the given value.
12461    ///
12462    /// Even though the property as already been set when instantiating this call,
12463    /// we provide this method for API completeness.
12464    pub fn name(mut self, new_value: &str) -> ProjectGetCall<'a, C> {
12465        self._name = new_value.to_string();
12466        self
12467    }
12468    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12469    /// while executing the actual API request.
12470    ///
12471    /// ````text
12472    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12473    /// ````
12474    ///
12475    /// Sets the *delegate* property to the given value.
12476    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectGetCall<'a, C> {
12477        self._delegate = Some(new_value);
12478        self
12479    }
12480
12481    /// Set any additional parameter of the query string used in the request.
12482    /// It should be used to set parameters which are not yet available through their own
12483    /// setters.
12484    ///
12485    /// Please note that this method must not be used to set any of the known parameters
12486    /// which have their own setter method. If done anyway, the request will fail.
12487    ///
12488    /// # Additional Parameters
12489    ///
12490    /// * *$.xgafv* (query-string) - V1 error format.
12491    /// * *access_token* (query-string) - OAuth access token.
12492    /// * *alt* (query-string) - Data format for response.
12493    /// * *callback* (query-string) - JSONP
12494    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12495    /// * *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.
12496    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12497    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12498    /// * *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.
12499    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12500    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12501    pub fn param<T>(mut self, name: T, value: T) -> ProjectGetCall<'a, C>
12502    where
12503        T: AsRef<str>,
12504    {
12505        self._additional_params
12506            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12507        self
12508    }
12509
12510    /// Identifies the authorization scope for the method you are building.
12511    ///
12512    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12513    /// [`Scope::CloudPlatformReadOnly`].
12514    ///
12515    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12516    /// tokens for more than one scope.
12517    ///
12518    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12519    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12520    /// sufficient, a read-write scope will do as well.
12521    pub fn add_scope<St>(mut self, scope: St) -> ProjectGetCall<'a, C>
12522    where
12523        St: AsRef<str>,
12524    {
12525        self._scopes.insert(String::from(scope.as_ref()));
12526        self
12527    }
12528    /// Identifies the authorization scope(s) for the method you are building.
12529    ///
12530    /// See [`Self::add_scope()`] for details.
12531    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetCall<'a, C>
12532    where
12533        I: IntoIterator<Item = St>,
12534        St: AsRef<str>,
12535    {
12536        self._scopes
12537            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12538        self
12539    }
12540
12541    /// Removes all scopes, and no default scope will be used either.
12542    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12543    /// for details).
12544    pub fn clear_scopes(mut self) -> ProjectGetCall<'a, C> {
12545        self._scopes.clear();
12546        self
12547    }
12548}
12549
12550/// Returns the IAM access control policy for the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123. Permission is denied if the policy or the resource do not exist.
12551///
12552/// A builder for the *getIamPolicy* method supported by a *project* resource.
12553/// It is not used directly, but through a [`ProjectMethods`] instance.
12554///
12555/// # Example
12556///
12557/// Instantiate a resource method builder
12558///
12559/// ```test_harness,no_run
12560/// # extern crate hyper;
12561/// # extern crate hyper_rustls;
12562/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
12563/// use cloudresourcemanager3::api::GetIamPolicyRequest;
12564/// # async fn dox() {
12565/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12566///
12567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12568/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12569/// #     .with_native_roots()
12570/// #     .unwrap()
12571/// #     .https_only()
12572/// #     .enable_http2()
12573/// #     .build();
12574///
12575/// # let executor = hyper_util::rt::TokioExecutor::new();
12576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12577/// #     secret,
12578/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12579/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12580/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12581/// #     ),
12582/// # ).build().await.unwrap();
12583///
12584/// # let client = hyper_util::client::legacy::Client::builder(
12585/// #     hyper_util::rt::TokioExecutor::new()
12586/// # )
12587/// # .build(
12588/// #     hyper_rustls::HttpsConnectorBuilder::new()
12589/// #         .with_native_roots()
12590/// #         .unwrap()
12591/// #         .https_or_http()
12592/// #         .enable_http2()
12593/// #         .build()
12594/// # );
12595/// # let mut hub = CloudResourceManager::new(client, auth);
12596/// // As the method needs a request, you would usually fill it with the desired information
12597/// // into the respective structure. Some of the parts shown here might not be applicable !
12598/// // Values shown here are possibly random and not representative !
12599/// let mut req = GetIamPolicyRequest::default();
12600///
12601/// // You can configure optional parameters by calling the respective setters at will, and
12602/// // execute the final call using `doit()`.
12603/// // Values shown here are possibly random and not representative !
12604/// let result = hub.projects().get_iam_policy(req, "resource")
12605///              .doit().await;
12606/// # }
12607/// ```
12608pub struct ProjectGetIamPolicyCall<'a, C>
12609where
12610    C: 'a,
12611{
12612    hub: &'a CloudResourceManager<C>,
12613    _request: GetIamPolicyRequest,
12614    _resource: String,
12615    _delegate: Option<&'a mut dyn common::Delegate>,
12616    _additional_params: HashMap<String, String>,
12617    _scopes: BTreeSet<String>,
12618}
12619
12620impl<'a, C> common::CallBuilder for ProjectGetIamPolicyCall<'a, C> {}
12621
12622impl<'a, C> ProjectGetIamPolicyCall<'a, C>
12623where
12624    C: common::Connector,
12625{
12626    /// Perform the operation you have build so far.
12627    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
12628        use std::borrow::Cow;
12629        use std::io::{Read, Seek};
12630
12631        use common::{url::Params, ToParts};
12632        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12633
12634        let mut dd = common::DefaultDelegate;
12635        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12636        dlg.begin(common::MethodInfo {
12637            id: "cloudresourcemanager.projects.getIamPolicy",
12638            http_method: hyper::Method::POST,
12639        });
12640
12641        for &field in ["alt", "resource"].iter() {
12642            if self._additional_params.contains_key(field) {
12643                dlg.finished(false);
12644                return Err(common::Error::FieldClash(field));
12645            }
12646        }
12647
12648        let mut params = Params::with_capacity(4 + self._additional_params.len());
12649        params.push("resource", self._resource);
12650
12651        params.extend(self._additional_params.iter());
12652
12653        params.push("alt", "json");
12654        let mut url = self.hub._base_url.clone() + "v3/{+resource}:getIamPolicy";
12655        if self._scopes.is_empty() {
12656            self._scopes
12657                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
12658        }
12659
12660        #[allow(clippy::single_element_loop)]
12661        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
12662            url = params.uri_replacement(url, param_name, find_this, true);
12663        }
12664        {
12665            let to_remove = ["resource"];
12666            params.remove_params(&to_remove);
12667        }
12668
12669        let url = params.parse_with_url(&url);
12670
12671        let mut json_mime_type = mime::APPLICATION_JSON;
12672        let mut request_value_reader = {
12673            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12674            common::remove_json_null_values(&mut value);
12675            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12676            serde_json::to_writer(&mut dst, &value).unwrap();
12677            dst
12678        };
12679        let request_size = request_value_reader
12680            .seek(std::io::SeekFrom::End(0))
12681            .unwrap();
12682        request_value_reader
12683            .seek(std::io::SeekFrom::Start(0))
12684            .unwrap();
12685
12686        loop {
12687            let token = match self
12688                .hub
12689                .auth
12690                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12691                .await
12692            {
12693                Ok(token) => token,
12694                Err(e) => match dlg.token(e) {
12695                    Ok(token) => token,
12696                    Err(e) => {
12697                        dlg.finished(false);
12698                        return Err(common::Error::MissingToken(e));
12699                    }
12700                },
12701            };
12702            request_value_reader
12703                .seek(std::io::SeekFrom::Start(0))
12704                .unwrap();
12705            let mut req_result = {
12706                let client = &self.hub.client;
12707                dlg.pre_request();
12708                let mut req_builder = hyper::Request::builder()
12709                    .method(hyper::Method::POST)
12710                    .uri(url.as_str())
12711                    .header(USER_AGENT, self.hub._user_agent.clone());
12712
12713                if let Some(token) = token.as_ref() {
12714                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12715                }
12716
12717                let request = req_builder
12718                    .header(CONTENT_TYPE, json_mime_type.to_string())
12719                    .header(CONTENT_LENGTH, request_size as u64)
12720                    .body(common::to_body(
12721                        request_value_reader.get_ref().clone().into(),
12722                    ));
12723
12724                client.request(request.unwrap()).await
12725            };
12726
12727            match req_result {
12728                Err(err) => {
12729                    if let common::Retry::After(d) = dlg.http_error(&err) {
12730                        sleep(d).await;
12731                        continue;
12732                    }
12733                    dlg.finished(false);
12734                    return Err(common::Error::HttpError(err));
12735                }
12736                Ok(res) => {
12737                    let (mut parts, body) = res.into_parts();
12738                    let mut body = common::Body::new(body);
12739                    if !parts.status.is_success() {
12740                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12741                        let error = serde_json::from_str(&common::to_string(&bytes));
12742                        let response = common::to_response(parts, bytes.into());
12743
12744                        if let common::Retry::After(d) =
12745                            dlg.http_failure(&response, error.as_ref().ok())
12746                        {
12747                            sleep(d).await;
12748                            continue;
12749                        }
12750
12751                        dlg.finished(false);
12752
12753                        return Err(match error {
12754                            Ok(value) => common::Error::BadRequest(value),
12755                            _ => common::Error::Failure(response),
12756                        });
12757                    }
12758                    let response = {
12759                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12760                        let encoded = common::to_string(&bytes);
12761                        match serde_json::from_str(&encoded) {
12762                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12763                            Err(error) => {
12764                                dlg.response_json_decode_error(&encoded, &error);
12765                                return Err(common::Error::JsonDecodeError(
12766                                    encoded.to_string(),
12767                                    error,
12768                                ));
12769                            }
12770                        }
12771                    };
12772
12773                    dlg.finished(true);
12774                    return Ok(response);
12775                }
12776            }
12777        }
12778    }
12779
12780    ///
12781    /// Sets the *request* property to the given value.
12782    ///
12783    /// Even though the property as already been set when instantiating this call,
12784    /// we provide this method for API completeness.
12785    pub fn request(mut self, new_value: GetIamPolicyRequest) -> ProjectGetIamPolicyCall<'a, C> {
12786        self._request = new_value;
12787        self
12788    }
12789    /// 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.
12790    ///
12791    /// Sets the *resource* path property to the given value.
12792    ///
12793    /// Even though the property as already been set when instantiating this call,
12794    /// we provide this method for API completeness.
12795    pub fn resource(mut self, new_value: &str) -> ProjectGetIamPolicyCall<'a, C> {
12796        self._resource = new_value.to_string();
12797        self
12798    }
12799    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12800    /// while executing the actual API request.
12801    ///
12802    /// ````text
12803    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12804    /// ````
12805    ///
12806    /// Sets the *delegate* property to the given value.
12807    pub fn delegate(
12808        mut self,
12809        new_value: &'a mut dyn common::Delegate,
12810    ) -> ProjectGetIamPolicyCall<'a, C> {
12811        self._delegate = Some(new_value);
12812        self
12813    }
12814
12815    /// Set any additional parameter of the query string used in the request.
12816    /// It should be used to set parameters which are not yet available through their own
12817    /// setters.
12818    ///
12819    /// Please note that this method must not be used to set any of the known parameters
12820    /// which have their own setter method. If done anyway, the request will fail.
12821    ///
12822    /// # Additional Parameters
12823    ///
12824    /// * *$.xgafv* (query-string) - V1 error format.
12825    /// * *access_token* (query-string) - OAuth access token.
12826    /// * *alt* (query-string) - Data format for response.
12827    /// * *callback* (query-string) - JSONP
12828    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12829    /// * *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.
12830    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12831    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12832    /// * *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.
12833    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12834    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12835    pub fn param<T>(mut self, name: T, value: T) -> ProjectGetIamPolicyCall<'a, C>
12836    where
12837        T: AsRef<str>,
12838    {
12839        self._additional_params
12840            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12841        self
12842    }
12843
12844    /// Identifies the authorization scope for the method you are building.
12845    ///
12846    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12847    /// [`Scope::CloudPlatformReadOnly`].
12848    ///
12849    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12850    /// tokens for more than one scope.
12851    ///
12852    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12853    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12854    /// sufficient, a read-write scope will do as well.
12855    pub fn add_scope<St>(mut self, scope: St) -> ProjectGetIamPolicyCall<'a, C>
12856    where
12857        St: AsRef<str>,
12858    {
12859        self._scopes.insert(String::from(scope.as_ref()));
12860        self
12861    }
12862    /// Identifies the authorization scope(s) for the method you are building.
12863    ///
12864    /// See [`Self::add_scope()`] for details.
12865    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectGetIamPolicyCall<'a, C>
12866    where
12867        I: IntoIterator<Item = St>,
12868        St: AsRef<str>,
12869    {
12870        self._scopes
12871            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12872        self
12873    }
12874
12875    /// Removes all scopes, and no default scope will be used either.
12876    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12877    /// for details).
12878    pub fn clear_scopes(mut self) -> ProjectGetIamPolicyCall<'a, C> {
12879        self._scopes.clear();
12880        self
12881    }
12882}
12883
12884/// Lists projects that are direct children of the specified folder or organization resource. `list()` provides a strongly consistent view of the projects underneath the specified parent resource. `list()` returns projects sorted based upon the (ascending) lexical ordering of their `display_name`. The caller must have `resourcemanager.projects.list` permission on the identified parent.
12885///
12886/// A builder for the *list* method supported by a *project* resource.
12887/// It is not used directly, but through a [`ProjectMethods`] instance.
12888///
12889/// # Example
12890///
12891/// Instantiate a resource method builder
12892///
12893/// ```test_harness,no_run
12894/// # extern crate hyper;
12895/// # extern crate hyper_rustls;
12896/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
12897/// # async fn dox() {
12898/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12899///
12900/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12901/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12902/// #     .with_native_roots()
12903/// #     .unwrap()
12904/// #     .https_only()
12905/// #     .enable_http2()
12906/// #     .build();
12907///
12908/// # let executor = hyper_util::rt::TokioExecutor::new();
12909/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12910/// #     secret,
12911/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12912/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
12913/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
12914/// #     ),
12915/// # ).build().await.unwrap();
12916///
12917/// # let client = hyper_util::client::legacy::Client::builder(
12918/// #     hyper_util::rt::TokioExecutor::new()
12919/// # )
12920/// # .build(
12921/// #     hyper_rustls::HttpsConnectorBuilder::new()
12922/// #         .with_native_roots()
12923/// #         .unwrap()
12924/// #         .https_or_http()
12925/// #         .enable_http2()
12926/// #         .build()
12927/// # );
12928/// # let mut hub = CloudResourceManager::new(client, auth);
12929/// // You can configure optional parameters by calling the respective setters at will, and
12930/// // execute the final call using `doit()`.
12931/// // Values shown here are possibly random and not representative !
12932/// let result = hub.projects().list()
12933///              .show_deleted(false)
12934///              .parent("duo")
12935///              .page_token("dolore")
12936///              .page_size(-22)
12937///              .doit().await;
12938/// # }
12939/// ```
12940pub struct ProjectListCall<'a, C>
12941where
12942    C: 'a,
12943{
12944    hub: &'a CloudResourceManager<C>,
12945    _show_deleted: Option<bool>,
12946    _parent: Option<String>,
12947    _page_token: Option<String>,
12948    _page_size: Option<i32>,
12949    _delegate: Option<&'a mut dyn common::Delegate>,
12950    _additional_params: HashMap<String, String>,
12951    _scopes: BTreeSet<String>,
12952}
12953
12954impl<'a, C> common::CallBuilder for ProjectListCall<'a, C> {}
12955
12956impl<'a, C> ProjectListCall<'a, C>
12957where
12958    C: common::Connector,
12959{
12960    /// Perform the operation you have build so far.
12961    pub async fn doit(mut self) -> common::Result<(common::Response, ListProjectsResponse)> {
12962        use std::borrow::Cow;
12963        use std::io::{Read, Seek};
12964
12965        use common::{url::Params, ToParts};
12966        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12967
12968        let mut dd = common::DefaultDelegate;
12969        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12970        dlg.begin(common::MethodInfo {
12971            id: "cloudresourcemanager.projects.list",
12972            http_method: hyper::Method::GET,
12973        });
12974
12975        for &field in ["alt", "showDeleted", "parent", "pageToken", "pageSize"].iter() {
12976            if self._additional_params.contains_key(field) {
12977                dlg.finished(false);
12978                return Err(common::Error::FieldClash(field));
12979            }
12980        }
12981
12982        let mut params = Params::with_capacity(6 + self._additional_params.len());
12983        if let Some(value) = self._show_deleted.as_ref() {
12984            params.push("showDeleted", value.to_string());
12985        }
12986        if let Some(value) = self._parent.as_ref() {
12987            params.push("parent", value);
12988        }
12989        if let Some(value) = self._page_token.as_ref() {
12990            params.push("pageToken", value);
12991        }
12992        if let Some(value) = self._page_size.as_ref() {
12993            params.push("pageSize", value.to_string());
12994        }
12995
12996        params.extend(self._additional_params.iter());
12997
12998        params.push("alt", "json");
12999        let mut url = self.hub._base_url.clone() + "v3/projects";
13000        if self._scopes.is_empty() {
13001            self._scopes
13002                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
13003        }
13004
13005        let url = params.parse_with_url(&url);
13006
13007        loop {
13008            let token = match self
13009                .hub
13010                .auth
13011                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13012                .await
13013            {
13014                Ok(token) => token,
13015                Err(e) => match dlg.token(e) {
13016                    Ok(token) => token,
13017                    Err(e) => {
13018                        dlg.finished(false);
13019                        return Err(common::Error::MissingToken(e));
13020                    }
13021                },
13022            };
13023            let mut req_result = {
13024                let client = &self.hub.client;
13025                dlg.pre_request();
13026                let mut req_builder = hyper::Request::builder()
13027                    .method(hyper::Method::GET)
13028                    .uri(url.as_str())
13029                    .header(USER_AGENT, self.hub._user_agent.clone());
13030
13031                if let Some(token) = token.as_ref() {
13032                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13033                }
13034
13035                let request = req_builder
13036                    .header(CONTENT_LENGTH, 0_u64)
13037                    .body(common::to_body::<String>(None));
13038
13039                client.request(request.unwrap()).await
13040            };
13041
13042            match req_result {
13043                Err(err) => {
13044                    if let common::Retry::After(d) = dlg.http_error(&err) {
13045                        sleep(d).await;
13046                        continue;
13047                    }
13048                    dlg.finished(false);
13049                    return Err(common::Error::HttpError(err));
13050                }
13051                Ok(res) => {
13052                    let (mut parts, body) = res.into_parts();
13053                    let mut body = common::Body::new(body);
13054                    if !parts.status.is_success() {
13055                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13056                        let error = serde_json::from_str(&common::to_string(&bytes));
13057                        let response = common::to_response(parts, bytes.into());
13058
13059                        if let common::Retry::After(d) =
13060                            dlg.http_failure(&response, error.as_ref().ok())
13061                        {
13062                            sleep(d).await;
13063                            continue;
13064                        }
13065
13066                        dlg.finished(false);
13067
13068                        return Err(match error {
13069                            Ok(value) => common::Error::BadRequest(value),
13070                            _ => common::Error::Failure(response),
13071                        });
13072                    }
13073                    let response = {
13074                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13075                        let encoded = common::to_string(&bytes);
13076                        match serde_json::from_str(&encoded) {
13077                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13078                            Err(error) => {
13079                                dlg.response_json_decode_error(&encoded, &error);
13080                                return Err(common::Error::JsonDecodeError(
13081                                    encoded.to_string(),
13082                                    error,
13083                                ));
13084                            }
13085                        }
13086                    };
13087
13088                    dlg.finished(true);
13089                    return Ok(response);
13090                }
13091            }
13092        }
13093    }
13094
13095    /// Optional. Indicate that projects in the `DELETE_REQUESTED` state should also be returned. Normally only `ACTIVE` projects are returned.
13096    ///
13097    /// Sets the *show deleted* query property to the given value.
13098    pub fn show_deleted(mut self, new_value: bool) -> ProjectListCall<'a, C> {
13099        self._show_deleted = Some(new_value);
13100        self
13101    }
13102    /// Required. The name of the parent resource whose projects are being listed. Only children of this parent resource are listed; descendants are not listed. If the parent is a folder, use the value `folders/{folder_id}`. If the parent is an organization, use the value `organizations/{org_id}`.
13103    ///
13104    /// Sets the *parent* query property to the given value.
13105    pub fn parent(mut self, new_value: &str) -> ProjectListCall<'a, C> {
13106        self._parent = Some(new_value.to_string());
13107        self
13108    }
13109    /// Optional. A pagination token returned from a previous call to ListProjects that indicates from where listing should continue.
13110    ///
13111    /// Sets the *page token* query property to the given value.
13112    pub fn page_token(mut self, new_value: &str) -> ProjectListCall<'a, C> {
13113        self._page_token = Some(new_value.to_string());
13114        self
13115    }
13116    /// Optional. 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.
13117    ///
13118    /// Sets the *page size* query property to the given value.
13119    pub fn page_size(mut self, new_value: i32) -> ProjectListCall<'a, C> {
13120        self._page_size = Some(new_value);
13121        self
13122    }
13123    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13124    /// while executing the actual API request.
13125    ///
13126    /// ````text
13127    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13128    /// ````
13129    ///
13130    /// Sets the *delegate* property to the given value.
13131    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectListCall<'a, C> {
13132        self._delegate = Some(new_value);
13133        self
13134    }
13135
13136    /// Set any additional parameter of the query string used in the request.
13137    /// It should be used to set parameters which are not yet available through their own
13138    /// setters.
13139    ///
13140    /// Please note that this method must not be used to set any of the known parameters
13141    /// which have their own setter method. If done anyway, the request will fail.
13142    ///
13143    /// # Additional Parameters
13144    ///
13145    /// * *$.xgafv* (query-string) - V1 error format.
13146    /// * *access_token* (query-string) - OAuth access token.
13147    /// * *alt* (query-string) - Data format for response.
13148    /// * *callback* (query-string) - JSONP
13149    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13150    /// * *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.
13151    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13152    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13153    /// * *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.
13154    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13155    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13156    pub fn param<T>(mut self, name: T, value: T) -> ProjectListCall<'a, C>
13157    where
13158        T: AsRef<str>,
13159    {
13160        self._additional_params
13161            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13162        self
13163    }
13164
13165    /// Identifies the authorization scope for the method you are building.
13166    ///
13167    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13168    /// [`Scope::CloudPlatformReadOnly`].
13169    ///
13170    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13171    /// tokens for more than one scope.
13172    ///
13173    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13174    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13175    /// sufficient, a read-write scope will do as well.
13176    pub fn add_scope<St>(mut self, scope: St) -> ProjectListCall<'a, C>
13177    where
13178        St: AsRef<str>,
13179    {
13180        self._scopes.insert(String::from(scope.as_ref()));
13181        self
13182    }
13183    /// Identifies the authorization scope(s) for the method you are building.
13184    ///
13185    /// See [`Self::add_scope()`] for details.
13186    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectListCall<'a, C>
13187    where
13188        I: IntoIterator<Item = St>,
13189        St: AsRef<str>,
13190    {
13191        self._scopes
13192            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13193        self
13194    }
13195
13196    /// Removes all scopes, and no default scope will be used either.
13197    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13198    /// for details).
13199    pub fn clear_scopes(mut self) -> ProjectListCall<'a, C> {
13200        self._scopes.clear();
13201        self
13202    }
13203}
13204
13205/// Move a project to another place in your resource hierarchy, under a new resource parent. Returns an operation which can be used to track the process of the project move workflow. Upon success, the `Operation.response` field will be populated with the moved project. The caller must have `resourcemanager.projects.move` permission on the project, on the project's current and proposed new parent. If project has no current parent, or it currently does not have an associated organization resource, you will also need the `resourcemanager.projects.setIamPolicy` permission in the project.
13206///
13207/// A builder for the *move* method supported by a *project* resource.
13208/// It is not used directly, but through a [`ProjectMethods`] instance.
13209///
13210/// # Example
13211///
13212/// Instantiate a resource method builder
13213///
13214/// ```test_harness,no_run
13215/// # extern crate hyper;
13216/// # extern crate hyper_rustls;
13217/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
13218/// use cloudresourcemanager3::api::MoveProjectRequest;
13219/// # async fn dox() {
13220/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13221///
13222/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13223/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13224/// #     .with_native_roots()
13225/// #     .unwrap()
13226/// #     .https_only()
13227/// #     .enable_http2()
13228/// #     .build();
13229///
13230/// # let executor = hyper_util::rt::TokioExecutor::new();
13231/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13232/// #     secret,
13233/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13234/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13235/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13236/// #     ),
13237/// # ).build().await.unwrap();
13238///
13239/// # let client = hyper_util::client::legacy::Client::builder(
13240/// #     hyper_util::rt::TokioExecutor::new()
13241/// # )
13242/// # .build(
13243/// #     hyper_rustls::HttpsConnectorBuilder::new()
13244/// #         .with_native_roots()
13245/// #         .unwrap()
13246/// #         .https_or_http()
13247/// #         .enable_http2()
13248/// #         .build()
13249/// # );
13250/// # let mut hub = CloudResourceManager::new(client, auth);
13251/// // As the method needs a request, you would usually fill it with the desired information
13252/// // into the respective structure. Some of the parts shown here might not be applicable !
13253/// // Values shown here are possibly random and not representative !
13254/// let mut req = MoveProjectRequest::default();
13255///
13256/// // You can configure optional parameters by calling the respective setters at will, and
13257/// // execute the final call using `doit()`.
13258/// // Values shown here are possibly random and not representative !
13259/// let result = hub.projects().move_(req, "name")
13260///              .doit().await;
13261/// # }
13262/// ```
13263pub struct ProjectMoveCall<'a, C>
13264where
13265    C: 'a,
13266{
13267    hub: &'a CloudResourceManager<C>,
13268    _request: MoveProjectRequest,
13269    _name: String,
13270    _delegate: Option<&'a mut dyn common::Delegate>,
13271    _additional_params: HashMap<String, String>,
13272    _scopes: BTreeSet<String>,
13273}
13274
13275impl<'a, C> common::CallBuilder for ProjectMoveCall<'a, C> {}
13276
13277impl<'a, C> ProjectMoveCall<'a, C>
13278where
13279    C: common::Connector,
13280{
13281    /// Perform the operation you have build so far.
13282    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13283        use std::borrow::Cow;
13284        use std::io::{Read, Seek};
13285
13286        use common::{url::Params, ToParts};
13287        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13288
13289        let mut dd = common::DefaultDelegate;
13290        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13291        dlg.begin(common::MethodInfo {
13292            id: "cloudresourcemanager.projects.move",
13293            http_method: hyper::Method::POST,
13294        });
13295
13296        for &field in ["alt", "name"].iter() {
13297            if self._additional_params.contains_key(field) {
13298                dlg.finished(false);
13299                return Err(common::Error::FieldClash(field));
13300            }
13301        }
13302
13303        let mut params = Params::with_capacity(4 + self._additional_params.len());
13304        params.push("name", self._name);
13305
13306        params.extend(self._additional_params.iter());
13307
13308        params.push("alt", "json");
13309        let mut url = self.hub._base_url.clone() + "v3/{+name}:move";
13310        if self._scopes.is_empty() {
13311            self._scopes
13312                .insert(Scope::CloudPlatform.as_ref().to_string());
13313        }
13314
13315        #[allow(clippy::single_element_loop)]
13316        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13317            url = params.uri_replacement(url, param_name, find_this, true);
13318        }
13319        {
13320            let to_remove = ["name"];
13321            params.remove_params(&to_remove);
13322        }
13323
13324        let url = params.parse_with_url(&url);
13325
13326        let mut json_mime_type = mime::APPLICATION_JSON;
13327        let mut request_value_reader = {
13328            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13329            common::remove_json_null_values(&mut value);
13330            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13331            serde_json::to_writer(&mut dst, &value).unwrap();
13332            dst
13333        };
13334        let request_size = request_value_reader
13335            .seek(std::io::SeekFrom::End(0))
13336            .unwrap();
13337        request_value_reader
13338            .seek(std::io::SeekFrom::Start(0))
13339            .unwrap();
13340
13341        loop {
13342            let token = match self
13343                .hub
13344                .auth
13345                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13346                .await
13347            {
13348                Ok(token) => token,
13349                Err(e) => match dlg.token(e) {
13350                    Ok(token) => token,
13351                    Err(e) => {
13352                        dlg.finished(false);
13353                        return Err(common::Error::MissingToken(e));
13354                    }
13355                },
13356            };
13357            request_value_reader
13358                .seek(std::io::SeekFrom::Start(0))
13359                .unwrap();
13360            let mut req_result = {
13361                let client = &self.hub.client;
13362                dlg.pre_request();
13363                let mut req_builder = hyper::Request::builder()
13364                    .method(hyper::Method::POST)
13365                    .uri(url.as_str())
13366                    .header(USER_AGENT, self.hub._user_agent.clone());
13367
13368                if let Some(token) = token.as_ref() {
13369                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13370                }
13371
13372                let request = req_builder
13373                    .header(CONTENT_TYPE, json_mime_type.to_string())
13374                    .header(CONTENT_LENGTH, request_size as u64)
13375                    .body(common::to_body(
13376                        request_value_reader.get_ref().clone().into(),
13377                    ));
13378
13379                client.request(request.unwrap()).await
13380            };
13381
13382            match req_result {
13383                Err(err) => {
13384                    if let common::Retry::After(d) = dlg.http_error(&err) {
13385                        sleep(d).await;
13386                        continue;
13387                    }
13388                    dlg.finished(false);
13389                    return Err(common::Error::HttpError(err));
13390                }
13391                Ok(res) => {
13392                    let (mut parts, body) = res.into_parts();
13393                    let mut body = common::Body::new(body);
13394                    if !parts.status.is_success() {
13395                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13396                        let error = serde_json::from_str(&common::to_string(&bytes));
13397                        let response = common::to_response(parts, bytes.into());
13398
13399                        if let common::Retry::After(d) =
13400                            dlg.http_failure(&response, error.as_ref().ok())
13401                        {
13402                            sleep(d).await;
13403                            continue;
13404                        }
13405
13406                        dlg.finished(false);
13407
13408                        return Err(match error {
13409                            Ok(value) => common::Error::BadRequest(value),
13410                            _ => common::Error::Failure(response),
13411                        });
13412                    }
13413                    let response = {
13414                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13415                        let encoded = common::to_string(&bytes);
13416                        match serde_json::from_str(&encoded) {
13417                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13418                            Err(error) => {
13419                                dlg.response_json_decode_error(&encoded, &error);
13420                                return Err(common::Error::JsonDecodeError(
13421                                    encoded.to_string(),
13422                                    error,
13423                                ));
13424                            }
13425                        }
13426                    };
13427
13428                    dlg.finished(true);
13429                    return Ok(response);
13430                }
13431            }
13432        }
13433    }
13434
13435    ///
13436    /// Sets the *request* property to the given value.
13437    ///
13438    /// Even though the property as already been set when instantiating this call,
13439    /// we provide this method for API completeness.
13440    pub fn request(mut self, new_value: MoveProjectRequest) -> ProjectMoveCall<'a, C> {
13441        self._request = new_value;
13442        self
13443    }
13444    /// Required. The name of the project to move.
13445    ///
13446    /// Sets the *name* path property to the given value.
13447    ///
13448    /// Even though the property as already been set when instantiating this call,
13449    /// we provide this method for API completeness.
13450    pub fn name(mut self, new_value: &str) -> ProjectMoveCall<'a, C> {
13451        self._name = new_value.to_string();
13452        self
13453    }
13454    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13455    /// while executing the actual API request.
13456    ///
13457    /// ````text
13458    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13459    /// ````
13460    ///
13461    /// Sets the *delegate* property to the given value.
13462    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectMoveCall<'a, C> {
13463        self._delegate = Some(new_value);
13464        self
13465    }
13466
13467    /// Set any additional parameter of the query string used in the request.
13468    /// It should be used to set parameters which are not yet available through their own
13469    /// setters.
13470    ///
13471    /// Please note that this method must not be used to set any of the known parameters
13472    /// which have their own setter method. If done anyway, the request will fail.
13473    ///
13474    /// # Additional Parameters
13475    ///
13476    /// * *$.xgafv* (query-string) - V1 error format.
13477    /// * *access_token* (query-string) - OAuth access token.
13478    /// * *alt* (query-string) - Data format for response.
13479    /// * *callback* (query-string) - JSONP
13480    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13481    /// * *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.
13482    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13483    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13484    /// * *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.
13485    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13486    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13487    pub fn param<T>(mut self, name: T, value: T) -> ProjectMoveCall<'a, C>
13488    where
13489        T: AsRef<str>,
13490    {
13491        self._additional_params
13492            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13493        self
13494    }
13495
13496    /// Identifies the authorization scope for the method you are building.
13497    ///
13498    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13499    /// [`Scope::CloudPlatform`].
13500    ///
13501    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13502    /// tokens for more than one scope.
13503    ///
13504    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13505    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13506    /// sufficient, a read-write scope will do as well.
13507    pub fn add_scope<St>(mut self, scope: St) -> ProjectMoveCall<'a, C>
13508    where
13509        St: AsRef<str>,
13510    {
13511        self._scopes.insert(String::from(scope.as_ref()));
13512        self
13513    }
13514    /// Identifies the authorization scope(s) for the method you are building.
13515    ///
13516    /// See [`Self::add_scope()`] for details.
13517    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectMoveCall<'a, C>
13518    where
13519        I: IntoIterator<Item = St>,
13520        St: AsRef<str>,
13521    {
13522        self._scopes
13523            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13524        self
13525    }
13526
13527    /// Removes all scopes, and no default scope will be used either.
13528    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13529    /// for details).
13530    pub fn clear_scopes(mut self) -> ProjectMoveCall<'a, C> {
13531        self._scopes.clear();
13532        self
13533    }
13534}
13535
13536/// Updates the `display_name` and labels of the project identified by the specified `name` (for example, `projects/415104041262`). Deleting all labels requires an update mask for labels field. The caller must have `resourcemanager.projects.update` permission for this project.
13537///
13538/// A builder for the *patch* method supported by a *project* resource.
13539/// It is not used directly, but through a [`ProjectMethods`] instance.
13540///
13541/// # Example
13542///
13543/// Instantiate a resource method builder
13544///
13545/// ```test_harness,no_run
13546/// # extern crate hyper;
13547/// # extern crate hyper_rustls;
13548/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
13549/// use cloudresourcemanager3::api::Project;
13550/// # async fn dox() {
13551/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13552///
13553/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13554/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13555/// #     .with_native_roots()
13556/// #     .unwrap()
13557/// #     .https_only()
13558/// #     .enable_http2()
13559/// #     .build();
13560///
13561/// # let executor = hyper_util::rt::TokioExecutor::new();
13562/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13563/// #     secret,
13564/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13565/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13566/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13567/// #     ),
13568/// # ).build().await.unwrap();
13569///
13570/// # let client = hyper_util::client::legacy::Client::builder(
13571/// #     hyper_util::rt::TokioExecutor::new()
13572/// # )
13573/// # .build(
13574/// #     hyper_rustls::HttpsConnectorBuilder::new()
13575/// #         .with_native_roots()
13576/// #         .unwrap()
13577/// #         .https_or_http()
13578/// #         .enable_http2()
13579/// #         .build()
13580/// # );
13581/// # let mut hub = CloudResourceManager::new(client, auth);
13582/// // As the method needs a request, you would usually fill it with the desired information
13583/// // into the respective structure. Some of the parts shown here might not be applicable !
13584/// // Values shown here are possibly random and not representative !
13585/// let mut req = Project::default();
13586///
13587/// // You can configure optional parameters by calling the respective setters at will, and
13588/// // execute the final call using `doit()`.
13589/// // Values shown here are possibly random and not representative !
13590/// let result = hub.projects().patch(req, "name")
13591///              .update_mask(FieldMask::new::<&str>(&[]))
13592///              .doit().await;
13593/// # }
13594/// ```
13595pub struct ProjectPatchCall<'a, C>
13596where
13597    C: 'a,
13598{
13599    hub: &'a CloudResourceManager<C>,
13600    _request: Project,
13601    _name: String,
13602    _update_mask: Option<common::FieldMask>,
13603    _delegate: Option<&'a mut dyn common::Delegate>,
13604    _additional_params: HashMap<String, String>,
13605    _scopes: BTreeSet<String>,
13606}
13607
13608impl<'a, C> common::CallBuilder for ProjectPatchCall<'a, C> {}
13609
13610impl<'a, C> ProjectPatchCall<'a, C>
13611where
13612    C: common::Connector,
13613{
13614    /// Perform the operation you have build so far.
13615    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13616        use std::borrow::Cow;
13617        use std::io::{Read, Seek};
13618
13619        use common::{url::Params, ToParts};
13620        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13621
13622        let mut dd = common::DefaultDelegate;
13623        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13624        dlg.begin(common::MethodInfo {
13625            id: "cloudresourcemanager.projects.patch",
13626            http_method: hyper::Method::PATCH,
13627        });
13628
13629        for &field in ["alt", "name", "updateMask"].iter() {
13630            if self._additional_params.contains_key(field) {
13631                dlg.finished(false);
13632                return Err(common::Error::FieldClash(field));
13633            }
13634        }
13635
13636        let mut params = Params::with_capacity(5 + self._additional_params.len());
13637        params.push("name", self._name);
13638        if let Some(value) = self._update_mask.as_ref() {
13639            params.push("updateMask", value.to_string());
13640        }
13641
13642        params.extend(self._additional_params.iter());
13643
13644        params.push("alt", "json");
13645        let mut url = self.hub._base_url.clone() + "v3/{+name}";
13646        if self._scopes.is_empty() {
13647            self._scopes
13648                .insert(Scope::CloudPlatform.as_ref().to_string());
13649        }
13650
13651        #[allow(clippy::single_element_loop)]
13652        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13653            url = params.uri_replacement(url, param_name, find_this, true);
13654        }
13655        {
13656            let to_remove = ["name"];
13657            params.remove_params(&to_remove);
13658        }
13659
13660        let url = params.parse_with_url(&url);
13661
13662        let mut json_mime_type = mime::APPLICATION_JSON;
13663        let mut request_value_reader = {
13664            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13665            common::remove_json_null_values(&mut value);
13666            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13667            serde_json::to_writer(&mut dst, &value).unwrap();
13668            dst
13669        };
13670        let request_size = request_value_reader
13671            .seek(std::io::SeekFrom::End(0))
13672            .unwrap();
13673        request_value_reader
13674            .seek(std::io::SeekFrom::Start(0))
13675            .unwrap();
13676
13677        loop {
13678            let token = match self
13679                .hub
13680                .auth
13681                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13682                .await
13683            {
13684                Ok(token) => token,
13685                Err(e) => match dlg.token(e) {
13686                    Ok(token) => token,
13687                    Err(e) => {
13688                        dlg.finished(false);
13689                        return Err(common::Error::MissingToken(e));
13690                    }
13691                },
13692            };
13693            request_value_reader
13694                .seek(std::io::SeekFrom::Start(0))
13695                .unwrap();
13696            let mut req_result = {
13697                let client = &self.hub.client;
13698                dlg.pre_request();
13699                let mut req_builder = hyper::Request::builder()
13700                    .method(hyper::Method::PATCH)
13701                    .uri(url.as_str())
13702                    .header(USER_AGENT, self.hub._user_agent.clone());
13703
13704                if let Some(token) = token.as_ref() {
13705                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13706                }
13707
13708                let request = req_builder
13709                    .header(CONTENT_TYPE, json_mime_type.to_string())
13710                    .header(CONTENT_LENGTH, request_size as u64)
13711                    .body(common::to_body(
13712                        request_value_reader.get_ref().clone().into(),
13713                    ));
13714
13715                client.request(request.unwrap()).await
13716            };
13717
13718            match req_result {
13719                Err(err) => {
13720                    if let common::Retry::After(d) = dlg.http_error(&err) {
13721                        sleep(d).await;
13722                        continue;
13723                    }
13724                    dlg.finished(false);
13725                    return Err(common::Error::HttpError(err));
13726                }
13727                Ok(res) => {
13728                    let (mut parts, body) = res.into_parts();
13729                    let mut body = common::Body::new(body);
13730                    if !parts.status.is_success() {
13731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13732                        let error = serde_json::from_str(&common::to_string(&bytes));
13733                        let response = common::to_response(parts, bytes.into());
13734
13735                        if let common::Retry::After(d) =
13736                            dlg.http_failure(&response, error.as_ref().ok())
13737                        {
13738                            sleep(d).await;
13739                            continue;
13740                        }
13741
13742                        dlg.finished(false);
13743
13744                        return Err(match error {
13745                            Ok(value) => common::Error::BadRequest(value),
13746                            _ => common::Error::Failure(response),
13747                        });
13748                    }
13749                    let response = {
13750                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13751                        let encoded = common::to_string(&bytes);
13752                        match serde_json::from_str(&encoded) {
13753                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13754                            Err(error) => {
13755                                dlg.response_json_decode_error(&encoded, &error);
13756                                return Err(common::Error::JsonDecodeError(
13757                                    encoded.to_string(),
13758                                    error,
13759                                ));
13760                            }
13761                        }
13762                    };
13763
13764                    dlg.finished(true);
13765                    return Ok(response);
13766                }
13767            }
13768        }
13769    }
13770
13771    ///
13772    /// Sets the *request* property to the given value.
13773    ///
13774    /// Even though the property as already been set when instantiating this call,
13775    /// we provide this method for API completeness.
13776    pub fn request(mut self, new_value: Project) -> ProjectPatchCall<'a, C> {
13777        self._request = new_value;
13778        self
13779    }
13780    /// Output only. The unique resource name of the project. It is an int64 generated number prefixed by "projects/". Example: `projects/415104041262`
13781    ///
13782    /// Sets the *name* path property to the given value.
13783    ///
13784    /// Even though the property as already been set when instantiating this call,
13785    /// we provide this method for API completeness.
13786    pub fn name(mut self, new_value: &str) -> ProjectPatchCall<'a, C> {
13787        self._name = new_value.to_string();
13788        self
13789    }
13790    /// Optional. An update mask to selectively update fields.
13791    ///
13792    /// Sets the *update mask* query property to the given value.
13793    pub fn update_mask(mut self, new_value: common::FieldMask) -> ProjectPatchCall<'a, C> {
13794        self._update_mask = Some(new_value);
13795        self
13796    }
13797    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13798    /// while executing the actual API request.
13799    ///
13800    /// ````text
13801    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13802    /// ````
13803    ///
13804    /// Sets the *delegate* property to the given value.
13805    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectPatchCall<'a, C> {
13806        self._delegate = Some(new_value);
13807        self
13808    }
13809
13810    /// Set any additional parameter of the query string used in the request.
13811    /// It should be used to set parameters which are not yet available through their own
13812    /// setters.
13813    ///
13814    /// Please note that this method must not be used to set any of the known parameters
13815    /// which have their own setter method. If done anyway, the request will fail.
13816    ///
13817    /// # Additional Parameters
13818    ///
13819    /// * *$.xgafv* (query-string) - V1 error format.
13820    /// * *access_token* (query-string) - OAuth access token.
13821    /// * *alt* (query-string) - Data format for response.
13822    /// * *callback* (query-string) - JSONP
13823    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13824    /// * *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.
13825    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13826    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13827    /// * *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.
13828    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13829    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13830    pub fn param<T>(mut self, name: T, value: T) -> ProjectPatchCall<'a, C>
13831    where
13832        T: AsRef<str>,
13833    {
13834        self._additional_params
13835            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13836        self
13837    }
13838
13839    /// Identifies the authorization scope for the method you are building.
13840    ///
13841    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13842    /// [`Scope::CloudPlatform`].
13843    ///
13844    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13845    /// tokens for more than one scope.
13846    ///
13847    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13848    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13849    /// sufficient, a read-write scope will do as well.
13850    pub fn add_scope<St>(mut self, scope: St) -> ProjectPatchCall<'a, C>
13851    where
13852        St: AsRef<str>,
13853    {
13854        self._scopes.insert(String::from(scope.as_ref()));
13855        self
13856    }
13857    /// Identifies the authorization scope(s) for the method you are building.
13858    ///
13859    /// See [`Self::add_scope()`] for details.
13860    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectPatchCall<'a, C>
13861    where
13862        I: IntoIterator<Item = St>,
13863        St: AsRef<str>,
13864    {
13865        self._scopes
13866            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13867        self
13868    }
13869
13870    /// Removes all scopes, and no default scope will be used either.
13871    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13872    /// for details).
13873    pub fn clear_scopes(mut self) -> ProjectPatchCall<'a, C> {
13874        self._scopes.clear();
13875        self
13876    }
13877}
13878
13879/// Search for projects that the caller has the `resourcemanager.projects.get` permission on, and also satisfy the specified query. 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.
13880///
13881/// A builder for the *search* method supported by a *project* resource.
13882/// It is not used directly, but through a [`ProjectMethods`] instance.
13883///
13884/// # Example
13885///
13886/// Instantiate a resource method builder
13887///
13888/// ```test_harness,no_run
13889/// # extern crate hyper;
13890/// # extern crate hyper_rustls;
13891/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
13892/// # async fn dox() {
13893/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13894///
13895/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13896/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13897/// #     .with_native_roots()
13898/// #     .unwrap()
13899/// #     .https_only()
13900/// #     .enable_http2()
13901/// #     .build();
13902///
13903/// # let executor = hyper_util::rt::TokioExecutor::new();
13904/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13905/// #     secret,
13906/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13907/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
13908/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
13909/// #     ),
13910/// # ).build().await.unwrap();
13911///
13912/// # let client = hyper_util::client::legacy::Client::builder(
13913/// #     hyper_util::rt::TokioExecutor::new()
13914/// # )
13915/// # .build(
13916/// #     hyper_rustls::HttpsConnectorBuilder::new()
13917/// #         .with_native_roots()
13918/// #         .unwrap()
13919/// #         .https_or_http()
13920/// #         .enable_http2()
13921/// #         .build()
13922/// # );
13923/// # let mut hub = CloudResourceManager::new(client, auth);
13924/// // You can configure optional parameters by calling the respective setters at will, and
13925/// // execute the final call using `doit()`.
13926/// // Values shown here are possibly random and not representative !
13927/// let result = hub.projects().search()
13928///              .query("consetetur")
13929///              .page_token("diam")
13930///              .page_size(-49)
13931///              .doit().await;
13932/// # }
13933/// ```
13934pub struct ProjectSearchCall<'a, C>
13935where
13936    C: 'a,
13937{
13938    hub: &'a CloudResourceManager<C>,
13939    _query: Option<String>,
13940    _page_token: Option<String>,
13941    _page_size: Option<i32>,
13942    _delegate: Option<&'a mut dyn common::Delegate>,
13943    _additional_params: HashMap<String, String>,
13944    _scopes: BTreeSet<String>,
13945}
13946
13947impl<'a, C> common::CallBuilder for ProjectSearchCall<'a, C> {}
13948
13949impl<'a, C> ProjectSearchCall<'a, C>
13950where
13951    C: common::Connector,
13952{
13953    /// Perform the operation you have build so far.
13954    pub async fn doit(mut self) -> common::Result<(common::Response, SearchProjectsResponse)> {
13955        use std::borrow::Cow;
13956        use std::io::{Read, Seek};
13957
13958        use common::{url::Params, ToParts};
13959        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13960
13961        let mut dd = common::DefaultDelegate;
13962        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13963        dlg.begin(common::MethodInfo {
13964            id: "cloudresourcemanager.projects.search",
13965            http_method: hyper::Method::GET,
13966        });
13967
13968        for &field in ["alt", "query", "pageToken", "pageSize"].iter() {
13969            if self._additional_params.contains_key(field) {
13970                dlg.finished(false);
13971                return Err(common::Error::FieldClash(field));
13972            }
13973        }
13974
13975        let mut params = Params::with_capacity(5 + self._additional_params.len());
13976        if let Some(value) = self._query.as_ref() {
13977            params.push("query", value);
13978        }
13979        if let Some(value) = self._page_token.as_ref() {
13980            params.push("pageToken", value);
13981        }
13982        if let Some(value) = self._page_size.as_ref() {
13983            params.push("pageSize", value.to_string());
13984        }
13985
13986        params.extend(self._additional_params.iter());
13987
13988        params.push("alt", "json");
13989        let mut url = self.hub._base_url.clone() + "v3/projects:search";
13990        if self._scopes.is_empty() {
13991            self._scopes
13992                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
13993        }
13994
13995        let url = params.parse_with_url(&url);
13996
13997        loop {
13998            let token = match self
13999                .hub
14000                .auth
14001                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14002                .await
14003            {
14004                Ok(token) => token,
14005                Err(e) => match dlg.token(e) {
14006                    Ok(token) => token,
14007                    Err(e) => {
14008                        dlg.finished(false);
14009                        return Err(common::Error::MissingToken(e));
14010                    }
14011                },
14012            };
14013            let mut req_result = {
14014                let client = &self.hub.client;
14015                dlg.pre_request();
14016                let mut req_builder = hyper::Request::builder()
14017                    .method(hyper::Method::GET)
14018                    .uri(url.as_str())
14019                    .header(USER_AGENT, self.hub._user_agent.clone());
14020
14021                if let Some(token) = token.as_ref() {
14022                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14023                }
14024
14025                let request = req_builder
14026                    .header(CONTENT_LENGTH, 0_u64)
14027                    .body(common::to_body::<String>(None));
14028
14029                client.request(request.unwrap()).await
14030            };
14031
14032            match req_result {
14033                Err(err) => {
14034                    if let common::Retry::After(d) = dlg.http_error(&err) {
14035                        sleep(d).await;
14036                        continue;
14037                    }
14038                    dlg.finished(false);
14039                    return Err(common::Error::HttpError(err));
14040                }
14041                Ok(res) => {
14042                    let (mut parts, body) = res.into_parts();
14043                    let mut body = common::Body::new(body);
14044                    if !parts.status.is_success() {
14045                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14046                        let error = serde_json::from_str(&common::to_string(&bytes));
14047                        let response = common::to_response(parts, bytes.into());
14048
14049                        if let common::Retry::After(d) =
14050                            dlg.http_failure(&response, error.as_ref().ok())
14051                        {
14052                            sleep(d).await;
14053                            continue;
14054                        }
14055
14056                        dlg.finished(false);
14057
14058                        return Err(match error {
14059                            Ok(value) => common::Error::BadRequest(value),
14060                            _ => common::Error::Failure(response),
14061                        });
14062                    }
14063                    let response = {
14064                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14065                        let encoded = common::to_string(&bytes);
14066                        match serde_json::from_str(&encoded) {
14067                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14068                            Err(error) => {
14069                                dlg.response_json_decode_error(&encoded, &error);
14070                                return Err(common::Error::JsonDecodeError(
14071                                    encoded.to_string(),
14072                                    error,
14073                                ));
14074                            }
14075                        }
14076                    };
14077
14078                    dlg.finished(true);
14079                    return Ok(response);
14080                }
14081            }
14082        }
14083    }
14084
14085    /// Optional. A query string for searching for projects that the caller has `resourcemanager.projects.get` permission to. If multiple fields are included in the query, then it will return results that match any of the fields. Some eligible fields are: ``` | Field | Description | |-------------------------|----------------------------------------------| | displayName, name | Filters by displayName. | | parent | Project's parent (for example: folders/123, organizations/*). Prefer parent field over parent.type and parent.id.| | parent.type | Parent's type: `folder` or `organization`. | | parent.id | Parent's id number (for example: 123) | | id, projectId | Filters by projectId. | | state, lifecycleState | Filters by state. | | labels | Filters by label name or value. | | labels.\ (where *key* is the name of a label) | Filters by label name.| ``` Search expressions are case insensitive. Some examples queries: ``` | Query | 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 query is specified, the call will return projects for which the user has the `resourcemanager.projects.get` permission.
14086    ///
14087    /// Sets the *query* query property to the given value.
14088    pub fn query(mut self, new_value: &str) -> ProjectSearchCall<'a, C> {
14089        self._query = Some(new_value.to_string());
14090        self
14091    }
14092    /// Optional. A pagination token returned from a previous call to ListProjects that indicates from where listing should continue.
14093    ///
14094    /// Sets the *page token* query property to the given value.
14095    pub fn page_token(mut self, new_value: &str) -> ProjectSearchCall<'a, C> {
14096        self._page_token = Some(new_value.to_string());
14097        self
14098    }
14099    /// Optional. 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.
14100    ///
14101    /// Sets the *page size* query property to the given value.
14102    pub fn page_size(mut self, new_value: i32) -> ProjectSearchCall<'a, C> {
14103        self._page_size = Some(new_value);
14104        self
14105    }
14106    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14107    /// while executing the actual API request.
14108    ///
14109    /// ````text
14110    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14111    /// ````
14112    ///
14113    /// Sets the *delegate* property to the given value.
14114    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ProjectSearchCall<'a, C> {
14115        self._delegate = Some(new_value);
14116        self
14117    }
14118
14119    /// Set any additional parameter of the query string used in the request.
14120    /// It should be used to set parameters which are not yet available through their own
14121    /// setters.
14122    ///
14123    /// Please note that this method must not be used to set any of the known parameters
14124    /// which have their own setter method. If done anyway, the request will fail.
14125    ///
14126    /// # Additional Parameters
14127    ///
14128    /// * *$.xgafv* (query-string) - V1 error format.
14129    /// * *access_token* (query-string) - OAuth access token.
14130    /// * *alt* (query-string) - Data format for response.
14131    /// * *callback* (query-string) - JSONP
14132    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14133    /// * *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.
14134    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14135    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14136    /// * *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.
14137    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14138    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14139    pub fn param<T>(mut self, name: T, value: T) -> ProjectSearchCall<'a, C>
14140    where
14141        T: AsRef<str>,
14142    {
14143        self._additional_params
14144            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14145        self
14146    }
14147
14148    /// Identifies the authorization scope for the method you are building.
14149    ///
14150    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14151    /// [`Scope::CloudPlatformReadOnly`].
14152    ///
14153    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14154    /// tokens for more than one scope.
14155    ///
14156    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14157    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14158    /// sufficient, a read-write scope will do as well.
14159    pub fn add_scope<St>(mut self, scope: St) -> ProjectSearchCall<'a, C>
14160    where
14161        St: AsRef<str>,
14162    {
14163        self._scopes.insert(String::from(scope.as_ref()));
14164        self
14165    }
14166    /// Identifies the authorization scope(s) for the method you are building.
14167    ///
14168    /// See [`Self::add_scope()`] for details.
14169    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSearchCall<'a, C>
14170    where
14171        I: IntoIterator<Item = St>,
14172        St: AsRef<str>,
14173    {
14174        self._scopes
14175            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14176        self
14177    }
14178
14179    /// Removes all scopes, and no default scope will be used either.
14180    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14181    /// for details).
14182    pub fn clear_scopes(mut self) -> ProjectSearchCall<'a, C> {
14183        self._scopes.clear();
14184        self
14185    }
14186}
14187
14188/// Sets the IAM access control policy for the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123. 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 using the 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. + 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. If the project is part of an organization, you can remove all owners, potentially making the organization inaccessible.
14189///
14190/// A builder for the *setIamPolicy* method supported by a *project* resource.
14191/// It is not used directly, but through a [`ProjectMethods`] instance.
14192///
14193/// # Example
14194///
14195/// Instantiate a resource method builder
14196///
14197/// ```test_harness,no_run
14198/// # extern crate hyper;
14199/// # extern crate hyper_rustls;
14200/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
14201/// use cloudresourcemanager3::api::SetIamPolicyRequest;
14202/// # async fn dox() {
14203/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14204///
14205/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14206/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14207/// #     .with_native_roots()
14208/// #     .unwrap()
14209/// #     .https_only()
14210/// #     .enable_http2()
14211/// #     .build();
14212///
14213/// # let executor = hyper_util::rt::TokioExecutor::new();
14214/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14215/// #     secret,
14216/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14217/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14218/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14219/// #     ),
14220/// # ).build().await.unwrap();
14221///
14222/// # let client = hyper_util::client::legacy::Client::builder(
14223/// #     hyper_util::rt::TokioExecutor::new()
14224/// # )
14225/// # .build(
14226/// #     hyper_rustls::HttpsConnectorBuilder::new()
14227/// #         .with_native_roots()
14228/// #         .unwrap()
14229/// #         .https_or_http()
14230/// #         .enable_http2()
14231/// #         .build()
14232/// # );
14233/// # let mut hub = CloudResourceManager::new(client, auth);
14234/// // As the method needs a request, you would usually fill it with the desired information
14235/// // into the respective structure. Some of the parts shown here might not be applicable !
14236/// // Values shown here are possibly random and not representative !
14237/// let mut req = SetIamPolicyRequest::default();
14238///
14239/// // You can configure optional parameters by calling the respective setters at will, and
14240/// // execute the final call using `doit()`.
14241/// // Values shown here are possibly random and not representative !
14242/// let result = hub.projects().set_iam_policy(req, "resource")
14243///              .doit().await;
14244/// # }
14245/// ```
14246pub struct ProjectSetIamPolicyCall<'a, C>
14247where
14248    C: 'a,
14249{
14250    hub: &'a CloudResourceManager<C>,
14251    _request: SetIamPolicyRequest,
14252    _resource: String,
14253    _delegate: Option<&'a mut dyn common::Delegate>,
14254    _additional_params: HashMap<String, String>,
14255    _scopes: BTreeSet<String>,
14256}
14257
14258impl<'a, C> common::CallBuilder for ProjectSetIamPolicyCall<'a, C> {}
14259
14260impl<'a, C> ProjectSetIamPolicyCall<'a, C>
14261where
14262    C: common::Connector,
14263{
14264    /// Perform the operation you have build so far.
14265    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
14266        use std::borrow::Cow;
14267        use std::io::{Read, Seek};
14268
14269        use common::{url::Params, ToParts};
14270        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14271
14272        let mut dd = common::DefaultDelegate;
14273        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14274        dlg.begin(common::MethodInfo {
14275            id: "cloudresourcemanager.projects.setIamPolicy",
14276            http_method: hyper::Method::POST,
14277        });
14278
14279        for &field in ["alt", "resource"].iter() {
14280            if self._additional_params.contains_key(field) {
14281                dlg.finished(false);
14282                return Err(common::Error::FieldClash(field));
14283            }
14284        }
14285
14286        let mut params = Params::with_capacity(4 + self._additional_params.len());
14287        params.push("resource", self._resource);
14288
14289        params.extend(self._additional_params.iter());
14290
14291        params.push("alt", "json");
14292        let mut url = self.hub._base_url.clone() + "v3/{+resource}:setIamPolicy";
14293        if self._scopes.is_empty() {
14294            self._scopes
14295                .insert(Scope::CloudPlatform.as_ref().to_string());
14296        }
14297
14298        #[allow(clippy::single_element_loop)]
14299        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14300            url = params.uri_replacement(url, param_name, find_this, true);
14301        }
14302        {
14303            let to_remove = ["resource"];
14304            params.remove_params(&to_remove);
14305        }
14306
14307        let url = params.parse_with_url(&url);
14308
14309        let mut json_mime_type = mime::APPLICATION_JSON;
14310        let mut request_value_reader = {
14311            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14312            common::remove_json_null_values(&mut value);
14313            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14314            serde_json::to_writer(&mut dst, &value).unwrap();
14315            dst
14316        };
14317        let request_size = request_value_reader
14318            .seek(std::io::SeekFrom::End(0))
14319            .unwrap();
14320        request_value_reader
14321            .seek(std::io::SeekFrom::Start(0))
14322            .unwrap();
14323
14324        loop {
14325            let token = match self
14326                .hub
14327                .auth
14328                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14329                .await
14330            {
14331                Ok(token) => token,
14332                Err(e) => match dlg.token(e) {
14333                    Ok(token) => token,
14334                    Err(e) => {
14335                        dlg.finished(false);
14336                        return Err(common::Error::MissingToken(e));
14337                    }
14338                },
14339            };
14340            request_value_reader
14341                .seek(std::io::SeekFrom::Start(0))
14342                .unwrap();
14343            let mut req_result = {
14344                let client = &self.hub.client;
14345                dlg.pre_request();
14346                let mut req_builder = hyper::Request::builder()
14347                    .method(hyper::Method::POST)
14348                    .uri(url.as_str())
14349                    .header(USER_AGENT, self.hub._user_agent.clone());
14350
14351                if let Some(token) = token.as_ref() {
14352                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14353                }
14354
14355                let request = req_builder
14356                    .header(CONTENT_TYPE, json_mime_type.to_string())
14357                    .header(CONTENT_LENGTH, request_size as u64)
14358                    .body(common::to_body(
14359                        request_value_reader.get_ref().clone().into(),
14360                    ));
14361
14362                client.request(request.unwrap()).await
14363            };
14364
14365            match req_result {
14366                Err(err) => {
14367                    if let common::Retry::After(d) = dlg.http_error(&err) {
14368                        sleep(d).await;
14369                        continue;
14370                    }
14371                    dlg.finished(false);
14372                    return Err(common::Error::HttpError(err));
14373                }
14374                Ok(res) => {
14375                    let (mut parts, body) = res.into_parts();
14376                    let mut body = common::Body::new(body);
14377                    if !parts.status.is_success() {
14378                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14379                        let error = serde_json::from_str(&common::to_string(&bytes));
14380                        let response = common::to_response(parts, bytes.into());
14381
14382                        if let common::Retry::After(d) =
14383                            dlg.http_failure(&response, error.as_ref().ok())
14384                        {
14385                            sleep(d).await;
14386                            continue;
14387                        }
14388
14389                        dlg.finished(false);
14390
14391                        return Err(match error {
14392                            Ok(value) => common::Error::BadRequest(value),
14393                            _ => common::Error::Failure(response),
14394                        });
14395                    }
14396                    let response = {
14397                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14398                        let encoded = common::to_string(&bytes);
14399                        match serde_json::from_str(&encoded) {
14400                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14401                            Err(error) => {
14402                                dlg.response_json_decode_error(&encoded, &error);
14403                                return Err(common::Error::JsonDecodeError(
14404                                    encoded.to_string(),
14405                                    error,
14406                                ));
14407                            }
14408                        }
14409                    };
14410
14411                    dlg.finished(true);
14412                    return Ok(response);
14413                }
14414            }
14415        }
14416    }
14417
14418    ///
14419    /// Sets the *request* property to the given value.
14420    ///
14421    /// Even though the property as already been set when instantiating this call,
14422    /// we provide this method for API completeness.
14423    pub fn request(mut self, new_value: SetIamPolicyRequest) -> ProjectSetIamPolicyCall<'a, C> {
14424        self._request = new_value;
14425        self
14426    }
14427    /// 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.
14428    ///
14429    /// Sets the *resource* path property to the given value.
14430    ///
14431    /// Even though the property as already been set when instantiating this call,
14432    /// we provide this method for API completeness.
14433    pub fn resource(mut self, new_value: &str) -> ProjectSetIamPolicyCall<'a, C> {
14434        self._resource = new_value.to_string();
14435        self
14436    }
14437    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14438    /// while executing the actual API request.
14439    ///
14440    /// ````text
14441    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14442    /// ````
14443    ///
14444    /// Sets the *delegate* property to the given value.
14445    pub fn delegate(
14446        mut self,
14447        new_value: &'a mut dyn common::Delegate,
14448    ) -> ProjectSetIamPolicyCall<'a, C> {
14449        self._delegate = Some(new_value);
14450        self
14451    }
14452
14453    /// Set any additional parameter of the query string used in the request.
14454    /// It should be used to set parameters which are not yet available through their own
14455    /// setters.
14456    ///
14457    /// Please note that this method must not be used to set any of the known parameters
14458    /// which have their own setter method. If done anyway, the request will fail.
14459    ///
14460    /// # Additional Parameters
14461    ///
14462    /// * *$.xgafv* (query-string) - V1 error format.
14463    /// * *access_token* (query-string) - OAuth access token.
14464    /// * *alt* (query-string) - Data format for response.
14465    /// * *callback* (query-string) - JSONP
14466    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14467    /// * *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.
14468    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14469    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14470    /// * *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.
14471    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14472    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14473    pub fn param<T>(mut self, name: T, value: T) -> ProjectSetIamPolicyCall<'a, C>
14474    where
14475        T: AsRef<str>,
14476    {
14477        self._additional_params
14478            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14479        self
14480    }
14481
14482    /// Identifies the authorization scope for the method you are building.
14483    ///
14484    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14485    /// [`Scope::CloudPlatform`].
14486    ///
14487    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14488    /// tokens for more than one scope.
14489    ///
14490    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14491    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14492    /// sufficient, a read-write scope will do as well.
14493    pub fn add_scope<St>(mut self, scope: St) -> ProjectSetIamPolicyCall<'a, C>
14494    where
14495        St: AsRef<str>,
14496    {
14497        self._scopes.insert(String::from(scope.as_ref()));
14498        self
14499    }
14500    /// Identifies the authorization scope(s) for the method you are building.
14501    ///
14502    /// See [`Self::add_scope()`] for details.
14503    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectSetIamPolicyCall<'a, C>
14504    where
14505        I: IntoIterator<Item = St>,
14506        St: AsRef<str>,
14507    {
14508        self._scopes
14509            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14510        self
14511    }
14512
14513    /// Removes all scopes, and no default scope will be used either.
14514    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14515    /// for details).
14516    pub fn clear_scopes(mut self) -> ProjectSetIamPolicyCall<'a, C> {
14517        self._scopes.clear();
14518        self
14519    }
14520}
14521
14522/// Returns permissions that a caller has on the specified project, in the format `projects/{ProjectIdOrNumber}` e.g. projects/123..
14523///
14524/// A builder for the *testIamPermissions* method supported by a *project* resource.
14525/// It is not used directly, but through a [`ProjectMethods`] instance.
14526///
14527/// # Example
14528///
14529/// Instantiate a resource method builder
14530///
14531/// ```test_harness,no_run
14532/// # extern crate hyper;
14533/// # extern crate hyper_rustls;
14534/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
14535/// use cloudresourcemanager3::api::TestIamPermissionsRequest;
14536/// # async fn dox() {
14537/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14538///
14539/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14540/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14541/// #     .with_native_roots()
14542/// #     .unwrap()
14543/// #     .https_only()
14544/// #     .enable_http2()
14545/// #     .build();
14546///
14547/// # let executor = hyper_util::rt::TokioExecutor::new();
14548/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14549/// #     secret,
14550/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14551/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14552/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14553/// #     ),
14554/// # ).build().await.unwrap();
14555///
14556/// # let client = hyper_util::client::legacy::Client::builder(
14557/// #     hyper_util::rt::TokioExecutor::new()
14558/// # )
14559/// # .build(
14560/// #     hyper_rustls::HttpsConnectorBuilder::new()
14561/// #         .with_native_roots()
14562/// #         .unwrap()
14563/// #         .https_or_http()
14564/// #         .enable_http2()
14565/// #         .build()
14566/// # );
14567/// # let mut hub = CloudResourceManager::new(client, auth);
14568/// // As the method needs a request, you would usually fill it with the desired information
14569/// // into the respective structure. Some of the parts shown here might not be applicable !
14570/// // Values shown here are possibly random and not representative !
14571/// let mut req = TestIamPermissionsRequest::default();
14572///
14573/// // You can configure optional parameters by calling the respective setters at will, and
14574/// // execute the final call using `doit()`.
14575/// // Values shown here are possibly random and not representative !
14576/// let result = hub.projects().test_iam_permissions(req, "resource")
14577///              .doit().await;
14578/// # }
14579/// ```
14580pub struct ProjectTestIamPermissionCall<'a, C>
14581where
14582    C: 'a,
14583{
14584    hub: &'a CloudResourceManager<C>,
14585    _request: TestIamPermissionsRequest,
14586    _resource: String,
14587    _delegate: Option<&'a mut dyn common::Delegate>,
14588    _additional_params: HashMap<String, String>,
14589    _scopes: BTreeSet<String>,
14590}
14591
14592impl<'a, C> common::CallBuilder for ProjectTestIamPermissionCall<'a, C> {}
14593
14594impl<'a, C> ProjectTestIamPermissionCall<'a, C>
14595where
14596    C: common::Connector,
14597{
14598    /// Perform the operation you have build so far.
14599    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
14600        use std::borrow::Cow;
14601        use std::io::{Read, Seek};
14602
14603        use common::{url::Params, ToParts};
14604        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14605
14606        let mut dd = common::DefaultDelegate;
14607        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14608        dlg.begin(common::MethodInfo {
14609            id: "cloudresourcemanager.projects.testIamPermissions",
14610            http_method: hyper::Method::POST,
14611        });
14612
14613        for &field in ["alt", "resource"].iter() {
14614            if self._additional_params.contains_key(field) {
14615                dlg.finished(false);
14616                return Err(common::Error::FieldClash(field));
14617            }
14618        }
14619
14620        let mut params = Params::with_capacity(4 + self._additional_params.len());
14621        params.push("resource", self._resource);
14622
14623        params.extend(self._additional_params.iter());
14624
14625        params.push("alt", "json");
14626        let mut url = self.hub._base_url.clone() + "v3/{+resource}:testIamPermissions";
14627        if self._scopes.is_empty() {
14628            self._scopes
14629                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
14630        }
14631
14632        #[allow(clippy::single_element_loop)]
14633        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
14634            url = params.uri_replacement(url, param_name, find_this, true);
14635        }
14636        {
14637            let to_remove = ["resource"];
14638            params.remove_params(&to_remove);
14639        }
14640
14641        let url = params.parse_with_url(&url);
14642
14643        let mut json_mime_type = mime::APPLICATION_JSON;
14644        let mut request_value_reader = {
14645            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14646            common::remove_json_null_values(&mut value);
14647            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14648            serde_json::to_writer(&mut dst, &value).unwrap();
14649            dst
14650        };
14651        let request_size = request_value_reader
14652            .seek(std::io::SeekFrom::End(0))
14653            .unwrap();
14654        request_value_reader
14655            .seek(std::io::SeekFrom::Start(0))
14656            .unwrap();
14657
14658        loop {
14659            let token = match self
14660                .hub
14661                .auth
14662                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14663                .await
14664            {
14665                Ok(token) => token,
14666                Err(e) => match dlg.token(e) {
14667                    Ok(token) => token,
14668                    Err(e) => {
14669                        dlg.finished(false);
14670                        return Err(common::Error::MissingToken(e));
14671                    }
14672                },
14673            };
14674            request_value_reader
14675                .seek(std::io::SeekFrom::Start(0))
14676                .unwrap();
14677            let mut req_result = {
14678                let client = &self.hub.client;
14679                dlg.pre_request();
14680                let mut req_builder = hyper::Request::builder()
14681                    .method(hyper::Method::POST)
14682                    .uri(url.as_str())
14683                    .header(USER_AGENT, self.hub._user_agent.clone());
14684
14685                if let Some(token) = token.as_ref() {
14686                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14687                }
14688
14689                let request = req_builder
14690                    .header(CONTENT_TYPE, json_mime_type.to_string())
14691                    .header(CONTENT_LENGTH, request_size as u64)
14692                    .body(common::to_body(
14693                        request_value_reader.get_ref().clone().into(),
14694                    ));
14695
14696                client.request(request.unwrap()).await
14697            };
14698
14699            match req_result {
14700                Err(err) => {
14701                    if let common::Retry::After(d) = dlg.http_error(&err) {
14702                        sleep(d).await;
14703                        continue;
14704                    }
14705                    dlg.finished(false);
14706                    return Err(common::Error::HttpError(err));
14707                }
14708                Ok(res) => {
14709                    let (mut parts, body) = res.into_parts();
14710                    let mut body = common::Body::new(body);
14711                    if !parts.status.is_success() {
14712                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14713                        let error = serde_json::from_str(&common::to_string(&bytes));
14714                        let response = common::to_response(parts, bytes.into());
14715
14716                        if let common::Retry::After(d) =
14717                            dlg.http_failure(&response, error.as_ref().ok())
14718                        {
14719                            sleep(d).await;
14720                            continue;
14721                        }
14722
14723                        dlg.finished(false);
14724
14725                        return Err(match error {
14726                            Ok(value) => common::Error::BadRequest(value),
14727                            _ => common::Error::Failure(response),
14728                        });
14729                    }
14730                    let response = {
14731                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14732                        let encoded = common::to_string(&bytes);
14733                        match serde_json::from_str(&encoded) {
14734                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14735                            Err(error) => {
14736                                dlg.response_json_decode_error(&encoded, &error);
14737                                return Err(common::Error::JsonDecodeError(
14738                                    encoded.to_string(),
14739                                    error,
14740                                ));
14741                            }
14742                        }
14743                    };
14744
14745                    dlg.finished(true);
14746                    return Ok(response);
14747                }
14748            }
14749        }
14750    }
14751
14752    ///
14753    /// Sets the *request* property to the given value.
14754    ///
14755    /// Even though the property as already been set when instantiating this call,
14756    /// we provide this method for API completeness.
14757    pub fn request(
14758        mut self,
14759        new_value: TestIamPermissionsRequest,
14760    ) -> ProjectTestIamPermissionCall<'a, C> {
14761        self._request = new_value;
14762        self
14763    }
14764    /// 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.
14765    ///
14766    /// Sets the *resource* path property to the given value.
14767    ///
14768    /// Even though the property as already been set when instantiating this call,
14769    /// we provide this method for API completeness.
14770    pub fn resource(mut self, new_value: &str) -> ProjectTestIamPermissionCall<'a, C> {
14771        self._resource = new_value.to_string();
14772        self
14773    }
14774    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14775    /// while executing the actual API request.
14776    ///
14777    /// ````text
14778    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14779    /// ````
14780    ///
14781    /// Sets the *delegate* property to the given value.
14782    pub fn delegate(
14783        mut self,
14784        new_value: &'a mut dyn common::Delegate,
14785    ) -> ProjectTestIamPermissionCall<'a, C> {
14786        self._delegate = Some(new_value);
14787        self
14788    }
14789
14790    /// Set any additional parameter of the query string used in the request.
14791    /// It should be used to set parameters which are not yet available through their own
14792    /// setters.
14793    ///
14794    /// Please note that this method must not be used to set any of the known parameters
14795    /// which have their own setter method. If done anyway, the request will fail.
14796    ///
14797    /// # Additional Parameters
14798    ///
14799    /// * *$.xgafv* (query-string) - V1 error format.
14800    /// * *access_token* (query-string) - OAuth access token.
14801    /// * *alt* (query-string) - Data format for response.
14802    /// * *callback* (query-string) - JSONP
14803    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14804    /// * *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.
14805    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14806    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14807    /// * *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.
14808    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14809    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14810    pub fn param<T>(mut self, name: T, value: T) -> ProjectTestIamPermissionCall<'a, C>
14811    where
14812        T: AsRef<str>,
14813    {
14814        self._additional_params
14815            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14816        self
14817    }
14818
14819    /// Identifies the authorization scope for the method you are building.
14820    ///
14821    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14822    /// [`Scope::CloudPlatformReadOnly`].
14823    ///
14824    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14825    /// tokens for more than one scope.
14826    ///
14827    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14828    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14829    /// sufficient, a read-write scope will do as well.
14830    pub fn add_scope<St>(mut self, scope: St) -> ProjectTestIamPermissionCall<'a, C>
14831    where
14832        St: AsRef<str>,
14833    {
14834        self._scopes.insert(String::from(scope.as_ref()));
14835        self
14836    }
14837    /// Identifies the authorization scope(s) for the method you are building.
14838    ///
14839    /// See [`Self::add_scope()`] for details.
14840    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectTestIamPermissionCall<'a, C>
14841    where
14842        I: IntoIterator<Item = St>,
14843        St: AsRef<str>,
14844    {
14845        self._scopes
14846            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14847        self
14848    }
14849
14850    /// Removes all scopes, and no default scope will be used either.
14851    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14852    /// for details).
14853    pub fn clear_scopes(mut self) -> ProjectTestIamPermissionCall<'a, C> {
14854        self._scopes.clear();
14855        self
14856    }
14857}
14858
14859/// Restores the project identified by the specified `name` (for example, `projects/415104041262`). 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 `resourcemanager.projects.undelete` permission for this project.
14860///
14861/// A builder for the *undelete* method supported by a *project* resource.
14862/// It is not used directly, but through a [`ProjectMethods`] instance.
14863///
14864/// # Example
14865///
14866/// Instantiate a resource method builder
14867///
14868/// ```test_harness,no_run
14869/// # extern crate hyper;
14870/// # extern crate hyper_rustls;
14871/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
14872/// use cloudresourcemanager3::api::UndeleteProjectRequest;
14873/// # async fn dox() {
14874/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14875///
14876/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14877/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14878/// #     .with_native_roots()
14879/// #     .unwrap()
14880/// #     .https_only()
14881/// #     .enable_http2()
14882/// #     .build();
14883///
14884/// # let executor = hyper_util::rt::TokioExecutor::new();
14885/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14886/// #     secret,
14887/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14888/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
14889/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
14890/// #     ),
14891/// # ).build().await.unwrap();
14892///
14893/// # let client = hyper_util::client::legacy::Client::builder(
14894/// #     hyper_util::rt::TokioExecutor::new()
14895/// # )
14896/// # .build(
14897/// #     hyper_rustls::HttpsConnectorBuilder::new()
14898/// #         .with_native_roots()
14899/// #         .unwrap()
14900/// #         .https_or_http()
14901/// #         .enable_http2()
14902/// #         .build()
14903/// # );
14904/// # let mut hub = CloudResourceManager::new(client, auth);
14905/// // As the method needs a request, you would usually fill it with the desired information
14906/// // into the respective structure. Some of the parts shown here might not be applicable !
14907/// // Values shown here are possibly random and not representative !
14908/// let mut req = UndeleteProjectRequest::default();
14909///
14910/// // You can configure optional parameters by calling the respective setters at will, and
14911/// // execute the final call using `doit()`.
14912/// // Values shown here are possibly random and not representative !
14913/// let result = hub.projects().undelete(req, "name")
14914///              .doit().await;
14915/// # }
14916/// ```
14917pub struct ProjectUndeleteCall<'a, C>
14918where
14919    C: 'a,
14920{
14921    hub: &'a CloudResourceManager<C>,
14922    _request: UndeleteProjectRequest,
14923    _name: String,
14924    _delegate: Option<&'a mut dyn common::Delegate>,
14925    _additional_params: HashMap<String, String>,
14926    _scopes: BTreeSet<String>,
14927}
14928
14929impl<'a, C> common::CallBuilder for ProjectUndeleteCall<'a, C> {}
14930
14931impl<'a, C> ProjectUndeleteCall<'a, C>
14932where
14933    C: common::Connector,
14934{
14935    /// Perform the operation you have build so far.
14936    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14937        use std::borrow::Cow;
14938        use std::io::{Read, Seek};
14939
14940        use common::{url::Params, ToParts};
14941        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14942
14943        let mut dd = common::DefaultDelegate;
14944        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14945        dlg.begin(common::MethodInfo {
14946            id: "cloudresourcemanager.projects.undelete",
14947            http_method: hyper::Method::POST,
14948        });
14949
14950        for &field in ["alt", "name"].iter() {
14951            if self._additional_params.contains_key(field) {
14952                dlg.finished(false);
14953                return Err(common::Error::FieldClash(field));
14954            }
14955        }
14956
14957        let mut params = Params::with_capacity(4 + self._additional_params.len());
14958        params.push("name", self._name);
14959
14960        params.extend(self._additional_params.iter());
14961
14962        params.push("alt", "json");
14963        let mut url = self.hub._base_url.clone() + "v3/{+name}:undelete";
14964        if self._scopes.is_empty() {
14965            self._scopes
14966                .insert(Scope::CloudPlatform.as_ref().to_string());
14967        }
14968
14969        #[allow(clippy::single_element_loop)]
14970        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14971            url = params.uri_replacement(url, param_name, find_this, true);
14972        }
14973        {
14974            let to_remove = ["name"];
14975            params.remove_params(&to_remove);
14976        }
14977
14978        let url = params.parse_with_url(&url);
14979
14980        let mut json_mime_type = mime::APPLICATION_JSON;
14981        let mut request_value_reader = {
14982            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14983            common::remove_json_null_values(&mut value);
14984            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14985            serde_json::to_writer(&mut dst, &value).unwrap();
14986            dst
14987        };
14988        let request_size = request_value_reader
14989            .seek(std::io::SeekFrom::End(0))
14990            .unwrap();
14991        request_value_reader
14992            .seek(std::io::SeekFrom::Start(0))
14993            .unwrap();
14994
14995        loop {
14996            let token = match self
14997                .hub
14998                .auth
14999                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15000                .await
15001            {
15002                Ok(token) => token,
15003                Err(e) => match dlg.token(e) {
15004                    Ok(token) => token,
15005                    Err(e) => {
15006                        dlg.finished(false);
15007                        return Err(common::Error::MissingToken(e));
15008                    }
15009                },
15010            };
15011            request_value_reader
15012                .seek(std::io::SeekFrom::Start(0))
15013                .unwrap();
15014            let mut req_result = {
15015                let client = &self.hub.client;
15016                dlg.pre_request();
15017                let mut req_builder = hyper::Request::builder()
15018                    .method(hyper::Method::POST)
15019                    .uri(url.as_str())
15020                    .header(USER_AGENT, self.hub._user_agent.clone());
15021
15022                if let Some(token) = token.as_ref() {
15023                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15024                }
15025
15026                let request = req_builder
15027                    .header(CONTENT_TYPE, json_mime_type.to_string())
15028                    .header(CONTENT_LENGTH, request_size as u64)
15029                    .body(common::to_body(
15030                        request_value_reader.get_ref().clone().into(),
15031                    ));
15032
15033                client.request(request.unwrap()).await
15034            };
15035
15036            match req_result {
15037                Err(err) => {
15038                    if let common::Retry::After(d) = dlg.http_error(&err) {
15039                        sleep(d).await;
15040                        continue;
15041                    }
15042                    dlg.finished(false);
15043                    return Err(common::Error::HttpError(err));
15044                }
15045                Ok(res) => {
15046                    let (mut parts, body) = res.into_parts();
15047                    let mut body = common::Body::new(body);
15048                    if !parts.status.is_success() {
15049                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15050                        let error = serde_json::from_str(&common::to_string(&bytes));
15051                        let response = common::to_response(parts, bytes.into());
15052
15053                        if let common::Retry::After(d) =
15054                            dlg.http_failure(&response, error.as_ref().ok())
15055                        {
15056                            sleep(d).await;
15057                            continue;
15058                        }
15059
15060                        dlg.finished(false);
15061
15062                        return Err(match error {
15063                            Ok(value) => common::Error::BadRequest(value),
15064                            _ => common::Error::Failure(response),
15065                        });
15066                    }
15067                    let response = {
15068                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15069                        let encoded = common::to_string(&bytes);
15070                        match serde_json::from_str(&encoded) {
15071                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15072                            Err(error) => {
15073                                dlg.response_json_decode_error(&encoded, &error);
15074                                return Err(common::Error::JsonDecodeError(
15075                                    encoded.to_string(),
15076                                    error,
15077                                ));
15078                            }
15079                        }
15080                    };
15081
15082                    dlg.finished(true);
15083                    return Ok(response);
15084                }
15085            }
15086        }
15087    }
15088
15089    ///
15090    /// Sets the *request* property to the given value.
15091    ///
15092    /// Even though the property as already been set when instantiating this call,
15093    /// we provide this method for API completeness.
15094    pub fn request(mut self, new_value: UndeleteProjectRequest) -> ProjectUndeleteCall<'a, C> {
15095        self._request = new_value;
15096        self
15097    }
15098    /// Required. The name of the project (for example, `projects/415104041262`). Required.
15099    ///
15100    /// Sets the *name* path property to the given value.
15101    ///
15102    /// Even though the property as already been set when instantiating this call,
15103    /// we provide this method for API completeness.
15104    pub fn name(mut self, new_value: &str) -> ProjectUndeleteCall<'a, C> {
15105        self._name = new_value.to_string();
15106        self
15107    }
15108    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15109    /// while executing the actual API request.
15110    ///
15111    /// ````text
15112    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15113    /// ````
15114    ///
15115    /// Sets the *delegate* property to the given value.
15116    pub fn delegate(
15117        mut self,
15118        new_value: &'a mut dyn common::Delegate,
15119    ) -> ProjectUndeleteCall<'a, C> {
15120        self._delegate = Some(new_value);
15121        self
15122    }
15123
15124    /// Set any additional parameter of the query string used in the request.
15125    /// It should be used to set parameters which are not yet available through their own
15126    /// setters.
15127    ///
15128    /// Please note that this method must not be used to set any of the known parameters
15129    /// which have their own setter method. If done anyway, the request will fail.
15130    ///
15131    /// # Additional Parameters
15132    ///
15133    /// * *$.xgafv* (query-string) - V1 error format.
15134    /// * *access_token* (query-string) - OAuth access token.
15135    /// * *alt* (query-string) - Data format for response.
15136    /// * *callback* (query-string) - JSONP
15137    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15138    /// * *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.
15139    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15140    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15141    /// * *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.
15142    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15143    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15144    pub fn param<T>(mut self, name: T, value: T) -> ProjectUndeleteCall<'a, C>
15145    where
15146        T: AsRef<str>,
15147    {
15148        self._additional_params
15149            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15150        self
15151    }
15152
15153    /// Identifies the authorization scope for the method you are building.
15154    ///
15155    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15156    /// [`Scope::CloudPlatform`].
15157    ///
15158    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15159    /// tokens for more than one scope.
15160    ///
15161    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15162    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15163    /// sufficient, a read-write scope will do as well.
15164    pub fn add_scope<St>(mut self, scope: St) -> ProjectUndeleteCall<'a, C>
15165    where
15166        St: AsRef<str>,
15167    {
15168        self._scopes.insert(String::from(scope.as_ref()));
15169        self
15170    }
15171    /// Identifies the authorization scope(s) for the method you are building.
15172    ///
15173    /// See [`Self::add_scope()`] for details.
15174    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectUndeleteCall<'a, C>
15175    where
15176        I: IntoIterator<Item = St>,
15177        St: AsRef<str>,
15178    {
15179        self._scopes
15180            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15181        self
15182    }
15183
15184    /// Removes all scopes, and no default scope will be used either.
15185    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15186    /// for details).
15187    pub fn clear_scopes(mut self) -> ProjectUndeleteCall<'a, C> {
15188        self._scopes.clear();
15189        self
15190    }
15191}
15192
15193/// Creates a TagBinding between a TagValue and a Google Cloud resource.
15194///
15195/// A builder for the *create* method supported by a *tagBinding* resource.
15196/// It is not used directly, but through a [`TagBindingMethods`] instance.
15197///
15198/// # Example
15199///
15200/// Instantiate a resource method builder
15201///
15202/// ```test_harness,no_run
15203/// # extern crate hyper;
15204/// # extern crate hyper_rustls;
15205/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
15206/// use cloudresourcemanager3::api::TagBinding;
15207/// # async fn dox() {
15208/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15209///
15210/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15211/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15212/// #     .with_native_roots()
15213/// #     .unwrap()
15214/// #     .https_only()
15215/// #     .enable_http2()
15216/// #     .build();
15217///
15218/// # let executor = hyper_util::rt::TokioExecutor::new();
15219/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15220/// #     secret,
15221/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15222/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15223/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15224/// #     ),
15225/// # ).build().await.unwrap();
15226///
15227/// # let client = hyper_util::client::legacy::Client::builder(
15228/// #     hyper_util::rt::TokioExecutor::new()
15229/// # )
15230/// # .build(
15231/// #     hyper_rustls::HttpsConnectorBuilder::new()
15232/// #         .with_native_roots()
15233/// #         .unwrap()
15234/// #         .https_or_http()
15235/// #         .enable_http2()
15236/// #         .build()
15237/// # );
15238/// # let mut hub = CloudResourceManager::new(client, auth);
15239/// // As the method needs a request, you would usually fill it with the desired information
15240/// // into the respective structure. Some of the parts shown here might not be applicable !
15241/// // Values shown here are possibly random and not representative !
15242/// let mut req = TagBinding::default();
15243///
15244/// // You can configure optional parameters by calling the respective setters at will, and
15245/// // execute the final call using `doit()`.
15246/// // Values shown here are possibly random and not representative !
15247/// let result = hub.tag_bindings().create(req)
15248///              .validate_only(false)
15249///              .doit().await;
15250/// # }
15251/// ```
15252pub struct TagBindingCreateCall<'a, C>
15253where
15254    C: 'a,
15255{
15256    hub: &'a CloudResourceManager<C>,
15257    _request: TagBinding,
15258    _validate_only: Option<bool>,
15259    _delegate: Option<&'a mut dyn common::Delegate>,
15260    _additional_params: HashMap<String, String>,
15261    _scopes: BTreeSet<String>,
15262}
15263
15264impl<'a, C> common::CallBuilder for TagBindingCreateCall<'a, C> {}
15265
15266impl<'a, C> TagBindingCreateCall<'a, C>
15267where
15268    C: common::Connector,
15269{
15270    /// Perform the operation you have build so far.
15271    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15272        use std::borrow::Cow;
15273        use std::io::{Read, Seek};
15274
15275        use common::{url::Params, ToParts};
15276        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15277
15278        let mut dd = common::DefaultDelegate;
15279        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15280        dlg.begin(common::MethodInfo {
15281            id: "cloudresourcemanager.tagBindings.create",
15282            http_method: hyper::Method::POST,
15283        });
15284
15285        for &field in ["alt", "validateOnly"].iter() {
15286            if self._additional_params.contains_key(field) {
15287                dlg.finished(false);
15288                return Err(common::Error::FieldClash(field));
15289            }
15290        }
15291
15292        let mut params = Params::with_capacity(4 + self._additional_params.len());
15293        if let Some(value) = self._validate_only.as_ref() {
15294            params.push("validateOnly", value.to_string());
15295        }
15296
15297        params.extend(self._additional_params.iter());
15298
15299        params.push("alt", "json");
15300        let mut url = self.hub._base_url.clone() + "v3/tagBindings";
15301        if self._scopes.is_empty() {
15302            self._scopes
15303                .insert(Scope::CloudPlatform.as_ref().to_string());
15304        }
15305
15306        let url = params.parse_with_url(&url);
15307
15308        let mut json_mime_type = mime::APPLICATION_JSON;
15309        let mut request_value_reader = {
15310            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15311            common::remove_json_null_values(&mut value);
15312            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15313            serde_json::to_writer(&mut dst, &value).unwrap();
15314            dst
15315        };
15316        let request_size = request_value_reader
15317            .seek(std::io::SeekFrom::End(0))
15318            .unwrap();
15319        request_value_reader
15320            .seek(std::io::SeekFrom::Start(0))
15321            .unwrap();
15322
15323        loop {
15324            let token = match self
15325                .hub
15326                .auth
15327                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15328                .await
15329            {
15330                Ok(token) => token,
15331                Err(e) => match dlg.token(e) {
15332                    Ok(token) => token,
15333                    Err(e) => {
15334                        dlg.finished(false);
15335                        return Err(common::Error::MissingToken(e));
15336                    }
15337                },
15338            };
15339            request_value_reader
15340                .seek(std::io::SeekFrom::Start(0))
15341                .unwrap();
15342            let mut req_result = {
15343                let client = &self.hub.client;
15344                dlg.pre_request();
15345                let mut req_builder = hyper::Request::builder()
15346                    .method(hyper::Method::POST)
15347                    .uri(url.as_str())
15348                    .header(USER_AGENT, self.hub._user_agent.clone());
15349
15350                if let Some(token) = token.as_ref() {
15351                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15352                }
15353
15354                let request = req_builder
15355                    .header(CONTENT_TYPE, json_mime_type.to_string())
15356                    .header(CONTENT_LENGTH, request_size as u64)
15357                    .body(common::to_body(
15358                        request_value_reader.get_ref().clone().into(),
15359                    ));
15360
15361                client.request(request.unwrap()).await
15362            };
15363
15364            match req_result {
15365                Err(err) => {
15366                    if let common::Retry::After(d) = dlg.http_error(&err) {
15367                        sleep(d).await;
15368                        continue;
15369                    }
15370                    dlg.finished(false);
15371                    return Err(common::Error::HttpError(err));
15372                }
15373                Ok(res) => {
15374                    let (mut parts, body) = res.into_parts();
15375                    let mut body = common::Body::new(body);
15376                    if !parts.status.is_success() {
15377                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15378                        let error = serde_json::from_str(&common::to_string(&bytes));
15379                        let response = common::to_response(parts, bytes.into());
15380
15381                        if let common::Retry::After(d) =
15382                            dlg.http_failure(&response, error.as_ref().ok())
15383                        {
15384                            sleep(d).await;
15385                            continue;
15386                        }
15387
15388                        dlg.finished(false);
15389
15390                        return Err(match error {
15391                            Ok(value) => common::Error::BadRequest(value),
15392                            _ => common::Error::Failure(response),
15393                        });
15394                    }
15395                    let response = {
15396                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15397                        let encoded = common::to_string(&bytes);
15398                        match serde_json::from_str(&encoded) {
15399                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15400                            Err(error) => {
15401                                dlg.response_json_decode_error(&encoded, &error);
15402                                return Err(common::Error::JsonDecodeError(
15403                                    encoded.to_string(),
15404                                    error,
15405                                ));
15406                            }
15407                        }
15408                    };
15409
15410                    dlg.finished(true);
15411                    return Ok(response);
15412                }
15413            }
15414        }
15415    }
15416
15417    ///
15418    /// Sets the *request* property to the given value.
15419    ///
15420    /// Even though the property as already been set when instantiating this call,
15421    /// we provide this method for API completeness.
15422    pub fn request(mut self, new_value: TagBinding) -> TagBindingCreateCall<'a, C> {
15423        self._request = new_value;
15424        self
15425    }
15426    /// Optional. Set to true to perform the validations necessary for creating the resource, but not actually perform the action.
15427    ///
15428    /// Sets the *validate only* query property to the given value.
15429    pub fn validate_only(mut self, new_value: bool) -> TagBindingCreateCall<'a, C> {
15430        self._validate_only = Some(new_value);
15431        self
15432    }
15433    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15434    /// while executing the actual API request.
15435    ///
15436    /// ````text
15437    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15438    /// ````
15439    ///
15440    /// Sets the *delegate* property to the given value.
15441    pub fn delegate(
15442        mut self,
15443        new_value: &'a mut dyn common::Delegate,
15444    ) -> TagBindingCreateCall<'a, C> {
15445        self._delegate = Some(new_value);
15446        self
15447    }
15448
15449    /// Set any additional parameter of the query string used in the request.
15450    /// It should be used to set parameters which are not yet available through their own
15451    /// setters.
15452    ///
15453    /// Please note that this method must not be used to set any of the known parameters
15454    /// which have their own setter method. If done anyway, the request will fail.
15455    ///
15456    /// # Additional Parameters
15457    ///
15458    /// * *$.xgafv* (query-string) - V1 error format.
15459    /// * *access_token* (query-string) - OAuth access token.
15460    /// * *alt* (query-string) - Data format for response.
15461    /// * *callback* (query-string) - JSONP
15462    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15463    /// * *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.
15464    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15465    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15466    /// * *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.
15467    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15468    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15469    pub fn param<T>(mut self, name: T, value: T) -> TagBindingCreateCall<'a, C>
15470    where
15471        T: AsRef<str>,
15472    {
15473        self._additional_params
15474            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15475        self
15476    }
15477
15478    /// Identifies the authorization scope for the method you are building.
15479    ///
15480    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15481    /// [`Scope::CloudPlatform`].
15482    ///
15483    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15484    /// tokens for more than one scope.
15485    ///
15486    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15487    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15488    /// sufficient, a read-write scope will do as well.
15489    pub fn add_scope<St>(mut self, scope: St) -> TagBindingCreateCall<'a, C>
15490    where
15491        St: AsRef<str>,
15492    {
15493        self._scopes.insert(String::from(scope.as_ref()));
15494        self
15495    }
15496    /// Identifies the authorization scope(s) for the method you are building.
15497    ///
15498    /// See [`Self::add_scope()`] for details.
15499    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagBindingCreateCall<'a, C>
15500    where
15501        I: IntoIterator<Item = St>,
15502        St: AsRef<str>,
15503    {
15504        self._scopes
15505            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15506        self
15507    }
15508
15509    /// Removes all scopes, and no default scope will be used either.
15510    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15511    /// for details).
15512    pub fn clear_scopes(mut self) -> TagBindingCreateCall<'a, C> {
15513        self._scopes.clear();
15514        self
15515    }
15516}
15517
15518/// Deletes a TagBinding.
15519///
15520/// A builder for the *delete* method supported by a *tagBinding* resource.
15521/// It is not used directly, but through a [`TagBindingMethods`] instance.
15522///
15523/// # Example
15524///
15525/// Instantiate a resource method builder
15526///
15527/// ```test_harness,no_run
15528/// # extern crate hyper;
15529/// # extern crate hyper_rustls;
15530/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
15531/// # async fn dox() {
15532/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15533///
15534/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15535/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15536/// #     .with_native_roots()
15537/// #     .unwrap()
15538/// #     .https_only()
15539/// #     .enable_http2()
15540/// #     .build();
15541///
15542/// # let executor = hyper_util::rt::TokioExecutor::new();
15543/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15544/// #     secret,
15545/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15546/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15547/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15548/// #     ),
15549/// # ).build().await.unwrap();
15550///
15551/// # let client = hyper_util::client::legacy::Client::builder(
15552/// #     hyper_util::rt::TokioExecutor::new()
15553/// # )
15554/// # .build(
15555/// #     hyper_rustls::HttpsConnectorBuilder::new()
15556/// #         .with_native_roots()
15557/// #         .unwrap()
15558/// #         .https_or_http()
15559/// #         .enable_http2()
15560/// #         .build()
15561/// # );
15562/// # let mut hub = CloudResourceManager::new(client, auth);
15563/// // You can configure optional parameters by calling the respective setters at will, and
15564/// // execute the final call using `doit()`.
15565/// // Values shown here are possibly random and not representative !
15566/// let result = hub.tag_bindings().delete("name")
15567///              .doit().await;
15568/// # }
15569/// ```
15570pub struct TagBindingDeleteCall<'a, C>
15571where
15572    C: 'a,
15573{
15574    hub: &'a CloudResourceManager<C>,
15575    _name: String,
15576    _delegate: Option<&'a mut dyn common::Delegate>,
15577    _additional_params: HashMap<String, String>,
15578    _scopes: BTreeSet<String>,
15579}
15580
15581impl<'a, C> common::CallBuilder for TagBindingDeleteCall<'a, C> {}
15582
15583impl<'a, C> TagBindingDeleteCall<'a, C>
15584where
15585    C: common::Connector,
15586{
15587    /// Perform the operation you have build so far.
15588    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15589        use std::borrow::Cow;
15590        use std::io::{Read, Seek};
15591
15592        use common::{url::Params, ToParts};
15593        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15594
15595        let mut dd = common::DefaultDelegate;
15596        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15597        dlg.begin(common::MethodInfo {
15598            id: "cloudresourcemanager.tagBindings.delete",
15599            http_method: hyper::Method::DELETE,
15600        });
15601
15602        for &field in ["alt", "name"].iter() {
15603            if self._additional_params.contains_key(field) {
15604                dlg.finished(false);
15605                return Err(common::Error::FieldClash(field));
15606            }
15607        }
15608
15609        let mut params = Params::with_capacity(3 + self._additional_params.len());
15610        params.push("name", self._name);
15611
15612        params.extend(self._additional_params.iter());
15613
15614        params.push("alt", "json");
15615        let mut url = self.hub._base_url.clone() + "v3/{+name}";
15616        if self._scopes.is_empty() {
15617            self._scopes
15618                .insert(Scope::CloudPlatform.as_ref().to_string());
15619        }
15620
15621        #[allow(clippy::single_element_loop)]
15622        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15623            url = params.uri_replacement(url, param_name, find_this, true);
15624        }
15625        {
15626            let to_remove = ["name"];
15627            params.remove_params(&to_remove);
15628        }
15629
15630        let url = params.parse_with_url(&url);
15631
15632        loop {
15633            let token = match self
15634                .hub
15635                .auth
15636                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15637                .await
15638            {
15639                Ok(token) => token,
15640                Err(e) => match dlg.token(e) {
15641                    Ok(token) => token,
15642                    Err(e) => {
15643                        dlg.finished(false);
15644                        return Err(common::Error::MissingToken(e));
15645                    }
15646                },
15647            };
15648            let mut req_result = {
15649                let client = &self.hub.client;
15650                dlg.pre_request();
15651                let mut req_builder = hyper::Request::builder()
15652                    .method(hyper::Method::DELETE)
15653                    .uri(url.as_str())
15654                    .header(USER_AGENT, self.hub._user_agent.clone());
15655
15656                if let Some(token) = token.as_ref() {
15657                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15658                }
15659
15660                let request = req_builder
15661                    .header(CONTENT_LENGTH, 0_u64)
15662                    .body(common::to_body::<String>(None));
15663
15664                client.request(request.unwrap()).await
15665            };
15666
15667            match req_result {
15668                Err(err) => {
15669                    if let common::Retry::After(d) = dlg.http_error(&err) {
15670                        sleep(d).await;
15671                        continue;
15672                    }
15673                    dlg.finished(false);
15674                    return Err(common::Error::HttpError(err));
15675                }
15676                Ok(res) => {
15677                    let (mut parts, body) = res.into_parts();
15678                    let mut body = common::Body::new(body);
15679                    if !parts.status.is_success() {
15680                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15681                        let error = serde_json::from_str(&common::to_string(&bytes));
15682                        let response = common::to_response(parts, bytes.into());
15683
15684                        if let common::Retry::After(d) =
15685                            dlg.http_failure(&response, error.as_ref().ok())
15686                        {
15687                            sleep(d).await;
15688                            continue;
15689                        }
15690
15691                        dlg.finished(false);
15692
15693                        return Err(match error {
15694                            Ok(value) => common::Error::BadRequest(value),
15695                            _ => common::Error::Failure(response),
15696                        });
15697                    }
15698                    let response = {
15699                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15700                        let encoded = common::to_string(&bytes);
15701                        match serde_json::from_str(&encoded) {
15702                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15703                            Err(error) => {
15704                                dlg.response_json_decode_error(&encoded, &error);
15705                                return Err(common::Error::JsonDecodeError(
15706                                    encoded.to_string(),
15707                                    error,
15708                                ));
15709                            }
15710                        }
15711                    };
15712
15713                    dlg.finished(true);
15714                    return Ok(response);
15715                }
15716            }
15717        }
15718    }
15719
15720    /// Required. The name of the TagBinding. This is a String of the form: `tagBindings/{id}` (e.g. `tagBindings/%2F%2Fcloudresourcemanager.googleapis.com%2Fprojects%2F123/tagValues/456`).
15721    ///
15722    /// Sets the *name* path property to the given value.
15723    ///
15724    /// Even though the property as already been set when instantiating this call,
15725    /// we provide this method for API completeness.
15726    pub fn name(mut self, new_value: &str) -> TagBindingDeleteCall<'a, C> {
15727        self._name = new_value.to_string();
15728        self
15729    }
15730    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15731    /// while executing the actual API request.
15732    ///
15733    /// ````text
15734    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15735    /// ````
15736    ///
15737    /// Sets the *delegate* property to the given value.
15738    pub fn delegate(
15739        mut self,
15740        new_value: &'a mut dyn common::Delegate,
15741    ) -> TagBindingDeleteCall<'a, C> {
15742        self._delegate = Some(new_value);
15743        self
15744    }
15745
15746    /// Set any additional parameter of the query string used in the request.
15747    /// It should be used to set parameters which are not yet available through their own
15748    /// setters.
15749    ///
15750    /// Please note that this method must not be used to set any of the known parameters
15751    /// which have their own setter method. If done anyway, the request will fail.
15752    ///
15753    /// # Additional Parameters
15754    ///
15755    /// * *$.xgafv* (query-string) - V1 error format.
15756    /// * *access_token* (query-string) - OAuth access token.
15757    /// * *alt* (query-string) - Data format for response.
15758    /// * *callback* (query-string) - JSONP
15759    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15760    /// * *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.
15761    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15762    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15763    /// * *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.
15764    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15765    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15766    pub fn param<T>(mut self, name: T, value: T) -> TagBindingDeleteCall<'a, C>
15767    where
15768        T: AsRef<str>,
15769    {
15770        self._additional_params
15771            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15772        self
15773    }
15774
15775    /// Identifies the authorization scope for the method you are building.
15776    ///
15777    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15778    /// [`Scope::CloudPlatform`].
15779    ///
15780    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15781    /// tokens for more than one scope.
15782    ///
15783    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15784    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15785    /// sufficient, a read-write scope will do as well.
15786    pub fn add_scope<St>(mut self, scope: St) -> TagBindingDeleteCall<'a, C>
15787    where
15788        St: AsRef<str>,
15789    {
15790        self._scopes.insert(String::from(scope.as_ref()));
15791        self
15792    }
15793    /// Identifies the authorization scope(s) for the method you are building.
15794    ///
15795    /// See [`Self::add_scope()`] for details.
15796    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagBindingDeleteCall<'a, C>
15797    where
15798        I: IntoIterator<Item = St>,
15799        St: AsRef<str>,
15800    {
15801        self._scopes
15802            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15803        self
15804    }
15805
15806    /// Removes all scopes, and no default scope will be used either.
15807    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15808    /// for details).
15809    pub fn clear_scopes(mut self) -> TagBindingDeleteCall<'a, C> {
15810        self._scopes.clear();
15811        self
15812    }
15813}
15814
15815/// Lists the TagBindings for the given Google Cloud resource, as specified with `parent`. NOTE: The `parent` field is expected to be a full resource name: https://cloud.google.com/apis/design/resource_names#full_resource_name
15816///
15817/// A builder for the *list* method supported by a *tagBinding* resource.
15818/// It is not used directly, but through a [`TagBindingMethods`] instance.
15819///
15820/// # Example
15821///
15822/// Instantiate a resource method builder
15823///
15824/// ```test_harness,no_run
15825/// # extern crate hyper;
15826/// # extern crate hyper_rustls;
15827/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
15828/// # async fn dox() {
15829/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15830///
15831/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15832/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15833/// #     .with_native_roots()
15834/// #     .unwrap()
15835/// #     .https_only()
15836/// #     .enable_http2()
15837/// #     .build();
15838///
15839/// # let executor = hyper_util::rt::TokioExecutor::new();
15840/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15841/// #     secret,
15842/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15843/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
15844/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
15845/// #     ),
15846/// # ).build().await.unwrap();
15847///
15848/// # let client = hyper_util::client::legacy::Client::builder(
15849/// #     hyper_util::rt::TokioExecutor::new()
15850/// # )
15851/// # .build(
15852/// #     hyper_rustls::HttpsConnectorBuilder::new()
15853/// #         .with_native_roots()
15854/// #         .unwrap()
15855/// #         .https_or_http()
15856/// #         .enable_http2()
15857/// #         .build()
15858/// # );
15859/// # let mut hub = CloudResourceManager::new(client, auth);
15860/// // You can configure optional parameters by calling the respective setters at will, and
15861/// // execute the final call using `doit()`.
15862/// // Values shown here are possibly random and not representative !
15863/// let result = hub.tag_bindings().list()
15864///              .parent("vero")
15865///              .page_token("vero")
15866///              .page_size(-88)
15867///              .doit().await;
15868/// # }
15869/// ```
15870pub struct TagBindingListCall<'a, C>
15871where
15872    C: 'a,
15873{
15874    hub: &'a CloudResourceManager<C>,
15875    _parent: Option<String>,
15876    _page_token: Option<String>,
15877    _page_size: Option<i32>,
15878    _delegate: Option<&'a mut dyn common::Delegate>,
15879    _additional_params: HashMap<String, String>,
15880    _scopes: BTreeSet<String>,
15881}
15882
15883impl<'a, C> common::CallBuilder for TagBindingListCall<'a, C> {}
15884
15885impl<'a, C> TagBindingListCall<'a, C>
15886where
15887    C: common::Connector,
15888{
15889    /// Perform the operation you have build so far.
15890    pub async fn doit(mut self) -> common::Result<(common::Response, ListTagBindingsResponse)> {
15891        use std::borrow::Cow;
15892        use std::io::{Read, Seek};
15893
15894        use common::{url::Params, ToParts};
15895        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15896
15897        let mut dd = common::DefaultDelegate;
15898        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15899        dlg.begin(common::MethodInfo {
15900            id: "cloudresourcemanager.tagBindings.list",
15901            http_method: hyper::Method::GET,
15902        });
15903
15904        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
15905            if self._additional_params.contains_key(field) {
15906                dlg.finished(false);
15907                return Err(common::Error::FieldClash(field));
15908            }
15909        }
15910
15911        let mut params = Params::with_capacity(5 + self._additional_params.len());
15912        if let Some(value) = self._parent.as_ref() {
15913            params.push("parent", value);
15914        }
15915        if let Some(value) = self._page_token.as_ref() {
15916            params.push("pageToken", value);
15917        }
15918        if let Some(value) = self._page_size.as_ref() {
15919            params.push("pageSize", value.to_string());
15920        }
15921
15922        params.extend(self._additional_params.iter());
15923
15924        params.push("alt", "json");
15925        let mut url = self.hub._base_url.clone() + "v3/tagBindings";
15926        if self._scopes.is_empty() {
15927            self._scopes
15928                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
15929        }
15930
15931        let url = params.parse_with_url(&url);
15932
15933        loop {
15934            let token = match self
15935                .hub
15936                .auth
15937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15938                .await
15939            {
15940                Ok(token) => token,
15941                Err(e) => match dlg.token(e) {
15942                    Ok(token) => token,
15943                    Err(e) => {
15944                        dlg.finished(false);
15945                        return Err(common::Error::MissingToken(e));
15946                    }
15947                },
15948            };
15949            let mut req_result = {
15950                let client = &self.hub.client;
15951                dlg.pre_request();
15952                let mut req_builder = hyper::Request::builder()
15953                    .method(hyper::Method::GET)
15954                    .uri(url.as_str())
15955                    .header(USER_AGENT, self.hub._user_agent.clone());
15956
15957                if let Some(token) = token.as_ref() {
15958                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15959                }
15960
15961                let request = req_builder
15962                    .header(CONTENT_LENGTH, 0_u64)
15963                    .body(common::to_body::<String>(None));
15964
15965                client.request(request.unwrap()).await
15966            };
15967
15968            match req_result {
15969                Err(err) => {
15970                    if let common::Retry::After(d) = dlg.http_error(&err) {
15971                        sleep(d).await;
15972                        continue;
15973                    }
15974                    dlg.finished(false);
15975                    return Err(common::Error::HttpError(err));
15976                }
15977                Ok(res) => {
15978                    let (mut parts, body) = res.into_parts();
15979                    let mut body = common::Body::new(body);
15980                    if !parts.status.is_success() {
15981                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15982                        let error = serde_json::from_str(&common::to_string(&bytes));
15983                        let response = common::to_response(parts, bytes.into());
15984
15985                        if let common::Retry::After(d) =
15986                            dlg.http_failure(&response, error.as_ref().ok())
15987                        {
15988                            sleep(d).await;
15989                            continue;
15990                        }
15991
15992                        dlg.finished(false);
15993
15994                        return Err(match error {
15995                            Ok(value) => common::Error::BadRequest(value),
15996                            _ => common::Error::Failure(response),
15997                        });
15998                    }
15999                    let response = {
16000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16001                        let encoded = common::to_string(&bytes);
16002                        match serde_json::from_str(&encoded) {
16003                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16004                            Err(error) => {
16005                                dlg.response_json_decode_error(&encoded, &error);
16006                                return Err(common::Error::JsonDecodeError(
16007                                    encoded.to_string(),
16008                                    error,
16009                                ));
16010                            }
16011                        }
16012                    };
16013
16014                    dlg.finished(true);
16015                    return Ok(response);
16016                }
16017            }
16018        }
16019    }
16020
16021    /// Required. The full resource name of a resource for which you want to list existing TagBindings. E.g. "//cloudresourcemanager.googleapis.com/projects/123"
16022    ///
16023    /// Sets the *parent* query property to the given value.
16024    pub fn parent(mut self, new_value: &str) -> TagBindingListCall<'a, C> {
16025        self._parent = Some(new_value.to_string());
16026        self
16027    }
16028    /// Optional. A pagination token returned from a previous call to `ListTagBindings` that indicates where this listing should continue from.
16029    ///
16030    /// Sets the *page token* query property to the given value.
16031    pub fn page_token(mut self, new_value: &str) -> TagBindingListCall<'a, C> {
16032        self._page_token = Some(new_value.to_string());
16033        self
16034    }
16035    /// Optional. The maximum number of TagBindings to return in the response. The server allows a maximum of 300 TagBindings to return. If unspecified, the server will use 100 as the default.
16036    ///
16037    /// Sets the *page size* query property to the given value.
16038    pub fn page_size(mut self, new_value: i32) -> TagBindingListCall<'a, C> {
16039        self._page_size = Some(new_value);
16040        self
16041    }
16042    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16043    /// while executing the actual API request.
16044    ///
16045    /// ````text
16046    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16047    /// ````
16048    ///
16049    /// Sets the *delegate* property to the given value.
16050    pub fn delegate(
16051        mut self,
16052        new_value: &'a mut dyn common::Delegate,
16053    ) -> TagBindingListCall<'a, C> {
16054        self._delegate = Some(new_value);
16055        self
16056    }
16057
16058    /// Set any additional parameter of the query string used in the request.
16059    /// It should be used to set parameters which are not yet available through their own
16060    /// setters.
16061    ///
16062    /// Please note that this method must not be used to set any of the known parameters
16063    /// which have their own setter method. If done anyway, the request will fail.
16064    ///
16065    /// # Additional Parameters
16066    ///
16067    /// * *$.xgafv* (query-string) - V1 error format.
16068    /// * *access_token* (query-string) - OAuth access token.
16069    /// * *alt* (query-string) - Data format for response.
16070    /// * *callback* (query-string) - JSONP
16071    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16072    /// * *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.
16073    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16074    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16075    /// * *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.
16076    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16077    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16078    pub fn param<T>(mut self, name: T, value: T) -> TagBindingListCall<'a, C>
16079    where
16080        T: AsRef<str>,
16081    {
16082        self._additional_params
16083            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16084        self
16085    }
16086
16087    /// Identifies the authorization scope for the method you are building.
16088    ///
16089    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16090    /// [`Scope::CloudPlatformReadOnly`].
16091    ///
16092    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16093    /// tokens for more than one scope.
16094    ///
16095    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16096    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16097    /// sufficient, a read-write scope will do as well.
16098    pub fn add_scope<St>(mut self, scope: St) -> TagBindingListCall<'a, C>
16099    where
16100        St: AsRef<str>,
16101    {
16102        self._scopes.insert(String::from(scope.as_ref()));
16103        self
16104    }
16105    /// Identifies the authorization scope(s) for the method you are building.
16106    ///
16107    /// See [`Self::add_scope()`] for details.
16108    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagBindingListCall<'a, C>
16109    where
16110        I: IntoIterator<Item = St>,
16111        St: AsRef<str>,
16112    {
16113        self._scopes
16114            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16115        self
16116    }
16117
16118    /// Removes all scopes, and no default scope will be used either.
16119    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16120    /// for details).
16121    pub fn clear_scopes(mut self) -> TagBindingListCall<'a, C> {
16122        self._scopes.clear();
16123        self
16124    }
16125}
16126
16127/// Creates a new TagKey. If another request with the same parameters is sent while the original request is in process, the second request will receive an error. A maximum of 1000 TagKeys can exist under a parent at any given time.
16128///
16129/// A builder for the *create* method supported by a *tagKey* resource.
16130/// It is not used directly, but through a [`TagKeyMethods`] instance.
16131///
16132/// # Example
16133///
16134/// Instantiate a resource method builder
16135///
16136/// ```test_harness,no_run
16137/// # extern crate hyper;
16138/// # extern crate hyper_rustls;
16139/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
16140/// use cloudresourcemanager3::api::TagKey;
16141/// # async fn dox() {
16142/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16143///
16144/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16145/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16146/// #     .with_native_roots()
16147/// #     .unwrap()
16148/// #     .https_only()
16149/// #     .enable_http2()
16150/// #     .build();
16151///
16152/// # let executor = hyper_util::rt::TokioExecutor::new();
16153/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16154/// #     secret,
16155/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16156/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16157/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16158/// #     ),
16159/// # ).build().await.unwrap();
16160///
16161/// # let client = hyper_util::client::legacy::Client::builder(
16162/// #     hyper_util::rt::TokioExecutor::new()
16163/// # )
16164/// # .build(
16165/// #     hyper_rustls::HttpsConnectorBuilder::new()
16166/// #         .with_native_roots()
16167/// #         .unwrap()
16168/// #         .https_or_http()
16169/// #         .enable_http2()
16170/// #         .build()
16171/// # );
16172/// # let mut hub = CloudResourceManager::new(client, auth);
16173/// // As the method needs a request, you would usually fill it with the desired information
16174/// // into the respective structure. Some of the parts shown here might not be applicable !
16175/// // Values shown here are possibly random and not representative !
16176/// let mut req = TagKey::default();
16177///
16178/// // You can configure optional parameters by calling the respective setters at will, and
16179/// // execute the final call using `doit()`.
16180/// // Values shown here are possibly random and not representative !
16181/// let result = hub.tag_keys().create(req)
16182///              .validate_only(true)
16183///              .doit().await;
16184/// # }
16185/// ```
16186pub struct TagKeyCreateCall<'a, C>
16187where
16188    C: 'a,
16189{
16190    hub: &'a CloudResourceManager<C>,
16191    _request: TagKey,
16192    _validate_only: Option<bool>,
16193    _delegate: Option<&'a mut dyn common::Delegate>,
16194    _additional_params: HashMap<String, String>,
16195    _scopes: BTreeSet<String>,
16196}
16197
16198impl<'a, C> common::CallBuilder for TagKeyCreateCall<'a, C> {}
16199
16200impl<'a, C> TagKeyCreateCall<'a, C>
16201where
16202    C: common::Connector,
16203{
16204    /// Perform the operation you have build so far.
16205    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16206        use std::borrow::Cow;
16207        use std::io::{Read, Seek};
16208
16209        use common::{url::Params, ToParts};
16210        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16211
16212        let mut dd = common::DefaultDelegate;
16213        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16214        dlg.begin(common::MethodInfo {
16215            id: "cloudresourcemanager.tagKeys.create",
16216            http_method: hyper::Method::POST,
16217        });
16218
16219        for &field in ["alt", "validateOnly"].iter() {
16220            if self._additional_params.contains_key(field) {
16221                dlg.finished(false);
16222                return Err(common::Error::FieldClash(field));
16223            }
16224        }
16225
16226        let mut params = Params::with_capacity(4 + self._additional_params.len());
16227        if let Some(value) = self._validate_only.as_ref() {
16228            params.push("validateOnly", value.to_string());
16229        }
16230
16231        params.extend(self._additional_params.iter());
16232
16233        params.push("alt", "json");
16234        let mut url = self.hub._base_url.clone() + "v3/tagKeys";
16235        if self._scopes.is_empty() {
16236            self._scopes
16237                .insert(Scope::CloudPlatform.as_ref().to_string());
16238        }
16239
16240        let url = params.parse_with_url(&url);
16241
16242        let mut json_mime_type = mime::APPLICATION_JSON;
16243        let mut request_value_reader = {
16244            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16245            common::remove_json_null_values(&mut value);
16246            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16247            serde_json::to_writer(&mut dst, &value).unwrap();
16248            dst
16249        };
16250        let request_size = request_value_reader
16251            .seek(std::io::SeekFrom::End(0))
16252            .unwrap();
16253        request_value_reader
16254            .seek(std::io::SeekFrom::Start(0))
16255            .unwrap();
16256
16257        loop {
16258            let token = match self
16259                .hub
16260                .auth
16261                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16262                .await
16263            {
16264                Ok(token) => token,
16265                Err(e) => match dlg.token(e) {
16266                    Ok(token) => token,
16267                    Err(e) => {
16268                        dlg.finished(false);
16269                        return Err(common::Error::MissingToken(e));
16270                    }
16271                },
16272            };
16273            request_value_reader
16274                .seek(std::io::SeekFrom::Start(0))
16275                .unwrap();
16276            let mut req_result = {
16277                let client = &self.hub.client;
16278                dlg.pre_request();
16279                let mut req_builder = hyper::Request::builder()
16280                    .method(hyper::Method::POST)
16281                    .uri(url.as_str())
16282                    .header(USER_AGENT, self.hub._user_agent.clone());
16283
16284                if let Some(token) = token.as_ref() {
16285                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16286                }
16287
16288                let request = req_builder
16289                    .header(CONTENT_TYPE, json_mime_type.to_string())
16290                    .header(CONTENT_LENGTH, request_size as u64)
16291                    .body(common::to_body(
16292                        request_value_reader.get_ref().clone().into(),
16293                    ));
16294
16295                client.request(request.unwrap()).await
16296            };
16297
16298            match req_result {
16299                Err(err) => {
16300                    if let common::Retry::After(d) = dlg.http_error(&err) {
16301                        sleep(d).await;
16302                        continue;
16303                    }
16304                    dlg.finished(false);
16305                    return Err(common::Error::HttpError(err));
16306                }
16307                Ok(res) => {
16308                    let (mut parts, body) = res.into_parts();
16309                    let mut body = common::Body::new(body);
16310                    if !parts.status.is_success() {
16311                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16312                        let error = serde_json::from_str(&common::to_string(&bytes));
16313                        let response = common::to_response(parts, bytes.into());
16314
16315                        if let common::Retry::After(d) =
16316                            dlg.http_failure(&response, error.as_ref().ok())
16317                        {
16318                            sleep(d).await;
16319                            continue;
16320                        }
16321
16322                        dlg.finished(false);
16323
16324                        return Err(match error {
16325                            Ok(value) => common::Error::BadRequest(value),
16326                            _ => common::Error::Failure(response),
16327                        });
16328                    }
16329                    let response = {
16330                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16331                        let encoded = common::to_string(&bytes);
16332                        match serde_json::from_str(&encoded) {
16333                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16334                            Err(error) => {
16335                                dlg.response_json_decode_error(&encoded, &error);
16336                                return Err(common::Error::JsonDecodeError(
16337                                    encoded.to_string(),
16338                                    error,
16339                                ));
16340                            }
16341                        }
16342                    };
16343
16344                    dlg.finished(true);
16345                    return Ok(response);
16346                }
16347            }
16348        }
16349    }
16350
16351    ///
16352    /// Sets the *request* property to the given value.
16353    ///
16354    /// Even though the property as already been set when instantiating this call,
16355    /// we provide this method for API completeness.
16356    pub fn request(mut self, new_value: TagKey) -> TagKeyCreateCall<'a, C> {
16357        self._request = new_value;
16358        self
16359    }
16360    /// Optional. Set to true to perform validations necessary for creating the resource, but not actually perform the action.
16361    ///
16362    /// Sets the *validate only* query property to the given value.
16363    pub fn validate_only(mut self, new_value: bool) -> TagKeyCreateCall<'a, C> {
16364        self._validate_only = Some(new_value);
16365        self
16366    }
16367    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16368    /// while executing the actual API request.
16369    ///
16370    /// ````text
16371    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16372    /// ````
16373    ///
16374    /// Sets the *delegate* property to the given value.
16375    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagKeyCreateCall<'a, C> {
16376        self._delegate = Some(new_value);
16377        self
16378    }
16379
16380    /// Set any additional parameter of the query string used in the request.
16381    /// It should be used to set parameters which are not yet available through their own
16382    /// setters.
16383    ///
16384    /// Please note that this method must not be used to set any of the known parameters
16385    /// which have their own setter method. If done anyway, the request will fail.
16386    ///
16387    /// # Additional Parameters
16388    ///
16389    /// * *$.xgafv* (query-string) - V1 error format.
16390    /// * *access_token* (query-string) - OAuth access token.
16391    /// * *alt* (query-string) - Data format for response.
16392    /// * *callback* (query-string) - JSONP
16393    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16394    /// * *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.
16395    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16396    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16397    /// * *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.
16398    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16399    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16400    pub fn param<T>(mut self, name: T, value: T) -> TagKeyCreateCall<'a, C>
16401    where
16402        T: AsRef<str>,
16403    {
16404        self._additional_params
16405            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16406        self
16407    }
16408
16409    /// Identifies the authorization scope for the method you are building.
16410    ///
16411    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16412    /// [`Scope::CloudPlatform`].
16413    ///
16414    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16415    /// tokens for more than one scope.
16416    ///
16417    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16418    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16419    /// sufficient, a read-write scope will do as well.
16420    pub fn add_scope<St>(mut self, scope: St) -> TagKeyCreateCall<'a, C>
16421    where
16422        St: AsRef<str>,
16423    {
16424        self._scopes.insert(String::from(scope.as_ref()));
16425        self
16426    }
16427    /// Identifies the authorization scope(s) for the method you are building.
16428    ///
16429    /// See [`Self::add_scope()`] for details.
16430    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyCreateCall<'a, C>
16431    where
16432        I: IntoIterator<Item = St>,
16433        St: AsRef<str>,
16434    {
16435        self._scopes
16436            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16437        self
16438    }
16439
16440    /// Removes all scopes, and no default scope will be used either.
16441    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16442    /// for details).
16443    pub fn clear_scopes(mut self) -> TagKeyCreateCall<'a, C> {
16444        self._scopes.clear();
16445        self
16446    }
16447}
16448
16449/// Deletes a TagKey. The TagKey cannot be deleted if it has any child TagValues.
16450///
16451/// A builder for the *delete* method supported by a *tagKey* resource.
16452/// It is not used directly, but through a [`TagKeyMethods`] instance.
16453///
16454/// # Example
16455///
16456/// Instantiate a resource method builder
16457///
16458/// ```test_harness,no_run
16459/// # extern crate hyper;
16460/// # extern crate hyper_rustls;
16461/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
16462/// # async fn dox() {
16463/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16464///
16465/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16466/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16467/// #     .with_native_roots()
16468/// #     .unwrap()
16469/// #     .https_only()
16470/// #     .enable_http2()
16471/// #     .build();
16472///
16473/// # let executor = hyper_util::rt::TokioExecutor::new();
16474/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16475/// #     secret,
16476/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16477/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16478/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16479/// #     ),
16480/// # ).build().await.unwrap();
16481///
16482/// # let client = hyper_util::client::legacy::Client::builder(
16483/// #     hyper_util::rt::TokioExecutor::new()
16484/// # )
16485/// # .build(
16486/// #     hyper_rustls::HttpsConnectorBuilder::new()
16487/// #         .with_native_roots()
16488/// #         .unwrap()
16489/// #         .https_or_http()
16490/// #         .enable_http2()
16491/// #         .build()
16492/// # );
16493/// # let mut hub = CloudResourceManager::new(client, auth);
16494/// // You can configure optional parameters by calling the respective setters at will, and
16495/// // execute the final call using `doit()`.
16496/// // Values shown here are possibly random and not representative !
16497/// let result = hub.tag_keys().delete("name")
16498///              .validate_only(true)
16499///              .etag("Lorem")
16500///              .doit().await;
16501/// # }
16502/// ```
16503pub struct TagKeyDeleteCall<'a, C>
16504where
16505    C: 'a,
16506{
16507    hub: &'a CloudResourceManager<C>,
16508    _name: String,
16509    _validate_only: Option<bool>,
16510    _etag: Option<String>,
16511    _delegate: Option<&'a mut dyn common::Delegate>,
16512    _additional_params: HashMap<String, String>,
16513    _scopes: BTreeSet<String>,
16514}
16515
16516impl<'a, C> common::CallBuilder for TagKeyDeleteCall<'a, C> {}
16517
16518impl<'a, C> TagKeyDeleteCall<'a, C>
16519where
16520    C: common::Connector,
16521{
16522    /// Perform the operation you have build so far.
16523    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16524        use std::borrow::Cow;
16525        use std::io::{Read, Seek};
16526
16527        use common::{url::Params, ToParts};
16528        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16529
16530        let mut dd = common::DefaultDelegate;
16531        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16532        dlg.begin(common::MethodInfo {
16533            id: "cloudresourcemanager.tagKeys.delete",
16534            http_method: hyper::Method::DELETE,
16535        });
16536
16537        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
16538            if self._additional_params.contains_key(field) {
16539                dlg.finished(false);
16540                return Err(common::Error::FieldClash(field));
16541            }
16542        }
16543
16544        let mut params = Params::with_capacity(5 + self._additional_params.len());
16545        params.push("name", self._name);
16546        if let Some(value) = self._validate_only.as_ref() {
16547            params.push("validateOnly", value.to_string());
16548        }
16549        if let Some(value) = self._etag.as_ref() {
16550            params.push("etag", value);
16551        }
16552
16553        params.extend(self._additional_params.iter());
16554
16555        params.push("alt", "json");
16556        let mut url = self.hub._base_url.clone() + "v3/{+name}";
16557        if self._scopes.is_empty() {
16558            self._scopes
16559                .insert(Scope::CloudPlatform.as_ref().to_string());
16560        }
16561
16562        #[allow(clippy::single_element_loop)]
16563        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16564            url = params.uri_replacement(url, param_name, find_this, true);
16565        }
16566        {
16567            let to_remove = ["name"];
16568            params.remove_params(&to_remove);
16569        }
16570
16571        let url = params.parse_with_url(&url);
16572
16573        loop {
16574            let token = match self
16575                .hub
16576                .auth
16577                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16578                .await
16579            {
16580                Ok(token) => token,
16581                Err(e) => match dlg.token(e) {
16582                    Ok(token) => token,
16583                    Err(e) => {
16584                        dlg.finished(false);
16585                        return Err(common::Error::MissingToken(e));
16586                    }
16587                },
16588            };
16589            let mut req_result = {
16590                let client = &self.hub.client;
16591                dlg.pre_request();
16592                let mut req_builder = hyper::Request::builder()
16593                    .method(hyper::Method::DELETE)
16594                    .uri(url.as_str())
16595                    .header(USER_AGENT, self.hub._user_agent.clone());
16596
16597                if let Some(token) = token.as_ref() {
16598                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16599                }
16600
16601                let request = req_builder
16602                    .header(CONTENT_LENGTH, 0_u64)
16603                    .body(common::to_body::<String>(None));
16604
16605                client.request(request.unwrap()).await
16606            };
16607
16608            match req_result {
16609                Err(err) => {
16610                    if let common::Retry::After(d) = dlg.http_error(&err) {
16611                        sleep(d).await;
16612                        continue;
16613                    }
16614                    dlg.finished(false);
16615                    return Err(common::Error::HttpError(err));
16616                }
16617                Ok(res) => {
16618                    let (mut parts, body) = res.into_parts();
16619                    let mut body = common::Body::new(body);
16620                    if !parts.status.is_success() {
16621                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16622                        let error = serde_json::from_str(&common::to_string(&bytes));
16623                        let response = common::to_response(parts, bytes.into());
16624
16625                        if let common::Retry::After(d) =
16626                            dlg.http_failure(&response, error.as_ref().ok())
16627                        {
16628                            sleep(d).await;
16629                            continue;
16630                        }
16631
16632                        dlg.finished(false);
16633
16634                        return Err(match error {
16635                            Ok(value) => common::Error::BadRequest(value),
16636                            _ => common::Error::Failure(response),
16637                        });
16638                    }
16639                    let response = {
16640                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16641                        let encoded = common::to_string(&bytes);
16642                        match serde_json::from_str(&encoded) {
16643                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16644                            Err(error) => {
16645                                dlg.response_json_decode_error(&encoded, &error);
16646                                return Err(common::Error::JsonDecodeError(
16647                                    encoded.to_string(),
16648                                    error,
16649                                ));
16650                            }
16651                        }
16652                    };
16653
16654                    dlg.finished(true);
16655                    return Ok(response);
16656                }
16657            }
16658        }
16659    }
16660
16661    /// Required. The resource name of a TagKey to be deleted in the format `tagKeys/123`. The TagKey cannot be a parent of any existing TagValues or it will not be deleted successfully.
16662    ///
16663    /// Sets the *name* path property to the given value.
16664    ///
16665    /// Even though the property as already been set when instantiating this call,
16666    /// we provide this method for API completeness.
16667    pub fn name(mut self, new_value: &str) -> TagKeyDeleteCall<'a, C> {
16668        self._name = new_value.to_string();
16669        self
16670    }
16671    /// Optional. Set as true to perform validations necessary for deletion, but not actually perform the action.
16672    ///
16673    /// Sets the *validate only* query property to the given value.
16674    pub fn validate_only(mut self, new_value: bool) -> TagKeyDeleteCall<'a, C> {
16675        self._validate_only = Some(new_value);
16676        self
16677    }
16678    /// Optional. The etag known to the client for the expected state of the TagKey. This is to be used for optimistic concurrency.
16679    ///
16680    /// Sets the *etag* query property to the given value.
16681    pub fn etag(mut self, new_value: &str) -> TagKeyDeleteCall<'a, C> {
16682        self._etag = Some(new_value.to_string());
16683        self
16684    }
16685    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16686    /// while executing the actual API request.
16687    ///
16688    /// ````text
16689    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16690    /// ````
16691    ///
16692    /// Sets the *delegate* property to the given value.
16693    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagKeyDeleteCall<'a, C> {
16694        self._delegate = Some(new_value);
16695        self
16696    }
16697
16698    /// Set any additional parameter of the query string used in the request.
16699    /// It should be used to set parameters which are not yet available through their own
16700    /// setters.
16701    ///
16702    /// Please note that this method must not be used to set any of the known parameters
16703    /// which have their own setter method. If done anyway, the request will fail.
16704    ///
16705    /// # Additional Parameters
16706    ///
16707    /// * *$.xgafv* (query-string) - V1 error format.
16708    /// * *access_token* (query-string) - OAuth access token.
16709    /// * *alt* (query-string) - Data format for response.
16710    /// * *callback* (query-string) - JSONP
16711    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16712    /// * *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.
16713    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16714    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16715    /// * *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.
16716    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16717    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16718    pub fn param<T>(mut self, name: T, value: T) -> TagKeyDeleteCall<'a, C>
16719    where
16720        T: AsRef<str>,
16721    {
16722        self._additional_params
16723            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16724        self
16725    }
16726
16727    /// Identifies the authorization scope for the method you are building.
16728    ///
16729    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16730    /// [`Scope::CloudPlatform`].
16731    ///
16732    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16733    /// tokens for more than one scope.
16734    ///
16735    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16736    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16737    /// sufficient, a read-write scope will do as well.
16738    pub fn add_scope<St>(mut self, scope: St) -> TagKeyDeleteCall<'a, C>
16739    where
16740        St: AsRef<str>,
16741    {
16742        self._scopes.insert(String::from(scope.as_ref()));
16743        self
16744    }
16745    /// Identifies the authorization scope(s) for the method you are building.
16746    ///
16747    /// See [`Self::add_scope()`] for details.
16748    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyDeleteCall<'a, C>
16749    where
16750        I: IntoIterator<Item = St>,
16751        St: AsRef<str>,
16752    {
16753        self._scopes
16754            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16755        self
16756    }
16757
16758    /// Removes all scopes, and no default scope will be used either.
16759    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16760    /// for details).
16761    pub fn clear_scopes(mut self) -> TagKeyDeleteCall<'a, C> {
16762        self._scopes.clear();
16763        self
16764    }
16765}
16766
16767/// Retrieves a TagKey. This method will return `PERMISSION_DENIED` if the key does not exist or the user does not have permission to view it.
16768///
16769/// A builder for the *get* method supported by a *tagKey* resource.
16770/// It is not used directly, but through a [`TagKeyMethods`] instance.
16771///
16772/// # Example
16773///
16774/// Instantiate a resource method builder
16775///
16776/// ```test_harness,no_run
16777/// # extern crate hyper;
16778/// # extern crate hyper_rustls;
16779/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
16780/// # async fn dox() {
16781/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16782///
16783/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16784/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16785/// #     .with_native_roots()
16786/// #     .unwrap()
16787/// #     .https_only()
16788/// #     .enable_http2()
16789/// #     .build();
16790///
16791/// # let executor = hyper_util::rt::TokioExecutor::new();
16792/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16793/// #     secret,
16794/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16795/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
16796/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
16797/// #     ),
16798/// # ).build().await.unwrap();
16799///
16800/// # let client = hyper_util::client::legacy::Client::builder(
16801/// #     hyper_util::rt::TokioExecutor::new()
16802/// # )
16803/// # .build(
16804/// #     hyper_rustls::HttpsConnectorBuilder::new()
16805/// #         .with_native_roots()
16806/// #         .unwrap()
16807/// #         .https_or_http()
16808/// #         .enable_http2()
16809/// #         .build()
16810/// # );
16811/// # let mut hub = CloudResourceManager::new(client, auth);
16812/// // You can configure optional parameters by calling the respective setters at will, and
16813/// // execute the final call using `doit()`.
16814/// // Values shown here are possibly random and not representative !
16815/// let result = hub.tag_keys().get("name")
16816///              .doit().await;
16817/// # }
16818/// ```
16819pub struct TagKeyGetCall<'a, C>
16820where
16821    C: 'a,
16822{
16823    hub: &'a CloudResourceManager<C>,
16824    _name: String,
16825    _delegate: Option<&'a mut dyn common::Delegate>,
16826    _additional_params: HashMap<String, String>,
16827    _scopes: BTreeSet<String>,
16828}
16829
16830impl<'a, C> common::CallBuilder for TagKeyGetCall<'a, C> {}
16831
16832impl<'a, C> TagKeyGetCall<'a, C>
16833where
16834    C: common::Connector,
16835{
16836    /// Perform the operation you have build so far.
16837    pub async fn doit(mut self) -> common::Result<(common::Response, TagKey)> {
16838        use std::borrow::Cow;
16839        use std::io::{Read, Seek};
16840
16841        use common::{url::Params, ToParts};
16842        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16843
16844        let mut dd = common::DefaultDelegate;
16845        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16846        dlg.begin(common::MethodInfo {
16847            id: "cloudresourcemanager.tagKeys.get",
16848            http_method: hyper::Method::GET,
16849        });
16850
16851        for &field in ["alt", "name"].iter() {
16852            if self._additional_params.contains_key(field) {
16853                dlg.finished(false);
16854                return Err(common::Error::FieldClash(field));
16855            }
16856        }
16857
16858        let mut params = Params::with_capacity(3 + self._additional_params.len());
16859        params.push("name", self._name);
16860
16861        params.extend(self._additional_params.iter());
16862
16863        params.push("alt", "json");
16864        let mut url = self.hub._base_url.clone() + "v3/{+name}";
16865        if self._scopes.is_empty() {
16866            self._scopes
16867                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
16868        }
16869
16870        #[allow(clippy::single_element_loop)]
16871        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16872            url = params.uri_replacement(url, param_name, find_this, true);
16873        }
16874        {
16875            let to_remove = ["name"];
16876            params.remove_params(&to_remove);
16877        }
16878
16879        let url = params.parse_with_url(&url);
16880
16881        loop {
16882            let token = match self
16883                .hub
16884                .auth
16885                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16886                .await
16887            {
16888                Ok(token) => token,
16889                Err(e) => match dlg.token(e) {
16890                    Ok(token) => token,
16891                    Err(e) => {
16892                        dlg.finished(false);
16893                        return Err(common::Error::MissingToken(e));
16894                    }
16895                },
16896            };
16897            let mut req_result = {
16898                let client = &self.hub.client;
16899                dlg.pre_request();
16900                let mut req_builder = hyper::Request::builder()
16901                    .method(hyper::Method::GET)
16902                    .uri(url.as_str())
16903                    .header(USER_AGENT, self.hub._user_agent.clone());
16904
16905                if let Some(token) = token.as_ref() {
16906                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16907                }
16908
16909                let request = req_builder
16910                    .header(CONTENT_LENGTH, 0_u64)
16911                    .body(common::to_body::<String>(None));
16912
16913                client.request(request.unwrap()).await
16914            };
16915
16916            match req_result {
16917                Err(err) => {
16918                    if let common::Retry::After(d) = dlg.http_error(&err) {
16919                        sleep(d).await;
16920                        continue;
16921                    }
16922                    dlg.finished(false);
16923                    return Err(common::Error::HttpError(err));
16924                }
16925                Ok(res) => {
16926                    let (mut parts, body) = res.into_parts();
16927                    let mut body = common::Body::new(body);
16928                    if !parts.status.is_success() {
16929                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16930                        let error = serde_json::from_str(&common::to_string(&bytes));
16931                        let response = common::to_response(parts, bytes.into());
16932
16933                        if let common::Retry::After(d) =
16934                            dlg.http_failure(&response, error.as_ref().ok())
16935                        {
16936                            sleep(d).await;
16937                            continue;
16938                        }
16939
16940                        dlg.finished(false);
16941
16942                        return Err(match error {
16943                            Ok(value) => common::Error::BadRequest(value),
16944                            _ => common::Error::Failure(response),
16945                        });
16946                    }
16947                    let response = {
16948                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16949                        let encoded = common::to_string(&bytes);
16950                        match serde_json::from_str(&encoded) {
16951                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16952                            Err(error) => {
16953                                dlg.response_json_decode_error(&encoded, &error);
16954                                return Err(common::Error::JsonDecodeError(
16955                                    encoded.to_string(),
16956                                    error,
16957                                ));
16958                            }
16959                        }
16960                    };
16961
16962                    dlg.finished(true);
16963                    return Ok(response);
16964                }
16965            }
16966        }
16967    }
16968
16969    /// Required. A resource name in the format `tagKeys/{id}`, such as `tagKeys/123`.
16970    ///
16971    /// Sets the *name* path property to the given value.
16972    ///
16973    /// Even though the property as already been set when instantiating this call,
16974    /// we provide this method for API completeness.
16975    pub fn name(mut self, new_value: &str) -> TagKeyGetCall<'a, C> {
16976        self._name = new_value.to_string();
16977        self
16978    }
16979    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16980    /// while executing the actual API request.
16981    ///
16982    /// ````text
16983    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16984    /// ````
16985    ///
16986    /// Sets the *delegate* property to the given value.
16987    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagKeyGetCall<'a, C> {
16988        self._delegate = Some(new_value);
16989        self
16990    }
16991
16992    /// Set any additional parameter of the query string used in the request.
16993    /// It should be used to set parameters which are not yet available through their own
16994    /// setters.
16995    ///
16996    /// Please note that this method must not be used to set any of the known parameters
16997    /// which have their own setter method. If done anyway, the request will fail.
16998    ///
16999    /// # Additional Parameters
17000    ///
17001    /// * *$.xgafv* (query-string) - V1 error format.
17002    /// * *access_token* (query-string) - OAuth access token.
17003    /// * *alt* (query-string) - Data format for response.
17004    /// * *callback* (query-string) - JSONP
17005    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17006    /// * *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.
17007    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17008    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17009    /// * *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.
17010    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17011    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17012    pub fn param<T>(mut self, name: T, value: T) -> TagKeyGetCall<'a, C>
17013    where
17014        T: AsRef<str>,
17015    {
17016        self._additional_params
17017            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17018        self
17019    }
17020
17021    /// Identifies the authorization scope for the method you are building.
17022    ///
17023    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17024    /// [`Scope::CloudPlatformReadOnly`].
17025    ///
17026    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17027    /// tokens for more than one scope.
17028    ///
17029    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17030    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17031    /// sufficient, a read-write scope will do as well.
17032    pub fn add_scope<St>(mut self, scope: St) -> TagKeyGetCall<'a, C>
17033    where
17034        St: AsRef<str>,
17035    {
17036        self._scopes.insert(String::from(scope.as_ref()));
17037        self
17038    }
17039    /// Identifies the authorization scope(s) for the method you are building.
17040    ///
17041    /// See [`Self::add_scope()`] for details.
17042    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyGetCall<'a, C>
17043    where
17044        I: IntoIterator<Item = St>,
17045        St: AsRef<str>,
17046    {
17047        self._scopes
17048            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17049        self
17050    }
17051
17052    /// Removes all scopes, and no default scope will be used either.
17053    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17054    /// for details).
17055    pub fn clear_scopes(mut self) -> TagKeyGetCall<'a, C> {
17056        self._scopes.clear();
17057        self
17058    }
17059}
17060
17061/// Gets the access control policy for a TagKey. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the TagKey's resource name. For example, "tagKeys/1234". The caller must have `cloudresourcemanager.googleapis.com/tagKeys.getIamPolicy` permission on the specified TagKey.
17062///
17063/// A builder for the *getIamPolicy* method supported by a *tagKey* resource.
17064/// It is not used directly, but through a [`TagKeyMethods`] instance.
17065///
17066/// # Example
17067///
17068/// Instantiate a resource method builder
17069///
17070/// ```test_harness,no_run
17071/// # extern crate hyper;
17072/// # extern crate hyper_rustls;
17073/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
17074/// use cloudresourcemanager3::api::GetIamPolicyRequest;
17075/// # async fn dox() {
17076/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17077///
17078/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17079/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17080/// #     .with_native_roots()
17081/// #     .unwrap()
17082/// #     .https_only()
17083/// #     .enable_http2()
17084/// #     .build();
17085///
17086/// # let executor = hyper_util::rt::TokioExecutor::new();
17087/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17088/// #     secret,
17089/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17090/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17091/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17092/// #     ),
17093/// # ).build().await.unwrap();
17094///
17095/// # let client = hyper_util::client::legacy::Client::builder(
17096/// #     hyper_util::rt::TokioExecutor::new()
17097/// # )
17098/// # .build(
17099/// #     hyper_rustls::HttpsConnectorBuilder::new()
17100/// #         .with_native_roots()
17101/// #         .unwrap()
17102/// #         .https_or_http()
17103/// #         .enable_http2()
17104/// #         .build()
17105/// # );
17106/// # let mut hub = CloudResourceManager::new(client, auth);
17107/// // As the method needs a request, you would usually fill it with the desired information
17108/// // into the respective structure. Some of the parts shown here might not be applicable !
17109/// // Values shown here are possibly random and not representative !
17110/// let mut req = GetIamPolicyRequest::default();
17111///
17112/// // You can configure optional parameters by calling the respective setters at will, and
17113/// // execute the final call using `doit()`.
17114/// // Values shown here are possibly random and not representative !
17115/// let result = hub.tag_keys().get_iam_policy(req, "resource")
17116///              .doit().await;
17117/// # }
17118/// ```
17119pub struct TagKeyGetIamPolicyCall<'a, C>
17120where
17121    C: 'a,
17122{
17123    hub: &'a CloudResourceManager<C>,
17124    _request: GetIamPolicyRequest,
17125    _resource: String,
17126    _delegate: Option<&'a mut dyn common::Delegate>,
17127    _additional_params: HashMap<String, String>,
17128    _scopes: BTreeSet<String>,
17129}
17130
17131impl<'a, C> common::CallBuilder for TagKeyGetIamPolicyCall<'a, C> {}
17132
17133impl<'a, C> TagKeyGetIamPolicyCall<'a, C>
17134where
17135    C: common::Connector,
17136{
17137    /// Perform the operation you have build so far.
17138    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
17139        use std::borrow::Cow;
17140        use std::io::{Read, Seek};
17141
17142        use common::{url::Params, ToParts};
17143        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17144
17145        let mut dd = common::DefaultDelegate;
17146        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17147        dlg.begin(common::MethodInfo {
17148            id: "cloudresourcemanager.tagKeys.getIamPolicy",
17149            http_method: hyper::Method::POST,
17150        });
17151
17152        for &field in ["alt", "resource"].iter() {
17153            if self._additional_params.contains_key(field) {
17154                dlg.finished(false);
17155                return Err(common::Error::FieldClash(field));
17156            }
17157        }
17158
17159        let mut params = Params::with_capacity(4 + self._additional_params.len());
17160        params.push("resource", self._resource);
17161
17162        params.extend(self._additional_params.iter());
17163
17164        params.push("alt", "json");
17165        let mut url = self.hub._base_url.clone() + "v3/{+resource}:getIamPolicy";
17166        if self._scopes.is_empty() {
17167            self._scopes
17168                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
17169        }
17170
17171        #[allow(clippy::single_element_loop)]
17172        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17173            url = params.uri_replacement(url, param_name, find_this, true);
17174        }
17175        {
17176            let to_remove = ["resource"];
17177            params.remove_params(&to_remove);
17178        }
17179
17180        let url = params.parse_with_url(&url);
17181
17182        let mut json_mime_type = mime::APPLICATION_JSON;
17183        let mut request_value_reader = {
17184            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17185            common::remove_json_null_values(&mut value);
17186            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17187            serde_json::to_writer(&mut dst, &value).unwrap();
17188            dst
17189        };
17190        let request_size = request_value_reader
17191            .seek(std::io::SeekFrom::End(0))
17192            .unwrap();
17193        request_value_reader
17194            .seek(std::io::SeekFrom::Start(0))
17195            .unwrap();
17196
17197        loop {
17198            let token = match self
17199                .hub
17200                .auth
17201                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17202                .await
17203            {
17204                Ok(token) => token,
17205                Err(e) => match dlg.token(e) {
17206                    Ok(token) => token,
17207                    Err(e) => {
17208                        dlg.finished(false);
17209                        return Err(common::Error::MissingToken(e));
17210                    }
17211                },
17212            };
17213            request_value_reader
17214                .seek(std::io::SeekFrom::Start(0))
17215                .unwrap();
17216            let mut req_result = {
17217                let client = &self.hub.client;
17218                dlg.pre_request();
17219                let mut req_builder = hyper::Request::builder()
17220                    .method(hyper::Method::POST)
17221                    .uri(url.as_str())
17222                    .header(USER_AGENT, self.hub._user_agent.clone());
17223
17224                if let Some(token) = token.as_ref() {
17225                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17226                }
17227
17228                let request = req_builder
17229                    .header(CONTENT_TYPE, json_mime_type.to_string())
17230                    .header(CONTENT_LENGTH, request_size as u64)
17231                    .body(common::to_body(
17232                        request_value_reader.get_ref().clone().into(),
17233                    ));
17234
17235                client.request(request.unwrap()).await
17236            };
17237
17238            match req_result {
17239                Err(err) => {
17240                    if let common::Retry::After(d) = dlg.http_error(&err) {
17241                        sleep(d).await;
17242                        continue;
17243                    }
17244                    dlg.finished(false);
17245                    return Err(common::Error::HttpError(err));
17246                }
17247                Ok(res) => {
17248                    let (mut parts, body) = res.into_parts();
17249                    let mut body = common::Body::new(body);
17250                    if !parts.status.is_success() {
17251                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17252                        let error = serde_json::from_str(&common::to_string(&bytes));
17253                        let response = common::to_response(parts, bytes.into());
17254
17255                        if let common::Retry::After(d) =
17256                            dlg.http_failure(&response, error.as_ref().ok())
17257                        {
17258                            sleep(d).await;
17259                            continue;
17260                        }
17261
17262                        dlg.finished(false);
17263
17264                        return Err(match error {
17265                            Ok(value) => common::Error::BadRequest(value),
17266                            _ => common::Error::Failure(response),
17267                        });
17268                    }
17269                    let response = {
17270                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17271                        let encoded = common::to_string(&bytes);
17272                        match serde_json::from_str(&encoded) {
17273                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17274                            Err(error) => {
17275                                dlg.response_json_decode_error(&encoded, &error);
17276                                return Err(common::Error::JsonDecodeError(
17277                                    encoded.to_string(),
17278                                    error,
17279                                ));
17280                            }
17281                        }
17282                    };
17283
17284                    dlg.finished(true);
17285                    return Ok(response);
17286                }
17287            }
17288        }
17289    }
17290
17291    ///
17292    /// Sets the *request* property to the given value.
17293    ///
17294    /// Even though the property as already been set when instantiating this call,
17295    /// we provide this method for API completeness.
17296    pub fn request(mut self, new_value: GetIamPolicyRequest) -> TagKeyGetIamPolicyCall<'a, C> {
17297        self._request = new_value;
17298        self
17299    }
17300    /// 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.
17301    ///
17302    /// Sets the *resource* path property to the given value.
17303    ///
17304    /// Even though the property as already been set when instantiating this call,
17305    /// we provide this method for API completeness.
17306    pub fn resource(mut self, new_value: &str) -> TagKeyGetIamPolicyCall<'a, C> {
17307        self._resource = new_value.to_string();
17308        self
17309    }
17310    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17311    /// while executing the actual API request.
17312    ///
17313    /// ````text
17314    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17315    /// ````
17316    ///
17317    /// Sets the *delegate* property to the given value.
17318    pub fn delegate(
17319        mut self,
17320        new_value: &'a mut dyn common::Delegate,
17321    ) -> TagKeyGetIamPolicyCall<'a, C> {
17322        self._delegate = Some(new_value);
17323        self
17324    }
17325
17326    /// Set any additional parameter of the query string used in the request.
17327    /// It should be used to set parameters which are not yet available through their own
17328    /// setters.
17329    ///
17330    /// Please note that this method must not be used to set any of the known parameters
17331    /// which have their own setter method. If done anyway, the request will fail.
17332    ///
17333    /// # Additional Parameters
17334    ///
17335    /// * *$.xgafv* (query-string) - V1 error format.
17336    /// * *access_token* (query-string) - OAuth access token.
17337    /// * *alt* (query-string) - Data format for response.
17338    /// * *callback* (query-string) - JSONP
17339    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17340    /// * *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.
17341    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17342    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17343    /// * *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.
17344    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17345    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17346    pub fn param<T>(mut self, name: T, value: T) -> TagKeyGetIamPolicyCall<'a, C>
17347    where
17348        T: AsRef<str>,
17349    {
17350        self._additional_params
17351            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17352        self
17353    }
17354
17355    /// Identifies the authorization scope for the method you are building.
17356    ///
17357    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17358    /// [`Scope::CloudPlatformReadOnly`].
17359    ///
17360    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17361    /// tokens for more than one scope.
17362    ///
17363    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17364    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17365    /// sufficient, a read-write scope will do as well.
17366    pub fn add_scope<St>(mut self, scope: St) -> TagKeyGetIamPolicyCall<'a, C>
17367    where
17368        St: AsRef<str>,
17369    {
17370        self._scopes.insert(String::from(scope.as_ref()));
17371        self
17372    }
17373    /// Identifies the authorization scope(s) for the method you are building.
17374    ///
17375    /// See [`Self::add_scope()`] for details.
17376    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyGetIamPolicyCall<'a, C>
17377    where
17378        I: IntoIterator<Item = St>,
17379        St: AsRef<str>,
17380    {
17381        self._scopes
17382            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17383        self
17384    }
17385
17386    /// Removes all scopes, and no default scope will be used either.
17387    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17388    /// for details).
17389    pub fn clear_scopes(mut self) -> TagKeyGetIamPolicyCall<'a, C> {
17390        self._scopes.clear();
17391        self
17392    }
17393}
17394
17395/// Retrieves a TagKey by its namespaced name. This method will return `PERMISSION_DENIED` if the key does not exist or the user does not have permission to view it.
17396///
17397/// A builder for the *getNamespaced* method supported by a *tagKey* resource.
17398/// It is not used directly, but through a [`TagKeyMethods`] instance.
17399///
17400/// # Example
17401///
17402/// Instantiate a resource method builder
17403///
17404/// ```test_harness,no_run
17405/// # extern crate hyper;
17406/// # extern crate hyper_rustls;
17407/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
17408/// # async fn dox() {
17409/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17410///
17411/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17412/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17413/// #     .with_native_roots()
17414/// #     .unwrap()
17415/// #     .https_only()
17416/// #     .enable_http2()
17417/// #     .build();
17418///
17419/// # let executor = hyper_util::rt::TokioExecutor::new();
17420/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17421/// #     secret,
17422/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17423/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17424/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17425/// #     ),
17426/// # ).build().await.unwrap();
17427///
17428/// # let client = hyper_util::client::legacy::Client::builder(
17429/// #     hyper_util::rt::TokioExecutor::new()
17430/// # )
17431/// # .build(
17432/// #     hyper_rustls::HttpsConnectorBuilder::new()
17433/// #         .with_native_roots()
17434/// #         .unwrap()
17435/// #         .https_or_http()
17436/// #         .enable_http2()
17437/// #         .build()
17438/// # );
17439/// # let mut hub = CloudResourceManager::new(client, auth);
17440/// // You can configure optional parameters by calling the respective setters at will, and
17441/// // execute the final call using `doit()`.
17442/// // Values shown here are possibly random and not representative !
17443/// let result = hub.tag_keys().get_namespaced()
17444///              .name("ipsum")
17445///              .doit().await;
17446/// # }
17447/// ```
17448pub struct TagKeyGetNamespacedCall<'a, C>
17449where
17450    C: 'a,
17451{
17452    hub: &'a CloudResourceManager<C>,
17453    _name: Option<String>,
17454    _delegate: Option<&'a mut dyn common::Delegate>,
17455    _additional_params: HashMap<String, String>,
17456    _scopes: BTreeSet<String>,
17457}
17458
17459impl<'a, C> common::CallBuilder for TagKeyGetNamespacedCall<'a, C> {}
17460
17461impl<'a, C> TagKeyGetNamespacedCall<'a, C>
17462where
17463    C: common::Connector,
17464{
17465    /// Perform the operation you have build so far.
17466    pub async fn doit(mut self) -> common::Result<(common::Response, TagKey)> {
17467        use std::borrow::Cow;
17468        use std::io::{Read, Seek};
17469
17470        use common::{url::Params, ToParts};
17471        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17472
17473        let mut dd = common::DefaultDelegate;
17474        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17475        dlg.begin(common::MethodInfo {
17476            id: "cloudresourcemanager.tagKeys.getNamespaced",
17477            http_method: hyper::Method::GET,
17478        });
17479
17480        for &field in ["alt", "name"].iter() {
17481            if self._additional_params.contains_key(field) {
17482                dlg.finished(false);
17483                return Err(common::Error::FieldClash(field));
17484            }
17485        }
17486
17487        let mut params = Params::with_capacity(3 + self._additional_params.len());
17488        if let Some(value) = self._name.as_ref() {
17489            params.push("name", value);
17490        }
17491
17492        params.extend(self._additional_params.iter());
17493
17494        params.push("alt", "json");
17495        let mut url = self.hub._base_url.clone() + "v3/tagKeys/namespaced";
17496        if self._scopes.is_empty() {
17497            self._scopes
17498                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
17499        }
17500
17501        let url = params.parse_with_url(&url);
17502
17503        loop {
17504            let token = match self
17505                .hub
17506                .auth
17507                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17508                .await
17509            {
17510                Ok(token) => token,
17511                Err(e) => match dlg.token(e) {
17512                    Ok(token) => token,
17513                    Err(e) => {
17514                        dlg.finished(false);
17515                        return Err(common::Error::MissingToken(e));
17516                    }
17517                },
17518            };
17519            let mut req_result = {
17520                let client = &self.hub.client;
17521                dlg.pre_request();
17522                let mut req_builder = hyper::Request::builder()
17523                    .method(hyper::Method::GET)
17524                    .uri(url.as_str())
17525                    .header(USER_AGENT, self.hub._user_agent.clone());
17526
17527                if let Some(token) = token.as_ref() {
17528                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17529                }
17530
17531                let request = req_builder
17532                    .header(CONTENT_LENGTH, 0_u64)
17533                    .body(common::to_body::<String>(None));
17534
17535                client.request(request.unwrap()).await
17536            };
17537
17538            match req_result {
17539                Err(err) => {
17540                    if let common::Retry::After(d) = dlg.http_error(&err) {
17541                        sleep(d).await;
17542                        continue;
17543                    }
17544                    dlg.finished(false);
17545                    return Err(common::Error::HttpError(err));
17546                }
17547                Ok(res) => {
17548                    let (mut parts, body) = res.into_parts();
17549                    let mut body = common::Body::new(body);
17550                    if !parts.status.is_success() {
17551                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17552                        let error = serde_json::from_str(&common::to_string(&bytes));
17553                        let response = common::to_response(parts, bytes.into());
17554
17555                        if let common::Retry::After(d) =
17556                            dlg.http_failure(&response, error.as_ref().ok())
17557                        {
17558                            sleep(d).await;
17559                            continue;
17560                        }
17561
17562                        dlg.finished(false);
17563
17564                        return Err(match error {
17565                            Ok(value) => common::Error::BadRequest(value),
17566                            _ => common::Error::Failure(response),
17567                        });
17568                    }
17569                    let response = {
17570                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17571                        let encoded = common::to_string(&bytes);
17572                        match serde_json::from_str(&encoded) {
17573                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17574                            Err(error) => {
17575                                dlg.response_json_decode_error(&encoded, &error);
17576                                return Err(common::Error::JsonDecodeError(
17577                                    encoded.to_string(),
17578                                    error,
17579                                ));
17580                            }
17581                        }
17582                    };
17583
17584                    dlg.finished(true);
17585                    return Ok(response);
17586                }
17587            }
17588        }
17589    }
17590
17591    /// Required. A namespaced tag key name in the format `{parentId}/{tagKeyShort}`, such as `42/foo` for a key with short name "foo" under the organization with ID 42 or `r2-d2/bar` for a key with short name "bar" under the project `r2-d2`.
17592    ///
17593    /// Sets the *name* query property to the given value.
17594    pub fn name(mut self, new_value: &str) -> TagKeyGetNamespacedCall<'a, C> {
17595        self._name = Some(new_value.to_string());
17596        self
17597    }
17598    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17599    /// while executing the actual API request.
17600    ///
17601    /// ````text
17602    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17603    /// ````
17604    ///
17605    /// Sets the *delegate* property to the given value.
17606    pub fn delegate(
17607        mut self,
17608        new_value: &'a mut dyn common::Delegate,
17609    ) -> TagKeyGetNamespacedCall<'a, C> {
17610        self._delegate = Some(new_value);
17611        self
17612    }
17613
17614    /// Set any additional parameter of the query string used in the request.
17615    /// It should be used to set parameters which are not yet available through their own
17616    /// setters.
17617    ///
17618    /// Please note that this method must not be used to set any of the known parameters
17619    /// which have their own setter method. If done anyway, the request will fail.
17620    ///
17621    /// # Additional Parameters
17622    ///
17623    /// * *$.xgafv* (query-string) - V1 error format.
17624    /// * *access_token* (query-string) - OAuth access token.
17625    /// * *alt* (query-string) - Data format for response.
17626    /// * *callback* (query-string) - JSONP
17627    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17628    /// * *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.
17629    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17630    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17631    /// * *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.
17632    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17633    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17634    pub fn param<T>(mut self, name: T, value: T) -> TagKeyGetNamespacedCall<'a, C>
17635    where
17636        T: AsRef<str>,
17637    {
17638        self._additional_params
17639            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17640        self
17641    }
17642
17643    /// Identifies the authorization scope for the method you are building.
17644    ///
17645    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17646    /// [`Scope::CloudPlatformReadOnly`].
17647    ///
17648    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17649    /// tokens for more than one scope.
17650    ///
17651    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17652    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17653    /// sufficient, a read-write scope will do as well.
17654    pub fn add_scope<St>(mut self, scope: St) -> TagKeyGetNamespacedCall<'a, C>
17655    where
17656        St: AsRef<str>,
17657    {
17658        self._scopes.insert(String::from(scope.as_ref()));
17659        self
17660    }
17661    /// Identifies the authorization scope(s) for the method you are building.
17662    ///
17663    /// See [`Self::add_scope()`] for details.
17664    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyGetNamespacedCall<'a, C>
17665    where
17666        I: IntoIterator<Item = St>,
17667        St: AsRef<str>,
17668    {
17669        self._scopes
17670            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17671        self
17672    }
17673
17674    /// Removes all scopes, and no default scope will be used either.
17675    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17676    /// for details).
17677    pub fn clear_scopes(mut self) -> TagKeyGetNamespacedCall<'a, C> {
17678        self._scopes.clear();
17679        self
17680    }
17681}
17682
17683/// Lists all TagKeys for a parent resource.
17684///
17685/// A builder for the *list* method supported by a *tagKey* resource.
17686/// It is not used directly, but through a [`TagKeyMethods`] instance.
17687///
17688/// # Example
17689///
17690/// Instantiate a resource method builder
17691///
17692/// ```test_harness,no_run
17693/// # extern crate hyper;
17694/// # extern crate hyper_rustls;
17695/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
17696/// # async fn dox() {
17697/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17698///
17699/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17700/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17701/// #     .with_native_roots()
17702/// #     .unwrap()
17703/// #     .https_only()
17704/// #     .enable_http2()
17705/// #     .build();
17706///
17707/// # let executor = hyper_util::rt::TokioExecutor::new();
17708/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17709/// #     secret,
17710/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17711/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
17712/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
17713/// #     ),
17714/// # ).build().await.unwrap();
17715///
17716/// # let client = hyper_util::client::legacy::Client::builder(
17717/// #     hyper_util::rt::TokioExecutor::new()
17718/// # )
17719/// # .build(
17720/// #     hyper_rustls::HttpsConnectorBuilder::new()
17721/// #         .with_native_roots()
17722/// #         .unwrap()
17723/// #         .https_or_http()
17724/// #         .enable_http2()
17725/// #         .build()
17726/// # );
17727/// # let mut hub = CloudResourceManager::new(client, auth);
17728/// // You can configure optional parameters by calling the respective setters at will, and
17729/// // execute the final call using `doit()`.
17730/// // Values shown here are possibly random and not representative !
17731/// let result = hub.tag_keys().list()
17732///              .parent("accusam")
17733///              .page_token("takimata")
17734///              .page_size(-46)
17735///              .doit().await;
17736/// # }
17737/// ```
17738pub struct TagKeyListCall<'a, C>
17739where
17740    C: 'a,
17741{
17742    hub: &'a CloudResourceManager<C>,
17743    _parent: Option<String>,
17744    _page_token: Option<String>,
17745    _page_size: Option<i32>,
17746    _delegate: Option<&'a mut dyn common::Delegate>,
17747    _additional_params: HashMap<String, String>,
17748    _scopes: BTreeSet<String>,
17749}
17750
17751impl<'a, C> common::CallBuilder for TagKeyListCall<'a, C> {}
17752
17753impl<'a, C> TagKeyListCall<'a, C>
17754where
17755    C: common::Connector,
17756{
17757    /// Perform the operation you have build so far.
17758    pub async fn doit(mut self) -> common::Result<(common::Response, ListTagKeysResponse)> {
17759        use std::borrow::Cow;
17760        use std::io::{Read, Seek};
17761
17762        use common::{url::Params, ToParts};
17763        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17764
17765        let mut dd = common::DefaultDelegate;
17766        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17767        dlg.begin(common::MethodInfo {
17768            id: "cloudresourcemanager.tagKeys.list",
17769            http_method: hyper::Method::GET,
17770        });
17771
17772        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
17773            if self._additional_params.contains_key(field) {
17774                dlg.finished(false);
17775                return Err(common::Error::FieldClash(field));
17776            }
17777        }
17778
17779        let mut params = Params::with_capacity(5 + self._additional_params.len());
17780        if let Some(value) = self._parent.as_ref() {
17781            params.push("parent", value);
17782        }
17783        if let Some(value) = self._page_token.as_ref() {
17784            params.push("pageToken", value);
17785        }
17786        if let Some(value) = self._page_size.as_ref() {
17787            params.push("pageSize", value.to_string());
17788        }
17789
17790        params.extend(self._additional_params.iter());
17791
17792        params.push("alt", "json");
17793        let mut url = self.hub._base_url.clone() + "v3/tagKeys";
17794        if self._scopes.is_empty() {
17795            self._scopes
17796                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
17797        }
17798
17799        let url = params.parse_with_url(&url);
17800
17801        loop {
17802            let token = match self
17803                .hub
17804                .auth
17805                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17806                .await
17807            {
17808                Ok(token) => token,
17809                Err(e) => match dlg.token(e) {
17810                    Ok(token) => token,
17811                    Err(e) => {
17812                        dlg.finished(false);
17813                        return Err(common::Error::MissingToken(e));
17814                    }
17815                },
17816            };
17817            let mut req_result = {
17818                let client = &self.hub.client;
17819                dlg.pre_request();
17820                let mut req_builder = hyper::Request::builder()
17821                    .method(hyper::Method::GET)
17822                    .uri(url.as_str())
17823                    .header(USER_AGENT, self.hub._user_agent.clone());
17824
17825                if let Some(token) = token.as_ref() {
17826                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17827                }
17828
17829                let request = req_builder
17830                    .header(CONTENT_LENGTH, 0_u64)
17831                    .body(common::to_body::<String>(None));
17832
17833                client.request(request.unwrap()).await
17834            };
17835
17836            match req_result {
17837                Err(err) => {
17838                    if let common::Retry::After(d) = dlg.http_error(&err) {
17839                        sleep(d).await;
17840                        continue;
17841                    }
17842                    dlg.finished(false);
17843                    return Err(common::Error::HttpError(err));
17844                }
17845                Ok(res) => {
17846                    let (mut parts, body) = res.into_parts();
17847                    let mut body = common::Body::new(body);
17848                    if !parts.status.is_success() {
17849                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17850                        let error = serde_json::from_str(&common::to_string(&bytes));
17851                        let response = common::to_response(parts, bytes.into());
17852
17853                        if let common::Retry::After(d) =
17854                            dlg.http_failure(&response, error.as_ref().ok())
17855                        {
17856                            sleep(d).await;
17857                            continue;
17858                        }
17859
17860                        dlg.finished(false);
17861
17862                        return Err(match error {
17863                            Ok(value) => common::Error::BadRequest(value),
17864                            _ => common::Error::Failure(response),
17865                        });
17866                    }
17867                    let response = {
17868                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17869                        let encoded = common::to_string(&bytes);
17870                        match serde_json::from_str(&encoded) {
17871                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17872                            Err(error) => {
17873                                dlg.response_json_decode_error(&encoded, &error);
17874                                return Err(common::Error::JsonDecodeError(
17875                                    encoded.to_string(),
17876                                    error,
17877                                ));
17878                            }
17879                        }
17880                    };
17881
17882                    dlg.finished(true);
17883                    return Ok(response);
17884                }
17885            }
17886        }
17887    }
17888
17889    /// Required. The resource name of the TagKey's parent. Must be of the form `organizations/{org_id}` or `projects/{project_id}` or `projects/{project_number}`
17890    ///
17891    /// Sets the *parent* query property to the given value.
17892    pub fn parent(mut self, new_value: &str) -> TagKeyListCall<'a, C> {
17893        self._parent = Some(new_value.to_string());
17894        self
17895    }
17896    /// Optional. A pagination token returned from a previous call to `ListTagKey` that indicates where this listing should continue from.
17897    ///
17898    /// Sets the *page token* query property to the given value.
17899    pub fn page_token(mut self, new_value: &str) -> TagKeyListCall<'a, C> {
17900        self._page_token = Some(new_value.to_string());
17901        self
17902    }
17903    /// Optional. The maximum number of TagKeys to return in the response. The server allows a maximum of 300 TagKeys to return. If unspecified, the server will use 100 as the default.
17904    ///
17905    /// Sets the *page size* query property to the given value.
17906    pub fn page_size(mut self, new_value: i32) -> TagKeyListCall<'a, C> {
17907        self._page_size = Some(new_value);
17908        self
17909    }
17910    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17911    /// while executing the actual API request.
17912    ///
17913    /// ````text
17914    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17915    /// ````
17916    ///
17917    /// Sets the *delegate* property to the given value.
17918    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagKeyListCall<'a, C> {
17919        self._delegate = Some(new_value);
17920        self
17921    }
17922
17923    /// Set any additional parameter of the query string used in the request.
17924    /// It should be used to set parameters which are not yet available through their own
17925    /// setters.
17926    ///
17927    /// Please note that this method must not be used to set any of the known parameters
17928    /// which have their own setter method. If done anyway, the request will fail.
17929    ///
17930    /// # Additional Parameters
17931    ///
17932    /// * *$.xgafv* (query-string) - V1 error format.
17933    /// * *access_token* (query-string) - OAuth access token.
17934    /// * *alt* (query-string) - Data format for response.
17935    /// * *callback* (query-string) - JSONP
17936    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17937    /// * *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.
17938    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17939    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17940    /// * *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.
17941    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17942    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17943    pub fn param<T>(mut self, name: T, value: T) -> TagKeyListCall<'a, C>
17944    where
17945        T: AsRef<str>,
17946    {
17947        self._additional_params
17948            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17949        self
17950    }
17951
17952    /// Identifies the authorization scope for the method you are building.
17953    ///
17954    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17955    /// [`Scope::CloudPlatformReadOnly`].
17956    ///
17957    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17958    /// tokens for more than one scope.
17959    ///
17960    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17961    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17962    /// sufficient, a read-write scope will do as well.
17963    pub fn add_scope<St>(mut self, scope: St) -> TagKeyListCall<'a, C>
17964    where
17965        St: AsRef<str>,
17966    {
17967        self._scopes.insert(String::from(scope.as_ref()));
17968        self
17969    }
17970    /// Identifies the authorization scope(s) for the method you are building.
17971    ///
17972    /// See [`Self::add_scope()`] for details.
17973    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyListCall<'a, C>
17974    where
17975        I: IntoIterator<Item = St>,
17976        St: AsRef<str>,
17977    {
17978        self._scopes
17979            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17980        self
17981    }
17982
17983    /// Removes all scopes, and no default scope will be used either.
17984    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17985    /// for details).
17986    pub fn clear_scopes(mut self) -> TagKeyListCall<'a, C> {
17987        self._scopes.clear();
17988        self
17989    }
17990}
17991
17992/// Updates the attributes of the TagKey resource.
17993///
17994/// A builder for the *patch* method supported by a *tagKey* resource.
17995/// It is not used directly, but through a [`TagKeyMethods`] instance.
17996///
17997/// # Example
17998///
17999/// Instantiate a resource method builder
18000///
18001/// ```test_harness,no_run
18002/// # extern crate hyper;
18003/// # extern crate hyper_rustls;
18004/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
18005/// use cloudresourcemanager3::api::TagKey;
18006/// # async fn dox() {
18007/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18008///
18009/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18010/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18011/// #     .with_native_roots()
18012/// #     .unwrap()
18013/// #     .https_only()
18014/// #     .enable_http2()
18015/// #     .build();
18016///
18017/// # let executor = hyper_util::rt::TokioExecutor::new();
18018/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18019/// #     secret,
18020/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18021/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18022/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18023/// #     ),
18024/// # ).build().await.unwrap();
18025///
18026/// # let client = hyper_util::client::legacy::Client::builder(
18027/// #     hyper_util::rt::TokioExecutor::new()
18028/// # )
18029/// # .build(
18030/// #     hyper_rustls::HttpsConnectorBuilder::new()
18031/// #         .with_native_roots()
18032/// #         .unwrap()
18033/// #         .https_or_http()
18034/// #         .enable_http2()
18035/// #         .build()
18036/// # );
18037/// # let mut hub = CloudResourceManager::new(client, auth);
18038/// // As the method needs a request, you would usually fill it with the desired information
18039/// // into the respective structure. Some of the parts shown here might not be applicable !
18040/// // Values shown here are possibly random and not representative !
18041/// let mut req = TagKey::default();
18042///
18043/// // You can configure optional parameters by calling the respective setters at will, and
18044/// // execute the final call using `doit()`.
18045/// // Values shown here are possibly random and not representative !
18046/// let result = hub.tag_keys().patch(req, "name")
18047///              .validate_only(false)
18048///              .update_mask(FieldMask::new::<&str>(&[]))
18049///              .doit().await;
18050/// # }
18051/// ```
18052pub struct TagKeyPatchCall<'a, C>
18053where
18054    C: 'a,
18055{
18056    hub: &'a CloudResourceManager<C>,
18057    _request: TagKey,
18058    _name: String,
18059    _validate_only: Option<bool>,
18060    _update_mask: Option<common::FieldMask>,
18061    _delegate: Option<&'a mut dyn common::Delegate>,
18062    _additional_params: HashMap<String, String>,
18063    _scopes: BTreeSet<String>,
18064}
18065
18066impl<'a, C> common::CallBuilder for TagKeyPatchCall<'a, C> {}
18067
18068impl<'a, C> TagKeyPatchCall<'a, C>
18069where
18070    C: common::Connector,
18071{
18072    /// Perform the operation you have build so far.
18073    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18074        use std::borrow::Cow;
18075        use std::io::{Read, Seek};
18076
18077        use common::{url::Params, ToParts};
18078        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18079
18080        let mut dd = common::DefaultDelegate;
18081        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18082        dlg.begin(common::MethodInfo {
18083            id: "cloudresourcemanager.tagKeys.patch",
18084            http_method: hyper::Method::PATCH,
18085        });
18086
18087        for &field in ["alt", "name", "validateOnly", "updateMask"].iter() {
18088            if self._additional_params.contains_key(field) {
18089                dlg.finished(false);
18090                return Err(common::Error::FieldClash(field));
18091            }
18092        }
18093
18094        let mut params = Params::with_capacity(6 + self._additional_params.len());
18095        params.push("name", self._name);
18096        if let Some(value) = self._validate_only.as_ref() {
18097            params.push("validateOnly", value.to_string());
18098        }
18099        if let Some(value) = self._update_mask.as_ref() {
18100            params.push("updateMask", value.to_string());
18101        }
18102
18103        params.extend(self._additional_params.iter());
18104
18105        params.push("alt", "json");
18106        let mut url = self.hub._base_url.clone() + "v3/{+name}";
18107        if self._scopes.is_empty() {
18108            self._scopes
18109                .insert(Scope::CloudPlatform.as_ref().to_string());
18110        }
18111
18112        #[allow(clippy::single_element_loop)]
18113        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18114            url = params.uri_replacement(url, param_name, find_this, true);
18115        }
18116        {
18117            let to_remove = ["name"];
18118            params.remove_params(&to_remove);
18119        }
18120
18121        let url = params.parse_with_url(&url);
18122
18123        let mut json_mime_type = mime::APPLICATION_JSON;
18124        let mut request_value_reader = {
18125            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18126            common::remove_json_null_values(&mut value);
18127            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18128            serde_json::to_writer(&mut dst, &value).unwrap();
18129            dst
18130        };
18131        let request_size = request_value_reader
18132            .seek(std::io::SeekFrom::End(0))
18133            .unwrap();
18134        request_value_reader
18135            .seek(std::io::SeekFrom::Start(0))
18136            .unwrap();
18137
18138        loop {
18139            let token = match self
18140                .hub
18141                .auth
18142                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18143                .await
18144            {
18145                Ok(token) => token,
18146                Err(e) => match dlg.token(e) {
18147                    Ok(token) => token,
18148                    Err(e) => {
18149                        dlg.finished(false);
18150                        return Err(common::Error::MissingToken(e));
18151                    }
18152                },
18153            };
18154            request_value_reader
18155                .seek(std::io::SeekFrom::Start(0))
18156                .unwrap();
18157            let mut req_result = {
18158                let client = &self.hub.client;
18159                dlg.pre_request();
18160                let mut req_builder = hyper::Request::builder()
18161                    .method(hyper::Method::PATCH)
18162                    .uri(url.as_str())
18163                    .header(USER_AGENT, self.hub._user_agent.clone());
18164
18165                if let Some(token) = token.as_ref() {
18166                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18167                }
18168
18169                let request = req_builder
18170                    .header(CONTENT_TYPE, json_mime_type.to_string())
18171                    .header(CONTENT_LENGTH, request_size as u64)
18172                    .body(common::to_body(
18173                        request_value_reader.get_ref().clone().into(),
18174                    ));
18175
18176                client.request(request.unwrap()).await
18177            };
18178
18179            match req_result {
18180                Err(err) => {
18181                    if let common::Retry::After(d) = dlg.http_error(&err) {
18182                        sleep(d).await;
18183                        continue;
18184                    }
18185                    dlg.finished(false);
18186                    return Err(common::Error::HttpError(err));
18187                }
18188                Ok(res) => {
18189                    let (mut parts, body) = res.into_parts();
18190                    let mut body = common::Body::new(body);
18191                    if !parts.status.is_success() {
18192                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18193                        let error = serde_json::from_str(&common::to_string(&bytes));
18194                        let response = common::to_response(parts, bytes.into());
18195
18196                        if let common::Retry::After(d) =
18197                            dlg.http_failure(&response, error.as_ref().ok())
18198                        {
18199                            sleep(d).await;
18200                            continue;
18201                        }
18202
18203                        dlg.finished(false);
18204
18205                        return Err(match error {
18206                            Ok(value) => common::Error::BadRequest(value),
18207                            _ => common::Error::Failure(response),
18208                        });
18209                    }
18210                    let response = {
18211                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18212                        let encoded = common::to_string(&bytes);
18213                        match serde_json::from_str(&encoded) {
18214                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18215                            Err(error) => {
18216                                dlg.response_json_decode_error(&encoded, &error);
18217                                return Err(common::Error::JsonDecodeError(
18218                                    encoded.to_string(),
18219                                    error,
18220                                ));
18221                            }
18222                        }
18223                    };
18224
18225                    dlg.finished(true);
18226                    return Ok(response);
18227                }
18228            }
18229        }
18230    }
18231
18232    ///
18233    /// Sets the *request* property to the given value.
18234    ///
18235    /// Even though the property as already been set when instantiating this call,
18236    /// we provide this method for API completeness.
18237    pub fn request(mut self, new_value: TagKey) -> TagKeyPatchCall<'a, C> {
18238        self._request = new_value;
18239        self
18240    }
18241    /// Immutable. The resource name for a TagKey. Must be in the format `tagKeys/{tag_key_id}`, where `tag_key_id` is the generated numeric id for the TagKey.
18242    ///
18243    /// Sets the *name* path property to the given value.
18244    ///
18245    /// Even though the property as already been set when instantiating this call,
18246    /// we provide this method for API completeness.
18247    pub fn name(mut self, new_value: &str) -> TagKeyPatchCall<'a, C> {
18248        self._name = new_value.to_string();
18249        self
18250    }
18251    /// Set as true to perform validations necessary for updating the resource, but not actually perform the action.
18252    ///
18253    /// Sets the *validate only* query property to the given value.
18254    pub fn validate_only(mut self, new_value: bool) -> TagKeyPatchCall<'a, C> {
18255        self._validate_only = Some(new_value);
18256        self
18257    }
18258    /// Fields to be updated. The mask may only contain `description` or `etag`. If omitted entirely, both `description` and `etag` are assumed to be significant.
18259    ///
18260    /// Sets the *update mask* query property to the given value.
18261    pub fn update_mask(mut self, new_value: common::FieldMask) -> TagKeyPatchCall<'a, C> {
18262        self._update_mask = Some(new_value);
18263        self
18264    }
18265    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18266    /// while executing the actual API request.
18267    ///
18268    /// ````text
18269    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18270    /// ````
18271    ///
18272    /// Sets the *delegate* property to the given value.
18273    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagKeyPatchCall<'a, C> {
18274        self._delegate = Some(new_value);
18275        self
18276    }
18277
18278    /// Set any additional parameter of the query string used in the request.
18279    /// It should be used to set parameters which are not yet available through their own
18280    /// setters.
18281    ///
18282    /// Please note that this method must not be used to set any of the known parameters
18283    /// which have their own setter method. If done anyway, the request will fail.
18284    ///
18285    /// # Additional Parameters
18286    ///
18287    /// * *$.xgafv* (query-string) - V1 error format.
18288    /// * *access_token* (query-string) - OAuth access token.
18289    /// * *alt* (query-string) - Data format for response.
18290    /// * *callback* (query-string) - JSONP
18291    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18292    /// * *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.
18293    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18294    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18295    /// * *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.
18296    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18297    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18298    pub fn param<T>(mut self, name: T, value: T) -> TagKeyPatchCall<'a, C>
18299    where
18300        T: AsRef<str>,
18301    {
18302        self._additional_params
18303            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18304        self
18305    }
18306
18307    /// Identifies the authorization scope for the method you are building.
18308    ///
18309    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18310    /// [`Scope::CloudPlatform`].
18311    ///
18312    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18313    /// tokens for more than one scope.
18314    ///
18315    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18316    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18317    /// sufficient, a read-write scope will do as well.
18318    pub fn add_scope<St>(mut self, scope: St) -> TagKeyPatchCall<'a, C>
18319    where
18320        St: AsRef<str>,
18321    {
18322        self._scopes.insert(String::from(scope.as_ref()));
18323        self
18324    }
18325    /// Identifies the authorization scope(s) for the method you are building.
18326    ///
18327    /// See [`Self::add_scope()`] for details.
18328    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyPatchCall<'a, C>
18329    where
18330        I: IntoIterator<Item = St>,
18331        St: AsRef<str>,
18332    {
18333        self._scopes
18334            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18335        self
18336    }
18337
18338    /// Removes all scopes, and no default scope will be used either.
18339    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18340    /// for details).
18341    pub fn clear_scopes(mut self) -> TagKeyPatchCall<'a, C> {
18342        self._scopes.clear();
18343        self
18344    }
18345}
18346
18347/// Sets the access control policy on a TagKey, replacing any existing policy. The `resource` field should be the TagKey's resource name. For example, "tagKeys/1234". The caller must have `resourcemanager.tagKeys.setIamPolicy` permission on the identified tagValue.
18348///
18349/// A builder for the *setIamPolicy* method supported by a *tagKey* resource.
18350/// It is not used directly, but through a [`TagKeyMethods`] instance.
18351///
18352/// # Example
18353///
18354/// Instantiate a resource method builder
18355///
18356/// ```test_harness,no_run
18357/// # extern crate hyper;
18358/// # extern crate hyper_rustls;
18359/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
18360/// use cloudresourcemanager3::api::SetIamPolicyRequest;
18361/// # async fn dox() {
18362/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18363///
18364/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18365/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18366/// #     .with_native_roots()
18367/// #     .unwrap()
18368/// #     .https_only()
18369/// #     .enable_http2()
18370/// #     .build();
18371///
18372/// # let executor = hyper_util::rt::TokioExecutor::new();
18373/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18374/// #     secret,
18375/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18376/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18377/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18378/// #     ),
18379/// # ).build().await.unwrap();
18380///
18381/// # let client = hyper_util::client::legacy::Client::builder(
18382/// #     hyper_util::rt::TokioExecutor::new()
18383/// # )
18384/// # .build(
18385/// #     hyper_rustls::HttpsConnectorBuilder::new()
18386/// #         .with_native_roots()
18387/// #         .unwrap()
18388/// #         .https_or_http()
18389/// #         .enable_http2()
18390/// #         .build()
18391/// # );
18392/// # let mut hub = CloudResourceManager::new(client, auth);
18393/// // As the method needs a request, you would usually fill it with the desired information
18394/// // into the respective structure. Some of the parts shown here might not be applicable !
18395/// // Values shown here are possibly random and not representative !
18396/// let mut req = SetIamPolicyRequest::default();
18397///
18398/// // You can configure optional parameters by calling the respective setters at will, and
18399/// // execute the final call using `doit()`.
18400/// // Values shown here are possibly random and not representative !
18401/// let result = hub.tag_keys().set_iam_policy(req, "resource")
18402///              .doit().await;
18403/// # }
18404/// ```
18405pub struct TagKeySetIamPolicyCall<'a, C>
18406where
18407    C: 'a,
18408{
18409    hub: &'a CloudResourceManager<C>,
18410    _request: SetIamPolicyRequest,
18411    _resource: String,
18412    _delegate: Option<&'a mut dyn common::Delegate>,
18413    _additional_params: HashMap<String, String>,
18414    _scopes: BTreeSet<String>,
18415}
18416
18417impl<'a, C> common::CallBuilder for TagKeySetIamPolicyCall<'a, C> {}
18418
18419impl<'a, C> TagKeySetIamPolicyCall<'a, C>
18420where
18421    C: common::Connector,
18422{
18423    /// Perform the operation you have build so far.
18424    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18425        use std::borrow::Cow;
18426        use std::io::{Read, Seek};
18427
18428        use common::{url::Params, ToParts};
18429        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18430
18431        let mut dd = common::DefaultDelegate;
18432        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18433        dlg.begin(common::MethodInfo {
18434            id: "cloudresourcemanager.tagKeys.setIamPolicy",
18435            http_method: hyper::Method::POST,
18436        });
18437
18438        for &field in ["alt", "resource"].iter() {
18439            if self._additional_params.contains_key(field) {
18440                dlg.finished(false);
18441                return Err(common::Error::FieldClash(field));
18442            }
18443        }
18444
18445        let mut params = Params::with_capacity(4 + self._additional_params.len());
18446        params.push("resource", self._resource);
18447
18448        params.extend(self._additional_params.iter());
18449
18450        params.push("alt", "json");
18451        let mut url = self.hub._base_url.clone() + "v3/{+resource}:setIamPolicy";
18452        if self._scopes.is_empty() {
18453            self._scopes
18454                .insert(Scope::CloudPlatform.as_ref().to_string());
18455        }
18456
18457        #[allow(clippy::single_element_loop)]
18458        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18459            url = params.uri_replacement(url, param_name, find_this, true);
18460        }
18461        {
18462            let to_remove = ["resource"];
18463            params.remove_params(&to_remove);
18464        }
18465
18466        let url = params.parse_with_url(&url);
18467
18468        let mut json_mime_type = mime::APPLICATION_JSON;
18469        let mut request_value_reader = {
18470            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18471            common::remove_json_null_values(&mut value);
18472            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18473            serde_json::to_writer(&mut dst, &value).unwrap();
18474            dst
18475        };
18476        let request_size = request_value_reader
18477            .seek(std::io::SeekFrom::End(0))
18478            .unwrap();
18479        request_value_reader
18480            .seek(std::io::SeekFrom::Start(0))
18481            .unwrap();
18482
18483        loop {
18484            let token = match self
18485                .hub
18486                .auth
18487                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18488                .await
18489            {
18490                Ok(token) => token,
18491                Err(e) => match dlg.token(e) {
18492                    Ok(token) => token,
18493                    Err(e) => {
18494                        dlg.finished(false);
18495                        return Err(common::Error::MissingToken(e));
18496                    }
18497                },
18498            };
18499            request_value_reader
18500                .seek(std::io::SeekFrom::Start(0))
18501                .unwrap();
18502            let mut req_result = {
18503                let client = &self.hub.client;
18504                dlg.pre_request();
18505                let mut req_builder = hyper::Request::builder()
18506                    .method(hyper::Method::POST)
18507                    .uri(url.as_str())
18508                    .header(USER_AGENT, self.hub._user_agent.clone());
18509
18510                if let Some(token) = token.as_ref() {
18511                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18512                }
18513
18514                let request = req_builder
18515                    .header(CONTENT_TYPE, json_mime_type.to_string())
18516                    .header(CONTENT_LENGTH, request_size as u64)
18517                    .body(common::to_body(
18518                        request_value_reader.get_ref().clone().into(),
18519                    ));
18520
18521                client.request(request.unwrap()).await
18522            };
18523
18524            match req_result {
18525                Err(err) => {
18526                    if let common::Retry::After(d) = dlg.http_error(&err) {
18527                        sleep(d).await;
18528                        continue;
18529                    }
18530                    dlg.finished(false);
18531                    return Err(common::Error::HttpError(err));
18532                }
18533                Ok(res) => {
18534                    let (mut parts, body) = res.into_parts();
18535                    let mut body = common::Body::new(body);
18536                    if !parts.status.is_success() {
18537                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18538                        let error = serde_json::from_str(&common::to_string(&bytes));
18539                        let response = common::to_response(parts, bytes.into());
18540
18541                        if let common::Retry::After(d) =
18542                            dlg.http_failure(&response, error.as_ref().ok())
18543                        {
18544                            sleep(d).await;
18545                            continue;
18546                        }
18547
18548                        dlg.finished(false);
18549
18550                        return Err(match error {
18551                            Ok(value) => common::Error::BadRequest(value),
18552                            _ => common::Error::Failure(response),
18553                        });
18554                    }
18555                    let response = {
18556                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18557                        let encoded = common::to_string(&bytes);
18558                        match serde_json::from_str(&encoded) {
18559                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18560                            Err(error) => {
18561                                dlg.response_json_decode_error(&encoded, &error);
18562                                return Err(common::Error::JsonDecodeError(
18563                                    encoded.to_string(),
18564                                    error,
18565                                ));
18566                            }
18567                        }
18568                    };
18569
18570                    dlg.finished(true);
18571                    return Ok(response);
18572                }
18573            }
18574        }
18575    }
18576
18577    ///
18578    /// Sets the *request* property to the given value.
18579    ///
18580    /// Even though the property as already been set when instantiating this call,
18581    /// we provide this method for API completeness.
18582    pub fn request(mut self, new_value: SetIamPolicyRequest) -> TagKeySetIamPolicyCall<'a, C> {
18583        self._request = new_value;
18584        self
18585    }
18586    /// 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.
18587    ///
18588    /// Sets the *resource* path property to the given value.
18589    ///
18590    /// Even though the property as already been set when instantiating this call,
18591    /// we provide this method for API completeness.
18592    pub fn resource(mut self, new_value: &str) -> TagKeySetIamPolicyCall<'a, C> {
18593        self._resource = new_value.to_string();
18594        self
18595    }
18596    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18597    /// while executing the actual API request.
18598    ///
18599    /// ````text
18600    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18601    /// ````
18602    ///
18603    /// Sets the *delegate* property to the given value.
18604    pub fn delegate(
18605        mut self,
18606        new_value: &'a mut dyn common::Delegate,
18607    ) -> TagKeySetIamPolicyCall<'a, C> {
18608        self._delegate = Some(new_value);
18609        self
18610    }
18611
18612    /// Set any additional parameter of the query string used in the request.
18613    /// It should be used to set parameters which are not yet available through their own
18614    /// setters.
18615    ///
18616    /// Please note that this method must not be used to set any of the known parameters
18617    /// which have their own setter method. If done anyway, the request will fail.
18618    ///
18619    /// # Additional Parameters
18620    ///
18621    /// * *$.xgafv* (query-string) - V1 error format.
18622    /// * *access_token* (query-string) - OAuth access token.
18623    /// * *alt* (query-string) - Data format for response.
18624    /// * *callback* (query-string) - JSONP
18625    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18626    /// * *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.
18627    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18628    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18629    /// * *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.
18630    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18631    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18632    pub fn param<T>(mut self, name: T, value: T) -> TagKeySetIamPolicyCall<'a, C>
18633    where
18634        T: AsRef<str>,
18635    {
18636        self._additional_params
18637            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18638        self
18639    }
18640
18641    /// Identifies the authorization scope for the method you are building.
18642    ///
18643    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18644    /// [`Scope::CloudPlatform`].
18645    ///
18646    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18647    /// tokens for more than one scope.
18648    ///
18649    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18650    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18651    /// sufficient, a read-write scope will do as well.
18652    pub fn add_scope<St>(mut self, scope: St) -> TagKeySetIamPolicyCall<'a, C>
18653    where
18654        St: AsRef<str>,
18655    {
18656        self._scopes.insert(String::from(scope.as_ref()));
18657        self
18658    }
18659    /// Identifies the authorization scope(s) for the method you are building.
18660    ///
18661    /// See [`Self::add_scope()`] for details.
18662    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeySetIamPolicyCall<'a, C>
18663    where
18664        I: IntoIterator<Item = St>,
18665        St: AsRef<str>,
18666    {
18667        self._scopes
18668            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18669        self
18670    }
18671
18672    /// Removes all scopes, and no default scope will be used either.
18673    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18674    /// for details).
18675    pub fn clear_scopes(mut self) -> TagKeySetIamPolicyCall<'a, C> {
18676        self._scopes.clear();
18677        self
18678    }
18679}
18680
18681/// Returns permissions that a caller has on the specified TagKey. The `resource` field should be the TagKey's resource name. For example, "tagKeys/1234". There are no permissions required for making this API call.
18682///
18683/// A builder for the *testIamPermissions* method supported by a *tagKey* resource.
18684/// It is not used directly, but through a [`TagKeyMethods`] instance.
18685///
18686/// # Example
18687///
18688/// Instantiate a resource method builder
18689///
18690/// ```test_harness,no_run
18691/// # extern crate hyper;
18692/// # extern crate hyper_rustls;
18693/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
18694/// use cloudresourcemanager3::api::TestIamPermissionsRequest;
18695/// # async fn dox() {
18696/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18697///
18698/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18699/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18700/// #     .with_native_roots()
18701/// #     .unwrap()
18702/// #     .https_only()
18703/// #     .enable_http2()
18704/// #     .build();
18705///
18706/// # let executor = hyper_util::rt::TokioExecutor::new();
18707/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18708/// #     secret,
18709/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18710/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
18711/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
18712/// #     ),
18713/// # ).build().await.unwrap();
18714///
18715/// # let client = hyper_util::client::legacy::Client::builder(
18716/// #     hyper_util::rt::TokioExecutor::new()
18717/// # )
18718/// # .build(
18719/// #     hyper_rustls::HttpsConnectorBuilder::new()
18720/// #         .with_native_roots()
18721/// #         .unwrap()
18722/// #         .https_or_http()
18723/// #         .enable_http2()
18724/// #         .build()
18725/// # );
18726/// # let mut hub = CloudResourceManager::new(client, auth);
18727/// // As the method needs a request, you would usually fill it with the desired information
18728/// // into the respective structure. Some of the parts shown here might not be applicable !
18729/// // Values shown here are possibly random and not representative !
18730/// let mut req = TestIamPermissionsRequest::default();
18731///
18732/// // You can configure optional parameters by calling the respective setters at will, and
18733/// // execute the final call using `doit()`.
18734/// // Values shown here are possibly random and not representative !
18735/// let result = hub.tag_keys().test_iam_permissions(req, "resource")
18736///              .doit().await;
18737/// # }
18738/// ```
18739pub struct TagKeyTestIamPermissionCall<'a, C>
18740where
18741    C: 'a,
18742{
18743    hub: &'a CloudResourceManager<C>,
18744    _request: TestIamPermissionsRequest,
18745    _resource: String,
18746    _delegate: Option<&'a mut dyn common::Delegate>,
18747    _additional_params: HashMap<String, String>,
18748    _scopes: BTreeSet<String>,
18749}
18750
18751impl<'a, C> common::CallBuilder for TagKeyTestIamPermissionCall<'a, C> {}
18752
18753impl<'a, C> TagKeyTestIamPermissionCall<'a, C>
18754where
18755    C: common::Connector,
18756{
18757    /// Perform the operation you have build so far.
18758    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
18759        use std::borrow::Cow;
18760        use std::io::{Read, Seek};
18761
18762        use common::{url::Params, ToParts};
18763        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18764
18765        let mut dd = common::DefaultDelegate;
18766        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18767        dlg.begin(common::MethodInfo {
18768            id: "cloudresourcemanager.tagKeys.testIamPermissions",
18769            http_method: hyper::Method::POST,
18770        });
18771
18772        for &field in ["alt", "resource"].iter() {
18773            if self._additional_params.contains_key(field) {
18774                dlg.finished(false);
18775                return Err(common::Error::FieldClash(field));
18776            }
18777        }
18778
18779        let mut params = Params::with_capacity(4 + self._additional_params.len());
18780        params.push("resource", self._resource);
18781
18782        params.extend(self._additional_params.iter());
18783
18784        params.push("alt", "json");
18785        let mut url = self.hub._base_url.clone() + "v3/{+resource}:testIamPermissions";
18786        if self._scopes.is_empty() {
18787            self._scopes
18788                .insert(Scope::CloudPlatform.as_ref().to_string());
18789        }
18790
18791        #[allow(clippy::single_element_loop)]
18792        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18793            url = params.uri_replacement(url, param_name, find_this, true);
18794        }
18795        {
18796            let to_remove = ["resource"];
18797            params.remove_params(&to_remove);
18798        }
18799
18800        let url = params.parse_with_url(&url);
18801
18802        let mut json_mime_type = mime::APPLICATION_JSON;
18803        let mut request_value_reader = {
18804            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18805            common::remove_json_null_values(&mut value);
18806            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18807            serde_json::to_writer(&mut dst, &value).unwrap();
18808            dst
18809        };
18810        let request_size = request_value_reader
18811            .seek(std::io::SeekFrom::End(0))
18812            .unwrap();
18813        request_value_reader
18814            .seek(std::io::SeekFrom::Start(0))
18815            .unwrap();
18816
18817        loop {
18818            let token = match self
18819                .hub
18820                .auth
18821                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18822                .await
18823            {
18824                Ok(token) => token,
18825                Err(e) => match dlg.token(e) {
18826                    Ok(token) => token,
18827                    Err(e) => {
18828                        dlg.finished(false);
18829                        return Err(common::Error::MissingToken(e));
18830                    }
18831                },
18832            };
18833            request_value_reader
18834                .seek(std::io::SeekFrom::Start(0))
18835                .unwrap();
18836            let mut req_result = {
18837                let client = &self.hub.client;
18838                dlg.pre_request();
18839                let mut req_builder = hyper::Request::builder()
18840                    .method(hyper::Method::POST)
18841                    .uri(url.as_str())
18842                    .header(USER_AGENT, self.hub._user_agent.clone());
18843
18844                if let Some(token) = token.as_ref() {
18845                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18846                }
18847
18848                let request = req_builder
18849                    .header(CONTENT_TYPE, json_mime_type.to_string())
18850                    .header(CONTENT_LENGTH, request_size as u64)
18851                    .body(common::to_body(
18852                        request_value_reader.get_ref().clone().into(),
18853                    ));
18854
18855                client.request(request.unwrap()).await
18856            };
18857
18858            match req_result {
18859                Err(err) => {
18860                    if let common::Retry::After(d) = dlg.http_error(&err) {
18861                        sleep(d).await;
18862                        continue;
18863                    }
18864                    dlg.finished(false);
18865                    return Err(common::Error::HttpError(err));
18866                }
18867                Ok(res) => {
18868                    let (mut parts, body) = res.into_parts();
18869                    let mut body = common::Body::new(body);
18870                    if !parts.status.is_success() {
18871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18872                        let error = serde_json::from_str(&common::to_string(&bytes));
18873                        let response = common::to_response(parts, bytes.into());
18874
18875                        if let common::Retry::After(d) =
18876                            dlg.http_failure(&response, error.as_ref().ok())
18877                        {
18878                            sleep(d).await;
18879                            continue;
18880                        }
18881
18882                        dlg.finished(false);
18883
18884                        return Err(match error {
18885                            Ok(value) => common::Error::BadRequest(value),
18886                            _ => common::Error::Failure(response),
18887                        });
18888                    }
18889                    let response = {
18890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18891                        let encoded = common::to_string(&bytes);
18892                        match serde_json::from_str(&encoded) {
18893                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18894                            Err(error) => {
18895                                dlg.response_json_decode_error(&encoded, &error);
18896                                return Err(common::Error::JsonDecodeError(
18897                                    encoded.to_string(),
18898                                    error,
18899                                ));
18900                            }
18901                        }
18902                    };
18903
18904                    dlg.finished(true);
18905                    return Ok(response);
18906                }
18907            }
18908        }
18909    }
18910
18911    ///
18912    /// Sets the *request* property to the given value.
18913    ///
18914    /// Even though the property as already been set when instantiating this call,
18915    /// we provide this method for API completeness.
18916    pub fn request(
18917        mut self,
18918        new_value: TestIamPermissionsRequest,
18919    ) -> TagKeyTestIamPermissionCall<'a, C> {
18920        self._request = new_value;
18921        self
18922    }
18923    /// 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.
18924    ///
18925    /// Sets the *resource* path property to the given value.
18926    ///
18927    /// Even though the property as already been set when instantiating this call,
18928    /// we provide this method for API completeness.
18929    pub fn resource(mut self, new_value: &str) -> TagKeyTestIamPermissionCall<'a, C> {
18930        self._resource = new_value.to_string();
18931        self
18932    }
18933    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18934    /// while executing the actual API request.
18935    ///
18936    /// ````text
18937    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18938    /// ````
18939    ///
18940    /// Sets the *delegate* property to the given value.
18941    pub fn delegate(
18942        mut self,
18943        new_value: &'a mut dyn common::Delegate,
18944    ) -> TagKeyTestIamPermissionCall<'a, C> {
18945        self._delegate = Some(new_value);
18946        self
18947    }
18948
18949    /// Set any additional parameter of the query string used in the request.
18950    /// It should be used to set parameters which are not yet available through their own
18951    /// setters.
18952    ///
18953    /// Please note that this method must not be used to set any of the known parameters
18954    /// which have their own setter method. If done anyway, the request will fail.
18955    ///
18956    /// # Additional Parameters
18957    ///
18958    /// * *$.xgafv* (query-string) - V1 error format.
18959    /// * *access_token* (query-string) - OAuth access token.
18960    /// * *alt* (query-string) - Data format for response.
18961    /// * *callback* (query-string) - JSONP
18962    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18963    /// * *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.
18964    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18965    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18966    /// * *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.
18967    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18968    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18969    pub fn param<T>(mut self, name: T, value: T) -> TagKeyTestIamPermissionCall<'a, C>
18970    where
18971        T: AsRef<str>,
18972    {
18973        self._additional_params
18974            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18975        self
18976    }
18977
18978    /// Identifies the authorization scope for the method you are building.
18979    ///
18980    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18981    /// [`Scope::CloudPlatform`].
18982    ///
18983    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18984    /// tokens for more than one scope.
18985    ///
18986    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18987    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18988    /// sufficient, a read-write scope will do as well.
18989    pub fn add_scope<St>(mut self, scope: St) -> TagKeyTestIamPermissionCall<'a, C>
18990    where
18991        St: AsRef<str>,
18992    {
18993        self._scopes.insert(String::from(scope.as_ref()));
18994        self
18995    }
18996    /// Identifies the authorization scope(s) for the method you are building.
18997    ///
18998    /// See [`Self::add_scope()`] for details.
18999    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagKeyTestIamPermissionCall<'a, C>
19000    where
19001        I: IntoIterator<Item = St>,
19002        St: AsRef<str>,
19003    {
19004        self._scopes
19005            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19006        self
19007    }
19008
19009    /// Removes all scopes, and no default scope will be used either.
19010    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19011    /// for details).
19012    pub fn clear_scopes(mut self) -> TagKeyTestIamPermissionCall<'a, C> {
19013        self._scopes.clear();
19014        self
19015    }
19016}
19017
19018/// Creates a TagHold. Returns ALREADY_EXISTS if a TagHold with the same resource and origin exists under the same TagValue.
19019///
19020/// A builder for the *tagHolds.create* method supported by a *tagValue* resource.
19021/// It is not used directly, but through a [`TagValueMethods`] instance.
19022///
19023/// # Example
19024///
19025/// Instantiate a resource method builder
19026///
19027/// ```test_harness,no_run
19028/// # extern crate hyper;
19029/// # extern crate hyper_rustls;
19030/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
19031/// use cloudresourcemanager3::api::TagHold;
19032/// # async fn dox() {
19033/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19034///
19035/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19036/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19037/// #     .with_native_roots()
19038/// #     .unwrap()
19039/// #     .https_only()
19040/// #     .enable_http2()
19041/// #     .build();
19042///
19043/// # let executor = hyper_util::rt::TokioExecutor::new();
19044/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19045/// #     secret,
19046/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19047/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19048/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19049/// #     ),
19050/// # ).build().await.unwrap();
19051///
19052/// # let client = hyper_util::client::legacy::Client::builder(
19053/// #     hyper_util::rt::TokioExecutor::new()
19054/// # )
19055/// # .build(
19056/// #     hyper_rustls::HttpsConnectorBuilder::new()
19057/// #         .with_native_roots()
19058/// #         .unwrap()
19059/// #         .https_or_http()
19060/// #         .enable_http2()
19061/// #         .build()
19062/// # );
19063/// # let mut hub = CloudResourceManager::new(client, auth);
19064/// // As the method needs a request, you would usually fill it with the desired information
19065/// // into the respective structure. Some of the parts shown here might not be applicable !
19066/// // Values shown here are possibly random and not representative !
19067/// let mut req = TagHold::default();
19068///
19069/// // You can configure optional parameters by calling the respective setters at will, and
19070/// // execute the final call using `doit()`.
19071/// // Values shown here are possibly random and not representative !
19072/// let result = hub.tag_values().tag_holds_create(req, "parent")
19073///              .validate_only(true)
19074///              .doit().await;
19075/// # }
19076/// ```
19077pub struct TagValueTagHoldCreateCall<'a, C>
19078where
19079    C: 'a,
19080{
19081    hub: &'a CloudResourceManager<C>,
19082    _request: TagHold,
19083    _parent: String,
19084    _validate_only: Option<bool>,
19085    _delegate: Option<&'a mut dyn common::Delegate>,
19086    _additional_params: HashMap<String, String>,
19087    _scopes: BTreeSet<String>,
19088}
19089
19090impl<'a, C> common::CallBuilder for TagValueTagHoldCreateCall<'a, C> {}
19091
19092impl<'a, C> TagValueTagHoldCreateCall<'a, C>
19093where
19094    C: common::Connector,
19095{
19096    /// Perform the operation you have build so far.
19097    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19098        use std::borrow::Cow;
19099        use std::io::{Read, Seek};
19100
19101        use common::{url::Params, ToParts};
19102        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19103
19104        let mut dd = common::DefaultDelegate;
19105        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19106        dlg.begin(common::MethodInfo {
19107            id: "cloudresourcemanager.tagValues.tagHolds.create",
19108            http_method: hyper::Method::POST,
19109        });
19110
19111        for &field in ["alt", "parent", "validateOnly"].iter() {
19112            if self._additional_params.contains_key(field) {
19113                dlg.finished(false);
19114                return Err(common::Error::FieldClash(field));
19115            }
19116        }
19117
19118        let mut params = Params::with_capacity(5 + self._additional_params.len());
19119        params.push("parent", self._parent);
19120        if let Some(value) = self._validate_only.as_ref() {
19121            params.push("validateOnly", value.to_string());
19122        }
19123
19124        params.extend(self._additional_params.iter());
19125
19126        params.push("alt", "json");
19127        let mut url = self.hub._base_url.clone() + "v3/{+parent}/tagHolds";
19128        if self._scopes.is_empty() {
19129            self._scopes
19130                .insert(Scope::CloudPlatform.as_ref().to_string());
19131        }
19132
19133        #[allow(clippy::single_element_loop)]
19134        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19135            url = params.uri_replacement(url, param_name, find_this, true);
19136        }
19137        {
19138            let to_remove = ["parent"];
19139            params.remove_params(&to_remove);
19140        }
19141
19142        let url = params.parse_with_url(&url);
19143
19144        let mut json_mime_type = mime::APPLICATION_JSON;
19145        let mut request_value_reader = {
19146            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19147            common::remove_json_null_values(&mut value);
19148            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19149            serde_json::to_writer(&mut dst, &value).unwrap();
19150            dst
19151        };
19152        let request_size = request_value_reader
19153            .seek(std::io::SeekFrom::End(0))
19154            .unwrap();
19155        request_value_reader
19156            .seek(std::io::SeekFrom::Start(0))
19157            .unwrap();
19158
19159        loop {
19160            let token = match self
19161                .hub
19162                .auth
19163                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19164                .await
19165            {
19166                Ok(token) => token,
19167                Err(e) => match dlg.token(e) {
19168                    Ok(token) => token,
19169                    Err(e) => {
19170                        dlg.finished(false);
19171                        return Err(common::Error::MissingToken(e));
19172                    }
19173                },
19174            };
19175            request_value_reader
19176                .seek(std::io::SeekFrom::Start(0))
19177                .unwrap();
19178            let mut req_result = {
19179                let client = &self.hub.client;
19180                dlg.pre_request();
19181                let mut req_builder = hyper::Request::builder()
19182                    .method(hyper::Method::POST)
19183                    .uri(url.as_str())
19184                    .header(USER_AGENT, self.hub._user_agent.clone());
19185
19186                if let Some(token) = token.as_ref() {
19187                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19188                }
19189
19190                let request = req_builder
19191                    .header(CONTENT_TYPE, json_mime_type.to_string())
19192                    .header(CONTENT_LENGTH, request_size as u64)
19193                    .body(common::to_body(
19194                        request_value_reader.get_ref().clone().into(),
19195                    ));
19196
19197                client.request(request.unwrap()).await
19198            };
19199
19200            match req_result {
19201                Err(err) => {
19202                    if let common::Retry::After(d) = dlg.http_error(&err) {
19203                        sleep(d).await;
19204                        continue;
19205                    }
19206                    dlg.finished(false);
19207                    return Err(common::Error::HttpError(err));
19208                }
19209                Ok(res) => {
19210                    let (mut parts, body) = res.into_parts();
19211                    let mut body = common::Body::new(body);
19212                    if !parts.status.is_success() {
19213                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19214                        let error = serde_json::from_str(&common::to_string(&bytes));
19215                        let response = common::to_response(parts, bytes.into());
19216
19217                        if let common::Retry::After(d) =
19218                            dlg.http_failure(&response, error.as_ref().ok())
19219                        {
19220                            sleep(d).await;
19221                            continue;
19222                        }
19223
19224                        dlg.finished(false);
19225
19226                        return Err(match error {
19227                            Ok(value) => common::Error::BadRequest(value),
19228                            _ => common::Error::Failure(response),
19229                        });
19230                    }
19231                    let response = {
19232                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19233                        let encoded = common::to_string(&bytes);
19234                        match serde_json::from_str(&encoded) {
19235                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19236                            Err(error) => {
19237                                dlg.response_json_decode_error(&encoded, &error);
19238                                return Err(common::Error::JsonDecodeError(
19239                                    encoded.to_string(),
19240                                    error,
19241                                ));
19242                            }
19243                        }
19244                    };
19245
19246                    dlg.finished(true);
19247                    return Ok(response);
19248                }
19249            }
19250        }
19251    }
19252
19253    ///
19254    /// Sets the *request* property to the given value.
19255    ///
19256    /// Even though the property as already been set when instantiating this call,
19257    /// we provide this method for API completeness.
19258    pub fn request(mut self, new_value: TagHold) -> TagValueTagHoldCreateCall<'a, C> {
19259        self._request = new_value;
19260        self
19261    }
19262    /// Required. The resource name of the TagHold's parent TagValue. Must be of the form: `tagValues/{tag-value-id}`.
19263    ///
19264    /// Sets the *parent* path property to the given value.
19265    ///
19266    /// Even though the property as already been set when instantiating this call,
19267    /// we provide this method for API completeness.
19268    pub fn parent(mut self, new_value: &str) -> TagValueTagHoldCreateCall<'a, C> {
19269        self._parent = new_value.to_string();
19270        self
19271    }
19272    /// Optional. Set to true to perform the validations necessary for creating the resource, but not actually perform the action.
19273    ///
19274    /// Sets the *validate only* query property to the given value.
19275    pub fn validate_only(mut self, new_value: bool) -> TagValueTagHoldCreateCall<'a, C> {
19276        self._validate_only = Some(new_value);
19277        self
19278    }
19279    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19280    /// while executing the actual API request.
19281    ///
19282    /// ````text
19283    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19284    /// ````
19285    ///
19286    /// Sets the *delegate* property to the given value.
19287    pub fn delegate(
19288        mut self,
19289        new_value: &'a mut dyn common::Delegate,
19290    ) -> TagValueTagHoldCreateCall<'a, C> {
19291        self._delegate = Some(new_value);
19292        self
19293    }
19294
19295    /// Set any additional parameter of the query string used in the request.
19296    /// It should be used to set parameters which are not yet available through their own
19297    /// setters.
19298    ///
19299    /// Please note that this method must not be used to set any of the known parameters
19300    /// which have their own setter method. If done anyway, the request will fail.
19301    ///
19302    /// # Additional Parameters
19303    ///
19304    /// * *$.xgafv* (query-string) - V1 error format.
19305    /// * *access_token* (query-string) - OAuth access token.
19306    /// * *alt* (query-string) - Data format for response.
19307    /// * *callback* (query-string) - JSONP
19308    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19309    /// * *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.
19310    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19311    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19312    /// * *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.
19313    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19314    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19315    pub fn param<T>(mut self, name: T, value: T) -> TagValueTagHoldCreateCall<'a, C>
19316    where
19317        T: AsRef<str>,
19318    {
19319        self._additional_params
19320            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19321        self
19322    }
19323
19324    /// Identifies the authorization scope for the method you are building.
19325    ///
19326    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19327    /// [`Scope::CloudPlatform`].
19328    ///
19329    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19330    /// tokens for more than one scope.
19331    ///
19332    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19333    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19334    /// sufficient, a read-write scope will do as well.
19335    pub fn add_scope<St>(mut self, scope: St) -> TagValueTagHoldCreateCall<'a, C>
19336    where
19337        St: AsRef<str>,
19338    {
19339        self._scopes.insert(String::from(scope.as_ref()));
19340        self
19341    }
19342    /// Identifies the authorization scope(s) for the method you are building.
19343    ///
19344    /// See [`Self::add_scope()`] for details.
19345    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueTagHoldCreateCall<'a, C>
19346    where
19347        I: IntoIterator<Item = St>,
19348        St: AsRef<str>,
19349    {
19350        self._scopes
19351            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19352        self
19353    }
19354
19355    /// Removes all scopes, and no default scope will be used either.
19356    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19357    /// for details).
19358    pub fn clear_scopes(mut self) -> TagValueTagHoldCreateCall<'a, C> {
19359        self._scopes.clear();
19360        self
19361    }
19362}
19363
19364/// Deletes a TagHold.
19365///
19366/// A builder for the *tagHolds.delete* method supported by a *tagValue* resource.
19367/// It is not used directly, but through a [`TagValueMethods`] instance.
19368///
19369/// # Example
19370///
19371/// Instantiate a resource method builder
19372///
19373/// ```test_harness,no_run
19374/// # extern crate hyper;
19375/// # extern crate hyper_rustls;
19376/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
19377/// # async fn dox() {
19378/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19379///
19380/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19381/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19382/// #     .with_native_roots()
19383/// #     .unwrap()
19384/// #     .https_only()
19385/// #     .enable_http2()
19386/// #     .build();
19387///
19388/// # let executor = hyper_util::rt::TokioExecutor::new();
19389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19390/// #     secret,
19391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19392/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19393/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19394/// #     ),
19395/// # ).build().await.unwrap();
19396///
19397/// # let client = hyper_util::client::legacy::Client::builder(
19398/// #     hyper_util::rt::TokioExecutor::new()
19399/// # )
19400/// # .build(
19401/// #     hyper_rustls::HttpsConnectorBuilder::new()
19402/// #         .with_native_roots()
19403/// #         .unwrap()
19404/// #         .https_or_http()
19405/// #         .enable_http2()
19406/// #         .build()
19407/// # );
19408/// # let mut hub = CloudResourceManager::new(client, auth);
19409/// // You can configure optional parameters by calling the respective setters at will, and
19410/// // execute the final call using `doit()`.
19411/// // Values shown here are possibly random and not representative !
19412/// let result = hub.tag_values().tag_holds_delete("name")
19413///              .validate_only(false)
19414///              .doit().await;
19415/// # }
19416/// ```
19417pub struct TagValueTagHoldDeleteCall<'a, C>
19418where
19419    C: 'a,
19420{
19421    hub: &'a CloudResourceManager<C>,
19422    _name: String,
19423    _validate_only: Option<bool>,
19424    _delegate: Option<&'a mut dyn common::Delegate>,
19425    _additional_params: HashMap<String, String>,
19426    _scopes: BTreeSet<String>,
19427}
19428
19429impl<'a, C> common::CallBuilder for TagValueTagHoldDeleteCall<'a, C> {}
19430
19431impl<'a, C> TagValueTagHoldDeleteCall<'a, C>
19432where
19433    C: common::Connector,
19434{
19435    /// Perform the operation you have build so far.
19436    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19437        use std::borrow::Cow;
19438        use std::io::{Read, Seek};
19439
19440        use common::{url::Params, ToParts};
19441        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19442
19443        let mut dd = common::DefaultDelegate;
19444        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19445        dlg.begin(common::MethodInfo {
19446            id: "cloudresourcemanager.tagValues.tagHolds.delete",
19447            http_method: hyper::Method::DELETE,
19448        });
19449
19450        for &field in ["alt", "name", "validateOnly"].iter() {
19451            if self._additional_params.contains_key(field) {
19452                dlg.finished(false);
19453                return Err(common::Error::FieldClash(field));
19454            }
19455        }
19456
19457        let mut params = Params::with_capacity(4 + self._additional_params.len());
19458        params.push("name", self._name);
19459        if let Some(value) = self._validate_only.as_ref() {
19460            params.push("validateOnly", value.to_string());
19461        }
19462
19463        params.extend(self._additional_params.iter());
19464
19465        params.push("alt", "json");
19466        let mut url = self.hub._base_url.clone() + "v3/{+name}";
19467        if self._scopes.is_empty() {
19468            self._scopes
19469                .insert(Scope::CloudPlatform.as_ref().to_string());
19470        }
19471
19472        #[allow(clippy::single_element_loop)]
19473        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19474            url = params.uri_replacement(url, param_name, find_this, true);
19475        }
19476        {
19477            let to_remove = ["name"];
19478            params.remove_params(&to_remove);
19479        }
19480
19481        let url = params.parse_with_url(&url);
19482
19483        loop {
19484            let token = match self
19485                .hub
19486                .auth
19487                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19488                .await
19489            {
19490                Ok(token) => token,
19491                Err(e) => match dlg.token(e) {
19492                    Ok(token) => token,
19493                    Err(e) => {
19494                        dlg.finished(false);
19495                        return Err(common::Error::MissingToken(e));
19496                    }
19497                },
19498            };
19499            let mut req_result = {
19500                let client = &self.hub.client;
19501                dlg.pre_request();
19502                let mut req_builder = hyper::Request::builder()
19503                    .method(hyper::Method::DELETE)
19504                    .uri(url.as_str())
19505                    .header(USER_AGENT, self.hub._user_agent.clone());
19506
19507                if let Some(token) = token.as_ref() {
19508                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19509                }
19510
19511                let request = req_builder
19512                    .header(CONTENT_LENGTH, 0_u64)
19513                    .body(common::to_body::<String>(None));
19514
19515                client.request(request.unwrap()).await
19516            };
19517
19518            match req_result {
19519                Err(err) => {
19520                    if let common::Retry::After(d) = dlg.http_error(&err) {
19521                        sleep(d).await;
19522                        continue;
19523                    }
19524                    dlg.finished(false);
19525                    return Err(common::Error::HttpError(err));
19526                }
19527                Ok(res) => {
19528                    let (mut parts, body) = res.into_parts();
19529                    let mut body = common::Body::new(body);
19530                    if !parts.status.is_success() {
19531                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19532                        let error = serde_json::from_str(&common::to_string(&bytes));
19533                        let response = common::to_response(parts, bytes.into());
19534
19535                        if let common::Retry::After(d) =
19536                            dlg.http_failure(&response, error.as_ref().ok())
19537                        {
19538                            sleep(d).await;
19539                            continue;
19540                        }
19541
19542                        dlg.finished(false);
19543
19544                        return Err(match error {
19545                            Ok(value) => common::Error::BadRequest(value),
19546                            _ => common::Error::Failure(response),
19547                        });
19548                    }
19549                    let response = {
19550                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19551                        let encoded = common::to_string(&bytes);
19552                        match serde_json::from_str(&encoded) {
19553                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19554                            Err(error) => {
19555                                dlg.response_json_decode_error(&encoded, &error);
19556                                return Err(common::Error::JsonDecodeError(
19557                                    encoded.to_string(),
19558                                    error,
19559                                ));
19560                            }
19561                        }
19562                    };
19563
19564                    dlg.finished(true);
19565                    return Ok(response);
19566                }
19567            }
19568        }
19569    }
19570
19571    /// Required. The resource name of the TagHold to delete. Must be of the form: `tagValues/{tag-value-id}/tagHolds/{tag-hold-id}`.
19572    ///
19573    /// Sets the *name* path property to the given value.
19574    ///
19575    /// Even though the property as already been set when instantiating this call,
19576    /// we provide this method for API completeness.
19577    pub fn name(mut self, new_value: &str) -> TagValueTagHoldDeleteCall<'a, C> {
19578        self._name = new_value.to_string();
19579        self
19580    }
19581    /// Optional. Set to true to perform the validations necessary for deleting the resource, but not actually perform the action.
19582    ///
19583    /// Sets the *validate only* query property to the given value.
19584    pub fn validate_only(mut self, new_value: bool) -> TagValueTagHoldDeleteCall<'a, C> {
19585        self._validate_only = Some(new_value);
19586        self
19587    }
19588    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19589    /// while executing the actual API request.
19590    ///
19591    /// ````text
19592    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19593    /// ````
19594    ///
19595    /// Sets the *delegate* property to the given value.
19596    pub fn delegate(
19597        mut self,
19598        new_value: &'a mut dyn common::Delegate,
19599    ) -> TagValueTagHoldDeleteCall<'a, C> {
19600        self._delegate = Some(new_value);
19601        self
19602    }
19603
19604    /// Set any additional parameter of the query string used in the request.
19605    /// It should be used to set parameters which are not yet available through their own
19606    /// setters.
19607    ///
19608    /// Please note that this method must not be used to set any of the known parameters
19609    /// which have their own setter method. If done anyway, the request will fail.
19610    ///
19611    /// # Additional Parameters
19612    ///
19613    /// * *$.xgafv* (query-string) - V1 error format.
19614    /// * *access_token* (query-string) - OAuth access token.
19615    /// * *alt* (query-string) - Data format for response.
19616    /// * *callback* (query-string) - JSONP
19617    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19618    /// * *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.
19619    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19620    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19621    /// * *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.
19622    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19623    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19624    pub fn param<T>(mut self, name: T, value: T) -> TagValueTagHoldDeleteCall<'a, C>
19625    where
19626        T: AsRef<str>,
19627    {
19628        self._additional_params
19629            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19630        self
19631    }
19632
19633    /// Identifies the authorization scope for the method you are building.
19634    ///
19635    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19636    /// [`Scope::CloudPlatform`].
19637    ///
19638    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19639    /// tokens for more than one scope.
19640    ///
19641    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19642    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19643    /// sufficient, a read-write scope will do as well.
19644    pub fn add_scope<St>(mut self, scope: St) -> TagValueTagHoldDeleteCall<'a, C>
19645    where
19646        St: AsRef<str>,
19647    {
19648        self._scopes.insert(String::from(scope.as_ref()));
19649        self
19650    }
19651    /// Identifies the authorization scope(s) for the method you are building.
19652    ///
19653    /// See [`Self::add_scope()`] for details.
19654    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueTagHoldDeleteCall<'a, C>
19655    where
19656        I: IntoIterator<Item = St>,
19657        St: AsRef<str>,
19658    {
19659        self._scopes
19660            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19661        self
19662    }
19663
19664    /// Removes all scopes, and no default scope will be used either.
19665    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19666    /// for details).
19667    pub fn clear_scopes(mut self) -> TagValueTagHoldDeleteCall<'a, C> {
19668        self._scopes.clear();
19669        self
19670    }
19671}
19672
19673/// Lists TagHolds under a TagValue.
19674///
19675/// A builder for the *tagHolds.list* method supported by a *tagValue* resource.
19676/// It is not used directly, but through a [`TagValueMethods`] instance.
19677///
19678/// # Example
19679///
19680/// Instantiate a resource method builder
19681///
19682/// ```test_harness,no_run
19683/// # extern crate hyper;
19684/// # extern crate hyper_rustls;
19685/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
19686/// # async fn dox() {
19687/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19688///
19689/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19690/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19691/// #     .with_native_roots()
19692/// #     .unwrap()
19693/// #     .https_only()
19694/// #     .enable_http2()
19695/// #     .build();
19696///
19697/// # let executor = hyper_util::rt::TokioExecutor::new();
19698/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19699/// #     secret,
19700/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19701/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
19702/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
19703/// #     ),
19704/// # ).build().await.unwrap();
19705///
19706/// # let client = hyper_util::client::legacy::Client::builder(
19707/// #     hyper_util::rt::TokioExecutor::new()
19708/// # )
19709/// # .build(
19710/// #     hyper_rustls::HttpsConnectorBuilder::new()
19711/// #         .with_native_roots()
19712/// #         .unwrap()
19713/// #         .https_or_http()
19714/// #         .enable_http2()
19715/// #         .build()
19716/// # );
19717/// # let mut hub = CloudResourceManager::new(client, auth);
19718/// // You can configure optional parameters by calling the respective setters at will, and
19719/// // execute the final call using `doit()`.
19720/// // Values shown here are possibly random and not representative !
19721/// let result = hub.tag_values().tag_holds_list("parent")
19722///              .page_token("dolore")
19723///              .page_size(-34)
19724///              .filter("voluptua.")
19725///              .doit().await;
19726/// # }
19727/// ```
19728pub struct TagValueTagHoldListCall<'a, C>
19729where
19730    C: 'a,
19731{
19732    hub: &'a CloudResourceManager<C>,
19733    _parent: String,
19734    _page_token: Option<String>,
19735    _page_size: Option<i32>,
19736    _filter: Option<String>,
19737    _delegate: Option<&'a mut dyn common::Delegate>,
19738    _additional_params: HashMap<String, String>,
19739    _scopes: BTreeSet<String>,
19740}
19741
19742impl<'a, C> common::CallBuilder for TagValueTagHoldListCall<'a, C> {}
19743
19744impl<'a, C> TagValueTagHoldListCall<'a, C>
19745where
19746    C: common::Connector,
19747{
19748    /// Perform the operation you have build so far.
19749    pub async fn doit(mut self) -> common::Result<(common::Response, ListTagHoldsResponse)> {
19750        use std::borrow::Cow;
19751        use std::io::{Read, Seek};
19752
19753        use common::{url::Params, ToParts};
19754        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19755
19756        let mut dd = common::DefaultDelegate;
19757        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19758        dlg.begin(common::MethodInfo {
19759            id: "cloudresourcemanager.tagValues.tagHolds.list",
19760            http_method: hyper::Method::GET,
19761        });
19762
19763        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
19764            if self._additional_params.contains_key(field) {
19765                dlg.finished(false);
19766                return Err(common::Error::FieldClash(field));
19767            }
19768        }
19769
19770        let mut params = Params::with_capacity(6 + self._additional_params.len());
19771        params.push("parent", self._parent);
19772        if let Some(value) = self._page_token.as_ref() {
19773            params.push("pageToken", value);
19774        }
19775        if let Some(value) = self._page_size.as_ref() {
19776            params.push("pageSize", value.to_string());
19777        }
19778        if let Some(value) = self._filter.as_ref() {
19779            params.push("filter", value);
19780        }
19781
19782        params.extend(self._additional_params.iter());
19783
19784        params.push("alt", "json");
19785        let mut url = self.hub._base_url.clone() + "v3/{+parent}/tagHolds";
19786        if self._scopes.is_empty() {
19787            self._scopes
19788                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
19789        }
19790
19791        #[allow(clippy::single_element_loop)]
19792        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19793            url = params.uri_replacement(url, param_name, find_this, true);
19794        }
19795        {
19796            let to_remove = ["parent"];
19797            params.remove_params(&to_remove);
19798        }
19799
19800        let url = params.parse_with_url(&url);
19801
19802        loop {
19803            let token = match self
19804                .hub
19805                .auth
19806                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19807                .await
19808            {
19809                Ok(token) => token,
19810                Err(e) => match dlg.token(e) {
19811                    Ok(token) => token,
19812                    Err(e) => {
19813                        dlg.finished(false);
19814                        return Err(common::Error::MissingToken(e));
19815                    }
19816                },
19817            };
19818            let mut req_result = {
19819                let client = &self.hub.client;
19820                dlg.pre_request();
19821                let mut req_builder = hyper::Request::builder()
19822                    .method(hyper::Method::GET)
19823                    .uri(url.as_str())
19824                    .header(USER_AGENT, self.hub._user_agent.clone());
19825
19826                if let Some(token) = token.as_ref() {
19827                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19828                }
19829
19830                let request = req_builder
19831                    .header(CONTENT_LENGTH, 0_u64)
19832                    .body(common::to_body::<String>(None));
19833
19834                client.request(request.unwrap()).await
19835            };
19836
19837            match req_result {
19838                Err(err) => {
19839                    if let common::Retry::After(d) = dlg.http_error(&err) {
19840                        sleep(d).await;
19841                        continue;
19842                    }
19843                    dlg.finished(false);
19844                    return Err(common::Error::HttpError(err));
19845                }
19846                Ok(res) => {
19847                    let (mut parts, body) = res.into_parts();
19848                    let mut body = common::Body::new(body);
19849                    if !parts.status.is_success() {
19850                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19851                        let error = serde_json::from_str(&common::to_string(&bytes));
19852                        let response = common::to_response(parts, bytes.into());
19853
19854                        if let common::Retry::After(d) =
19855                            dlg.http_failure(&response, error.as_ref().ok())
19856                        {
19857                            sleep(d).await;
19858                            continue;
19859                        }
19860
19861                        dlg.finished(false);
19862
19863                        return Err(match error {
19864                            Ok(value) => common::Error::BadRequest(value),
19865                            _ => common::Error::Failure(response),
19866                        });
19867                    }
19868                    let response = {
19869                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19870                        let encoded = common::to_string(&bytes);
19871                        match serde_json::from_str(&encoded) {
19872                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19873                            Err(error) => {
19874                                dlg.response_json_decode_error(&encoded, &error);
19875                                return Err(common::Error::JsonDecodeError(
19876                                    encoded.to_string(),
19877                                    error,
19878                                ));
19879                            }
19880                        }
19881                    };
19882
19883                    dlg.finished(true);
19884                    return Ok(response);
19885                }
19886            }
19887        }
19888    }
19889
19890    /// Required. The resource name of the parent TagValue. Must be of the form: `tagValues/{tag-value-id}`.
19891    ///
19892    /// Sets the *parent* path property to the given value.
19893    ///
19894    /// Even though the property as already been set when instantiating this call,
19895    /// we provide this method for API completeness.
19896    pub fn parent(mut self, new_value: &str) -> TagValueTagHoldListCall<'a, C> {
19897        self._parent = new_value.to_string();
19898        self
19899    }
19900    /// Optional. A pagination token returned from a previous call to `ListTagHolds` that indicates where this listing should continue from.
19901    ///
19902    /// Sets the *page token* query property to the given value.
19903    pub fn page_token(mut self, new_value: &str) -> TagValueTagHoldListCall<'a, C> {
19904        self._page_token = Some(new_value.to_string());
19905        self
19906    }
19907    /// Optional. The maximum number of TagHolds to return in the response. The server allows a maximum of 300 TagHolds to return. If unspecified, the server will use 100 as the default.
19908    ///
19909    /// Sets the *page size* query property to the given value.
19910    pub fn page_size(mut self, new_value: i32) -> TagValueTagHoldListCall<'a, C> {
19911        self._page_size = Some(new_value);
19912        self
19913    }
19914    /// Optional. Criteria used to select a subset of TagHolds parented by the TagValue to return. This field follows the syntax defined by aip.dev/160; the `holder` and `origin` fields are supported for filtering. Currently only `AND` syntax is supported. Some example queries are: * `holder = //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group` * `origin = 35678234` * `holder = //compute.googleapis.com/compute/projects/myproject/regions/us-east-1/instanceGroupManagers/instance-group AND origin = 35678234`
19915    ///
19916    /// Sets the *filter* query property to the given value.
19917    pub fn filter(mut self, new_value: &str) -> TagValueTagHoldListCall<'a, C> {
19918        self._filter = Some(new_value.to_string());
19919        self
19920    }
19921    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19922    /// while executing the actual API request.
19923    ///
19924    /// ````text
19925    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19926    /// ````
19927    ///
19928    /// Sets the *delegate* property to the given value.
19929    pub fn delegate(
19930        mut self,
19931        new_value: &'a mut dyn common::Delegate,
19932    ) -> TagValueTagHoldListCall<'a, C> {
19933        self._delegate = Some(new_value);
19934        self
19935    }
19936
19937    /// Set any additional parameter of the query string used in the request.
19938    /// It should be used to set parameters which are not yet available through their own
19939    /// setters.
19940    ///
19941    /// Please note that this method must not be used to set any of the known parameters
19942    /// which have their own setter method. If done anyway, the request will fail.
19943    ///
19944    /// # Additional Parameters
19945    ///
19946    /// * *$.xgafv* (query-string) - V1 error format.
19947    /// * *access_token* (query-string) - OAuth access token.
19948    /// * *alt* (query-string) - Data format for response.
19949    /// * *callback* (query-string) - JSONP
19950    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19951    /// * *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.
19952    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19953    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19954    /// * *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.
19955    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19956    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19957    pub fn param<T>(mut self, name: T, value: T) -> TagValueTagHoldListCall<'a, C>
19958    where
19959        T: AsRef<str>,
19960    {
19961        self._additional_params
19962            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19963        self
19964    }
19965
19966    /// Identifies the authorization scope for the method you are building.
19967    ///
19968    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19969    /// [`Scope::CloudPlatformReadOnly`].
19970    ///
19971    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19972    /// tokens for more than one scope.
19973    ///
19974    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19975    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19976    /// sufficient, a read-write scope will do as well.
19977    pub fn add_scope<St>(mut self, scope: St) -> TagValueTagHoldListCall<'a, C>
19978    where
19979        St: AsRef<str>,
19980    {
19981        self._scopes.insert(String::from(scope.as_ref()));
19982        self
19983    }
19984    /// Identifies the authorization scope(s) for the method you are building.
19985    ///
19986    /// See [`Self::add_scope()`] for details.
19987    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueTagHoldListCall<'a, C>
19988    where
19989        I: IntoIterator<Item = St>,
19990        St: AsRef<str>,
19991    {
19992        self._scopes
19993            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19994        self
19995    }
19996
19997    /// Removes all scopes, and no default scope will be used either.
19998    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19999    /// for details).
20000    pub fn clear_scopes(mut self) -> TagValueTagHoldListCall<'a, C> {
20001        self._scopes.clear();
20002        self
20003    }
20004}
20005
20006/// Creates a TagValue as a child of the specified TagKey. If a another request with the same parameters is sent while the original request is in process the second request will receive an error. A maximum of 1000 TagValues can exist under a TagKey at any given time.
20007///
20008/// A builder for the *create* method supported by a *tagValue* resource.
20009/// It is not used directly, but through a [`TagValueMethods`] instance.
20010///
20011/// # Example
20012///
20013/// Instantiate a resource method builder
20014///
20015/// ```test_harness,no_run
20016/// # extern crate hyper;
20017/// # extern crate hyper_rustls;
20018/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
20019/// use cloudresourcemanager3::api::TagValue;
20020/// # async fn dox() {
20021/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20022///
20023/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20024/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20025/// #     .with_native_roots()
20026/// #     .unwrap()
20027/// #     .https_only()
20028/// #     .enable_http2()
20029/// #     .build();
20030///
20031/// # let executor = hyper_util::rt::TokioExecutor::new();
20032/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20033/// #     secret,
20034/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20035/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20036/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20037/// #     ),
20038/// # ).build().await.unwrap();
20039///
20040/// # let client = hyper_util::client::legacy::Client::builder(
20041/// #     hyper_util::rt::TokioExecutor::new()
20042/// # )
20043/// # .build(
20044/// #     hyper_rustls::HttpsConnectorBuilder::new()
20045/// #         .with_native_roots()
20046/// #         .unwrap()
20047/// #         .https_or_http()
20048/// #         .enable_http2()
20049/// #         .build()
20050/// # );
20051/// # let mut hub = CloudResourceManager::new(client, auth);
20052/// // As the method needs a request, you would usually fill it with the desired information
20053/// // into the respective structure. Some of the parts shown here might not be applicable !
20054/// // Values shown here are possibly random and not representative !
20055/// let mut req = TagValue::default();
20056///
20057/// // You can configure optional parameters by calling the respective setters at will, and
20058/// // execute the final call using `doit()`.
20059/// // Values shown here are possibly random and not representative !
20060/// let result = hub.tag_values().create(req)
20061///              .validate_only(false)
20062///              .doit().await;
20063/// # }
20064/// ```
20065pub struct TagValueCreateCall<'a, C>
20066where
20067    C: 'a,
20068{
20069    hub: &'a CloudResourceManager<C>,
20070    _request: TagValue,
20071    _validate_only: Option<bool>,
20072    _delegate: Option<&'a mut dyn common::Delegate>,
20073    _additional_params: HashMap<String, String>,
20074    _scopes: BTreeSet<String>,
20075}
20076
20077impl<'a, C> common::CallBuilder for TagValueCreateCall<'a, C> {}
20078
20079impl<'a, C> TagValueCreateCall<'a, C>
20080where
20081    C: common::Connector,
20082{
20083    /// Perform the operation you have build so far.
20084    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20085        use std::borrow::Cow;
20086        use std::io::{Read, Seek};
20087
20088        use common::{url::Params, ToParts};
20089        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20090
20091        let mut dd = common::DefaultDelegate;
20092        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20093        dlg.begin(common::MethodInfo {
20094            id: "cloudresourcemanager.tagValues.create",
20095            http_method: hyper::Method::POST,
20096        });
20097
20098        for &field in ["alt", "validateOnly"].iter() {
20099            if self._additional_params.contains_key(field) {
20100                dlg.finished(false);
20101                return Err(common::Error::FieldClash(field));
20102            }
20103        }
20104
20105        let mut params = Params::with_capacity(4 + self._additional_params.len());
20106        if let Some(value) = self._validate_only.as_ref() {
20107            params.push("validateOnly", value.to_string());
20108        }
20109
20110        params.extend(self._additional_params.iter());
20111
20112        params.push("alt", "json");
20113        let mut url = self.hub._base_url.clone() + "v3/tagValues";
20114        if self._scopes.is_empty() {
20115            self._scopes
20116                .insert(Scope::CloudPlatform.as_ref().to_string());
20117        }
20118
20119        let url = params.parse_with_url(&url);
20120
20121        let mut json_mime_type = mime::APPLICATION_JSON;
20122        let mut request_value_reader = {
20123            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20124            common::remove_json_null_values(&mut value);
20125            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20126            serde_json::to_writer(&mut dst, &value).unwrap();
20127            dst
20128        };
20129        let request_size = request_value_reader
20130            .seek(std::io::SeekFrom::End(0))
20131            .unwrap();
20132        request_value_reader
20133            .seek(std::io::SeekFrom::Start(0))
20134            .unwrap();
20135
20136        loop {
20137            let token = match self
20138                .hub
20139                .auth
20140                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20141                .await
20142            {
20143                Ok(token) => token,
20144                Err(e) => match dlg.token(e) {
20145                    Ok(token) => token,
20146                    Err(e) => {
20147                        dlg.finished(false);
20148                        return Err(common::Error::MissingToken(e));
20149                    }
20150                },
20151            };
20152            request_value_reader
20153                .seek(std::io::SeekFrom::Start(0))
20154                .unwrap();
20155            let mut req_result = {
20156                let client = &self.hub.client;
20157                dlg.pre_request();
20158                let mut req_builder = hyper::Request::builder()
20159                    .method(hyper::Method::POST)
20160                    .uri(url.as_str())
20161                    .header(USER_AGENT, self.hub._user_agent.clone());
20162
20163                if let Some(token) = token.as_ref() {
20164                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20165                }
20166
20167                let request = req_builder
20168                    .header(CONTENT_TYPE, json_mime_type.to_string())
20169                    .header(CONTENT_LENGTH, request_size as u64)
20170                    .body(common::to_body(
20171                        request_value_reader.get_ref().clone().into(),
20172                    ));
20173
20174                client.request(request.unwrap()).await
20175            };
20176
20177            match req_result {
20178                Err(err) => {
20179                    if let common::Retry::After(d) = dlg.http_error(&err) {
20180                        sleep(d).await;
20181                        continue;
20182                    }
20183                    dlg.finished(false);
20184                    return Err(common::Error::HttpError(err));
20185                }
20186                Ok(res) => {
20187                    let (mut parts, body) = res.into_parts();
20188                    let mut body = common::Body::new(body);
20189                    if !parts.status.is_success() {
20190                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20191                        let error = serde_json::from_str(&common::to_string(&bytes));
20192                        let response = common::to_response(parts, bytes.into());
20193
20194                        if let common::Retry::After(d) =
20195                            dlg.http_failure(&response, error.as_ref().ok())
20196                        {
20197                            sleep(d).await;
20198                            continue;
20199                        }
20200
20201                        dlg.finished(false);
20202
20203                        return Err(match error {
20204                            Ok(value) => common::Error::BadRequest(value),
20205                            _ => common::Error::Failure(response),
20206                        });
20207                    }
20208                    let response = {
20209                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20210                        let encoded = common::to_string(&bytes);
20211                        match serde_json::from_str(&encoded) {
20212                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20213                            Err(error) => {
20214                                dlg.response_json_decode_error(&encoded, &error);
20215                                return Err(common::Error::JsonDecodeError(
20216                                    encoded.to_string(),
20217                                    error,
20218                                ));
20219                            }
20220                        }
20221                    };
20222
20223                    dlg.finished(true);
20224                    return Ok(response);
20225                }
20226            }
20227        }
20228    }
20229
20230    ///
20231    /// Sets the *request* property to the given value.
20232    ///
20233    /// Even though the property as already been set when instantiating this call,
20234    /// we provide this method for API completeness.
20235    pub fn request(mut self, new_value: TagValue) -> TagValueCreateCall<'a, C> {
20236        self._request = new_value;
20237        self
20238    }
20239    /// Optional. Set as true to perform the validations necessary for creating the resource, but not actually perform the action.
20240    ///
20241    /// Sets the *validate only* query property to the given value.
20242    pub fn validate_only(mut self, new_value: bool) -> TagValueCreateCall<'a, C> {
20243        self._validate_only = Some(new_value);
20244        self
20245    }
20246    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20247    /// while executing the actual API request.
20248    ///
20249    /// ````text
20250    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20251    /// ````
20252    ///
20253    /// Sets the *delegate* property to the given value.
20254    pub fn delegate(
20255        mut self,
20256        new_value: &'a mut dyn common::Delegate,
20257    ) -> TagValueCreateCall<'a, C> {
20258        self._delegate = Some(new_value);
20259        self
20260    }
20261
20262    /// Set any additional parameter of the query string used in the request.
20263    /// It should be used to set parameters which are not yet available through their own
20264    /// setters.
20265    ///
20266    /// Please note that this method must not be used to set any of the known parameters
20267    /// which have their own setter method. If done anyway, the request will fail.
20268    ///
20269    /// # Additional Parameters
20270    ///
20271    /// * *$.xgafv* (query-string) - V1 error format.
20272    /// * *access_token* (query-string) - OAuth access token.
20273    /// * *alt* (query-string) - Data format for response.
20274    /// * *callback* (query-string) - JSONP
20275    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20276    /// * *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.
20277    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20278    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20279    /// * *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.
20280    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20281    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20282    pub fn param<T>(mut self, name: T, value: T) -> TagValueCreateCall<'a, C>
20283    where
20284        T: AsRef<str>,
20285    {
20286        self._additional_params
20287            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20288        self
20289    }
20290
20291    /// Identifies the authorization scope for the method you are building.
20292    ///
20293    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20294    /// [`Scope::CloudPlatform`].
20295    ///
20296    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20297    /// tokens for more than one scope.
20298    ///
20299    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20300    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20301    /// sufficient, a read-write scope will do as well.
20302    pub fn add_scope<St>(mut self, scope: St) -> TagValueCreateCall<'a, C>
20303    where
20304        St: AsRef<str>,
20305    {
20306        self._scopes.insert(String::from(scope.as_ref()));
20307        self
20308    }
20309    /// Identifies the authorization scope(s) for the method you are building.
20310    ///
20311    /// See [`Self::add_scope()`] for details.
20312    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueCreateCall<'a, C>
20313    where
20314        I: IntoIterator<Item = St>,
20315        St: AsRef<str>,
20316    {
20317        self._scopes
20318            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20319        self
20320    }
20321
20322    /// Removes all scopes, and no default scope will be used either.
20323    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20324    /// for details).
20325    pub fn clear_scopes(mut self) -> TagValueCreateCall<'a, C> {
20326        self._scopes.clear();
20327        self
20328    }
20329}
20330
20331/// Deletes a TagValue. The TagValue cannot have any bindings when it is deleted.
20332///
20333/// A builder for the *delete* method supported by a *tagValue* resource.
20334/// It is not used directly, but through a [`TagValueMethods`] instance.
20335///
20336/// # Example
20337///
20338/// Instantiate a resource method builder
20339///
20340/// ```test_harness,no_run
20341/// # extern crate hyper;
20342/// # extern crate hyper_rustls;
20343/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
20344/// # async fn dox() {
20345/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20346///
20347/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20348/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20349/// #     .with_native_roots()
20350/// #     .unwrap()
20351/// #     .https_only()
20352/// #     .enable_http2()
20353/// #     .build();
20354///
20355/// # let executor = hyper_util::rt::TokioExecutor::new();
20356/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20357/// #     secret,
20358/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20359/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20360/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20361/// #     ),
20362/// # ).build().await.unwrap();
20363///
20364/// # let client = hyper_util::client::legacy::Client::builder(
20365/// #     hyper_util::rt::TokioExecutor::new()
20366/// # )
20367/// # .build(
20368/// #     hyper_rustls::HttpsConnectorBuilder::new()
20369/// #         .with_native_roots()
20370/// #         .unwrap()
20371/// #         .https_or_http()
20372/// #         .enable_http2()
20373/// #         .build()
20374/// # );
20375/// # let mut hub = CloudResourceManager::new(client, auth);
20376/// // You can configure optional parameters by calling the respective setters at will, and
20377/// // execute the final call using `doit()`.
20378/// // Values shown here are possibly random and not representative !
20379/// let result = hub.tag_values().delete("name")
20380///              .validate_only(true)
20381///              .etag("no")
20382///              .doit().await;
20383/// # }
20384/// ```
20385pub struct TagValueDeleteCall<'a, C>
20386where
20387    C: 'a,
20388{
20389    hub: &'a CloudResourceManager<C>,
20390    _name: String,
20391    _validate_only: Option<bool>,
20392    _etag: Option<String>,
20393    _delegate: Option<&'a mut dyn common::Delegate>,
20394    _additional_params: HashMap<String, String>,
20395    _scopes: BTreeSet<String>,
20396}
20397
20398impl<'a, C> common::CallBuilder for TagValueDeleteCall<'a, C> {}
20399
20400impl<'a, C> TagValueDeleteCall<'a, C>
20401where
20402    C: common::Connector,
20403{
20404    /// Perform the operation you have build so far.
20405    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20406        use std::borrow::Cow;
20407        use std::io::{Read, Seek};
20408
20409        use common::{url::Params, ToParts};
20410        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20411
20412        let mut dd = common::DefaultDelegate;
20413        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20414        dlg.begin(common::MethodInfo {
20415            id: "cloudresourcemanager.tagValues.delete",
20416            http_method: hyper::Method::DELETE,
20417        });
20418
20419        for &field in ["alt", "name", "validateOnly", "etag"].iter() {
20420            if self._additional_params.contains_key(field) {
20421                dlg.finished(false);
20422                return Err(common::Error::FieldClash(field));
20423            }
20424        }
20425
20426        let mut params = Params::with_capacity(5 + self._additional_params.len());
20427        params.push("name", self._name);
20428        if let Some(value) = self._validate_only.as_ref() {
20429            params.push("validateOnly", value.to_string());
20430        }
20431        if let Some(value) = self._etag.as_ref() {
20432            params.push("etag", value);
20433        }
20434
20435        params.extend(self._additional_params.iter());
20436
20437        params.push("alt", "json");
20438        let mut url = self.hub._base_url.clone() + "v3/{+name}";
20439        if self._scopes.is_empty() {
20440            self._scopes
20441                .insert(Scope::CloudPlatform.as_ref().to_string());
20442        }
20443
20444        #[allow(clippy::single_element_loop)]
20445        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20446            url = params.uri_replacement(url, param_name, find_this, true);
20447        }
20448        {
20449            let to_remove = ["name"];
20450            params.remove_params(&to_remove);
20451        }
20452
20453        let url = params.parse_with_url(&url);
20454
20455        loop {
20456            let token = match self
20457                .hub
20458                .auth
20459                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20460                .await
20461            {
20462                Ok(token) => token,
20463                Err(e) => match dlg.token(e) {
20464                    Ok(token) => token,
20465                    Err(e) => {
20466                        dlg.finished(false);
20467                        return Err(common::Error::MissingToken(e));
20468                    }
20469                },
20470            };
20471            let mut req_result = {
20472                let client = &self.hub.client;
20473                dlg.pre_request();
20474                let mut req_builder = hyper::Request::builder()
20475                    .method(hyper::Method::DELETE)
20476                    .uri(url.as_str())
20477                    .header(USER_AGENT, self.hub._user_agent.clone());
20478
20479                if let Some(token) = token.as_ref() {
20480                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20481                }
20482
20483                let request = req_builder
20484                    .header(CONTENT_LENGTH, 0_u64)
20485                    .body(common::to_body::<String>(None));
20486
20487                client.request(request.unwrap()).await
20488            };
20489
20490            match req_result {
20491                Err(err) => {
20492                    if let common::Retry::After(d) = dlg.http_error(&err) {
20493                        sleep(d).await;
20494                        continue;
20495                    }
20496                    dlg.finished(false);
20497                    return Err(common::Error::HttpError(err));
20498                }
20499                Ok(res) => {
20500                    let (mut parts, body) = res.into_parts();
20501                    let mut body = common::Body::new(body);
20502                    if !parts.status.is_success() {
20503                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20504                        let error = serde_json::from_str(&common::to_string(&bytes));
20505                        let response = common::to_response(parts, bytes.into());
20506
20507                        if let common::Retry::After(d) =
20508                            dlg.http_failure(&response, error.as_ref().ok())
20509                        {
20510                            sleep(d).await;
20511                            continue;
20512                        }
20513
20514                        dlg.finished(false);
20515
20516                        return Err(match error {
20517                            Ok(value) => common::Error::BadRequest(value),
20518                            _ => common::Error::Failure(response),
20519                        });
20520                    }
20521                    let response = {
20522                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20523                        let encoded = common::to_string(&bytes);
20524                        match serde_json::from_str(&encoded) {
20525                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20526                            Err(error) => {
20527                                dlg.response_json_decode_error(&encoded, &error);
20528                                return Err(common::Error::JsonDecodeError(
20529                                    encoded.to_string(),
20530                                    error,
20531                                ));
20532                            }
20533                        }
20534                    };
20535
20536                    dlg.finished(true);
20537                    return Ok(response);
20538                }
20539            }
20540        }
20541    }
20542
20543    /// Required. Resource name for TagValue to be deleted in the format tagValues/456.
20544    ///
20545    /// Sets the *name* path property to the given value.
20546    ///
20547    /// Even though the property as already been set when instantiating this call,
20548    /// we provide this method for API completeness.
20549    pub fn name(mut self, new_value: &str) -> TagValueDeleteCall<'a, C> {
20550        self._name = new_value.to_string();
20551        self
20552    }
20553    /// Optional. Set as true to perform the validations necessary for deletion, but not actually perform the action.
20554    ///
20555    /// Sets the *validate only* query property to the given value.
20556    pub fn validate_only(mut self, new_value: bool) -> TagValueDeleteCall<'a, C> {
20557        self._validate_only = Some(new_value);
20558        self
20559    }
20560    /// Optional. The etag known to the client for the expected state of the TagValue. This is to be used for optimistic concurrency.
20561    ///
20562    /// Sets the *etag* query property to the given value.
20563    pub fn etag(mut self, new_value: &str) -> TagValueDeleteCall<'a, C> {
20564        self._etag = Some(new_value.to_string());
20565        self
20566    }
20567    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20568    /// while executing the actual API request.
20569    ///
20570    /// ````text
20571    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20572    /// ````
20573    ///
20574    /// Sets the *delegate* property to the given value.
20575    pub fn delegate(
20576        mut self,
20577        new_value: &'a mut dyn common::Delegate,
20578    ) -> TagValueDeleteCall<'a, C> {
20579        self._delegate = Some(new_value);
20580        self
20581    }
20582
20583    /// Set any additional parameter of the query string used in the request.
20584    /// It should be used to set parameters which are not yet available through their own
20585    /// setters.
20586    ///
20587    /// Please note that this method must not be used to set any of the known parameters
20588    /// which have their own setter method. If done anyway, the request will fail.
20589    ///
20590    /// # Additional Parameters
20591    ///
20592    /// * *$.xgafv* (query-string) - V1 error format.
20593    /// * *access_token* (query-string) - OAuth access token.
20594    /// * *alt* (query-string) - Data format for response.
20595    /// * *callback* (query-string) - JSONP
20596    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20597    /// * *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.
20598    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20599    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20600    /// * *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.
20601    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20602    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20603    pub fn param<T>(mut self, name: T, value: T) -> TagValueDeleteCall<'a, C>
20604    where
20605        T: AsRef<str>,
20606    {
20607        self._additional_params
20608            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20609        self
20610    }
20611
20612    /// Identifies the authorization scope for the method you are building.
20613    ///
20614    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20615    /// [`Scope::CloudPlatform`].
20616    ///
20617    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20618    /// tokens for more than one scope.
20619    ///
20620    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20621    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20622    /// sufficient, a read-write scope will do as well.
20623    pub fn add_scope<St>(mut self, scope: St) -> TagValueDeleteCall<'a, C>
20624    where
20625        St: AsRef<str>,
20626    {
20627        self._scopes.insert(String::from(scope.as_ref()));
20628        self
20629    }
20630    /// Identifies the authorization scope(s) for the method you are building.
20631    ///
20632    /// See [`Self::add_scope()`] for details.
20633    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueDeleteCall<'a, C>
20634    where
20635        I: IntoIterator<Item = St>,
20636        St: AsRef<str>,
20637    {
20638        self._scopes
20639            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20640        self
20641    }
20642
20643    /// Removes all scopes, and no default scope will be used either.
20644    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20645    /// for details).
20646    pub fn clear_scopes(mut self) -> TagValueDeleteCall<'a, C> {
20647        self._scopes.clear();
20648        self
20649    }
20650}
20651
20652/// Retrieves a TagValue. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it.
20653///
20654/// A builder for the *get* method supported by a *tagValue* resource.
20655/// It is not used directly, but through a [`TagValueMethods`] instance.
20656///
20657/// # Example
20658///
20659/// Instantiate a resource method builder
20660///
20661/// ```test_harness,no_run
20662/// # extern crate hyper;
20663/// # extern crate hyper_rustls;
20664/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
20665/// # async fn dox() {
20666/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20667///
20668/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20669/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20670/// #     .with_native_roots()
20671/// #     .unwrap()
20672/// #     .https_only()
20673/// #     .enable_http2()
20674/// #     .build();
20675///
20676/// # let executor = hyper_util::rt::TokioExecutor::new();
20677/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20678/// #     secret,
20679/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20680/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20681/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20682/// #     ),
20683/// # ).build().await.unwrap();
20684///
20685/// # let client = hyper_util::client::legacy::Client::builder(
20686/// #     hyper_util::rt::TokioExecutor::new()
20687/// # )
20688/// # .build(
20689/// #     hyper_rustls::HttpsConnectorBuilder::new()
20690/// #         .with_native_roots()
20691/// #         .unwrap()
20692/// #         .https_or_http()
20693/// #         .enable_http2()
20694/// #         .build()
20695/// # );
20696/// # let mut hub = CloudResourceManager::new(client, auth);
20697/// // You can configure optional parameters by calling the respective setters at will, and
20698/// // execute the final call using `doit()`.
20699/// // Values shown here are possibly random and not representative !
20700/// let result = hub.tag_values().get("name")
20701///              .doit().await;
20702/// # }
20703/// ```
20704pub struct TagValueGetCall<'a, C>
20705where
20706    C: 'a,
20707{
20708    hub: &'a CloudResourceManager<C>,
20709    _name: String,
20710    _delegate: Option<&'a mut dyn common::Delegate>,
20711    _additional_params: HashMap<String, String>,
20712    _scopes: BTreeSet<String>,
20713}
20714
20715impl<'a, C> common::CallBuilder for TagValueGetCall<'a, C> {}
20716
20717impl<'a, C> TagValueGetCall<'a, C>
20718where
20719    C: common::Connector,
20720{
20721    /// Perform the operation you have build so far.
20722    pub async fn doit(mut self) -> common::Result<(common::Response, TagValue)> {
20723        use std::borrow::Cow;
20724        use std::io::{Read, Seek};
20725
20726        use common::{url::Params, ToParts};
20727        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20728
20729        let mut dd = common::DefaultDelegate;
20730        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20731        dlg.begin(common::MethodInfo {
20732            id: "cloudresourcemanager.tagValues.get",
20733            http_method: hyper::Method::GET,
20734        });
20735
20736        for &field in ["alt", "name"].iter() {
20737            if self._additional_params.contains_key(field) {
20738                dlg.finished(false);
20739                return Err(common::Error::FieldClash(field));
20740            }
20741        }
20742
20743        let mut params = Params::with_capacity(3 + self._additional_params.len());
20744        params.push("name", self._name);
20745
20746        params.extend(self._additional_params.iter());
20747
20748        params.push("alt", "json");
20749        let mut url = self.hub._base_url.clone() + "v3/{+name}";
20750        if self._scopes.is_empty() {
20751            self._scopes
20752                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
20753        }
20754
20755        #[allow(clippy::single_element_loop)]
20756        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20757            url = params.uri_replacement(url, param_name, find_this, true);
20758        }
20759        {
20760            let to_remove = ["name"];
20761            params.remove_params(&to_remove);
20762        }
20763
20764        let url = params.parse_with_url(&url);
20765
20766        loop {
20767            let token = match self
20768                .hub
20769                .auth
20770                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20771                .await
20772            {
20773                Ok(token) => token,
20774                Err(e) => match dlg.token(e) {
20775                    Ok(token) => token,
20776                    Err(e) => {
20777                        dlg.finished(false);
20778                        return Err(common::Error::MissingToken(e));
20779                    }
20780                },
20781            };
20782            let mut req_result = {
20783                let client = &self.hub.client;
20784                dlg.pre_request();
20785                let mut req_builder = hyper::Request::builder()
20786                    .method(hyper::Method::GET)
20787                    .uri(url.as_str())
20788                    .header(USER_AGENT, self.hub._user_agent.clone());
20789
20790                if let Some(token) = token.as_ref() {
20791                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20792                }
20793
20794                let request = req_builder
20795                    .header(CONTENT_LENGTH, 0_u64)
20796                    .body(common::to_body::<String>(None));
20797
20798                client.request(request.unwrap()).await
20799            };
20800
20801            match req_result {
20802                Err(err) => {
20803                    if let common::Retry::After(d) = dlg.http_error(&err) {
20804                        sleep(d).await;
20805                        continue;
20806                    }
20807                    dlg.finished(false);
20808                    return Err(common::Error::HttpError(err));
20809                }
20810                Ok(res) => {
20811                    let (mut parts, body) = res.into_parts();
20812                    let mut body = common::Body::new(body);
20813                    if !parts.status.is_success() {
20814                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20815                        let error = serde_json::from_str(&common::to_string(&bytes));
20816                        let response = common::to_response(parts, bytes.into());
20817
20818                        if let common::Retry::After(d) =
20819                            dlg.http_failure(&response, error.as_ref().ok())
20820                        {
20821                            sleep(d).await;
20822                            continue;
20823                        }
20824
20825                        dlg.finished(false);
20826
20827                        return Err(match error {
20828                            Ok(value) => common::Error::BadRequest(value),
20829                            _ => common::Error::Failure(response),
20830                        });
20831                    }
20832                    let response = {
20833                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20834                        let encoded = common::to_string(&bytes);
20835                        match serde_json::from_str(&encoded) {
20836                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20837                            Err(error) => {
20838                                dlg.response_json_decode_error(&encoded, &error);
20839                                return Err(common::Error::JsonDecodeError(
20840                                    encoded.to_string(),
20841                                    error,
20842                                ));
20843                            }
20844                        }
20845                    };
20846
20847                    dlg.finished(true);
20848                    return Ok(response);
20849                }
20850            }
20851        }
20852    }
20853
20854    /// Required. Resource name for TagValue to be fetched in the format `tagValues/456`.
20855    ///
20856    /// Sets the *name* path property to the given value.
20857    ///
20858    /// Even though the property as already been set when instantiating this call,
20859    /// we provide this method for API completeness.
20860    pub fn name(mut self, new_value: &str) -> TagValueGetCall<'a, C> {
20861        self._name = new_value.to_string();
20862        self
20863    }
20864    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20865    /// while executing the actual API request.
20866    ///
20867    /// ````text
20868    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20869    /// ````
20870    ///
20871    /// Sets the *delegate* property to the given value.
20872    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagValueGetCall<'a, C> {
20873        self._delegate = Some(new_value);
20874        self
20875    }
20876
20877    /// Set any additional parameter of the query string used in the request.
20878    /// It should be used to set parameters which are not yet available through their own
20879    /// setters.
20880    ///
20881    /// Please note that this method must not be used to set any of the known parameters
20882    /// which have their own setter method. If done anyway, the request will fail.
20883    ///
20884    /// # Additional Parameters
20885    ///
20886    /// * *$.xgafv* (query-string) - V1 error format.
20887    /// * *access_token* (query-string) - OAuth access token.
20888    /// * *alt* (query-string) - Data format for response.
20889    /// * *callback* (query-string) - JSONP
20890    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20891    /// * *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.
20892    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20893    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20894    /// * *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.
20895    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20896    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20897    pub fn param<T>(mut self, name: T, value: T) -> TagValueGetCall<'a, C>
20898    where
20899        T: AsRef<str>,
20900    {
20901        self._additional_params
20902            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20903        self
20904    }
20905
20906    /// Identifies the authorization scope for the method you are building.
20907    ///
20908    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20909    /// [`Scope::CloudPlatformReadOnly`].
20910    ///
20911    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20912    /// tokens for more than one scope.
20913    ///
20914    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20915    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20916    /// sufficient, a read-write scope will do as well.
20917    pub fn add_scope<St>(mut self, scope: St) -> TagValueGetCall<'a, C>
20918    where
20919        St: AsRef<str>,
20920    {
20921        self._scopes.insert(String::from(scope.as_ref()));
20922        self
20923    }
20924    /// Identifies the authorization scope(s) for the method you are building.
20925    ///
20926    /// See [`Self::add_scope()`] for details.
20927    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueGetCall<'a, C>
20928    where
20929        I: IntoIterator<Item = St>,
20930        St: AsRef<str>,
20931    {
20932        self._scopes
20933            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20934        self
20935    }
20936
20937    /// Removes all scopes, and no default scope will be used either.
20938    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20939    /// for details).
20940    pub fn clear_scopes(mut self) -> TagValueGetCall<'a, C> {
20941        self._scopes.clear();
20942        self
20943    }
20944}
20945
20946/// Gets the access control policy for a TagValue. The returned policy may be empty if no such policy or resource exists. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. The caller must have the `cloudresourcemanager.googleapis.com/tagValues.getIamPolicy` permission on the identified TagValue to get the access control policy.
20947///
20948/// A builder for the *getIamPolicy* method supported by a *tagValue* resource.
20949/// It is not used directly, but through a [`TagValueMethods`] instance.
20950///
20951/// # Example
20952///
20953/// Instantiate a resource method builder
20954///
20955/// ```test_harness,no_run
20956/// # extern crate hyper;
20957/// # extern crate hyper_rustls;
20958/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
20959/// use cloudresourcemanager3::api::GetIamPolicyRequest;
20960/// # async fn dox() {
20961/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20962///
20963/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20964/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20965/// #     .with_native_roots()
20966/// #     .unwrap()
20967/// #     .https_only()
20968/// #     .enable_http2()
20969/// #     .build();
20970///
20971/// # let executor = hyper_util::rt::TokioExecutor::new();
20972/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20973/// #     secret,
20974/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20975/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
20976/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
20977/// #     ),
20978/// # ).build().await.unwrap();
20979///
20980/// # let client = hyper_util::client::legacy::Client::builder(
20981/// #     hyper_util::rt::TokioExecutor::new()
20982/// # )
20983/// # .build(
20984/// #     hyper_rustls::HttpsConnectorBuilder::new()
20985/// #         .with_native_roots()
20986/// #         .unwrap()
20987/// #         .https_or_http()
20988/// #         .enable_http2()
20989/// #         .build()
20990/// # );
20991/// # let mut hub = CloudResourceManager::new(client, auth);
20992/// // As the method needs a request, you would usually fill it with the desired information
20993/// // into the respective structure. Some of the parts shown here might not be applicable !
20994/// // Values shown here are possibly random and not representative !
20995/// let mut req = GetIamPolicyRequest::default();
20996///
20997/// // You can configure optional parameters by calling the respective setters at will, and
20998/// // execute the final call using `doit()`.
20999/// // Values shown here are possibly random and not representative !
21000/// let result = hub.tag_values().get_iam_policy(req, "resource")
21001///              .doit().await;
21002/// # }
21003/// ```
21004pub struct TagValueGetIamPolicyCall<'a, C>
21005where
21006    C: 'a,
21007{
21008    hub: &'a CloudResourceManager<C>,
21009    _request: GetIamPolicyRequest,
21010    _resource: String,
21011    _delegate: Option<&'a mut dyn common::Delegate>,
21012    _additional_params: HashMap<String, String>,
21013    _scopes: BTreeSet<String>,
21014}
21015
21016impl<'a, C> common::CallBuilder for TagValueGetIamPolicyCall<'a, C> {}
21017
21018impl<'a, C> TagValueGetIamPolicyCall<'a, C>
21019where
21020    C: common::Connector,
21021{
21022    /// Perform the operation you have build so far.
21023    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
21024        use std::borrow::Cow;
21025        use std::io::{Read, Seek};
21026
21027        use common::{url::Params, ToParts};
21028        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21029
21030        let mut dd = common::DefaultDelegate;
21031        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21032        dlg.begin(common::MethodInfo {
21033            id: "cloudresourcemanager.tagValues.getIamPolicy",
21034            http_method: hyper::Method::POST,
21035        });
21036
21037        for &field in ["alt", "resource"].iter() {
21038            if self._additional_params.contains_key(field) {
21039                dlg.finished(false);
21040                return Err(common::Error::FieldClash(field));
21041            }
21042        }
21043
21044        let mut params = Params::with_capacity(4 + self._additional_params.len());
21045        params.push("resource", self._resource);
21046
21047        params.extend(self._additional_params.iter());
21048
21049        params.push("alt", "json");
21050        let mut url = self.hub._base_url.clone() + "v3/{+resource}:getIamPolicy";
21051        if self._scopes.is_empty() {
21052            self._scopes
21053                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
21054        }
21055
21056        #[allow(clippy::single_element_loop)]
21057        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
21058            url = params.uri_replacement(url, param_name, find_this, true);
21059        }
21060        {
21061            let to_remove = ["resource"];
21062            params.remove_params(&to_remove);
21063        }
21064
21065        let url = params.parse_with_url(&url);
21066
21067        let mut json_mime_type = mime::APPLICATION_JSON;
21068        let mut request_value_reader = {
21069            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21070            common::remove_json_null_values(&mut value);
21071            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21072            serde_json::to_writer(&mut dst, &value).unwrap();
21073            dst
21074        };
21075        let request_size = request_value_reader
21076            .seek(std::io::SeekFrom::End(0))
21077            .unwrap();
21078        request_value_reader
21079            .seek(std::io::SeekFrom::Start(0))
21080            .unwrap();
21081
21082        loop {
21083            let token = match self
21084                .hub
21085                .auth
21086                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21087                .await
21088            {
21089                Ok(token) => token,
21090                Err(e) => match dlg.token(e) {
21091                    Ok(token) => token,
21092                    Err(e) => {
21093                        dlg.finished(false);
21094                        return Err(common::Error::MissingToken(e));
21095                    }
21096                },
21097            };
21098            request_value_reader
21099                .seek(std::io::SeekFrom::Start(0))
21100                .unwrap();
21101            let mut req_result = {
21102                let client = &self.hub.client;
21103                dlg.pre_request();
21104                let mut req_builder = hyper::Request::builder()
21105                    .method(hyper::Method::POST)
21106                    .uri(url.as_str())
21107                    .header(USER_AGENT, self.hub._user_agent.clone());
21108
21109                if let Some(token) = token.as_ref() {
21110                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21111                }
21112
21113                let request = req_builder
21114                    .header(CONTENT_TYPE, json_mime_type.to_string())
21115                    .header(CONTENT_LENGTH, request_size as u64)
21116                    .body(common::to_body(
21117                        request_value_reader.get_ref().clone().into(),
21118                    ));
21119
21120                client.request(request.unwrap()).await
21121            };
21122
21123            match req_result {
21124                Err(err) => {
21125                    if let common::Retry::After(d) = dlg.http_error(&err) {
21126                        sleep(d).await;
21127                        continue;
21128                    }
21129                    dlg.finished(false);
21130                    return Err(common::Error::HttpError(err));
21131                }
21132                Ok(res) => {
21133                    let (mut parts, body) = res.into_parts();
21134                    let mut body = common::Body::new(body);
21135                    if !parts.status.is_success() {
21136                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21137                        let error = serde_json::from_str(&common::to_string(&bytes));
21138                        let response = common::to_response(parts, bytes.into());
21139
21140                        if let common::Retry::After(d) =
21141                            dlg.http_failure(&response, error.as_ref().ok())
21142                        {
21143                            sleep(d).await;
21144                            continue;
21145                        }
21146
21147                        dlg.finished(false);
21148
21149                        return Err(match error {
21150                            Ok(value) => common::Error::BadRequest(value),
21151                            _ => common::Error::Failure(response),
21152                        });
21153                    }
21154                    let response = {
21155                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21156                        let encoded = common::to_string(&bytes);
21157                        match serde_json::from_str(&encoded) {
21158                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21159                            Err(error) => {
21160                                dlg.response_json_decode_error(&encoded, &error);
21161                                return Err(common::Error::JsonDecodeError(
21162                                    encoded.to_string(),
21163                                    error,
21164                                ));
21165                            }
21166                        }
21167                    };
21168
21169                    dlg.finished(true);
21170                    return Ok(response);
21171                }
21172            }
21173        }
21174    }
21175
21176    ///
21177    /// Sets the *request* property to the given value.
21178    ///
21179    /// Even though the property as already been set when instantiating this call,
21180    /// we provide this method for API completeness.
21181    pub fn request(mut self, new_value: GetIamPolicyRequest) -> TagValueGetIamPolicyCall<'a, C> {
21182        self._request = new_value;
21183        self
21184    }
21185    /// 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.
21186    ///
21187    /// Sets the *resource* path property to the given value.
21188    ///
21189    /// Even though the property as already been set when instantiating this call,
21190    /// we provide this method for API completeness.
21191    pub fn resource(mut self, new_value: &str) -> TagValueGetIamPolicyCall<'a, C> {
21192        self._resource = new_value.to_string();
21193        self
21194    }
21195    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21196    /// while executing the actual API request.
21197    ///
21198    /// ````text
21199    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21200    /// ````
21201    ///
21202    /// Sets the *delegate* property to the given value.
21203    pub fn delegate(
21204        mut self,
21205        new_value: &'a mut dyn common::Delegate,
21206    ) -> TagValueGetIamPolicyCall<'a, C> {
21207        self._delegate = Some(new_value);
21208        self
21209    }
21210
21211    /// Set any additional parameter of the query string used in the request.
21212    /// It should be used to set parameters which are not yet available through their own
21213    /// setters.
21214    ///
21215    /// Please note that this method must not be used to set any of the known parameters
21216    /// which have their own setter method. If done anyway, the request will fail.
21217    ///
21218    /// # Additional Parameters
21219    ///
21220    /// * *$.xgafv* (query-string) - V1 error format.
21221    /// * *access_token* (query-string) - OAuth access token.
21222    /// * *alt* (query-string) - Data format for response.
21223    /// * *callback* (query-string) - JSONP
21224    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21225    /// * *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.
21226    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21227    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21228    /// * *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.
21229    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21230    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21231    pub fn param<T>(mut self, name: T, value: T) -> TagValueGetIamPolicyCall<'a, C>
21232    where
21233        T: AsRef<str>,
21234    {
21235        self._additional_params
21236            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21237        self
21238    }
21239
21240    /// Identifies the authorization scope for the method you are building.
21241    ///
21242    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21243    /// [`Scope::CloudPlatformReadOnly`].
21244    ///
21245    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21246    /// tokens for more than one scope.
21247    ///
21248    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21249    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21250    /// sufficient, a read-write scope will do as well.
21251    pub fn add_scope<St>(mut self, scope: St) -> TagValueGetIamPolicyCall<'a, C>
21252    where
21253        St: AsRef<str>,
21254    {
21255        self._scopes.insert(String::from(scope.as_ref()));
21256        self
21257    }
21258    /// Identifies the authorization scope(s) for the method you are building.
21259    ///
21260    /// See [`Self::add_scope()`] for details.
21261    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueGetIamPolicyCall<'a, C>
21262    where
21263        I: IntoIterator<Item = St>,
21264        St: AsRef<str>,
21265    {
21266        self._scopes
21267            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21268        self
21269    }
21270
21271    /// Removes all scopes, and no default scope will be used either.
21272    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21273    /// for details).
21274    pub fn clear_scopes(mut self) -> TagValueGetIamPolicyCall<'a, C> {
21275        self._scopes.clear();
21276        self
21277    }
21278}
21279
21280/// Retrieves a TagValue by its namespaced name. This method will return `PERMISSION_DENIED` if the value does not exist or the user does not have permission to view it.
21281///
21282/// A builder for the *getNamespaced* method supported by a *tagValue* resource.
21283/// It is not used directly, but through a [`TagValueMethods`] instance.
21284///
21285/// # Example
21286///
21287/// Instantiate a resource method builder
21288///
21289/// ```test_harness,no_run
21290/// # extern crate hyper;
21291/// # extern crate hyper_rustls;
21292/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
21293/// # async fn dox() {
21294/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21295///
21296/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21297/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21298/// #     .with_native_roots()
21299/// #     .unwrap()
21300/// #     .https_only()
21301/// #     .enable_http2()
21302/// #     .build();
21303///
21304/// # let executor = hyper_util::rt::TokioExecutor::new();
21305/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21306/// #     secret,
21307/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21308/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21309/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21310/// #     ),
21311/// # ).build().await.unwrap();
21312///
21313/// # let client = hyper_util::client::legacy::Client::builder(
21314/// #     hyper_util::rt::TokioExecutor::new()
21315/// # )
21316/// # .build(
21317/// #     hyper_rustls::HttpsConnectorBuilder::new()
21318/// #         .with_native_roots()
21319/// #         .unwrap()
21320/// #         .https_or_http()
21321/// #         .enable_http2()
21322/// #         .build()
21323/// # );
21324/// # let mut hub = CloudResourceManager::new(client, auth);
21325/// // You can configure optional parameters by calling the respective setters at will, and
21326/// // execute the final call using `doit()`.
21327/// // Values shown here are possibly random and not representative !
21328/// let result = hub.tag_values().get_namespaced()
21329///              .name("sed")
21330///              .doit().await;
21331/// # }
21332/// ```
21333pub struct TagValueGetNamespacedCall<'a, C>
21334where
21335    C: 'a,
21336{
21337    hub: &'a CloudResourceManager<C>,
21338    _name: Option<String>,
21339    _delegate: Option<&'a mut dyn common::Delegate>,
21340    _additional_params: HashMap<String, String>,
21341    _scopes: BTreeSet<String>,
21342}
21343
21344impl<'a, C> common::CallBuilder for TagValueGetNamespacedCall<'a, C> {}
21345
21346impl<'a, C> TagValueGetNamespacedCall<'a, C>
21347where
21348    C: common::Connector,
21349{
21350    /// Perform the operation you have build so far.
21351    pub async fn doit(mut self) -> common::Result<(common::Response, TagValue)> {
21352        use std::borrow::Cow;
21353        use std::io::{Read, Seek};
21354
21355        use common::{url::Params, ToParts};
21356        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21357
21358        let mut dd = common::DefaultDelegate;
21359        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21360        dlg.begin(common::MethodInfo {
21361            id: "cloudresourcemanager.tagValues.getNamespaced",
21362            http_method: hyper::Method::GET,
21363        });
21364
21365        for &field in ["alt", "name"].iter() {
21366            if self._additional_params.contains_key(field) {
21367                dlg.finished(false);
21368                return Err(common::Error::FieldClash(field));
21369            }
21370        }
21371
21372        let mut params = Params::with_capacity(3 + self._additional_params.len());
21373        if let Some(value) = self._name.as_ref() {
21374            params.push("name", value);
21375        }
21376
21377        params.extend(self._additional_params.iter());
21378
21379        params.push("alt", "json");
21380        let mut url = self.hub._base_url.clone() + "v3/tagValues/namespaced";
21381        if self._scopes.is_empty() {
21382            self._scopes
21383                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
21384        }
21385
21386        let url = params.parse_with_url(&url);
21387
21388        loop {
21389            let token = match self
21390                .hub
21391                .auth
21392                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21393                .await
21394            {
21395                Ok(token) => token,
21396                Err(e) => match dlg.token(e) {
21397                    Ok(token) => token,
21398                    Err(e) => {
21399                        dlg.finished(false);
21400                        return Err(common::Error::MissingToken(e));
21401                    }
21402                },
21403            };
21404            let mut req_result = {
21405                let client = &self.hub.client;
21406                dlg.pre_request();
21407                let mut req_builder = hyper::Request::builder()
21408                    .method(hyper::Method::GET)
21409                    .uri(url.as_str())
21410                    .header(USER_AGENT, self.hub._user_agent.clone());
21411
21412                if let Some(token) = token.as_ref() {
21413                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21414                }
21415
21416                let request = req_builder
21417                    .header(CONTENT_LENGTH, 0_u64)
21418                    .body(common::to_body::<String>(None));
21419
21420                client.request(request.unwrap()).await
21421            };
21422
21423            match req_result {
21424                Err(err) => {
21425                    if let common::Retry::After(d) = dlg.http_error(&err) {
21426                        sleep(d).await;
21427                        continue;
21428                    }
21429                    dlg.finished(false);
21430                    return Err(common::Error::HttpError(err));
21431                }
21432                Ok(res) => {
21433                    let (mut parts, body) = res.into_parts();
21434                    let mut body = common::Body::new(body);
21435                    if !parts.status.is_success() {
21436                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21437                        let error = serde_json::from_str(&common::to_string(&bytes));
21438                        let response = common::to_response(parts, bytes.into());
21439
21440                        if let common::Retry::After(d) =
21441                            dlg.http_failure(&response, error.as_ref().ok())
21442                        {
21443                            sleep(d).await;
21444                            continue;
21445                        }
21446
21447                        dlg.finished(false);
21448
21449                        return Err(match error {
21450                            Ok(value) => common::Error::BadRequest(value),
21451                            _ => common::Error::Failure(response),
21452                        });
21453                    }
21454                    let response = {
21455                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21456                        let encoded = common::to_string(&bytes);
21457                        match serde_json::from_str(&encoded) {
21458                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21459                            Err(error) => {
21460                                dlg.response_json_decode_error(&encoded, &error);
21461                                return Err(common::Error::JsonDecodeError(
21462                                    encoded.to_string(),
21463                                    error,
21464                                ));
21465                            }
21466                        }
21467                    };
21468
21469                    dlg.finished(true);
21470                    return Ok(response);
21471                }
21472            }
21473        }
21474    }
21475
21476    /// Required. A namespaced tag value name in the following format: `{parentId}/{tagKeyShort}/{tagValueShort}` Examples: - `42/foo/abc` for a value with short name "abc" under the key with short name "foo" under the organization with ID 42 - `r2-d2/bar/xyz` for a value with short name "xyz" under the key with short name "bar" under the project with ID "r2-d2"
21477    ///
21478    /// Sets the *name* query property to the given value.
21479    pub fn name(mut self, new_value: &str) -> TagValueGetNamespacedCall<'a, C> {
21480        self._name = Some(new_value.to_string());
21481        self
21482    }
21483    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21484    /// while executing the actual API request.
21485    ///
21486    /// ````text
21487    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21488    /// ````
21489    ///
21490    /// Sets the *delegate* property to the given value.
21491    pub fn delegate(
21492        mut self,
21493        new_value: &'a mut dyn common::Delegate,
21494    ) -> TagValueGetNamespacedCall<'a, C> {
21495        self._delegate = Some(new_value);
21496        self
21497    }
21498
21499    /// Set any additional parameter of the query string used in the request.
21500    /// It should be used to set parameters which are not yet available through their own
21501    /// setters.
21502    ///
21503    /// Please note that this method must not be used to set any of the known parameters
21504    /// which have their own setter method. If done anyway, the request will fail.
21505    ///
21506    /// # Additional Parameters
21507    ///
21508    /// * *$.xgafv* (query-string) - V1 error format.
21509    /// * *access_token* (query-string) - OAuth access token.
21510    /// * *alt* (query-string) - Data format for response.
21511    /// * *callback* (query-string) - JSONP
21512    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21513    /// * *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.
21514    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21515    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21516    /// * *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.
21517    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21518    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21519    pub fn param<T>(mut self, name: T, value: T) -> TagValueGetNamespacedCall<'a, C>
21520    where
21521        T: AsRef<str>,
21522    {
21523        self._additional_params
21524            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21525        self
21526    }
21527
21528    /// Identifies the authorization scope for the method you are building.
21529    ///
21530    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21531    /// [`Scope::CloudPlatformReadOnly`].
21532    ///
21533    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21534    /// tokens for more than one scope.
21535    ///
21536    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21537    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21538    /// sufficient, a read-write scope will do as well.
21539    pub fn add_scope<St>(mut self, scope: St) -> TagValueGetNamespacedCall<'a, C>
21540    where
21541        St: AsRef<str>,
21542    {
21543        self._scopes.insert(String::from(scope.as_ref()));
21544        self
21545    }
21546    /// Identifies the authorization scope(s) for the method you are building.
21547    ///
21548    /// See [`Self::add_scope()`] for details.
21549    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueGetNamespacedCall<'a, C>
21550    where
21551        I: IntoIterator<Item = St>,
21552        St: AsRef<str>,
21553    {
21554        self._scopes
21555            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21556        self
21557    }
21558
21559    /// Removes all scopes, and no default scope will be used either.
21560    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21561    /// for details).
21562    pub fn clear_scopes(mut self) -> TagValueGetNamespacedCall<'a, C> {
21563        self._scopes.clear();
21564        self
21565    }
21566}
21567
21568/// Lists all TagValues for a specific TagKey.
21569///
21570/// A builder for the *list* method supported by a *tagValue* resource.
21571/// It is not used directly, but through a [`TagValueMethods`] instance.
21572///
21573/// # Example
21574///
21575/// Instantiate a resource method builder
21576///
21577/// ```test_harness,no_run
21578/// # extern crate hyper;
21579/// # extern crate hyper_rustls;
21580/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
21581/// # async fn dox() {
21582/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21583///
21584/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21585/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21586/// #     .with_native_roots()
21587/// #     .unwrap()
21588/// #     .https_only()
21589/// #     .enable_http2()
21590/// #     .build();
21591///
21592/// # let executor = hyper_util::rt::TokioExecutor::new();
21593/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21594/// #     secret,
21595/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21596/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21597/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21598/// #     ),
21599/// # ).build().await.unwrap();
21600///
21601/// # let client = hyper_util::client::legacy::Client::builder(
21602/// #     hyper_util::rt::TokioExecutor::new()
21603/// # )
21604/// # .build(
21605/// #     hyper_rustls::HttpsConnectorBuilder::new()
21606/// #         .with_native_roots()
21607/// #         .unwrap()
21608/// #         .https_or_http()
21609/// #         .enable_http2()
21610/// #         .build()
21611/// # );
21612/// # let mut hub = CloudResourceManager::new(client, auth);
21613/// // You can configure optional parameters by calling the respective setters at will, and
21614/// // execute the final call using `doit()`.
21615/// // Values shown here are possibly random and not representative !
21616/// let result = hub.tag_values().list()
21617///              .parent("sit")
21618///              .page_token("et")
21619///              .page_size(-39)
21620///              .doit().await;
21621/// # }
21622/// ```
21623pub struct TagValueListCall<'a, C>
21624where
21625    C: 'a,
21626{
21627    hub: &'a CloudResourceManager<C>,
21628    _parent: Option<String>,
21629    _page_token: Option<String>,
21630    _page_size: Option<i32>,
21631    _delegate: Option<&'a mut dyn common::Delegate>,
21632    _additional_params: HashMap<String, String>,
21633    _scopes: BTreeSet<String>,
21634}
21635
21636impl<'a, C> common::CallBuilder for TagValueListCall<'a, C> {}
21637
21638impl<'a, C> TagValueListCall<'a, C>
21639where
21640    C: common::Connector,
21641{
21642    /// Perform the operation you have build so far.
21643    pub async fn doit(mut self) -> common::Result<(common::Response, ListTagValuesResponse)> {
21644        use std::borrow::Cow;
21645        use std::io::{Read, Seek};
21646
21647        use common::{url::Params, ToParts};
21648        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21649
21650        let mut dd = common::DefaultDelegate;
21651        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21652        dlg.begin(common::MethodInfo {
21653            id: "cloudresourcemanager.tagValues.list",
21654            http_method: hyper::Method::GET,
21655        });
21656
21657        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
21658            if self._additional_params.contains_key(field) {
21659                dlg.finished(false);
21660                return Err(common::Error::FieldClash(field));
21661            }
21662        }
21663
21664        let mut params = Params::with_capacity(5 + self._additional_params.len());
21665        if let Some(value) = self._parent.as_ref() {
21666            params.push("parent", value);
21667        }
21668        if let Some(value) = self._page_token.as_ref() {
21669            params.push("pageToken", value);
21670        }
21671        if let Some(value) = self._page_size.as_ref() {
21672            params.push("pageSize", value.to_string());
21673        }
21674
21675        params.extend(self._additional_params.iter());
21676
21677        params.push("alt", "json");
21678        let mut url = self.hub._base_url.clone() + "v3/tagValues";
21679        if self._scopes.is_empty() {
21680            self._scopes
21681                .insert(Scope::CloudPlatformReadOnly.as_ref().to_string());
21682        }
21683
21684        let url = params.parse_with_url(&url);
21685
21686        loop {
21687            let token = match self
21688                .hub
21689                .auth
21690                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21691                .await
21692            {
21693                Ok(token) => token,
21694                Err(e) => match dlg.token(e) {
21695                    Ok(token) => token,
21696                    Err(e) => {
21697                        dlg.finished(false);
21698                        return Err(common::Error::MissingToken(e));
21699                    }
21700                },
21701            };
21702            let mut req_result = {
21703                let client = &self.hub.client;
21704                dlg.pre_request();
21705                let mut req_builder = hyper::Request::builder()
21706                    .method(hyper::Method::GET)
21707                    .uri(url.as_str())
21708                    .header(USER_AGENT, self.hub._user_agent.clone());
21709
21710                if let Some(token) = token.as_ref() {
21711                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21712                }
21713
21714                let request = req_builder
21715                    .header(CONTENT_LENGTH, 0_u64)
21716                    .body(common::to_body::<String>(None));
21717
21718                client.request(request.unwrap()).await
21719            };
21720
21721            match req_result {
21722                Err(err) => {
21723                    if let common::Retry::After(d) = dlg.http_error(&err) {
21724                        sleep(d).await;
21725                        continue;
21726                    }
21727                    dlg.finished(false);
21728                    return Err(common::Error::HttpError(err));
21729                }
21730                Ok(res) => {
21731                    let (mut parts, body) = res.into_parts();
21732                    let mut body = common::Body::new(body);
21733                    if !parts.status.is_success() {
21734                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21735                        let error = serde_json::from_str(&common::to_string(&bytes));
21736                        let response = common::to_response(parts, bytes.into());
21737
21738                        if let common::Retry::After(d) =
21739                            dlg.http_failure(&response, error.as_ref().ok())
21740                        {
21741                            sleep(d).await;
21742                            continue;
21743                        }
21744
21745                        dlg.finished(false);
21746
21747                        return Err(match error {
21748                            Ok(value) => common::Error::BadRequest(value),
21749                            _ => common::Error::Failure(response),
21750                        });
21751                    }
21752                    let response = {
21753                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21754                        let encoded = common::to_string(&bytes);
21755                        match serde_json::from_str(&encoded) {
21756                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21757                            Err(error) => {
21758                                dlg.response_json_decode_error(&encoded, &error);
21759                                return Err(common::Error::JsonDecodeError(
21760                                    encoded.to_string(),
21761                                    error,
21762                                ));
21763                            }
21764                        }
21765                    };
21766
21767                    dlg.finished(true);
21768                    return Ok(response);
21769                }
21770            }
21771        }
21772    }
21773
21774    /// Required. Resource name for the parent of the TagValues to be listed, in the format `tagKeys/123` or `tagValues/123`.
21775    ///
21776    /// Sets the *parent* query property to the given value.
21777    pub fn parent(mut self, new_value: &str) -> TagValueListCall<'a, C> {
21778        self._parent = Some(new_value.to_string());
21779        self
21780    }
21781    /// Optional. A pagination token returned from a previous call to `ListTagValues` that indicates where this listing should continue from.
21782    ///
21783    /// Sets the *page token* query property to the given value.
21784    pub fn page_token(mut self, new_value: &str) -> TagValueListCall<'a, C> {
21785        self._page_token = Some(new_value.to_string());
21786        self
21787    }
21788    /// Optional. The maximum number of TagValues to return in the response. The server allows a maximum of 300 TagValues to return. If unspecified, the server will use 100 as the default.
21789    ///
21790    /// Sets the *page size* query property to the given value.
21791    pub fn page_size(mut self, new_value: i32) -> TagValueListCall<'a, C> {
21792        self._page_size = Some(new_value);
21793        self
21794    }
21795    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21796    /// while executing the actual API request.
21797    ///
21798    /// ````text
21799    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21800    /// ````
21801    ///
21802    /// Sets the *delegate* property to the given value.
21803    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagValueListCall<'a, C> {
21804        self._delegate = Some(new_value);
21805        self
21806    }
21807
21808    /// Set any additional parameter of the query string used in the request.
21809    /// It should be used to set parameters which are not yet available through their own
21810    /// setters.
21811    ///
21812    /// Please note that this method must not be used to set any of the known parameters
21813    /// which have their own setter method. If done anyway, the request will fail.
21814    ///
21815    /// # Additional Parameters
21816    ///
21817    /// * *$.xgafv* (query-string) - V1 error format.
21818    /// * *access_token* (query-string) - OAuth access token.
21819    /// * *alt* (query-string) - Data format for response.
21820    /// * *callback* (query-string) - JSONP
21821    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21822    /// * *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.
21823    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21824    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21825    /// * *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.
21826    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21827    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21828    pub fn param<T>(mut self, name: T, value: T) -> TagValueListCall<'a, C>
21829    where
21830        T: AsRef<str>,
21831    {
21832        self._additional_params
21833            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21834        self
21835    }
21836
21837    /// Identifies the authorization scope for the method you are building.
21838    ///
21839    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21840    /// [`Scope::CloudPlatformReadOnly`].
21841    ///
21842    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21843    /// tokens for more than one scope.
21844    ///
21845    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21846    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21847    /// sufficient, a read-write scope will do as well.
21848    pub fn add_scope<St>(mut self, scope: St) -> TagValueListCall<'a, C>
21849    where
21850        St: AsRef<str>,
21851    {
21852        self._scopes.insert(String::from(scope.as_ref()));
21853        self
21854    }
21855    /// Identifies the authorization scope(s) for the method you are building.
21856    ///
21857    /// See [`Self::add_scope()`] for details.
21858    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueListCall<'a, C>
21859    where
21860        I: IntoIterator<Item = St>,
21861        St: AsRef<str>,
21862    {
21863        self._scopes
21864            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21865        self
21866    }
21867
21868    /// Removes all scopes, and no default scope will be used either.
21869    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21870    /// for details).
21871    pub fn clear_scopes(mut self) -> TagValueListCall<'a, C> {
21872        self._scopes.clear();
21873        self
21874    }
21875}
21876
21877/// Updates the attributes of the TagValue resource.
21878///
21879/// A builder for the *patch* method supported by a *tagValue* resource.
21880/// It is not used directly, but through a [`TagValueMethods`] instance.
21881///
21882/// # Example
21883///
21884/// Instantiate a resource method builder
21885///
21886/// ```test_harness,no_run
21887/// # extern crate hyper;
21888/// # extern crate hyper_rustls;
21889/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
21890/// use cloudresourcemanager3::api::TagValue;
21891/// # async fn dox() {
21892/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21893///
21894/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21895/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21896/// #     .with_native_roots()
21897/// #     .unwrap()
21898/// #     .https_only()
21899/// #     .enable_http2()
21900/// #     .build();
21901///
21902/// # let executor = hyper_util::rt::TokioExecutor::new();
21903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21904/// #     secret,
21905/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21906/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
21907/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
21908/// #     ),
21909/// # ).build().await.unwrap();
21910///
21911/// # let client = hyper_util::client::legacy::Client::builder(
21912/// #     hyper_util::rt::TokioExecutor::new()
21913/// # )
21914/// # .build(
21915/// #     hyper_rustls::HttpsConnectorBuilder::new()
21916/// #         .with_native_roots()
21917/// #         .unwrap()
21918/// #         .https_or_http()
21919/// #         .enable_http2()
21920/// #         .build()
21921/// # );
21922/// # let mut hub = CloudResourceManager::new(client, auth);
21923/// // As the method needs a request, you would usually fill it with the desired information
21924/// // into the respective structure. Some of the parts shown here might not be applicable !
21925/// // Values shown here are possibly random and not representative !
21926/// let mut req = TagValue::default();
21927///
21928/// // You can configure optional parameters by calling the respective setters at will, and
21929/// // execute the final call using `doit()`.
21930/// // Values shown here are possibly random and not representative !
21931/// let result = hub.tag_values().patch(req, "name")
21932///              .validate_only(true)
21933///              .update_mask(FieldMask::new::<&str>(&[]))
21934///              .doit().await;
21935/// # }
21936/// ```
21937pub struct TagValuePatchCall<'a, C>
21938where
21939    C: 'a,
21940{
21941    hub: &'a CloudResourceManager<C>,
21942    _request: TagValue,
21943    _name: String,
21944    _validate_only: Option<bool>,
21945    _update_mask: Option<common::FieldMask>,
21946    _delegate: Option<&'a mut dyn common::Delegate>,
21947    _additional_params: HashMap<String, String>,
21948    _scopes: BTreeSet<String>,
21949}
21950
21951impl<'a, C> common::CallBuilder for TagValuePatchCall<'a, C> {}
21952
21953impl<'a, C> TagValuePatchCall<'a, C>
21954where
21955    C: common::Connector,
21956{
21957    /// Perform the operation you have build so far.
21958    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21959        use std::borrow::Cow;
21960        use std::io::{Read, Seek};
21961
21962        use common::{url::Params, ToParts};
21963        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21964
21965        let mut dd = common::DefaultDelegate;
21966        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21967        dlg.begin(common::MethodInfo {
21968            id: "cloudresourcemanager.tagValues.patch",
21969            http_method: hyper::Method::PATCH,
21970        });
21971
21972        for &field in ["alt", "name", "validateOnly", "updateMask"].iter() {
21973            if self._additional_params.contains_key(field) {
21974                dlg.finished(false);
21975                return Err(common::Error::FieldClash(field));
21976            }
21977        }
21978
21979        let mut params = Params::with_capacity(6 + self._additional_params.len());
21980        params.push("name", self._name);
21981        if let Some(value) = self._validate_only.as_ref() {
21982            params.push("validateOnly", value.to_string());
21983        }
21984        if let Some(value) = self._update_mask.as_ref() {
21985            params.push("updateMask", value.to_string());
21986        }
21987
21988        params.extend(self._additional_params.iter());
21989
21990        params.push("alt", "json");
21991        let mut url = self.hub._base_url.clone() + "v3/{+name}";
21992        if self._scopes.is_empty() {
21993            self._scopes
21994                .insert(Scope::CloudPlatform.as_ref().to_string());
21995        }
21996
21997        #[allow(clippy::single_element_loop)]
21998        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21999            url = params.uri_replacement(url, param_name, find_this, true);
22000        }
22001        {
22002            let to_remove = ["name"];
22003            params.remove_params(&to_remove);
22004        }
22005
22006        let url = params.parse_with_url(&url);
22007
22008        let mut json_mime_type = mime::APPLICATION_JSON;
22009        let mut request_value_reader = {
22010            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22011            common::remove_json_null_values(&mut value);
22012            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22013            serde_json::to_writer(&mut dst, &value).unwrap();
22014            dst
22015        };
22016        let request_size = request_value_reader
22017            .seek(std::io::SeekFrom::End(0))
22018            .unwrap();
22019        request_value_reader
22020            .seek(std::io::SeekFrom::Start(0))
22021            .unwrap();
22022
22023        loop {
22024            let token = match self
22025                .hub
22026                .auth
22027                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22028                .await
22029            {
22030                Ok(token) => token,
22031                Err(e) => match dlg.token(e) {
22032                    Ok(token) => token,
22033                    Err(e) => {
22034                        dlg.finished(false);
22035                        return Err(common::Error::MissingToken(e));
22036                    }
22037                },
22038            };
22039            request_value_reader
22040                .seek(std::io::SeekFrom::Start(0))
22041                .unwrap();
22042            let mut req_result = {
22043                let client = &self.hub.client;
22044                dlg.pre_request();
22045                let mut req_builder = hyper::Request::builder()
22046                    .method(hyper::Method::PATCH)
22047                    .uri(url.as_str())
22048                    .header(USER_AGENT, self.hub._user_agent.clone());
22049
22050                if let Some(token) = token.as_ref() {
22051                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22052                }
22053
22054                let request = req_builder
22055                    .header(CONTENT_TYPE, json_mime_type.to_string())
22056                    .header(CONTENT_LENGTH, request_size as u64)
22057                    .body(common::to_body(
22058                        request_value_reader.get_ref().clone().into(),
22059                    ));
22060
22061                client.request(request.unwrap()).await
22062            };
22063
22064            match req_result {
22065                Err(err) => {
22066                    if let common::Retry::After(d) = dlg.http_error(&err) {
22067                        sleep(d).await;
22068                        continue;
22069                    }
22070                    dlg.finished(false);
22071                    return Err(common::Error::HttpError(err));
22072                }
22073                Ok(res) => {
22074                    let (mut parts, body) = res.into_parts();
22075                    let mut body = common::Body::new(body);
22076                    if !parts.status.is_success() {
22077                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22078                        let error = serde_json::from_str(&common::to_string(&bytes));
22079                        let response = common::to_response(parts, bytes.into());
22080
22081                        if let common::Retry::After(d) =
22082                            dlg.http_failure(&response, error.as_ref().ok())
22083                        {
22084                            sleep(d).await;
22085                            continue;
22086                        }
22087
22088                        dlg.finished(false);
22089
22090                        return Err(match error {
22091                            Ok(value) => common::Error::BadRequest(value),
22092                            _ => common::Error::Failure(response),
22093                        });
22094                    }
22095                    let response = {
22096                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22097                        let encoded = common::to_string(&bytes);
22098                        match serde_json::from_str(&encoded) {
22099                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22100                            Err(error) => {
22101                                dlg.response_json_decode_error(&encoded, &error);
22102                                return Err(common::Error::JsonDecodeError(
22103                                    encoded.to_string(),
22104                                    error,
22105                                ));
22106                            }
22107                        }
22108                    };
22109
22110                    dlg.finished(true);
22111                    return Ok(response);
22112                }
22113            }
22114        }
22115    }
22116
22117    ///
22118    /// Sets the *request* property to the given value.
22119    ///
22120    /// Even though the property as already been set when instantiating this call,
22121    /// we provide this method for API completeness.
22122    pub fn request(mut self, new_value: TagValue) -> TagValuePatchCall<'a, C> {
22123        self._request = new_value;
22124        self
22125    }
22126    /// Immutable. Resource name for TagValue in the format `tagValues/456`.
22127    ///
22128    /// Sets the *name* path property to the given value.
22129    ///
22130    /// Even though the property as already been set when instantiating this call,
22131    /// we provide this method for API completeness.
22132    pub fn name(mut self, new_value: &str) -> TagValuePatchCall<'a, C> {
22133        self._name = new_value.to_string();
22134        self
22135    }
22136    /// Optional. True to perform validations necessary for updating the resource, but not actually perform the action.
22137    ///
22138    /// Sets the *validate only* query property to the given value.
22139    pub fn validate_only(mut self, new_value: bool) -> TagValuePatchCall<'a, C> {
22140        self._validate_only = Some(new_value);
22141        self
22142    }
22143    /// Optional. Fields to be updated.
22144    ///
22145    /// Sets the *update mask* query property to the given value.
22146    pub fn update_mask(mut self, new_value: common::FieldMask) -> TagValuePatchCall<'a, C> {
22147        self._update_mask = Some(new_value);
22148        self
22149    }
22150    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22151    /// while executing the actual API request.
22152    ///
22153    /// ````text
22154    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22155    /// ````
22156    ///
22157    /// Sets the *delegate* property to the given value.
22158    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TagValuePatchCall<'a, C> {
22159        self._delegate = Some(new_value);
22160        self
22161    }
22162
22163    /// Set any additional parameter of the query string used in the request.
22164    /// It should be used to set parameters which are not yet available through their own
22165    /// setters.
22166    ///
22167    /// Please note that this method must not be used to set any of the known parameters
22168    /// which have their own setter method. If done anyway, the request will fail.
22169    ///
22170    /// # Additional Parameters
22171    ///
22172    /// * *$.xgafv* (query-string) - V1 error format.
22173    /// * *access_token* (query-string) - OAuth access token.
22174    /// * *alt* (query-string) - Data format for response.
22175    /// * *callback* (query-string) - JSONP
22176    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22177    /// * *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.
22178    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22179    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22180    /// * *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.
22181    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22182    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22183    pub fn param<T>(mut self, name: T, value: T) -> TagValuePatchCall<'a, C>
22184    where
22185        T: AsRef<str>,
22186    {
22187        self._additional_params
22188            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22189        self
22190    }
22191
22192    /// Identifies the authorization scope for the method you are building.
22193    ///
22194    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22195    /// [`Scope::CloudPlatform`].
22196    ///
22197    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22198    /// tokens for more than one scope.
22199    ///
22200    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22201    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22202    /// sufficient, a read-write scope will do as well.
22203    pub fn add_scope<St>(mut self, scope: St) -> TagValuePatchCall<'a, C>
22204    where
22205        St: AsRef<str>,
22206    {
22207        self._scopes.insert(String::from(scope.as_ref()));
22208        self
22209    }
22210    /// Identifies the authorization scope(s) for the method you are building.
22211    ///
22212    /// See [`Self::add_scope()`] for details.
22213    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValuePatchCall<'a, C>
22214    where
22215        I: IntoIterator<Item = St>,
22216        St: AsRef<str>,
22217    {
22218        self._scopes
22219            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22220        self
22221    }
22222
22223    /// Removes all scopes, and no default scope will be used either.
22224    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22225    /// for details).
22226    pub fn clear_scopes(mut self) -> TagValuePatchCall<'a, C> {
22227        self._scopes.clear();
22228        self
22229    }
22230}
22231
22232/// Sets the access control policy on a TagValue, replacing any existing policy. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. The caller must have `resourcemanager.tagValues.setIamPolicy` permission on the identified tagValue.
22233///
22234/// A builder for the *setIamPolicy* method supported by a *tagValue* resource.
22235/// It is not used directly, but through a [`TagValueMethods`] instance.
22236///
22237/// # Example
22238///
22239/// Instantiate a resource method builder
22240///
22241/// ```test_harness,no_run
22242/// # extern crate hyper;
22243/// # extern crate hyper_rustls;
22244/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
22245/// use cloudresourcemanager3::api::SetIamPolicyRequest;
22246/// # async fn dox() {
22247/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22248///
22249/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22250/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22251/// #     .with_native_roots()
22252/// #     .unwrap()
22253/// #     .https_only()
22254/// #     .enable_http2()
22255/// #     .build();
22256///
22257/// # let executor = hyper_util::rt::TokioExecutor::new();
22258/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22259/// #     secret,
22260/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22261/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22262/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22263/// #     ),
22264/// # ).build().await.unwrap();
22265///
22266/// # let client = hyper_util::client::legacy::Client::builder(
22267/// #     hyper_util::rt::TokioExecutor::new()
22268/// # )
22269/// # .build(
22270/// #     hyper_rustls::HttpsConnectorBuilder::new()
22271/// #         .with_native_roots()
22272/// #         .unwrap()
22273/// #         .https_or_http()
22274/// #         .enable_http2()
22275/// #         .build()
22276/// # );
22277/// # let mut hub = CloudResourceManager::new(client, auth);
22278/// // As the method needs a request, you would usually fill it with the desired information
22279/// // into the respective structure. Some of the parts shown here might not be applicable !
22280/// // Values shown here are possibly random and not representative !
22281/// let mut req = SetIamPolicyRequest::default();
22282///
22283/// // You can configure optional parameters by calling the respective setters at will, and
22284/// // execute the final call using `doit()`.
22285/// // Values shown here are possibly random and not representative !
22286/// let result = hub.tag_values().set_iam_policy(req, "resource")
22287///              .doit().await;
22288/// # }
22289/// ```
22290pub struct TagValueSetIamPolicyCall<'a, C>
22291where
22292    C: 'a,
22293{
22294    hub: &'a CloudResourceManager<C>,
22295    _request: SetIamPolicyRequest,
22296    _resource: String,
22297    _delegate: Option<&'a mut dyn common::Delegate>,
22298    _additional_params: HashMap<String, String>,
22299    _scopes: BTreeSet<String>,
22300}
22301
22302impl<'a, C> common::CallBuilder for TagValueSetIamPolicyCall<'a, C> {}
22303
22304impl<'a, C> TagValueSetIamPolicyCall<'a, C>
22305where
22306    C: common::Connector,
22307{
22308    /// Perform the operation you have build so far.
22309    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
22310        use std::borrow::Cow;
22311        use std::io::{Read, Seek};
22312
22313        use common::{url::Params, ToParts};
22314        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22315
22316        let mut dd = common::DefaultDelegate;
22317        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22318        dlg.begin(common::MethodInfo {
22319            id: "cloudresourcemanager.tagValues.setIamPolicy",
22320            http_method: hyper::Method::POST,
22321        });
22322
22323        for &field in ["alt", "resource"].iter() {
22324            if self._additional_params.contains_key(field) {
22325                dlg.finished(false);
22326                return Err(common::Error::FieldClash(field));
22327            }
22328        }
22329
22330        let mut params = Params::with_capacity(4 + self._additional_params.len());
22331        params.push("resource", self._resource);
22332
22333        params.extend(self._additional_params.iter());
22334
22335        params.push("alt", "json");
22336        let mut url = self.hub._base_url.clone() + "v3/{+resource}:setIamPolicy";
22337        if self._scopes.is_empty() {
22338            self._scopes
22339                .insert(Scope::CloudPlatform.as_ref().to_string());
22340        }
22341
22342        #[allow(clippy::single_element_loop)]
22343        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22344            url = params.uri_replacement(url, param_name, find_this, true);
22345        }
22346        {
22347            let to_remove = ["resource"];
22348            params.remove_params(&to_remove);
22349        }
22350
22351        let url = params.parse_with_url(&url);
22352
22353        let mut json_mime_type = mime::APPLICATION_JSON;
22354        let mut request_value_reader = {
22355            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22356            common::remove_json_null_values(&mut value);
22357            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22358            serde_json::to_writer(&mut dst, &value).unwrap();
22359            dst
22360        };
22361        let request_size = request_value_reader
22362            .seek(std::io::SeekFrom::End(0))
22363            .unwrap();
22364        request_value_reader
22365            .seek(std::io::SeekFrom::Start(0))
22366            .unwrap();
22367
22368        loop {
22369            let token = match self
22370                .hub
22371                .auth
22372                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22373                .await
22374            {
22375                Ok(token) => token,
22376                Err(e) => match dlg.token(e) {
22377                    Ok(token) => token,
22378                    Err(e) => {
22379                        dlg.finished(false);
22380                        return Err(common::Error::MissingToken(e));
22381                    }
22382                },
22383            };
22384            request_value_reader
22385                .seek(std::io::SeekFrom::Start(0))
22386                .unwrap();
22387            let mut req_result = {
22388                let client = &self.hub.client;
22389                dlg.pre_request();
22390                let mut req_builder = hyper::Request::builder()
22391                    .method(hyper::Method::POST)
22392                    .uri(url.as_str())
22393                    .header(USER_AGENT, self.hub._user_agent.clone());
22394
22395                if let Some(token) = token.as_ref() {
22396                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22397                }
22398
22399                let request = req_builder
22400                    .header(CONTENT_TYPE, json_mime_type.to_string())
22401                    .header(CONTENT_LENGTH, request_size as u64)
22402                    .body(common::to_body(
22403                        request_value_reader.get_ref().clone().into(),
22404                    ));
22405
22406                client.request(request.unwrap()).await
22407            };
22408
22409            match req_result {
22410                Err(err) => {
22411                    if let common::Retry::After(d) = dlg.http_error(&err) {
22412                        sleep(d).await;
22413                        continue;
22414                    }
22415                    dlg.finished(false);
22416                    return Err(common::Error::HttpError(err));
22417                }
22418                Ok(res) => {
22419                    let (mut parts, body) = res.into_parts();
22420                    let mut body = common::Body::new(body);
22421                    if !parts.status.is_success() {
22422                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22423                        let error = serde_json::from_str(&common::to_string(&bytes));
22424                        let response = common::to_response(parts, bytes.into());
22425
22426                        if let common::Retry::After(d) =
22427                            dlg.http_failure(&response, error.as_ref().ok())
22428                        {
22429                            sleep(d).await;
22430                            continue;
22431                        }
22432
22433                        dlg.finished(false);
22434
22435                        return Err(match error {
22436                            Ok(value) => common::Error::BadRequest(value),
22437                            _ => common::Error::Failure(response),
22438                        });
22439                    }
22440                    let response = {
22441                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22442                        let encoded = common::to_string(&bytes);
22443                        match serde_json::from_str(&encoded) {
22444                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22445                            Err(error) => {
22446                                dlg.response_json_decode_error(&encoded, &error);
22447                                return Err(common::Error::JsonDecodeError(
22448                                    encoded.to_string(),
22449                                    error,
22450                                ));
22451                            }
22452                        }
22453                    };
22454
22455                    dlg.finished(true);
22456                    return Ok(response);
22457                }
22458            }
22459        }
22460    }
22461
22462    ///
22463    /// Sets the *request* property to the given value.
22464    ///
22465    /// Even though the property as already been set when instantiating this call,
22466    /// we provide this method for API completeness.
22467    pub fn request(mut self, new_value: SetIamPolicyRequest) -> TagValueSetIamPolicyCall<'a, C> {
22468        self._request = new_value;
22469        self
22470    }
22471    /// 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.
22472    ///
22473    /// Sets the *resource* path property to the given value.
22474    ///
22475    /// Even though the property as already been set when instantiating this call,
22476    /// we provide this method for API completeness.
22477    pub fn resource(mut self, new_value: &str) -> TagValueSetIamPolicyCall<'a, C> {
22478        self._resource = new_value.to_string();
22479        self
22480    }
22481    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22482    /// while executing the actual API request.
22483    ///
22484    /// ````text
22485    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22486    /// ````
22487    ///
22488    /// Sets the *delegate* property to the given value.
22489    pub fn delegate(
22490        mut self,
22491        new_value: &'a mut dyn common::Delegate,
22492    ) -> TagValueSetIamPolicyCall<'a, C> {
22493        self._delegate = Some(new_value);
22494        self
22495    }
22496
22497    /// Set any additional parameter of the query string used in the request.
22498    /// It should be used to set parameters which are not yet available through their own
22499    /// setters.
22500    ///
22501    /// Please note that this method must not be used to set any of the known parameters
22502    /// which have their own setter method. If done anyway, the request will fail.
22503    ///
22504    /// # Additional Parameters
22505    ///
22506    /// * *$.xgafv* (query-string) - V1 error format.
22507    /// * *access_token* (query-string) - OAuth access token.
22508    /// * *alt* (query-string) - Data format for response.
22509    /// * *callback* (query-string) - JSONP
22510    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22511    /// * *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.
22512    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22513    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22514    /// * *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.
22515    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22516    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22517    pub fn param<T>(mut self, name: T, value: T) -> TagValueSetIamPolicyCall<'a, C>
22518    where
22519        T: AsRef<str>,
22520    {
22521        self._additional_params
22522            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22523        self
22524    }
22525
22526    /// Identifies the authorization scope for the method you are building.
22527    ///
22528    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22529    /// [`Scope::CloudPlatform`].
22530    ///
22531    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22532    /// tokens for more than one scope.
22533    ///
22534    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22535    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22536    /// sufficient, a read-write scope will do as well.
22537    pub fn add_scope<St>(mut self, scope: St) -> TagValueSetIamPolicyCall<'a, C>
22538    where
22539        St: AsRef<str>,
22540    {
22541        self._scopes.insert(String::from(scope.as_ref()));
22542        self
22543    }
22544    /// Identifies the authorization scope(s) for the method you are building.
22545    ///
22546    /// See [`Self::add_scope()`] for details.
22547    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueSetIamPolicyCall<'a, C>
22548    where
22549        I: IntoIterator<Item = St>,
22550        St: AsRef<str>,
22551    {
22552        self._scopes
22553            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22554        self
22555    }
22556
22557    /// Removes all scopes, and no default scope will be used either.
22558    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22559    /// for details).
22560    pub fn clear_scopes(mut self) -> TagValueSetIamPolicyCall<'a, C> {
22561        self._scopes.clear();
22562        self
22563    }
22564}
22565
22566/// Returns permissions that a caller has on the specified TagValue. The `resource` field should be the TagValue's resource name. For example: `tagValues/1234`. There are no permissions required for making this API call.
22567///
22568/// A builder for the *testIamPermissions* method supported by a *tagValue* resource.
22569/// It is not used directly, but through a [`TagValueMethods`] instance.
22570///
22571/// # Example
22572///
22573/// Instantiate a resource method builder
22574///
22575/// ```test_harness,no_run
22576/// # extern crate hyper;
22577/// # extern crate hyper_rustls;
22578/// # extern crate google_cloudresourcemanager3 as cloudresourcemanager3;
22579/// use cloudresourcemanager3::api::TestIamPermissionsRequest;
22580/// # async fn dox() {
22581/// # use cloudresourcemanager3::{CloudResourceManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22582///
22583/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22584/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22585/// #     .with_native_roots()
22586/// #     .unwrap()
22587/// #     .https_only()
22588/// #     .enable_http2()
22589/// #     .build();
22590///
22591/// # let executor = hyper_util::rt::TokioExecutor::new();
22592/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22593/// #     secret,
22594/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22595/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
22596/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
22597/// #     ),
22598/// # ).build().await.unwrap();
22599///
22600/// # let client = hyper_util::client::legacy::Client::builder(
22601/// #     hyper_util::rt::TokioExecutor::new()
22602/// # )
22603/// # .build(
22604/// #     hyper_rustls::HttpsConnectorBuilder::new()
22605/// #         .with_native_roots()
22606/// #         .unwrap()
22607/// #         .https_or_http()
22608/// #         .enable_http2()
22609/// #         .build()
22610/// # );
22611/// # let mut hub = CloudResourceManager::new(client, auth);
22612/// // As the method needs a request, you would usually fill it with the desired information
22613/// // into the respective structure. Some of the parts shown here might not be applicable !
22614/// // Values shown here are possibly random and not representative !
22615/// let mut req = TestIamPermissionsRequest::default();
22616///
22617/// // You can configure optional parameters by calling the respective setters at will, and
22618/// // execute the final call using `doit()`.
22619/// // Values shown here are possibly random and not representative !
22620/// let result = hub.tag_values().test_iam_permissions(req, "resource")
22621///              .doit().await;
22622/// # }
22623/// ```
22624pub struct TagValueTestIamPermissionCall<'a, C>
22625where
22626    C: 'a,
22627{
22628    hub: &'a CloudResourceManager<C>,
22629    _request: TestIamPermissionsRequest,
22630    _resource: String,
22631    _delegate: Option<&'a mut dyn common::Delegate>,
22632    _additional_params: HashMap<String, String>,
22633    _scopes: BTreeSet<String>,
22634}
22635
22636impl<'a, C> common::CallBuilder for TagValueTestIamPermissionCall<'a, C> {}
22637
22638impl<'a, C> TagValueTestIamPermissionCall<'a, C>
22639where
22640    C: common::Connector,
22641{
22642    /// Perform the operation you have build so far.
22643    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
22644        use std::borrow::Cow;
22645        use std::io::{Read, Seek};
22646
22647        use common::{url::Params, ToParts};
22648        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22649
22650        let mut dd = common::DefaultDelegate;
22651        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22652        dlg.begin(common::MethodInfo {
22653            id: "cloudresourcemanager.tagValues.testIamPermissions",
22654            http_method: hyper::Method::POST,
22655        });
22656
22657        for &field in ["alt", "resource"].iter() {
22658            if self._additional_params.contains_key(field) {
22659                dlg.finished(false);
22660                return Err(common::Error::FieldClash(field));
22661            }
22662        }
22663
22664        let mut params = Params::with_capacity(4 + self._additional_params.len());
22665        params.push("resource", self._resource);
22666
22667        params.extend(self._additional_params.iter());
22668
22669        params.push("alt", "json");
22670        let mut url = self.hub._base_url.clone() + "v3/{+resource}:testIamPermissions";
22671        if self._scopes.is_empty() {
22672            self._scopes
22673                .insert(Scope::CloudPlatform.as_ref().to_string());
22674        }
22675
22676        #[allow(clippy::single_element_loop)]
22677        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
22678            url = params.uri_replacement(url, param_name, find_this, true);
22679        }
22680        {
22681            let to_remove = ["resource"];
22682            params.remove_params(&to_remove);
22683        }
22684
22685        let url = params.parse_with_url(&url);
22686
22687        let mut json_mime_type = mime::APPLICATION_JSON;
22688        let mut request_value_reader = {
22689            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22690            common::remove_json_null_values(&mut value);
22691            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22692            serde_json::to_writer(&mut dst, &value).unwrap();
22693            dst
22694        };
22695        let request_size = request_value_reader
22696            .seek(std::io::SeekFrom::End(0))
22697            .unwrap();
22698        request_value_reader
22699            .seek(std::io::SeekFrom::Start(0))
22700            .unwrap();
22701
22702        loop {
22703            let token = match self
22704                .hub
22705                .auth
22706                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22707                .await
22708            {
22709                Ok(token) => token,
22710                Err(e) => match dlg.token(e) {
22711                    Ok(token) => token,
22712                    Err(e) => {
22713                        dlg.finished(false);
22714                        return Err(common::Error::MissingToken(e));
22715                    }
22716                },
22717            };
22718            request_value_reader
22719                .seek(std::io::SeekFrom::Start(0))
22720                .unwrap();
22721            let mut req_result = {
22722                let client = &self.hub.client;
22723                dlg.pre_request();
22724                let mut req_builder = hyper::Request::builder()
22725                    .method(hyper::Method::POST)
22726                    .uri(url.as_str())
22727                    .header(USER_AGENT, self.hub._user_agent.clone());
22728
22729                if let Some(token) = token.as_ref() {
22730                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22731                }
22732
22733                let request = req_builder
22734                    .header(CONTENT_TYPE, json_mime_type.to_string())
22735                    .header(CONTENT_LENGTH, request_size as u64)
22736                    .body(common::to_body(
22737                        request_value_reader.get_ref().clone().into(),
22738                    ));
22739
22740                client.request(request.unwrap()).await
22741            };
22742
22743            match req_result {
22744                Err(err) => {
22745                    if let common::Retry::After(d) = dlg.http_error(&err) {
22746                        sleep(d).await;
22747                        continue;
22748                    }
22749                    dlg.finished(false);
22750                    return Err(common::Error::HttpError(err));
22751                }
22752                Ok(res) => {
22753                    let (mut parts, body) = res.into_parts();
22754                    let mut body = common::Body::new(body);
22755                    if !parts.status.is_success() {
22756                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22757                        let error = serde_json::from_str(&common::to_string(&bytes));
22758                        let response = common::to_response(parts, bytes.into());
22759
22760                        if let common::Retry::After(d) =
22761                            dlg.http_failure(&response, error.as_ref().ok())
22762                        {
22763                            sleep(d).await;
22764                            continue;
22765                        }
22766
22767                        dlg.finished(false);
22768
22769                        return Err(match error {
22770                            Ok(value) => common::Error::BadRequest(value),
22771                            _ => common::Error::Failure(response),
22772                        });
22773                    }
22774                    let response = {
22775                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22776                        let encoded = common::to_string(&bytes);
22777                        match serde_json::from_str(&encoded) {
22778                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22779                            Err(error) => {
22780                                dlg.response_json_decode_error(&encoded, &error);
22781                                return Err(common::Error::JsonDecodeError(
22782                                    encoded.to_string(),
22783                                    error,
22784                                ));
22785                            }
22786                        }
22787                    };
22788
22789                    dlg.finished(true);
22790                    return Ok(response);
22791                }
22792            }
22793        }
22794    }
22795
22796    ///
22797    /// Sets the *request* property to the given value.
22798    ///
22799    /// Even though the property as already been set when instantiating this call,
22800    /// we provide this method for API completeness.
22801    pub fn request(
22802        mut self,
22803        new_value: TestIamPermissionsRequest,
22804    ) -> TagValueTestIamPermissionCall<'a, C> {
22805        self._request = new_value;
22806        self
22807    }
22808    /// 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.
22809    ///
22810    /// Sets the *resource* path property to the given value.
22811    ///
22812    /// Even though the property as already been set when instantiating this call,
22813    /// we provide this method for API completeness.
22814    pub fn resource(mut self, new_value: &str) -> TagValueTestIamPermissionCall<'a, C> {
22815        self._resource = new_value.to_string();
22816        self
22817    }
22818    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22819    /// while executing the actual API request.
22820    ///
22821    /// ````text
22822    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22823    /// ````
22824    ///
22825    /// Sets the *delegate* property to the given value.
22826    pub fn delegate(
22827        mut self,
22828        new_value: &'a mut dyn common::Delegate,
22829    ) -> TagValueTestIamPermissionCall<'a, C> {
22830        self._delegate = Some(new_value);
22831        self
22832    }
22833
22834    /// Set any additional parameter of the query string used in the request.
22835    /// It should be used to set parameters which are not yet available through their own
22836    /// setters.
22837    ///
22838    /// Please note that this method must not be used to set any of the known parameters
22839    /// which have their own setter method. If done anyway, the request will fail.
22840    ///
22841    /// # Additional Parameters
22842    ///
22843    /// * *$.xgafv* (query-string) - V1 error format.
22844    /// * *access_token* (query-string) - OAuth access token.
22845    /// * *alt* (query-string) - Data format for response.
22846    /// * *callback* (query-string) - JSONP
22847    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22848    /// * *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.
22849    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22850    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22851    /// * *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.
22852    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22853    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22854    pub fn param<T>(mut self, name: T, value: T) -> TagValueTestIamPermissionCall<'a, C>
22855    where
22856        T: AsRef<str>,
22857    {
22858        self._additional_params
22859            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22860        self
22861    }
22862
22863    /// Identifies the authorization scope for the method you are building.
22864    ///
22865    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22866    /// [`Scope::CloudPlatform`].
22867    ///
22868    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22869    /// tokens for more than one scope.
22870    ///
22871    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22872    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22873    /// sufficient, a read-write scope will do as well.
22874    pub fn add_scope<St>(mut self, scope: St) -> TagValueTestIamPermissionCall<'a, C>
22875    where
22876        St: AsRef<str>,
22877    {
22878        self._scopes.insert(String::from(scope.as_ref()));
22879        self
22880    }
22881    /// Identifies the authorization scope(s) for the method you are building.
22882    ///
22883    /// See [`Self::add_scope()`] for details.
22884    pub fn add_scopes<I, St>(mut self, scopes: I) -> TagValueTestIamPermissionCall<'a, C>
22885    where
22886        I: IntoIterator<Item = St>,
22887        St: AsRef<str>,
22888    {
22889        self._scopes
22890            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22891        self
22892    }
22893
22894    /// Removes all scopes, and no default scope will be used either.
22895    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22896    /// for details).
22897    pub fn clear_scopes(mut self) -> TagValueTestIamPermissionCall<'a, C> {
22898        self._scopes.clear();
22899        self
22900    }
22901}