google_deploymentmanager2/
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    /// View and manage your Google Cloud Platform management resources and deployment status information
23    NdevCloudman,
24
25    /// View your Google Cloud Platform management resources and deployment status information
26    NdevCloudmanReadonly,
27}
28
29impl AsRef<str> for Scope {
30    fn as_ref(&self) -> &str {
31        match *self {
32            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
33            Scope::CloudPlatformReadOnly => {
34                "https://www.googleapis.com/auth/cloud-platform.read-only"
35            }
36            Scope::NdevCloudman => "https://www.googleapis.com/auth/ndev.cloudman",
37            Scope::NdevCloudmanReadonly => "https://www.googleapis.com/auth/ndev.cloudman.readonly",
38        }
39    }
40}
41
42#[allow(clippy::derivable_impls)]
43impl Default for Scope {
44    fn default() -> Scope {
45        Scope::NdevCloudmanReadonly
46    }
47}
48
49// ########
50// HUB ###
51// ######
52
53/// Central instance to access all DeploymentManager related resource activities
54///
55/// # Examples
56///
57/// Instantiate a new hub
58///
59/// ```test_harness,no_run
60/// extern crate hyper;
61/// extern crate hyper_rustls;
62/// extern crate google_deploymentmanager2 as deploymentmanager2;
63/// use deploymentmanager2::api::Deployment;
64/// use deploymentmanager2::{Result, Error};
65/// # async fn dox() {
66/// use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
67///
68/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
69/// // `client_secret`, among other things.
70/// let secret: yup_oauth2::ApplicationSecret = Default::default();
71/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
72/// // unless you replace  `None` with the desired Flow.
73/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
74/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
75/// // retrieve them from storage.
76/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
77///     .with_native_roots()
78///     .unwrap()
79///     .https_only()
80///     .enable_http2()
81///     .build();
82///
83/// let executor = hyper_util::rt::TokioExecutor::new();
84/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
85///     secret,
86///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
87///     yup_oauth2::client::CustomHyperClientBuilder::from(
88///         hyper_util::client::legacy::Client::builder(executor).build(connector),
89///     ),
90/// ).build().await.unwrap();
91///
92/// let client = hyper_util::client::legacy::Client::builder(
93///     hyper_util::rt::TokioExecutor::new()
94/// )
95/// .build(
96///     hyper_rustls::HttpsConnectorBuilder::new()
97///         .with_native_roots()
98///         .unwrap()
99///         .https_or_http()
100///         .enable_http2()
101///         .build()
102/// );
103/// let mut hub = DeploymentManager::new(client, auth);
104/// // As the method needs a request, you would usually fill it with the desired information
105/// // into the respective structure. Some of the parts shown here might not be applicable !
106/// // Values shown here are possibly random and not representative !
107/// let mut req = Deployment::default();
108///
109/// // You can configure optional parameters by calling the respective setters at will, and
110/// // execute the final call using `doit()`.
111/// // Values shown here are possibly random and not representative !
112/// let result = hub.deployments().patch(req, "project", "deployment")
113///              .preview(true)
114///              .header_bypass_billing_filter(false)
115///              .delete_policy("amet")
116///              .create_policy("duo")
117///              .doit().await;
118///
119/// match result {
120///     Err(e) => match e {
121///         // The Error enum provides details about what exactly happened.
122///         // You can also just use its `Debug`, `Display` or `Error` traits
123///          Error::HttpError(_)
124///         |Error::Io(_)
125///         |Error::MissingAPIKey
126///         |Error::MissingToken(_)
127///         |Error::Cancelled
128///         |Error::UploadSizeLimitExceeded(_, _)
129///         |Error::Failure(_)
130///         |Error::BadRequest(_)
131///         |Error::FieldClash(_)
132///         |Error::JsonDecodeError(_, _) => println!("{}", e),
133///     },
134///     Ok(res) => println!("Success: {:?}", res),
135/// }
136/// # }
137/// ```
138#[derive(Clone)]
139pub struct DeploymentManager<C> {
140    pub client: common::Client<C>,
141    pub auth: Box<dyn common::GetToken>,
142    _user_agent: String,
143    _base_url: String,
144    _root_url: String,
145}
146
147impl<C> common::Hub for DeploymentManager<C> {}
148
149impl<'a, C> DeploymentManager<C> {
150    pub fn new<A: 'static + common::GetToken>(
151        client: common::Client<C>,
152        auth: A,
153    ) -> DeploymentManager<C> {
154        DeploymentManager {
155            client,
156            auth: Box::new(auth),
157            _user_agent: "google-api-rust-client/7.0.0".to_string(),
158            _base_url: "https://deploymentmanager.googleapis.com/".to_string(),
159            _root_url: "https://deploymentmanager.googleapis.com/".to_string(),
160        }
161    }
162
163    pub fn deployments(&'a self) -> DeploymentMethods<'a, C> {
164        DeploymentMethods { hub: self }
165    }
166    pub fn manifests(&'a self) -> ManifestMethods<'a, C> {
167        ManifestMethods { hub: self }
168    }
169    pub fn operations(&'a self) -> OperationMethods<'a, C> {
170        OperationMethods { hub: self }
171    }
172    pub fn resources(&'a self) -> ResourceMethods<'a, C> {
173        ResourceMethods { hub: self }
174    }
175    pub fn types(&'a self) -> TypeMethods<'a, C> {
176        TypeMethods { hub: self }
177    }
178
179    /// Set the user-agent header field to use in all requests to the server.
180    /// It defaults to `google-api-rust-client/7.0.0`.
181    ///
182    /// Returns the previously set user-agent.
183    pub fn user_agent(&mut self, agent_name: String) -> String {
184        std::mem::replace(&mut self._user_agent, agent_name)
185    }
186
187    /// Set the base url to use in all requests to the server.
188    /// It defaults to `https://deploymentmanager.googleapis.com/`.
189    ///
190    /// Returns the previously set base url.
191    pub fn base_url(&mut self, new_base_url: String) -> String {
192        std::mem::replace(&mut self._base_url, new_base_url)
193    }
194
195    /// Set the root url to use in all requests to the server.
196    /// It defaults to `https://deploymentmanager.googleapis.com/`.
197    ///
198    /// Returns the previously set root url.
199    pub fn root_url(&mut self, new_root_url: String) -> String {
200        std::mem::replace(&mut self._root_url, new_root_url)
201    }
202}
203
204// ############
205// SCHEMAS ###
206// ##########
207/// 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.
208///
209/// This type is not used in any activity, and only used as *part* of another schema.
210///
211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
212#[serde_with::serde_as]
213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
214pub struct AuditConfig {
215    /// The configuration for logging of each type of permission.
216    #[serde(rename = "auditLogConfigs")]
217    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
218    /// 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.
219    pub service: Option<String>,
220}
221
222impl common::Part for AuditConfig {}
223
224/// 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.
225///
226/// This type is not used in any activity, and only used as *part* of another schema.
227///
228#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
229#[serde_with::serde_as]
230#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
231pub struct AuditLogConfig {
232    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
233    #[serde(rename = "exemptedMembers")]
234    pub exempted_members: Option<Vec<String>>,
235    /// The log type that this config enables.
236    #[serde(rename = "logType")]
237    pub log_type: Option<String>,
238}
239
240impl common::Part for AuditLogConfig {}
241
242/// Associates `members`, or principals, with a `role`.
243///
244/// This type is not used in any activity, and only used as *part* of another schema.
245///
246#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
247#[serde_with::serde_as]
248#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
249pub struct Binding {
250    /// 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).
251    pub condition: Option<Expr>,
252    /// 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`.
253    pub members: Option<Vec<String>>,
254    /// 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).
255    pub role: Option<String>,
256}
257
258impl common::Part for Binding {}
259
260/// There is no detailed description.
261///
262/// This type is not used in any activity, and only used as *part* of another schema.
263///
264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
265#[serde_with::serde_as]
266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
267pub struct BulkInsertOperationStatus {
268    /// [Output Only] Count of VMs successfully created so far.
269    #[serde(rename = "createdVmCount")]
270    pub created_vm_count: Option<i32>,
271    /// [Output Only] Count of VMs that got deleted during rollback.
272    #[serde(rename = "deletedVmCount")]
273    pub deleted_vm_count: Option<i32>,
274    /// [Output Only] Count of VMs that started creating but encountered an error.
275    #[serde(rename = "failedToCreateVmCount")]
276    pub failed_to_create_vm_count: Option<i32>,
277    /// [Output Only] Creation status of BulkInsert operation - information if the flow is rolling forward or rolling back.
278    pub status: Option<String>,
279    /// [Output Only] Count of VMs originally planned to be created.
280    #[serde(rename = "targetVmCount")]
281    pub target_vm_count: Option<i32>,
282}
283
284impl common::Part for BulkInsertOperationStatus {}
285
286/// There is no detailed description.
287///
288/// This type is not used in any activity, and only used as *part* of another schema.
289///
290#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
291#[serde_with::serde_as]
292#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
293pub struct ConfigFile {
294    /// The contents of the file.
295    pub content: Option<String>,
296}
297
298impl common::Part for ConfigFile {}
299
300/// Describes additional debugging info.
301///
302/// This type is not used in any activity, and only used as *part* of another schema.
303///
304#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
305#[serde_with::serde_as]
306#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
307pub struct DebugInfo {
308    /// Additional debugging information provided by the server.
309    pub detail: Option<String>,
310    /// The stack trace entries indicating where the error occurred.
311    #[serde(rename = "stackEntries")]
312    pub stack_entries: Option<Vec<String>>,
313}
314
315impl common::Part for DebugInfo {}
316
317/// There is no detailed description.
318///
319/// # Activities
320///
321/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
322/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
323///
324/// * [cancel preview deployments](DeploymentCancelPreviewCall) (none)
325/// * [delete deployments](DeploymentDeleteCall) (none)
326/// * [get deployments](DeploymentGetCall) (response)
327/// * [get iam policy deployments](DeploymentGetIamPolicyCall) (none)
328/// * [insert deployments](DeploymentInsertCall) (request)
329/// * [list deployments](DeploymentListCall) (none)
330/// * [patch deployments](DeploymentPatchCall) (request)
331/// * [set iam policy deployments](DeploymentSetIamPolicyCall) (none)
332/// * [stop deployments](DeploymentStopCall) (none)
333/// * [test iam permissions deployments](DeploymentTestIamPermissionCall) (none)
334/// * [update deployments](DeploymentUpdateCall) (request)
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct Deployment {
339    /// An optional user-provided description of the deployment.
340    pub description: Option<String>,
341    /// Provides a fingerprint to use in requests to modify a deployment, such as `update()`, `stop()`, and `cancelPreview()` requests. A fingerprint is a randomly generated value that must be provided with `update()`, `stop()`, and `cancelPreview()` requests to perform optimistic locking. This ensures optimistic concurrency so that only one request happens at a time. The fingerprint is initially generated by Deployment Manager and changes after every request to modify data. To get the latest fingerprint value, perform a `get()` request to a deployment.
342    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
343    pub fingerprint: Option<Vec<u8>>,
344    /// no description provided
345    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
346    pub id: Option<u64>,
347    /// Output only. Creation timestamp in RFC3339 text format.
348    #[serde(rename = "insertTime")]
349    pub insert_time: Option<String>,
350    /// Map of One Platform labels; provided by the client when the resource is created or updated. Specifically: 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])?)?`.
351    pub labels: Option<Vec<DeploymentLabelEntry>>,
352    /// Output only. URL of the manifest representing the last manifest that was successfully deployed. If no manifest has been successfully deployed, this field will be absent.
353    pub manifest: Option<String>,
354    /// Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
355    pub name: Option<String>,
356    /// Output only. The Operation that most recently ran, or is currently running, on this deployment.
357    pub operation: Option<Operation>,
358    /// Output only. Server defined URL for the resource.
359    #[serde(rename = "selfLink")]
360    pub self_link: Option<String>,
361    /// [Input Only] The parameters that define your deployment, including the deployment configuration and relevant templates.
362    pub target: Option<TargetConfiguration>,
363    /// Output only. If Deployment Manager is currently updating or previewing an update to this deployment, the updated configuration appears here.
364    pub update: Option<DeploymentUpdate>,
365    /// Output only. Update timestamp in RFC3339 text format.
366    #[serde(rename = "updateTime")]
367    pub update_time: Option<String>,
368}
369
370impl common::RequestValue for Deployment {}
371impl common::Resource for Deployment {}
372impl common::ResponseResult for Deployment {}
373
374/// Label object for Deployments
375///
376/// This type is not used in any activity, and only used as *part* of another schema.
377///
378#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
379#[serde_with::serde_as]
380#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
381pub struct DeploymentLabelEntry {
382    /// Key of the label
383    pub key: Option<String>,
384    /// Value of the label
385    pub value: Option<String>,
386}
387
388impl common::Part for DeploymentLabelEntry {}
389
390/// There is no detailed description.
391///
392/// This type is not used in any activity, and only used as *part* of another schema.
393///
394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
395#[serde_with::serde_as]
396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
397pub struct DeploymentUpdate {
398    /// Output only. An optional user-provided description of the deployment after the current update has been applied.
399    pub description: Option<String>,
400    /// Map of One Platform labels; provided by the client when the resource is created or updated. Specifically: 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])?)?`.
401    pub labels: Option<Vec<DeploymentUpdateLabelEntry>>,
402    /// Output only. URL of the manifest representing the update configuration of this deployment.
403    pub manifest: Option<String>,
404}
405
406impl common::Part for DeploymentUpdate {}
407
408/// Label object for DeploymentUpdate
409///
410/// This type is not used in any activity, and only used as *part* of another schema.
411///
412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
413#[serde_with::serde_as]
414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
415pub struct DeploymentUpdateLabelEntry {
416    /// Key of the label
417    pub key: Option<String>,
418    /// Value of the label
419    pub value: Option<String>,
420}
421
422impl common::Part for DeploymentUpdateLabelEntry {}
423
424/// There is no detailed description.
425///
426/// # Activities
427///
428/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
429/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
430///
431/// * [cancel preview deployments](DeploymentCancelPreviewCall) (request)
432#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
433#[serde_with::serde_as]
434#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
435pub struct DeploymentsCancelPreviewRequest {
436    /// Specifies a fingerprint for `cancelPreview()` requests. A fingerprint is a randomly generated value that must be provided in `cancelPreview()` requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to cancel a preview, this would prevent one of the requests). The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a `get()` request on the deployment.
437    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
438    pub fingerprint: Option<Vec<u8>>,
439}
440
441impl common::RequestValue for DeploymentsCancelPreviewRequest {}
442
443/// A response containing a partial list of deployments and a page token used to build the next request if the request has been truncated.
444///
445/// # Activities
446///
447/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
448/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
449///
450/// * [list deployments](DeploymentListCall) (response)
451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
452#[serde_with::serde_as]
453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
454pub struct DeploymentsListResponse {
455    /// Output only. The deployments contained in this response.
456    pub deployments: Option<Vec<Deployment>>,
457    /// Output only. A token used to continue a truncated list request.
458    #[serde(rename = "nextPageToken")]
459    pub next_page_token: Option<String>,
460}
461
462impl common::ResponseResult for DeploymentsListResponse {}
463
464/// There is no detailed description.
465///
466/// # Activities
467///
468/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
469/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
470///
471/// * [stop deployments](DeploymentStopCall) (request)
472#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
473#[serde_with::serde_as]
474#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
475pub struct DeploymentsStopRequest {
476    /// Specifies a fingerprint for `stop()` requests. A fingerprint is a randomly generated value that must be provided in `stop()` requests to perform optimistic locking. This ensures optimistic concurrency so that the deployment does not have conflicting requests (e.g. if someone attempts to make a new update request while another user attempts to stop an ongoing update request, this would prevent a collision). The fingerprint is initially generated by Deployment Manager and changes after every request to modify a deployment. To get the latest fingerprint value, perform a `get()` request on the deployment.
477    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
478    pub fingerprint: Option<Vec<u8>>,
479}
480
481impl common::RequestValue for DeploymentsStopRequest {}
482
483/// Describes the cause of the error with structured details. Example of an error when contacting the "pubsub.googleapis.com" API when it is not enabled: { "reason": "API_DISABLED" "domain": "googleapis.com" "metadata": { "resource": "projects/123", "service": "pubsub.googleapis.com" } } This response indicates that the pubsub.googleapis.com API is not enabled. Example of an error that is returned when attempting to create a Spanner instance in a region that is out of stock: { "reason": "STOCKOUT" "domain": "spanner.googleapis.com", "metadata": { "availableRegions": "us-central1,us-east2" } }
484///
485/// This type is not used in any activity, and only used as *part* of another schema.
486///
487#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
488#[serde_with::serde_as]
489#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
490pub struct ErrorInfo {
491    /// The logical grouping to which the "reason" belongs. The error domain is typically the registered service name of the tool or product that generates the error. Example: "pubsub.googleapis.com". If the error is generated by some common infrastructure, the error domain must be a globally unique value that identifies the infrastructure. For Google API infrastructure, the error domain is "googleapis.com".
492    pub domain: Option<String>,
493    /// Additional structured details about this error. Keys must match a regular expression of `a-z+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request.
494    pub metadatas: Option<HashMap<String, String>>,
495    /// The reason of the error. This is a constant value that identifies the proximate cause of the error. Error reasons are unique within a particular domain of errors. This should be at most 63 characters and match a regular expression of `A-Z+[A-Z0-9]`, which represents UPPER_SNAKE_CASE.
496    pub reason: Option<String>,
497}
498
499impl common::Part for ErrorInfo {}
500
501/// 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.
502///
503/// This type is not used in any activity, and only used as *part* of another schema.
504///
505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
506#[serde_with::serde_as]
507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
508pub struct Expr {
509    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
510    pub description: Option<String>,
511    /// Textual representation of an expression in Common Expression Language syntax.
512    pub expression: Option<String>,
513    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
514    pub location: Option<String>,
515    /// 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.
516    pub title: Option<String>,
517}
518
519impl common::Part for Expr {}
520
521/// There is no detailed description.
522///
523/// This type is not used in any activity, and only used as *part* of another schema.
524///
525#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
526#[serde_with::serde_as]
527#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
528pub struct FirewallPolicyRuleOperationMetadata {
529    /// The priority allocated for the firewall policy rule if query parameters specified minPriority/maxPriority.
530    #[serde(rename = "allocatedPriority")]
531    pub allocated_priority: Option<i32>,
532}
533
534impl common::Part for FirewallPolicyRuleOperationMetadata {}
535
536/// There is no detailed description.
537///
538/// # Activities
539///
540/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
541/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
542///
543/// * [set iam policy deployments](DeploymentSetIamPolicyCall) (request)
544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
545#[serde_with::serde_as]
546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
547pub struct GlobalSetPolicyRequest {
548    /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify bindings.
549    pub bindings: Option<Vec<Binding>>,
550    /// Flatten Policy to create a backward compatible wire-format. Deprecated. Use 'policy' to specify the etag.
551    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
552    pub etag: Option<Vec<u8>>,
553    /// 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 in general a valid policy but certain services (like Projects) might reject them.
554    pub policy: Option<Policy>,
555    /// Update mask for the policy.
556    #[serde(rename = "updateMask")]
557    pub update_mask: Option<common::FieldMask>,
558}
559
560impl common::RequestValue for GlobalSetPolicyRequest {}
561
562/// Provides links to documentation or for performing an out of band action. For example, if a quota check failed with an error indicating the calling project hasn't enabled the accessed service, this can contain a URL pointing directly to the right place in the developer console to flip the bit.
563///
564/// This type is not used in any activity, and only used as *part* of another schema.
565///
566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
567#[serde_with::serde_as]
568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
569pub struct Help {
570    /// URL(s) pointing to additional information on handling the current error.
571    pub links: Option<Vec<HelpLink>>,
572}
573
574impl common::Part for Help {}
575
576/// Describes a URL link.
577///
578/// This type is not used in any activity, and only used as *part* of another schema.
579///
580#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
581#[serde_with::serde_as]
582#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
583pub struct HelpLink {
584    /// Describes what the link offers.
585    pub description: Option<String>,
586    /// The URL of the link.
587    pub url: Option<String>,
588}
589
590impl common::Part for HelpLink {}
591
592/// There is no detailed description.
593///
594/// This type is not used in any activity, and only used as *part* of another schema.
595///
596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
597#[serde_with::serde_as]
598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
599pub struct ImportFile {
600    /// The contents of the file.
601    pub content: Option<String>,
602    /// The name of the file.
603    pub name: Option<String>,
604}
605
606impl common::Part for ImportFile {}
607
608/// There is no detailed description.
609///
610/// This type is not used in any activity, and only used as *part* of another schema.
611///
612#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
613#[serde_with::serde_as]
614#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
615pub struct InstancesBulkInsertOperationMetadata {
616    /// [Output Only] The machine type of the VMs that were created used internally only by KCP flex bulk insert.
617    #[serde(rename = "machineType")]
618    pub machine_type: Option<String>,
619    /// Status information per location (location name is key). Example key: zones/us-central1-a
620    #[serde(rename = "perLocationStatus")]
621    pub per_location_status: Option<HashMap<String, BulkInsertOperationStatus>>,
622}
623
624impl common::Part for InstancesBulkInsertOperationMetadata {}
625
626/// Provides a localized error message that is safe to return to the user which can be attached to an RPC error.
627///
628/// This type is not used in any activity, and only used as *part* of another schema.
629///
630#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
631#[serde_with::serde_as]
632#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
633pub struct LocalizedMessage {
634    /// The locale used following the specification defined at https://www.rfc-editor.org/rfc/bcp/bcp47.txt. Examples are: "en-US", "fr-CH", "es-MX"
635    pub locale: Option<String>,
636    /// The localized error message in the above locale.
637    pub message: Option<String>,
638}
639
640impl common::Part for LocalizedMessage {}
641
642/// There is no detailed description.
643///
644/// # Activities
645///
646/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
647/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
648///
649/// * [get manifests](ManifestGetCall) (response)
650/// * [list manifests](ManifestListCall) (none)
651#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
652#[serde_with::serde_as]
653#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
654pub struct Manifest {
655    /// Output only. The YAML configuration for this manifest.
656    pub config: Option<ConfigFile>,
657    /// Output only. The fully-expanded configuration file, including any templates and references.
658    #[serde(rename = "expandedConfig")]
659    pub expanded_config: Option<String>,
660    /// no description provided
661    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
662    pub id: Option<u64>,
663    /// Output only. The imported files for this manifest.
664    pub imports: Option<Vec<ImportFile>>,
665    /// Output only. Creation timestamp in RFC3339 text format.
666    #[serde(rename = "insertTime")]
667    pub insert_time: Option<String>,
668    /// Output only. The YAML layout for this manifest.
669    pub layout: Option<String>,
670    /// Output only. The computed size of the fully expanded manifest.
671    #[serde(rename = "manifestSizeBytes")]
672    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
673    pub manifest_size_bytes: Option<i64>,
674    /// Output only. The size limit for expanded manifests in the project.
675    #[serde(rename = "manifestSizeLimitBytes")]
676    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
677    pub manifest_size_limit_bytes: Option<i64>,
678    /// Output only. The name of the manifest.
679    pub name: Option<String>,
680    /// Output only. Self link for the manifest.
681    #[serde(rename = "selfLink")]
682    pub self_link: Option<String>,
683}
684
685impl common::Resource for Manifest {}
686impl common::ResponseResult for Manifest {}
687
688/// A response containing a partial list of manifests and a page token used to build the next request if the request has been truncated.
689///
690/// # Activities
691///
692/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
693/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
694///
695/// * [list manifests](ManifestListCall) (response)
696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
697#[serde_with::serde_as]
698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
699pub struct ManifestsListResponse {
700    /// Output only. Manifests contained in this list response.
701    pub manifests: Option<Vec<Manifest>>,
702    /// Output only. A token used to continue a truncated list request.
703    #[serde(rename = "nextPageToken")]
704    pub next_page_token: Option<String>,
705}
706
707impl common::ResponseResult for ManifestsListResponse {}
708
709/// Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](https://cloud.google.com/compute/docs/reference/rest/{$api_version}/globalOperations) * [Regional](https://cloud.google.com/compute/docs/reference/rest/{$api_version}/regionOperations) * [Zonal](https://cloud.google.com/compute/docs/reference/rest/{$api_version}/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zoneOperations` resource. For more information, read Global, Regional, and Zonal Resources. Note that completed Operation resources have a limited retention period.
710///
711/// # Activities
712///
713/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
714/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
715///
716/// * [cancel preview deployments](DeploymentCancelPreviewCall) (response)
717/// * [delete deployments](DeploymentDeleteCall) (response)
718/// * [insert deployments](DeploymentInsertCall) (response)
719/// * [patch deployments](DeploymentPatchCall) (response)
720/// * [stop deployments](DeploymentStopCall) (response)
721/// * [update deployments](DeploymentUpdateCall) (response)
722/// * [get operations](OperationGetCall) (response)
723/// * [list operations](OperationListCall) (none)
724#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
725#[serde_with::serde_as]
726#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
727pub struct Operation {
728    /// [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise.
729    #[serde(rename = "clientOperationId")]
730    pub client_operation_id: Option<String>,
731    /// [Deprecated] This field is deprecated.
732    #[serde(rename = "creationTimestamp")]
733    pub creation_timestamp: Option<String>,
734    /// [Output Only] A textual description of the operation, which is set when the operation is created.
735    pub description: Option<String>,
736    /// [Output Only] The time that this operation was completed. This value is in RFC3339 text format.
737    #[serde(rename = "endTime")]
738    pub end_time: Option<String>,
739    /// [Output Only] If errors are generated during processing of the operation, this field will be populated.
740    pub error: Option<OperationError>,
741    /// no description provided
742    #[serde(rename = "firewallPolicyRuleOperationMetadata")]
743    pub firewall_policy_rule_operation_metadata: Option<FirewallPolicyRuleOperationMetadata>,
744    /// [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`.
745    #[serde(rename = "httpErrorMessage")]
746    pub http_error_message: Option<String>,
747    /// [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found.
748    #[serde(rename = "httpErrorStatusCode")]
749    pub http_error_status_code: Option<i32>,
750    /// [Output Only] The unique identifier for the operation. This identifier is defined by the server.
751    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
752    pub id: Option<u64>,
753    /// [Output Only] The time that this operation was requested. This value is in RFC3339 text format.
754    #[serde(rename = "insertTime")]
755    pub insert_time: Option<String>,
756    /// no description provided
757    #[serde(rename = "instancesBulkInsertOperationMetadata")]
758    pub instances_bulk_insert_operation_metadata: Option<InstancesBulkInsertOperationMetadata>,
759    /// Output only. [Output Only] Type of the resource. Always `compute#operation` for Operation resources.
760    pub kind: Option<String>,
761    /// [Output Only] Name of the operation.
762    pub name: Option<String>,
763    /// Output only. [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request.
764    #[serde(rename = "operationGroupId")]
765    pub operation_group_id: Option<String>,
766    /// [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on.
767    #[serde(rename = "operationType")]
768    pub operation_type: Option<String>,
769    /// [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses.
770    pub progress: Option<i32>,
771    /// [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations.
772    pub region: Option<String>,
773    /// [Output Only] Server-defined URL for the resource.
774    #[serde(rename = "selfLink")]
775    pub self_link: Option<String>,
776    /// Output only. [Output Only] Server-defined URL for this resource with the resource id.
777    #[serde(rename = "selfLinkWithId")]
778    pub self_link_with_id: Option<String>,
779    /// This field is used internally by the Autoscaler team and should not be promoted to "alpha/beta/v1".
780    #[serde(rename = "setAutoscalerLinkOperationMetadata")]
781    pub set_autoscaler_link_operation_metadata: Option<SetAutoscalerLinkOperationMetadata>,
782    /// Output only. [Output Only] If the operation is for projects.setCommonInstanceMetadata, this field will contain information on all underlying zonal actions and their state.
783    #[serde(rename = "setCommonInstanceMetadataOperationMetadata")]
784    pub set_common_instance_metadata_operation_metadata:
785        Option<SetCommonInstanceMetadataOperationMetadata>,
786    /// [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format.
787    #[serde(rename = "startTime")]
788    pub start_time: Option<String>,
789    /// [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`.
790    pub status: Option<String>,
791    /// [Output Only] An optional textual description of the current status of the operation.
792    #[serde(rename = "statusMessage")]
793    pub status_message: Option<String>,
794    /// [Output Only] The unique target ID, which identifies a specific incarnation of the target resource.
795    #[serde(rename = "targetId")]
796    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
797    pub target_id: Option<u64>,
798    /// [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the disk that the snapshot was created from.
799    #[serde(rename = "targetLink")]
800    pub target_link: Option<String>,
801    /// [Output Only] User who requested the operation, for example: `user@example.com` or `alice_smith_identifier (global/workforcePools/example-com-us-employees)`.
802    pub user: Option<String>,
803    /// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
804    pub warnings: Option<Vec<OperationWarnings>>,
805    /// [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations.
806    pub zone: Option<String>,
807}
808
809impl common::Resource for Operation {}
810impl common::ResponseResult for Operation {}
811
812/// A response containing a partial list of operations and a page token used to build the next request if the request has been truncated.
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/// * [list operations](OperationListCall) (response)
820#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
821#[serde_with::serde_as]
822#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
823pub struct OperationsListResponse {
824    /// Output only. A token used to continue a truncated list request.
825    #[serde(rename = "nextPageToken")]
826    pub next_page_token: Option<String>,
827    /// Output only. Operations contained in this list response.
828    pub operations: Option<Vec<Operation>>,
829}
830
831impl common::ResponseResult for OperationsListResponse {}
832
833/// 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/).
834///
835/// # Activities
836///
837/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
838/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
839///
840/// * [get iam policy deployments](DeploymentGetIamPolicyCall) (response)
841/// * [set iam policy deployments](DeploymentSetIamPolicyCall) (response)
842#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
843#[serde_with::serde_as]
844#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
845pub struct Policy {
846    /// Specifies cloud audit logging configuration for this policy.
847    #[serde(rename = "auditConfigs")]
848    pub audit_configs: Option<Vec<AuditConfig>>,
849    /// 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`.
850    pub bindings: Option<Vec<Binding>>,
851    /// `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.
852    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
853    pub etag: Option<Vec<u8>>,
854    /// 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).
855    pub version: Option<i32>,
856}
857
858impl common::ResponseResult for Policy {}
859
860/// Additional details for quota exceeded error for resource quota.
861///
862/// This type is not used in any activity, and only used as *part* of another schema.
863///
864#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
865#[serde_with::serde_as]
866#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
867pub struct QuotaExceededInfo {
868    /// The map holding related quota dimensions.
869    pub dimensions: Option<HashMap<String, String>>,
870    /// Future quota limit being rolled out. The limit's unit depends on the quota type or metric.
871    #[serde(rename = "futureLimit")]
872    pub future_limit: Option<f64>,
873    /// Current effective quota limit. The limit's unit depends on the quota type or metric.
874    pub limit: Option<f64>,
875    /// The name of the quota limit.
876    #[serde(rename = "limitName")]
877    pub limit_name: Option<String>,
878    /// The Compute Engine quota metric name.
879    #[serde(rename = "metricName")]
880    pub metric_name: Option<String>,
881    /// Rollout status of the future quota limit.
882    #[serde(rename = "rolloutStatus")]
883    pub rollout_status: Option<String>,
884}
885
886impl common::Part for QuotaExceededInfo {}
887
888/// There is no detailed description.
889///
890/// # Activities
891///
892/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
893/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
894///
895/// * [get resources](ResourceGetCall) (response)
896/// * [list resources](ResourceListCall) (none)
897#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
898#[serde_with::serde_as]
899#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
900pub struct Resource {
901    /// The Access Control Policy set on this resource.
902    #[serde(rename = "accessControl")]
903    pub access_control: Option<ResourceAccessControl>,
904    /// Output only. The evaluated properties of the resource with references expanded. Returned as serialized YAML.
905    #[serde(rename = "finalProperties")]
906    pub final_properties: Option<String>,
907    /// no description provided
908    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
909    pub id: Option<u64>,
910    /// Output only. Creation timestamp in RFC3339 text format.
911    #[serde(rename = "insertTime")]
912    pub insert_time: Option<String>,
913    /// Output only. URL of the manifest representing the current configuration of this resource.
914    pub manifest: Option<String>,
915    /// Output only. The name of the resource as it appears in the YAML config.
916    pub name: Option<String>,
917    /// Output only. The current properties of the resource before any references have been filled in. Returned as serialized YAML.
918    pub properties: Option<String>,
919    /// Output only. The type of the resource, for example `compute.v1.instance`, or `cloudfunctions.v1beta1.function`.
920    #[serde(rename = "type")]
921    pub type_: Option<String>,
922    /// Output only. If Deployment Manager is currently updating or previewing an update to this resource, the updated configuration appears here.
923    pub update: Option<ResourceUpdate>,
924    /// Output only. Update timestamp in RFC3339 text format.
925    #[serde(rename = "updateTime")]
926    pub update_time: Option<String>,
927    /// Output only. The URL of the actual resource.
928    pub url: Option<String>,
929    /// Output only. If warning messages are generated during processing of this resource, this field will be populated.
930    pub warnings: Option<Vec<ResourceWarnings>>,
931}
932
933impl common::Resource for Resource {}
934impl common::ResponseResult for Resource {}
935
936/// The access controls set on the resource.
937///
938/// This type is not used in any activity, and only used as *part* of another schema.
939///
940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
941#[serde_with::serde_as]
942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
943pub struct ResourceAccessControl {
944    /// The GCP IAM Policy to set on the resource.
945    #[serde(rename = "gcpIamPolicy")]
946    pub gcp_iam_policy: Option<String>,
947}
948
949impl common::Part for ResourceAccessControl {}
950
951/// There is no detailed description.
952///
953/// This type is not used in any activity, and only used as *part* of another schema.
954///
955#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
956#[serde_with::serde_as]
957#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
958pub struct ResourceUpdate {
959    /// The Access Control Policy to set on this resource after updating the resource itself.
960    #[serde(rename = "accessControl")]
961    pub access_control: Option<ResourceAccessControl>,
962    /// Output only. If errors are generated during update of the resource, this field will be populated.
963    pub error: Option<ResourceUpdateError>,
964    /// Output only. The expanded properties of the resource with reference values expanded. Returned as serialized YAML.
965    #[serde(rename = "finalProperties")]
966    pub final_properties: Option<String>,
967    /// Output only. The intent of the resource: `PREVIEW`, `UPDATE`, or `CANCEL`.
968    pub intent: Option<String>,
969    /// Output only. URL of the manifest representing the update configuration of this resource.
970    pub manifest: Option<String>,
971    /// Output only. The set of updated properties for this resource, before references are expanded. Returned as serialized YAML.
972    pub properties: Option<String>,
973    /// Output only. The state of the resource.
974    pub state: Option<String>,
975    /// Output only. If warning messages are generated during processing of this resource, this field will be populated.
976    pub warnings: Option<Vec<ResourceUpdateWarnings>>,
977}
978
979impl common::Part for ResourceUpdate {}
980
981/// A response containing a partial list of resources and a page token used to build the next request if the request has been truncated.
982///
983/// # Activities
984///
985/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
986/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
987///
988/// * [list resources](ResourceListCall) (response)
989#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
990#[serde_with::serde_as]
991#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
992pub struct ResourcesListResponse {
993    /// A token used to continue a truncated list request.
994    #[serde(rename = "nextPageToken")]
995    pub next_page_token: Option<String>,
996    /// Resources contained in this list response.
997    pub resources: Option<Vec<Resource>>,
998}
999
1000impl common::ResponseResult for ResourcesListResponse {}
1001
1002/// There is no detailed description.
1003///
1004/// This type is not used in any activity, and only used as *part* of another schema.
1005///
1006#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1007#[serde_with::serde_as]
1008#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1009pub struct SetAutoscalerLinkOperationMetadata {
1010    /// List of zonal IGM IDs part of the RMIG.
1011    #[serde(rename = "zonalIgmIds")]
1012    #[serde_as(as = "Option<Vec<serde_with::DisplayFromStr>>")]
1013    pub zonal_igm_ids: Option<Vec<i64>>,
1014    /// Map of zone to an ID of the zonal IGM belonging to the RMIG.
1015    #[serde(rename = "zoneToIgmIds")]
1016    #[serde_as(as = "Option<HashMap<_, serde_with::DisplayFromStr>>")]
1017    pub zone_to_igm_ids: Option<HashMap<String, i64>>,
1018}
1019
1020impl common::Part for SetAutoscalerLinkOperationMetadata {}
1021
1022/// There is no detailed description.
1023///
1024/// This type is not used in any activity, and only used as *part* of another schema.
1025///
1026#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1027#[serde_with::serde_as]
1028#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1029pub struct SetCommonInstanceMetadataOperationMetadata {
1030    /// [Output Only] The client operation id.
1031    #[serde(rename = "clientOperationId")]
1032    pub client_operation_id: Option<String>,
1033    /// [Output Only] Status information per location (location name is key). Example key: zones/us-central1-a
1034    #[serde(rename = "perLocationOperations")]
1035    pub per_location_operations:
1036        Option<HashMap<String, SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo>>,
1037}
1038
1039impl common::Part for SetCommonInstanceMetadataOperationMetadata {}
1040
1041/// There is no detailed description.
1042///
1043/// This type is not used in any activity, and only used as *part* of another schema.
1044///
1045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1046#[serde_with::serde_as]
1047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1048pub struct SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo {
1049    /// [Output Only] If state is `ABANDONED` or `FAILED`, this field is populated.
1050    pub error: Option<Status>,
1051    /// [Output Only] Status of the action, which can be one of the following: `PROPAGATING`, `PROPAGATED`, `ABANDONED`, `FAILED`, or `DONE`.
1052    pub state: Option<String>,
1053}
1054
1055impl common::Part for SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo {}
1056
1057/// 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).
1058///
1059/// This type is not used in any activity, and only used as *part* of another schema.
1060///
1061#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1062#[serde_with::serde_as]
1063#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1064pub struct Status {
1065    /// The status code, which should be an enum value of google.rpc.Code.
1066    pub code: Option<i32>,
1067    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1068    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1069    /// 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.
1070    pub message: Option<String>,
1071}
1072
1073impl common::Part for Status {}
1074
1075/// There is no detailed description.
1076///
1077/// This type is not used in any activity, and only used as *part* of another schema.
1078///
1079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1080#[serde_with::serde_as]
1081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1082pub struct TargetConfiguration {
1083    /// The configuration to use for this deployment.
1084    pub config: Option<ConfigFile>,
1085    /// Specifies any files to import for this configuration. This can be used to import templates or other files. For example, you might import a text file in order to use the file in a template.
1086    pub imports: Option<Vec<ImportFile>>,
1087}
1088
1089impl common::Part for TargetConfiguration {}
1090
1091/// There is no detailed description.
1092///
1093/// # Activities
1094///
1095/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1096/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1097///
1098/// * [test iam permissions deployments](DeploymentTestIamPermissionCall) (request)
1099#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1100#[serde_with::serde_as]
1101#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1102pub struct TestPermissionsRequest {
1103    /// The set of permissions to check for the 'resource'. Permissions with wildcards (such as '*' or 'storage.*') are not allowed.
1104    pub permissions: Option<Vec<String>>,
1105}
1106
1107impl common::RequestValue for TestPermissionsRequest {}
1108
1109/// There is no detailed description.
1110///
1111/// # Activities
1112///
1113/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1114/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1115///
1116/// * [test iam permissions deployments](DeploymentTestIamPermissionCall) (response)
1117#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1118#[serde_with::serde_as]
1119#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1120pub struct TestPermissionsResponse {
1121    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
1122    pub permissions: Option<Vec<String>>,
1123}
1124
1125impl common::ResponseResult for TestPermissionsResponse {}
1126
1127/// A resource type supported by Deployment Manager.
1128///
1129/// # Activities
1130///
1131/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1132/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1133///
1134/// * [list types](TypeListCall) (none)
1135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1136#[serde_with::serde_as]
1137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1138pub struct Type {
1139    /// no description provided
1140    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1141    pub id: Option<u64>,
1142    /// Output only. Creation timestamp in RFC3339 text format.
1143    #[serde(rename = "insertTime")]
1144    pub insert_time: Option<String>,
1145    /// Name of the type.
1146    pub name: Option<String>,
1147    /// Output only. The Operation that most recently ran, or is currently running, on this type.
1148    pub operation: Option<Operation>,
1149    /// Output only. Server defined URL for the resource.
1150    #[serde(rename = "selfLink")]
1151    pub self_link: Option<String>,
1152}
1153
1154impl common::Resource for Type {}
1155
1156/// A response that returns all Types supported by Deployment Manager
1157///
1158/// # Activities
1159///
1160/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1161/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1162///
1163/// * [list types](TypeListCall) (response)
1164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1165#[serde_with::serde_as]
1166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1167pub struct TypesListResponse {
1168    /// A token used to continue a truncated list request.
1169    #[serde(rename = "nextPageToken")]
1170    pub next_page_token: Option<String>,
1171    /// Output only. A list of resource types supported by Deployment Manager.
1172    pub types: Option<Vec<Type>>,
1173}
1174
1175impl common::ResponseResult for TypesListResponse {}
1176
1177/// [Output Only] If errors are generated during processing of the operation, this field will be populated.
1178///
1179/// This type is not used in any activity, and only used as *part* of another schema.
1180///
1181#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1182#[serde_with::serde_as]
1183#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1184pub struct OperationError {
1185    /// [Output Only] The array of errors encountered while processing this operation.
1186    pub errors: Option<Vec<OperationErrorErrors>>,
1187}
1188
1189impl common::NestedType for OperationError {}
1190impl common::Part for OperationError {}
1191
1192/// [Output Only] The array of errors encountered while processing this operation.
1193///
1194/// This type is not used in any activity, and only used as *part* of another schema.
1195///
1196#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1197#[serde_with::serde_as]
1198#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1199pub struct OperationErrorErrors {
1200    /// Output only. [Output Only] Optional error details WARNING: DO NOT MAKE VISIBLE This is for internal use-only (like componentization) (thus the visibility "none") and in case of public exposure it is strongly recommended to follow pattern of: https://aip.dev/193 and expose as details field.
1201    pub arguments: Option<Vec<String>>,
1202    /// [Output Only] The error type identifier for this error.
1203    pub code: Option<String>,
1204    /// no description provided
1205    #[serde(rename = "debugInfo")]
1206    pub debug_info: Option<DebugInfo>,
1207    /// [Output Only] An optional list of messages that contain the error details. There is a set of defined message types to use for providing details.The syntax depends on the error code. For example, QuotaExceededInfo will have details when the error code is QUOTA_EXCEEDED.
1208    #[serde(rename = "errorDetails")]
1209    pub error_details: Option<Vec<OperationErrorErrorsErrorDetails>>,
1210    /// [Output Only] Indicates the field in the request that caused the error. This property is optional.
1211    pub location: Option<String>,
1212    /// [Output Only] An optional, human-readable error message.
1213    pub message: Option<String>,
1214}
1215
1216impl common::NestedType for OperationErrorErrors {}
1217impl common::Part for OperationErrorErrors {}
1218
1219/// [Output Only] An optional list of messages that contain the error details. There is a set of defined message types to use for providing details.The syntax depends on the error code. For example, QuotaExceededInfo will have details when the error code is QUOTA_EXCEEDED.
1220///
1221/// This type is not used in any activity, and only used as *part* of another schema.
1222///
1223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1224#[serde_with::serde_as]
1225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1226pub struct OperationErrorErrorsErrorDetails {
1227    /// no description provided
1228    #[serde(rename = "errorInfo")]
1229    pub error_info: Option<ErrorInfo>,
1230    /// no description provided
1231    pub help: Option<Help>,
1232    /// no description provided
1233    #[serde(rename = "localizedMessage")]
1234    pub localized_message: Option<LocalizedMessage>,
1235    /// no description provided
1236    #[serde(rename = "quotaInfo")]
1237    pub quota_info: Option<QuotaExceededInfo>,
1238}
1239
1240impl common::NestedType for OperationErrorErrorsErrorDetails {}
1241impl common::Part for OperationErrorErrorsErrorDetails {}
1242
1243/// [Output Only] If warning messages are generated during processing of the operation, this field will be populated.
1244///
1245/// This type is not used in any activity, and only used as *part* of another schema.
1246///
1247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1248#[serde_with::serde_as]
1249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1250pub struct OperationWarnings {
1251    /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
1252    pub code: Option<String>,
1253    /// [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
1254    pub data: Option<Vec<OperationWarningsData>>,
1255    /// [Output Only] A human-readable description of the warning code.
1256    pub message: Option<String>,
1257}
1258
1259impl common::NestedType for OperationWarnings {}
1260impl common::Part for OperationWarnings {}
1261
1262/// [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
1263///
1264/// This type is not used in any activity, and only used as *part* of another schema.
1265///
1266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1267#[serde_with::serde_as]
1268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1269pub struct OperationWarningsData {
1270    /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding).
1271    pub key: Option<String>,
1272    /// [Output Only] A warning data value corresponding to the key.
1273    pub value: Option<String>,
1274}
1275
1276impl common::NestedType for OperationWarningsData {}
1277impl common::Part for OperationWarningsData {}
1278
1279/// Output only. If warning messages are generated during processing of this resource, this field will be populated.
1280///
1281/// This type is not used in any activity, and only used as *part* of another schema.
1282///
1283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1284#[serde_with::serde_as]
1285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1286pub struct ResourceWarnings {
1287    /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
1288    pub code: Option<String>,
1289    /// [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
1290    pub data: Option<Vec<ResourceWarningsData>>,
1291    /// [Output Only] A human-readable description of the warning code.
1292    pub message: Option<String>,
1293}
1294
1295impl common::NestedType for ResourceWarnings {}
1296impl common::Part for ResourceWarnings {}
1297
1298/// [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
1299///
1300/// This type is not used in any activity, and only used as *part* of another schema.
1301///
1302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1303#[serde_with::serde_as]
1304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1305pub struct ResourceWarningsData {
1306    /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding).
1307    pub key: Option<String>,
1308    /// [Output Only] A warning data value corresponding to the key.
1309    pub value: Option<String>,
1310}
1311
1312impl common::NestedType for ResourceWarningsData {}
1313impl common::Part for ResourceWarningsData {}
1314
1315/// Output only. If errors are generated during update of the resource, this field will be populated.
1316///
1317/// This type is not used in any activity, and only used as *part* of another schema.
1318///
1319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1320#[serde_with::serde_as]
1321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1322pub struct ResourceUpdateError {
1323    /// [Output Only] The array of errors encountered while processing this operation.
1324    pub errors: Option<Vec<ResourceUpdateErrorErrors>>,
1325}
1326
1327impl common::NestedType for ResourceUpdateError {}
1328impl common::Part for ResourceUpdateError {}
1329
1330/// [Output Only] The array of errors encountered while processing this operation.
1331///
1332/// This type is not used in any activity, and only used as *part* of another schema.
1333///
1334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1335#[serde_with::serde_as]
1336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1337pub struct ResourceUpdateErrorErrors {
1338    /// Output only. [Output Only] Optional error details WARNING: DO NOT MAKE VISIBLE This is for internal use-only (like componentization) (thus the visibility "none") and in case of public exposure it is strongly recommended to follow pattern of: https://aip.dev/193 and expose as details field.
1339    pub arguments: Option<Vec<String>>,
1340    /// [Output Only] The error type identifier for this error.
1341    pub code: Option<String>,
1342    /// no description provided
1343    #[serde(rename = "debugInfo")]
1344    pub debug_info: Option<DebugInfo>,
1345    /// [Output Only] An optional list of messages that contain the error details. There is a set of defined message types to use for providing details.The syntax depends on the error code. For example, QuotaExceededInfo will have details when the error code is QUOTA_EXCEEDED.
1346    #[serde(rename = "errorDetails")]
1347    pub error_details: Option<Vec<ResourceUpdateErrorErrorsErrorDetails>>,
1348    /// [Output Only] Indicates the field in the request that caused the error. This property is optional.
1349    pub location: Option<String>,
1350    /// [Output Only] An optional, human-readable error message.
1351    pub message: Option<String>,
1352}
1353
1354impl common::NestedType for ResourceUpdateErrorErrors {}
1355impl common::Part for ResourceUpdateErrorErrors {}
1356
1357/// [Output Only] An optional list of messages that contain the error details. There is a set of defined message types to use for providing details.The syntax depends on the error code. For example, QuotaExceededInfo will have details when the error code is QUOTA_EXCEEDED.
1358///
1359/// This type is not used in any activity, and only used as *part* of another schema.
1360///
1361#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1362#[serde_with::serde_as]
1363#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1364pub struct ResourceUpdateErrorErrorsErrorDetails {
1365    /// no description provided
1366    #[serde(rename = "errorInfo")]
1367    pub error_info: Option<ErrorInfo>,
1368    /// no description provided
1369    pub help: Option<Help>,
1370    /// no description provided
1371    #[serde(rename = "localizedMessage")]
1372    pub localized_message: Option<LocalizedMessage>,
1373    /// no description provided
1374    #[serde(rename = "quotaInfo")]
1375    pub quota_info: Option<QuotaExceededInfo>,
1376}
1377
1378impl common::NestedType for ResourceUpdateErrorErrorsErrorDetails {}
1379impl common::Part for ResourceUpdateErrorErrorsErrorDetails {}
1380
1381/// Output only. If warning messages are generated during processing of this resource, this field will be populated.
1382///
1383/// This type is not used in any activity, and only used as *part* of another schema.
1384///
1385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1386#[serde_with::serde_as]
1387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1388pub struct ResourceUpdateWarnings {
1389    /// [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
1390    pub code: Option<String>,
1391    /// [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
1392    pub data: Option<Vec<ResourceUpdateWarningsData>>,
1393    /// [Output Only] A human-readable description of the warning code.
1394    pub message: Option<String>,
1395}
1396
1397impl common::NestedType for ResourceUpdateWarnings {}
1398impl common::Part for ResourceUpdateWarnings {}
1399
1400/// [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" }
1401///
1402/// This type is not used in any activity, and only used as *part* of another schema.
1403///
1404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1405#[serde_with::serde_as]
1406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1407pub struct ResourceUpdateWarningsData {
1408    /// [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding).
1409    pub key: Option<String>,
1410    /// [Output Only] A warning data value corresponding to the key.
1411    pub value: Option<String>,
1412}
1413
1414impl common::NestedType for ResourceUpdateWarningsData {}
1415impl common::Part for ResourceUpdateWarningsData {}
1416
1417// ###################
1418// MethodBuilders ###
1419// #################
1420
1421/// A builder providing access to all methods supported on *deployment* resources.
1422/// It is not used directly, but through the [`DeploymentManager`] hub.
1423///
1424/// # Example
1425///
1426/// Instantiate a resource builder
1427///
1428/// ```test_harness,no_run
1429/// extern crate hyper;
1430/// extern crate hyper_rustls;
1431/// extern crate google_deploymentmanager2 as deploymentmanager2;
1432///
1433/// # async fn dox() {
1434/// use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1435///
1436/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1437/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1438///     .with_native_roots()
1439///     .unwrap()
1440///     .https_only()
1441///     .enable_http2()
1442///     .build();
1443///
1444/// let executor = hyper_util::rt::TokioExecutor::new();
1445/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1446///     secret,
1447///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1448///     yup_oauth2::client::CustomHyperClientBuilder::from(
1449///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1450///     ),
1451/// ).build().await.unwrap();
1452///
1453/// let client = hyper_util::client::legacy::Client::builder(
1454///     hyper_util::rt::TokioExecutor::new()
1455/// )
1456/// .build(
1457///     hyper_rustls::HttpsConnectorBuilder::new()
1458///         .with_native_roots()
1459///         .unwrap()
1460///         .https_or_http()
1461///         .enable_http2()
1462///         .build()
1463/// );
1464/// let mut hub = DeploymentManager::new(client, auth);
1465/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1466/// // like `cancel_preview(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `insert(...)`, `list(...)`, `patch(...)`, `set_iam_policy(...)`, `stop(...)`, `test_iam_permissions(...)` and `update(...)`
1467/// // to build up your call.
1468/// let rb = hub.deployments();
1469/// # }
1470/// ```
1471pub struct DeploymentMethods<'a, C>
1472where
1473    C: 'a,
1474{
1475    hub: &'a DeploymentManager<C>,
1476}
1477
1478impl<'a, C> common::MethodsBuilder for DeploymentMethods<'a, C> {}
1479
1480impl<'a, C> DeploymentMethods<'a, C> {
1481    /// Create a builder to help you perform the following task:
1482    ///
1483    /// Cancels and removes the preview currently associated with the deployment.
1484    ///
1485    /// # Arguments
1486    ///
1487    /// * `request` - No description provided.
1488    /// * `project` - The project ID for this request.
1489    /// * `deployment` - The name of the deployment for this request.
1490    pub fn cancel_preview(
1491        &self,
1492        request: DeploymentsCancelPreviewRequest,
1493        project: &str,
1494        deployment: &str,
1495    ) -> DeploymentCancelPreviewCall<'a, C> {
1496        DeploymentCancelPreviewCall {
1497            hub: self.hub,
1498            _request: request,
1499            _project: project.to_string(),
1500            _deployment: deployment.to_string(),
1501            _delegate: Default::default(),
1502            _additional_params: Default::default(),
1503            _scopes: Default::default(),
1504        }
1505    }
1506
1507    /// Create a builder to help you perform the following task:
1508    ///
1509    /// Deletes a deployment and all of the resources in the deployment.
1510    ///
1511    /// # Arguments
1512    ///
1513    /// * `project` - The project ID for this request.
1514    /// * `deployment` - The name of the deployment for this request.
1515    pub fn delete(&self, project: &str, deployment: &str) -> DeploymentDeleteCall<'a, C> {
1516        DeploymentDeleteCall {
1517            hub: self.hub,
1518            _project: project.to_string(),
1519            _deployment: deployment.to_string(),
1520            _header_bypass_billing_filter: Default::default(),
1521            _delete_policy: Default::default(),
1522            _delegate: Default::default(),
1523            _additional_params: Default::default(),
1524            _scopes: Default::default(),
1525        }
1526    }
1527
1528    /// Create a builder to help you perform the following task:
1529    ///
1530    /// Gets information about a specific deployment.
1531    ///
1532    /// # Arguments
1533    ///
1534    /// * `project` - The project ID for this request.
1535    /// * `deployment` - The name of the deployment for this request.
1536    pub fn get(&self, project: &str, deployment: &str) -> DeploymentGetCall<'a, C> {
1537        DeploymentGetCall {
1538            hub: self.hub,
1539            _project: project.to_string(),
1540            _deployment: deployment.to_string(),
1541            _header_bypass_billing_filter: Default::default(),
1542            _delegate: Default::default(),
1543            _additional_params: Default::default(),
1544            _scopes: Default::default(),
1545        }
1546    }
1547
1548    /// Create a builder to help you perform the following task:
1549    ///
1550    /// Gets the access control policy for a resource. May be empty if no such policy or resource exists.
1551    ///
1552    /// # Arguments
1553    ///
1554    /// * `project` - Project ID for this request.
1555    /// * `resource` - Name or id of the resource for this request.
1556    pub fn get_iam_policy(
1557        &self,
1558        project: &str,
1559        resource: &str,
1560    ) -> DeploymentGetIamPolicyCall<'a, C> {
1561        DeploymentGetIamPolicyCall {
1562            hub: self.hub,
1563            _project: project.to_string(),
1564            _resource: resource.to_string(),
1565            _options_requested_policy_version: Default::default(),
1566            _header_bypass_billing_filter: Default::default(),
1567            _delegate: Default::default(),
1568            _additional_params: Default::default(),
1569            _scopes: Default::default(),
1570        }
1571    }
1572
1573    /// Create a builder to help you perform the following task:
1574    ///
1575    /// Creates a deployment and all of the resources described by the deployment manifest.
1576    ///
1577    /// # Arguments
1578    ///
1579    /// * `request` - No description provided.
1580    /// * `project` - The project ID for this request.
1581    pub fn insert(&self, request: Deployment, project: &str) -> DeploymentInsertCall<'a, C> {
1582        DeploymentInsertCall {
1583            hub: self.hub,
1584            _request: request,
1585            _project: project.to_string(),
1586            _preview: Default::default(),
1587            _header_bypass_billing_filter: Default::default(),
1588            _create_policy: Default::default(),
1589            _delegate: Default::default(),
1590            _additional_params: Default::default(),
1591            _scopes: Default::default(),
1592        }
1593    }
1594
1595    /// Create a builder to help you perform the following task:
1596    ///
1597    /// Lists all deployments for a given project.
1598    ///
1599    /// # Arguments
1600    ///
1601    /// * `project` - The project ID for this request.
1602    pub fn list(&self, project: &str) -> DeploymentListCall<'a, C> {
1603        DeploymentListCall {
1604            hub: self.hub,
1605            _project: project.to_string(),
1606            _page_token: Default::default(),
1607            _order_by: Default::default(),
1608            _max_results: Default::default(),
1609            _filter: Default::default(),
1610            _delegate: Default::default(),
1611            _additional_params: Default::default(),
1612            _scopes: Default::default(),
1613        }
1614    }
1615
1616    /// Create a builder to help you perform the following task:
1617    ///
1618    /// Patches a deployment and all of the resources described by the deployment manifest.
1619    ///
1620    /// # Arguments
1621    ///
1622    /// * `request` - No description provided.
1623    /// * `project` - The project ID for this request.
1624    /// * `deployment` - The name of the deployment for this request.
1625    pub fn patch(
1626        &self,
1627        request: Deployment,
1628        project: &str,
1629        deployment: &str,
1630    ) -> DeploymentPatchCall<'a, C> {
1631        DeploymentPatchCall {
1632            hub: self.hub,
1633            _request: request,
1634            _project: project.to_string(),
1635            _deployment: deployment.to_string(),
1636            _preview: Default::default(),
1637            _header_bypass_billing_filter: Default::default(),
1638            _delete_policy: Default::default(),
1639            _create_policy: Default::default(),
1640            _delegate: Default::default(),
1641            _additional_params: Default::default(),
1642            _scopes: Default::default(),
1643        }
1644    }
1645
1646    /// Create a builder to help you perform the following task:
1647    ///
1648    /// Sets the access control policy on the specified resource. Replaces any existing policy.
1649    ///
1650    /// # Arguments
1651    ///
1652    /// * `request` - No description provided.
1653    /// * `project` - Project ID for this request.
1654    /// * `resource` - Name or id of the resource for this request.
1655    pub fn set_iam_policy(
1656        &self,
1657        request: GlobalSetPolicyRequest,
1658        project: &str,
1659        resource: &str,
1660    ) -> DeploymentSetIamPolicyCall<'a, C> {
1661        DeploymentSetIamPolicyCall {
1662            hub: self.hub,
1663            _request: request,
1664            _project: project.to_string(),
1665            _resource: resource.to_string(),
1666            _delegate: Default::default(),
1667            _additional_params: Default::default(),
1668            _scopes: Default::default(),
1669        }
1670    }
1671
1672    /// Create a builder to help you perform the following task:
1673    ///
1674    /// Stops an ongoing operation. This does not roll back any work that has already been completed, but prevents any new work from being started.
1675    ///
1676    /// # Arguments
1677    ///
1678    /// * `request` - No description provided.
1679    /// * `project` - The project ID for this request.
1680    /// * `deployment` - The name of the deployment for this request.
1681    pub fn stop(
1682        &self,
1683        request: DeploymentsStopRequest,
1684        project: &str,
1685        deployment: &str,
1686    ) -> DeploymentStopCall<'a, C> {
1687        DeploymentStopCall {
1688            hub: self.hub,
1689            _request: request,
1690            _project: project.to_string(),
1691            _deployment: deployment.to_string(),
1692            _delegate: Default::default(),
1693            _additional_params: Default::default(),
1694            _scopes: Default::default(),
1695        }
1696    }
1697
1698    /// Create a builder to help you perform the following task:
1699    ///
1700    /// Returns permissions that a caller has on the specified resource.
1701    ///
1702    /// # Arguments
1703    ///
1704    /// * `request` - No description provided.
1705    /// * `project` - Project ID for this request.
1706    /// * `resource` - Name or id of the resource for this request.
1707    pub fn test_iam_permissions(
1708        &self,
1709        request: TestPermissionsRequest,
1710        project: &str,
1711        resource: &str,
1712    ) -> DeploymentTestIamPermissionCall<'a, C> {
1713        DeploymentTestIamPermissionCall {
1714            hub: self.hub,
1715            _request: request,
1716            _project: project.to_string(),
1717            _resource: resource.to_string(),
1718            _header_bypass_billing_filter: Default::default(),
1719            _delegate: Default::default(),
1720            _additional_params: Default::default(),
1721            _scopes: Default::default(),
1722        }
1723    }
1724
1725    /// Create a builder to help you perform the following task:
1726    ///
1727    /// Updates a deployment and all of the resources described by the deployment manifest.
1728    ///
1729    /// # Arguments
1730    ///
1731    /// * `request` - No description provided.
1732    /// * `project` - The project ID for this request.
1733    /// * `deployment` - The name of the deployment for this request.
1734    pub fn update(
1735        &self,
1736        request: Deployment,
1737        project: &str,
1738        deployment: &str,
1739    ) -> DeploymentUpdateCall<'a, C> {
1740        DeploymentUpdateCall {
1741            hub: self.hub,
1742            _request: request,
1743            _project: project.to_string(),
1744            _deployment: deployment.to_string(),
1745            _preview: Default::default(),
1746            _header_bypass_billing_filter: Default::default(),
1747            _delete_policy: Default::default(),
1748            _create_policy: Default::default(),
1749            _delegate: Default::default(),
1750            _additional_params: Default::default(),
1751            _scopes: Default::default(),
1752        }
1753    }
1754}
1755
1756/// A builder providing access to all methods supported on *manifest* resources.
1757/// It is not used directly, but through the [`DeploymentManager`] hub.
1758///
1759/// # Example
1760///
1761/// Instantiate a resource builder
1762///
1763/// ```test_harness,no_run
1764/// extern crate hyper;
1765/// extern crate hyper_rustls;
1766/// extern crate google_deploymentmanager2 as deploymentmanager2;
1767///
1768/// # async fn dox() {
1769/// use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1770///
1771/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1772/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1773///     .with_native_roots()
1774///     .unwrap()
1775///     .https_only()
1776///     .enable_http2()
1777///     .build();
1778///
1779/// let executor = hyper_util::rt::TokioExecutor::new();
1780/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1781///     secret,
1782///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1783///     yup_oauth2::client::CustomHyperClientBuilder::from(
1784///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1785///     ),
1786/// ).build().await.unwrap();
1787///
1788/// let client = hyper_util::client::legacy::Client::builder(
1789///     hyper_util::rt::TokioExecutor::new()
1790/// )
1791/// .build(
1792///     hyper_rustls::HttpsConnectorBuilder::new()
1793///         .with_native_roots()
1794///         .unwrap()
1795///         .https_or_http()
1796///         .enable_http2()
1797///         .build()
1798/// );
1799/// let mut hub = DeploymentManager::new(client, auth);
1800/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1801/// // like `get(...)` and `list(...)`
1802/// // to build up your call.
1803/// let rb = hub.manifests();
1804/// # }
1805/// ```
1806pub struct ManifestMethods<'a, C>
1807where
1808    C: 'a,
1809{
1810    hub: &'a DeploymentManager<C>,
1811}
1812
1813impl<'a, C> common::MethodsBuilder for ManifestMethods<'a, C> {}
1814
1815impl<'a, C> ManifestMethods<'a, C> {
1816    /// Create a builder to help you perform the following task:
1817    ///
1818    /// Gets information about a specific manifest.
1819    ///
1820    /// # Arguments
1821    ///
1822    /// * `project` - The project ID for this request.
1823    /// * `deployment` - The name of the deployment for this request.
1824    /// * `manifest` - The name of the manifest for this request.
1825    pub fn get(&self, project: &str, deployment: &str, manifest: &str) -> ManifestGetCall<'a, C> {
1826        ManifestGetCall {
1827            hub: self.hub,
1828            _project: project.to_string(),
1829            _deployment: deployment.to_string(),
1830            _manifest: manifest.to_string(),
1831            _header_bypass_billing_filter: Default::default(),
1832            _delegate: Default::default(),
1833            _additional_params: Default::default(),
1834            _scopes: Default::default(),
1835        }
1836    }
1837
1838    /// Create a builder to help you perform the following task:
1839    ///
1840    /// Lists all manifests for a given deployment.
1841    ///
1842    /// # Arguments
1843    ///
1844    /// * `project` - The project ID for this request.
1845    /// * `deployment` - The name of the deployment for this request.
1846    pub fn list(&self, project: &str, deployment: &str) -> ManifestListCall<'a, C> {
1847        ManifestListCall {
1848            hub: self.hub,
1849            _project: project.to_string(),
1850            _deployment: deployment.to_string(),
1851            _page_token: Default::default(),
1852            _order_by: Default::default(),
1853            _max_results: Default::default(),
1854            _filter: Default::default(),
1855            _delegate: Default::default(),
1856            _additional_params: Default::default(),
1857            _scopes: Default::default(),
1858        }
1859    }
1860}
1861
1862/// A builder providing access to all methods supported on *operation* resources.
1863/// It is not used directly, but through the [`DeploymentManager`] hub.
1864///
1865/// # Example
1866///
1867/// Instantiate a resource builder
1868///
1869/// ```test_harness,no_run
1870/// extern crate hyper;
1871/// extern crate hyper_rustls;
1872/// extern crate google_deploymentmanager2 as deploymentmanager2;
1873///
1874/// # async fn dox() {
1875/// use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1876///
1877/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1878/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1879///     .with_native_roots()
1880///     .unwrap()
1881///     .https_only()
1882///     .enable_http2()
1883///     .build();
1884///
1885/// let executor = hyper_util::rt::TokioExecutor::new();
1886/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1887///     secret,
1888///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1889///     yup_oauth2::client::CustomHyperClientBuilder::from(
1890///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1891///     ),
1892/// ).build().await.unwrap();
1893///
1894/// let client = hyper_util::client::legacy::Client::builder(
1895///     hyper_util::rt::TokioExecutor::new()
1896/// )
1897/// .build(
1898///     hyper_rustls::HttpsConnectorBuilder::new()
1899///         .with_native_roots()
1900///         .unwrap()
1901///         .https_or_http()
1902///         .enable_http2()
1903///         .build()
1904/// );
1905/// let mut hub = DeploymentManager::new(client, auth);
1906/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1907/// // like `get(...)` and `list(...)`
1908/// // to build up your call.
1909/// let rb = hub.operations();
1910/// # }
1911/// ```
1912pub struct OperationMethods<'a, C>
1913where
1914    C: 'a,
1915{
1916    hub: &'a DeploymentManager<C>,
1917}
1918
1919impl<'a, C> common::MethodsBuilder for OperationMethods<'a, C> {}
1920
1921impl<'a, C> OperationMethods<'a, C> {
1922    /// Create a builder to help you perform the following task:
1923    ///
1924    /// Gets information about a specific operation.
1925    ///
1926    /// # Arguments
1927    ///
1928    /// * `project` - The project ID for this request.
1929    /// * `operation` - The name of the operation for this request.
1930    pub fn get(&self, project: &str, operation: &str) -> OperationGetCall<'a, C> {
1931        OperationGetCall {
1932            hub: self.hub,
1933            _project: project.to_string(),
1934            _operation: operation.to_string(),
1935            _header_bypass_billing_filter: Default::default(),
1936            _delegate: Default::default(),
1937            _additional_params: Default::default(),
1938            _scopes: Default::default(),
1939        }
1940    }
1941
1942    /// Create a builder to help you perform the following task:
1943    ///
1944    /// Lists all operations for a project.
1945    ///
1946    /// # Arguments
1947    ///
1948    /// * `project` - The project ID for this request.
1949    pub fn list(&self, project: &str) -> OperationListCall<'a, C> {
1950        OperationListCall {
1951            hub: self.hub,
1952            _project: project.to_string(),
1953            _page_token: Default::default(),
1954            _order_by: Default::default(),
1955            _max_results: Default::default(),
1956            _filter: Default::default(),
1957            _delegate: Default::default(),
1958            _additional_params: Default::default(),
1959            _scopes: Default::default(),
1960        }
1961    }
1962}
1963
1964/// A builder providing access to all methods supported on *resource* resources.
1965/// It is not used directly, but through the [`DeploymentManager`] hub.
1966///
1967/// # Example
1968///
1969/// Instantiate a resource builder
1970///
1971/// ```test_harness,no_run
1972/// extern crate hyper;
1973/// extern crate hyper_rustls;
1974/// extern crate google_deploymentmanager2 as deploymentmanager2;
1975///
1976/// # async fn dox() {
1977/// use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1978///
1979/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1980/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1981///     .with_native_roots()
1982///     .unwrap()
1983///     .https_only()
1984///     .enable_http2()
1985///     .build();
1986///
1987/// let executor = hyper_util::rt::TokioExecutor::new();
1988/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1989///     secret,
1990///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1991///     yup_oauth2::client::CustomHyperClientBuilder::from(
1992///         hyper_util::client::legacy::Client::builder(executor).build(connector),
1993///     ),
1994/// ).build().await.unwrap();
1995///
1996/// let client = hyper_util::client::legacy::Client::builder(
1997///     hyper_util::rt::TokioExecutor::new()
1998/// )
1999/// .build(
2000///     hyper_rustls::HttpsConnectorBuilder::new()
2001///         .with_native_roots()
2002///         .unwrap()
2003///         .https_or_http()
2004///         .enable_http2()
2005///         .build()
2006/// );
2007/// let mut hub = DeploymentManager::new(client, auth);
2008/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2009/// // like `get(...)` and `list(...)`
2010/// // to build up your call.
2011/// let rb = hub.resources();
2012/// # }
2013/// ```
2014pub struct ResourceMethods<'a, C>
2015where
2016    C: 'a,
2017{
2018    hub: &'a DeploymentManager<C>,
2019}
2020
2021impl<'a, C> common::MethodsBuilder for ResourceMethods<'a, C> {}
2022
2023impl<'a, C> ResourceMethods<'a, C> {
2024    /// Create a builder to help you perform the following task:
2025    ///
2026    /// Gets information about a single resource.
2027    ///
2028    /// # Arguments
2029    ///
2030    /// * `project` - The project ID for this request.
2031    /// * `deployment` - The name of the deployment for this request.
2032    /// * `resource` - The name of the resource for this request.
2033    pub fn get(&self, project: &str, deployment: &str, resource: &str) -> ResourceGetCall<'a, C> {
2034        ResourceGetCall {
2035            hub: self.hub,
2036            _project: project.to_string(),
2037            _deployment: deployment.to_string(),
2038            _resource: resource.to_string(),
2039            _header_bypass_billing_filter: Default::default(),
2040            _delegate: Default::default(),
2041            _additional_params: Default::default(),
2042            _scopes: Default::default(),
2043        }
2044    }
2045
2046    /// Create a builder to help you perform the following task:
2047    ///
2048    /// Lists all resources in a given deployment.
2049    ///
2050    /// # Arguments
2051    ///
2052    /// * `project` - The project ID for this request.
2053    /// * `deployment` - The name of the deployment for this request.
2054    pub fn list(&self, project: &str, deployment: &str) -> ResourceListCall<'a, C> {
2055        ResourceListCall {
2056            hub: self.hub,
2057            _project: project.to_string(),
2058            _deployment: deployment.to_string(),
2059            _page_token: Default::default(),
2060            _order_by: Default::default(),
2061            _max_results: Default::default(),
2062            _filter: Default::default(),
2063            _delegate: Default::default(),
2064            _additional_params: Default::default(),
2065            _scopes: Default::default(),
2066        }
2067    }
2068}
2069
2070/// A builder providing access to all methods supported on *type* resources.
2071/// It is not used directly, but through the [`DeploymentManager`] hub.
2072///
2073/// # Example
2074///
2075/// Instantiate a resource builder
2076///
2077/// ```test_harness,no_run
2078/// extern crate hyper;
2079/// extern crate hyper_rustls;
2080/// extern crate google_deploymentmanager2 as deploymentmanager2;
2081///
2082/// # async fn dox() {
2083/// use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2084///
2085/// let secret: yup_oauth2::ApplicationSecret = Default::default();
2086/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
2087///     .with_native_roots()
2088///     .unwrap()
2089///     .https_only()
2090///     .enable_http2()
2091///     .build();
2092///
2093/// let executor = hyper_util::rt::TokioExecutor::new();
2094/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2095///     secret,
2096///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2097///     yup_oauth2::client::CustomHyperClientBuilder::from(
2098///         hyper_util::client::legacy::Client::builder(executor).build(connector),
2099///     ),
2100/// ).build().await.unwrap();
2101///
2102/// let client = hyper_util::client::legacy::Client::builder(
2103///     hyper_util::rt::TokioExecutor::new()
2104/// )
2105/// .build(
2106///     hyper_rustls::HttpsConnectorBuilder::new()
2107///         .with_native_roots()
2108///         .unwrap()
2109///         .https_or_http()
2110///         .enable_http2()
2111///         .build()
2112/// );
2113/// let mut hub = DeploymentManager::new(client, auth);
2114/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
2115/// // like `list(...)`
2116/// // to build up your call.
2117/// let rb = hub.types();
2118/// # }
2119/// ```
2120pub struct TypeMethods<'a, C>
2121where
2122    C: 'a,
2123{
2124    hub: &'a DeploymentManager<C>,
2125}
2126
2127impl<'a, C> common::MethodsBuilder for TypeMethods<'a, C> {}
2128
2129impl<'a, C> TypeMethods<'a, C> {
2130    /// Create a builder to help you perform the following task:
2131    ///
2132    /// Lists all resource types for Deployment Manager.
2133    ///
2134    /// # Arguments
2135    ///
2136    /// * `project` - The project ID for this request.
2137    pub fn list(&self, project: &str) -> TypeListCall<'a, C> {
2138        TypeListCall {
2139            hub: self.hub,
2140            _project: project.to_string(),
2141            _page_token: Default::default(),
2142            _order_by: Default::default(),
2143            _max_results: Default::default(),
2144            _filter: Default::default(),
2145            _delegate: Default::default(),
2146            _additional_params: Default::default(),
2147            _scopes: Default::default(),
2148        }
2149    }
2150}
2151
2152// ###################
2153// CallBuilders   ###
2154// #################
2155
2156/// Cancels and removes the preview currently associated with the deployment.
2157///
2158/// A builder for the *cancelPreview* method supported by a *deployment* resource.
2159/// It is not used directly, but through a [`DeploymentMethods`] instance.
2160///
2161/// # Example
2162///
2163/// Instantiate a resource method builder
2164///
2165/// ```test_harness,no_run
2166/// # extern crate hyper;
2167/// # extern crate hyper_rustls;
2168/// # extern crate google_deploymentmanager2 as deploymentmanager2;
2169/// use deploymentmanager2::api::DeploymentsCancelPreviewRequest;
2170/// # async fn dox() {
2171/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2172///
2173/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2174/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2175/// #     .with_native_roots()
2176/// #     .unwrap()
2177/// #     .https_only()
2178/// #     .enable_http2()
2179/// #     .build();
2180///
2181/// # let executor = hyper_util::rt::TokioExecutor::new();
2182/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2183/// #     secret,
2184/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2185/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2186/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2187/// #     ),
2188/// # ).build().await.unwrap();
2189///
2190/// # let client = hyper_util::client::legacy::Client::builder(
2191/// #     hyper_util::rt::TokioExecutor::new()
2192/// # )
2193/// # .build(
2194/// #     hyper_rustls::HttpsConnectorBuilder::new()
2195/// #         .with_native_roots()
2196/// #         .unwrap()
2197/// #         .https_or_http()
2198/// #         .enable_http2()
2199/// #         .build()
2200/// # );
2201/// # let mut hub = DeploymentManager::new(client, auth);
2202/// // As the method needs a request, you would usually fill it with the desired information
2203/// // into the respective structure. Some of the parts shown here might not be applicable !
2204/// // Values shown here are possibly random and not representative !
2205/// let mut req = DeploymentsCancelPreviewRequest::default();
2206///
2207/// // You can configure optional parameters by calling the respective setters at will, and
2208/// // execute the final call using `doit()`.
2209/// // Values shown here are possibly random and not representative !
2210/// let result = hub.deployments().cancel_preview(req, "project", "deployment")
2211///              .doit().await;
2212/// # }
2213/// ```
2214pub struct DeploymentCancelPreviewCall<'a, C>
2215where
2216    C: 'a,
2217{
2218    hub: &'a DeploymentManager<C>,
2219    _request: DeploymentsCancelPreviewRequest,
2220    _project: String,
2221    _deployment: String,
2222    _delegate: Option<&'a mut dyn common::Delegate>,
2223    _additional_params: HashMap<String, String>,
2224    _scopes: BTreeSet<String>,
2225}
2226
2227impl<'a, C> common::CallBuilder for DeploymentCancelPreviewCall<'a, C> {}
2228
2229impl<'a, C> DeploymentCancelPreviewCall<'a, C>
2230where
2231    C: common::Connector,
2232{
2233    /// Perform the operation you have build so far.
2234    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2235        use std::borrow::Cow;
2236        use std::io::{Read, Seek};
2237
2238        use common::{url::Params, ToParts};
2239        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2240
2241        let mut dd = common::DefaultDelegate;
2242        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2243        dlg.begin(common::MethodInfo {
2244            id: "deploymentmanager.deployments.cancelPreview",
2245            http_method: hyper::Method::POST,
2246        });
2247
2248        for &field in ["alt", "project", "deployment"].iter() {
2249            if self._additional_params.contains_key(field) {
2250                dlg.finished(false);
2251                return Err(common::Error::FieldClash(field));
2252            }
2253        }
2254
2255        let mut params = Params::with_capacity(5 + self._additional_params.len());
2256        params.push("project", self._project);
2257        params.push("deployment", self._deployment);
2258
2259        params.extend(self._additional_params.iter());
2260
2261        params.push("alt", "json");
2262        let mut url = self.hub._base_url.clone() + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}/cancelPreview";
2263        if self._scopes.is_empty() {
2264            self._scopes
2265                .insert(Scope::CloudPlatform.as_ref().to_string());
2266        }
2267
2268        #[allow(clippy::single_element_loop)]
2269        for &(find_this, param_name) in
2270            [("{project}", "project"), ("{deployment}", "deployment")].iter()
2271        {
2272            url = params.uri_replacement(url, param_name, find_this, false);
2273        }
2274        {
2275            let to_remove = ["deployment", "project"];
2276            params.remove_params(&to_remove);
2277        }
2278
2279        let url = params.parse_with_url(&url);
2280
2281        let mut json_mime_type = mime::APPLICATION_JSON;
2282        let mut request_value_reader = {
2283            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2284            common::remove_json_null_values(&mut value);
2285            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2286            serde_json::to_writer(&mut dst, &value).unwrap();
2287            dst
2288        };
2289        let request_size = request_value_reader
2290            .seek(std::io::SeekFrom::End(0))
2291            .unwrap();
2292        request_value_reader
2293            .seek(std::io::SeekFrom::Start(0))
2294            .unwrap();
2295
2296        loop {
2297            let token = match self
2298                .hub
2299                .auth
2300                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2301                .await
2302            {
2303                Ok(token) => token,
2304                Err(e) => match dlg.token(e) {
2305                    Ok(token) => token,
2306                    Err(e) => {
2307                        dlg.finished(false);
2308                        return Err(common::Error::MissingToken(e));
2309                    }
2310                },
2311            };
2312            request_value_reader
2313                .seek(std::io::SeekFrom::Start(0))
2314                .unwrap();
2315            let mut req_result = {
2316                let client = &self.hub.client;
2317                dlg.pre_request();
2318                let mut req_builder = hyper::Request::builder()
2319                    .method(hyper::Method::POST)
2320                    .uri(url.as_str())
2321                    .header(USER_AGENT, self.hub._user_agent.clone());
2322
2323                if let Some(token) = token.as_ref() {
2324                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2325                }
2326
2327                let request = req_builder
2328                    .header(CONTENT_TYPE, json_mime_type.to_string())
2329                    .header(CONTENT_LENGTH, request_size as u64)
2330                    .body(common::to_body(
2331                        request_value_reader.get_ref().clone().into(),
2332                    ));
2333
2334                client.request(request.unwrap()).await
2335            };
2336
2337            match req_result {
2338                Err(err) => {
2339                    if let common::Retry::After(d) = dlg.http_error(&err) {
2340                        sleep(d).await;
2341                        continue;
2342                    }
2343                    dlg.finished(false);
2344                    return Err(common::Error::HttpError(err));
2345                }
2346                Ok(res) => {
2347                    let (mut parts, body) = res.into_parts();
2348                    let mut body = common::Body::new(body);
2349                    if !parts.status.is_success() {
2350                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2351                        let error = serde_json::from_str(&common::to_string(&bytes));
2352                        let response = common::to_response(parts, bytes.into());
2353
2354                        if let common::Retry::After(d) =
2355                            dlg.http_failure(&response, error.as_ref().ok())
2356                        {
2357                            sleep(d).await;
2358                            continue;
2359                        }
2360
2361                        dlg.finished(false);
2362
2363                        return Err(match error {
2364                            Ok(value) => common::Error::BadRequest(value),
2365                            _ => common::Error::Failure(response),
2366                        });
2367                    }
2368                    let response = {
2369                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2370                        let encoded = common::to_string(&bytes);
2371                        match serde_json::from_str(&encoded) {
2372                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2373                            Err(error) => {
2374                                dlg.response_json_decode_error(&encoded, &error);
2375                                return Err(common::Error::JsonDecodeError(
2376                                    encoded.to_string(),
2377                                    error,
2378                                ));
2379                            }
2380                        }
2381                    };
2382
2383                    dlg.finished(true);
2384                    return Ok(response);
2385                }
2386            }
2387        }
2388    }
2389
2390    ///
2391    /// Sets the *request* property to the given value.
2392    ///
2393    /// Even though the property as already been set when instantiating this call,
2394    /// we provide this method for API completeness.
2395    pub fn request(
2396        mut self,
2397        new_value: DeploymentsCancelPreviewRequest,
2398    ) -> DeploymentCancelPreviewCall<'a, C> {
2399        self._request = new_value;
2400        self
2401    }
2402    /// The project ID for this request.
2403    ///
2404    /// Sets the *project* path property to the given value.
2405    ///
2406    /// Even though the property as already been set when instantiating this call,
2407    /// we provide this method for API completeness.
2408    pub fn project(mut self, new_value: &str) -> DeploymentCancelPreviewCall<'a, C> {
2409        self._project = new_value.to_string();
2410        self
2411    }
2412    /// The name of the deployment for this request.
2413    ///
2414    /// Sets the *deployment* path property to the given value.
2415    ///
2416    /// Even though the property as already been set when instantiating this call,
2417    /// we provide this method for API completeness.
2418    pub fn deployment(mut self, new_value: &str) -> DeploymentCancelPreviewCall<'a, C> {
2419        self._deployment = new_value.to_string();
2420        self
2421    }
2422    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2423    /// while executing the actual API request.
2424    ///
2425    /// ````text
2426    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2427    /// ````
2428    ///
2429    /// Sets the *delegate* property to the given value.
2430    pub fn delegate(
2431        mut self,
2432        new_value: &'a mut dyn common::Delegate,
2433    ) -> DeploymentCancelPreviewCall<'a, C> {
2434        self._delegate = Some(new_value);
2435        self
2436    }
2437
2438    /// Set any additional parameter of the query string used in the request.
2439    /// It should be used to set parameters which are not yet available through their own
2440    /// setters.
2441    ///
2442    /// Please note that this method must not be used to set any of the known parameters
2443    /// which have their own setter method. If done anyway, the request will fail.
2444    ///
2445    /// # Additional Parameters
2446    ///
2447    /// * *$.xgafv* (query-string) - V1 error format.
2448    /// * *access_token* (query-string) - OAuth access token.
2449    /// * *alt* (query-string) - Data format for response.
2450    /// * *callback* (query-string) - JSONP
2451    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2452    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2453    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2454    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2455    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2456    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2457    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2458    pub fn param<T>(mut self, name: T, value: T) -> DeploymentCancelPreviewCall<'a, C>
2459    where
2460        T: AsRef<str>,
2461    {
2462        self._additional_params
2463            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2464        self
2465    }
2466
2467    /// Identifies the authorization scope for the method you are building.
2468    ///
2469    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2470    /// [`Scope::CloudPlatform`].
2471    ///
2472    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2473    /// tokens for more than one scope.
2474    ///
2475    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2476    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2477    /// sufficient, a read-write scope will do as well.
2478    pub fn add_scope<St>(mut self, scope: St) -> DeploymentCancelPreviewCall<'a, C>
2479    where
2480        St: AsRef<str>,
2481    {
2482        self._scopes.insert(String::from(scope.as_ref()));
2483        self
2484    }
2485    /// Identifies the authorization scope(s) for the method you are building.
2486    ///
2487    /// See [`Self::add_scope()`] for details.
2488    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentCancelPreviewCall<'a, C>
2489    where
2490        I: IntoIterator<Item = St>,
2491        St: AsRef<str>,
2492    {
2493        self._scopes
2494            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2495        self
2496    }
2497
2498    /// Removes all scopes, and no default scope will be used either.
2499    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2500    /// for details).
2501    pub fn clear_scopes(mut self) -> DeploymentCancelPreviewCall<'a, C> {
2502        self._scopes.clear();
2503        self
2504    }
2505}
2506
2507/// Deletes a deployment and all of the resources in the deployment.
2508///
2509/// A builder for the *delete* method supported by a *deployment* resource.
2510/// It is not used directly, but through a [`DeploymentMethods`] instance.
2511///
2512/// # Example
2513///
2514/// Instantiate a resource method builder
2515///
2516/// ```test_harness,no_run
2517/// # extern crate hyper;
2518/// # extern crate hyper_rustls;
2519/// # extern crate google_deploymentmanager2 as deploymentmanager2;
2520/// # async fn dox() {
2521/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2522///
2523/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2524/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2525/// #     .with_native_roots()
2526/// #     .unwrap()
2527/// #     .https_only()
2528/// #     .enable_http2()
2529/// #     .build();
2530///
2531/// # let executor = hyper_util::rt::TokioExecutor::new();
2532/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2533/// #     secret,
2534/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2535/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2536/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2537/// #     ),
2538/// # ).build().await.unwrap();
2539///
2540/// # let client = hyper_util::client::legacy::Client::builder(
2541/// #     hyper_util::rt::TokioExecutor::new()
2542/// # )
2543/// # .build(
2544/// #     hyper_rustls::HttpsConnectorBuilder::new()
2545/// #         .with_native_roots()
2546/// #         .unwrap()
2547/// #         .https_or_http()
2548/// #         .enable_http2()
2549/// #         .build()
2550/// # );
2551/// # let mut hub = DeploymentManager::new(client, auth);
2552/// // You can configure optional parameters by calling the respective setters at will, and
2553/// // execute the final call using `doit()`.
2554/// // Values shown here are possibly random and not representative !
2555/// let result = hub.deployments().delete("project", "deployment")
2556///              .header_bypass_billing_filter(true)
2557///              .delete_policy("ipsum")
2558///              .doit().await;
2559/// # }
2560/// ```
2561pub struct DeploymentDeleteCall<'a, C>
2562where
2563    C: 'a,
2564{
2565    hub: &'a DeploymentManager<C>,
2566    _project: String,
2567    _deployment: String,
2568    _header_bypass_billing_filter: Option<bool>,
2569    _delete_policy: Option<String>,
2570    _delegate: Option<&'a mut dyn common::Delegate>,
2571    _additional_params: HashMap<String, String>,
2572    _scopes: BTreeSet<String>,
2573}
2574
2575impl<'a, C> common::CallBuilder for DeploymentDeleteCall<'a, C> {}
2576
2577impl<'a, C> DeploymentDeleteCall<'a, C>
2578where
2579    C: common::Connector,
2580{
2581    /// Perform the operation you have build so far.
2582    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
2583        use std::borrow::Cow;
2584        use std::io::{Read, Seek};
2585
2586        use common::{url::Params, ToParts};
2587        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2588
2589        let mut dd = common::DefaultDelegate;
2590        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2591        dlg.begin(common::MethodInfo {
2592            id: "deploymentmanager.deployments.delete",
2593            http_method: hyper::Method::DELETE,
2594        });
2595
2596        for &field in [
2597            "alt",
2598            "project",
2599            "deployment",
2600            "header.bypassBillingFilter",
2601            "deletePolicy",
2602        ]
2603        .iter()
2604        {
2605            if self._additional_params.contains_key(field) {
2606                dlg.finished(false);
2607                return Err(common::Error::FieldClash(field));
2608            }
2609        }
2610
2611        let mut params = Params::with_capacity(6 + self._additional_params.len());
2612        params.push("project", self._project);
2613        params.push("deployment", self._deployment);
2614        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
2615            params.push("header.bypassBillingFilter", value.to_string());
2616        }
2617        if let Some(value) = self._delete_policy.as_ref() {
2618            params.push("deletePolicy", value);
2619        }
2620
2621        params.extend(self._additional_params.iter());
2622
2623        params.push("alt", "json");
2624        let mut url = self.hub._base_url.clone()
2625            + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}";
2626        if self._scopes.is_empty() {
2627            self._scopes
2628                .insert(Scope::CloudPlatform.as_ref().to_string());
2629        }
2630
2631        #[allow(clippy::single_element_loop)]
2632        for &(find_this, param_name) in
2633            [("{project}", "project"), ("{deployment}", "deployment")].iter()
2634        {
2635            url = params.uri_replacement(url, param_name, find_this, false);
2636        }
2637        {
2638            let to_remove = ["deployment", "project"];
2639            params.remove_params(&to_remove);
2640        }
2641
2642        let url = params.parse_with_url(&url);
2643
2644        loop {
2645            let token = match self
2646                .hub
2647                .auth
2648                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2649                .await
2650            {
2651                Ok(token) => token,
2652                Err(e) => match dlg.token(e) {
2653                    Ok(token) => token,
2654                    Err(e) => {
2655                        dlg.finished(false);
2656                        return Err(common::Error::MissingToken(e));
2657                    }
2658                },
2659            };
2660            let mut req_result = {
2661                let client = &self.hub.client;
2662                dlg.pre_request();
2663                let mut req_builder = hyper::Request::builder()
2664                    .method(hyper::Method::DELETE)
2665                    .uri(url.as_str())
2666                    .header(USER_AGENT, self.hub._user_agent.clone());
2667
2668                if let Some(token) = token.as_ref() {
2669                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2670                }
2671
2672                let request = req_builder
2673                    .header(CONTENT_LENGTH, 0_u64)
2674                    .body(common::to_body::<String>(None));
2675
2676                client.request(request.unwrap()).await
2677            };
2678
2679            match req_result {
2680                Err(err) => {
2681                    if let common::Retry::After(d) = dlg.http_error(&err) {
2682                        sleep(d).await;
2683                        continue;
2684                    }
2685                    dlg.finished(false);
2686                    return Err(common::Error::HttpError(err));
2687                }
2688                Ok(res) => {
2689                    let (mut parts, body) = res.into_parts();
2690                    let mut body = common::Body::new(body);
2691                    if !parts.status.is_success() {
2692                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2693                        let error = serde_json::from_str(&common::to_string(&bytes));
2694                        let response = common::to_response(parts, bytes.into());
2695
2696                        if let common::Retry::After(d) =
2697                            dlg.http_failure(&response, error.as_ref().ok())
2698                        {
2699                            sleep(d).await;
2700                            continue;
2701                        }
2702
2703                        dlg.finished(false);
2704
2705                        return Err(match error {
2706                            Ok(value) => common::Error::BadRequest(value),
2707                            _ => common::Error::Failure(response),
2708                        });
2709                    }
2710                    let response = {
2711                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2712                        let encoded = common::to_string(&bytes);
2713                        match serde_json::from_str(&encoded) {
2714                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2715                            Err(error) => {
2716                                dlg.response_json_decode_error(&encoded, &error);
2717                                return Err(common::Error::JsonDecodeError(
2718                                    encoded.to_string(),
2719                                    error,
2720                                ));
2721                            }
2722                        }
2723                    };
2724
2725                    dlg.finished(true);
2726                    return Ok(response);
2727                }
2728            }
2729        }
2730    }
2731
2732    /// The project ID for this request.
2733    ///
2734    /// Sets the *project* path property to the given value.
2735    ///
2736    /// Even though the property as already been set when instantiating this call,
2737    /// we provide this method for API completeness.
2738    pub fn project(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
2739        self._project = new_value.to_string();
2740        self
2741    }
2742    /// The name of the deployment for this request.
2743    ///
2744    /// Sets the *deployment* path property to the given value.
2745    ///
2746    /// Even though the property as already been set when instantiating this call,
2747    /// we provide this method for API completeness.
2748    pub fn deployment(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
2749        self._deployment = new_value.to_string();
2750        self
2751    }
2752    ///
2753    /// Sets the *header.bypass billing filter* query property to the given value.
2754    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> DeploymentDeleteCall<'a, C> {
2755        self._header_bypass_billing_filter = Some(new_value);
2756        self
2757    }
2758    /// Sets the policy to use for deleting resources.
2759    ///
2760    /// Sets the *delete policy* query property to the given value.
2761    pub fn delete_policy(mut self, new_value: &str) -> DeploymentDeleteCall<'a, C> {
2762        self._delete_policy = Some(new_value.to_string());
2763        self
2764    }
2765    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2766    /// while executing the actual API request.
2767    ///
2768    /// ````text
2769    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2770    /// ````
2771    ///
2772    /// Sets the *delegate* property to the given value.
2773    pub fn delegate(
2774        mut self,
2775        new_value: &'a mut dyn common::Delegate,
2776    ) -> DeploymentDeleteCall<'a, C> {
2777        self._delegate = Some(new_value);
2778        self
2779    }
2780
2781    /// Set any additional parameter of the query string used in the request.
2782    /// It should be used to set parameters which are not yet available through their own
2783    /// setters.
2784    ///
2785    /// Please note that this method must not be used to set any of the known parameters
2786    /// which have their own setter method. If done anyway, the request will fail.
2787    ///
2788    /// # Additional Parameters
2789    ///
2790    /// * *$.xgafv* (query-string) - V1 error format.
2791    /// * *access_token* (query-string) - OAuth access token.
2792    /// * *alt* (query-string) - Data format for response.
2793    /// * *callback* (query-string) - JSONP
2794    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2795    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
2796    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2797    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2798    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
2799    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2800    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2801    pub fn param<T>(mut self, name: T, value: T) -> DeploymentDeleteCall<'a, C>
2802    where
2803        T: AsRef<str>,
2804    {
2805        self._additional_params
2806            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2807        self
2808    }
2809
2810    /// Identifies the authorization scope for the method you are building.
2811    ///
2812    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2813    /// [`Scope::CloudPlatform`].
2814    ///
2815    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2816    /// tokens for more than one scope.
2817    ///
2818    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2819    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2820    /// sufficient, a read-write scope will do as well.
2821    pub fn add_scope<St>(mut self, scope: St) -> DeploymentDeleteCall<'a, C>
2822    where
2823        St: AsRef<str>,
2824    {
2825        self._scopes.insert(String::from(scope.as_ref()));
2826        self
2827    }
2828    /// Identifies the authorization scope(s) for the method you are building.
2829    ///
2830    /// See [`Self::add_scope()`] for details.
2831    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentDeleteCall<'a, C>
2832    where
2833        I: IntoIterator<Item = St>,
2834        St: AsRef<str>,
2835    {
2836        self._scopes
2837            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2838        self
2839    }
2840
2841    /// Removes all scopes, and no default scope will be used either.
2842    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2843    /// for details).
2844    pub fn clear_scopes(mut self) -> DeploymentDeleteCall<'a, C> {
2845        self._scopes.clear();
2846        self
2847    }
2848}
2849
2850/// Gets information about a specific deployment.
2851///
2852/// A builder for the *get* method supported by a *deployment* resource.
2853/// It is not used directly, but through a [`DeploymentMethods`] instance.
2854///
2855/// # Example
2856///
2857/// Instantiate a resource method builder
2858///
2859/// ```test_harness,no_run
2860/// # extern crate hyper;
2861/// # extern crate hyper_rustls;
2862/// # extern crate google_deploymentmanager2 as deploymentmanager2;
2863/// # async fn dox() {
2864/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2865///
2866/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2867/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2868/// #     .with_native_roots()
2869/// #     .unwrap()
2870/// #     .https_only()
2871/// #     .enable_http2()
2872/// #     .build();
2873///
2874/// # let executor = hyper_util::rt::TokioExecutor::new();
2875/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2876/// #     secret,
2877/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2878/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
2879/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
2880/// #     ),
2881/// # ).build().await.unwrap();
2882///
2883/// # let client = hyper_util::client::legacy::Client::builder(
2884/// #     hyper_util::rt::TokioExecutor::new()
2885/// # )
2886/// # .build(
2887/// #     hyper_rustls::HttpsConnectorBuilder::new()
2888/// #         .with_native_roots()
2889/// #         .unwrap()
2890/// #         .https_or_http()
2891/// #         .enable_http2()
2892/// #         .build()
2893/// # );
2894/// # let mut hub = DeploymentManager::new(client, auth);
2895/// // You can configure optional parameters by calling the respective setters at will, and
2896/// // execute the final call using `doit()`.
2897/// // Values shown here are possibly random and not representative !
2898/// let result = hub.deployments().get("project", "deployment")
2899///              .header_bypass_billing_filter(true)
2900///              .doit().await;
2901/// # }
2902/// ```
2903pub struct DeploymentGetCall<'a, C>
2904where
2905    C: 'a,
2906{
2907    hub: &'a DeploymentManager<C>,
2908    _project: String,
2909    _deployment: String,
2910    _header_bypass_billing_filter: Option<bool>,
2911    _delegate: Option<&'a mut dyn common::Delegate>,
2912    _additional_params: HashMap<String, String>,
2913    _scopes: BTreeSet<String>,
2914}
2915
2916impl<'a, C> common::CallBuilder for DeploymentGetCall<'a, C> {}
2917
2918impl<'a, C> DeploymentGetCall<'a, C>
2919where
2920    C: common::Connector,
2921{
2922    /// Perform the operation you have build so far.
2923    pub async fn doit(mut self) -> common::Result<(common::Response, Deployment)> {
2924        use std::borrow::Cow;
2925        use std::io::{Read, Seek};
2926
2927        use common::{url::Params, ToParts};
2928        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2929
2930        let mut dd = common::DefaultDelegate;
2931        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2932        dlg.begin(common::MethodInfo {
2933            id: "deploymentmanager.deployments.get",
2934            http_method: hyper::Method::GET,
2935        });
2936
2937        for &field in ["alt", "project", "deployment", "header.bypassBillingFilter"].iter() {
2938            if self._additional_params.contains_key(field) {
2939                dlg.finished(false);
2940                return Err(common::Error::FieldClash(field));
2941            }
2942        }
2943
2944        let mut params = Params::with_capacity(5 + self._additional_params.len());
2945        params.push("project", self._project);
2946        params.push("deployment", self._deployment);
2947        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
2948            params.push("header.bypassBillingFilter", value.to_string());
2949        }
2950
2951        params.extend(self._additional_params.iter());
2952
2953        params.push("alt", "json");
2954        let mut url = self.hub._base_url.clone()
2955            + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}";
2956        if self._scopes.is_empty() {
2957            self._scopes
2958                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
2959        }
2960
2961        #[allow(clippy::single_element_loop)]
2962        for &(find_this, param_name) in
2963            [("{project}", "project"), ("{deployment}", "deployment")].iter()
2964        {
2965            url = params.uri_replacement(url, param_name, find_this, false);
2966        }
2967        {
2968            let to_remove = ["deployment", "project"];
2969            params.remove_params(&to_remove);
2970        }
2971
2972        let url = params.parse_with_url(&url);
2973
2974        loop {
2975            let token = match self
2976                .hub
2977                .auth
2978                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2979                .await
2980            {
2981                Ok(token) => token,
2982                Err(e) => match dlg.token(e) {
2983                    Ok(token) => token,
2984                    Err(e) => {
2985                        dlg.finished(false);
2986                        return Err(common::Error::MissingToken(e));
2987                    }
2988                },
2989            };
2990            let mut req_result = {
2991                let client = &self.hub.client;
2992                dlg.pre_request();
2993                let mut req_builder = hyper::Request::builder()
2994                    .method(hyper::Method::GET)
2995                    .uri(url.as_str())
2996                    .header(USER_AGENT, self.hub._user_agent.clone());
2997
2998                if let Some(token) = token.as_ref() {
2999                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3000                }
3001
3002                let request = req_builder
3003                    .header(CONTENT_LENGTH, 0_u64)
3004                    .body(common::to_body::<String>(None));
3005
3006                client.request(request.unwrap()).await
3007            };
3008
3009            match req_result {
3010                Err(err) => {
3011                    if let common::Retry::After(d) = dlg.http_error(&err) {
3012                        sleep(d).await;
3013                        continue;
3014                    }
3015                    dlg.finished(false);
3016                    return Err(common::Error::HttpError(err));
3017                }
3018                Ok(res) => {
3019                    let (mut parts, body) = res.into_parts();
3020                    let mut body = common::Body::new(body);
3021                    if !parts.status.is_success() {
3022                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3023                        let error = serde_json::from_str(&common::to_string(&bytes));
3024                        let response = common::to_response(parts, bytes.into());
3025
3026                        if let common::Retry::After(d) =
3027                            dlg.http_failure(&response, error.as_ref().ok())
3028                        {
3029                            sleep(d).await;
3030                            continue;
3031                        }
3032
3033                        dlg.finished(false);
3034
3035                        return Err(match error {
3036                            Ok(value) => common::Error::BadRequest(value),
3037                            _ => common::Error::Failure(response),
3038                        });
3039                    }
3040                    let response = {
3041                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3042                        let encoded = common::to_string(&bytes);
3043                        match serde_json::from_str(&encoded) {
3044                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3045                            Err(error) => {
3046                                dlg.response_json_decode_error(&encoded, &error);
3047                                return Err(common::Error::JsonDecodeError(
3048                                    encoded.to_string(),
3049                                    error,
3050                                ));
3051                            }
3052                        }
3053                    };
3054
3055                    dlg.finished(true);
3056                    return Ok(response);
3057                }
3058            }
3059        }
3060    }
3061
3062    /// The project ID for this request.
3063    ///
3064    /// Sets the *project* path property to the given value.
3065    ///
3066    /// Even though the property as already been set when instantiating this call,
3067    /// we provide this method for API completeness.
3068    pub fn project(mut self, new_value: &str) -> DeploymentGetCall<'a, C> {
3069        self._project = new_value.to_string();
3070        self
3071    }
3072    /// The name of the deployment for this request.
3073    ///
3074    /// Sets the *deployment* path property to the given value.
3075    ///
3076    /// Even though the property as already been set when instantiating this call,
3077    /// we provide this method for API completeness.
3078    pub fn deployment(mut self, new_value: &str) -> DeploymentGetCall<'a, C> {
3079        self._deployment = new_value.to_string();
3080        self
3081    }
3082    ///
3083    /// Sets the *header.bypass billing filter* query property to the given value.
3084    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> DeploymentGetCall<'a, C> {
3085        self._header_bypass_billing_filter = Some(new_value);
3086        self
3087    }
3088    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3089    /// while executing the actual API request.
3090    ///
3091    /// ````text
3092    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3093    /// ````
3094    ///
3095    /// Sets the *delegate* property to the given value.
3096    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> DeploymentGetCall<'a, C> {
3097        self._delegate = Some(new_value);
3098        self
3099    }
3100
3101    /// Set any additional parameter of the query string used in the request.
3102    /// It should be used to set parameters which are not yet available through their own
3103    /// setters.
3104    ///
3105    /// Please note that this method must not be used to set any of the known parameters
3106    /// which have their own setter method. If done anyway, the request will fail.
3107    ///
3108    /// # Additional Parameters
3109    ///
3110    /// * *$.xgafv* (query-string) - V1 error format.
3111    /// * *access_token* (query-string) - OAuth access token.
3112    /// * *alt* (query-string) - Data format for response.
3113    /// * *callback* (query-string) - JSONP
3114    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3115    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3116    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3117    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3118    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3119    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3120    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3121    pub fn param<T>(mut self, name: T, value: T) -> DeploymentGetCall<'a, C>
3122    where
3123        T: AsRef<str>,
3124    {
3125        self._additional_params
3126            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3127        self
3128    }
3129
3130    /// Identifies the authorization scope for the method you are building.
3131    ///
3132    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3133    /// [`Scope::NdevCloudmanReadonly`].
3134    ///
3135    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3136    /// tokens for more than one scope.
3137    ///
3138    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3139    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3140    /// sufficient, a read-write scope will do as well.
3141    pub fn add_scope<St>(mut self, scope: St) -> DeploymentGetCall<'a, C>
3142    where
3143        St: AsRef<str>,
3144    {
3145        self._scopes.insert(String::from(scope.as_ref()));
3146        self
3147    }
3148    /// Identifies the authorization scope(s) for the method you are building.
3149    ///
3150    /// See [`Self::add_scope()`] for details.
3151    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentGetCall<'a, C>
3152    where
3153        I: IntoIterator<Item = St>,
3154        St: AsRef<str>,
3155    {
3156        self._scopes
3157            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3158        self
3159    }
3160
3161    /// Removes all scopes, and no default scope will be used either.
3162    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3163    /// for details).
3164    pub fn clear_scopes(mut self) -> DeploymentGetCall<'a, C> {
3165        self._scopes.clear();
3166        self
3167    }
3168}
3169
3170/// Gets the access control policy for a resource. May be empty if no such policy or resource exists.
3171///
3172/// A builder for the *getIamPolicy* method supported by a *deployment* resource.
3173/// It is not used directly, but through a [`DeploymentMethods`] instance.
3174///
3175/// # Example
3176///
3177/// Instantiate a resource method builder
3178///
3179/// ```test_harness,no_run
3180/// # extern crate hyper;
3181/// # extern crate hyper_rustls;
3182/// # extern crate google_deploymentmanager2 as deploymentmanager2;
3183/// # async fn dox() {
3184/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3185///
3186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3187/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3188/// #     .with_native_roots()
3189/// #     .unwrap()
3190/// #     .https_only()
3191/// #     .enable_http2()
3192/// #     .build();
3193///
3194/// # let executor = hyper_util::rt::TokioExecutor::new();
3195/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3196/// #     secret,
3197/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3198/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3199/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3200/// #     ),
3201/// # ).build().await.unwrap();
3202///
3203/// # let client = hyper_util::client::legacy::Client::builder(
3204/// #     hyper_util::rt::TokioExecutor::new()
3205/// # )
3206/// # .build(
3207/// #     hyper_rustls::HttpsConnectorBuilder::new()
3208/// #         .with_native_roots()
3209/// #         .unwrap()
3210/// #         .https_or_http()
3211/// #         .enable_http2()
3212/// #         .build()
3213/// # );
3214/// # let mut hub = DeploymentManager::new(client, auth);
3215/// // You can configure optional parameters by calling the respective setters at will, and
3216/// // execute the final call using `doit()`.
3217/// // Values shown here are possibly random and not representative !
3218/// let result = hub.deployments().get_iam_policy("project", "resource")
3219///              .options_requested_policy_version(-56)
3220///              .header_bypass_billing_filter(false)
3221///              .doit().await;
3222/// # }
3223/// ```
3224pub struct DeploymentGetIamPolicyCall<'a, C>
3225where
3226    C: 'a,
3227{
3228    hub: &'a DeploymentManager<C>,
3229    _project: String,
3230    _resource: String,
3231    _options_requested_policy_version: Option<i32>,
3232    _header_bypass_billing_filter: Option<bool>,
3233    _delegate: Option<&'a mut dyn common::Delegate>,
3234    _additional_params: HashMap<String, String>,
3235    _scopes: BTreeSet<String>,
3236}
3237
3238impl<'a, C> common::CallBuilder for DeploymentGetIamPolicyCall<'a, C> {}
3239
3240impl<'a, C> DeploymentGetIamPolicyCall<'a, C>
3241where
3242    C: common::Connector,
3243{
3244    /// Perform the operation you have build so far.
3245    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
3246        use std::borrow::Cow;
3247        use std::io::{Read, Seek};
3248
3249        use common::{url::Params, ToParts};
3250        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3251
3252        let mut dd = common::DefaultDelegate;
3253        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3254        dlg.begin(common::MethodInfo {
3255            id: "deploymentmanager.deployments.getIamPolicy",
3256            http_method: hyper::Method::GET,
3257        });
3258
3259        for &field in [
3260            "alt",
3261            "project",
3262            "resource",
3263            "optionsRequestedPolicyVersion",
3264            "header.bypassBillingFilter",
3265        ]
3266        .iter()
3267        {
3268            if self._additional_params.contains_key(field) {
3269                dlg.finished(false);
3270                return Err(common::Error::FieldClash(field));
3271            }
3272        }
3273
3274        let mut params = Params::with_capacity(6 + self._additional_params.len());
3275        params.push("project", self._project);
3276        params.push("resource", self._resource);
3277        if let Some(value) = self._options_requested_policy_version.as_ref() {
3278            params.push("optionsRequestedPolicyVersion", value.to_string());
3279        }
3280        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
3281            params.push("header.bypassBillingFilter", value.to_string());
3282        }
3283
3284        params.extend(self._additional_params.iter());
3285
3286        params.push("alt", "json");
3287        let mut url = self.hub._base_url.clone()
3288            + "deploymentmanager/v2/projects/{project}/global/deployments/{resource}/getIamPolicy";
3289        if self._scopes.is_empty() {
3290            self._scopes
3291                .insert(Scope::CloudPlatform.as_ref().to_string());
3292        }
3293
3294        #[allow(clippy::single_element_loop)]
3295        for &(find_this, param_name) in
3296            [("{project}", "project"), ("{resource}", "resource")].iter()
3297        {
3298            url = params.uri_replacement(url, param_name, find_this, false);
3299        }
3300        {
3301            let to_remove = ["resource", "project"];
3302            params.remove_params(&to_remove);
3303        }
3304
3305        let url = params.parse_with_url(&url);
3306
3307        loop {
3308            let token = match self
3309                .hub
3310                .auth
3311                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3312                .await
3313            {
3314                Ok(token) => token,
3315                Err(e) => match dlg.token(e) {
3316                    Ok(token) => token,
3317                    Err(e) => {
3318                        dlg.finished(false);
3319                        return Err(common::Error::MissingToken(e));
3320                    }
3321                },
3322            };
3323            let mut req_result = {
3324                let client = &self.hub.client;
3325                dlg.pre_request();
3326                let mut req_builder = hyper::Request::builder()
3327                    .method(hyper::Method::GET)
3328                    .uri(url.as_str())
3329                    .header(USER_AGENT, self.hub._user_agent.clone());
3330
3331                if let Some(token) = token.as_ref() {
3332                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3333                }
3334
3335                let request = req_builder
3336                    .header(CONTENT_LENGTH, 0_u64)
3337                    .body(common::to_body::<String>(None));
3338
3339                client.request(request.unwrap()).await
3340            };
3341
3342            match req_result {
3343                Err(err) => {
3344                    if let common::Retry::After(d) = dlg.http_error(&err) {
3345                        sleep(d).await;
3346                        continue;
3347                    }
3348                    dlg.finished(false);
3349                    return Err(common::Error::HttpError(err));
3350                }
3351                Ok(res) => {
3352                    let (mut parts, body) = res.into_parts();
3353                    let mut body = common::Body::new(body);
3354                    if !parts.status.is_success() {
3355                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3356                        let error = serde_json::from_str(&common::to_string(&bytes));
3357                        let response = common::to_response(parts, bytes.into());
3358
3359                        if let common::Retry::After(d) =
3360                            dlg.http_failure(&response, error.as_ref().ok())
3361                        {
3362                            sleep(d).await;
3363                            continue;
3364                        }
3365
3366                        dlg.finished(false);
3367
3368                        return Err(match error {
3369                            Ok(value) => common::Error::BadRequest(value),
3370                            _ => common::Error::Failure(response),
3371                        });
3372                    }
3373                    let response = {
3374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3375                        let encoded = common::to_string(&bytes);
3376                        match serde_json::from_str(&encoded) {
3377                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3378                            Err(error) => {
3379                                dlg.response_json_decode_error(&encoded, &error);
3380                                return Err(common::Error::JsonDecodeError(
3381                                    encoded.to_string(),
3382                                    error,
3383                                ));
3384                            }
3385                        }
3386                    };
3387
3388                    dlg.finished(true);
3389                    return Ok(response);
3390                }
3391            }
3392        }
3393    }
3394
3395    /// Project ID for this request.
3396    ///
3397    /// Sets the *project* path property to the given value.
3398    ///
3399    /// Even though the property as already been set when instantiating this call,
3400    /// we provide this method for API completeness.
3401    pub fn project(mut self, new_value: &str) -> DeploymentGetIamPolicyCall<'a, C> {
3402        self._project = new_value.to_string();
3403        self
3404    }
3405    /// Name or id of the resource for this request.
3406    ///
3407    /// Sets the *resource* path property to the given value.
3408    ///
3409    /// Even though the property as already been set when instantiating this call,
3410    /// we provide this method for API completeness.
3411    pub fn resource(mut self, new_value: &str) -> DeploymentGetIamPolicyCall<'a, C> {
3412        self._resource = new_value.to_string();
3413        self
3414    }
3415    /// Requested IAM Policy version.
3416    ///
3417    /// Sets the *options requested policy version* query property to the given value.
3418    pub fn options_requested_policy_version(
3419        mut self,
3420        new_value: i32,
3421    ) -> DeploymentGetIamPolicyCall<'a, C> {
3422        self._options_requested_policy_version = Some(new_value);
3423        self
3424    }
3425    ///
3426    /// Sets the *header.bypass billing filter* query property to the given value.
3427    pub fn header_bypass_billing_filter(
3428        mut self,
3429        new_value: bool,
3430    ) -> DeploymentGetIamPolicyCall<'a, C> {
3431        self._header_bypass_billing_filter = Some(new_value);
3432        self
3433    }
3434    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3435    /// while executing the actual API request.
3436    ///
3437    /// ````text
3438    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3439    /// ````
3440    ///
3441    /// Sets the *delegate* property to the given value.
3442    pub fn delegate(
3443        mut self,
3444        new_value: &'a mut dyn common::Delegate,
3445    ) -> DeploymentGetIamPolicyCall<'a, C> {
3446        self._delegate = Some(new_value);
3447        self
3448    }
3449
3450    /// Set any additional parameter of the query string used in the request.
3451    /// It should be used to set parameters which are not yet available through their own
3452    /// setters.
3453    ///
3454    /// Please note that this method must not be used to set any of the known parameters
3455    /// which have their own setter method. If done anyway, the request will fail.
3456    ///
3457    /// # Additional Parameters
3458    ///
3459    /// * *$.xgafv* (query-string) - V1 error format.
3460    /// * *access_token* (query-string) - OAuth access token.
3461    /// * *alt* (query-string) - Data format for response.
3462    /// * *callback* (query-string) - JSONP
3463    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3464    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3465    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3466    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3467    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3468    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3469    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3470    pub fn param<T>(mut self, name: T, value: T) -> DeploymentGetIamPolicyCall<'a, C>
3471    where
3472        T: AsRef<str>,
3473    {
3474        self._additional_params
3475            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3476        self
3477    }
3478
3479    /// Identifies the authorization scope for the method you are building.
3480    ///
3481    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3482    /// [`Scope::CloudPlatform`].
3483    ///
3484    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3485    /// tokens for more than one scope.
3486    ///
3487    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3488    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3489    /// sufficient, a read-write scope will do as well.
3490    pub fn add_scope<St>(mut self, scope: St) -> DeploymentGetIamPolicyCall<'a, C>
3491    where
3492        St: AsRef<str>,
3493    {
3494        self._scopes.insert(String::from(scope.as_ref()));
3495        self
3496    }
3497    /// Identifies the authorization scope(s) for the method you are building.
3498    ///
3499    /// See [`Self::add_scope()`] for details.
3500    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentGetIamPolicyCall<'a, C>
3501    where
3502        I: IntoIterator<Item = St>,
3503        St: AsRef<str>,
3504    {
3505        self._scopes
3506            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3507        self
3508    }
3509
3510    /// Removes all scopes, and no default scope will be used either.
3511    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3512    /// for details).
3513    pub fn clear_scopes(mut self) -> DeploymentGetIamPolicyCall<'a, C> {
3514        self._scopes.clear();
3515        self
3516    }
3517}
3518
3519/// Creates a deployment and all of the resources described by the deployment manifest.
3520///
3521/// A builder for the *insert* method supported by a *deployment* resource.
3522/// It is not used directly, but through a [`DeploymentMethods`] instance.
3523///
3524/// # Example
3525///
3526/// Instantiate a resource method builder
3527///
3528/// ```test_harness,no_run
3529/// # extern crate hyper;
3530/// # extern crate hyper_rustls;
3531/// # extern crate google_deploymentmanager2 as deploymentmanager2;
3532/// use deploymentmanager2::api::Deployment;
3533/// # async fn dox() {
3534/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3535///
3536/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3537/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3538/// #     .with_native_roots()
3539/// #     .unwrap()
3540/// #     .https_only()
3541/// #     .enable_http2()
3542/// #     .build();
3543///
3544/// # let executor = hyper_util::rt::TokioExecutor::new();
3545/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3546/// #     secret,
3547/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3548/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3549/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3550/// #     ),
3551/// # ).build().await.unwrap();
3552///
3553/// # let client = hyper_util::client::legacy::Client::builder(
3554/// #     hyper_util::rt::TokioExecutor::new()
3555/// # )
3556/// # .build(
3557/// #     hyper_rustls::HttpsConnectorBuilder::new()
3558/// #         .with_native_roots()
3559/// #         .unwrap()
3560/// #         .https_or_http()
3561/// #         .enable_http2()
3562/// #         .build()
3563/// # );
3564/// # let mut hub = DeploymentManager::new(client, auth);
3565/// // As the method needs a request, you would usually fill it with the desired information
3566/// // into the respective structure. Some of the parts shown here might not be applicable !
3567/// // Values shown here are possibly random and not representative !
3568/// let mut req = Deployment::default();
3569///
3570/// // You can configure optional parameters by calling the respective setters at will, and
3571/// // execute the final call using `doit()`.
3572/// // Values shown here are possibly random and not representative !
3573/// let result = hub.deployments().insert(req, "project")
3574///              .preview(false)
3575///              .header_bypass_billing_filter(false)
3576///              .create_policy("no")
3577///              .doit().await;
3578/// # }
3579/// ```
3580pub struct DeploymentInsertCall<'a, C>
3581where
3582    C: 'a,
3583{
3584    hub: &'a DeploymentManager<C>,
3585    _request: Deployment,
3586    _project: String,
3587    _preview: Option<bool>,
3588    _header_bypass_billing_filter: Option<bool>,
3589    _create_policy: Option<String>,
3590    _delegate: Option<&'a mut dyn common::Delegate>,
3591    _additional_params: HashMap<String, String>,
3592    _scopes: BTreeSet<String>,
3593}
3594
3595impl<'a, C> common::CallBuilder for DeploymentInsertCall<'a, C> {}
3596
3597impl<'a, C> DeploymentInsertCall<'a, C>
3598where
3599    C: common::Connector,
3600{
3601    /// Perform the operation you have build so far.
3602    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
3603        use std::borrow::Cow;
3604        use std::io::{Read, Seek};
3605
3606        use common::{url::Params, ToParts};
3607        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3608
3609        let mut dd = common::DefaultDelegate;
3610        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3611        dlg.begin(common::MethodInfo {
3612            id: "deploymentmanager.deployments.insert",
3613            http_method: hyper::Method::POST,
3614        });
3615
3616        for &field in [
3617            "alt",
3618            "project",
3619            "preview",
3620            "header.bypassBillingFilter",
3621            "createPolicy",
3622        ]
3623        .iter()
3624        {
3625            if self._additional_params.contains_key(field) {
3626                dlg.finished(false);
3627                return Err(common::Error::FieldClash(field));
3628            }
3629        }
3630
3631        let mut params = Params::with_capacity(7 + self._additional_params.len());
3632        params.push("project", self._project);
3633        if let Some(value) = self._preview.as_ref() {
3634            params.push("preview", value.to_string());
3635        }
3636        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
3637            params.push("header.bypassBillingFilter", value.to_string());
3638        }
3639        if let Some(value) = self._create_policy.as_ref() {
3640            params.push("createPolicy", value);
3641        }
3642
3643        params.extend(self._additional_params.iter());
3644
3645        params.push("alt", "json");
3646        let mut url = self.hub._base_url.clone()
3647            + "deploymentmanager/v2/projects/{project}/global/deployments";
3648        if self._scopes.is_empty() {
3649            self._scopes
3650                .insert(Scope::CloudPlatform.as_ref().to_string());
3651        }
3652
3653        #[allow(clippy::single_element_loop)]
3654        for &(find_this, param_name) in [("{project}", "project")].iter() {
3655            url = params.uri_replacement(url, param_name, find_this, false);
3656        }
3657        {
3658            let to_remove = ["project"];
3659            params.remove_params(&to_remove);
3660        }
3661
3662        let url = params.parse_with_url(&url);
3663
3664        let mut json_mime_type = mime::APPLICATION_JSON;
3665        let mut request_value_reader = {
3666            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3667            common::remove_json_null_values(&mut value);
3668            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3669            serde_json::to_writer(&mut dst, &value).unwrap();
3670            dst
3671        };
3672        let request_size = request_value_reader
3673            .seek(std::io::SeekFrom::End(0))
3674            .unwrap();
3675        request_value_reader
3676            .seek(std::io::SeekFrom::Start(0))
3677            .unwrap();
3678
3679        loop {
3680            let token = match self
3681                .hub
3682                .auth
3683                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3684                .await
3685            {
3686                Ok(token) => token,
3687                Err(e) => match dlg.token(e) {
3688                    Ok(token) => token,
3689                    Err(e) => {
3690                        dlg.finished(false);
3691                        return Err(common::Error::MissingToken(e));
3692                    }
3693                },
3694            };
3695            request_value_reader
3696                .seek(std::io::SeekFrom::Start(0))
3697                .unwrap();
3698            let mut req_result = {
3699                let client = &self.hub.client;
3700                dlg.pre_request();
3701                let mut req_builder = hyper::Request::builder()
3702                    .method(hyper::Method::POST)
3703                    .uri(url.as_str())
3704                    .header(USER_AGENT, self.hub._user_agent.clone());
3705
3706                if let Some(token) = token.as_ref() {
3707                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3708                }
3709
3710                let request = req_builder
3711                    .header(CONTENT_TYPE, json_mime_type.to_string())
3712                    .header(CONTENT_LENGTH, request_size as u64)
3713                    .body(common::to_body(
3714                        request_value_reader.get_ref().clone().into(),
3715                    ));
3716
3717                client.request(request.unwrap()).await
3718            };
3719
3720            match req_result {
3721                Err(err) => {
3722                    if let common::Retry::After(d) = dlg.http_error(&err) {
3723                        sleep(d).await;
3724                        continue;
3725                    }
3726                    dlg.finished(false);
3727                    return Err(common::Error::HttpError(err));
3728                }
3729                Ok(res) => {
3730                    let (mut parts, body) = res.into_parts();
3731                    let mut body = common::Body::new(body);
3732                    if !parts.status.is_success() {
3733                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3734                        let error = serde_json::from_str(&common::to_string(&bytes));
3735                        let response = common::to_response(parts, bytes.into());
3736
3737                        if let common::Retry::After(d) =
3738                            dlg.http_failure(&response, error.as_ref().ok())
3739                        {
3740                            sleep(d).await;
3741                            continue;
3742                        }
3743
3744                        dlg.finished(false);
3745
3746                        return Err(match error {
3747                            Ok(value) => common::Error::BadRequest(value),
3748                            _ => common::Error::Failure(response),
3749                        });
3750                    }
3751                    let response = {
3752                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3753                        let encoded = common::to_string(&bytes);
3754                        match serde_json::from_str(&encoded) {
3755                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3756                            Err(error) => {
3757                                dlg.response_json_decode_error(&encoded, &error);
3758                                return Err(common::Error::JsonDecodeError(
3759                                    encoded.to_string(),
3760                                    error,
3761                                ));
3762                            }
3763                        }
3764                    };
3765
3766                    dlg.finished(true);
3767                    return Ok(response);
3768                }
3769            }
3770        }
3771    }
3772
3773    ///
3774    /// Sets the *request* property to the given value.
3775    ///
3776    /// Even though the property as already been set when instantiating this call,
3777    /// we provide this method for API completeness.
3778    pub fn request(mut self, new_value: Deployment) -> DeploymentInsertCall<'a, C> {
3779        self._request = new_value;
3780        self
3781    }
3782    /// The project ID for this request.
3783    ///
3784    /// Sets the *project* path property to the given value.
3785    ///
3786    /// Even though the property as already been set when instantiating this call,
3787    /// we provide this method for API completeness.
3788    pub fn project(mut self, new_value: &str) -> DeploymentInsertCall<'a, C> {
3789        self._project = new_value.to_string();
3790        self
3791    }
3792    /// If set to true, creates a deployment and creates "shell" resources but does not actually instantiate these resources. This allows you to preview what your deployment looks like. After previewing a deployment, you can deploy your resources by making a request with the `update()` method or you can use the `cancelPreview()` method to cancel the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it.
3793    ///
3794    /// Sets the *preview* query property to the given value.
3795    pub fn preview(mut self, new_value: bool) -> DeploymentInsertCall<'a, C> {
3796        self._preview = Some(new_value);
3797        self
3798    }
3799    ///
3800    /// Sets the *header.bypass billing filter* query property to the given value.
3801    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> DeploymentInsertCall<'a, C> {
3802        self._header_bypass_billing_filter = Some(new_value);
3803        self
3804    }
3805    /// Sets the policy to use for creating new resources.
3806    ///
3807    /// Sets the *create policy* query property to the given value.
3808    pub fn create_policy(mut self, new_value: &str) -> DeploymentInsertCall<'a, C> {
3809        self._create_policy = Some(new_value.to_string());
3810        self
3811    }
3812    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3813    /// while executing the actual API request.
3814    ///
3815    /// ````text
3816    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3817    /// ````
3818    ///
3819    /// Sets the *delegate* property to the given value.
3820    pub fn delegate(
3821        mut self,
3822        new_value: &'a mut dyn common::Delegate,
3823    ) -> DeploymentInsertCall<'a, C> {
3824        self._delegate = Some(new_value);
3825        self
3826    }
3827
3828    /// Set any additional parameter of the query string used in the request.
3829    /// It should be used to set parameters which are not yet available through their own
3830    /// setters.
3831    ///
3832    /// Please note that this method must not be used to set any of the known parameters
3833    /// which have their own setter method. If done anyway, the request will fail.
3834    ///
3835    /// # Additional Parameters
3836    ///
3837    /// * *$.xgafv* (query-string) - V1 error format.
3838    /// * *access_token* (query-string) - OAuth access token.
3839    /// * *alt* (query-string) - Data format for response.
3840    /// * *callback* (query-string) - JSONP
3841    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3842    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
3843    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3844    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3845    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
3846    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3847    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3848    pub fn param<T>(mut self, name: T, value: T) -> DeploymentInsertCall<'a, C>
3849    where
3850        T: AsRef<str>,
3851    {
3852        self._additional_params
3853            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3854        self
3855    }
3856
3857    /// Identifies the authorization scope for the method you are building.
3858    ///
3859    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3860    /// [`Scope::CloudPlatform`].
3861    ///
3862    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3863    /// tokens for more than one scope.
3864    ///
3865    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3866    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3867    /// sufficient, a read-write scope will do as well.
3868    pub fn add_scope<St>(mut self, scope: St) -> DeploymentInsertCall<'a, C>
3869    where
3870        St: AsRef<str>,
3871    {
3872        self._scopes.insert(String::from(scope.as_ref()));
3873        self
3874    }
3875    /// Identifies the authorization scope(s) for the method you are building.
3876    ///
3877    /// See [`Self::add_scope()`] for details.
3878    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentInsertCall<'a, C>
3879    where
3880        I: IntoIterator<Item = St>,
3881        St: AsRef<str>,
3882    {
3883        self._scopes
3884            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3885        self
3886    }
3887
3888    /// Removes all scopes, and no default scope will be used either.
3889    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3890    /// for details).
3891    pub fn clear_scopes(mut self) -> DeploymentInsertCall<'a, C> {
3892        self._scopes.clear();
3893        self
3894    }
3895}
3896
3897/// Lists all deployments for a given project.
3898///
3899/// A builder for the *list* method supported by a *deployment* resource.
3900/// It is not used directly, but through a [`DeploymentMethods`] instance.
3901///
3902/// # Example
3903///
3904/// Instantiate a resource method builder
3905///
3906/// ```test_harness,no_run
3907/// # extern crate hyper;
3908/// # extern crate hyper_rustls;
3909/// # extern crate google_deploymentmanager2 as deploymentmanager2;
3910/// # async fn dox() {
3911/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3912///
3913/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3914/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3915/// #     .with_native_roots()
3916/// #     .unwrap()
3917/// #     .https_only()
3918/// #     .enable_http2()
3919/// #     .build();
3920///
3921/// # let executor = hyper_util::rt::TokioExecutor::new();
3922/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3923/// #     secret,
3924/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3925/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
3926/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
3927/// #     ),
3928/// # ).build().await.unwrap();
3929///
3930/// # let client = hyper_util::client::legacy::Client::builder(
3931/// #     hyper_util::rt::TokioExecutor::new()
3932/// # )
3933/// # .build(
3934/// #     hyper_rustls::HttpsConnectorBuilder::new()
3935/// #         .with_native_roots()
3936/// #         .unwrap()
3937/// #         .https_or_http()
3938/// #         .enable_http2()
3939/// #         .build()
3940/// # );
3941/// # let mut hub = DeploymentManager::new(client, auth);
3942/// // You can configure optional parameters by calling the respective setters at will, and
3943/// // execute the final call using `doit()`.
3944/// // Values shown here are possibly random and not representative !
3945/// let result = hub.deployments().list("project")
3946///              .page_token("kasd")
3947///              .order_by("et")
3948///              .max_results(58)
3949///              .filter("et")
3950///              .doit().await;
3951/// # }
3952/// ```
3953pub struct DeploymentListCall<'a, C>
3954where
3955    C: 'a,
3956{
3957    hub: &'a DeploymentManager<C>,
3958    _project: String,
3959    _page_token: Option<String>,
3960    _order_by: Option<String>,
3961    _max_results: Option<u32>,
3962    _filter: Option<String>,
3963    _delegate: Option<&'a mut dyn common::Delegate>,
3964    _additional_params: HashMap<String, String>,
3965    _scopes: BTreeSet<String>,
3966}
3967
3968impl<'a, C> common::CallBuilder for DeploymentListCall<'a, C> {}
3969
3970impl<'a, C> DeploymentListCall<'a, C>
3971where
3972    C: common::Connector,
3973{
3974    /// Perform the operation you have build so far.
3975    pub async fn doit(mut self) -> common::Result<(common::Response, DeploymentsListResponse)> {
3976        use std::borrow::Cow;
3977        use std::io::{Read, Seek};
3978
3979        use common::{url::Params, ToParts};
3980        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3981
3982        let mut dd = common::DefaultDelegate;
3983        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3984        dlg.begin(common::MethodInfo {
3985            id: "deploymentmanager.deployments.list",
3986            http_method: hyper::Method::GET,
3987        });
3988
3989        for &field in [
3990            "alt",
3991            "project",
3992            "pageToken",
3993            "orderBy",
3994            "maxResults",
3995            "filter",
3996        ]
3997        .iter()
3998        {
3999            if self._additional_params.contains_key(field) {
4000                dlg.finished(false);
4001                return Err(common::Error::FieldClash(field));
4002            }
4003        }
4004
4005        let mut params = Params::with_capacity(7 + self._additional_params.len());
4006        params.push("project", self._project);
4007        if let Some(value) = self._page_token.as_ref() {
4008            params.push("pageToken", value);
4009        }
4010        if let Some(value) = self._order_by.as_ref() {
4011            params.push("orderBy", value);
4012        }
4013        if let Some(value) = self._max_results.as_ref() {
4014            params.push("maxResults", value.to_string());
4015        }
4016        if let Some(value) = self._filter.as_ref() {
4017            params.push("filter", value);
4018        }
4019
4020        params.extend(self._additional_params.iter());
4021
4022        params.push("alt", "json");
4023        let mut url = self.hub._base_url.clone()
4024            + "deploymentmanager/v2/projects/{project}/global/deployments";
4025        if self._scopes.is_empty() {
4026            self._scopes
4027                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
4028        }
4029
4030        #[allow(clippy::single_element_loop)]
4031        for &(find_this, param_name) in [("{project}", "project")].iter() {
4032            url = params.uri_replacement(url, param_name, find_this, false);
4033        }
4034        {
4035            let to_remove = ["project"];
4036            params.remove_params(&to_remove);
4037        }
4038
4039        let url = params.parse_with_url(&url);
4040
4041        loop {
4042            let token = match self
4043                .hub
4044                .auth
4045                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4046                .await
4047            {
4048                Ok(token) => token,
4049                Err(e) => match dlg.token(e) {
4050                    Ok(token) => token,
4051                    Err(e) => {
4052                        dlg.finished(false);
4053                        return Err(common::Error::MissingToken(e));
4054                    }
4055                },
4056            };
4057            let mut req_result = {
4058                let client = &self.hub.client;
4059                dlg.pre_request();
4060                let mut req_builder = hyper::Request::builder()
4061                    .method(hyper::Method::GET)
4062                    .uri(url.as_str())
4063                    .header(USER_AGENT, self.hub._user_agent.clone());
4064
4065                if let Some(token) = token.as_ref() {
4066                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4067                }
4068
4069                let request = req_builder
4070                    .header(CONTENT_LENGTH, 0_u64)
4071                    .body(common::to_body::<String>(None));
4072
4073                client.request(request.unwrap()).await
4074            };
4075
4076            match req_result {
4077                Err(err) => {
4078                    if let common::Retry::After(d) = dlg.http_error(&err) {
4079                        sleep(d).await;
4080                        continue;
4081                    }
4082                    dlg.finished(false);
4083                    return Err(common::Error::HttpError(err));
4084                }
4085                Ok(res) => {
4086                    let (mut parts, body) = res.into_parts();
4087                    let mut body = common::Body::new(body);
4088                    if !parts.status.is_success() {
4089                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4090                        let error = serde_json::from_str(&common::to_string(&bytes));
4091                        let response = common::to_response(parts, bytes.into());
4092
4093                        if let common::Retry::After(d) =
4094                            dlg.http_failure(&response, error.as_ref().ok())
4095                        {
4096                            sleep(d).await;
4097                            continue;
4098                        }
4099
4100                        dlg.finished(false);
4101
4102                        return Err(match error {
4103                            Ok(value) => common::Error::BadRequest(value),
4104                            _ => common::Error::Failure(response),
4105                        });
4106                    }
4107                    let response = {
4108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4109                        let encoded = common::to_string(&bytes);
4110                        match serde_json::from_str(&encoded) {
4111                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4112                            Err(error) => {
4113                                dlg.response_json_decode_error(&encoded, &error);
4114                                return Err(common::Error::JsonDecodeError(
4115                                    encoded.to_string(),
4116                                    error,
4117                                ));
4118                            }
4119                        }
4120                    };
4121
4122                    dlg.finished(true);
4123                    return Ok(response);
4124                }
4125            }
4126        }
4127    }
4128
4129    /// The project ID for this request.
4130    ///
4131    /// Sets the *project* path property to the given value.
4132    ///
4133    /// Even though the property as already been set when instantiating this call,
4134    /// we provide this method for API completeness.
4135    pub fn project(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
4136        self._project = new_value.to_string();
4137        self
4138    }
4139    /// Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
4140    ///
4141    /// Sets the *page token* query property to the given value.
4142    pub fn page_token(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
4143        self._page_token = Some(new_value.to_string());
4144        self
4145    }
4146    /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
4147    ///
4148    /// Sets the *order by* query property to the given value.
4149    pub fn order_by(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
4150        self._order_by = Some(new_value.to_string());
4151        self
4152    }
4153    /// The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
4154    ///
4155    /// Sets the *max results* query property to the given value.
4156    pub fn max_results(mut self, new_value: u32) -> DeploymentListCall<'a, C> {
4157        self._max_results = Some(new_value);
4158        self
4159    }
4160    /// A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
4161    ///
4162    /// Sets the *filter* query property to the given value.
4163    pub fn filter(mut self, new_value: &str) -> DeploymentListCall<'a, C> {
4164        self._filter = Some(new_value.to_string());
4165        self
4166    }
4167    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4168    /// while executing the actual API request.
4169    ///
4170    /// ````text
4171    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4172    /// ````
4173    ///
4174    /// Sets the *delegate* property to the given value.
4175    pub fn delegate(
4176        mut self,
4177        new_value: &'a mut dyn common::Delegate,
4178    ) -> DeploymentListCall<'a, C> {
4179        self._delegate = Some(new_value);
4180        self
4181    }
4182
4183    /// Set any additional parameter of the query string used in the request.
4184    /// It should be used to set parameters which are not yet available through their own
4185    /// setters.
4186    ///
4187    /// Please note that this method must not be used to set any of the known parameters
4188    /// which have their own setter method. If done anyway, the request will fail.
4189    ///
4190    /// # Additional Parameters
4191    ///
4192    /// * *$.xgafv* (query-string) - V1 error format.
4193    /// * *access_token* (query-string) - OAuth access token.
4194    /// * *alt* (query-string) - Data format for response.
4195    /// * *callback* (query-string) - JSONP
4196    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4197    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4198    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4199    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4200    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4201    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4202    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4203    pub fn param<T>(mut self, name: T, value: T) -> DeploymentListCall<'a, C>
4204    where
4205        T: AsRef<str>,
4206    {
4207        self._additional_params
4208            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4209        self
4210    }
4211
4212    /// Identifies the authorization scope for the method you are building.
4213    ///
4214    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4215    /// [`Scope::NdevCloudmanReadonly`].
4216    ///
4217    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4218    /// tokens for more than one scope.
4219    ///
4220    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4221    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4222    /// sufficient, a read-write scope will do as well.
4223    pub fn add_scope<St>(mut self, scope: St) -> DeploymentListCall<'a, C>
4224    where
4225        St: AsRef<str>,
4226    {
4227        self._scopes.insert(String::from(scope.as_ref()));
4228        self
4229    }
4230    /// Identifies the authorization scope(s) for the method you are building.
4231    ///
4232    /// See [`Self::add_scope()`] for details.
4233    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentListCall<'a, C>
4234    where
4235        I: IntoIterator<Item = St>,
4236        St: AsRef<str>,
4237    {
4238        self._scopes
4239            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4240        self
4241    }
4242
4243    /// Removes all scopes, and no default scope will be used either.
4244    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4245    /// for details).
4246    pub fn clear_scopes(mut self) -> DeploymentListCall<'a, C> {
4247        self._scopes.clear();
4248        self
4249    }
4250}
4251
4252/// Patches a deployment and all of the resources described by the deployment manifest.
4253///
4254/// A builder for the *patch* method supported by a *deployment* resource.
4255/// It is not used directly, but through a [`DeploymentMethods`] instance.
4256///
4257/// # Example
4258///
4259/// Instantiate a resource method builder
4260///
4261/// ```test_harness,no_run
4262/// # extern crate hyper;
4263/// # extern crate hyper_rustls;
4264/// # extern crate google_deploymentmanager2 as deploymentmanager2;
4265/// use deploymentmanager2::api::Deployment;
4266/// # async fn dox() {
4267/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4268///
4269/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4270/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4271/// #     .with_native_roots()
4272/// #     .unwrap()
4273/// #     .https_only()
4274/// #     .enable_http2()
4275/// #     .build();
4276///
4277/// # let executor = hyper_util::rt::TokioExecutor::new();
4278/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4279/// #     secret,
4280/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4281/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4282/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4283/// #     ),
4284/// # ).build().await.unwrap();
4285///
4286/// # let client = hyper_util::client::legacy::Client::builder(
4287/// #     hyper_util::rt::TokioExecutor::new()
4288/// # )
4289/// # .build(
4290/// #     hyper_rustls::HttpsConnectorBuilder::new()
4291/// #         .with_native_roots()
4292/// #         .unwrap()
4293/// #         .https_or_http()
4294/// #         .enable_http2()
4295/// #         .build()
4296/// # );
4297/// # let mut hub = DeploymentManager::new(client, auth);
4298/// // As the method needs a request, you would usually fill it with the desired information
4299/// // into the respective structure. Some of the parts shown here might not be applicable !
4300/// // Values shown here are possibly random and not representative !
4301/// let mut req = Deployment::default();
4302///
4303/// // You can configure optional parameters by calling the respective setters at will, and
4304/// // execute the final call using `doit()`.
4305/// // Values shown here are possibly random and not representative !
4306/// let result = hub.deployments().patch(req, "project", "deployment")
4307///              .preview(false)
4308///              .header_bypass_billing_filter(false)
4309///              .delete_policy("diam")
4310///              .create_policy("dolor")
4311///              .doit().await;
4312/// # }
4313/// ```
4314pub struct DeploymentPatchCall<'a, C>
4315where
4316    C: 'a,
4317{
4318    hub: &'a DeploymentManager<C>,
4319    _request: Deployment,
4320    _project: String,
4321    _deployment: String,
4322    _preview: Option<bool>,
4323    _header_bypass_billing_filter: Option<bool>,
4324    _delete_policy: Option<String>,
4325    _create_policy: Option<String>,
4326    _delegate: Option<&'a mut dyn common::Delegate>,
4327    _additional_params: HashMap<String, String>,
4328    _scopes: BTreeSet<String>,
4329}
4330
4331impl<'a, C> common::CallBuilder for DeploymentPatchCall<'a, C> {}
4332
4333impl<'a, C> DeploymentPatchCall<'a, C>
4334where
4335    C: common::Connector,
4336{
4337    /// Perform the operation you have build so far.
4338    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4339        use std::borrow::Cow;
4340        use std::io::{Read, Seek};
4341
4342        use common::{url::Params, ToParts};
4343        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4344
4345        let mut dd = common::DefaultDelegate;
4346        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4347        dlg.begin(common::MethodInfo {
4348            id: "deploymentmanager.deployments.patch",
4349            http_method: hyper::Method::PATCH,
4350        });
4351
4352        for &field in [
4353            "alt",
4354            "project",
4355            "deployment",
4356            "preview",
4357            "header.bypassBillingFilter",
4358            "deletePolicy",
4359            "createPolicy",
4360        ]
4361        .iter()
4362        {
4363            if self._additional_params.contains_key(field) {
4364                dlg.finished(false);
4365                return Err(common::Error::FieldClash(field));
4366            }
4367        }
4368
4369        let mut params = Params::with_capacity(9 + self._additional_params.len());
4370        params.push("project", self._project);
4371        params.push("deployment", self._deployment);
4372        if let Some(value) = self._preview.as_ref() {
4373            params.push("preview", value.to_string());
4374        }
4375        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
4376            params.push("header.bypassBillingFilter", value.to_string());
4377        }
4378        if let Some(value) = self._delete_policy.as_ref() {
4379            params.push("deletePolicy", value);
4380        }
4381        if let Some(value) = self._create_policy.as_ref() {
4382            params.push("createPolicy", value);
4383        }
4384
4385        params.extend(self._additional_params.iter());
4386
4387        params.push("alt", "json");
4388        let mut url = self.hub._base_url.clone()
4389            + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}";
4390        if self._scopes.is_empty() {
4391            self._scopes
4392                .insert(Scope::CloudPlatform.as_ref().to_string());
4393        }
4394
4395        #[allow(clippy::single_element_loop)]
4396        for &(find_this, param_name) in
4397            [("{project}", "project"), ("{deployment}", "deployment")].iter()
4398        {
4399            url = params.uri_replacement(url, param_name, find_this, false);
4400        }
4401        {
4402            let to_remove = ["deployment", "project"];
4403            params.remove_params(&to_remove);
4404        }
4405
4406        let url = params.parse_with_url(&url);
4407
4408        let mut json_mime_type = mime::APPLICATION_JSON;
4409        let mut request_value_reader = {
4410            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4411            common::remove_json_null_values(&mut value);
4412            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4413            serde_json::to_writer(&mut dst, &value).unwrap();
4414            dst
4415        };
4416        let request_size = request_value_reader
4417            .seek(std::io::SeekFrom::End(0))
4418            .unwrap();
4419        request_value_reader
4420            .seek(std::io::SeekFrom::Start(0))
4421            .unwrap();
4422
4423        loop {
4424            let token = match self
4425                .hub
4426                .auth
4427                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4428                .await
4429            {
4430                Ok(token) => token,
4431                Err(e) => match dlg.token(e) {
4432                    Ok(token) => token,
4433                    Err(e) => {
4434                        dlg.finished(false);
4435                        return Err(common::Error::MissingToken(e));
4436                    }
4437                },
4438            };
4439            request_value_reader
4440                .seek(std::io::SeekFrom::Start(0))
4441                .unwrap();
4442            let mut req_result = {
4443                let client = &self.hub.client;
4444                dlg.pre_request();
4445                let mut req_builder = hyper::Request::builder()
4446                    .method(hyper::Method::PATCH)
4447                    .uri(url.as_str())
4448                    .header(USER_AGENT, self.hub._user_agent.clone());
4449
4450                if let Some(token) = token.as_ref() {
4451                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4452                }
4453
4454                let request = req_builder
4455                    .header(CONTENT_TYPE, json_mime_type.to_string())
4456                    .header(CONTENT_LENGTH, request_size as u64)
4457                    .body(common::to_body(
4458                        request_value_reader.get_ref().clone().into(),
4459                    ));
4460
4461                client.request(request.unwrap()).await
4462            };
4463
4464            match req_result {
4465                Err(err) => {
4466                    if let common::Retry::After(d) = dlg.http_error(&err) {
4467                        sleep(d).await;
4468                        continue;
4469                    }
4470                    dlg.finished(false);
4471                    return Err(common::Error::HttpError(err));
4472                }
4473                Ok(res) => {
4474                    let (mut parts, body) = res.into_parts();
4475                    let mut body = common::Body::new(body);
4476                    if !parts.status.is_success() {
4477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4478                        let error = serde_json::from_str(&common::to_string(&bytes));
4479                        let response = common::to_response(parts, bytes.into());
4480
4481                        if let common::Retry::After(d) =
4482                            dlg.http_failure(&response, error.as_ref().ok())
4483                        {
4484                            sleep(d).await;
4485                            continue;
4486                        }
4487
4488                        dlg.finished(false);
4489
4490                        return Err(match error {
4491                            Ok(value) => common::Error::BadRequest(value),
4492                            _ => common::Error::Failure(response),
4493                        });
4494                    }
4495                    let response = {
4496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4497                        let encoded = common::to_string(&bytes);
4498                        match serde_json::from_str(&encoded) {
4499                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4500                            Err(error) => {
4501                                dlg.response_json_decode_error(&encoded, &error);
4502                                return Err(common::Error::JsonDecodeError(
4503                                    encoded.to_string(),
4504                                    error,
4505                                ));
4506                            }
4507                        }
4508                    };
4509
4510                    dlg.finished(true);
4511                    return Ok(response);
4512                }
4513            }
4514        }
4515    }
4516
4517    ///
4518    /// Sets the *request* property to the given value.
4519    ///
4520    /// Even though the property as already been set when instantiating this call,
4521    /// we provide this method for API completeness.
4522    pub fn request(mut self, new_value: Deployment) -> DeploymentPatchCall<'a, C> {
4523        self._request = new_value;
4524        self
4525    }
4526    /// The project ID for this request.
4527    ///
4528    /// Sets the *project* path property to the given value.
4529    ///
4530    /// Even though the property as already been set when instantiating this call,
4531    /// we provide this method for API completeness.
4532    pub fn project(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
4533        self._project = new_value.to_string();
4534        self
4535    }
4536    /// The name of the deployment for this request.
4537    ///
4538    /// Sets the *deployment* path property to the given value.
4539    ///
4540    /// Even though the property as already been set when instantiating this call,
4541    /// we provide this method for API completeness.
4542    pub fn deployment(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
4543        self._deployment = new_value.to_string();
4544        self
4545    }
4546    /// If set to true, updates the deployment and creates and updates the "shell" resources but does not actually alter or instantiate these resources. This allows you to preview what your deployment will look like. You can use this intent to preview how an update would affect your deployment. You must provide a `target.config` with a configuration if this is set to true. After previewing a deployment, you can deploy your resources by making a request with the `update()` or you can `cancelPreview()` to remove the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it.
4547    ///
4548    /// Sets the *preview* query property to the given value.
4549    pub fn preview(mut self, new_value: bool) -> DeploymentPatchCall<'a, C> {
4550        self._preview = Some(new_value);
4551        self
4552    }
4553    ///
4554    /// Sets the *header.bypass billing filter* query property to the given value.
4555    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> DeploymentPatchCall<'a, C> {
4556        self._header_bypass_billing_filter = Some(new_value);
4557        self
4558    }
4559    /// Sets the policy to use for deleting resources.
4560    ///
4561    /// Sets the *delete policy* query property to the given value.
4562    pub fn delete_policy(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
4563        self._delete_policy = Some(new_value.to_string());
4564        self
4565    }
4566    /// Sets the policy to use for creating new resources.
4567    ///
4568    /// Sets the *create policy* query property to the given value.
4569    pub fn create_policy(mut self, new_value: &str) -> DeploymentPatchCall<'a, C> {
4570        self._create_policy = Some(new_value.to_string());
4571        self
4572    }
4573    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4574    /// while executing the actual API request.
4575    ///
4576    /// ````text
4577    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4578    /// ````
4579    ///
4580    /// Sets the *delegate* property to the given value.
4581    pub fn delegate(
4582        mut self,
4583        new_value: &'a mut dyn common::Delegate,
4584    ) -> DeploymentPatchCall<'a, C> {
4585        self._delegate = Some(new_value);
4586        self
4587    }
4588
4589    /// Set any additional parameter of the query string used in the request.
4590    /// It should be used to set parameters which are not yet available through their own
4591    /// setters.
4592    ///
4593    /// Please note that this method must not be used to set any of the known parameters
4594    /// which have their own setter method. If done anyway, the request will fail.
4595    ///
4596    /// # Additional Parameters
4597    ///
4598    /// * *$.xgafv* (query-string) - V1 error format.
4599    /// * *access_token* (query-string) - OAuth access token.
4600    /// * *alt* (query-string) - Data format for response.
4601    /// * *callback* (query-string) - JSONP
4602    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4603    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4604    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4605    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4606    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4607    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4608    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4609    pub fn param<T>(mut self, name: T, value: T) -> DeploymentPatchCall<'a, C>
4610    where
4611        T: AsRef<str>,
4612    {
4613        self._additional_params
4614            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4615        self
4616    }
4617
4618    /// Identifies the authorization scope for the method you are building.
4619    ///
4620    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4621    /// [`Scope::CloudPlatform`].
4622    ///
4623    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4624    /// tokens for more than one scope.
4625    ///
4626    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4627    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4628    /// sufficient, a read-write scope will do as well.
4629    pub fn add_scope<St>(mut self, scope: St) -> DeploymentPatchCall<'a, C>
4630    where
4631        St: AsRef<str>,
4632    {
4633        self._scopes.insert(String::from(scope.as_ref()));
4634        self
4635    }
4636    /// Identifies the authorization scope(s) for the method you are building.
4637    ///
4638    /// See [`Self::add_scope()`] for details.
4639    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentPatchCall<'a, C>
4640    where
4641        I: IntoIterator<Item = St>,
4642        St: AsRef<str>,
4643    {
4644        self._scopes
4645            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4646        self
4647    }
4648
4649    /// Removes all scopes, and no default scope will be used either.
4650    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4651    /// for details).
4652    pub fn clear_scopes(mut self) -> DeploymentPatchCall<'a, C> {
4653        self._scopes.clear();
4654        self
4655    }
4656}
4657
4658/// Sets the access control policy on the specified resource. Replaces any existing policy.
4659///
4660/// A builder for the *setIamPolicy* method supported by a *deployment* resource.
4661/// It is not used directly, but through a [`DeploymentMethods`] instance.
4662///
4663/// # Example
4664///
4665/// Instantiate a resource method builder
4666///
4667/// ```test_harness,no_run
4668/// # extern crate hyper;
4669/// # extern crate hyper_rustls;
4670/// # extern crate google_deploymentmanager2 as deploymentmanager2;
4671/// use deploymentmanager2::api::GlobalSetPolicyRequest;
4672/// # async fn dox() {
4673/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4674///
4675/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4676/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4677/// #     .with_native_roots()
4678/// #     .unwrap()
4679/// #     .https_only()
4680/// #     .enable_http2()
4681/// #     .build();
4682///
4683/// # let executor = hyper_util::rt::TokioExecutor::new();
4684/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4685/// #     secret,
4686/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4687/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
4688/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
4689/// #     ),
4690/// # ).build().await.unwrap();
4691///
4692/// # let client = hyper_util::client::legacy::Client::builder(
4693/// #     hyper_util::rt::TokioExecutor::new()
4694/// # )
4695/// # .build(
4696/// #     hyper_rustls::HttpsConnectorBuilder::new()
4697/// #         .with_native_roots()
4698/// #         .unwrap()
4699/// #         .https_or_http()
4700/// #         .enable_http2()
4701/// #         .build()
4702/// # );
4703/// # let mut hub = DeploymentManager::new(client, auth);
4704/// // As the method needs a request, you would usually fill it with the desired information
4705/// // into the respective structure. Some of the parts shown here might not be applicable !
4706/// // Values shown here are possibly random and not representative !
4707/// let mut req = GlobalSetPolicyRequest::default();
4708///
4709/// // You can configure optional parameters by calling the respective setters at will, and
4710/// // execute the final call using `doit()`.
4711/// // Values shown here are possibly random and not representative !
4712/// let result = hub.deployments().set_iam_policy(req, "project", "resource")
4713///              .doit().await;
4714/// # }
4715/// ```
4716pub struct DeploymentSetIamPolicyCall<'a, C>
4717where
4718    C: 'a,
4719{
4720    hub: &'a DeploymentManager<C>,
4721    _request: GlobalSetPolicyRequest,
4722    _project: String,
4723    _resource: String,
4724    _delegate: Option<&'a mut dyn common::Delegate>,
4725    _additional_params: HashMap<String, String>,
4726    _scopes: BTreeSet<String>,
4727}
4728
4729impl<'a, C> common::CallBuilder for DeploymentSetIamPolicyCall<'a, C> {}
4730
4731impl<'a, C> DeploymentSetIamPolicyCall<'a, C>
4732where
4733    C: common::Connector,
4734{
4735    /// Perform the operation you have build so far.
4736    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
4737        use std::borrow::Cow;
4738        use std::io::{Read, Seek};
4739
4740        use common::{url::Params, ToParts};
4741        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4742
4743        let mut dd = common::DefaultDelegate;
4744        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4745        dlg.begin(common::MethodInfo {
4746            id: "deploymentmanager.deployments.setIamPolicy",
4747            http_method: hyper::Method::POST,
4748        });
4749
4750        for &field in ["alt", "project", "resource"].iter() {
4751            if self._additional_params.contains_key(field) {
4752                dlg.finished(false);
4753                return Err(common::Error::FieldClash(field));
4754            }
4755        }
4756
4757        let mut params = Params::with_capacity(5 + self._additional_params.len());
4758        params.push("project", self._project);
4759        params.push("resource", self._resource);
4760
4761        params.extend(self._additional_params.iter());
4762
4763        params.push("alt", "json");
4764        let mut url = self.hub._base_url.clone()
4765            + "deploymentmanager/v2/projects/{project}/global/deployments/{resource}/setIamPolicy";
4766        if self._scopes.is_empty() {
4767            self._scopes
4768                .insert(Scope::CloudPlatform.as_ref().to_string());
4769        }
4770
4771        #[allow(clippy::single_element_loop)]
4772        for &(find_this, param_name) in
4773            [("{project}", "project"), ("{resource}", "resource")].iter()
4774        {
4775            url = params.uri_replacement(url, param_name, find_this, false);
4776        }
4777        {
4778            let to_remove = ["resource", "project"];
4779            params.remove_params(&to_remove);
4780        }
4781
4782        let url = params.parse_with_url(&url);
4783
4784        let mut json_mime_type = mime::APPLICATION_JSON;
4785        let mut request_value_reader = {
4786            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4787            common::remove_json_null_values(&mut value);
4788            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4789            serde_json::to_writer(&mut dst, &value).unwrap();
4790            dst
4791        };
4792        let request_size = request_value_reader
4793            .seek(std::io::SeekFrom::End(0))
4794            .unwrap();
4795        request_value_reader
4796            .seek(std::io::SeekFrom::Start(0))
4797            .unwrap();
4798
4799        loop {
4800            let token = match self
4801                .hub
4802                .auth
4803                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4804                .await
4805            {
4806                Ok(token) => token,
4807                Err(e) => match dlg.token(e) {
4808                    Ok(token) => token,
4809                    Err(e) => {
4810                        dlg.finished(false);
4811                        return Err(common::Error::MissingToken(e));
4812                    }
4813                },
4814            };
4815            request_value_reader
4816                .seek(std::io::SeekFrom::Start(0))
4817                .unwrap();
4818            let mut req_result = {
4819                let client = &self.hub.client;
4820                dlg.pre_request();
4821                let mut req_builder = hyper::Request::builder()
4822                    .method(hyper::Method::POST)
4823                    .uri(url.as_str())
4824                    .header(USER_AGENT, self.hub._user_agent.clone());
4825
4826                if let Some(token) = token.as_ref() {
4827                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4828                }
4829
4830                let request = req_builder
4831                    .header(CONTENT_TYPE, json_mime_type.to_string())
4832                    .header(CONTENT_LENGTH, request_size as u64)
4833                    .body(common::to_body(
4834                        request_value_reader.get_ref().clone().into(),
4835                    ));
4836
4837                client.request(request.unwrap()).await
4838            };
4839
4840            match req_result {
4841                Err(err) => {
4842                    if let common::Retry::After(d) = dlg.http_error(&err) {
4843                        sleep(d).await;
4844                        continue;
4845                    }
4846                    dlg.finished(false);
4847                    return Err(common::Error::HttpError(err));
4848                }
4849                Ok(res) => {
4850                    let (mut parts, body) = res.into_parts();
4851                    let mut body = common::Body::new(body);
4852                    if !parts.status.is_success() {
4853                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4854                        let error = serde_json::from_str(&common::to_string(&bytes));
4855                        let response = common::to_response(parts, bytes.into());
4856
4857                        if let common::Retry::After(d) =
4858                            dlg.http_failure(&response, error.as_ref().ok())
4859                        {
4860                            sleep(d).await;
4861                            continue;
4862                        }
4863
4864                        dlg.finished(false);
4865
4866                        return Err(match error {
4867                            Ok(value) => common::Error::BadRequest(value),
4868                            _ => common::Error::Failure(response),
4869                        });
4870                    }
4871                    let response = {
4872                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4873                        let encoded = common::to_string(&bytes);
4874                        match serde_json::from_str(&encoded) {
4875                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4876                            Err(error) => {
4877                                dlg.response_json_decode_error(&encoded, &error);
4878                                return Err(common::Error::JsonDecodeError(
4879                                    encoded.to_string(),
4880                                    error,
4881                                ));
4882                            }
4883                        }
4884                    };
4885
4886                    dlg.finished(true);
4887                    return Ok(response);
4888                }
4889            }
4890        }
4891    }
4892
4893    ///
4894    /// Sets the *request* property to the given value.
4895    ///
4896    /// Even though the property as already been set when instantiating this call,
4897    /// we provide this method for API completeness.
4898    pub fn request(
4899        mut self,
4900        new_value: GlobalSetPolicyRequest,
4901    ) -> DeploymentSetIamPolicyCall<'a, C> {
4902        self._request = new_value;
4903        self
4904    }
4905    /// Project ID for this request.
4906    ///
4907    /// Sets the *project* path property to the given value.
4908    ///
4909    /// Even though the property as already been set when instantiating this call,
4910    /// we provide this method for API completeness.
4911    pub fn project(mut self, new_value: &str) -> DeploymentSetIamPolicyCall<'a, C> {
4912        self._project = new_value.to_string();
4913        self
4914    }
4915    /// Name or id of the resource for this request.
4916    ///
4917    /// Sets the *resource* path property to the given value.
4918    ///
4919    /// Even though the property as already been set when instantiating this call,
4920    /// we provide this method for API completeness.
4921    pub fn resource(mut self, new_value: &str) -> DeploymentSetIamPolicyCall<'a, C> {
4922        self._resource = new_value.to_string();
4923        self
4924    }
4925    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4926    /// while executing the actual API request.
4927    ///
4928    /// ````text
4929    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4930    /// ````
4931    ///
4932    /// Sets the *delegate* property to the given value.
4933    pub fn delegate(
4934        mut self,
4935        new_value: &'a mut dyn common::Delegate,
4936    ) -> DeploymentSetIamPolicyCall<'a, C> {
4937        self._delegate = Some(new_value);
4938        self
4939    }
4940
4941    /// Set any additional parameter of the query string used in the request.
4942    /// It should be used to set parameters which are not yet available through their own
4943    /// setters.
4944    ///
4945    /// Please note that this method must not be used to set any of the known parameters
4946    /// which have their own setter method. If done anyway, the request will fail.
4947    ///
4948    /// # Additional Parameters
4949    ///
4950    /// * *$.xgafv* (query-string) - V1 error format.
4951    /// * *access_token* (query-string) - OAuth access token.
4952    /// * *alt* (query-string) - Data format for response.
4953    /// * *callback* (query-string) - JSONP
4954    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4955    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4956    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4957    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4958    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4959    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4960    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4961    pub fn param<T>(mut self, name: T, value: T) -> DeploymentSetIamPolicyCall<'a, C>
4962    where
4963        T: AsRef<str>,
4964    {
4965        self._additional_params
4966            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4967        self
4968    }
4969
4970    /// Identifies the authorization scope for the method you are building.
4971    ///
4972    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4973    /// [`Scope::CloudPlatform`].
4974    ///
4975    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4976    /// tokens for more than one scope.
4977    ///
4978    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4979    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4980    /// sufficient, a read-write scope will do as well.
4981    pub fn add_scope<St>(mut self, scope: St) -> DeploymentSetIamPolicyCall<'a, C>
4982    where
4983        St: AsRef<str>,
4984    {
4985        self._scopes.insert(String::from(scope.as_ref()));
4986        self
4987    }
4988    /// Identifies the authorization scope(s) for the method you are building.
4989    ///
4990    /// See [`Self::add_scope()`] for details.
4991    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentSetIamPolicyCall<'a, C>
4992    where
4993        I: IntoIterator<Item = St>,
4994        St: AsRef<str>,
4995    {
4996        self._scopes
4997            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4998        self
4999    }
5000
5001    /// Removes all scopes, and no default scope will be used either.
5002    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5003    /// for details).
5004    pub fn clear_scopes(mut self) -> DeploymentSetIamPolicyCall<'a, C> {
5005        self._scopes.clear();
5006        self
5007    }
5008}
5009
5010/// Stops an ongoing operation. This does not roll back any work that has already been completed, but prevents any new work from being started.
5011///
5012/// A builder for the *stop* method supported by a *deployment* resource.
5013/// It is not used directly, but through a [`DeploymentMethods`] instance.
5014///
5015/// # Example
5016///
5017/// Instantiate a resource method builder
5018///
5019/// ```test_harness,no_run
5020/// # extern crate hyper;
5021/// # extern crate hyper_rustls;
5022/// # extern crate google_deploymentmanager2 as deploymentmanager2;
5023/// use deploymentmanager2::api::DeploymentsStopRequest;
5024/// # async fn dox() {
5025/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5026///
5027/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5028/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5029/// #     .with_native_roots()
5030/// #     .unwrap()
5031/// #     .https_only()
5032/// #     .enable_http2()
5033/// #     .build();
5034///
5035/// # let executor = hyper_util::rt::TokioExecutor::new();
5036/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5037/// #     secret,
5038/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5039/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5040/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5041/// #     ),
5042/// # ).build().await.unwrap();
5043///
5044/// # let client = hyper_util::client::legacy::Client::builder(
5045/// #     hyper_util::rt::TokioExecutor::new()
5046/// # )
5047/// # .build(
5048/// #     hyper_rustls::HttpsConnectorBuilder::new()
5049/// #         .with_native_roots()
5050/// #         .unwrap()
5051/// #         .https_or_http()
5052/// #         .enable_http2()
5053/// #         .build()
5054/// # );
5055/// # let mut hub = DeploymentManager::new(client, auth);
5056/// // As the method needs a request, you would usually fill it with the desired information
5057/// // into the respective structure. Some of the parts shown here might not be applicable !
5058/// // Values shown here are possibly random and not representative !
5059/// let mut req = DeploymentsStopRequest::default();
5060///
5061/// // You can configure optional parameters by calling the respective setters at will, and
5062/// // execute the final call using `doit()`.
5063/// // Values shown here are possibly random and not representative !
5064/// let result = hub.deployments().stop(req, "project", "deployment")
5065///              .doit().await;
5066/// # }
5067/// ```
5068pub struct DeploymentStopCall<'a, C>
5069where
5070    C: 'a,
5071{
5072    hub: &'a DeploymentManager<C>,
5073    _request: DeploymentsStopRequest,
5074    _project: String,
5075    _deployment: String,
5076    _delegate: Option<&'a mut dyn common::Delegate>,
5077    _additional_params: HashMap<String, String>,
5078    _scopes: BTreeSet<String>,
5079}
5080
5081impl<'a, C> common::CallBuilder for DeploymentStopCall<'a, C> {}
5082
5083impl<'a, C> DeploymentStopCall<'a, C>
5084where
5085    C: common::Connector,
5086{
5087    /// Perform the operation you have build so far.
5088    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5089        use std::borrow::Cow;
5090        use std::io::{Read, Seek};
5091
5092        use common::{url::Params, ToParts};
5093        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5094
5095        let mut dd = common::DefaultDelegate;
5096        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5097        dlg.begin(common::MethodInfo {
5098            id: "deploymentmanager.deployments.stop",
5099            http_method: hyper::Method::POST,
5100        });
5101
5102        for &field in ["alt", "project", "deployment"].iter() {
5103            if self._additional_params.contains_key(field) {
5104                dlg.finished(false);
5105                return Err(common::Error::FieldClash(field));
5106            }
5107        }
5108
5109        let mut params = Params::with_capacity(5 + self._additional_params.len());
5110        params.push("project", self._project);
5111        params.push("deployment", self._deployment);
5112
5113        params.extend(self._additional_params.iter());
5114
5115        params.push("alt", "json");
5116        let mut url = self.hub._base_url.clone()
5117            + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}/stop";
5118        if self._scopes.is_empty() {
5119            self._scopes
5120                .insert(Scope::CloudPlatform.as_ref().to_string());
5121        }
5122
5123        #[allow(clippy::single_element_loop)]
5124        for &(find_this, param_name) in
5125            [("{project}", "project"), ("{deployment}", "deployment")].iter()
5126        {
5127            url = params.uri_replacement(url, param_name, find_this, false);
5128        }
5129        {
5130            let to_remove = ["deployment", "project"];
5131            params.remove_params(&to_remove);
5132        }
5133
5134        let url = params.parse_with_url(&url);
5135
5136        let mut json_mime_type = mime::APPLICATION_JSON;
5137        let mut request_value_reader = {
5138            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5139            common::remove_json_null_values(&mut value);
5140            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5141            serde_json::to_writer(&mut dst, &value).unwrap();
5142            dst
5143        };
5144        let request_size = request_value_reader
5145            .seek(std::io::SeekFrom::End(0))
5146            .unwrap();
5147        request_value_reader
5148            .seek(std::io::SeekFrom::Start(0))
5149            .unwrap();
5150
5151        loop {
5152            let token = match self
5153                .hub
5154                .auth
5155                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5156                .await
5157            {
5158                Ok(token) => token,
5159                Err(e) => match dlg.token(e) {
5160                    Ok(token) => token,
5161                    Err(e) => {
5162                        dlg.finished(false);
5163                        return Err(common::Error::MissingToken(e));
5164                    }
5165                },
5166            };
5167            request_value_reader
5168                .seek(std::io::SeekFrom::Start(0))
5169                .unwrap();
5170            let mut req_result = {
5171                let client = &self.hub.client;
5172                dlg.pre_request();
5173                let mut req_builder = hyper::Request::builder()
5174                    .method(hyper::Method::POST)
5175                    .uri(url.as_str())
5176                    .header(USER_AGENT, self.hub._user_agent.clone());
5177
5178                if let Some(token) = token.as_ref() {
5179                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5180                }
5181
5182                let request = req_builder
5183                    .header(CONTENT_TYPE, json_mime_type.to_string())
5184                    .header(CONTENT_LENGTH, request_size as u64)
5185                    .body(common::to_body(
5186                        request_value_reader.get_ref().clone().into(),
5187                    ));
5188
5189                client.request(request.unwrap()).await
5190            };
5191
5192            match req_result {
5193                Err(err) => {
5194                    if let common::Retry::After(d) = dlg.http_error(&err) {
5195                        sleep(d).await;
5196                        continue;
5197                    }
5198                    dlg.finished(false);
5199                    return Err(common::Error::HttpError(err));
5200                }
5201                Ok(res) => {
5202                    let (mut parts, body) = res.into_parts();
5203                    let mut body = common::Body::new(body);
5204                    if !parts.status.is_success() {
5205                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5206                        let error = serde_json::from_str(&common::to_string(&bytes));
5207                        let response = common::to_response(parts, bytes.into());
5208
5209                        if let common::Retry::After(d) =
5210                            dlg.http_failure(&response, error.as_ref().ok())
5211                        {
5212                            sleep(d).await;
5213                            continue;
5214                        }
5215
5216                        dlg.finished(false);
5217
5218                        return Err(match error {
5219                            Ok(value) => common::Error::BadRequest(value),
5220                            _ => common::Error::Failure(response),
5221                        });
5222                    }
5223                    let response = {
5224                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5225                        let encoded = common::to_string(&bytes);
5226                        match serde_json::from_str(&encoded) {
5227                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5228                            Err(error) => {
5229                                dlg.response_json_decode_error(&encoded, &error);
5230                                return Err(common::Error::JsonDecodeError(
5231                                    encoded.to_string(),
5232                                    error,
5233                                ));
5234                            }
5235                        }
5236                    };
5237
5238                    dlg.finished(true);
5239                    return Ok(response);
5240                }
5241            }
5242        }
5243    }
5244
5245    ///
5246    /// Sets the *request* property to the given value.
5247    ///
5248    /// Even though the property as already been set when instantiating this call,
5249    /// we provide this method for API completeness.
5250    pub fn request(mut self, new_value: DeploymentsStopRequest) -> DeploymentStopCall<'a, C> {
5251        self._request = new_value;
5252        self
5253    }
5254    /// The project ID for this request.
5255    ///
5256    /// Sets the *project* path property to the given value.
5257    ///
5258    /// Even though the property as already been set when instantiating this call,
5259    /// we provide this method for API completeness.
5260    pub fn project(mut self, new_value: &str) -> DeploymentStopCall<'a, C> {
5261        self._project = new_value.to_string();
5262        self
5263    }
5264    /// The name of the deployment for this request.
5265    ///
5266    /// Sets the *deployment* path property to the given value.
5267    ///
5268    /// Even though the property as already been set when instantiating this call,
5269    /// we provide this method for API completeness.
5270    pub fn deployment(mut self, new_value: &str) -> DeploymentStopCall<'a, C> {
5271        self._deployment = new_value.to_string();
5272        self
5273    }
5274    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5275    /// while executing the actual API request.
5276    ///
5277    /// ````text
5278    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5279    /// ````
5280    ///
5281    /// Sets the *delegate* property to the given value.
5282    pub fn delegate(
5283        mut self,
5284        new_value: &'a mut dyn common::Delegate,
5285    ) -> DeploymentStopCall<'a, C> {
5286        self._delegate = Some(new_value);
5287        self
5288    }
5289
5290    /// Set any additional parameter of the query string used in the request.
5291    /// It should be used to set parameters which are not yet available through their own
5292    /// setters.
5293    ///
5294    /// Please note that this method must not be used to set any of the known parameters
5295    /// which have their own setter method. If done anyway, the request will fail.
5296    ///
5297    /// # Additional Parameters
5298    ///
5299    /// * *$.xgafv* (query-string) - V1 error format.
5300    /// * *access_token* (query-string) - OAuth access token.
5301    /// * *alt* (query-string) - Data format for response.
5302    /// * *callback* (query-string) - JSONP
5303    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5304    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5305    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5306    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5307    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5308    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5309    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5310    pub fn param<T>(mut self, name: T, value: T) -> DeploymentStopCall<'a, C>
5311    where
5312        T: AsRef<str>,
5313    {
5314        self._additional_params
5315            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5316        self
5317    }
5318
5319    /// Identifies the authorization scope for the method you are building.
5320    ///
5321    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5322    /// [`Scope::CloudPlatform`].
5323    ///
5324    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5325    /// tokens for more than one scope.
5326    ///
5327    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5328    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5329    /// sufficient, a read-write scope will do as well.
5330    pub fn add_scope<St>(mut self, scope: St) -> DeploymentStopCall<'a, C>
5331    where
5332        St: AsRef<str>,
5333    {
5334        self._scopes.insert(String::from(scope.as_ref()));
5335        self
5336    }
5337    /// Identifies the authorization scope(s) for the method you are building.
5338    ///
5339    /// See [`Self::add_scope()`] for details.
5340    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentStopCall<'a, C>
5341    where
5342        I: IntoIterator<Item = St>,
5343        St: AsRef<str>,
5344    {
5345        self._scopes
5346            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5347        self
5348    }
5349
5350    /// Removes all scopes, and no default scope will be used either.
5351    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5352    /// for details).
5353    pub fn clear_scopes(mut self) -> DeploymentStopCall<'a, C> {
5354        self._scopes.clear();
5355        self
5356    }
5357}
5358
5359/// Returns permissions that a caller has on the specified resource.
5360///
5361/// A builder for the *testIamPermissions* method supported by a *deployment* resource.
5362/// It is not used directly, but through a [`DeploymentMethods`] instance.
5363///
5364/// # Example
5365///
5366/// Instantiate a resource method builder
5367///
5368/// ```test_harness,no_run
5369/// # extern crate hyper;
5370/// # extern crate hyper_rustls;
5371/// # extern crate google_deploymentmanager2 as deploymentmanager2;
5372/// use deploymentmanager2::api::TestPermissionsRequest;
5373/// # async fn dox() {
5374/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5375///
5376/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5377/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5378/// #     .with_native_roots()
5379/// #     .unwrap()
5380/// #     .https_only()
5381/// #     .enable_http2()
5382/// #     .build();
5383///
5384/// # let executor = hyper_util::rt::TokioExecutor::new();
5385/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5386/// #     secret,
5387/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5388/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5389/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5390/// #     ),
5391/// # ).build().await.unwrap();
5392///
5393/// # let client = hyper_util::client::legacy::Client::builder(
5394/// #     hyper_util::rt::TokioExecutor::new()
5395/// # )
5396/// # .build(
5397/// #     hyper_rustls::HttpsConnectorBuilder::new()
5398/// #         .with_native_roots()
5399/// #         .unwrap()
5400/// #         .https_or_http()
5401/// #         .enable_http2()
5402/// #         .build()
5403/// # );
5404/// # let mut hub = DeploymentManager::new(client, auth);
5405/// // As the method needs a request, you would usually fill it with the desired information
5406/// // into the respective structure. Some of the parts shown here might not be applicable !
5407/// // Values shown here are possibly random and not representative !
5408/// let mut req = TestPermissionsRequest::default();
5409///
5410/// // You can configure optional parameters by calling the respective setters at will, and
5411/// // execute the final call using `doit()`.
5412/// // Values shown here are possibly random and not representative !
5413/// let result = hub.deployments().test_iam_permissions(req, "project", "resource")
5414///              .header_bypass_billing_filter(false)
5415///              .doit().await;
5416/// # }
5417/// ```
5418pub struct DeploymentTestIamPermissionCall<'a, C>
5419where
5420    C: 'a,
5421{
5422    hub: &'a DeploymentManager<C>,
5423    _request: TestPermissionsRequest,
5424    _project: String,
5425    _resource: String,
5426    _header_bypass_billing_filter: Option<bool>,
5427    _delegate: Option<&'a mut dyn common::Delegate>,
5428    _additional_params: HashMap<String, String>,
5429    _scopes: BTreeSet<String>,
5430}
5431
5432impl<'a, C> common::CallBuilder for DeploymentTestIamPermissionCall<'a, C> {}
5433
5434impl<'a, C> DeploymentTestIamPermissionCall<'a, C>
5435where
5436    C: common::Connector,
5437{
5438    /// Perform the operation you have build so far.
5439    pub async fn doit(mut self) -> common::Result<(common::Response, TestPermissionsResponse)> {
5440        use std::borrow::Cow;
5441        use std::io::{Read, Seek};
5442
5443        use common::{url::Params, ToParts};
5444        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5445
5446        let mut dd = common::DefaultDelegate;
5447        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5448        dlg.begin(common::MethodInfo {
5449            id: "deploymentmanager.deployments.testIamPermissions",
5450            http_method: hyper::Method::POST,
5451        });
5452
5453        for &field in ["alt", "project", "resource", "header.bypassBillingFilter"].iter() {
5454            if self._additional_params.contains_key(field) {
5455                dlg.finished(false);
5456                return Err(common::Error::FieldClash(field));
5457            }
5458        }
5459
5460        let mut params = Params::with_capacity(6 + self._additional_params.len());
5461        params.push("project", self._project);
5462        params.push("resource", self._resource);
5463        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
5464            params.push("header.bypassBillingFilter", value.to_string());
5465        }
5466
5467        params.extend(self._additional_params.iter());
5468
5469        params.push("alt", "json");
5470        let mut url = self.hub._base_url.clone() + "deploymentmanager/v2/projects/{project}/global/deployments/{resource}/testIamPermissions";
5471        if self._scopes.is_empty() {
5472            self._scopes
5473                .insert(Scope::CloudPlatform.as_ref().to_string());
5474        }
5475
5476        #[allow(clippy::single_element_loop)]
5477        for &(find_this, param_name) in
5478            [("{project}", "project"), ("{resource}", "resource")].iter()
5479        {
5480            url = params.uri_replacement(url, param_name, find_this, false);
5481        }
5482        {
5483            let to_remove = ["resource", "project"];
5484            params.remove_params(&to_remove);
5485        }
5486
5487        let url = params.parse_with_url(&url);
5488
5489        let mut json_mime_type = mime::APPLICATION_JSON;
5490        let mut request_value_reader = {
5491            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5492            common::remove_json_null_values(&mut value);
5493            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5494            serde_json::to_writer(&mut dst, &value).unwrap();
5495            dst
5496        };
5497        let request_size = request_value_reader
5498            .seek(std::io::SeekFrom::End(0))
5499            .unwrap();
5500        request_value_reader
5501            .seek(std::io::SeekFrom::Start(0))
5502            .unwrap();
5503
5504        loop {
5505            let token = match self
5506                .hub
5507                .auth
5508                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5509                .await
5510            {
5511                Ok(token) => token,
5512                Err(e) => match dlg.token(e) {
5513                    Ok(token) => token,
5514                    Err(e) => {
5515                        dlg.finished(false);
5516                        return Err(common::Error::MissingToken(e));
5517                    }
5518                },
5519            };
5520            request_value_reader
5521                .seek(std::io::SeekFrom::Start(0))
5522                .unwrap();
5523            let mut req_result = {
5524                let client = &self.hub.client;
5525                dlg.pre_request();
5526                let mut req_builder = hyper::Request::builder()
5527                    .method(hyper::Method::POST)
5528                    .uri(url.as_str())
5529                    .header(USER_AGENT, self.hub._user_agent.clone());
5530
5531                if let Some(token) = token.as_ref() {
5532                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5533                }
5534
5535                let request = req_builder
5536                    .header(CONTENT_TYPE, json_mime_type.to_string())
5537                    .header(CONTENT_LENGTH, request_size as u64)
5538                    .body(common::to_body(
5539                        request_value_reader.get_ref().clone().into(),
5540                    ));
5541
5542                client.request(request.unwrap()).await
5543            };
5544
5545            match req_result {
5546                Err(err) => {
5547                    if let common::Retry::After(d) = dlg.http_error(&err) {
5548                        sleep(d).await;
5549                        continue;
5550                    }
5551                    dlg.finished(false);
5552                    return Err(common::Error::HttpError(err));
5553                }
5554                Ok(res) => {
5555                    let (mut parts, body) = res.into_parts();
5556                    let mut body = common::Body::new(body);
5557                    if !parts.status.is_success() {
5558                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5559                        let error = serde_json::from_str(&common::to_string(&bytes));
5560                        let response = common::to_response(parts, bytes.into());
5561
5562                        if let common::Retry::After(d) =
5563                            dlg.http_failure(&response, error.as_ref().ok())
5564                        {
5565                            sleep(d).await;
5566                            continue;
5567                        }
5568
5569                        dlg.finished(false);
5570
5571                        return Err(match error {
5572                            Ok(value) => common::Error::BadRequest(value),
5573                            _ => common::Error::Failure(response),
5574                        });
5575                    }
5576                    let response = {
5577                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5578                        let encoded = common::to_string(&bytes);
5579                        match serde_json::from_str(&encoded) {
5580                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5581                            Err(error) => {
5582                                dlg.response_json_decode_error(&encoded, &error);
5583                                return Err(common::Error::JsonDecodeError(
5584                                    encoded.to_string(),
5585                                    error,
5586                                ));
5587                            }
5588                        }
5589                    };
5590
5591                    dlg.finished(true);
5592                    return Ok(response);
5593                }
5594            }
5595        }
5596    }
5597
5598    ///
5599    /// Sets the *request* property to the given value.
5600    ///
5601    /// Even though the property as already been set when instantiating this call,
5602    /// we provide this method for API completeness.
5603    pub fn request(
5604        mut self,
5605        new_value: TestPermissionsRequest,
5606    ) -> DeploymentTestIamPermissionCall<'a, C> {
5607        self._request = new_value;
5608        self
5609    }
5610    /// Project ID for this request.
5611    ///
5612    /// Sets the *project* path property to the given value.
5613    ///
5614    /// Even though the property as already been set when instantiating this call,
5615    /// we provide this method for API completeness.
5616    pub fn project(mut self, new_value: &str) -> DeploymentTestIamPermissionCall<'a, C> {
5617        self._project = new_value.to_string();
5618        self
5619    }
5620    /// Name or id of the resource for this request.
5621    ///
5622    /// Sets the *resource* path property to the given value.
5623    ///
5624    /// Even though the property as already been set when instantiating this call,
5625    /// we provide this method for API completeness.
5626    pub fn resource(mut self, new_value: &str) -> DeploymentTestIamPermissionCall<'a, C> {
5627        self._resource = new_value.to_string();
5628        self
5629    }
5630    ///
5631    /// Sets the *header.bypass billing filter* query property to the given value.
5632    pub fn header_bypass_billing_filter(
5633        mut self,
5634        new_value: bool,
5635    ) -> DeploymentTestIamPermissionCall<'a, C> {
5636        self._header_bypass_billing_filter = Some(new_value);
5637        self
5638    }
5639    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5640    /// while executing the actual API request.
5641    ///
5642    /// ````text
5643    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5644    /// ````
5645    ///
5646    /// Sets the *delegate* property to the given value.
5647    pub fn delegate(
5648        mut self,
5649        new_value: &'a mut dyn common::Delegate,
5650    ) -> DeploymentTestIamPermissionCall<'a, C> {
5651        self._delegate = Some(new_value);
5652        self
5653    }
5654
5655    /// Set any additional parameter of the query string used in the request.
5656    /// It should be used to set parameters which are not yet available through their own
5657    /// setters.
5658    ///
5659    /// Please note that this method must not be used to set any of the known parameters
5660    /// which have their own setter method. If done anyway, the request will fail.
5661    ///
5662    /// # Additional Parameters
5663    ///
5664    /// * *$.xgafv* (query-string) - V1 error format.
5665    /// * *access_token* (query-string) - OAuth access token.
5666    /// * *alt* (query-string) - Data format for response.
5667    /// * *callback* (query-string) - JSONP
5668    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5669    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5670    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5671    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5672    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5673    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5674    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5675    pub fn param<T>(mut self, name: T, value: T) -> DeploymentTestIamPermissionCall<'a, C>
5676    where
5677        T: AsRef<str>,
5678    {
5679        self._additional_params
5680            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5681        self
5682    }
5683
5684    /// Identifies the authorization scope for the method you are building.
5685    ///
5686    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5687    /// [`Scope::CloudPlatform`].
5688    ///
5689    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5690    /// tokens for more than one scope.
5691    ///
5692    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5693    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5694    /// sufficient, a read-write scope will do as well.
5695    pub fn add_scope<St>(mut self, scope: St) -> DeploymentTestIamPermissionCall<'a, C>
5696    where
5697        St: AsRef<str>,
5698    {
5699        self._scopes.insert(String::from(scope.as_ref()));
5700        self
5701    }
5702    /// Identifies the authorization scope(s) for the method you are building.
5703    ///
5704    /// See [`Self::add_scope()`] for details.
5705    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentTestIamPermissionCall<'a, C>
5706    where
5707        I: IntoIterator<Item = St>,
5708        St: AsRef<str>,
5709    {
5710        self._scopes
5711            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5712        self
5713    }
5714
5715    /// Removes all scopes, and no default scope will be used either.
5716    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5717    /// for details).
5718    pub fn clear_scopes(mut self) -> DeploymentTestIamPermissionCall<'a, C> {
5719        self._scopes.clear();
5720        self
5721    }
5722}
5723
5724/// Updates a deployment and all of the resources described by the deployment manifest.
5725///
5726/// A builder for the *update* method supported by a *deployment* resource.
5727/// It is not used directly, but through a [`DeploymentMethods`] instance.
5728///
5729/// # Example
5730///
5731/// Instantiate a resource method builder
5732///
5733/// ```test_harness,no_run
5734/// # extern crate hyper;
5735/// # extern crate hyper_rustls;
5736/// # extern crate google_deploymentmanager2 as deploymentmanager2;
5737/// use deploymentmanager2::api::Deployment;
5738/// # async fn dox() {
5739/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5740///
5741/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5742/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5743/// #     .with_native_roots()
5744/// #     .unwrap()
5745/// #     .https_only()
5746/// #     .enable_http2()
5747/// #     .build();
5748///
5749/// # let executor = hyper_util::rt::TokioExecutor::new();
5750/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5751/// #     secret,
5752/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5753/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
5754/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
5755/// #     ),
5756/// # ).build().await.unwrap();
5757///
5758/// # let client = hyper_util::client::legacy::Client::builder(
5759/// #     hyper_util::rt::TokioExecutor::new()
5760/// # )
5761/// # .build(
5762/// #     hyper_rustls::HttpsConnectorBuilder::new()
5763/// #         .with_native_roots()
5764/// #         .unwrap()
5765/// #         .https_or_http()
5766/// #         .enable_http2()
5767/// #         .build()
5768/// # );
5769/// # let mut hub = DeploymentManager::new(client, auth);
5770/// // As the method needs a request, you would usually fill it with the desired information
5771/// // into the respective structure. Some of the parts shown here might not be applicable !
5772/// // Values shown here are possibly random and not representative !
5773/// let mut req = Deployment::default();
5774///
5775/// // You can configure optional parameters by calling the respective setters at will, and
5776/// // execute the final call using `doit()`.
5777/// // Values shown here are possibly random and not representative !
5778/// let result = hub.deployments().update(req, "project", "deployment")
5779///              .preview(true)
5780///              .header_bypass_billing_filter(false)
5781///              .delete_policy("elitr")
5782///              .create_policy("Lorem")
5783///              .doit().await;
5784/// # }
5785/// ```
5786pub struct DeploymentUpdateCall<'a, C>
5787where
5788    C: 'a,
5789{
5790    hub: &'a DeploymentManager<C>,
5791    _request: Deployment,
5792    _project: String,
5793    _deployment: String,
5794    _preview: Option<bool>,
5795    _header_bypass_billing_filter: Option<bool>,
5796    _delete_policy: Option<String>,
5797    _create_policy: Option<String>,
5798    _delegate: Option<&'a mut dyn common::Delegate>,
5799    _additional_params: HashMap<String, String>,
5800    _scopes: BTreeSet<String>,
5801}
5802
5803impl<'a, C> common::CallBuilder for DeploymentUpdateCall<'a, C> {}
5804
5805impl<'a, C> DeploymentUpdateCall<'a, C>
5806where
5807    C: common::Connector,
5808{
5809    /// Perform the operation you have build so far.
5810    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5811        use std::borrow::Cow;
5812        use std::io::{Read, Seek};
5813
5814        use common::{url::Params, ToParts};
5815        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5816
5817        let mut dd = common::DefaultDelegate;
5818        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5819        dlg.begin(common::MethodInfo {
5820            id: "deploymentmanager.deployments.update",
5821            http_method: hyper::Method::PUT,
5822        });
5823
5824        for &field in [
5825            "alt",
5826            "project",
5827            "deployment",
5828            "preview",
5829            "header.bypassBillingFilter",
5830            "deletePolicy",
5831            "createPolicy",
5832        ]
5833        .iter()
5834        {
5835            if self._additional_params.contains_key(field) {
5836                dlg.finished(false);
5837                return Err(common::Error::FieldClash(field));
5838            }
5839        }
5840
5841        let mut params = Params::with_capacity(9 + self._additional_params.len());
5842        params.push("project", self._project);
5843        params.push("deployment", self._deployment);
5844        if let Some(value) = self._preview.as_ref() {
5845            params.push("preview", value.to_string());
5846        }
5847        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
5848            params.push("header.bypassBillingFilter", value.to_string());
5849        }
5850        if let Some(value) = self._delete_policy.as_ref() {
5851            params.push("deletePolicy", value);
5852        }
5853        if let Some(value) = self._create_policy.as_ref() {
5854            params.push("createPolicy", value);
5855        }
5856
5857        params.extend(self._additional_params.iter());
5858
5859        params.push("alt", "json");
5860        let mut url = self.hub._base_url.clone()
5861            + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}";
5862        if self._scopes.is_empty() {
5863            self._scopes
5864                .insert(Scope::CloudPlatform.as_ref().to_string());
5865        }
5866
5867        #[allow(clippy::single_element_loop)]
5868        for &(find_this, param_name) in
5869            [("{project}", "project"), ("{deployment}", "deployment")].iter()
5870        {
5871            url = params.uri_replacement(url, param_name, find_this, false);
5872        }
5873        {
5874            let to_remove = ["deployment", "project"];
5875            params.remove_params(&to_remove);
5876        }
5877
5878        let url = params.parse_with_url(&url);
5879
5880        let mut json_mime_type = mime::APPLICATION_JSON;
5881        let mut request_value_reader = {
5882            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5883            common::remove_json_null_values(&mut value);
5884            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5885            serde_json::to_writer(&mut dst, &value).unwrap();
5886            dst
5887        };
5888        let request_size = request_value_reader
5889            .seek(std::io::SeekFrom::End(0))
5890            .unwrap();
5891        request_value_reader
5892            .seek(std::io::SeekFrom::Start(0))
5893            .unwrap();
5894
5895        loop {
5896            let token = match self
5897                .hub
5898                .auth
5899                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5900                .await
5901            {
5902                Ok(token) => token,
5903                Err(e) => match dlg.token(e) {
5904                    Ok(token) => token,
5905                    Err(e) => {
5906                        dlg.finished(false);
5907                        return Err(common::Error::MissingToken(e));
5908                    }
5909                },
5910            };
5911            request_value_reader
5912                .seek(std::io::SeekFrom::Start(0))
5913                .unwrap();
5914            let mut req_result = {
5915                let client = &self.hub.client;
5916                dlg.pre_request();
5917                let mut req_builder = hyper::Request::builder()
5918                    .method(hyper::Method::PUT)
5919                    .uri(url.as_str())
5920                    .header(USER_AGENT, self.hub._user_agent.clone());
5921
5922                if let Some(token) = token.as_ref() {
5923                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5924                }
5925
5926                let request = req_builder
5927                    .header(CONTENT_TYPE, json_mime_type.to_string())
5928                    .header(CONTENT_LENGTH, request_size as u64)
5929                    .body(common::to_body(
5930                        request_value_reader.get_ref().clone().into(),
5931                    ));
5932
5933                client.request(request.unwrap()).await
5934            };
5935
5936            match req_result {
5937                Err(err) => {
5938                    if let common::Retry::After(d) = dlg.http_error(&err) {
5939                        sleep(d).await;
5940                        continue;
5941                    }
5942                    dlg.finished(false);
5943                    return Err(common::Error::HttpError(err));
5944                }
5945                Ok(res) => {
5946                    let (mut parts, body) = res.into_parts();
5947                    let mut body = common::Body::new(body);
5948                    if !parts.status.is_success() {
5949                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5950                        let error = serde_json::from_str(&common::to_string(&bytes));
5951                        let response = common::to_response(parts, bytes.into());
5952
5953                        if let common::Retry::After(d) =
5954                            dlg.http_failure(&response, error.as_ref().ok())
5955                        {
5956                            sleep(d).await;
5957                            continue;
5958                        }
5959
5960                        dlg.finished(false);
5961
5962                        return Err(match error {
5963                            Ok(value) => common::Error::BadRequest(value),
5964                            _ => common::Error::Failure(response),
5965                        });
5966                    }
5967                    let response = {
5968                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5969                        let encoded = common::to_string(&bytes);
5970                        match serde_json::from_str(&encoded) {
5971                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5972                            Err(error) => {
5973                                dlg.response_json_decode_error(&encoded, &error);
5974                                return Err(common::Error::JsonDecodeError(
5975                                    encoded.to_string(),
5976                                    error,
5977                                ));
5978                            }
5979                        }
5980                    };
5981
5982                    dlg.finished(true);
5983                    return Ok(response);
5984                }
5985            }
5986        }
5987    }
5988
5989    ///
5990    /// Sets the *request* property to the given value.
5991    ///
5992    /// Even though the property as already been set when instantiating this call,
5993    /// we provide this method for API completeness.
5994    pub fn request(mut self, new_value: Deployment) -> DeploymentUpdateCall<'a, C> {
5995        self._request = new_value;
5996        self
5997    }
5998    /// The project ID for this request.
5999    ///
6000    /// Sets the *project* path property to the given value.
6001    ///
6002    /// Even though the property as already been set when instantiating this call,
6003    /// we provide this method for API completeness.
6004    pub fn project(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
6005        self._project = new_value.to_string();
6006        self
6007    }
6008    /// The name of the deployment for this request.
6009    ///
6010    /// Sets the *deployment* path property to the given value.
6011    ///
6012    /// Even though the property as already been set when instantiating this call,
6013    /// we provide this method for API completeness.
6014    pub fn deployment(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
6015        self._deployment = new_value.to_string();
6016        self
6017    }
6018    /// If set to true, updates the deployment and creates and updates the "shell" resources but does not actually alter or instantiate these resources. This allows you to preview what your deployment will look like. You can use this intent to preview how an update would affect your deployment. You must provide a `target.config` with a configuration if this is set to true. After previewing a deployment, you can deploy your resources by making a request with the `update()` or you can `cancelPreview()` to remove the preview altogether. Note that the deployment will still exist after you cancel the preview and you must separately delete this deployment if you want to remove it.
6019    ///
6020    /// Sets the *preview* query property to the given value.
6021    pub fn preview(mut self, new_value: bool) -> DeploymentUpdateCall<'a, C> {
6022        self._preview = Some(new_value);
6023        self
6024    }
6025    ///
6026    /// Sets the *header.bypass billing filter* query property to the given value.
6027    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> DeploymentUpdateCall<'a, C> {
6028        self._header_bypass_billing_filter = Some(new_value);
6029        self
6030    }
6031    /// Sets the policy to use for deleting resources.
6032    ///
6033    /// Sets the *delete policy* query property to the given value.
6034    pub fn delete_policy(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
6035        self._delete_policy = Some(new_value.to_string());
6036        self
6037    }
6038    /// Sets the policy to use for creating new resources.
6039    ///
6040    /// Sets the *create policy* query property to the given value.
6041    pub fn create_policy(mut self, new_value: &str) -> DeploymentUpdateCall<'a, C> {
6042        self._create_policy = Some(new_value.to_string());
6043        self
6044    }
6045    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6046    /// while executing the actual API request.
6047    ///
6048    /// ````text
6049    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6050    /// ````
6051    ///
6052    /// Sets the *delegate* property to the given value.
6053    pub fn delegate(
6054        mut self,
6055        new_value: &'a mut dyn common::Delegate,
6056    ) -> DeploymentUpdateCall<'a, C> {
6057        self._delegate = Some(new_value);
6058        self
6059    }
6060
6061    /// Set any additional parameter of the query string used in the request.
6062    /// It should be used to set parameters which are not yet available through their own
6063    /// setters.
6064    ///
6065    /// Please note that this method must not be used to set any of the known parameters
6066    /// which have their own setter method. If done anyway, the request will fail.
6067    ///
6068    /// # Additional Parameters
6069    ///
6070    /// * *$.xgafv* (query-string) - V1 error format.
6071    /// * *access_token* (query-string) - OAuth access token.
6072    /// * *alt* (query-string) - Data format for response.
6073    /// * *callback* (query-string) - JSONP
6074    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6075    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6076    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6077    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6078    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6079    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6080    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6081    pub fn param<T>(mut self, name: T, value: T) -> DeploymentUpdateCall<'a, C>
6082    where
6083        T: AsRef<str>,
6084    {
6085        self._additional_params
6086            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6087        self
6088    }
6089
6090    /// Identifies the authorization scope for the method you are building.
6091    ///
6092    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6093    /// [`Scope::CloudPlatform`].
6094    ///
6095    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6096    /// tokens for more than one scope.
6097    ///
6098    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6099    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6100    /// sufficient, a read-write scope will do as well.
6101    pub fn add_scope<St>(mut self, scope: St) -> DeploymentUpdateCall<'a, C>
6102    where
6103        St: AsRef<str>,
6104    {
6105        self._scopes.insert(String::from(scope.as_ref()));
6106        self
6107    }
6108    /// Identifies the authorization scope(s) for the method you are building.
6109    ///
6110    /// See [`Self::add_scope()`] for details.
6111    pub fn add_scopes<I, St>(mut self, scopes: I) -> DeploymentUpdateCall<'a, C>
6112    where
6113        I: IntoIterator<Item = St>,
6114        St: AsRef<str>,
6115    {
6116        self._scopes
6117            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6118        self
6119    }
6120
6121    /// Removes all scopes, and no default scope will be used either.
6122    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6123    /// for details).
6124    pub fn clear_scopes(mut self) -> DeploymentUpdateCall<'a, C> {
6125        self._scopes.clear();
6126        self
6127    }
6128}
6129
6130/// Gets information about a specific manifest.
6131///
6132/// A builder for the *get* method supported by a *manifest* resource.
6133/// It is not used directly, but through a [`ManifestMethods`] instance.
6134///
6135/// # Example
6136///
6137/// Instantiate a resource method builder
6138///
6139/// ```test_harness,no_run
6140/// # extern crate hyper;
6141/// # extern crate hyper_rustls;
6142/// # extern crate google_deploymentmanager2 as deploymentmanager2;
6143/// # async fn dox() {
6144/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6145///
6146/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6147/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6148/// #     .with_native_roots()
6149/// #     .unwrap()
6150/// #     .https_only()
6151/// #     .enable_http2()
6152/// #     .build();
6153///
6154/// # let executor = hyper_util::rt::TokioExecutor::new();
6155/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6156/// #     secret,
6157/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6158/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6159/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6160/// #     ),
6161/// # ).build().await.unwrap();
6162///
6163/// # let client = hyper_util::client::legacy::Client::builder(
6164/// #     hyper_util::rt::TokioExecutor::new()
6165/// # )
6166/// # .build(
6167/// #     hyper_rustls::HttpsConnectorBuilder::new()
6168/// #         .with_native_roots()
6169/// #         .unwrap()
6170/// #         .https_or_http()
6171/// #         .enable_http2()
6172/// #         .build()
6173/// # );
6174/// # let mut hub = DeploymentManager::new(client, auth);
6175/// // You can configure optional parameters by calling the respective setters at will, and
6176/// // execute the final call using `doit()`.
6177/// // Values shown here are possibly random and not representative !
6178/// let result = hub.manifests().get("project", "deployment", "manifest")
6179///              .header_bypass_billing_filter(true)
6180///              .doit().await;
6181/// # }
6182/// ```
6183pub struct ManifestGetCall<'a, C>
6184where
6185    C: 'a,
6186{
6187    hub: &'a DeploymentManager<C>,
6188    _project: String,
6189    _deployment: String,
6190    _manifest: String,
6191    _header_bypass_billing_filter: Option<bool>,
6192    _delegate: Option<&'a mut dyn common::Delegate>,
6193    _additional_params: HashMap<String, String>,
6194    _scopes: BTreeSet<String>,
6195}
6196
6197impl<'a, C> common::CallBuilder for ManifestGetCall<'a, C> {}
6198
6199impl<'a, C> ManifestGetCall<'a, C>
6200where
6201    C: common::Connector,
6202{
6203    /// Perform the operation you have build so far.
6204    pub async fn doit(mut self) -> common::Result<(common::Response, Manifest)> {
6205        use std::borrow::Cow;
6206        use std::io::{Read, Seek};
6207
6208        use common::{url::Params, ToParts};
6209        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6210
6211        let mut dd = common::DefaultDelegate;
6212        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6213        dlg.begin(common::MethodInfo {
6214            id: "deploymentmanager.manifests.get",
6215            http_method: hyper::Method::GET,
6216        });
6217
6218        for &field in [
6219            "alt",
6220            "project",
6221            "deployment",
6222            "manifest",
6223            "header.bypassBillingFilter",
6224        ]
6225        .iter()
6226        {
6227            if self._additional_params.contains_key(field) {
6228                dlg.finished(false);
6229                return Err(common::Error::FieldClash(field));
6230            }
6231        }
6232
6233        let mut params = Params::with_capacity(6 + self._additional_params.len());
6234        params.push("project", self._project);
6235        params.push("deployment", self._deployment);
6236        params.push("manifest", self._manifest);
6237        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
6238            params.push("header.bypassBillingFilter", value.to_string());
6239        }
6240
6241        params.extend(self._additional_params.iter());
6242
6243        params.push("alt", "json");
6244        let mut url = self.hub._base_url.clone() + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}/manifests/{manifest}";
6245        if self._scopes.is_empty() {
6246            self._scopes
6247                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
6248        }
6249
6250        #[allow(clippy::single_element_loop)]
6251        for &(find_this, param_name) in [
6252            ("{project}", "project"),
6253            ("{deployment}", "deployment"),
6254            ("{manifest}", "manifest"),
6255        ]
6256        .iter()
6257        {
6258            url = params.uri_replacement(url, param_name, find_this, false);
6259        }
6260        {
6261            let to_remove = ["manifest", "deployment", "project"];
6262            params.remove_params(&to_remove);
6263        }
6264
6265        let url = params.parse_with_url(&url);
6266
6267        loop {
6268            let token = match self
6269                .hub
6270                .auth
6271                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6272                .await
6273            {
6274                Ok(token) => token,
6275                Err(e) => match dlg.token(e) {
6276                    Ok(token) => token,
6277                    Err(e) => {
6278                        dlg.finished(false);
6279                        return Err(common::Error::MissingToken(e));
6280                    }
6281                },
6282            };
6283            let mut req_result = {
6284                let client = &self.hub.client;
6285                dlg.pre_request();
6286                let mut req_builder = hyper::Request::builder()
6287                    .method(hyper::Method::GET)
6288                    .uri(url.as_str())
6289                    .header(USER_AGENT, self.hub._user_agent.clone());
6290
6291                if let Some(token) = token.as_ref() {
6292                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6293                }
6294
6295                let request = req_builder
6296                    .header(CONTENT_LENGTH, 0_u64)
6297                    .body(common::to_body::<String>(None));
6298
6299                client.request(request.unwrap()).await
6300            };
6301
6302            match req_result {
6303                Err(err) => {
6304                    if let common::Retry::After(d) = dlg.http_error(&err) {
6305                        sleep(d).await;
6306                        continue;
6307                    }
6308                    dlg.finished(false);
6309                    return Err(common::Error::HttpError(err));
6310                }
6311                Ok(res) => {
6312                    let (mut parts, body) = res.into_parts();
6313                    let mut body = common::Body::new(body);
6314                    if !parts.status.is_success() {
6315                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6316                        let error = serde_json::from_str(&common::to_string(&bytes));
6317                        let response = common::to_response(parts, bytes.into());
6318
6319                        if let common::Retry::After(d) =
6320                            dlg.http_failure(&response, error.as_ref().ok())
6321                        {
6322                            sleep(d).await;
6323                            continue;
6324                        }
6325
6326                        dlg.finished(false);
6327
6328                        return Err(match error {
6329                            Ok(value) => common::Error::BadRequest(value),
6330                            _ => common::Error::Failure(response),
6331                        });
6332                    }
6333                    let response = {
6334                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6335                        let encoded = common::to_string(&bytes);
6336                        match serde_json::from_str(&encoded) {
6337                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6338                            Err(error) => {
6339                                dlg.response_json_decode_error(&encoded, &error);
6340                                return Err(common::Error::JsonDecodeError(
6341                                    encoded.to_string(),
6342                                    error,
6343                                ));
6344                            }
6345                        }
6346                    };
6347
6348                    dlg.finished(true);
6349                    return Ok(response);
6350                }
6351            }
6352        }
6353    }
6354
6355    /// The project ID for this request.
6356    ///
6357    /// Sets the *project* path property to the given value.
6358    ///
6359    /// Even though the property as already been set when instantiating this call,
6360    /// we provide this method for API completeness.
6361    pub fn project(mut self, new_value: &str) -> ManifestGetCall<'a, C> {
6362        self._project = new_value.to_string();
6363        self
6364    }
6365    /// The name of the deployment for this request.
6366    ///
6367    /// Sets the *deployment* path property to the given value.
6368    ///
6369    /// Even though the property as already been set when instantiating this call,
6370    /// we provide this method for API completeness.
6371    pub fn deployment(mut self, new_value: &str) -> ManifestGetCall<'a, C> {
6372        self._deployment = new_value.to_string();
6373        self
6374    }
6375    /// The name of the manifest for this request.
6376    ///
6377    /// Sets the *manifest* path property to the given value.
6378    ///
6379    /// Even though the property as already been set when instantiating this call,
6380    /// we provide this method for API completeness.
6381    pub fn manifest(mut self, new_value: &str) -> ManifestGetCall<'a, C> {
6382        self._manifest = new_value.to_string();
6383        self
6384    }
6385    ///
6386    /// Sets the *header.bypass billing filter* query property to the given value.
6387    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> ManifestGetCall<'a, C> {
6388        self._header_bypass_billing_filter = Some(new_value);
6389        self
6390    }
6391    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6392    /// while executing the actual API request.
6393    ///
6394    /// ````text
6395    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6396    /// ````
6397    ///
6398    /// Sets the *delegate* property to the given value.
6399    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ManifestGetCall<'a, C> {
6400        self._delegate = Some(new_value);
6401        self
6402    }
6403
6404    /// Set any additional parameter of the query string used in the request.
6405    /// It should be used to set parameters which are not yet available through their own
6406    /// setters.
6407    ///
6408    /// Please note that this method must not be used to set any of the known parameters
6409    /// which have their own setter method. If done anyway, the request will fail.
6410    ///
6411    /// # Additional Parameters
6412    ///
6413    /// * *$.xgafv* (query-string) - V1 error format.
6414    /// * *access_token* (query-string) - OAuth access token.
6415    /// * *alt* (query-string) - Data format for response.
6416    /// * *callback* (query-string) - JSONP
6417    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6418    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6419    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6420    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6421    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6422    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6423    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6424    pub fn param<T>(mut self, name: T, value: T) -> ManifestGetCall<'a, C>
6425    where
6426        T: AsRef<str>,
6427    {
6428        self._additional_params
6429            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6430        self
6431    }
6432
6433    /// Identifies the authorization scope for the method you are building.
6434    ///
6435    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6436    /// [`Scope::NdevCloudmanReadonly`].
6437    ///
6438    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6439    /// tokens for more than one scope.
6440    ///
6441    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6442    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6443    /// sufficient, a read-write scope will do as well.
6444    pub fn add_scope<St>(mut self, scope: St) -> ManifestGetCall<'a, C>
6445    where
6446        St: AsRef<str>,
6447    {
6448        self._scopes.insert(String::from(scope.as_ref()));
6449        self
6450    }
6451    /// Identifies the authorization scope(s) for the method you are building.
6452    ///
6453    /// See [`Self::add_scope()`] for details.
6454    pub fn add_scopes<I, St>(mut self, scopes: I) -> ManifestGetCall<'a, C>
6455    where
6456        I: IntoIterator<Item = St>,
6457        St: AsRef<str>,
6458    {
6459        self._scopes
6460            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6461        self
6462    }
6463
6464    /// Removes all scopes, and no default scope will be used either.
6465    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6466    /// for details).
6467    pub fn clear_scopes(mut self) -> ManifestGetCall<'a, C> {
6468        self._scopes.clear();
6469        self
6470    }
6471}
6472
6473/// Lists all manifests for a given deployment.
6474///
6475/// A builder for the *list* method supported by a *manifest* resource.
6476/// It is not used directly, but through a [`ManifestMethods`] instance.
6477///
6478/// # Example
6479///
6480/// Instantiate a resource method builder
6481///
6482/// ```test_harness,no_run
6483/// # extern crate hyper;
6484/// # extern crate hyper_rustls;
6485/// # extern crate google_deploymentmanager2 as deploymentmanager2;
6486/// # async fn dox() {
6487/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6488///
6489/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6490/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6491/// #     .with_native_roots()
6492/// #     .unwrap()
6493/// #     .https_only()
6494/// #     .enable_http2()
6495/// #     .build();
6496///
6497/// # let executor = hyper_util::rt::TokioExecutor::new();
6498/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6499/// #     secret,
6500/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6501/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6502/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6503/// #     ),
6504/// # ).build().await.unwrap();
6505///
6506/// # let client = hyper_util::client::legacy::Client::builder(
6507/// #     hyper_util::rt::TokioExecutor::new()
6508/// # )
6509/// # .build(
6510/// #     hyper_rustls::HttpsConnectorBuilder::new()
6511/// #         .with_native_roots()
6512/// #         .unwrap()
6513/// #         .https_or_http()
6514/// #         .enable_http2()
6515/// #         .build()
6516/// # );
6517/// # let mut hub = DeploymentManager::new(client, auth);
6518/// // You can configure optional parameters by calling the respective setters at will, and
6519/// // execute the final call using `doit()`.
6520/// // Values shown here are possibly random and not representative !
6521/// let result = hub.manifests().list("project", "deployment")
6522///              .page_token("et")
6523///              .order_by("erat")
6524///              .max_results(5)
6525///              .filter("amet.")
6526///              .doit().await;
6527/// # }
6528/// ```
6529pub struct ManifestListCall<'a, C>
6530where
6531    C: 'a,
6532{
6533    hub: &'a DeploymentManager<C>,
6534    _project: String,
6535    _deployment: String,
6536    _page_token: Option<String>,
6537    _order_by: Option<String>,
6538    _max_results: Option<u32>,
6539    _filter: Option<String>,
6540    _delegate: Option<&'a mut dyn common::Delegate>,
6541    _additional_params: HashMap<String, String>,
6542    _scopes: BTreeSet<String>,
6543}
6544
6545impl<'a, C> common::CallBuilder for ManifestListCall<'a, C> {}
6546
6547impl<'a, C> ManifestListCall<'a, C>
6548where
6549    C: common::Connector,
6550{
6551    /// Perform the operation you have build so far.
6552    pub async fn doit(mut self) -> common::Result<(common::Response, ManifestsListResponse)> {
6553        use std::borrow::Cow;
6554        use std::io::{Read, Seek};
6555
6556        use common::{url::Params, ToParts};
6557        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6558
6559        let mut dd = common::DefaultDelegate;
6560        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6561        dlg.begin(common::MethodInfo {
6562            id: "deploymentmanager.manifests.list",
6563            http_method: hyper::Method::GET,
6564        });
6565
6566        for &field in [
6567            "alt",
6568            "project",
6569            "deployment",
6570            "pageToken",
6571            "orderBy",
6572            "maxResults",
6573            "filter",
6574        ]
6575        .iter()
6576        {
6577            if self._additional_params.contains_key(field) {
6578                dlg.finished(false);
6579                return Err(common::Error::FieldClash(field));
6580            }
6581        }
6582
6583        let mut params = Params::with_capacity(8 + self._additional_params.len());
6584        params.push("project", self._project);
6585        params.push("deployment", self._deployment);
6586        if let Some(value) = self._page_token.as_ref() {
6587            params.push("pageToken", value);
6588        }
6589        if let Some(value) = self._order_by.as_ref() {
6590            params.push("orderBy", value);
6591        }
6592        if let Some(value) = self._max_results.as_ref() {
6593            params.push("maxResults", value.to_string());
6594        }
6595        if let Some(value) = self._filter.as_ref() {
6596            params.push("filter", value);
6597        }
6598
6599        params.extend(self._additional_params.iter());
6600
6601        params.push("alt", "json");
6602        let mut url = self.hub._base_url.clone()
6603            + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}/manifests";
6604        if self._scopes.is_empty() {
6605            self._scopes
6606                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
6607        }
6608
6609        #[allow(clippy::single_element_loop)]
6610        for &(find_this, param_name) in
6611            [("{project}", "project"), ("{deployment}", "deployment")].iter()
6612        {
6613            url = params.uri_replacement(url, param_name, find_this, false);
6614        }
6615        {
6616            let to_remove = ["deployment", "project"];
6617            params.remove_params(&to_remove);
6618        }
6619
6620        let url = params.parse_with_url(&url);
6621
6622        loop {
6623            let token = match self
6624                .hub
6625                .auth
6626                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6627                .await
6628            {
6629                Ok(token) => token,
6630                Err(e) => match dlg.token(e) {
6631                    Ok(token) => token,
6632                    Err(e) => {
6633                        dlg.finished(false);
6634                        return Err(common::Error::MissingToken(e));
6635                    }
6636                },
6637            };
6638            let mut req_result = {
6639                let client = &self.hub.client;
6640                dlg.pre_request();
6641                let mut req_builder = hyper::Request::builder()
6642                    .method(hyper::Method::GET)
6643                    .uri(url.as_str())
6644                    .header(USER_AGENT, self.hub._user_agent.clone());
6645
6646                if let Some(token) = token.as_ref() {
6647                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6648                }
6649
6650                let request = req_builder
6651                    .header(CONTENT_LENGTH, 0_u64)
6652                    .body(common::to_body::<String>(None));
6653
6654                client.request(request.unwrap()).await
6655            };
6656
6657            match req_result {
6658                Err(err) => {
6659                    if let common::Retry::After(d) = dlg.http_error(&err) {
6660                        sleep(d).await;
6661                        continue;
6662                    }
6663                    dlg.finished(false);
6664                    return Err(common::Error::HttpError(err));
6665                }
6666                Ok(res) => {
6667                    let (mut parts, body) = res.into_parts();
6668                    let mut body = common::Body::new(body);
6669                    if !parts.status.is_success() {
6670                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6671                        let error = serde_json::from_str(&common::to_string(&bytes));
6672                        let response = common::to_response(parts, bytes.into());
6673
6674                        if let common::Retry::After(d) =
6675                            dlg.http_failure(&response, error.as_ref().ok())
6676                        {
6677                            sleep(d).await;
6678                            continue;
6679                        }
6680
6681                        dlg.finished(false);
6682
6683                        return Err(match error {
6684                            Ok(value) => common::Error::BadRequest(value),
6685                            _ => common::Error::Failure(response),
6686                        });
6687                    }
6688                    let response = {
6689                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6690                        let encoded = common::to_string(&bytes);
6691                        match serde_json::from_str(&encoded) {
6692                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6693                            Err(error) => {
6694                                dlg.response_json_decode_error(&encoded, &error);
6695                                return Err(common::Error::JsonDecodeError(
6696                                    encoded.to_string(),
6697                                    error,
6698                                ));
6699                            }
6700                        }
6701                    };
6702
6703                    dlg.finished(true);
6704                    return Ok(response);
6705                }
6706            }
6707        }
6708    }
6709
6710    /// The project ID for this request.
6711    ///
6712    /// Sets the *project* path property to the given value.
6713    ///
6714    /// Even though the property as already been set when instantiating this call,
6715    /// we provide this method for API completeness.
6716    pub fn project(mut self, new_value: &str) -> ManifestListCall<'a, C> {
6717        self._project = new_value.to_string();
6718        self
6719    }
6720    /// The name of the deployment for this request.
6721    ///
6722    /// Sets the *deployment* path property to the given value.
6723    ///
6724    /// Even though the property as already been set when instantiating this call,
6725    /// we provide this method for API completeness.
6726    pub fn deployment(mut self, new_value: &str) -> ManifestListCall<'a, C> {
6727        self._deployment = new_value.to_string();
6728        self
6729    }
6730    /// Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
6731    ///
6732    /// Sets the *page token* query property to the given value.
6733    pub fn page_token(mut self, new_value: &str) -> ManifestListCall<'a, C> {
6734        self._page_token = Some(new_value.to_string());
6735        self
6736    }
6737    /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
6738    ///
6739    /// Sets the *order by* query property to the given value.
6740    pub fn order_by(mut self, new_value: &str) -> ManifestListCall<'a, C> {
6741        self._order_by = Some(new_value.to_string());
6742        self
6743    }
6744    /// The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
6745    ///
6746    /// Sets the *max results* query property to the given value.
6747    pub fn max_results(mut self, new_value: u32) -> ManifestListCall<'a, C> {
6748        self._max_results = Some(new_value);
6749        self
6750    }
6751    /// A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
6752    ///
6753    /// Sets the *filter* query property to the given value.
6754    pub fn filter(mut self, new_value: &str) -> ManifestListCall<'a, C> {
6755        self._filter = Some(new_value.to_string());
6756        self
6757    }
6758    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6759    /// while executing the actual API request.
6760    ///
6761    /// ````text
6762    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6763    /// ````
6764    ///
6765    /// Sets the *delegate* property to the given value.
6766    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ManifestListCall<'a, C> {
6767        self._delegate = Some(new_value);
6768        self
6769    }
6770
6771    /// Set any additional parameter of the query string used in the request.
6772    /// It should be used to set parameters which are not yet available through their own
6773    /// setters.
6774    ///
6775    /// Please note that this method must not be used to set any of the known parameters
6776    /// which have their own setter method. If done anyway, the request will fail.
6777    ///
6778    /// # Additional Parameters
6779    ///
6780    /// * *$.xgafv* (query-string) - V1 error format.
6781    /// * *access_token* (query-string) - OAuth access token.
6782    /// * *alt* (query-string) - Data format for response.
6783    /// * *callback* (query-string) - JSONP
6784    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6785    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6786    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6787    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6788    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6789    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6790    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6791    pub fn param<T>(mut self, name: T, value: T) -> ManifestListCall<'a, C>
6792    where
6793        T: AsRef<str>,
6794    {
6795        self._additional_params
6796            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6797        self
6798    }
6799
6800    /// Identifies the authorization scope for the method you are building.
6801    ///
6802    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6803    /// [`Scope::NdevCloudmanReadonly`].
6804    ///
6805    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6806    /// tokens for more than one scope.
6807    ///
6808    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6809    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6810    /// sufficient, a read-write scope will do as well.
6811    pub fn add_scope<St>(mut self, scope: St) -> ManifestListCall<'a, C>
6812    where
6813        St: AsRef<str>,
6814    {
6815        self._scopes.insert(String::from(scope.as_ref()));
6816        self
6817    }
6818    /// Identifies the authorization scope(s) for the method you are building.
6819    ///
6820    /// See [`Self::add_scope()`] for details.
6821    pub fn add_scopes<I, St>(mut self, scopes: I) -> ManifestListCall<'a, C>
6822    where
6823        I: IntoIterator<Item = St>,
6824        St: AsRef<str>,
6825    {
6826        self._scopes
6827            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6828        self
6829    }
6830
6831    /// Removes all scopes, and no default scope will be used either.
6832    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6833    /// for details).
6834    pub fn clear_scopes(mut self) -> ManifestListCall<'a, C> {
6835        self._scopes.clear();
6836        self
6837    }
6838}
6839
6840/// Gets information about a specific operation.
6841///
6842/// A builder for the *get* method supported by a *operation* resource.
6843/// It is not used directly, but through a [`OperationMethods`] instance.
6844///
6845/// # Example
6846///
6847/// Instantiate a resource method builder
6848///
6849/// ```test_harness,no_run
6850/// # extern crate hyper;
6851/// # extern crate hyper_rustls;
6852/// # extern crate google_deploymentmanager2 as deploymentmanager2;
6853/// # async fn dox() {
6854/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6855///
6856/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6857/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6858/// #     .with_native_roots()
6859/// #     .unwrap()
6860/// #     .https_only()
6861/// #     .enable_http2()
6862/// #     .build();
6863///
6864/// # let executor = hyper_util::rt::TokioExecutor::new();
6865/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6866/// #     secret,
6867/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6868/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
6869/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
6870/// #     ),
6871/// # ).build().await.unwrap();
6872///
6873/// # let client = hyper_util::client::legacy::Client::builder(
6874/// #     hyper_util::rt::TokioExecutor::new()
6875/// # )
6876/// # .build(
6877/// #     hyper_rustls::HttpsConnectorBuilder::new()
6878/// #         .with_native_roots()
6879/// #         .unwrap()
6880/// #         .https_or_http()
6881/// #         .enable_http2()
6882/// #         .build()
6883/// # );
6884/// # let mut hub = DeploymentManager::new(client, auth);
6885/// // You can configure optional parameters by calling the respective setters at will, and
6886/// // execute the final call using `doit()`.
6887/// // Values shown here are possibly random and not representative !
6888/// let result = hub.operations().get("project", "operation")
6889///              .header_bypass_billing_filter(true)
6890///              .doit().await;
6891/// # }
6892/// ```
6893pub struct OperationGetCall<'a, C>
6894where
6895    C: 'a,
6896{
6897    hub: &'a DeploymentManager<C>,
6898    _project: String,
6899    _operation: String,
6900    _header_bypass_billing_filter: Option<bool>,
6901    _delegate: Option<&'a mut dyn common::Delegate>,
6902    _additional_params: HashMap<String, String>,
6903    _scopes: BTreeSet<String>,
6904}
6905
6906impl<'a, C> common::CallBuilder for OperationGetCall<'a, C> {}
6907
6908impl<'a, C> OperationGetCall<'a, C>
6909where
6910    C: common::Connector,
6911{
6912    /// Perform the operation you have build so far.
6913    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6914        use std::borrow::Cow;
6915        use std::io::{Read, Seek};
6916
6917        use common::{url::Params, ToParts};
6918        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6919
6920        let mut dd = common::DefaultDelegate;
6921        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6922        dlg.begin(common::MethodInfo {
6923            id: "deploymentmanager.operations.get",
6924            http_method: hyper::Method::GET,
6925        });
6926
6927        for &field in ["alt", "project", "operation", "header.bypassBillingFilter"].iter() {
6928            if self._additional_params.contains_key(field) {
6929                dlg.finished(false);
6930                return Err(common::Error::FieldClash(field));
6931            }
6932        }
6933
6934        let mut params = Params::with_capacity(5 + self._additional_params.len());
6935        params.push("project", self._project);
6936        params.push("operation", self._operation);
6937        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
6938            params.push("header.bypassBillingFilter", value.to_string());
6939        }
6940
6941        params.extend(self._additional_params.iter());
6942
6943        params.push("alt", "json");
6944        let mut url = self.hub._base_url.clone()
6945            + "deploymentmanager/v2/projects/{project}/global/operations/{operation}";
6946        if self._scopes.is_empty() {
6947            self._scopes
6948                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
6949        }
6950
6951        #[allow(clippy::single_element_loop)]
6952        for &(find_this, param_name) in
6953            [("{project}", "project"), ("{operation}", "operation")].iter()
6954        {
6955            url = params.uri_replacement(url, param_name, find_this, false);
6956        }
6957        {
6958            let to_remove = ["operation", "project"];
6959            params.remove_params(&to_remove);
6960        }
6961
6962        let url = params.parse_with_url(&url);
6963
6964        loop {
6965            let token = match self
6966                .hub
6967                .auth
6968                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6969                .await
6970            {
6971                Ok(token) => token,
6972                Err(e) => match dlg.token(e) {
6973                    Ok(token) => token,
6974                    Err(e) => {
6975                        dlg.finished(false);
6976                        return Err(common::Error::MissingToken(e));
6977                    }
6978                },
6979            };
6980            let mut req_result = {
6981                let client = &self.hub.client;
6982                dlg.pre_request();
6983                let mut req_builder = hyper::Request::builder()
6984                    .method(hyper::Method::GET)
6985                    .uri(url.as_str())
6986                    .header(USER_AGENT, self.hub._user_agent.clone());
6987
6988                if let Some(token) = token.as_ref() {
6989                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6990                }
6991
6992                let request = req_builder
6993                    .header(CONTENT_LENGTH, 0_u64)
6994                    .body(common::to_body::<String>(None));
6995
6996                client.request(request.unwrap()).await
6997            };
6998
6999            match req_result {
7000                Err(err) => {
7001                    if let common::Retry::After(d) = dlg.http_error(&err) {
7002                        sleep(d).await;
7003                        continue;
7004                    }
7005                    dlg.finished(false);
7006                    return Err(common::Error::HttpError(err));
7007                }
7008                Ok(res) => {
7009                    let (mut parts, body) = res.into_parts();
7010                    let mut body = common::Body::new(body);
7011                    if !parts.status.is_success() {
7012                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7013                        let error = serde_json::from_str(&common::to_string(&bytes));
7014                        let response = common::to_response(parts, bytes.into());
7015
7016                        if let common::Retry::After(d) =
7017                            dlg.http_failure(&response, error.as_ref().ok())
7018                        {
7019                            sleep(d).await;
7020                            continue;
7021                        }
7022
7023                        dlg.finished(false);
7024
7025                        return Err(match error {
7026                            Ok(value) => common::Error::BadRequest(value),
7027                            _ => common::Error::Failure(response),
7028                        });
7029                    }
7030                    let response = {
7031                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7032                        let encoded = common::to_string(&bytes);
7033                        match serde_json::from_str(&encoded) {
7034                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7035                            Err(error) => {
7036                                dlg.response_json_decode_error(&encoded, &error);
7037                                return Err(common::Error::JsonDecodeError(
7038                                    encoded.to_string(),
7039                                    error,
7040                                ));
7041                            }
7042                        }
7043                    };
7044
7045                    dlg.finished(true);
7046                    return Ok(response);
7047                }
7048            }
7049        }
7050    }
7051
7052    /// The project ID for this request.
7053    ///
7054    /// Sets the *project* path property to the given value.
7055    ///
7056    /// Even though the property as already been set when instantiating this call,
7057    /// we provide this method for API completeness.
7058    pub fn project(mut self, new_value: &str) -> OperationGetCall<'a, C> {
7059        self._project = new_value.to_string();
7060        self
7061    }
7062    /// The name of the operation for this request.
7063    ///
7064    /// Sets the *operation* path property to the given value.
7065    ///
7066    /// Even though the property as already been set when instantiating this call,
7067    /// we provide this method for API completeness.
7068    pub fn operation(mut self, new_value: &str) -> OperationGetCall<'a, C> {
7069        self._operation = new_value.to_string();
7070        self
7071    }
7072    ///
7073    /// Sets the *header.bypass billing filter* query property to the given value.
7074    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> OperationGetCall<'a, C> {
7075        self._header_bypass_billing_filter = Some(new_value);
7076        self
7077    }
7078    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7079    /// while executing the actual API request.
7080    ///
7081    /// ````text
7082    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7083    /// ````
7084    ///
7085    /// Sets the *delegate* property to the given value.
7086    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationGetCall<'a, C> {
7087        self._delegate = Some(new_value);
7088        self
7089    }
7090
7091    /// Set any additional parameter of the query string used in the request.
7092    /// It should be used to set parameters which are not yet available through their own
7093    /// setters.
7094    ///
7095    /// Please note that this method must not be used to set any of the known parameters
7096    /// which have their own setter method. If done anyway, the request will fail.
7097    ///
7098    /// # Additional Parameters
7099    ///
7100    /// * *$.xgafv* (query-string) - V1 error format.
7101    /// * *access_token* (query-string) - OAuth access token.
7102    /// * *alt* (query-string) - Data format for response.
7103    /// * *callback* (query-string) - JSONP
7104    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7105    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7106    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7107    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7108    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7109    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7110    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7111    pub fn param<T>(mut self, name: T, value: T) -> OperationGetCall<'a, C>
7112    where
7113        T: AsRef<str>,
7114    {
7115        self._additional_params
7116            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7117        self
7118    }
7119
7120    /// Identifies the authorization scope for the method you are building.
7121    ///
7122    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7123    /// [`Scope::NdevCloudmanReadonly`].
7124    ///
7125    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7126    /// tokens for more than one scope.
7127    ///
7128    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7129    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7130    /// sufficient, a read-write scope will do as well.
7131    pub fn add_scope<St>(mut self, scope: St) -> OperationGetCall<'a, C>
7132    where
7133        St: AsRef<str>,
7134    {
7135        self._scopes.insert(String::from(scope.as_ref()));
7136        self
7137    }
7138    /// Identifies the authorization scope(s) for the method you are building.
7139    ///
7140    /// See [`Self::add_scope()`] for details.
7141    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationGetCall<'a, C>
7142    where
7143        I: IntoIterator<Item = St>,
7144        St: AsRef<str>,
7145    {
7146        self._scopes
7147            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7148        self
7149    }
7150
7151    /// Removes all scopes, and no default scope will be used either.
7152    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7153    /// for details).
7154    pub fn clear_scopes(mut self) -> OperationGetCall<'a, C> {
7155        self._scopes.clear();
7156        self
7157    }
7158}
7159
7160/// Lists all operations for a project.
7161///
7162/// A builder for the *list* method supported by a *operation* resource.
7163/// It is not used directly, but through a [`OperationMethods`] instance.
7164///
7165/// # Example
7166///
7167/// Instantiate a resource method builder
7168///
7169/// ```test_harness,no_run
7170/// # extern crate hyper;
7171/// # extern crate hyper_rustls;
7172/// # extern crate google_deploymentmanager2 as deploymentmanager2;
7173/// # async fn dox() {
7174/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7175///
7176/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7177/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7178/// #     .with_native_roots()
7179/// #     .unwrap()
7180/// #     .https_only()
7181/// #     .enable_http2()
7182/// #     .build();
7183///
7184/// # let executor = hyper_util::rt::TokioExecutor::new();
7185/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7186/// #     secret,
7187/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7188/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7189/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7190/// #     ),
7191/// # ).build().await.unwrap();
7192///
7193/// # let client = hyper_util::client::legacy::Client::builder(
7194/// #     hyper_util::rt::TokioExecutor::new()
7195/// # )
7196/// # .build(
7197/// #     hyper_rustls::HttpsConnectorBuilder::new()
7198/// #         .with_native_roots()
7199/// #         .unwrap()
7200/// #         .https_or_http()
7201/// #         .enable_http2()
7202/// #         .build()
7203/// # );
7204/// # let mut hub = DeploymentManager::new(client, auth);
7205/// // You can configure optional parameters by calling the respective setters at will, and
7206/// // execute the final call using `doit()`.
7207/// // Values shown here are possibly random and not representative !
7208/// let result = hub.operations().list("project")
7209///              .page_token("accusam")
7210///              .order_by("voluptua.")
7211///              .max_results(67)
7212///              .filter("dolore")
7213///              .doit().await;
7214/// # }
7215/// ```
7216pub struct OperationListCall<'a, C>
7217where
7218    C: 'a,
7219{
7220    hub: &'a DeploymentManager<C>,
7221    _project: String,
7222    _page_token: Option<String>,
7223    _order_by: Option<String>,
7224    _max_results: Option<u32>,
7225    _filter: Option<String>,
7226    _delegate: Option<&'a mut dyn common::Delegate>,
7227    _additional_params: HashMap<String, String>,
7228    _scopes: BTreeSet<String>,
7229}
7230
7231impl<'a, C> common::CallBuilder for OperationListCall<'a, C> {}
7232
7233impl<'a, C> OperationListCall<'a, C>
7234where
7235    C: common::Connector,
7236{
7237    /// Perform the operation you have build so far.
7238    pub async fn doit(mut self) -> common::Result<(common::Response, OperationsListResponse)> {
7239        use std::borrow::Cow;
7240        use std::io::{Read, Seek};
7241
7242        use common::{url::Params, ToParts};
7243        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7244
7245        let mut dd = common::DefaultDelegate;
7246        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7247        dlg.begin(common::MethodInfo {
7248            id: "deploymentmanager.operations.list",
7249            http_method: hyper::Method::GET,
7250        });
7251
7252        for &field in [
7253            "alt",
7254            "project",
7255            "pageToken",
7256            "orderBy",
7257            "maxResults",
7258            "filter",
7259        ]
7260        .iter()
7261        {
7262            if self._additional_params.contains_key(field) {
7263                dlg.finished(false);
7264                return Err(common::Error::FieldClash(field));
7265            }
7266        }
7267
7268        let mut params = Params::with_capacity(7 + self._additional_params.len());
7269        params.push("project", self._project);
7270        if let Some(value) = self._page_token.as_ref() {
7271            params.push("pageToken", value);
7272        }
7273        if let Some(value) = self._order_by.as_ref() {
7274            params.push("orderBy", value);
7275        }
7276        if let Some(value) = self._max_results.as_ref() {
7277            params.push("maxResults", value.to_string());
7278        }
7279        if let Some(value) = self._filter.as_ref() {
7280            params.push("filter", value);
7281        }
7282
7283        params.extend(self._additional_params.iter());
7284
7285        params.push("alt", "json");
7286        let mut url = self.hub._base_url.clone()
7287            + "deploymentmanager/v2/projects/{project}/global/operations";
7288        if self._scopes.is_empty() {
7289            self._scopes
7290                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
7291        }
7292
7293        #[allow(clippy::single_element_loop)]
7294        for &(find_this, param_name) in [("{project}", "project")].iter() {
7295            url = params.uri_replacement(url, param_name, find_this, false);
7296        }
7297        {
7298            let to_remove = ["project"];
7299            params.remove_params(&to_remove);
7300        }
7301
7302        let url = params.parse_with_url(&url);
7303
7304        loop {
7305            let token = match self
7306                .hub
7307                .auth
7308                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7309                .await
7310            {
7311                Ok(token) => token,
7312                Err(e) => match dlg.token(e) {
7313                    Ok(token) => token,
7314                    Err(e) => {
7315                        dlg.finished(false);
7316                        return Err(common::Error::MissingToken(e));
7317                    }
7318                },
7319            };
7320            let mut req_result = {
7321                let client = &self.hub.client;
7322                dlg.pre_request();
7323                let mut req_builder = hyper::Request::builder()
7324                    .method(hyper::Method::GET)
7325                    .uri(url.as_str())
7326                    .header(USER_AGENT, self.hub._user_agent.clone());
7327
7328                if let Some(token) = token.as_ref() {
7329                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7330                }
7331
7332                let request = req_builder
7333                    .header(CONTENT_LENGTH, 0_u64)
7334                    .body(common::to_body::<String>(None));
7335
7336                client.request(request.unwrap()).await
7337            };
7338
7339            match req_result {
7340                Err(err) => {
7341                    if let common::Retry::After(d) = dlg.http_error(&err) {
7342                        sleep(d).await;
7343                        continue;
7344                    }
7345                    dlg.finished(false);
7346                    return Err(common::Error::HttpError(err));
7347                }
7348                Ok(res) => {
7349                    let (mut parts, body) = res.into_parts();
7350                    let mut body = common::Body::new(body);
7351                    if !parts.status.is_success() {
7352                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7353                        let error = serde_json::from_str(&common::to_string(&bytes));
7354                        let response = common::to_response(parts, bytes.into());
7355
7356                        if let common::Retry::After(d) =
7357                            dlg.http_failure(&response, error.as_ref().ok())
7358                        {
7359                            sleep(d).await;
7360                            continue;
7361                        }
7362
7363                        dlg.finished(false);
7364
7365                        return Err(match error {
7366                            Ok(value) => common::Error::BadRequest(value),
7367                            _ => common::Error::Failure(response),
7368                        });
7369                    }
7370                    let response = {
7371                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7372                        let encoded = common::to_string(&bytes);
7373                        match serde_json::from_str(&encoded) {
7374                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7375                            Err(error) => {
7376                                dlg.response_json_decode_error(&encoded, &error);
7377                                return Err(common::Error::JsonDecodeError(
7378                                    encoded.to_string(),
7379                                    error,
7380                                ));
7381                            }
7382                        }
7383                    };
7384
7385                    dlg.finished(true);
7386                    return Ok(response);
7387                }
7388            }
7389        }
7390    }
7391
7392    /// The project ID for this request.
7393    ///
7394    /// Sets the *project* path property to the given value.
7395    ///
7396    /// Even though the property as already been set when instantiating this call,
7397    /// we provide this method for API completeness.
7398    pub fn project(mut self, new_value: &str) -> OperationListCall<'a, C> {
7399        self._project = new_value.to_string();
7400        self
7401    }
7402    /// Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
7403    ///
7404    /// Sets the *page token* query property to the given value.
7405    pub fn page_token(mut self, new_value: &str) -> OperationListCall<'a, C> {
7406        self._page_token = Some(new_value.to_string());
7407        self
7408    }
7409    /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
7410    ///
7411    /// Sets the *order by* query property to the given value.
7412    pub fn order_by(mut self, new_value: &str) -> OperationListCall<'a, C> {
7413        self._order_by = Some(new_value.to_string());
7414        self
7415    }
7416    /// The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
7417    ///
7418    /// Sets the *max results* query property to the given value.
7419    pub fn max_results(mut self, new_value: u32) -> OperationListCall<'a, C> {
7420        self._max_results = Some(new_value);
7421        self
7422    }
7423    /// A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
7424    ///
7425    /// Sets the *filter* query property to the given value.
7426    pub fn filter(mut self, new_value: &str) -> OperationListCall<'a, C> {
7427        self._filter = Some(new_value.to_string());
7428        self
7429    }
7430    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7431    /// while executing the actual API request.
7432    ///
7433    /// ````text
7434    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7435    /// ````
7436    ///
7437    /// Sets the *delegate* property to the given value.
7438    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> OperationListCall<'a, C> {
7439        self._delegate = Some(new_value);
7440        self
7441    }
7442
7443    /// Set any additional parameter of the query string used in the request.
7444    /// It should be used to set parameters which are not yet available through their own
7445    /// setters.
7446    ///
7447    /// Please note that this method must not be used to set any of the known parameters
7448    /// which have their own setter method. If done anyway, the request will fail.
7449    ///
7450    /// # Additional Parameters
7451    ///
7452    /// * *$.xgafv* (query-string) - V1 error format.
7453    /// * *access_token* (query-string) - OAuth access token.
7454    /// * *alt* (query-string) - Data format for response.
7455    /// * *callback* (query-string) - JSONP
7456    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7457    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7458    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7459    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7460    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7461    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7462    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7463    pub fn param<T>(mut self, name: T, value: T) -> OperationListCall<'a, C>
7464    where
7465        T: AsRef<str>,
7466    {
7467        self._additional_params
7468            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7469        self
7470    }
7471
7472    /// Identifies the authorization scope for the method you are building.
7473    ///
7474    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7475    /// [`Scope::NdevCloudmanReadonly`].
7476    ///
7477    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7478    /// tokens for more than one scope.
7479    ///
7480    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7481    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7482    /// sufficient, a read-write scope will do as well.
7483    pub fn add_scope<St>(mut self, scope: St) -> OperationListCall<'a, C>
7484    where
7485        St: AsRef<str>,
7486    {
7487        self._scopes.insert(String::from(scope.as_ref()));
7488        self
7489    }
7490    /// Identifies the authorization scope(s) for the method you are building.
7491    ///
7492    /// See [`Self::add_scope()`] for details.
7493    pub fn add_scopes<I, St>(mut self, scopes: I) -> OperationListCall<'a, C>
7494    where
7495        I: IntoIterator<Item = St>,
7496        St: AsRef<str>,
7497    {
7498        self._scopes
7499            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7500        self
7501    }
7502
7503    /// Removes all scopes, and no default scope will be used either.
7504    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7505    /// for details).
7506    pub fn clear_scopes(mut self) -> OperationListCall<'a, C> {
7507        self._scopes.clear();
7508        self
7509    }
7510}
7511
7512/// Gets information about a single resource.
7513///
7514/// A builder for the *get* method supported by a *resource* resource.
7515/// It is not used directly, but through a [`ResourceMethods`] instance.
7516///
7517/// # Example
7518///
7519/// Instantiate a resource method builder
7520///
7521/// ```test_harness,no_run
7522/// # extern crate hyper;
7523/// # extern crate hyper_rustls;
7524/// # extern crate google_deploymentmanager2 as deploymentmanager2;
7525/// # async fn dox() {
7526/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7527///
7528/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7529/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7530/// #     .with_native_roots()
7531/// #     .unwrap()
7532/// #     .https_only()
7533/// #     .enable_http2()
7534/// #     .build();
7535///
7536/// # let executor = hyper_util::rt::TokioExecutor::new();
7537/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7538/// #     secret,
7539/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7540/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7541/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7542/// #     ),
7543/// # ).build().await.unwrap();
7544///
7545/// # let client = hyper_util::client::legacy::Client::builder(
7546/// #     hyper_util::rt::TokioExecutor::new()
7547/// # )
7548/// # .build(
7549/// #     hyper_rustls::HttpsConnectorBuilder::new()
7550/// #         .with_native_roots()
7551/// #         .unwrap()
7552/// #         .https_or_http()
7553/// #         .enable_http2()
7554/// #         .build()
7555/// # );
7556/// # let mut hub = DeploymentManager::new(client, auth);
7557/// // You can configure optional parameters by calling the respective setters at will, and
7558/// // execute the final call using `doit()`.
7559/// // Values shown here are possibly random and not representative !
7560/// let result = hub.resources().get("project", "deployment", "resource")
7561///              .header_bypass_billing_filter(false)
7562///              .doit().await;
7563/// # }
7564/// ```
7565pub struct ResourceGetCall<'a, C>
7566where
7567    C: 'a,
7568{
7569    hub: &'a DeploymentManager<C>,
7570    _project: String,
7571    _deployment: String,
7572    _resource: String,
7573    _header_bypass_billing_filter: Option<bool>,
7574    _delegate: Option<&'a mut dyn common::Delegate>,
7575    _additional_params: HashMap<String, String>,
7576    _scopes: BTreeSet<String>,
7577}
7578
7579impl<'a, C> common::CallBuilder for ResourceGetCall<'a, C> {}
7580
7581impl<'a, C> ResourceGetCall<'a, C>
7582where
7583    C: common::Connector,
7584{
7585    /// Perform the operation you have build so far.
7586    pub async fn doit(mut self) -> common::Result<(common::Response, Resource)> {
7587        use std::borrow::Cow;
7588        use std::io::{Read, Seek};
7589
7590        use common::{url::Params, ToParts};
7591        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7592
7593        let mut dd = common::DefaultDelegate;
7594        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7595        dlg.begin(common::MethodInfo {
7596            id: "deploymentmanager.resources.get",
7597            http_method: hyper::Method::GET,
7598        });
7599
7600        for &field in [
7601            "alt",
7602            "project",
7603            "deployment",
7604            "resource",
7605            "header.bypassBillingFilter",
7606        ]
7607        .iter()
7608        {
7609            if self._additional_params.contains_key(field) {
7610                dlg.finished(false);
7611                return Err(common::Error::FieldClash(field));
7612            }
7613        }
7614
7615        let mut params = Params::with_capacity(6 + self._additional_params.len());
7616        params.push("project", self._project);
7617        params.push("deployment", self._deployment);
7618        params.push("resource", self._resource);
7619        if let Some(value) = self._header_bypass_billing_filter.as_ref() {
7620            params.push("header.bypassBillingFilter", value.to_string());
7621        }
7622
7623        params.extend(self._additional_params.iter());
7624
7625        params.push("alt", "json");
7626        let mut url = self.hub._base_url.clone() + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}/resources/{resource}";
7627        if self._scopes.is_empty() {
7628            self._scopes
7629                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
7630        }
7631
7632        #[allow(clippy::single_element_loop)]
7633        for &(find_this, param_name) in [
7634            ("{project}", "project"),
7635            ("{deployment}", "deployment"),
7636            ("{resource}", "resource"),
7637        ]
7638        .iter()
7639        {
7640            url = params.uri_replacement(url, param_name, find_this, false);
7641        }
7642        {
7643            let to_remove = ["resource", "deployment", "project"];
7644            params.remove_params(&to_remove);
7645        }
7646
7647        let url = params.parse_with_url(&url);
7648
7649        loop {
7650            let token = match self
7651                .hub
7652                .auth
7653                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7654                .await
7655            {
7656                Ok(token) => token,
7657                Err(e) => match dlg.token(e) {
7658                    Ok(token) => token,
7659                    Err(e) => {
7660                        dlg.finished(false);
7661                        return Err(common::Error::MissingToken(e));
7662                    }
7663                },
7664            };
7665            let mut req_result = {
7666                let client = &self.hub.client;
7667                dlg.pre_request();
7668                let mut req_builder = hyper::Request::builder()
7669                    .method(hyper::Method::GET)
7670                    .uri(url.as_str())
7671                    .header(USER_AGENT, self.hub._user_agent.clone());
7672
7673                if let Some(token) = token.as_ref() {
7674                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7675                }
7676
7677                let request = req_builder
7678                    .header(CONTENT_LENGTH, 0_u64)
7679                    .body(common::to_body::<String>(None));
7680
7681                client.request(request.unwrap()).await
7682            };
7683
7684            match req_result {
7685                Err(err) => {
7686                    if let common::Retry::After(d) = dlg.http_error(&err) {
7687                        sleep(d).await;
7688                        continue;
7689                    }
7690                    dlg.finished(false);
7691                    return Err(common::Error::HttpError(err));
7692                }
7693                Ok(res) => {
7694                    let (mut parts, body) = res.into_parts();
7695                    let mut body = common::Body::new(body);
7696                    if !parts.status.is_success() {
7697                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7698                        let error = serde_json::from_str(&common::to_string(&bytes));
7699                        let response = common::to_response(parts, bytes.into());
7700
7701                        if let common::Retry::After(d) =
7702                            dlg.http_failure(&response, error.as_ref().ok())
7703                        {
7704                            sleep(d).await;
7705                            continue;
7706                        }
7707
7708                        dlg.finished(false);
7709
7710                        return Err(match error {
7711                            Ok(value) => common::Error::BadRequest(value),
7712                            _ => common::Error::Failure(response),
7713                        });
7714                    }
7715                    let response = {
7716                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7717                        let encoded = common::to_string(&bytes);
7718                        match serde_json::from_str(&encoded) {
7719                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7720                            Err(error) => {
7721                                dlg.response_json_decode_error(&encoded, &error);
7722                                return Err(common::Error::JsonDecodeError(
7723                                    encoded.to_string(),
7724                                    error,
7725                                ));
7726                            }
7727                        }
7728                    };
7729
7730                    dlg.finished(true);
7731                    return Ok(response);
7732                }
7733            }
7734        }
7735    }
7736
7737    /// The project ID for this request.
7738    ///
7739    /// Sets the *project* path property to the given value.
7740    ///
7741    /// Even though the property as already been set when instantiating this call,
7742    /// we provide this method for API completeness.
7743    pub fn project(mut self, new_value: &str) -> ResourceGetCall<'a, C> {
7744        self._project = new_value.to_string();
7745        self
7746    }
7747    /// The name of the deployment for this request.
7748    ///
7749    /// Sets the *deployment* path property to the given value.
7750    ///
7751    /// Even though the property as already been set when instantiating this call,
7752    /// we provide this method for API completeness.
7753    pub fn deployment(mut self, new_value: &str) -> ResourceGetCall<'a, C> {
7754        self._deployment = new_value.to_string();
7755        self
7756    }
7757    /// The name of the resource for this request.
7758    ///
7759    /// Sets the *resource* path property to the given value.
7760    ///
7761    /// Even though the property as already been set when instantiating this call,
7762    /// we provide this method for API completeness.
7763    pub fn resource(mut self, new_value: &str) -> ResourceGetCall<'a, C> {
7764        self._resource = new_value.to_string();
7765        self
7766    }
7767    ///
7768    /// Sets the *header.bypass billing filter* query property to the given value.
7769    pub fn header_bypass_billing_filter(mut self, new_value: bool) -> ResourceGetCall<'a, C> {
7770        self._header_bypass_billing_filter = Some(new_value);
7771        self
7772    }
7773    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7774    /// while executing the actual API request.
7775    ///
7776    /// ````text
7777    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7778    /// ````
7779    ///
7780    /// Sets the *delegate* property to the given value.
7781    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ResourceGetCall<'a, C> {
7782        self._delegate = Some(new_value);
7783        self
7784    }
7785
7786    /// Set any additional parameter of the query string used in the request.
7787    /// It should be used to set parameters which are not yet available through their own
7788    /// setters.
7789    ///
7790    /// Please note that this method must not be used to set any of the known parameters
7791    /// which have their own setter method. If done anyway, the request will fail.
7792    ///
7793    /// # Additional Parameters
7794    ///
7795    /// * *$.xgafv* (query-string) - V1 error format.
7796    /// * *access_token* (query-string) - OAuth access token.
7797    /// * *alt* (query-string) - Data format for response.
7798    /// * *callback* (query-string) - JSONP
7799    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7800    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7801    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7802    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7803    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7804    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7805    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7806    pub fn param<T>(mut self, name: T, value: T) -> ResourceGetCall<'a, C>
7807    where
7808        T: AsRef<str>,
7809    {
7810        self._additional_params
7811            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7812        self
7813    }
7814
7815    /// Identifies the authorization scope for the method you are building.
7816    ///
7817    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7818    /// [`Scope::NdevCloudmanReadonly`].
7819    ///
7820    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7821    /// tokens for more than one scope.
7822    ///
7823    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7824    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7825    /// sufficient, a read-write scope will do as well.
7826    pub fn add_scope<St>(mut self, scope: St) -> ResourceGetCall<'a, C>
7827    where
7828        St: AsRef<str>,
7829    {
7830        self._scopes.insert(String::from(scope.as_ref()));
7831        self
7832    }
7833    /// Identifies the authorization scope(s) for the method you are building.
7834    ///
7835    /// See [`Self::add_scope()`] for details.
7836    pub fn add_scopes<I, St>(mut self, scopes: I) -> ResourceGetCall<'a, C>
7837    where
7838        I: IntoIterator<Item = St>,
7839        St: AsRef<str>,
7840    {
7841        self._scopes
7842            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7843        self
7844    }
7845
7846    /// Removes all scopes, and no default scope will be used either.
7847    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7848    /// for details).
7849    pub fn clear_scopes(mut self) -> ResourceGetCall<'a, C> {
7850        self._scopes.clear();
7851        self
7852    }
7853}
7854
7855/// Lists all resources in a given deployment.
7856///
7857/// A builder for the *list* method supported by a *resource* resource.
7858/// It is not used directly, but through a [`ResourceMethods`] instance.
7859///
7860/// # Example
7861///
7862/// Instantiate a resource method builder
7863///
7864/// ```test_harness,no_run
7865/// # extern crate hyper;
7866/// # extern crate hyper_rustls;
7867/// # extern crate google_deploymentmanager2 as deploymentmanager2;
7868/// # async fn dox() {
7869/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7870///
7871/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7872/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7873/// #     .with_native_roots()
7874/// #     .unwrap()
7875/// #     .https_only()
7876/// #     .enable_http2()
7877/// #     .build();
7878///
7879/// # let executor = hyper_util::rt::TokioExecutor::new();
7880/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7881/// #     secret,
7882/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7883/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
7884/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
7885/// #     ),
7886/// # ).build().await.unwrap();
7887///
7888/// # let client = hyper_util::client::legacy::Client::builder(
7889/// #     hyper_util::rt::TokioExecutor::new()
7890/// # )
7891/// # .build(
7892/// #     hyper_rustls::HttpsConnectorBuilder::new()
7893/// #         .with_native_roots()
7894/// #         .unwrap()
7895/// #         .https_or_http()
7896/// #         .enable_http2()
7897/// #         .build()
7898/// # );
7899/// # let mut hub = DeploymentManager::new(client, auth);
7900/// // You can configure optional parameters by calling the respective setters at will, and
7901/// // execute the final call using `doit()`.
7902/// // Values shown here are possibly random and not representative !
7903/// let result = hub.resources().list("project", "deployment")
7904///              .page_token("no")
7905///              .order_by("est")
7906///              .max_results(74)
7907///              .filter("sed")
7908///              .doit().await;
7909/// # }
7910/// ```
7911pub struct ResourceListCall<'a, C>
7912where
7913    C: 'a,
7914{
7915    hub: &'a DeploymentManager<C>,
7916    _project: String,
7917    _deployment: String,
7918    _page_token: Option<String>,
7919    _order_by: Option<String>,
7920    _max_results: Option<u32>,
7921    _filter: Option<String>,
7922    _delegate: Option<&'a mut dyn common::Delegate>,
7923    _additional_params: HashMap<String, String>,
7924    _scopes: BTreeSet<String>,
7925}
7926
7927impl<'a, C> common::CallBuilder for ResourceListCall<'a, C> {}
7928
7929impl<'a, C> ResourceListCall<'a, C>
7930where
7931    C: common::Connector,
7932{
7933    /// Perform the operation you have build so far.
7934    pub async fn doit(mut self) -> common::Result<(common::Response, ResourcesListResponse)> {
7935        use std::borrow::Cow;
7936        use std::io::{Read, Seek};
7937
7938        use common::{url::Params, ToParts};
7939        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7940
7941        let mut dd = common::DefaultDelegate;
7942        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7943        dlg.begin(common::MethodInfo {
7944            id: "deploymentmanager.resources.list",
7945            http_method: hyper::Method::GET,
7946        });
7947
7948        for &field in [
7949            "alt",
7950            "project",
7951            "deployment",
7952            "pageToken",
7953            "orderBy",
7954            "maxResults",
7955            "filter",
7956        ]
7957        .iter()
7958        {
7959            if self._additional_params.contains_key(field) {
7960                dlg.finished(false);
7961                return Err(common::Error::FieldClash(field));
7962            }
7963        }
7964
7965        let mut params = Params::with_capacity(8 + self._additional_params.len());
7966        params.push("project", self._project);
7967        params.push("deployment", self._deployment);
7968        if let Some(value) = self._page_token.as_ref() {
7969            params.push("pageToken", value);
7970        }
7971        if let Some(value) = self._order_by.as_ref() {
7972            params.push("orderBy", value);
7973        }
7974        if let Some(value) = self._max_results.as_ref() {
7975            params.push("maxResults", value.to_string());
7976        }
7977        if let Some(value) = self._filter.as_ref() {
7978            params.push("filter", value);
7979        }
7980
7981        params.extend(self._additional_params.iter());
7982
7983        params.push("alt", "json");
7984        let mut url = self.hub._base_url.clone()
7985            + "deploymentmanager/v2/projects/{project}/global/deployments/{deployment}/resources";
7986        if self._scopes.is_empty() {
7987            self._scopes
7988                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
7989        }
7990
7991        #[allow(clippy::single_element_loop)]
7992        for &(find_this, param_name) in
7993            [("{project}", "project"), ("{deployment}", "deployment")].iter()
7994        {
7995            url = params.uri_replacement(url, param_name, find_this, false);
7996        }
7997        {
7998            let to_remove = ["deployment", "project"];
7999            params.remove_params(&to_remove);
8000        }
8001
8002        let url = params.parse_with_url(&url);
8003
8004        loop {
8005            let token = match self
8006                .hub
8007                .auth
8008                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8009                .await
8010            {
8011                Ok(token) => token,
8012                Err(e) => match dlg.token(e) {
8013                    Ok(token) => token,
8014                    Err(e) => {
8015                        dlg.finished(false);
8016                        return Err(common::Error::MissingToken(e));
8017                    }
8018                },
8019            };
8020            let mut req_result = {
8021                let client = &self.hub.client;
8022                dlg.pre_request();
8023                let mut req_builder = hyper::Request::builder()
8024                    .method(hyper::Method::GET)
8025                    .uri(url.as_str())
8026                    .header(USER_AGENT, self.hub._user_agent.clone());
8027
8028                if let Some(token) = token.as_ref() {
8029                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8030                }
8031
8032                let request = req_builder
8033                    .header(CONTENT_LENGTH, 0_u64)
8034                    .body(common::to_body::<String>(None));
8035
8036                client.request(request.unwrap()).await
8037            };
8038
8039            match req_result {
8040                Err(err) => {
8041                    if let common::Retry::After(d) = dlg.http_error(&err) {
8042                        sleep(d).await;
8043                        continue;
8044                    }
8045                    dlg.finished(false);
8046                    return Err(common::Error::HttpError(err));
8047                }
8048                Ok(res) => {
8049                    let (mut parts, body) = res.into_parts();
8050                    let mut body = common::Body::new(body);
8051                    if !parts.status.is_success() {
8052                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8053                        let error = serde_json::from_str(&common::to_string(&bytes));
8054                        let response = common::to_response(parts, bytes.into());
8055
8056                        if let common::Retry::After(d) =
8057                            dlg.http_failure(&response, error.as_ref().ok())
8058                        {
8059                            sleep(d).await;
8060                            continue;
8061                        }
8062
8063                        dlg.finished(false);
8064
8065                        return Err(match error {
8066                            Ok(value) => common::Error::BadRequest(value),
8067                            _ => common::Error::Failure(response),
8068                        });
8069                    }
8070                    let response = {
8071                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8072                        let encoded = common::to_string(&bytes);
8073                        match serde_json::from_str(&encoded) {
8074                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8075                            Err(error) => {
8076                                dlg.response_json_decode_error(&encoded, &error);
8077                                return Err(common::Error::JsonDecodeError(
8078                                    encoded.to_string(),
8079                                    error,
8080                                ));
8081                            }
8082                        }
8083                    };
8084
8085                    dlg.finished(true);
8086                    return Ok(response);
8087                }
8088            }
8089        }
8090    }
8091
8092    /// The project ID for this request.
8093    ///
8094    /// Sets the *project* path property to the given value.
8095    ///
8096    /// Even though the property as already been set when instantiating this call,
8097    /// we provide this method for API completeness.
8098    pub fn project(mut self, new_value: &str) -> ResourceListCall<'a, C> {
8099        self._project = new_value.to_string();
8100        self
8101    }
8102    /// The name of the deployment for this request.
8103    ///
8104    /// Sets the *deployment* path property to the given value.
8105    ///
8106    /// Even though the property as already been set when instantiating this call,
8107    /// we provide this method for API completeness.
8108    pub fn deployment(mut self, new_value: &str) -> ResourceListCall<'a, C> {
8109        self._deployment = new_value.to_string();
8110        self
8111    }
8112    /// Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
8113    ///
8114    /// Sets the *page token* query property to the given value.
8115    pub fn page_token(mut self, new_value: &str) -> ResourceListCall<'a, C> {
8116        self._page_token = Some(new_value.to_string());
8117        self
8118    }
8119    /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
8120    ///
8121    /// Sets the *order by* query property to the given value.
8122    pub fn order_by(mut self, new_value: &str) -> ResourceListCall<'a, C> {
8123        self._order_by = Some(new_value.to_string());
8124        self
8125    }
8126    /// The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
8127    ///
8128    /// Sets the *max results* query property to the given value.
8129    pub fn max_results(mut self, new_value: u32) -> ResourceListCall<'a, C> {
8130        self._max_results = Some(new_value);
8131        self
8132    }
8133    /// A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
8134    ///
8135    /// Sets the *filter* query property to the given value.
8136    pub fn filter(mut self, new_value: &str) -> ResourceListCall<'a, C> {
8137        self._filter = Some(new_value.to_string());
8138        self
8139    }
8140    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8141    /// while executing the actual API request.
8142    ///
8143    /// ````text
8144    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8145    /// ````
8146    ///
8147    /// Sets the *delegate* property to the given value.
8148    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> ResourceListCall<'a, C> {
8149        self._delegate = Some(new_value);
8150        self
8151    }
8152
8153    /// Set any additional parameter of the query string used in the request.
8154    /// It should be used to set parameters which are not yet available through their own
8155    /// setters.
8156    ///
8157    /// Please note that this method must not be used to set any of the known parameters
8158    /// which have their own setter method. If done anyway, the request will fail.
8159    ///
8160    /// # Additional Parameters
8161    ///
8162    /// * *$.xgafv* (query-string) - V1 error format.
8163    /// * *access_token* (query-string) - OAuth access token.
8164    /// * *alt* (query-string) - Data format for response.
8165    /// * *callback* (query-string) - JSONP
8166    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8167    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8168    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8169    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8170    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8171    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8172    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8173    pub fn param<T>(mut self, name: T, value: T) -> ResourceListCall<'a, C>
8174    where
8175        T: AsRef<str>,
8176    {
8177        self._additional_params
8178            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8179        self
8180    }
8181
8182    /// Identifies the authorization scope for the method you are building.
8183    ///
8184    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8185    /// [`Scope::NdevCloudmanReadonly`].
8186    ///
8187    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8188    /// tokens for more than one scope.
8189    ///
8190    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8191    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8192    /// sufficient, a read-write scope will do as well.
8193    pub fn add_scope<St>(mut self, scope: St) -> ResourceListCall<'a, C>
8194    where
8195        St: AsRef<str>,
8196    {
8197        self._scopes.insert(String::from(scope.as_ref()));
8198        self
8199    }
8200    /// Identifies the authorization scope(s) for the method you are building.
8201    ///
8202    /// See [`Self::add_scope()`] for details.
8203    pub fn add_scopes<I, St>(mut self, scopes: I) -> ResourceListCall<'a, C>
8204    where
8205        I: IntoIterator<Item = St>,
8206        St: AsRef<str>,
8207    {
8208        self._scopes
8209            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8210        self
8211    }
8212
8213    /// Removes all scopes, and no default scope will be used either.
8214    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8215    /// for details).
8216    pub fn clear_scopes(mut self) -> ResourceListCall<'a, C> {
8217        self._scopes.clear();
8218        self
8219    }
8220}
8221
8222/// Lists all resource types for Deployment Manager.
8223///
8224/// A builder for the *list* method supported by a *type* resource.
8225/// It is not used directly, but through a [`TypeMethods`] instance.
8226///
8227/// # Example
8228///
8229/// Instantiate a resource method builder
8230///
8231/// ```test_harness,no_run
8232/// # extern crate hyper;
8233/// # extern crate hyper_rustls;
8234/// # extern crate google_deploymentmanager2 as deploymentmanager2;
8235/// # async fn dox() {
8236/// # use deploymentmanager2::{DeploymentManager, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8237///
8238/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8239/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8240/// #     .with_native_roots()
8241/// #     .unwrap()
8242/// #     .https_only()
8243/// #     .enable_http2()
8244/// #     .build();
8245///
8246/// # let executor = hyper_util::rt::TokioExecutor::new();
8247/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8248/// #     secret,
8249/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8250/// #     yup_oauth2::client::CustomHyperClientBuilder::from(
8251/// #         hyper_util::client::legacy::Client::builder(executor).build(connector),
8252/// #     ),
8253/// # ).build().await.unwrap();
8254///
8255/// # let client = hyper_util::client::legacy::Client::builder(
8256/// #     hyper_util::rt::TokioExecutor::new()
8257/// # )
8258/// # .build(
8259/// #     hyper_rustls::HttpsConnectorBuilder::new()
8260/// #         .with_native_roots()
8261/// #         .unwrap()
8262/// #         .https_or_http()
8263/// #         .enable_http2()
8264/// #         .build()
8265/// # );
8266/// # let mut hub = DeploymentManager::new(client, auth);
8267/// // You can configure optional parameters by calling the respective setters at will, and
8268/// // execute the final call using `doit()`.
8269/// // Values shown here are possibly random and not representative !
8270/// let result = hub.types().list("project")
8271///              .page_token("et")
8272///              .order_by("tempor")
8273///              .max_results(69)
8274///              .filter("ipsum")
8275///              .doit().await;
8276/// # }
8277/// ```
8278pub struct TypeListCall<'a, C>
8279where
8280    C: 'a,
8281{
8282    hub: &'a DeploymentManager<C>,
8283    _project: String,
8284    _page_token: Option<String>,
8285    _order_by: Option<String>,
8286    _max_results: Option<u32>,
8287    _filter: Option<String>,
8288    _delegate: Option<&'a mut dyn common::Delegate>,
8289    _additional_params: HashMap<String, String>,
8290    _scopes: BTreeSet<String>,
8291}
8292
8293impl<'a, C> common::CallBuilder for TypeListCall<'a, C> {}
8294
8295impl<'a, C> TypeListCall<'a, C>
8296where
8297    C: common::Connector,
8298{
8299    /// Perform the operation you have build so far.
8300    pub async fn doit(mut self) -> common::Result<(common::Response, TypesListResponse)> {
8301        use std::borrow::Cow;
8302        use std::io::{Read, Seek};
8303
8304        use common::{url::Params, ToParts};
8305        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8306
8307        let mut dd = common::DefaultDelegate;
8308        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8309        dlg.begin(common::MethodInfo {
8310            id: "deploymentmanager.types.list",
8311            http_method: hyper::Method::GET,
8312        });
8313
8314        for &field in [
8315            "alt",
8316            "project",
8317            "pageToken",
8318            "orderBy",
8319            "maxResults",
8320            "filter",
8321        ]
8322        .iter()
8323        {
8324            if self._additional_params.contains_key(field) {
8325                dlg.finished(false);
8326                return Err(common::Error::FieldClash(field));
8327            }
8328        }
8329
8330        let mut params = Params::with_capacity(7 + self._additional_params.len());
8331        params.push("project", self._project);
8332        if let Some(value) = self._page_token.as_ref() {
8333            params.push("pageToken", value);
8334        }
8335        if let Some(value) = self._order_by.as_ref() {
8336            params.push("orderBy", value);
8337        }
8338        if let Some(value) = self._max_results.as_ref() {
8339            params.push("maxResults", value.to_string());
8340        }
8341        if let Some(value) = self._filter.as_ref() {
8342            params.push("filter", value);
8343        }
8344
8345        params.extend(self._additional_params.iter());
8346
8347        params.push("alt", "json");
8348        let mut url =
8349            self.hub._base_url.clone() + "deploymentmanager/v2/projects/{project}/global/types";
8350        if self._scopes.is_empty() {
8351            self._scopes
8352                .insert(Scope::NdevCloudmanReadonly.as_ref().to_string());
8353        }
8354
8355        #[allow(clippy::single_element_loop)]
8356        for &(find_this, param_name) in [("{project}", "project")].iter() {
8357            url = params.uri_replacement(url, param_name, find_this, false);
8358        }
8359        {
8360            let to_remove = ["project"];
8361            params.remove_params(&to_remove);
8362        }
8363
8364        let url = params.parse_with_url(&url);
8365
8366        loop {
8367            let token = match self
8368                .hub
8369                .auth
8370                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8371                .await
8372            {
8373                Ok(token) => token,
8374                Err(e) => match dlg.token(e) {
8375                    Ok(token) => token,
8376                    Err(e) => {
8377                        dlg.finished(false);
8378                        return Err(common::Error::MissingToken(e));
8379                    }
8380                },
8381            };
8382            let mut req_result = {
8383                let client = &self.hub.client;
8384                dlg.pre_request();
8385                let mut req_builder = hyper::Request::builder()
8386                    .method(hyper::Method::GET)
8387                    .uri(url.as_str())
8388                    .header(USER_AGENT, self.hub._user_agent.clone());
8389
8390                if let Some(token) = token.as_ref() {
8391                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8392                }
8393
8394                let request = req_builder
8395                    .header(CONTENT_LENGTH, 0_u64)
8396                    .body(common::to_body::<String>(None));
8397
8398                client.request(request.unwrap()).await
8399            };
8400
8401            match req_result {
8402                Err(err) => {
8403                    if let common::Retry::After(d) = dlg.http_error(&err) {
8404                        sleep(d).await;
8405                        continue;
8406                    }
8407                    dlg.finished(false);
8408                    return Err(common::Error::HttpError(err));
8409                }
8410                Ok(res) => {
8411                    let (mut parts, body) = res.into_parts();
8412                    let mut body = common::Body::new(body);
8413                    if !parts.status.is_success() {
8414                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8415                        let error = serde_json::from_str(&common::to_string(&bytes));
8416                        let response = common::to_response(parts, bytes.into());
8417
8418                        if let common::Retry::After(d) =
8419                            dlg.http_failure(&response, error.as_ref().ok())
8420                        {
8421                            sleep(d).await;
8422                            continue;
8423                        }
8424
8425                        dlg.finished(false);
8426
8427                        return Err(match error {
8428                            Ok(value) => common::Error::BadRequest(value),
8429                            _ => common::Error::Failure(response),
8430                        });
8431                    }
8432                    let response = {
8433                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8434                        let encoded = common::to_string(&bytes);
8435                        match serde_json::from_str(&encoded) {
8436                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8437                            Err(error) => {
8438                                dlg.response_json_decode_error(&encoded, &error);
8439                                return Err(common::Error::JsonDecodeError(
8440                                    encoded.to_string(),
8441                                    error,
8442                                ));
8443                            }
8444                        }
8445                    };
8446
8447                    dlg.finished(true);
8448                    return Ok(response);
8449                }
8450            }
8451        }
8452    }
8453
8454    /// The project ID for this request.
8455    ///
8456    /// Sets the *project* path property to the given value.
8457    ///
8458    /// Even though the property as already been set when instantiating this call,
8459    /// we provide this method for API completeness.
8460    pub fn project(mut self, new_value: &str) -> TypeListCall<'a, C> {
8461        self._project = new_value.to_string();
8462        self
8463    }
8464    /// Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results.
8465    ///
8466    /// Sets the *page token* query property to the given value.
8467    pub fn page_token(mut self, new_value: &str) -> TypeListCall<'a, C> {
8468        self._page_token = Some(new_value.to_string());
8469        self
8470    }
8471    /// Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported.
8472    ///
8473    /// Sets the *order by* query property to the given value.
8474    pub fn order_by(mut self, new_value: &str) -> TypeListCall<'a, C> {
8475        self._order_by = Some(new_value.to_string());
8476        self
8477    }
8478    /// The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`)
8479    ///
8480    /// Sets the *max results* query property to the given value.
8481    pub fn max_results(mut self, new_value: u32) -> TypeListCall<'a, C> {
8482        self._max_results = Some(new_value);
8483        self
8484    }
8485    /// A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions.
8486    ///
8487    /// Sets the *filter* query property to the given value.
8488    pub fn filter(mut self, new_value: &str) -> TypeListCall<'a, C> {
8489        self._filter = Some(new_value.to_string());
8490        self
8491    }
8492    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8493    /// while executing the actual API request.
8494    ///
8495    /// ````text
8496    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8497    /// ````
8498    ///
8499    /// Sets the *delegate* property to the given value.
8500    pub fn delegate(mut self, new_value: &'a mut dyn common::Delegate) -> TypeListCall<'a, C> {
8501        self._delegate = Some(new_value);
8502        self
8503    }
8504
8505    /// Set any additional parameter of the query string used in the request.
8506    /// It should be used to set parameters which are not yet available through their own
8507    /// setters.
8508    ///
8509    /// Please note that this method must not be used to set any of the known parameters
8510    /// which have their own setter method. If done anyway, the request will fail.
8511    ///
8512    /// # Additional Parameters
8513    ///
8514    /// * *$.xgafv* (query-string) - V1 error format.
8515    /// * *access_token* (query-string) - OAuth access token.
8516    /// * *alt* (query-string) - Data format for response.
8517    /// * *callback* (query-string) - JSONP
8518    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8519    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8520    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8521    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8522    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8523    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8524    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8525    pub fn param<T>(mut self, name: T, value: T) -> TypeListCall<'a, C>
8526    where
8527        T: AsRef<str>,
8528    {
8529        self._additional_params
8530            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8531        self
8532    }
8533
8534    /// Identifies the authorization scope for the method you are building.
8535    ///
8536    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8537    /// [`Scope::NdevCloudmanReadonly`].
8538    ///
8539    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8540    /// tokens for more than one scope.
8541    ///
8542    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8543    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8544    /// sufficient, a read-write scope will do as well.
8545    pub fn add_scope<St>(mut self, scope: St) -> TypeListCall<'a, C>
8546    where
8547        St: AsRef<str>,
8548    {
8549        self._scopes.insert(String::from(scope.as_ref()));
8550        self
8551    }
8552    /// Identifies the authorization scope(s) for the method you are building.
8553    ///
8554    /// See [`Self::add_scope()`] for details.
8555    pub fn add_scopes<I, St>(mut self, scopes: I) -> TypeListCall<'a, C>
8556    where
8557        I: IntoIterator<Item = St>,
8558        St: AsRef<str>,
8559    {
8560        self._scopes
8561            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8562        self
8563    }
8564
8565    /// Removes all scopes, and no default scope will be used either.
8566    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8567    /// for details).
8568    pub fn clear_scopes(mut self) -> TypeListCall<'a, C> {
8569        self._scopes.clear();
8570        self
8571    }
8572}