google_clouddeploy1/
api.rs

1#![allow(clippy::ptr_arg)]
2
3use std::collections::{BTreeSet, HashMap};
4
5use tokio::time::sleep;
6
7// ##############
8// UTILITIES ###
9// ############
10
11/// Identifies the an OAuth2 authorization scope.
12/// A scope is needed when requesting an
13/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
14#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
15pub enum Scope {
16    /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
17    CloudPlatform,
18}
19
20impl AsRef<str> for Scope {
21    fn as_ref(&self) -> &str {
22        match *self {
23            Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
24        }
25    }
26}
27
28#[allow(clippy::derivable_impls)]
29impl Default for Scope {
30    fn default() -> Scope {
31        Scope::CloudPlatform
32    }
33}
34
35// ########
36// HUB ###
37// ######
38
39/// Central instance to access all CloudDeploy related resource activities
40///
41/// # Examples
42///
43/// Instantiate a new hub
44///
45/// ```test_harness,no_run
46/// extern crate hyper;
47/// extern crate hyper_rustls;
48/// extern crate google_clouddeploy1 as clouddeploy1;
49/// use clouddeploy1::api::CustomTargetType;
50/// use clouddeploy1::{Result, Error};
51/// # async fn dox() {
52/// use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = CloudDeploy::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = CustomTargetType::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_custom_target_types_patch(req, "name")
88///              .validate_only(true)
89///              .update_mask(FieldMask::new::<&str>(&[]))
90///              .request_id("gubergren")
91///              .allow_missing(false)
92///              .doit().await;
93///
94/// match result {
95///     Err(e) => match e {
96///         // The Error enum provides details about what exactly happened.
97///         // You can also just use its `Debug`, `Display` or `Error` traits
98///          Error::HttpError(_)
99///         |Error::Io(_)
100///         |Error::MissingAPIKey
101///         |Error::MissingToken(_)
102///         |Error::Cancelled
103///         |Error::UploadSizeLimitExceeded(_, _)
104///         |Error::Failure(_)
105///         |Error::BadRequest(_)
106///         |Error::FieldClash(_)
107///         |Error::JsonDecodeError(_, _) => println!("{}", e),
108///     },
109///     Ok(res) => println!("Success: {:?}", res),
110/// }
111/// # }
112/// ```
113#[derive(Clone)]
114pub struct CloudDeploy<C> {
115    pub client: common::Client<C>,
116    pub auth: Box<dyn common::GetToken>,
117    _user_agent: String,
118    _base_url: String,
119    _root_url: String,
120}
121
122impl<C> common::Hub for CloudDeploy<C> {}
123
124impl<'a, C> CloudDeploy<C> {
125    pub fn new<A: 'static + common::GetToken>(
126        client: common::Client<C>,
127        auth: A,
128    ) -> CloudDeploy<C> {
129        CloudDeploy {
130            client,
131            auth: Box::new(auth),
132            _user_agent: "google-api-rust-client/6.0.0".to_string(),
133            _base_url: "https://clouddeploy.googleapis.com/".to_string(),
134            _root_url: "https://clouddeploy.googleapis.com/".to_string(),
135        }
136    }
137
138    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
139        ProjectMethods { hub: self }
140    }
141
142    /// Set the user-agent header field to use in all requests to the server.
143    /// It defaults to `google-api-rust-client/6.0.0`.
144    ///
145    /// Returns the previously set user-agent.
146    pub fn user_agent(&mut self, agent_name: String) -> String {
147        std::mem::replace(&mut self._user_agent, agent_name)
148    }
149
150    /// Set the base url to use in all requests to the server.
151    /// It defaults to `https://clouddeploy.googleapis.com/`.
152    ///
153    /// Returns the previously set base url.
154    pub fn base_url(&mut self, new_base_url: String) -> String {
155        std::mem::replace(&mut self._base_url, new_base_url)
156    }
157
158    /// Set the root url to use in all requests to the server.
159    /// It defaults to `https://clouddeploy.googleapis.com/`.
160    ///
161    /// Returns the previously set root url.
162    pub fn root_url(&mut self, new_root_url: String) -> String {
163        std::mem::replace(&mut self._root_url, new_root_url)
164    }
165}
166
167// ############
168// SCHEMAS ###
169// ##########
170/// The request object used by `AbandonRelease`.
171///
172/// # Activities
173///
174/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
175/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
176///
177/// * [locations delivery pipelines releases abandon projects](ProjectLocationDeliveryPipelineReleaseAbandonCall) (request)
178#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
179#[serde_with::serde_as]
180#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
181pub struct AbandonReleaseRequest {
182    _never_set: Option<bool>,
183}
184
185impl common::RequestValue for AbandonReleaseRequest {}
186
187/// The response object for `AbandonRelease`.
188///
189/// # Activities
190///
191/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
192/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
193///
194/// * [locations delivery pipelines releases abandon projects](ProjectLocationDeliveryPipelineReleaseAbandonCall) (response)
195#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
196#[serde_with::serde_as]
197#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
198pub struct AbandonReleaseResponse {
199    _never_set: Option<bool>,
200}
201
202impl common::ResponseResult for AbandonReleaseResponse {}
203
204/// An advanceChildRollout Job.
205///
206/// This type is not used in any activity, and only used as *part* of another schema.
207///
208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
209#[serde_with::serde_as]
210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
211pub struct AdvanceChildRolloutJob {
212    _never_set: Option<bool>,
213}
214
215impl common::Part for AdvanceChildRolloutJob {}
216
217/// AdvanceChildRolloutJobRun contains information specific to a advanceChildRollout `JobRun`.
218///
219/// This type is not used in any activity, and only used as *part* of another schema.
220///
221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
222#[serde_with::serde_as]
223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
224pub struct AdvanceChildRolloutJobRun {
225    /// Output only. Name of the `ChildRollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
226    pub rollout: Option<String>,
227    /// Output only. the ID of the ChildRollout's Phase.
228    #[serde(rename = "rolloutPhaseId")]
229    pub rollout_phase_id: Option<String>,
230}
231
232impl common::Part for AdvanceChildRolloutJobRun {}
233
234/// Contains the information of an automated advance-rollout operation.
235///
236/// This type is not used in any activity, and only used as *part* of another schema.
237///
238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
239#[serde_with::serde_as]
240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
241pub struct AdvanceRolloutOperation {
242    /// Output only. The phase the rollout will be advanced to.
243    #[serde(rename = "destinationPhase")]
244    pub destination_phase: Option<String>,
245    /// Output only. The name of the rollout that initiates the `AutomationRun`.
246    pub rollout: Option<String>,
247    /// Output only. The phase of a deployment that initiated the operation.
248    #[serde(rename = "sourcePhase")]
249    pub source_phase: Option<String>,
250    /// Output only. How long the operation will be paused.
251    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
252    pub wait: Option<chrono::Duration>,
253}
254
255impl common::Part for AdvanceRolloutOperation {}
256
257/// The request object used by `AdvanceRollout`.
258///
259/// # Activities
260///
261/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
262/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
263///
264/// * [locations delivery pipelines releases rollouts advance projects](ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall) (request)
265#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
266#[serde_with::serde_as]
267#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
268pub struct AdvanceRolloutRequest {
269    /// Required. The phase ID to advance the `Rollout` to.
270    #[serde(rename = "phaseId")]
271    pub phase_id: Option<String>,
272}
273
274impl common::RequestValue for AdvanceRolloutRequest {}
275
276/// The response object from `AdvanceRollout`.
277///
278/// # Activities
279///
280/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
281/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
282///
283/// * [locations delivery pipelines releases rollouts advance projects](ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall) (response)
284#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
285#[serde_with::serde_as]
286#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
287pub struct AdvanceRolloutResponse {
288    _never_set: Option<bool>,
289}
290
291impl common::ResponseResult for AdvanceRolloutResponse {}
292
293/// The `AdvanceRollout` automation rule will automatically advance a successful Rollout to the next phase.
294///
295/// This type is not used in any activity, and only used as *part* of another schema.
296///
297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
298#[serde_with::serde_as]
299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
300pub struct AdvanceRolloutRule {
301    /// Output only. Information around the state of the Automation rule.
302    pub condition: Option<AutomationRuleCondition>,
303    /// Required. ID of the rule. This id must be unique in the `Automation` resource to which this rule belongs. The format is `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
304    pub id: Option<String>,
305    /// Optional. Proceeds only after phase name matched any one in the list. This value must consist of lower-case letters, numbers, and hyphens, start with a letter and end with a letter or a number, and have a max length of 63 characters. In other words, it must match the following regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
306    #[serde(rename = "sourcePhases")]
307    pub source_phases: Option<Vec<String>>,
308    /// Optional. How long to wait after a rollout is finished.
309    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
310    pub wait: Option<chrono::Duration>,
311}
312
313impl common::Part for AdvanceRolloutRule {}
314
315/// Information specifying an Anthos Cluster.
316///
317/// This type is not used in any activity, and only used as *part* of another schema.
318///
319#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
320#[serde_with::serde_as]
321#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
322pub struct AnthosCluster {
323    /// Optional. Membership of the GKE Hub-registered cluster to which to apply the Skaffold configuration. Format is `projects/{project}/locations/{location}/memberships/{membership_name}`.
324    pub membership: Option<String>,
325}
326
327impl common::Part for AnthosCluster {}
328
329/// The request object used by `ApproveRollout`.
330///
331/// # Activities
332///
333/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
334/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
335///
336/// * [locations delivery pipelines releases rollouts approve projects](ProjectLocationDeliveryPipelineReleaseRolloutApproveCall) (request)
337#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
338#[serde_with::serde_as]
339#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
340pub struct ApproveRolloutRequest {
341    /// Required. True = approve; false = reject
342    pub approved: Option<bool>,
343}
344
345impl common::RequestValue for ApproveRolloutRequest {}
346
347/// The response object from `ApproveRollout`.
348///
349/// # Activities
350///
351/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
352/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
353///
354/// * [locations delivery pipelines releases rollouts approve projects](ProjectLocationDeliveryPipelineReleaseRolloutApproveCall) (response)
355#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
356#[serde_with::serde_as]
357#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
358pub struct ApproveRolloutResponse {
359    _never_set: Option<bool>,
360}
361
362impl common::ResponseResult for ApproveRolloutResponse {}
363
364/// 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.
365///
366/// This type is not used in any activity, and only used as *part* of another schema.
367///
368#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
369#[serde_with::serde_as]
370#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
371pub struct AuditConfig {
372    /// The configuration for logging of each type of permission.
373    #[serde(rename = "auditLogConfigs")]
374    pub audit_log_configs: Option<Vec<AuditLogConfig>>,
375    /// 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.
376    pub service: Option<String>,
377}
378
379impl common::Part for AuditConfig {}
380
381/// 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.
382///
383/// This type is not used in any activity, and only used as *part* of another schema.
384///
385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
386#[serde_with::serde_as]
387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
388pub struct AuditLogConfig {
389    /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
390    #[serde(rename = "exemptedMembers")]
391    pub exempted_members: Option<Vec<String>>,
392    /// The log type that this config enables.
393    #[serde(rename = "logType")]
394    pub log_type: Option<String>,
395}
396
397impl common::Part for AuditLogConfig {}
398
399/// An `Automation` resource in the Cloud Deploy API. An `Automation` enables the automation of manually driven actions for a Delivery Pipeline, which includes Release promotion among Targets, Rollout repair and Rollout deployment strategy advancement. The intention of Automation is to reduce manual intervention in the continuous delivery process.
400///
401/// # Activities
402///
403/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
404/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
405///
406/// * [locations delivery pipelines automations create projects](ProjectLocationDeliveryPipelineAutomationCreateCall) (request)
407/// * [locations delivery pipelines automations get projects](ProjectLocationDeliveryPipelineAutomationGetCall) (response)
408/// * [locations delivery pipelines automations patch projects](ProjectLocationDeliveryPipelineAutomationPatchCall) (request)
409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
410#[serde_with::serde_as]
411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
412pub struct Automation {
413    /// Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. Annotations must meet the following constraints: * Annotations are key/value pairs. * Valid annotation keys have two segments: an optional prefix and name, separated by a slash (`/`). * The name segment is required and must be 63 characters or less, beginning and ending with an alphanumeric character (`[a-z0-9A-Z]`) with dashes (`-`), underscores (`_`), dots (`.`), and alphanumerics between. * The prefix is optional. If specified, the prefix must be a DNS subdomain: a series of DNS labels separated by dots(`.`), not longer than 253 characters in total, followed by a slash (`/`). See https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set for more details.
414    pub annotations: Option<HashMap<String, String>>,
415    /// Output only. Time at which the automation was created.
416    #[serde(rename = "createTime")]
417    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
418    /// Optional. Description of the `Automation`. Max length is 255 characters.
419    pub description: Option<String>,
420    /// Optional. The weak etag of the `Automation` resource. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
421    pub etag: Option<String>,
422    /// Optional. Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 63 characters.
423    pub labels: Option<HashMap<String, String>>,
424    /// Output only. Name of the `Automation`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automations/{automation}`.
425    pub name: Option<String>,
426    /// Required. List of Automation rules associated with the Automation resource. Must have at least one rule and limited to 250 rules per Delivery Pipeline. Note: the order of the rules here is not the same as the order of execution.
427    pub rules: Option<Vec<AutomationRule>>,
428    /// Required. Selected resources to which the automation will be applied.
429    pub selector: Option<AutomationResourceSelector>,
430    /// Required. Email address of the user-managed IAM service account that creates Cloud Deploy release and rollout resources.
431    #[serde(rename = "serviceAccount")]
432    pub service_account: Option<String>,
433    /// Optional. When Suspended, automation is deactivated from execution.
434    pub suspended: Option<bool>,
435    /// Output only. Unique identifier of the `Automation`.
436    pub uid: Option<String>,
437    /// Output only. Time at which the automation was updated.
438    #[serde(rename = "updateTime")]
439    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
440}
441
442impl common::RequestValue for Automation {}
443impl common::ResponseResult for Automation {}
444
445/// AutomationResourceSelector contains the information to select the resources to which an Automation is going to be applied.
446///
447/// This type is not used in any activity, and only used as *part* of another schema.
448///
449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
450#[serde_with::serde_as]
451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
452pub struct AutomationResourceSelector {
453    /// Contains attributes about a target.
454    pub targets: Option<Vec<TargetAttribute>>,
455}
456
457impl common::Part for AutomationResourceSelector {}
458
459/// AutomationRolloutMetadata contains Automation-related actions that were performed on a rollout.
460///
461/// This type is not used in any activity, and only used as *part* of another schema.
462///
463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
464#[serde_with::serde_as]
465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
466pub struct AutomationRolloutMetadata {
467    /// Output only. The names of the AutomationRuns initiated by an advance rollout rule.
468    #[serde(rename = "advanceAutomationRuns")]
469    pub advance_automation_runs: Option<Vec<String>>,
470    /// Output only. The name of the AutomationRun initiated by a promote release rule.
471    #[serde(rename = "promoteAutomationRun")]
472    pub promote_automation_run: Option<String>,
473    /// Output only. The names of the AutomationRuns initiated by a repair rollout rule.
474    #[serde(rename = "repairAutomationRuns")]
475    pub repair_automation_runs: Option<Vec<String>>,
476}
477
478impl common::Part for AutomationRolloutMetadata {}
479
480/// `AutomationRule` defines the automation activities.
481///
482/// This type is not used in any activity, and only used as *part* of another schema.
483///
484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
485#[serde_with::serde_as]
486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
487pub struct AutomationRule {
488    /// Optional. The `AdvanceRolloutRule` will automatically advance a successful Rollout.
489    #[serde(rename = "advanceRolloutRule")]
490    pub advance_rollout_rule: Option<AdvanceRolloutRule>,
491    /// Optional. `PromoteReleaseRule` will automatically promote a release from the current target to a specified target.
492    #[serde(rename = "promoteReleaseRule")]
493    pub promote_release_rule: Option<PromoteReleaseRule>,
494    /// Optional. The `RepairRolloutRule` will automatically repair a failed rollout.
495    #[serde(rename = "repairRolloutRule")]
496    pub repair_rollout_rule: Option<RepairRolloutRule>,
497}
498
499impl common::Part for AutomationRule {}
500
501/// `AutomationRuleCondition` contains conditions relevant to an `Automation` rule.
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 AutomationRuleCondition {
509    /// Optional. Details around targets enumerated in the rule.
510    #[serde(rename = "targetsPresentCondition")]
511    pub targets_present_condition: Option<TargetsPresentCondition>,
512}
513
514impl common::Part for AutomationRuleCondition {}
515
516/// An `AutomationRun` resource in the Cloud Deploy API. An `AutomationRun` represents an execution instance of an automation rule.
517///
518/// # Activities
519///
520/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
521/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
522///
523/// * [locations delivery pipelines automation runs get projects](ProjectLocationDeliveryPipelineAutomationRunGetCall) (response)
524#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
525#[serde_with::serde_as]
526#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
527pub struct AutomationRun {
528    /// Output only. Advances a rollout to the next phase.
529    #[serde(rename = "advanceRolloutOperation")]
530    pub advance_rollout_operation: Option<AdvanceRolloutOperation>,
531    /// Output only. The ID of the automation that initiated the operation.
532    #[serde(rename = "automationId")]
533    pub automation_id: Option<String>,
534    /// Output only. Snapshot of the Automation taken at AutomationRun creation time.
535    #[serde(rename = "automationSnapshot")]
536    pub automation_snapshot: Option<Automation>,
537    /// Output only. Time at which the `AutomationRun` was created.
538    #[serde(rename = "createTime")]
539    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
540    /// Output only. The weak etag of the `AutomationRun` resource. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
541    pub etag: Option<String>,
542    /// Output only. Time the `AutomationRun` expires. An `AutomationRun` expires after 14 days from its creation date.
543    #[serde(rename = "expireTime")]
544    pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
545    /// Output only. Name of the `AutomationRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
546    pub name: Option<String>,
547    /// Output only. Promotes a release to a specified 'Target'.
548    #[serde(rename = "promoteReleaseOperation")]
549    pub promote_release_operation: Option<PromoteReleaseOperation>,
550    /// Output only. Repairs a failed 'Rollout'.
551    #[serde(rename = "repairRolloutOperation")]
552    pub repair_rollout_operation: Option<RepairRolloutOperation>,
553    /// Output only. The ID of the automation rule that initiated the operation.
554    #[serde(rename = "ruleId")]
555    pub rule_id: Option<String>,
556    /// Output only. Email address of the user-managed IAM service account that performs the operations against Cloud Deploy resources.
557    #[serde(rename = "serviceAccount")]
558    pub service_account: Option<String>,
559    /// Output only. Current state of the `AutomationRun`.
560    pub state: Option<String>,
561    /// Output only. Explains the current state of the `AutomationRun`. Present only when an explanation is needed.
562    #[serde(rename = "stateDescription")]
563    pub state_description: Option<String>,
564    /// Output only. The ID of the target that represents the promotion stage that initiates the `AutomationRun`. The value of this field is the last segment of a target name.
565    #[serde(rename = "targetId")]
566    pub target_id: Option<String>,
567    /// Output only. Time at which the automationRun was updated.
568    #[serde(rename = "updateTime")]
569    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
570    /// Output only. Earliest time the `AutomationRun` will attempt to resume. Wait-time is configured by `wait` in automation rule.
571    #[serde(rename = "waitUntilTime")]
572    pub wait_until_time: Option<chrono::DateTime<chrono::offset::Utc>>,
573}
574
575impl common::ResponseResult for AutomationRun {}
576
577/// Associates `members`, or principals, with a `role`.
578///
579/// This type is not used in any activity, and only used as *part* of another schema.
580///
581#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
582#[serde_with::serde_as]
583#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
584pub struct Binding {
585    /// 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).
586    pub condition: Option<Expr>,
587    /// 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`.
588    pub members: Option<Vec<String>>,
589    /// 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).
590    pub role: Option<String>,
591}
592
593impl common::Part for Binding {}
594
595/// Description of an a image to use during Skaffold rendering.
596///
597/// This type is not used in any activity, and only used as *part* of another schema.
598///
599#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
600#[serde_with::serde_as]
601#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
602pub struct BuildArtifact {
603    /// Image name in Skaffold configuration.
604    pub image: Option<String>,
605    /// Image tag to use. This will generally be the full path to an image, such as "gcr.io/my-project/busybox:1.2.3" or "gcr.io/my-project/busybox@sha256:abc123".
606    pub tag: Option<String>,
607}
608
609impl common::Part for BuildArtifact {}
610
611/// Canary represents the canary deployment strategy.
612///
613/// This type is not used in any activity, and only used as *part* of another schema.
614///
615#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
616#[serde_with::serde_as]
617#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
618pub struct Canary {
619    /// Configures the progressive based deployment for a Target.
620    #[serde(rename = "canaryDeployment")]
621    pub canary_deployment: Option<CanaryDeployment>,
622    /// Configures the progressive based deployment for a Target, but allows customizing at the phase level where a phase represents each of the percentage deployments.
623    #[serde(rename = "customCanaryDeployment")]
624    pub custom_canary_deployment: Option<CustomCanaryDeployment>,
625    /// Optional. Runtime specific configurations for the deployment strategy. The runtime configuration is used to determine how Cloud Deploy will split traffic to enable a progressive deployment.
626    #[serde(rename = "runtimeConfig")]
627    pub runtime_config: Option<RuntimeConfig>,
628}
629
630impl common::Part for Canary {}
631
632/// CanaryDeployment represents the canary deployment configuration
633///
634/// This type is not used in any activity, and only used as *part* of another schema.
635///
636#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
637#[serde_with::serde_as]
638#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
639pub struct CanaryDeployment {
640    /// Required. The percentage based deployments that will occur as a part of a `Rollout`. List is expected in ascending order and each integer n is 0 <= n < 100. If the GatewayServiceMesh is configured for Kubernetes, then the range for n is 0 <= n <= 100.
641    pub percentages: Option<Vec<i32>>,
642    /// Optional. Configuration for the postdeploy job of the last phase. If this is not configured, there will be no postdeploy job for this phase.
643    pub postdeploy: Option<Postdeploy>,
644    /// Optional. Configuration for the predeploy job of the first phase. If this is not configured, there will be no predeploy job for this phase.
645    pub predeploy: Option<Predeploy>,
646    /// Whether to run verify tests after each percentage deployment.
647    pub verify: Option<bool>,
648}
649
650impl common::Part for CanaryDeployment {}
651
652/// The request object used by `CancelAutomationRun`.
653///
654/// # Activities
655///
656/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
657/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
658///
659/// * [locations delivery pipelines automation runs cancel projects](ProjectLocationDeliveryPipelineAutomationRunCancelCall) (request)
660#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
661#[serde_with::serde_as]
662#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
663pub struct CancelAutomationRunRequest {
664    _never_set: Option<bool>,
665}
666
667impl common::RequestValue for CancelAutomationRunRequest {}
668
669/// The response object from `CancelAutomationRun`.
670///
671/// # Activities
672///
673/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
674/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
675///
676/// * [locations delivery pipelines automation runs cancel projects](ProjectLocationDeliveryPipelineAutomationRunCancelCall) (response)
677#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
678#[serde_with::serde_as]
679#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
680pub struct CancelAutomationRunResponse {
681    _never_set: Option<bool>,
682}
683
684impl common::ResponseResult for CancelAutomationRunResponse {}
685
686/// The request message for Operations.CancelOperation.
687///
688/// # Activities
689///
690/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
691/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
692///
693/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
694#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
695#[serde_with::serde_as]
696#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
697pub struct CancelOperationRequest {
698    _never_set: Option<bool>,
699}
700
701impl common::RequestValue for CancelOperationRequest {}
702
703/// The request object used by `CancelRollout`.
704///
705/// # Activities
706///
707/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
708/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
709///
710/// * [locations delivery pipelines releases rollouts cancel projects](ProjectLocationDeliveryPipelineReleaseRolloutCancelCall) (request)
711#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
712#[serde_with::serde_as]
713#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
714pub struct CancelRolloutRequest {
715    _never_set: Option<bool>,
716}
717
718impl common::RequestValue for CancelRolloutRequest {}
719
720/// The response object from `CancelRollout`.
721///
722/// # Activities
723///
724/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
725/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
726///
727/// * [locations delivery pipelines releases rollouts cancel projects](ProjectLocationDeliveryPipelineReleaseRolloutCancelCall) (response)
728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
729#[serde_with::serde_as]
730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
731pub struct CancelRolloutResponse {
732    _never_set: Option<bool>,
733}
734
735impl common::ResponseResult for CancelRolloutResponse {}
736
737/// ChildRollouts job composition
738///
739/// This type is not used in any activity, and only used as *part* of another schema.
740///
741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
742#[serde_with::serde_as]
743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
744pub struct ChildRolloutJobs {
745    /// Output only. List of AdvanceChildRolloutJobs
746    #[serde(rename = "advanceRolloutJobs")]
747    pub advance_rollout_jobs: Option<Vec<Job>>,
748    /// Output only. List of CreateChildRolloutJobs
749    #[serde(rename = "createRolloutJobs")]
750    pub create_rollout_jobs: Option<Vec<Job>>,
751}
752
753impl common::Part for ChildRolloutJobs {}
754
755/// CloudRunConfig contains the Cloud Run runtime configuration.
756///
757/// This type is not used in any activity, and only used as *part* of another schema.
758///
759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
760#[serde_with::serde_as]
761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
762pub struct CloudRunConfig {
763    /// Whether Cloud Deploy should update the traffic stanza in a Cloud Run Service on the user's behalf to facilitate traffic splitting. This is required to be true for CanaryDeployments, but optional for CustomCanaryDeployments.
764    #[serde(rename = "automaticTrafficControl")]
765    pub automatic_traffic_control: Option<bool>,
766    /// Optional. A list of tags that are added to the canary revision while the canary phase is in progress.
767    #[serde(rename = "canaryRevisionTags")]
768    pub canary_revision_tags: Option<Vec<String>>,
769    /// Optional. A list of tags that are added to the prior revision while the canary phase is in progress.
770    #[serde(rename = "priorRevisionTags")]
771    pub prior_revision_tags: Option<Vec<String>>,
772    /// Optional. A list of tags that are added to the final stable revision when the stable phase is applied.
773    #[serde(rename = "stableRevisionTags")]
774    pub stable_revision_tags: Option<Vec<String>>,
775}
776
777impl common::Part for CloudRunConfig {}
778
779/// Information specifying where to deploy a Cloud Run Service.
780///
781/// This type is not used in any activity, and only used as *part* of another schema.
782///
783#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
784#[serde_with::serde_as]
785#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
786pub struct CloudRunLocation {
787    /// Required. The location for the Cloud Run Service. Format must be `projects/{project}/locations/{location}`.
788    pub location: Option<String>,
789}
790
791impl common::Part for CloudRunLocation {}
792
793/// CloudRunMetadata contains information from a Cloud Run deployment.
794///
795/// This type is not used in any activity, and only used as *part* of another schema.
796///
797#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
798#[serde_with::serde_as]
799#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
800pub struct CloudRunMetadata {
801    /// Output only. The name of the Cloud Run job that is associated with a `Rollout`. Format is `projects/{project}/locations/{location}/jobs/{job_name}`.
802    pub job: Option<String>,
803    /// Output only. The Cloud Run Revision id associated with a `Rollout`.
804    pub revision: Option<String>,
805    /// Output only. The name of the Cloud Run Service that is associated with a `Rollout`. Format is `projects/{project}/locations/{location}/services/{service}`.
806    pub service: Option<String>,
807    /// Output only. The Cloud Run Service urls that are associated with a `Rollout`.
808    #[serde(rename = "serviceUrls")]
809    pub service_urls: Option<Vec<String>>,
810}
811
812impl common::Part for CloudRunMetadata {}
813
814/// CloudRunRenderMetadata contains Cloud Run information associated with a `Release` render.
815///
816/// This type is not used in any activity, and only used as *part* of another schema.
817///
818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
819#[serde_with::serde_as]
820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
821pub struct CloudRunRenderMetadata {
822    /// Output only. The name of the Cloud Run Service in the rendered manifest. Format is `projects/{project}/locations/{location}/services/{service}`.
823    pub service: Option<String>,
824}
825
826impl common::Part for CloudRunRenderMetadata {}
827
828/// Service-wide configuration.
829///
830/// # Activities
831///
832/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
833/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
834///
835/// * [locations get config projects](ProjectLocationGetConfigCall) (response)
836#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
837#[serde_with::serde_as]
838#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
839pub struct Config {
840    /// Default Skaffold version that is assigned when a Release is created without specifying a Skaffold version.
841    #[serde(rename = "defaultSkaffoldVersion")]
842    pub default_skaffold_version: Option<String>,
843    /// Name of the configuration.
844    pub name: Option<String>,
845    /// All supported versions of Skaffold.
846    #[serde(rename = "supportedVersions")]
847    pub supported_versions: Option<Vec<SkaffoldVersion>>,
848}
849
850impl common::ResponseResult for Config {}
851
852/// A createChildRollout Job.
853///
854/// This type is not used in any activity, and only used as *part* of another schema.
855///
856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
857#[serde_with::serde_as]
858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
859pub struct CreateChildRolloutJob {
860    _never_set: Option<bool>,
861}
862
863impl common::Part for CreateChildRolloutJob {}
864
865/// CreateChildRolloutJobRun contains information specific to a createChildRollout `JobRun`.
866///
867/// This type is not used in any activity, and only used as *part* of another schema.
868///
869#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
870#[serde_with::serde_as]
871#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
872pub struct CreateChildRolloutJobRun {
873    /// Output only. Name of the `ChildRollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
874    pub rollout: Option<String>,
875    /// Output only. The ID of the childRollout Phase initiated by this JobRun.
876    #[serde(rename = "rolloutPhaseId")]
877    pub rollout_phase_id: Option<String>,
878}
879
880impl common::Part for CreateChildRolloutJobRun {}
881
882/// CustomCanaryDeployment represents the custom canary deployment configuration.
883///
884/// This type is not used in any activity, and only used as *part* of another schema.
885///
886#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
887#[serde_with::serde_as]
888#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
889pub struct CustomCanaryDeployment {
890    /// Required. Configuration for each phase in the canary deployment in the order executed.
891    #[serde(rename = "phaseConfigs")]
892    pub phase_configs: Option<Vec<PhaseConfig>>,
893}
894
895impl common::Part for CustomCanaryDeployment {}
896
897/// CustomMetadata contains information from a user-defined operation.
898///
899/// This type is not used in any activity, and only used as *part* of another schema.
900///
901#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
902#[serde_with::serde_as]
903#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
904pub struct CustomMetadata {
905    /// Output only. Key-value pairs provided by the user-defined operation.
906    pub values: Option<HashMap<String, String>>,
907}
908
909impl common::Part for CustomMetadata {}
910
911/// Information specifying a Custom Target.
912///
913/// This type is not used in any activity, and only used as *part* of another schema.
914///
915#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
916#[serde_with::serde_as]
917#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
918pub struct CustomTarget {
919    /// Required. The name of the CustomTargetType. Format must be `projects/{project}/locations/{location}/customTargetTypes/{custom_target_type}`.
920    #[serde(rename = "customTargetType")]
921    pub custom_target_type: Option<String>,
922}
923
924impl common::Part for CustomTarget {}
925
926/// CustomTargetDeployMetadata contains information from a Custom Target deploy operation.
927///
928/// This type is not used in any activity, and only used as *part* of another schema.
929///
930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
931#[serde_with::serde_as]
932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
933pub struct CustomTargetDeployMetadata {
934    /// Output only. Skip message provided in the results of a custom deploy operation.
935    #[serde(rename = "skipMessage")]
936    pub skip_message: Option<String>,
937}
938
939impl common::Part for CustomTargetDeployMetadata {}
940
941/// CustomTargetSkaffoldActions represents the `CustomTargetType` configuration using Skaffold custom actions.
942///
943/// This type is not used in any activity, and only used as *part* of another schema.
944///
945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
946#[serde_with::serde_as]
947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
948pub struct CustomTargetSkaffoldActions {
949    /// Required. The Skaffold custom action responsible for deploy operations.
950    #[serde(rename = "deployAction")]
951    pub deploy_action: Option<String>,
952    /// Optional. List of Skaffold modules Cloud Deploy will include in the Skaffold Config as required before performing diagnose.
953    #[serde(rename = "includeSkaffoldModules")]
954    pub include_skaffold_modules: Option<Vec<SkaffoldModules>>,
955    /// Optional. The Skaffold custom action responsible for render operations. If not provided then Cloud Deploy will perform the render operations via `skaffold render`.
956    #[serde(rename = "renderAction")]
957    pub render_action: Option<String>,
958}
959
960impl common::Part for CustomTargetSkaffoldActions {}
961
962/// A `CustomTargetType` resource in the Cloud Deploy API. A `CustomTargetType` defines a type of custom target that can be referenced in a `Target` in order to facilitate deploying to other systems besides the supported runtimes.
963///
964/// # Activities
965///
966/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
967/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
968///
969/// * [locations custom target types create projects](ProjectLocationCustomTargetTypeCreateCall) (request)
970/// * [locations custom target types get projects](ProjectLocationCustomTargetTypeGetCall) (response)
971/// * [locations custom target types patch projects](ProjectLocationCustomTargetTypePatchCall) (request)
972#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
973#[serde_with::serde_as]
974#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
975pub struct CustomTargetType {
976    /// Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
977    pub annotations: Option<HashMap<String, String>>,
978    /// Output only. Time at which the `CustomTargetType` was created.
979    #[serde(rename = "createTime")]
980    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
981    /// Configures render and deploy for the `CustomTargetType` using Skaffold custom actions.
982    #[serde(rename = "customActions")]
983    pub custom_actions: Option<CustomTargetSkaffoldActions>,
984    /// Output only. Resource id of the `CustomTargetType`.
985    #[serde(rename = "customTargetTypeId")]
986    pub custom_target_type_id: Option<String>,
987    /// Optional. Description of the `CustomTargetType`. Max length is 255 characters.
988    pub description: Option<String>,
989    /// Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
990    pub etag: Option<String>,
991    /// Optional. Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
992    pub labels: Option<HashMap<String, String>>,
993    /// Optional. Name of the `CustomTargetType`. Format is `projects/{project}/locations/{location}/customTargetTypes/{customTargetType}`. The `customTargetType` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
994    pub name: Option<String>,
995    /// Output only. Unique identifier of the `CustomTargetType`.
996    pub uid: Option<String>,
997    /// Output only. Most recent time at which the `CustomTargetType` was updated.
998    #[serde(rename = "updateTime")]
999    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1000}
1001
1002impl common::RequestValue for CustomTargetType {}
1003impl common::ResponseResult for CustomTargetType {}
1004
1005/// Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
1006///
1007/// This type is not used in any activity, and only used as *part* of another schema.
1008///
1009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1010#[serde_with::serde_as]
1011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1012pub struct Date {
1013    /// Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
1014    pub day: Option<i32>,
1015    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
1016    pub month: Option<i32>,
1017    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
1018    pub year: Option<i32>,
1019}
1020
1021impl common::Part for Date {}
1022
1023/// Execution using the default Cloud Build pool.
1024///
1025/// This type is not used in any activity, and only used as *part* of another schema.
1026///
1027#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1028#[serde_with::serde_as]
1029#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1030pub struct DefaultPool {
1031    /// Optional. Cloud Storage location where execution outputs should be stored. This can either be a bucket ("gs://my-bucket") or a path within a bucket ("gs://my-bucket/my-dir"). If unspecified, a default bucket located in the same region will be used.
1032    #[serde(rename = "artifactStorage")]
1033    pub artifact_storage: Option<String>,
1034    /// Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) will be used.
1035    #[serde(rename = "serviceAccount")]
1036    pub service_account: Option<String>,
1037}
1038
1039impl common::Part for DefaultPool {}
1040
1041/// A `DeliveryPipeline` resource in the Cloud Deploy API. A `DeliveryPipeline` defines a pipeline through which a Skaffold configuration can progress.
1042///
1043/// # Activities
1044///
1045/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1046/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1047///
1048/// * [locations delivery pipelines create projects](ProjectLocationDeliveryPipelineCreateCall) (request)
1049/// * [locations delivery pipelines get projects](ProjectLocationDeliveryPipelineGetCall) (response)
1050/// * [locations delivery pipelines patch projects](ProjectLocationDeliveryPipelinePatchCall) (request)
1051#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1052#[serde_with::serde_as]
1053#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1054pub struct DeliveryPipeline {
1055    /// User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy.
1056    pub annotations: Option<HashMap<String, String>>,
1057    /// Output only. Information around the state of the Delivery Pipeline.
1058    pub condition: Option<PipelineCondition>,
1059    /// Output only. Time at which the pipeline was created.
1060    #[serde(rename = "createTime")]
1061    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1062    /// Description of the `DeliveryPipeline`. Max length is 255 characters.
1063    pub description: Option<String>,
1064    /// This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
1065    pub etag: Option<String>,
1066    /// Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
1067    pub labels: Option<HashMap<String, String>>,
1068    /// Optional. Name of the `DeliveryPipeline`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}`. The `deliveryPipeline` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
1069    pub name: Option<String>,
1070    /// SerialPipeline defines a sequential set of stages for a `DeliveryPipeline`.
1071    #[serde(rename = "serialPipeline")]
1072    pub serial_pipeline: Option<SerialPipeline>,
1073    /// When suspended, no new releases or rollouts can be created, but in-progress ones will complete.
1074    pub suspended: Option<bool>,
1075    /// Output only. Unique identifier of the `DeliveryPipeline`.
1076    pub uid: Option<String>,
1077    /// Output only. Most recent time at which the pipeline was updated.
1078    #[serde(rename = "updateTime")]
1079    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1080}
1081
1082impl common::RequestValue for DeliveryPipeline {}
1083impl common::ResponseResult for DeliveryPipeline {}
1084
1085/// The artifacts produced by a deploy operation.
1086///
1087/// This type is not used in any activity, and only used as *part* of another schema.
1088///
1089#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1090#[serde_with::serde_as]
1091#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1092pub struct DeployArtifact {
1093    /// Output only. URI of a directory containing the artifacts. All paths are relative to this location.
1094    #[serde(rename = "artifactUri")]
1095    pub artifact_uri: Option<String>,
1096    /// Output only. File paths of the manifests applied during the deploy operation relative to the URI.
1097    #[serde(rename = "manifestPaths")]
1098    pub manifest_paths: Option<Vec<String>>,
1099}
1100
1101impl common::Part for DeployArtifact {}
1102
1103/// A deploy Job.
1104///
1105/// This type is not used in any activity, and only used as *part* of another schema.
1106///
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct DeployJob {
1111    _never_set: Option<bool>,
1112}
1113
1114impl common::Part for DeployJob {}
1115
1116/// DeployJobRun contains information specific to a deploy `JobRun`.
1117///
1118/// This type is not used in any activity, and only used as *part* of another schema.
1119///
1120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1121#[serde_with::serde_as]
1122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1123pub struct DeployJobRun {
1124    /// Output only. The artifact of a deploy job run, if available.
1125    pub artifact: Option<DeployArtifact>,
1126    /// Output only. The resource name of the Cloud Build `Build` object that is used to deploy. Format is `projects/{project}/locations/{location}/builds/{build}`.
1127    pub build: Option<String>,
1128    /// Output only. The reason the deploy failed. This will always be unspecified while the deploy is in progress or if it succeeded.
1129    #[serde(rename = "failureCause")]
1130    pub failure_cause: Option<String>,
1131    /// Output only. Additional information about the deploy failure, if available.
1132    #[serde(rename = "failureMessage")]
1133    pub failure_message: Option<String>,
1134    /// Output only. Metadata containing information about the deploy job run.
1135    pub metadata: Option<DeployJobRunMetadata>,
1136}
1137
1138impl common::Part for DeployJobRun {}
1139
1140/// DeployJobRunMetadata surfaces information associated with a `DeployJobRun` to the user.
1141///
1142/// This type is not used in any activity, and only used as *part* of another schema.
1143///
1144#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1145#[serde_with::serde_as]
1146#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1147pub struct DeployJobRunMetadata {
1148    /// Output only. The name of the Cloud Run Service that is associated with a `DeployJobRun`.
1149    #[serde(rename = "cloudRun")]
1150    pub cloud_run: Option<CloudRunMetadata>,
1151    /// Output only. Custom metadata provided by user-defined deploy operation.
1152    pub custom: Option<CustomMetadata>,
1153    /// Output only. Custom Target metadata associated with a `DeployJobRun`.
1154    #[serde(rename = "customTarget")]
1155    pub custom_target: Option<CustomTargetDeployMetadata>,
1156}
1157
1158impl common::Part for DeployJobRunMetadata {}
1159
1160/// DeployParameters contains deploy parameters information.
1161///
1162/// This type is not used in any activity, and only used as *part* of another schema.
1163///
1164#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1165#[serde_with::serde_as]
1166#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1167pub struct DeployParameters {
1168    /// Optional. Deploy parameters are applied to targets with match labels. If unspecified, deploy parameters are applied to all targets (including child targets of a multi-target).
1169    #[serde(rename = "matchTargetLabels")]
1170    pub match_target_labels: Option<HashMap<String, String>>,
1171    /// Required. Values are deploy parameters in key-value pairs.
1172    pub values: Option<HashMap<String, String>>,
1173}
1174
1175impl common::Part for DeployParameters {}
1176
1177/// Deployment job composition.
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 DeploymentJobs {
1185    /// Output only. The deploy Job. This is the deploy job in the phase.
1186    #[serde(rename = "deployJob")]
1187    pub deploy_job: Option<Job>,
1188    /// Output only. The postdeploy Job, which is the last job on the phase.
1189    #[serde(rename = "postdeployJob")]
1190    pub postdeploy_job: Option<Job>,
1191    /// Output only. The predeploy Job, which is the first job on the phase.
1192    #[serde(rename = "predeployJob")]
1193    pub predeploy_job: Option<Job>,
1194    /// Output only. The verify Job. Runs after a deploy if the deploy succeeds.
1195    #[serde(rename = "verifyJob")]
1196    pub verify_job: Option<Job>,
1197}
1198
1199impl common::Part for DeploymentJobs {}
1200
1201/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
1202///
1203/// # Activities
1204///
1205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1207///
1208/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1209/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
1210#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1211#[serde_with::serde_as]
1212#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1213pub struct Empty {
1214    _never_set: Option<bool>,
1215}
1216
1217impl common::ResponseResult for Empty {}
1218
1219/// Configuration of the environment to use when calling Skaffold.
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 ExecutionConfig {
1227    /// Optional. Cloud Storage location in which to store execution outputs. This can either be a bucket ("gs://my-bucket") or a path within a bucket ("gs://my-bucket/my-dir"). If unspecified, a default bucket located in the same region will be used.
1228    #[serde(rename = "artifactStorage")]
1229    pub artifact_storage: Option<String>,
1230    /// Optional. Use default Cloud Build pool.
1231    #[serde(rename = "defaultPool")]
1232    pub default_pool: Option<DefaultPool>,
1233    /// Optional. Execution timeout for a Cloud Build Execution. This must be between 10m and 24h in seconds format. If unspecified, a default timeout of 1h is used.
1234    #[serde(rename = "executionTimeout")]
1235    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1236    pub execution_timeout: Option<chrono::Duration>,
1237    /// Optional. Use private Cloud Build pool.
1238    #[serde(rename = "privatePool")]
1239    pub private_pool: Option<PrivatePool>,
1240    /// Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) is used.
1241    #[serde(rename = "serviceAccount")]
1242    pub service_account: Option<String>,
1243    /// Required. Usages when this configuration should be applied.
1244    pub usages: Option<Vec<String>>,
1245    /// Optional. If true, additional logging will be enabled when running builds in this execution environment.
1246    pub verbose: Option<bool>,
1247    /// Optional. The resource name of the `WorkerPool`, with the format `projects/{project}/locations/{location}/workerPools/{worker_pool}`. If this optional field is unspecified, the default Cloud Build pool will be used.
1248    #[serde(rename = "workerPool")]
1249    pub worker_pool: Option<String>,
1250}
1251
1252impl common::Part for ExecutionConfig {}
1253
1254/// 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.
1255///
1256/// This type is not used in any activity, and only used as *part* of another schema.
1257///
1258#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1259#[serde_with::serde_as]
1260#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1261pub struct Expr {
1262    /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1263    pub description: Option<String>,
1264    /// Textual representation of an expression in Common Expression Language syntax.
1265    pub expression: Option<String>,
1266    /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1267    pub location: Option<String>,
1268    /// 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.
1269    pub title: Option<String>,
1270}
1271
1272impl common::Part for Expr {}
1273
1274/// Information about the Kubernetes Gateway API service mesh configuration.
1275///
1276/// This type is not used in any activity, and only used as *part* of another schema.
1277///
1278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1279#[serde_with::serde_as]
1280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1281pub struct GatewayServiceMesh {
1282    /// Required. Name of the Kubernetes Deployment whose traffic is managed by the specified HTTPRoute and Service.
1283    pub deployment: Option<String>,
1284    /// Required. Name of the Gateway API HTTPRoute.
1285    #[serde(rename = "httpRoute")]
1286    pub http_route: Option<String>,
1287    /// Optional. The time to wait for route updates to propagate. The maximum configurable time is 3 hours, in seconds format. If unspecified, there is no wait time.
1288    #[serde(rename = "routeUpdateWaitTime")]
1289    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1290    pub route_update_wait_time: Option<chrono::Duration>,
1291    /// Required. Name of the Kubernetes Service.
1292    pub service: Option<String>,
1293    /// Optional. The amount of time to migrate traffic back from the canary Service to the original Service during the stable phase deployment. If specified, must be between 15s and 3600s. If unspecified, there is no cutback time.
1294    #[serde(rename = "stableCutbackDuration")]
1295    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1296    pub stable_cutback_duration: Option<chrono::Duration>,
1297}
1298
1299impl common::Part for GatewayServiceMesh {}
1300
1301/// Information specifying a GKE Cluster.
1302///
1303/// This type is not used in any activity, and only used as *part* of another schema.
1304///
1305#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1306#[serde_with::serde_as]
1307#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1308pub struct GkeCluster {
1309    /// Optional. Information specifying a GKE Cluster. Format is `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`.
1310    pub cluster: Option<String>,
1311    /// Optional. If true, `cluster` is accessed using the private IP address of the control plane endpoint. Otherwise, the default IP address of the control plane endpoint is used. The default IP address is the private IP address for clusters with private control-plane endpoints and the public IP address otherwise. Only specify this option when `cluster` is a [private GKE cluster](https://cloud.google.com/kubernetes-engine/docs/concepts/private-cluster-concept).
1312    #[serde(rename = "internalIp")]
1313    pub internal_ip: Option<bool>,
1314    /// Optional. If set, used to configure a [proxy](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#proxy) to the Kubernetes server.
1315    #[serde(rename = "proxyUrl")]
1316    pub proxy_url: Option<String>,
1317}
1318
1319impl common::Part for GkeCluster {}
1320
1321/// The request object used by `IgnoreJob`.
1322///
1323/// # Activities
1324///
1325/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1326/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1327///
1328/// * [locations delivery pipelines releases rollouts ignore job projects](ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall) (request)
1329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1330#[serde_with::serde_as]
1331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1332pub struct IgnoreJobRequest {
1333    /// Required. The job ID for the Job to ignore.
1334    #[serde(rename = "jobId")]
1335    pub job_id: Option<String>,
1336    /// Required. The phase ID the Job to ignore belongs to.
1337    #[serde(rename = "phaseId")]
1338    pub phase_id: Option<String>,
1339}
1340
1341impl common::RequestValue for IgnoreJobRequest {}
1342
1343/// The response object from `IgnoreJob`.
1344///
1345/// # Activities
1346///
1347/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1348/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1349///
1350/// * [locations delivery pipelines releases rollouts ignore job projects](ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall) (response)
1351#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1352#[serde_with::serde_as]
1353#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1354pub struct IgnoreJobResponse {
1355    _never_set: Option<bool>,
1356}
1357
1358impl common::ResponseResult for IgnoreJobResponse {}
1359
1360/// Job represents an operation for a `Rollout`.
1361///
1362/// This type is not used in any activity, and only used as *part* of another schema.
1363///
1364#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1365#[serde_with::serde_as]
1366#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1367pub struct Job {
1368    /// Output only. An advanceChildRollout Job.
1369    #[serde(rename = "advanceChildRolloutJob")]
1370    pub advance_child_rollout_job: Option<AdvanceChildRolloutJob>,
1371    /// Output only. A createChildRollout Job.
1372    #[serde(rename = "createChildRolloutJob")]
1373    pub create_child_rollout_job: Option<CreateChildRolloutJob>,
1374    /// Output only. A deploy Job.
1375    #[serde(rename = "deployJob")]
1376    pub deploy_job: Option<DeployJob>,
1377    /// Output only. The ID of the Job.
1378    pub id: Option<String>,
1379    /// Output only. The name of the `JobRun` responsible for the most recent invocation of this Job.
1380    #[serde(rename = "jobRun")]
1381    pub job_run: Option<String>,
1382    /// Output only. A postdeploy Job.
1383    #[serde(rename = "postdeployJob")]
1384    pub postdeploy_job: Option<PostdeployJob>,
1385    /// Output only. A predeploy Job.
1386    #[serde(rename = "predeployJob")]
1387    pub predeploy_job: Option<PredeployJob>,
1388    /// Output only. Additional information on why the Job was skipped, if available.
1389    #[serde(rename = "skipMessage")]
1390    pub skip_message: Option<String>,
1391    /// Output only. The current state of the Job.
1392    pub state: Option<String>,
1393    /// Output only. A verify Job.
1394    #[serde(rename = "verifyJob")]
1395    pub verify_job: Option<VerifyJob>,
1396}
1397
1398impl common::Part for Job {}
1399
1400/// A `JobRun` resource in the Cloud Deploy API. A `JobRun` contains information of a single `Rollout` job evaluation.
1401///
1402/// # Activities
1403///
1404/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1405/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1406///
1407/// * [locations delivery pipelines releases rollouts job runs get projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall) (response)
1408#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1409#[serde_with::serde_as]
1410#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1411pub struct JobRun {
1412    /// Output only. Information specific to an advanceChildRollout `JobRun`
1413    #[serde(rename = "advanceChildRolloutJobRun")]
1414    pub advance_child_rollout_job_run: Option<AdvanceChildRolloutJobRun>,
1415    /// Output only. Information specific to a createChildRollout `JobRun`.
1416    #[serde(rename = "createChildRolloutJobRun")]
1417    pub create_child_rollout_job_run: Option<CreateChildRolloutJobRun>,
1418    /// Output only. Time at which the `JobRun` was created.
1419    #[serde(rename = "createTime")]
1420    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1421    /// Output only. Information specific to a deploy `JobRun`.
1422    #[serde(rename = "deployJobRun")]
1423    pub deploy_job_run: Option<DeployJobRun>,
1424    /// Output only. Time at which the `JobRun` ended.
1425    #[serde(rename = "endTime")]
1426    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1427    /// Output only. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
1428    pub etag: Option<String>,
1429    /// Output only. ID of the `Rollout` job this `JobRun` corresponds to.
1430    #[serde(rename = "jobId")]
1431    pub job_id: Option<String>,
1432    /// Optional. Name of the `JobRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/{rollouts}/jobRuns/{uuid}`.
1433    pub name: Option<String>,
1434    /// Output only. ID of the `Rollout` phase this `JobRun` belongs in.
1435    #[serde(rename = "phaseId")]
1436    pub phase_id: Option<String>,
1437    /// Output only. Information specific to a postdeploy `JobRun`.
1438    #[serde(rename = "postdeployJobRun")]
1439    pub postdeploy_job_run: Option<PostdeployJobRun>,
1440    /// Output only. Information specific to a predeploy `JobRun`.
1441    #[serde(rename = "predeployJobRun")]
1442    pub predeploy_job_run: Option<PredeployJobRun>,
1443    /// Output only. Time at which the `JobRun` was started.
1444    #[serde(rename = "startTime")]
1445    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1446    /// Output only. The current state of the `JobRun`.
1447    pub state: Option<String>,
1448    /// Output only. Unique identifier of the `JobRun`.
1449    pub uid: Option<String>,
1450    /// Output only. Information specific to a verify `JobRun`.
1451    #[serde(rename = "verifyJobRun")]
1452    pub verify_job_run: Option<VerifyJobRun>,
1453}
1454
1455impl common::ResponseResult for JobRun {}
1456
1457/// KubernetesConfig contains the Kubernetes runtime configuration.
1458///
1459/// This type is not used in any activity, and only used as *part* of another schema.
1460///
1461#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1462#[serde_with::serde_as]
1463#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1464pub struct KubernetesConfig {
1465    /// Kubernetes Gateway API service mesh configuration.
1466    #[serde(rename = "gatewayServiceMesh")]
1467    pub gateway_service_mesh: Option<GatewayServiceMesh>,
1468    /// Kubernetes Service networking configuration.
1469    #[serde(rename = "serviceNetworking")]
1470    pub service_networking: Option<ServiceNetworking>,
1471}
1472
1473impl common::Part for KubernetesConfig {}
1474
1475/// The response object from `ListAutomationRuns`.
1476///
1477/// # Activities
1478///
1479/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1480/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1481///
1482/// * [locations delivery pipelines automation runs list projects](ProjectLocationDeliveryPipelineAutomationRunListCall) (response)
1483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1484#[serde_with::serde_as]
1485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1486pub struct ListAutomationRunsResponse {
1487    /// The `AutomationRuns` objects.
1488    #[serde(rename = "automationRuns")]
1489    pub automation_runs: Option<Vec<AutomationRun>>,
1490    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1491    #[serde(rename = "nextPageToken")]
1492    pub next_page_token: Option<String>,
1493    /// Locations that could not be reached.
1494    pub unreachable: Option<Vec<String>>,
1495}
1496
1497impl common::ResponseResult for ListAutomationRunsResponse {}
1498
1499/// The response object from `ListAutomations`.
1500///
1501/// # Activities
1502///
1503/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1504/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1505///
1506/// * [locations delivery pipelines automations list projects](ProjectLocationDeliveryPipelineAutomationListCall) (response)
1507#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1508#[serde_with::serde_as]
1509#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1510pub struct ListAutomationsResponse {
1511    /// The `Automation` objects.
1512    pub automations: Option<Vec<Automation>>,
1513    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1514    #[serde(rename = "nextPageToken")]
1515    pub next_page_token: Option<String>,
1516    /// Locations that could not be reached.
1517    pub unreachable: Option<Vec<String>>,
1518}
1519
1520impl common::ResponseResult for ListAutomationsResponse {}
1521
1522/// The response object from `ListCustomTargetTypes.`
1523///
1524/// # Activities
1525///
1526/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1527/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1528///
1529/// * [locations custom target types list projects](ProjectLocationCustomTargetTypeListCall) (response)
1530#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1531#[serde_with::serde_as]
1532#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1533pub struct ListCustomTargetTypesResponse {
1534    /// The `CustomTargetType` objects.
1535    #[serde(rename = "customTargetTypes")]
1536    pub custom_target_types: Option<Vec<CustomTargetType>>,
1537    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1538    #[serde(rename = "nextPageToken")]
1539    pub next_page_token: Option<String>,
1540    /// Locations that could not be reached.
1541    pub unreachable: Option<Vec<String>>,
1542}
1543
1544impl common::ResponseResult for ListCustomTargetTypesResponse {}
1545
1546/// The response object from `ListDeliveryPipelines`.
1547///
1548/// # Activities
1549///
1550/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1551/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1552///
1553/// * [locations delivery pipelines list projects](ProjectLocationDeliveryPipelineListCall) (response)
1554#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1555#[serde_with::serde_as]
1556#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1557pub struct ListDeliveryPipelinesResponse {
1558    /// The `DeliveryPipeline` objects.
1559    #[serde(rename = "deliveryPipelines")]
1560    pub delivery_pipelines: Option<Vec<DeliveryPipeline>>,
1561    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1562    #[serde(rename = "nextPageToken")]
1563    pub next_page_token: Option<String>,
1564    /// Locations that could not be reached.
1565    pub unreachable: Option<Vec<String>>,
1566}
1567
1568impl common::ResponseResult for ListDeliveryPipelinesResponse {}
1569
1570/// ListJobRunsResponse is the response object returned by `ListJobRuns`.
1571///
1572/// # Activities
1573///
1574/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1575/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1576///
1577/// * [locations delivery pipelines releases rollouts job runs list projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall) (response)
1578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1579#[serde_with::serde_as]
1580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1581pub struct ListJobRunsResponse {
1582    /// The `JobRun` objects.
1583    #[serde(rename = "jobRuns")]
1584    pub job_runs: Option<Vec<JobRun>>,
1585    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1586    #[serde(rename = "nextPageToken")]
1587    pub next_page_token: Option<String>,
1588    /// Locations that could not be reached
1589    pub unreachable: Option<Vec<String>>,
1590}
1591
1592impl common::ResponseResult for ListJobRunsResponse {}
1593
1594/// The response message for Locations.ListLocations.
1595///
1596/// # Activities
1597///
1598/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1599/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1600///
1601/// * [locations list projects](ProjectLocationListCall) (response)
1602#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1603#[serde_with::serde_as]
1604#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1605pub struct ListLocationsResponse {
1606    /// A list of locations that matches the specified filter in the request.
1607    pub locations: Option<Vec<Location>>,
1608    /// The standard List next-page token.
1609    #[serde(rename = "nextPageToken")]
1610    pub next_page_token: Option<String>,
1611}
1612
1613impl common::ResponseResult for ListLocationsResponse {}
1614
1615/// The response message for Operations.ListOperations.
1616///
1617/// # Activities
1618///
1619/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1620/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1621///
1622/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1623#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1624#[serde_with::serde_as]
1625#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1626pub struct ListOperationsResponse {
1627    /// The standard List next-page token.
1628    #[serde(rename = "nextPageToken")]
1629    pub next_page_token: Option<String>,
1630    /// A list of operations that matches the specified filter in the request.
1631    pub operations: Option<Vec<Operation>>,
1632}
1633
1634impl common::ResponseResult for ListOperationsResponse {}
1635
1636/// The response object from `ListReleases`.
1637///
1638/// # Activities
1639///
1640/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1641/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1642///
1643/// * [locations delivery pipelines releases list projects](ProjectLocationDeliveryPipelineReleaseListCall) (response)
1644#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1645#[serde_with::serde_as]
1646#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1647pub struct ListReleasesResponse {
1648    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1649    #[serde(rename = "nextPageToken")]
1650    pub next_page_token: Option<String>,
1651    /// The `Release` objects.
1652    pub releases: Option<Vec<Release>>,
1653    /// Locations that could not be reached.
1654    pub unreachable: Option<Vec<String>>,
1655}
1656
1657impl common::ResponseResult for ListReleasesResponse {}
1658
1659/// ListRolloutsResponse is the response object reutrned by `ListRollouts`.
1660///
1661/// # Activities
1662///
1663/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1664/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1665///
1666/// * [locations delivery pipelines releases rollouts list projects](ProjectLocationDeliveryPipelineReleaseRolloutListCall) (response)
1667#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1668#[serde_with::serde_as]
1669#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1670pub struct ListRolloutsResponse {
1671    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1672    #[serde(rename = "nextPageToken")]
1673    pub next_page_token: Option<String>,
1674    /// The `Rollout` objects.
1675    pub rollouts: Option<Vec<Rollout>>,
1676    /// Locations that could not be reached.
1677    pub unreachable: Option<Vec<String>>,
1678}
1679
1680impl common::ResponseResult for ListRolloutsResponse {}
1681
1682/// The response object from `ListTargets`.
1683///
1684/// # Activities
1685///
1686/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1687/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1688///
1689/// * [locations targets list projects](ProjectLocationTargetListCall) (response)
1690#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1691#[serde_with::serde_as]
1692#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1693pub struct ListTargetsResponse {
1694    /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1695    #[serde(rename = "nextPageToken")]
1696    pub next_page_token: Option<String>,
1697    /// The `Target` objects.
1698    pub targets: Option<Vec<Target>>,
1699    /// Locations that could not be reached.
1700    pub unreachable: Option<Vec<String>>,
1701}
1702
1703impl common::ResponseResult for ListTargetsResponse {}
1704
1705/// A resource that represents a Google Cloud location.
1706///
1707/// # Activities
1708///
1709/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1710/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1711///
1712/// * [locations get projects](ProjectLocationGetCall) (response)
1713#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1714#[serde_with::serde_as]
1715#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1716pub struct Location {
1717    /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1718    #[serde(rename = "displayName")]
1719    pub display_name: Option<String>,
1720    /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1721    pub labels: Option<HashMap<String, String>>,
1722    /// The canonical id for this location. For example: `"us-east1"`.
1723    #[serde(rename = "locationId")]
1724    pub location_id: Option<String>,
1725    /// Service-specific metadata. For example the available capacity at the given location.
1726    pub metadata: Option<HashMap<String, serde_json::Value>>,
1727    /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1728    pub name: Option<String>,
1729}
1730
1731impl common::ResponseResult for Location {}
1732
1733/// Metadata includes information associated with a `Rollout`.
1734///
1735/// This type is not used in any activity, and only used as *part* of another schema.
1736///
1737#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1738#[serde_with::serde_as]
1739#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1740pub struct Metadata {
1741    /// Output only. AutomationRolloutMetadata contains the information about the interactions between Automation service and this rollout.
1742    pub automation: Option<AutomationRolloutMetadata>,
1743    /// Output only. The name of the Cloud Run Service that is associated with a `Rollout`.
1744    #[serde(rename = "cloudRun")]
1745    pub cloud_run: Option<CloudRunMetadata>,
1746    /// Output only. Custom metadata provided by user-defined `Rollout` operations.
1747    pub custom: Option<CustomMetadata>,
1748}
1749
1750impl common::Part for Metadata {}
1751
1752/// Information specifying a multiTarget.
1753///
1754/// This type is not used in any activity, and only used as *part* of another schema.
1755///
1756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1757#[serde_with::serde_as]
1758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1759pub struct MultiTarget {
1760    /// Required. The target_ids of this multiTarget.
1761    #[serde(rename = "targetIds")]
1762    pub target_ids: Option<Vec<String>>,
1763}
1764
1765impl common::Part for MultiTarget {}
1766
1767/// This resource represents a long-running operation that is the result of a network API call.
1768///
1769/// # Activities
1770///
1771/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1772/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1773///
1774/// * [locations custom target types create projects](ProjectLocationCustomTargetTypeCreateCall) (response)
1775/// * [locations custom target types delete projects](ProjectLocationCustomTargetTypeDeleteCall) (response)
1776/// * [locations custom target types patch projects](ProjectLocationCustomTargetTypePatchCall) (response)
1777/// * [locations delivery pipelines automations create projects](ProjectLocationDeliveryPipelineAutomationCreateCall) (response)
1778/// * [locations delivery pipelines automations delete projects](ProjectLocationDeliveryPipelineAutomationDeleteCall) (response)
1779/// * [locations delivery pipelines automations patch projects](ProjectLocationDeliveryPipelineAutomationPatchCall) (response)
1780/// * [locations delivery pipelines releases rollouts create projects](ProjectLocationDeliveryPipelineReleaseRolloutCreateCall) (response)
1781/// * [locations delivery pipelines releases create projects](ProjectLocationDeliveryPipelineReleaseCreateCall) (response)
1782/// * [locations delivery pipelines create projects](ProjectLocationDeliveryPipelineCreateCall) (response)
1783/// * [locations delivery pipelines delete projects](ProjectLocationDeliveryPipelineDeleteCall) (response)
1784/// * [locations delivery pipelines patch projects](ProjectLocationDeliveryPipelinePatchCall) (response)
1785/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1786/// * [locations targets create projects](ProjectLocationTargetCreateCall) (response)
1787/// * [locations targets delete projects](ProjectLocationTargetDeleteCall) (response)
1788/// * [locations targets patch projects](ProjectLocationTargetPatchCall) (response)
1789#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1790#[serde_with::serde_as]
1791#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1792pub struct Operation {
1793    /// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
1794    pub done: Option<bool>,
1795    /// The error result of the operation in case of failure or cancellation.
1796    pub error: Option<Status>,
1797    /// Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
1798    pub metadata: Option<HashMap<String, serde_json::Value>>,
1799    /// The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
1800    pub name: Option<String>,
1801    /// The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
1802    pub response: Option<HashMap<String, serde_json::Value>>,
1803}
1804
1805impl common::ResponseResult for Operation {}
1806
1807/// Phase represents a collection of jobs that are logically grouped together for a `Rollout`.
1808///
1809/// This type is not used in any activity, and only used as *part* of another schema.
1810///
1811#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1812#[serde_with::serde_as]
1813#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1814pub struct Phase {
1815    /// Output only. ChildRollout job composition.
1816    #[serde(rename = "childRolloutJobs")]
1817    pub child_rollout_jobs: Option<ChildRolloutJobs>,
1818    /// Output only. Deployment job composition.
1819    #[serde(rename = "deploymentJobs")]
1820    pub deployment_jobs: Option<DeploymentJobs>,
1821    /// Output only. The ID of the Phase.
1822    pub id: Option<String>,
1823    /// Output only. Additional information on why the Phase was skipped, if available.
1824    #[serde(rename = "skipMessage")]
1825    pub skip_message: Option<String>,
1826    /// Output only. Current state of the Phase.
1827    pub state: Option<String>,
1828}
1829
1830impl common::Part for Phase {}
1831
1832/// Contains the paths to the artifacts, relative to the URI, for a phase.
1833///
1834/// This type is not used in any activity, and only used as *part* of another schema.
1835///
1836#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1837#[serde_with::serde_as]
1838#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1839pub struct PhaseArtifact {
1840    /// Output only. File path of the directory of rendered job manifests relative to the URI. This is only set if it is applicable.
1841    #[serde(rename = "jobManifestsPath")]
1842    pub job_manifests_path: Option<String>,
1843    /// Output only. File path of the rendered manifest relative to the URI.
1844    #[serde(rename = "manifestPath")]
1845    pub manifest_path: Option<String>,
1846    /// Output only. File path of the resolved Skaffold configuration relative to the URI.
1847    #[serde(rename = "skaffoldConfigPath")]
1848    pub skaffold_config_path: Option<String>,
1849}
1850
1851impl common::Part for PhaseArtifact {}
1852
1853/// PhaseConfig represents the configuration for a phase in the custom canary deployment.
1854///
1855/// This type is not used in any activity, and only used as *part* of another schema.
1856///
1857#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1858#[serde_with::serde_as]
1859#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1860pub struct PhaseConfig {
1861    /// Required. Percentage deployment for the phase.
1862    pub percentage: Option<i32>,
1863    /// Required. The ID to assign to the `Rollout` phase. This value must consist of lower-case letters, numbers, and hyphens, start with a letter and end with a letter or a number, and have a max length of 63 characters. In other words, it must match the following regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
1864    #[serde(rename = "phaseId")]
1865    pub phase_id: Option<String>,
1866    /// Optional. Configuration for the postdeploy job of this phase. If this is not configured, there will be no postdeploy job for this phase.
1867    pub postdeploy: Option<Postdeploy>,
1868    /// Optional. Configuration for the predeploy job of this phase. If this is not configured, there will be no predeploy job for this phase.
1869    pub predeploy: Option<Predeploy>,
1870    /// Skaffold profiles to use when rendering the manifest for this phase. These are in addition to the profiles list specified in the `DeliveryPipeline` stage.
1871    pub profiles: Option<Vec<String>>,
1872    /// Whether to run verify tests after the deployment.
1873    pub verify: Option<bool>,
1874}
1875
1876impl common::Part for PhaseConfig {}
1877
1878/// PipelineCondition contains all conditions relevant to a Delivery Pipeline.
1879///
1880/// This type is not used in any activity, and only used as *part* of another schema.
1881///
1882#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1883#[serde_with::serde_as]
1884#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1885pub struct PipelineCondition {
1886    /// Details around the Pipeline's overall status.
1887    #[serde(rename = "pipelineReadyCondition")]
1888    pub pipeline_ready_condition: Option<PipelineReadyCondition>,
1889    /// Details around targets enumerated in the pipeline.
1890    #[serde(rename = "targetsPresentCondition")]
1891    pub targets_present_condition: Option<TargetsPresentCondition>,
1892    /// Details on the whether the targets enumerated in the pipeline are of the same type.
1893    #[serde(rename = "targetsTypeCondition")]
1894    pub targets_type_condition: Option<TargetsTypeCondition>,
1895}
1896
1897impl common::Part for PipelineCondition {}
1898
1899/// PipelineReadyCondition contains information around the status of the Pipeline.
1900///
1901/// This type is not used in any activity, and only used as *part* of another schema.
1902///
1903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1904#[serde_with::serde_as]
1905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1906pub struct PipelineReadyCondition {
1907    /// True if the Pipeline is in a valid state. Otherwise at least one condition in `PipelineCondition` is in an invalid state. Iterate over those conditions and see which condition(s) has status = false to find out what is wrong with the Pipeline.
1908    pub status: Option<bool>,
1909    /// Last time the condition was updated.
1910    #[serde(rename = "updateTime")]
1911    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1912}
1913
1914impl common::Part for PipelineReadyCondition {}
1915
1916/// 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/).
1917///
1918/// # Activities
1919///
1920/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1921/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1922///
1923/// * [locations custom target types get iam policy projects](ProjectLocationCustomTargetTypeGetIamPolicyCall) (response)
1924/// * [locations custom target types set iam policy projects](ProjectLocationCustomTargetTypeSetIamPolicyCall) (response)
1925/// * [locations delivery pipelines get iam policy projects](ProjectLocationDeliveryPipelineGetIamPolicyCall) (response)
1926/// * [locations delivery pipelines set iam policy projects](ProjectLocationDeliveryPipelineSetIamPolicyCall) (response)
1927/// * [locations targets get iam policy projects](ProjectLocationTargetGetIamPolicyCall) (response)
1928/// * [locations targets set iam policy projects](ProjectLocationTargetSetIamPolicyCall) (response)
1929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1930#[serde_with::serde_as]
1931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1932pub struct Policy {
1933    /// Specifies cloud audit logging configuration for this policy.
1934    #[serde(rename = "auditConfigs")]
1935    pub audit_configs: Option<Vec<AuditConfig>>,
1936    /// 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`.
1937    pub bindings: Option<Vec<Binding>>,
1938    /// `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.
1939    #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
1940    pub etag: Option<Vec<u8>>,
1941    /// 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).
1942    pub version: Option<i32>,
1943}
1944
1945impl common::ResponseResult for Policy {}
1946
1947/// Postdeploy contains the postdeploy job configuration information.
1948///
1949/// This type is not used in any activity, and only used as *part* of another schema.
1950///
1951#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1952#[serde_with::serde_as]
1953#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1954pub struct Postdeploy {
1955    /// Optional. A sequence of Skaffold custom actions to invoke during execution of the postdeploy job.
1956    pub actions: Option<Vec<String>>,
1957}
1958
1959impl common::Part for Postdeploy {}
1960
1961/// A postdeploy Job.
1962///
1963/// This type is not used in any activity, and only used as *part* of another schema.
1964///
1965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1966#[serde_with::serde_as]
1967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1968pub struct PostdeployJob {
1969    /// Output only. The custom actions that the postdeploy Job executes.
1970    pub actions: Option<Vec<String>>,
1971}
1972
1973impl common::Part for PostdeployJob {}
1974
1975/// PostdeployJobRun contains information specific to a postdeploy `JobRun`.
1976///
1977/// This type is not used in any activity, and only used as *part* of another schema.
1978///
1979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1980#[serde_with::serde_as]
1981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1982pub struct PostdeployJobRun {
1983    /// Output only. The resource name of the Cloud Build `Build` object that is used to execute the custom actions associated with the postdeploy Job. Format is `projects/{project}/locations/{location}/builds/{build}`.
1984    pub build: Option<String>,
1985    /// Output only. The reason the postdeploy failed. This will always be unspecified while the postdeploy is in progress or if it succeeded.
1986    #[serde(rename = "failureCause")]
1987    pub failure_cause: Option<String>,
1988    /// Output only. Additional information about the postdeploy failure, if available.
1989    #[serde(rename = "failureMessage")]
1990    pub failure_message: Option<String>,
1991}
1992
1993impl common::Part for PostdeployJobRun {}
1994
1995/// Predeploy contains the predeploy job configuration information.
1996///
1997/// This type is not used in any activity, and only used as *part* of another schema.
1998///
1999#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2000#[serde_with::serde_as]
2001#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2002pub struct Predeploy {
2003    /// Optional. A sequence of Skaffold custom actions to invoke during execution of the predeploy job.
2004    pub actions: Option<Vec<String>>,
2005}
2006
2007impl common::Part for Predeploy {}
2008
2009/// A predeploy Job.
2010///
2011/// This type is not used in any activity, and only used as *part* of another schema.
2012///
2013#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2014#[serde_with::serde_as]
2015#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2016pub struct PredeployJob {
2017    /// Output only. The custom actions that the predeploy Job executes.
2018    pub actions: Option<Vec<String>>,
2019}
2020
2021impl common::Part for PredeployJob {}
2022
2023/// PredeployJobRun contains information specific to a predeploy `JobRun`.
2024///
2025/// This type is not used in any activity, and only used as *part* of another schema.
2026///
2027#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2028#[serde_with::serde_as]
2029#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2030pub struct PredeployJobRun {
2031    /// Output only. The resource name of the Cloud Build `Build` object that is used to execute the custom actions associated with the predeploy Job. Format is `projects/{project}/locations/{location}/builds/{build}`.
2032    pub build: Option<String>,
2033    /// Output only. The reason the predeploy failed. This will always be unspecified while the predeploy is in progress or if it succeeded.
2034    #[serde(rename = "failureCause")]
2035    pub failure_cause: Option<String>,
2036    /// Output only. Additional information about the predeploy failure, if available.
2037    #[serde(rename = "failureMessage")]
2038    pub failure_message: Option<String>,
2039}
2040
2041impl common::Part for PredeployJobRun {}
2042
2043/// Execution using a private Cloud Build pool.
2044///
2045/// This type is not used in any activity, and only used as *part* of another schema.
2046///
2047#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2048#[serde_with::serde_as]
2049#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2050pub struct PrivatePool {
2051    /// Optional. Cloud Storage location where execution outputs should be stored. This can either be a bucket ("gs://my-bucket") or a path within a bucket ("gs://my-bucket/my-dir"). If unspecified, a default bucket located in the same region will be used.
2052    #[serde(rename = "artifactStorage")]
2053    pub artifact_storage: Option<String>,
2054    /// Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) will be used.
2055    #[serde(rename = "serviceAccount")]
2056    pub service_account: Option<String>,
2057    /// Required. Resource name of the Cloud Build worker pool to use. The format is `projects/{project}/locations/{location}/workerPools/{pool}`.
2058    #[serde(rename = "workerPool")]
2059    pub worker_pool: Option<String>,
2060}
2061
2062impl common::Part for PrivatePool {}
2063
2064/// Contains the information of an automated promote-release operation.
2065///
2066/// This type is not used in any activity, and only used as *part* of another schema.
2067///
2068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2069#[serde_with::serde_as]
2070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2071pub struct PromoteReleaseOperation {
2072    /// Output only. The starting phase of the rollout created by this operation.
2073    pub phase: Option<String>,
2074    /// Output only. The name of the rollout that initiates the `AutomationRun`.
2075    pub rollout: Option<String>,
2076    /// Output only. The ID of the target that represents the promotion stage to which the release will be promoted. The value of this field is the last segment of a target name.
2077    #[serde(rename = "targetId")]
2078    pub target_id: Option<String>,
2079    /// Output only. How long the operation will be paused.
2080    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2081    pub wait: Option<chrono::Duration>,
2082}
2083
2084impl common::Part for PromoteReleaseOperation {}
2085
2086/// `PromoteRelease` rule will automatically promote a release from the current target to a specified target.
2087///
2088/// This type is not used in any activity, and only used as *part* of another schema.
2089///
2090#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2091#[serde_with::serde_as]
2092#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2093pub struct PromoteReleaseRule {
2094    /// Output only. Information around the state of the Automation rule.
2095    pub condition: Option<AutomationRuleCondition>,
2096    /// Optional. The starting phase of the rollout created by this operation. Default to the first phase.
2097    #[serde(rename = "destinationPhase")]
2098    pub destination_phase: Option<String>,
2099    /// Optional. The ID of the stage in the pipeline to which this `Release` is deploying. If unspecified, default it to the next stage in the promotion flow. The value of this field could be one of the following: * The last segment of a target name. It only needs the ID to determine if the target is one of the stages in the promotion sequence defined in the pipeline. * "@next", the next target in the promotion sequence.
2100    #[serde(rename = "destinationTargetId")]
2101    pub destination_target_id: Option<String>,
2102    /// Required. ID of the rule. This id must be unique in the `Automation` resource to which this rule belongs. The format is `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
2103    pub id: Option<String>,
2104    /// Optional. How long the release need to be paused until being promoted to the next target.
2105    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2106    pub wait: Option<chrono::Duration>,
2107}
2108
2109impl common::Part for PromoteReleaseRule {}
2110
2111/// A `Release` resource in the Cloud Deploy API. A `Release` defines a specific Skaffold configuration instance that can be deployed.
2112///
2113/// # Activities
2114///
2115/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2116/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2117///
2118/// * [locations delivery pipelines releases create projects](ProjectLocationDeliveryPipelineReleaseCreateCall) (request)
2119/// * [locations delivery pipelines releases get projects](ProjectLocationDeliveryPipelineReleaseGetCall) (response)
2120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2121#[serde_with::serde_as]
2122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2123pub struct Release {
2124    /// Output only. Indicates whether this is an abandoned release.
2125    pub abandoned: Option<bool>,
2126    /// User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
2127    pub annotations: Option<HashMap<String, String>>,
2128    /// List of artifacts to pass through to Skaffold command.
2129    #[serde(rename = "buildArtifacts")]
2130    pub build_artifacts: Option<Vec<BuildArtifact>>,
2131    /// Output only. Information around the state of the Release.
2132    pub condition: Option<ReleaseCondition>,
2133    /// Output only. Time at which the `Release` was created.
2134    #[serde(rename = "createTime")]
2135    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2136    /// Output only. Snapshot of the custom target types referenced by the targets taken at release creation time.
2137    #[serde(rename = "customTargetTypeSnapshots")]
2138    pub custom_target_type_snapshots: Option<Vec<CustomTargetType>>,
2139    /// Output only. Snapshot of the parent pipeline taken at release creation time.
2140    #[serde(rename = "deliveryPipelineSnapshot")]
2141    pub delivery_pipeline_snapshot: Option<DeliveryPipeline>,
2142    /// Optional. The deploy parameters to use for all targets in this release.
2143    #[serde(rename = "deployParameters")]
2144    pub deploy_parameters: Option<HashMap<String, String>>,
2145    /// Description of the `Release`. Max length is 255 characters.
2146    pub description: Option<String>,
2147    /// This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2148    pub etag: Option<String>,
2149    /// Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
2150    pub labels: Option<HashMap<String, String>>,
2151    /// Optional. Name of the `Release`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}`. The `release` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
2152    pub name: Option<String>,
2153    /// Output only. Time at which the render completed.
2154    #[serde(rename = "renderEndTime")]
2155    pub render_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2156    /// Output only. Time at which the render began.
2157    #[serde(rename = "renderStartTime")]
2158    pub render_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2159    /// Output only. Current state of the render operation.
2160    #[serde(rename = "renderState")]
2161    pub render_state: Option<String>,
2162    /// Filepath of the Skaffold config inside of the config URI.
2163    #[serde(rename = "skaffoldConfigPath")]
2164    pub skaffold_config_path: Option<String>,
2165    /// Cloud Storage URI of tar.gz archive containing Skaffold configuration.
2166    #[serde(rename = "skaffoldConfigUri")]
2167    pub skaffold_config_uri: Option<String>,
2168    /// The Skaffold version to use when operating on this release, such as "1.20.0". Not all versions are valid; Cloud Deploy supports a specific set of versions. If unset, the most recent supported Skaffold version will be used.
2169    #[serde(rename = "skaffoldVersion")]
2170    pub skaffold_version: Option<String>,
2171    /// Output only. Map from target ID to the target artifacts created during the render operation.
2172    #[serde(rename = "targetArtifacts")]
2173    pub target_artifacts: Option<HashMap<String, TargetArtifact>>,
2174    /// Output only. Map from target ID to details of the render operation for that target.
2175    #[serde(rename = "targetRenders")]
2176    pub target_renders: Option<HashMap<String, TargetRender>>,
2177    /// Output only. Snapshot of the targets taken at release creation time.
2178    #[serde(rename = "targetSnapshots")]
2179    pub target_snapshots: Option<Vec<Target>>,
2180    /// Output only. Unique identifier of the `Release`.
2181    pub uid: Option<String>,
2182}
2183
2184impl common::RequestValue for Release {}
2185impl common::ResponseResult for Release {}
2186
2187/// ReleaseCondition contains all conditions relevant to a Release.
2188///
2189/// This type is not used in any activity, and only used as *part* of another schema.
2190///
2191#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2192#[serde_with::serde_as]
2193#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2194pub struct ReleaseCondition {
2195    /// Details around the Releases's overall status.
2196    #[serde(rename = "releaseReadyCondition")]
2197    pub release_ready_condition: Option<ReleaseReadyCondition>,
2198    /// Details around the support state of the release's Skaffold version.
2199    #[serde(rename = "skaffoldSupportedCondition")]
2200    pub skaffold_supported_condition: Option<SkaffoldSupportedCondition>,
2201}
2202
2203impl common::Part for ReleaseCondition {}
2204
2205/// ReleaseReadyCondition contains information around the status of the Release. If a release is not ready, you cannot create a rollout with the release.
2206///
2207/// This type is not used in any activity, and only used as *part* of another schema.
2208///
2209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2210#[serde_with::serde_as]
2211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2212pub struct ReleaseReadyCondition {
2213    /// True if the Release is in a valid state. Otherwise at least one condition in `ReleaseCondition` is in an invalid state. Iterate over those conditions and see which condition(s) has status = false to find out what is wrong with the Release.
2214    pub status: Option<bool>,
2215}
2216
2217impl common::Part for ReleaseReadyCondition {}
2218
2219/// RenderMetadata includes information associated with a `Release` render.
2220///
2221/// This type is not used in any activity, and only used as *part* of another schema.
2222///
2223#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2224#[serde_with::serde_as]
2225#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2226pub struct RenderMetadata {
2227    /// Output only. Metadata associated with rendering for Cloud Run.
2228    #[serde(rename = "cloudRun")]
2229    pub cloud_run: Option<CloudRunRenderMetadata>,
2230    /// Output only. Custom metadata provided by user-defined render operation.
2231    pub custom: Option<CustomMetadata>,
2232}
2233
2234impl common::Part for RenderMetadata {}
2235
2236/// RepairPhase tracks the repair attempts that have been made for each `RepairPhaseConfig` specified in the `Automation` resource.
2237///
2238/// This type is not used in any activity, and only used as *part* of another schema.
2239///
2240#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2241#[serde_with::serde_as]
2242#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2243pub struct RepairPhase {
2244    /// Output only. Records of the retry attempts for retry repair mode.
2245    pub retry: Option<RetryPhase>,
2246    /// Output only. Rollback attempt for rollback repair mode .
2247    pub rollback: Option<RollbackAttempt>,
2248}
2249
2250impl common::Part for RepairPhase {}
2251
2252/// Contains the information for an automated `repair rollout` operation.
2253///
2254/// This type is not used in any activity, and only used as *part* of another schema.
2255///
2256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2257#[serde_with::serde_as]
2258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2259pub struct RepairRolloutOperation {
2260    /// Output only. The job ID for the Job to repair.
2261    #[serde(rename = "jobId")]
2262    pub job_id: Option<String>,
2263    /// Output only. The phase ID of the phase that includes the job being repaired.
2264    #[serde(rename = "phaseId")]
2265    pub phase_id: Option<String>,
2266    /// Output only. Records of the repair attempts. Each repair phase may have multiple retry attempts or single rollback attempt.
2267    #[serde(rename = "repairPhases")]
2268    pub repair_phases: Option<Vec<RepairPhase>>,
2269    /// Output only. The name of the rollout that initiates the `AutomationRun`.
2270    pub rollout: Option<String>,
2271}
2272
2273impl common::Part for RepairRolloutOperation {}
2274
2275/// The `RepairRolloutRule` automation rule will automatically repair a failed `Rollout`.
2276///
2277/// This type is not used in any activity, and only used as *part* of another schema.
2278///
2279#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2280#[serde_with::serde_as]
2281#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2282pub struct RepairRolloutRule {
2283    /// Output only. Information around the state of the 'Automation' rule.
2284    pub condition: Option<AutomationRuleCondition>,
2285    /// Required. ID of the rule. This id must be unique in the `Automation` resource to which this rule belongs. The format is `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
2286    pub id: Option<String>,
2287    /// Optional. Jobs to repair. Proceeds only after job name matched any one in the list, or for all jobs if unspecified or empty. The phase that includes the job must match the phase ID specified in `source_phase`. This value must consist of lower-case letters, numbers, and hyphens, start with a letter and end with a letter or a number, and have a max length of 63 characters. In other words, it must match the following regex: `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`.
2288    pub jobs: Option<Vec<String>>,
2289}
2290
2291impl common::Part for RepairRolloutRule {}
2292
2293/// RetryAttempt represents an action of retrying the failed Cloud Deploy job.
2294///
2295/// This type is not used in any activity, and only used as *part* of another schema.
2296///
2297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2298#[serde_with::serde_as]
2299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2300pub struct RetryAttempt {
2301    /// Output only. The index of this retry attempt.
2302    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2303    pub attempt: Option<i64>,
2304    /// Output only. Valid state of this retry action.
2305    pub state: Option<String>,
2306    /// Output only. Description of the state of the Retry.
2307    #[serde(rename = "stateDesc")]
2308    pub state_desc: Option<String>,
2309    /// Output only. How long the operation will be paused.
2310    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2311    pub wait: Option<chrono::Duration>,
2312}
2313
2314impl common::Part for RetryAttempt {}
2315
2316/// RetryJobRequest is the request object used by `RetryJob`.
2317///
2318/// # Activities
2319///
2320/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2321/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2322///
2323/// * [locations delivery pipelines releases rollouts retry job projects](ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall) (request)
2324#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2325#[serde_with::serde_as]
2326#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2327pub struct RetryJobRequest {
2328    /// Required. The job ID for the Job to retry.
2329    #[serde(rename = "jobId")]
2330    pub job_id: Option<String>,
2331    /// Required. The phase ID the Job to retry belongs to.
2332    #[serde(rename = "phaseId")]
2333    pub phase_id: Option<String>,
2334}
2335
2336impl common::RequestValue for RetryJobRequest {}
2337
2338/// The response object from ‘RetryJob’.
2339///
2340/// # Activities
2341///
2342/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2343/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2344///
2345/// * [locations delivery pipelines releases rollouts retry job projects](ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall) (response)
2346#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2347#[serde_with::serde_as]
2348#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2349pub struct RetryJobResponse {
2350    _never_set: Option<bool>,
2351}
2352
2353impl common::ResponseResult for RetryJobResponse {}
2354
2355/// RetryPhase contains the retry attempts and the metadata for initiating a new attempt.
2356///
2357/// This type is not used in any activity, and only used as *part* of another schema.
2358///
2359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2360#[serde_with::serde_as]
2361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2362pub struct RetryPhase {
2363    /// Output only. Detail of a retry action.
2364    pub attempts: Option<Vec<RetryAttempt>>,
2365    /// Output only. The pattern of how the wait time of the retry attempt is calculated.
2366    #[serde(rename = "backoffMode")]
2367    pub backoff_mode: Option<String>,
2368    /// Output only. The number of attempts that have been made.
2369    #[serde(rename = "totalAttempts")]
2370    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2371    pub total_attempts: Option<i64>,
2372}
2373
2374impl common::Part for RetryPhase {}
2375
2376/// RollbackAttempt represents an action of rolling back a Cloud Deploy 'Target'.
2377///
2378/// This type is not used in any activity, and only used as *part* of another schema.
2379///
2380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2381#[serde_with::serde_as]
2382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2383pub struct RollbackAttempt {
2384    /// Output only. The phase to which the rollout will be rolled back to.
2385    #[serde(rename = "destinationPhase")]
2386    pub destination_phase: Option<String>,
2387    /// Output only. ID of the rollback `Rollout` to create.
2388    #[serde(rename = "rolloutId")]
2389    pub rollout_id: Option<String>,
2390    /// Output only. Valid state of this rollback action.
2391    pub state: Option<String>,
2392    /// Output only. Description of the state of the Rollback.
2393    #[serde(rename = "stateDesc")]
2394    pub state_desc: Option<String>,
2395}
2396
2397impl common::Part for RollbackAttempt {}
2398
2399/// Configs for the Rollback rollout.
2400///
2401/// This type is not used in any activity, and only used as *part* of another schema.
2402///
2403#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2404#[serde_with::serde_as]
2405#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2406pub struct RollbackTargetConfig {
2407    /// Optional. The rollback `Rollout` to create.
2408    pub rollout: Option<Rollout>,
2409    /// Optional. The starting phase ID for the `Rollout`. If unspecified, the `Rollout` will start in the stable phase.
2410    #[serde(rename = "startingPhaseId")]
2411    pub starting_phase_id: Option<String>,
2412}
2413
2414impl common::Part for RollbackTargetConfig {}
2415
2416/// The request object for `RollbackTarget`.
2417///
2418/// # Activities
2419///
2420/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2421/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2422///
2423/// * [locations delivery pipelines rollback target projects](ProjectLocationDeliveryPipelineRollbackTargetCall) (request)
2424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2425#[serde_with::serde_as]
2426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2427pub struct RollbackTargetRequest {
2428    /// Optional. ID of the `Release` to roll back to. If this isn't specified, the previous successful `Rollout` to the specified target will be used to determine the `Release`.
2429    #[serde(rename = "releaseId")]
2430    pub release_id: Option<String>,
2431    /// Optional. Configs for the rollback `Rollout`.
2432    #[serde(rename = "rollbackConfig")]
2433    pub rollback_config: Option<RollbackTargetConfig>,
2434    /// Required. ID of the rollback `Rollout` to create.
2435    #[serde(rename = "rolloutId")]
2436    pub rollout_id: Option<String>,
2437    /// Optional. If provided, this must be the latest `Rollout` that is on the `Target`.
2438    #[serde(rename = "rolloutToRollBack")]
2439    pub rollout_to_roll_back: Option<String>,
2440    /// Required. ID of the `Target` that is being rolled back.
2441    #[serde(rename = "targetId")]
2442    pub target_id: Option<String>,
2443    /// Optional. If set to true, the request is validated and the user is provided with a `RollbackTargetResponse`.
2444    #[serde(rename = "validateOnly")]
2445    pub validate_only: Option<bool>,
2446}
2447
2448impl common::RequestValue for RollbackTargetRequest {}
2449
2450/// The response object from `RollbackTarget`.
2451///
2452/// # Activities
2453///
2454/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2455/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2456///
2457/// * [locations delivery pipelines rollback target projects](ProjectLocationDeliveryPipelineRollbackTargetCall) (response)
2458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2459#[serde_with::serde_as]
2460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2461pub struct RollbackTargetResponse {
2462    /// The config of the rollback `Rollout` created or will be created.
2463    #[serde(rename = "rollbackConfig")]
2464    pub rollback_config: Option<RollbackTargetConfig>,
2465}
2466
2467impl common::ResponseResult for RollbackTargetResponse {}
2468
2469/// A `Rollout` resource in the Cloud Deploy API. A `Rollout` contains information around a specific deployment to a `Target`.
2470///
2471/// # Activities
2472///
2473/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2474/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2475///
2476/// * [locations delivery pipelines releases rollouts create projects](ProjectLocationDeliveryPipelineReleaseRolloutCreateCall) (request)
2477/// * [locations delivery pipelines releases rollouts get projects](ProjectLocationDeliveryPipelineReleaseRolloutGetCall) (response)
2478#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2479#[serde_with::serde_as]
2480#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2481pub struct Rollout {
2482    /// User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
2483    pub annotations: Option<HashMap<String, String>>,
2484    /// Output only. Approval state of the `Rollout`.
2485    #[serde(rename = "approvalState")]
2486    pub approval_state: Option<String>,
2487    /// Output only. Time at which the `Rollout` was approved.
2488    #[serde(rename = "approveTime")]
2489    pub approve_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2490    /// Output only. Name of the `ControllerRollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
2491    #[serde(rename = "controllerRollout")]
2492    pub controller_rollout: Option<String>,
2493    /// Output only. Time at which the `Rollout` was created.
2494    #[serde(rename = "createTime")]
2495    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2496    /// Output only. Time at which the `Rollout` finished deploying.
2497    #[serde(rename = "deployEndTime")]
2498    pub deploy_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2499    /// Output only. The reason this rollout failed. This will always be unspecified while the rollout is in progress.
2500    #[serde(rename = "deployFailureCause")]
2501    pub deploy_failure_cause: Option<String>,
2502    /// Output only. Time at which the `Rollout` started deploying.
2503    #[serde(rename = "deployStartTime")]
2504    pub deploy_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2505    /// Output only. The resource name of the Cloud Build `Build` object that is used to deploy the Rollout. Format is `projects/{project}/locations/{location}/builds/{build}`.
2506    #[serde(rename = "deployingBuild")]
2507    pub deploying_build: Option<String>,
2508    /// Description of the `Rollout` for user purposes. Max length is 255 characters.
2509    pub description: Option<String>,
2510    /// Output only. Time at which the `Rollout` was enqueued.
2511    #[serde(rename = "enqueueTime")]
2512    pub enqueue_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2513    /// This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2514    pub etag: Option<String>,
2515    /// Output only. Additional information about the rollout failure, if available.
2516    #[serde(rename = "failureReason")]
2517    pub failure_reason: Option<String>,
2518    /// Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
2519    pub labels: Option<HashMap<String, String>>,
2520    /// Output only. Metadata contains information about the rollout.
2521    pub metadata: Option<Metadata>,
2522    /// Optional. Name of the `Rollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`. The `rollout` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
2523    pub name: Option<String>,
2524    /// Output only. The phases that represent the workflows of this `Rollout`.
2525    pub phases: Option<Vec<Phase>>,
2526    /// Output only. Name of the `Rollout` that is rolled back by this `Rollout`. Empty if this `Rollout` wasn't created as a rollback.
2527    #[serde(rename = "rollbackOfRollout")]
2528    pub rollback_of_rollout: Option<String>,
2529    /// Output only. Names of `Rollouts` that rolled back this `Rollout`.
2530    #[serde(rename = "rolledBackByRollouts")]
2531    pub rolled_back_by_rollouts: Option<Vec<String>>,
2532    /// Output only. Current state of the `Rollout`.
2533    pub state: Option<String>,
2534    /// Required. The ID of Target to which this `Rollout` is deploying.
2535    #[serde(rename = "targetId")]
2536    pub target_id: Option<String>,
2537    /// Output only. Unique identifier of the `Rollout`.
2538    pub uid: Option<String>,
2539}
2540
2541impl common::RequestValue for Rollout {}
2542impl common::ResponseResult for Rollout {}
2543
2544/// RuntimeConfig contains the runtime specific configurations for a deployment strategy.
2545///
2546/// This type is not used in any activity, and only used as *part* of another schema.
2547///
2548#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2549#[serde_with::serde_as]
2550#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2551pub struct RuntimeConfig {
2552    /// Cloud Run runtime configuration.
2553    #[serde(rename = "cloudRun")]
2554    pub cloud_run: Option<CloudRunConfig>,
2555    /// Kubernetes runtime configuration.
2556    pub kubernetes: Option<KubernetesConfig>,
2557}
2558
2559impl common::Part for RuntimeConfig {}
2560
2561/// SerialPipeline defines a sequential set of stages for a `DeliveryPipeline`.
2562///
2563/// This type is not used in any activity, and only used as *part* of another schema.
2564///
2565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2566#[serde_with::serde_as]
2567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2568pub struct SerialPipeline {
2569    /// Each stage specifies configuration for a `Target`. The ordering of this list defines the promotion flow.
2570    pub stages: Option<Vec<Stage>>,
2571}
2572
2573impl common::Part for SerialPipeline {}
2574
2575/// Information about the Kubernetes Service networking configuration.
2576///
2577/// This type is not used in any activity, and only used as *part* of another schema.
2578///
2579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2580#[serde_with::serde_as]
2581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2582pub struct ServiceNetworking {
2583    /// Required. Name of the Kubernetes Deployment whose traffic is managed by the specified Service.
2584    pub deployment: Option<String>,
2585    /// Optional. Whether to disable Pod overprovisioning. If Pod overprovisioning is disabled then Cloud Deploy will limit the number of total Pods used for the deployment strategy to the number of Pods the Deployment has on the cluster.
2586    #[serde(rename = "disablePodOverprovisioning")]
2587    pub disable_pod_overprovisioning: Option<bool>,
2588    /// Required. Name of the Kubernetes Service.
2589    pub service: Option<String>,
2590}
2591
2592impl common::Part for ServiceNetworking {}
2593
2594/// Request message for `SetIamPolicy` method.
2595///
2596/// # Activities
2597///
2598/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2599/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2600///
2601/// * [locations custom target types set iam policy projects](ProjectLocationCustomTargetTypeSetIamPolicyCall) (request)
2602/// * [locations delivery pipelines set iam policy projects](ProjectLocationDeliveryPipelineSetIamPolicyCall) (request)
2603/// * [locations targets set iam policy projects](ProjectLocationTargetSetIamPolicyCall) (request)
2604#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2605#[serde_with::serde_as]
2606#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2607pub struct SetIamPolicyRequest {
2608    /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.
2609    pub policy: Option<Policy>,
2610    /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"`
2611    #[serde(rename = "updateMask")]
2612    pub update_mask: Option<common::FieldMask>,
2613}
2614
2615impl common::RequestValue for SetIamPolicyRequest {}
2616
2617/// Cloud Build V2 Repository containing Skaffold Configs.
2618///
2619/// This type is not used in any activity, and only used as *part* of another schema.
2620///
2621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2622#[serde_with::serde_as]
2623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2624pub struct SkaffoldGCBRepoSource {
2625    /// Optional. Relative path from the repository root to the Skaffold Config file.
2626    pub path: Option<String>,
2627    /// Optional. Branch or tag to use when cloning the repository.
2628    #[serde(rename = "ref")]
2629    pub ref_: Option<String>,
2630    /// Required. Name of the Cloud Build V2 Repository. Format is projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}.
2631    pub repository: Option<String>,
2632}
2633
2634impl common::Part for SkaffoldGCBRepoSource {}
2635
2636/// Cloud Storage bucket containing Skaffold Config modules.
2637///
2638/// This type is not used in any activity, and only used as *part* of another schema.
2639///
2640#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2641#[serde_with::serde_as]
2642#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2643pub struct SkaffoldGCSSource {
2644    /// Optional. Relative path from the source to the Skaffold file.
2645    pub path: Option<String>,
2646    /// Required. Cloud Storage source paths to copy recursively. For example, providing "gs://my-bucket/dir/configs/*" will result in Skaffold copying all files within the "dir/configs" directory in the bucket "my-bucket".
2647    pub source: Option<String>,
2648}
2649
2650impl common::Part for SkaffoldGCSSource {}
2651
2652/// Git repository containing Skaffold Config modules.
2653///
2654/// This type is not used in any activity, and only used as *part* of another schema.
2655///
2656#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2657#[serde_with::serde_as]
2658#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2659pub struct SkaffoldGitSource {
2660    /// Optional. Relative path from the repository root to the Skaffold file.
2661    pub path: Option<String>,
2662    /// Optional. Git branch or tag to use when cloning the repository.
2663    #[serde(rename = "ref")]
2664    pub ref_: Option<String>,
2665    /// Required. Git repository the package should be cloned from.
2666    pub repo: Option<String>,
2667}
2668
2669impl common::Part for SkaffoldGitSource {}
2670
2671/// Skaffold Config modules and their remote source.
2672///
2673/// This type is not used in any activity, and only used as *part* of another schema.
2674///
2675#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2676#[serde_with::serde_as]
2677#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2678pub struct SkaffoldModules {
2679    /// Optional. The Skaffold Config modules to use from the specified source.
2680    pub configs: Option<Vec<String>>,
2681    /// Remote git repository containing the Skaffold Config modules.
2682    pub git: Option<SkaffoldGitSource>,
2683    /// Cloud Build V2 repository containing the Skaffold Config modules.
2684    #[serde(rename = "googleCloudBuildRepo")]
2685    pub google_cloud_build_repo: Option<SkaffoldGCBRepoSource>,
2686    /// Cloud Storage bucket containing the Skaffold Config modules.
2687    #[serde(rename = "googleCloudStorage")]
2688    pub google_cloud_storage: Option<SkaffoldGCSSource>,
2689}
2690
2691impl common::Part for SkaffoldModules {}
2692
2693/// SkaffoldSupportedCondition contains information about when support for the release's version of Skaffold ends.
2694///
2695/// This type is not used in any activity, and only used as *part* of another schema.
2696///
2697#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2698#[serde_with::serde_as]
2699#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2700pub struct SkaffoldSupportedCondition {
2701    /// The time at which this release's version of Skaffold will enter maintenance mode.
2702    #[serde(rename = "maintenanceModeTime")]
2703    pub maintenance_mode_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2704    /// The Skaffold support state for this release's version of Skaffold.
2705    #[serde(rename = "skaffoldSupportState")]
2706    pub skaffold_support_state: Option<String>,
2707    /// True if the version of Skaffold used by this release is supported.
2708    pub status: Option<bool>,
2709    /// The time at which this release's version of Skaffold will no longer be supported.
2710    #[serde(rename = "supportExpirationTime")]
2711    pub support_expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2712}
2713
2714impl common::Part for SkaffoldSupportedCondition {}
2715
2716/// Details of a supported Skaffold version.
2717///
2718/// This type is not used in any activity, and only used as *part* of another schema.
2719///
2720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2721#[serde_with::serde_as]
2722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2723pub struct SkaffoldVersion {
2724    /// The time at which this version of Skaffold will enter maintenance mode.
2725    #[serde(rename = "maintenanceModeTime")]
2726    pub maintenance_mode_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2727    /// Date when this version is expected to no longer be supported.
2728    #[serde(rename = "supportEndDate")]
2729    pub support_end_date: Option<Date>,
2730    /// The time at which this version of Skaffold will no longer be supported.
2731    #[serde(rename = "supportExpirationTime")]
2732    pub support_expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2733    /// Release version number. For example, "1.20.3".
2734    pub version: Option<String>,
2735}
2736
2737impl common::Part for SkaffoldVersion {}
2738
2739/// Stage specifies a location to which to deploy.
2740///
2741/// This type is not used in any activity, and only used as *part* of another schema.
2742///
2743#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2744#[serde_with::serde_as]
2745#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2746pub struct Stage {
2747    /// Optional. The deploy parameters to use for the target in this stage.
2748    #[serde(rename = "deployParameters")]
2749    pub deploy_parameters: Option<Vec<DeployParameters>>,
2750    /// Skaffold profiles to use when rendering the manifest for this stage's `Target`.
2751    pub profiles: Option<Vec<String>>,
2752    /// Optional. The strategy to use for a `Rollout` to this stage.
2753    pub strategy: Option<Strategy>,
2754    /// The target_id to which this stage points. This field refers exclusively to the last segment of a target name. For example, this field would just be `my-target` (rather than `projects/project/locations/location/targets/my-target`). The location of the `Target` is inferred to be the same as the location of the `DeliveryPipeline` that contains this `Stage`.
2755    #[serde(rename = "targetId")]
2756    pub target_id: Option<String>,
2757}
2758
2759impl common::Part for Stage {}
2760
2761/// Standard represents the standard deployment strategy.
2762///
2763/// This type is not used in any activity, and only used as *part* of another schema.
2764///
2765#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2766#[serde_with::serde_as]
2767#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2768pub struct Standard {
2769    /// Optional. Configuration for the postdeploy job. If this is not configured, postdeploy job will not be present.
2770    pub postdeploy: Option<Postdeploy>,
2771    /// Optional. Configuration for the predeploy job. If this is not configured, predeploy job will not be present.
2772    pub predeploy: Option<Predeploy>,
2773    /// Whether to verify a deployment.
2774    pub verify: Option<bool>,
2775}
2776
2777impl common::Part for Standard {}
2778
2779/// 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).
2780///
2781/// This type is not used in any activity, and only used as *part* of another schema.
2782///
2783#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2784#[serde_with::serde_as]
2785#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2786pub struct Status {
2787    /// The status code, which should be an enum value of google.rpc.Code.
2788    pub code: Option<i32>,
2789    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
2790    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
2791    /// 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.
2792    pub message: Option<String>,
2793}
2794
2795impl common::Part for Status {}
2796
2797/// Strategy contains deployment strategy information.
2798///
2799/// This type is not used in any activity, and only used as *part* of another schema.
2800///
2801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2802#[serde_with::serde_as]
2803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2804pub struct Strategy {
2805    /// Canary deployment strategy provides progressive percentage based deployments to a Target.
2806    pub canary: Option<Canary>,
2807    /// Standard deployment strategy executes a single deploy and allows verifying the deployment.
2808    pub standard: Option<Standard>,
2809}
2810
2811impl common::Part for Strategy {}
2812
2813/// A `Target` resource in the Cloud Deploy API. A `Target` defines a location to which a Skaffold configuration can be deployed.
2814///
2815/// # Activities
2816///
2817/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2818/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2819///
2820/// * [locations targets create projects](ProjectLocationTargetCreateCall) (request)
2821/// * [locations targets get projects](ProjectLocationTargetGetCall) (response)
2822/// * [locations targets patch projects](ProjectLocationTargetPatchCall) (request)
2823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2824#[serde_with::serde_as]
2825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2826pub struct Target {
2827    /// Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy. See https://google.aip.dev/128#annotations for more details such as format and size limitations.
2828    pub annotations: Option<HashMap<String, String>>,
2829    /// Optional. Information specifying an Anthos Cluster.
2830    #[serde(rename = "anthosCluster")]
2831    pub anthos_cluster: Option<AnthosCluster>,
2832    /// Output only. Time at which the `Target` was created.
2833    #[serde(rename = "createTime")]
2834    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2835    /// Optional. Information specifying a Custom Target.
2836    #[serde(rename = "customTarget")]
2837    pub custom_target: Option<CustomTarget>,
2838    /// Optional. The deploy parameters to use for this target.
2839    #[serde(rename = "deployParameters")]
2840    pub deploy_parameters: Option<HashMap<String, String>>,
2841    /// Optional. Description of the `Target`. Max length is 255 characters.
2842    pub description: Option<String>,
2843    /// Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
2844    pub etag: Option<String>,
2845    /// Configurations for all execution that relates to this `Target`. Each `ExecutionEnvironmentUsage` value may only be used in a single configuration; using the same value multiple times is an error. When one or more configurations are specified, they must include the `RENDER` and `DEPLOY` `ExecutionEnvironmentUsage` values. When no configurations are specified, execution will use the default specified in `DefaultPool`.
2846    #[serde(rename = "executionConfigs")]
2847    pub execution_configs: Option<Vec<ExecutionConfig>>,
2848    /// Optional. Information specifying a GKE Cluster.
2849    pub gke: Option<GkeCluster>,
2850    /// Optional. Labels are attributes that can be set and used by both the user and by Cloud Deploy. Labels must meet the following constraints: * Keys and values can contain only lowercase letters, numeric characters, underscores, and dashes. * All characters must use UTF-8 encoding, and international characters are allowed. * Keys must start with a lowercase letter or international character. * Each resource is limited to a maximum of 64 labels. Both keys and values are additionally constrained to be <= 128 bytes.
2851    pub labels: Option<HashMap<String, String>>,
2852    /// Optional. Information specifying a multiTarget.
2853    #[serde(rename = "multiTarget")]
2854    pub multi_target: Option<MultiTarget>,
2855    /// Optional. Name of the `Target`. Format is `projects/{project}/locations/{location}/targets/{target}`. The `target` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
2856    pub name: Option<String>,
2857    /// Optional. Whether or not the `Target` requires approval.
2858    #[serde(rename = "requireApproval")]
2859    pub require_approval: Option<bool>,
2860    /// Optional. Information specifying a Cloud Run deployment target.
2861    pub run: Option<CloudRunLocation>,
2862    /// Output only. Resource id of the `Target`.
2863    #[serde(rename = "targetId")]
2864    pub target_id: Option<String>,
2865    /// Output only. Unique identifier of the `Target`.
2866    pub uid: Option<String>,
2867    /// Output only. Most recent time at which the `Target` was updated.
2868    #[serde(rename = "updateTime")]
2869    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2870}
2871
2872impl common::RequestValue for Target {}
2873impl common::ResponseResult for Target {}
2874
2875/// The artifacts produced by a target render operation.
2876///
2877/// This type is not used in any activity, and only used as *part* of another schema.
2878///
2879#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2880#[serde_with::serde_as]
2881#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2882pub struct TargetArtifact {
2883    /// Output only. URI of a directory containing the artifacts. This contains deployment configuration used by Skaffold during a rollout, and all paths are relative to this location.
2884    #[serde(rename = "artifactUri")]
2885    pub artifact_uri: Option<String>,
2886    /// Output only. File path of the rendered manifest relative to the URI.
2887    #[serde(rename = "manifestPath")]
2888    pub manifest_path: Option<String>,
2889    /// Output only. Map from the phase ID to the phase artifacts for the `Target`.
2890    #[serde(rename = "phaseArtifacts")]
2891    pub phase_artifacts: Option<HashMap<String, PhaseArtifact>>,
2892    /// Output only. File path of the resolved Skaffold configuration relative to the URI.
2893    #[serde(rename = "skaffoldConfigPath")]
2894    pub skaffold_config_path: Option<String>,
2895}
2896
2897impl common::Part for TargetArtifact {}
2898
2899/// Contains criteria for selecting Targets.
2900///
2901/// This type is not used in any activity, and only used as *part* of another schema.
2902///
2903#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2904#[serde_with::serde_as]
2905#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2906pub struct TargetAttribute {
2907    /// ID of the `Target`. The value of this field could be one of the following: * The last segment of a target name. It only needs the ID to determine which target is being referred to * "*", all targets in a location.
2908    pub id: Option<String>,
2909    /// Target labels.
2910    pub labels: Option<HashMap<String, String>>,
2911}
2912
2913impl common::Part for TargetAttribute {}
2914
2915/// Details of rendering for a single target.
2916///
2917/// This type is not used in any activity, and only used as *part* of another schema.
2918///
2919#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2920#[serde_with::serde_as]
2921#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2922pub struct TargetRender {
2923    /// Output only. Reason this render failed. This will always be unspecified while the render in progress.
2924    #[serde(rename = "failureCause")]
2925    pub failure_cause: Option<String>,
2926    /// Output only. Additional information about the render failure, if available.
2927    #[serde(rename = "failureMessage")]
2928    pub failure_message: Option<String>,
2929    /// Output only. Metadata related to the `Release` render for this Target.
2930    pub metadata: Option<RenderMetadata>,
2931    /// Output only. The resource name of the Cloud Build `Build` object that is used to render the manifest for this target. Format is `projects/{project}/locations/{location}/builds/{build}`.
2932    #[serde(rename = "renderingBuild")]
2933    pub rendering_build: Option<String>,
2934    /// Output only. Current state of the render operation for this Target.
2935    #[serde(rename = "renderingState")]
2936    pub rendering_state: Option<String>,
2937}
2938
2939impl common::Part for TargetRender {}
2940
2941/// `TargetsPresentCondition` contains information on any Targets referenced in the Delivery Pipeline that do not actually exist.
2942///
2943/// This type is not used in any activity, and only used as *part* of another schema.
2944///
2945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2946#[serde_with::serde_as]
2947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2948pub struct TargetsPresentCondition {
2949    /// The list of Target names that do not exist. For example, `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
2950    #[serde(rename = "missingTargets")]
2951    pub missing_targets: Option<Vec<String>>,
2952    /// True if there aren't any missing Targets.
2953    pub status: Option<bool>,
2954    /// Last time the condition was updated.
2955    #[serde(rename = "updateTime")]
2956    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2957}
2958
2959impl common::Part for TargetsPresentCondition {}
2960
2961/// TargetsTypeCondition contains information on whether the Targets defined in the Delivery Pipeline are of the same type.
2962///
2963/// This type is not used in any activity, and only used as *part* of another schema.
2964///
2965#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2966#[serde_with::serde_as]
2967#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2968pub struct TargetsTypeCondition {
2969    /// Human readable error message.
2970    #[serde(rename = "errorDetails")]
2971    pub error_details: Option<String>,
2972    /// True if the targets are all a comparable type. For example this is true if all targets are GKE clusters. This is false if some targets are Cloud Run targets and others are GKE clusters.
2973    pub status: Option<bool>,
2974}
2975
2976impl common::Part for TargetsTypeCondition {}
2977
2978/// The request object used by `TerminateJobRun`.
2979///
2980/// # Activities
2981///
2982/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2983/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2984///
2985/// * [locations delivery pipelines releases rollouts job runs terminate projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall) (request)
2986#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2987#[serde_with::serde_as]
2988#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2989pub struct TerminateJobRunRequest {
2990    _never_set: Option<bool>,
2991}
2992
2993impl common::RequestValue for TerminateJobRunRequest {}
2994
2995/// The response object from `TerminateJobRun`.
2996///
2997/// # Activities
2998///
2999/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3000/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3001///
3002/// * [locations delivery pipelines releases rollouts job runs terminate projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall) (response)
3003#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3004#[serde_with::serde_as]
3005#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3006pub struct TerminateJobRunResponse {
3007    _never_set: Option<bool>,
3008}
3009
3010impl common::ResponseResult for TerminateJobRunResponse {}
3011
3012/// Request message for `TestIamPermissions` method.
3013///
3014/// # Activities
3015///
3016/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3017/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3018///
3019/// * [locations delivery pipelines test iam permissions projects](ProjectLocationDeliveryPipelineTestIamPermissionCall) (request)
3020/// * [locations targets test iam permissions projects](ProjectLocationTargetTestIamPermissionCall) (request)
3021#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3022#[serde_with::serde_as]
3023#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3024pub struct TestIamPermissionsRequest {
3025    /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
3026    pub permissions: Option<Vec<String>>,
3027}
3028
3029impl common::RequestValue for TestIamPermissionsRequest {}
3030
3031/// Response message for `TestIamPermissions` method.
3032///
3033/// # Activities
3034///
3035/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3036/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3037///
3038/// * [locations delivery pipelines test iam permissions projects](ProjectLocationDeliveryPipelineTestIamPermissionCall) (response)
3039/// * [locations targets test iam permissions projects](ProjectLocationTargetTestIamPermissionCall) (response)
3040#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3041#[serde_with::serde_as]
3042#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3043pub struct TestIamPermissionsResponse {
3044    /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
3045    pub permissions: Option<Vec<String>>,
3046}
3047
3048impl common::ResponseResult for TestIamPermissionsResponse {}
3049
3050/// A verify Job.
3051///
3052/// This type is not used in any activity, and only used as *part* of another schema.
3053///
3054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3055#[serde_with::serde_as]
3056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3057pub struct VerifyJob {
3058    _never_set: Option<bool>,
3059}
3060
3061impl common::Part for VerifyJob {}
3062
3063/// VerifyJobRun contains information specific to a verify `JobRun`.
3064///
3065/// This type is not used in any activity, and only used as *part* of another schema.
3066///
3067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3068#[serde_with::serde_as]
3069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3070pub struct VerifyJobRun {
3071    /// Output only. URI of a directory containing the verify artifacts. This contains the Skaffold event log.
3072    #[serde(rename = "artifactUri")]
3073    pub artifact_uri: Option<String>,
3074    /// Output only. The resource name of the Cloud Build `Build` object that is used to verify. Format is `projects/{project}/locations/{location}/builds/{build}`.
3075    pub build: Option<String>,
3076    /// Output only. File path of the Skaffold event log relative to the artifact URI.
3077    #[serde(rename = "eventLogPath")]
3078    pub event_log_path: Option<String>,
3079    /// Output only. The reason the verify failed. This will always be unspecified while the verify is in progress or if it succeeded.
3080    #[serde(rename = "failureCause")]
3081    pub failure_cause: Option<String>,
3082    /// Output only. Additional information about the verify failure, if available.
3083    #[serde(rename = "failureMessage")]
3084    pub failure_message: Option<String>,
3085}
3086
3087impl common::Part for VerifyJobRun {}
3088
3089// ###################
3090// MethodBuilders ###
3091// #################
3092
3093/// A builder providing access to all methods supported on *project* resources.
3094/// It is not used directly, but through the [`CloudDeploy`] hub.
3095///
3096/// # Example
3097///
3098/// Instantiate a resource builder
3099///
3100/// ```test_harness,no_run
3101/// extern crate hyper;
3102/// extern crate hyper_rustls;
3103/// extern crate google_clouddeploy1 as clouddeploy1;
3104///
3105/// # async fn dox() {
3106/// use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3107///
3108/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3109/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3110///     secret,
3111///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3112/// ).build().await.unwrap();
3113///
3114/// let client = hyper_util::client::legacy::Client::builder(
3115///     hyper_util::rt::TokioExecutor::new()
3116/// )
3117/// .build(
3118///     hyper_rustls::HttpsConnectorBuilder::new()
3119///         .with_native_roots()
3120///         .unwrap()
3121///         .https_or_http()
3122///         .enable_http1()
3123///         .build()
3124/// );
3125/// let mut hub = CloudDeploy::new(client, auth);
3126/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3127/// // like `locations_custom_target_types_create(...)`, `locations_custom_target_types_delete(...)`, `locations_custom_target_types_get(...)`, `locations_custom_target_types_get_iam_policy(...)`, `locations_custom_target_types_list(...)`, `locations_custom_target_types_patch(...)`, `locations_custom_target_types_set_iam_policy(...)`, `locations_delivery_pipelines_automation_runs_cancel(...)`, `locations_delivery_pipelines_automation_runs_get(...)`, `locations_delivery_pipelines_automation_runs_list(...)`, `locations_delivery_pipelines_automations_create(...)`, `locations_delivery_pipelines_automations_delete(...)`, `locations_delivery_pipelines_automations_get(...)`, `locations_delivery_pipelines_automations_list(...)`, `locations_delivery_pipelines_automations_patch(...)`, `locations_delivery_pipelines_create(...)`, `locations_delivery_pipelines_delete(...)`, `locations_delivery_pipelines_get(...)`, `locations_delivery_pipelines_get_iam_policy(...)`, `locations_delivery_pipelines_list(...)`, `locations_delivery_pipelines_patch(...)`, `locations_delivery_pipelines_releases_abandon(...)`, `locations_delivery_pipelines_releases_create(...)`, `locations_delivery_pipelines_releases_get(...)`, `locations_delivery_pipelines_releases_list(...)`, `locations_delivery_pipelines_releases_rollouts_advance(...)`, `locations_delivery_pipelines_releases_rollouts_approve(...)`, `locations_delivery_pipelines_releases_rollouts_cancel(...)`, `locations_delivery_pipelines_releases_rollouts_create(...)`, `locations_delivery_pipelines_releases_rollouts_get(...)`, `locations_delivery_pipelines_releases_rollouts_ignore_job(...)`, `locations_delivery_pipelines_releases_rollouts_job_runs_get(...)`, `locations_delivery_pipelines_releases_rollouts_job_runs_list(...)`, `locations_delivery_pipelines_releases_rollouts_job_runs_terminate(...)`, `locations_delivery_pipelines_releases_rollouts_list(...)`, `locations_delivery_pipelines_releases_rollouts_retry_job(...)`, `locations_delivery_pipelines_rollback_target(...)`, `locations_delivery_pipelines_set_iam_policy(...)`, `locations_delivery_pipelines_test_iam_permissions(...)`, `locations_get(...)`, `locations_get_config(...)`, `locations_list(...)`, `locations_operations_cancel(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `locations_targets_create(...)`, `locations_targets_delete(...)`, `locations_targets_get(...)`, `locations_targets_get_iam_policy(...)`, `locations_targets_list(...)`, `locations_targets_patch(...)`, `locations_targets_set_iam_policy(...)` and `locations_targets_test_iam_permissions(...)`
3128/// // to build up your call.
3129/// let rb = hub.projects();
3130/// # }
3131/// ```
3132pub struct ProjectMethods<'a, C>
3133where
3134    C: 'a,
3135{
3136    hub: &'a CloudDeploy<C>,
3137}
3138
3139impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3140
3141impl<'a, C> ProjectMethods<'a, C> {
3142    /// Create a builder to help you perform the following task:
3143    ///
3144    /// Creates a new CustomTargetType in a given project and location.
3145    ///
3146    /// # Arguments
3147    ///
3148    /// * `request` - No description provided.
3149    /// * `parent` - Required. The parent collection in which the `CustomTargetType` should be created. Format should be `projects/{project_id}/locations/{location_name}`.
3150    pub fn locations_custom_target_types_create(
3151        &self,
3152        request: CustomTargetType,
3153        parent: &str,
3154    ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
3155        ProjectLocationCustomTargetTypeCreateCall {
3156            hub: self.hub,
3157            _request: request,
3158            _parent: parent.to_string(),
3159            _validate_only: Default::default(),
3160            _request_id: Default::default(),
3161            _custom_target_type_id: Default::default(),
3162            _delegate: Default::default(),
3163            _additional_params: Default::default(),
3164            _scopes: Default::default(),
3165        }
3166    }
3167
3168    /// Create a builder to help you perform the following task:
3169    ///
3170    /// Deletes a single CustomTargetType.
3171    ///
3172    /// # Arguments
3173    ///
3174    /// * `name` - Required. The name of the `CustomTargetType` to delete. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
3175    pub fn locations_custom_target_types_delete(
3176        &self,
3177        name: &str,
3178    ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
3179        ProjectLocationCustomTargetTypeDeleteCall {
3180            hub: self.hub,
3181            _name: name.to_string(),
3182            _validate_only: Default::default(),
3183            _request_id: Default::default(),
3184            _etag: Default::default(),
3185            _allow_missing: Default::default(),
3186            _delegate: Default::default(),
3187            _additional_params: Default::default(),
3188            _scopes: Default::default(),
3189        }
3190    }
3191
3192    /// Create a builder to help you perform the following task:
3193    ///
3194    /// Gets details of a single CustomTargetType.
3195    ///
3196    /// # Arguments
3197    ///
3198    /// * `name` - Required. Name of the `CustomTargetType`. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
3199    pub fn locations_custom_target_types_get(
3200        &self,
3201        name: &str,
3202    ) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
3203        ProjectLocationCustomTargetTypeGetCall {
3204            hub: self.hub,
3205            _name: name.to_string(),
3206            _delegate: Default::default(),
3207            _additional_params: Default::default(),
3208            _scopes: Default::default(),
3209        }
3210    }
3211
3212    /// Create a builder to help you perform the following task:
3213    ///
3214    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3215    ///
3216    /// # Arguments
3217    ///
3218    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3219    pub fn locations_custom_target_types_get_iam_policy(
3220        &self,
3221        resource: &str,
3222    ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
3223        ProjectLocationCustomTargetTypeGetIamPolicyCall {
3224            hub: self.hub,
3225            _resource: resource.to_string(),
3226            _options_requested_policy_version: Default::default(),
3227            _delegate: Default::default(),
3228            _additional_params: Default::default(),
3229            _scopes: Default::default(),
3230        }
3231    }
3232
3233    /// Create a builder to help you perform the following task:
3234    ///
3235    /// Lists CustomTargetTypes in a given project and location.
3236    ///
3237    /// # Arguments
3238    ///
3239    /// * `parent` - Required. The parent that owns this collection of custom target types. Format must be `projects/{project_id}/locations/{location_name}`.
3240    pub fn locations_custom_target_types_list(
3241        &self,
3242        parent: &str,
3243    ) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
3244        ProjectLocationCustomTargetTypeListCall {
3245            hub: self.hub,
3246            _parent: parent.to_string(),
3247            _page_token: Default::default(),
3248            _page_size: Default::default(),
3249            _order_by: Default::default(),
3250            _filter: Default::default(),
3251            _delegate: Default::default(),
3252            _additional_params: Default::default(),
3253            _scopes: Default::default(),
3254        }
3255    }
3256
3257    /// Create a builder to help you perform the following task:
3258    ///
3259    /// Updates a single CustomTargetType.
3260    ///
3261    /// # Arguments
3262    ///
3263    /// * `request` - No description provided.
3264    /// * `name` - Optional. Name of the `CustomTargetType`. Format is `projects/{project}/locations/{location}/customTargetTypes/{customTargetType}`. The `customTargetType` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
3265    pub fn locations_custom_target_types_patch(
3266        &self,
3267        request: CustomTargetType,
3268        name: &str,
3269    ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
3270        ProjectLocationCustomTargetTypePatchCall {
3271            hub: self.hub,
3272            _request: request,
3273            _name: name.to_string(),
3274            _validate_only: Default::default(),
3275            _update_mask: Default::default(),
3276            _request_id: Default::default(),
3277            _allow_missing: Default::default(),
3278            _delegate: Default::default(),
3279            _additional_params: Default::default(),
3280            _scopes: Default::default(),
3281        }
3282    }
3283
3284    /// Create a builder to help you perform the following task:
3285    ///
3286    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3287    ///
3288    /// # Arguments
3289    ///
3290    /// * `request` - No description provided.
3291    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3292    pub fn locations_custom_target_types_set_iam_policy(
3293        &self,
3294        request: SetIamPolicyRequest,
3295        resource: &str,
3296    ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
3297        ProjectLocationCustomTargetTypeSetIamPolicyCall {
3298            hub: self.hub,
3299            _request: request,
3300            _resource: resource.to_string(),
3301            _delegate: Default::default(),
3302            _additional_params: Default::default(),
3303            _scopes: Default::default(),
3304        }
3305    }
3306
3307    /// Create a builder to help you perform the following task:
3308    ///
3309    /// Cancels an AutomationRun. The `state` of the `AutomationRun` after cancelling is `CANCELLED`. `CancelAutomationRun` can be called on AutomationRun in the state `IN_PROGRESS` and `PENDING`; AutomationRun in a different state returns an `FAILED_PRECONDITION` error.
3310    ///
3311    /// # Arguments
3312    ///
3313    /// * `request` - No description provided.
3314    /// * `name` - Required. Name of the `AutomationRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
3315    pub fn locations_delivery_pipelines_automation_runs_cancel(
3316        &self,
3317        request: CancelAutomationRunRequest,
3318        name: &str,
3319    ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
3320        ProjectLocationDeliveryPipelineAutomationRunCancelCall {
3321            hub: self.hub,
3322            _request: request,
3323            _name: name.to_string(),
3324            _delegate: Default::default(),
3325            _additional_params: Default::default(),
3326            _scopes: Default::default(),
3327        }
3328    }
3329
3330    /// Create a builder to help you perform the following task:
3331    ///
3332    /// Gets details of a single AutomationRun.
3333    ///
3334    /// # Arguments
3335    ///
3336    /// * `name` - Required. Name of the `AutomationRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
3337    pub fn locations_delivery_pipelines_automation_runs_get(
3338        &self,
3339        name: &str,
3340    ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
3341        ProjectLocationDeliveryPipelineAutomationRunGetCall {
3342            hub: self.hub,
3343            _name: name.to_string(),
3344            _delegate: Default::default(),
3345            _additional_params: Default::default(),
3346            _scopes: Default::default(),
3347        }
3348    }
3349
3350    /// Create a builder to help you perform the following task:
3351    ///
3352    /// Lists AutomationRuns in a given project and location.
3353    ///
3354    /// # Arguments
3355    ///
3356    /// * `parent` - Required. The parent `Delivery Pipeline`, which owns this collection of automationRuns. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}`.
3357    pub fn locations_delivery_pipelines_automation_runs_list(
3358        &self,
3359        parent: &str,
3360    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
3361        ProjectLocationDeliveryPipelineAutomationRunListCall {
3362            hub: self.hub,
3363            _parent: parent.to_string(),
3364            _page_token: Default::default(),
3365            _page_size: Default::default(),
3366            _order_by: Default::default(),
3367            _filter: Default::default(),
3368            _delegate: Default::default(),
3369            _additional_params: Default::default(),
3370            _scopes: Default::default(),
3371        }
3372    }
3373
3374    /// Create a builder to help you perform the following task:
3375    ///
3376    /// Creates a new Automation in a given project and location.
3377    ///
3378    /// # Arguments
3379    ///
3380    /// * `request` - No description provided.
3381    /// * `parent` - Required. The parent collection in which the `Automation` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
3382    pub fn locations_delivery_pipelines_automations_create(
3383        &self,
3384        request: Automation,
3385        parent: &str,
3386    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
3387        ProjectLocationDeliveryPipelineAutomationCreateCall {
3388            hub: self.hub,
3389            _request: request,
3390            _parent: parent.to_string(),
3391            _validate_only: Default::default(),
3392            _request_id: Default::default(),
3393            _automation_id: Default::default(),
3394            _delegate: Default::default(),
3395            _additional_params: Default::default(),
3396            _scopes: Default::default(),
3397        }
3398    }
3399
3400    /// Create a builder to help you perform the following task:
3401    ///
3402    /// Deletes a single Automation resource.
3403    ///
3404    /// # Arguments
3405    ///
3406    /// * `name` - Required. The name of the `Automation` to delete. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
3407    pub fn locations_delivery_pipelines_automations_delete(
3408        &self,
3409        name: &str,
3410    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
3411        ProjectLocationDeliveryPipelineAutomationDeleteCall {
3412            hub: self.hub,
3413            _name: name.to_string(),
3414            _validate_only: Default::default(),
3415            _request_id: Default::default(),
3416            _etag: Default::default(),
3417            _allow_missing: Default::default(),
3418            _delegate: Default::default(),
3419            _additional_params: Default::default(),
3420            _scopes: Default::default(),
3421        }
3422    }
3423
3424    /// Create a builder to help you perform the following task:
3425    ///
3426    /// Gets details of a single Automation.
3427    ///
3428    /// # Arguments
3429    ///
3430    /// * `name` - Required. Name of the `Automation`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
3431    pub fn locations_delivery_pipelines_automations_get(
3432        &self,
3433        name: &str,
3434    ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
3435        ProjectLocationDeliveryPipelineAutomationGetCall {
3436            hub: self.hub,
3437            _name: name.to_string(),
3438            _delegate: Default::default(),
3439            _additional_params: Default::default(),
3440            _scopes: Default::default(),
3441        }
3442    }
3443
3444    /// Create a builder to help you perform the following task:
3445    ///
3446    /// Lists Automations in a given project and location.
3447    ///
3448    /// # Arguments
3449    ///
3450    /// * `parent` - Required. The parent `Delivery Pipeline`, which owns this collection of automations. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
3451    pub fn locations_delivery_pipelines_automations_list(
3452        &self,
3453        parent: &str,
3454    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
3455        ProjectLocationDeliveryPipelineAutomationListCall {
3456            hub: self.hub,
3457            _parent: parent.to_string(),
3458            _page_token: Default::default(),
3459            _page_size: Default::default(),
3460            _order_by: Default::default(),
3461            _filter: Default::default(),
3462            _delegate: Default::default(),
3463            _additional_params: Default::default(),
3464            _scopes: Default::default(),
3465        }
3466    }
3467
3468    /// Create a builder to help you perform the following task:
3469    ///
3470    /// Updates the parameters of a single Automation resource.
3471    ///
3472    /// # Arguments
3473    ///
3474    /// * `request` - No description provided.
3475    /// * `name` - Output only. Name of the `Automation`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automations/{automation}`.
3476    pub fn locations_delivery_pipelines_automations_patch(
3477        &self,
3478        request: Automation,
3479        name: &str,
3480    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
3481        ProjectLocationDeliveryPipelineAutomationPatchCall {
3482            hub: self.hub,
3483            _request: request,
3484            _name: name.to_string(),
3485            _validate_only: Default::default(),
3486            _update_mask: Default::default(),
3487            _request_id: Default::default(),
3488            _allow_missing: Default::default(),
3489            _delegate: Default::default(),
3490            _additional_params: Default::default(),
3491            _scopes: Default::default(),
3492        }
3493    }
3494
3495    /// Create a builder to help you perform the following task:
3496    ///
3497    /// Gets details of a single JobRun.
3498    ///
3499    /// # Arguments
3500    ///
3501    /// * `name` - Required. Name of the `JobRun`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}`.
3502    pub fn locations_delivery_pipelines_releases_rollouts_job_runs_get(
3503        &self,
3504        name: &str,
3505    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
3506        ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall {
3507            hub: self.hub,
3508            _name: name.to_string(),
3509            _delegate: Default::default(),
3510            _additional_params: Default::default(),
3511            _scopes: Default::default(),
3512        }
3513    }
3514
3515    /// Create a builder to help you perform the following task:
3516    ///
3517    /// Lists JobRuns in a given project and location.
3518    ///
3519    /// # Arguments
3520    ///
3521    /// * `parent` - Required. The `Rollout` which owns this collection of `JobRun` objects.
3522    pub fn locations_delivery_pipelines_releases_rollouts_job_runs_list(
3523        &self,
3524        parent: &str,
3525    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
3526        ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall {
3527            hub: self.hub,
3528            _parent: parent.to_string(),
3529            _page_token: Default::default(),
3530            _page_size: Default::default(),
3531            _order_by: Default::default(),
3532            _filter: Default::default(),
3533            _delegate: Default::default(),
3534            _additional_params: Default::default(),
3535            _scopes: Default::default(),
3536        }
3537    }
3538
3539    /// Create a builder to help you perform the following task:
3540    ///
3541    /// Terminates a Job Run in a given project and location.
3542    ///
3543    /// # Arguments
3544    ///
3545    /// * `request` - No description provided.
3546    /// * `name` - Required. Name of the `JobRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}`.
3547    pub fn locations_delivery_pipelines_releases_rollouts_job_runs_terminate(
3548        &self,
3549        request: TerminateJobRunRequest,
3550        name: &str,
3551    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
3552        ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall {
3553            hub: self.hub,
3554            _request: request,
3555            _name: name.to_string(),
3556            _delegate: Default::default(),
3557            _additional_params: Default::default(),
3558            _scopes: Default::default(),
3559        }
3560    }
3561
3562    /// Create a builder to help you perform the following task:
3563    ///
3564    /// Advances a Rollout in a given project and location.
3565    ///
3566    /// # Arguments
3567    ///
3568    /// * `request` - No description provided.
3569    /// * `name` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
3570    pub fn locations_delivery_pipelines_releases_rollouts_advance(
3571        &self,
3572        request: AdvanceRolloutRequest,
3573        name: &str,
3574    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
3575        ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall {
3576            hub: self.hub,
3577            _request: request,
3578            _name: name.to_string(),
3579            _delegate: Default::default(),
3580            _additional_params: Default::default(),
3581            _scopes: Default::default(),
3582        }
3583    }
3584
3585    /// Create a builder to help you perform the following task:
3586    ///
3587    /// Approves a Rollout.
3588    ///
3589    /// # Arguments
3590    ///
3591    /// * `request` - No description provided.
3592    /// * `name` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
3593    pub fn locations_delivery_pipelines_releases_rollouts_approve(
3594        &self,
3595        request: ApproveRolloutRequest,
3596        name: &str,
3597    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
3598        ProjectLocationDeliveryPipelineReleaseRolloutApproveCall {
3599            hub: self.hub,
3600            _request: request,
3601            _name: name.to_string(),
3602            _delegate: Default::default(),
3603            _additional_params: Default::default(),
3604            _scopes: Default::default(),
3605        }
3606    }
3607
3608    /// Create a builder to help you perform the following task:
3609    ///
3610    /// Cancels a Rollout in a given project and location.
3611    ///
3612    /// # Arguments
3613    ///
3614    /// * `request` - No description provided.
3615    /// * `name` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
3616    pub fn locations_delivery_pipelines_releases_rollouts_cancel(
3617        &self,
3618        request: CancelRolloutRequest,
3619        name: &str,
3620    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
3621        ProjectLocationDeliveryPipelineReleaseRolloutCancelCall {
3622            hub: self.hub,
3623            _request: request,
3624            _name: name.to_string(),
3625            _delegate: Default::default(),
3626            _additional_params: Default::default(),
3627            _scopes: Default::default(),
3628        }
3629    }
3630
3631    /// Create a builder to help you perform the following task:
3632    ///
3633    /// Creates a new Rollout in a given project and location.
3634    ///
3635    /// # Arguments
3636    ///
3637    /// * `request` - No description provided.
3638    /// * `parent` - Required. The parent collection in which the `Rollout` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
3639    pub fn locations_delivery_pipelines_releases_rollouts_create(
3640        &self,
3641        request: Rollout,
3642        parent: &str,
3643    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
3644        ProjectLocationDeliveryPipelineReleaseRolloutCreateCall {
3645            hub: self.hub,
3646            _request: request,
3647            _parent: parent.to_string(),
3648            _validate_only: Default::default(),
3649            _starting_phase_id: Default::default(),
3650            _rollout_id: Default::default(),
3651            _request_id: Default::default(),
3652            _delegate: Default::default(),
3653            _additional_params: Default::default(),
3654            _scopes: Default::default(),
3655        }
3656    }
3657
3658    /// Create a builder to help you perform the following task:
3659    ///
3660    /// Gets details of a single Rollout.
3661    ///
3662    /// # Arguments
3663    ///
3664    /// * `name` - Required. Name of the `Rollout`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}`.
3665    pub fn locations_delivery_pipelines_releases_rollouts_get(
3666        &self,
3667        name: &str,
3668    ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
3669        ProjectLocationDeliveryPipelineReleaseRolloutGetCall {
3670            hub: self.hub,
3671            _name: name.to_string(),
3672            _delegate: Default::default(),
3673            _additional_params: Default::default(),
3674            _scopes: Default::default(),
3675        }
3676    }
3677
3678    /// Create a builder to help you perform the following task:
3679    ///
3680    /// Ignores the specified Job in a Rollout.
3681    ///
3682    /// # Arguments
3683    ///
3684    /// * `request` - No description provided.
3685    /// * `rollout` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
3686    pub fn locations_delivery_pipelines_releases_rollouts_ignore_job(
3687        &self,
3688        request: IgnoreJobRequest,
3689        rollout: &str,
3690    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
3691        ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall {
3692            hub: self.hub,
3693            _request: request,
3694            _rollout: rollout.to_string(),
3695            _delegate: Default::default(),
3696            _additional_params: Default::default(),
3697            _scopes: Default::default(),
3698        }
3699    }
3700
3701    /// Create a builder to help you perform the following task:
3702    ///
3703    /// Lists Rollouts in a given project and location.
3704    ///
3705    /// # Arguments
3706    ///
3707    /// * `parent` - Required. The `Release` which owns this collection of `Rollout` objects.
3708    pub fn locations_delivery_pipelines_releases_rollouts_list(
3709        &self,
3710        parent: &str,
3711    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
3712        ProjectLocationDeliveryPipelineReleaseRolloutListCall {
3713            hub: self.hub,
3714            _parent: parent.to_string(),
3715            _page_token: Default::default(),
3716            _page_size: Default::default(),
3717            _order_by: Default::default(),
3718            _filter: Default::default(),
3719            _delegate: Default::default(),
3720            _additional_params: Default::default(),
3721            _scopes: Default::default(),
3722        }
3723    }
3724
3725    /// Create a builder to help you perform the following task:
3726    ///
3727    /// Retries the specified Job in a Rollout.
3728    ///
3729    /// # Arguments
3730    ///
3731    /// * `request` - No description provided.
3732    /// * `rollout` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
3733    pub fn locations_delivery_pipelines_releases_rollouts_retry_job(
3734        &self,
3735        request: RetryJobRequest,
3736        rollout: &str,
3737    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
3738        ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall {
3739            hub: self.hub,
3740            _request: request,
3741            _rollout: rollout.to_string(),
3742            _delegate: Default::default(),
3743            _additional_params: Default::default(),
3744            _scopes: Default::default(),
3745        }
3746    }
3747
3748    /// Create a builder to help you perform the following task:
3749    ///
3750    /// Abandons a Release in the Delivery Pipeline.
3751    ///
3752    /// # Arguments
3753    ///
3754    /// * `request` - No description provided.
3755    /// * `name` - Required. Name of the Release. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}`.
3756    pub fn locations_delivery_pipelines_releases_abandon(
3757        &self,
3758        request: AbandonReleaseRequest,
3759        name: &str,
3760    ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
3761        ProjectLocationDeliveryPipelineReleaseAbandonCall {
3762            hub: self.hub,
3763            _request: request,
3764            _name: name.to_string(),
3765            _delegate: Default::default(),
3766            _additional_params: Default::default(),
3767            _scopes: Default::default(),
3768        }
3769    }
3770
3771    /// Create a builder to help you perform the following task:
3772    ///
3773    /// Creates a new Release in a given project and location.
3774    ///
3775    /// # Arguments
3776    ///
3777    /// * `request` - No description provided.
3778    /// * `parent` - Required. The parent collection in which the `Release` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
3779    pub fn locations_delivery_pipelines_releases_create(
3780        &self,
3781        request: Release,
3782        parent: &str,
3783    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
3784        ProjectLocationDeliveryPipelineReleaseCreateCall {
3785            hub: self.hub,
3786            _request: request,
3787            _parent: parent.to_string(),
3788            _validate_only: Default::default(),
3789            _request_id: Default::default(),
3790            _release_id: Default::default(),
3791            _delegate: Default::default(),
3792            _additional_params: Default::default(),
3793            _scopes: Default::default(),
3794        }
3795    }
3796
3797    /// Create a builder to help you perform the following task:
3798    ///
3799    /// Gets details of a single Release.
3800    ///
3801    /// # Arguments
3802    ///
3803    /// * `name` - Required. Name of the `Release`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
3804    pub fn locations_delivery_pipelines_releases_get(
3805        &self,
3806        name: &str,
3807    ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
3808        ProjectLocationDeliveryPipelineReleaseGetCall {
3809            hub: self.hub,
3810            _name: name.to_string(),
3811            _delegate: Default::default(),
3812            _additional_params: Default::default(),
3813            _scopes: Default::default(),
3814        }
3815    }
3816
3817    /// Create a builder to help you perform the following task:
3818    ///
3819    /// Lists Releases in a given project and location.
3820    ///
3821    /// # Arguments
3822    ///
3823    /// * `parent` - Required. The `DeliveryPipeline` which owns this collection of `Release` objects.
3824    pub fn locations_delivery_pipelines_releases_list(
3825        &self,
3826        parent: &str,
3827    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
3828        ProjectLocationDeliveryPipelineReleaseListCall {
3829            hub: self.hub,
3830            _parent: parent.to_string(),
3831            _page_token: Default::default(),
3832            _page_size: Default::default(),
3833            _order_by: Default::default(),
3834            _filter: Default::default(),
3835            _delegate: Default::default(),
3836            _additional_params: Default::default(),
3837            _scopes: Default::default(),
3838        }
3839    }
3840
3841    /// Create a builder to help you perform the following task:
3842    ///
3843    /// Creates a new DeliveryPipeline in a given project and location.
3844    ///
3845    /// # Arguments
3846    ///
3847    /// * `request` - No description provided.
3848    /// * `parent` - Required. The parent collection in which the `DeliveryPipeline` should be created. Format should be `projects/{project_id}/locations/{location_name}`.
3849    pub fn locations_delivery_pipelines_create(
3850        &self,
3851        request: DeliveryPipeline,
3852        parent: &str,
3853    ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
3854        ProjectLocationDeliveryPipelineCreateCall {
3855            hub: self.hub,
3856            _request: request,
3857            _parent: parent.to_string(),
3858            _validate_only: Default::default(),
3859            _request_id: Default::default(),
3860            _delivery_pipeline_id: Default::default(),
3861            _delegate: Default::default(),
3862            _additional_params: Default::default(),
3863            _scopes: Default::default(),
3864        }
3865    }
3866
3867    /// Create a builder to help you perform the following task:
3868    ///
3869    /// Deletes a single DeliveryPipeline.
3870    ///
3871    /// # Arguments
3872    ///
3873    /// * `name` - Required. The name of the `DeliveryPipeline` to delete. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
3874    pub fn locations_delivery_pipelines_delete(
3875        &self,
3876        name: &str,
3877    ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
3878        ProjectLocationDeliveryPipelineDeleteCall {
3879            hub: self.hub,
3880            _name: name.to_string(),
3881            _validate_only: Default::default(),
3882            _request_id: Default::default(),
3883            _force: Default::default(),
3884            _etag: Default::default(),
3885            _allow_missing: Default::default(),
3886            _delegate: Default::default(),
3887            _additional_params: Default::default(),
3888            _scopes: Default::default(),
3889        }
3890    }
3891
3892    /// Create a builder to help you perform the following task:
3893    ///
3894    /// Gets details of a single DeliveryPipeline.
3895    ///
3896    /// # Arguments
3897    ///
3898    /// * `name` - Required. Name of the `DeliveryPipeline`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
3899    pub fn locations_delivery_pipelines_get(
3900        &self,
3901        name: &str,
3902    ) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
3903        ProjectLocationDeliveryPipelineGetCall {
3904            hub: self.hub,
3905            _name: name.to_string(),
3906            _delegate: Default::default(),
3907            _additional_params: Default::default(),
3908            _scopes: Default::default(),
3909        }
3910    }
3911
3912    /// Create a builder to help you perform the following task:
3913    ///
3914    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3915    ///
3916    /// # Arguments
3917    ///
3918    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
3919    pub fn locations_delivery_pipelines_get_iam_policy(
3920        &self,
3921        resource: &str,
3922    ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
3923        ProjectLocationDeliveryPipelineGetIamPolicyCall {
3924            hub: self.hub,
3925            _resource: resource.to_string(),
3926            _options_requested_policy_version: Default::default(),
3927            _delegate: Default::default(),
3928            _additional_params: Default::default(),
3929            _scopes: Default::default(),
3930        }
3931    }
3932
3933    /// Create a builder to help you perform the following task:
3934    ///
3935    /// Lists DeliveryPipelines in a given project and location.
3936    ///
3937    /// # Arguments
3938    ///
3939    /// * `parent` - Required. The parent, which owns this collection of pipelines. Format must be `projects/{project_id}/locations/{location_name}`.
3940    pub fn locations_delivery_pipelines_list(
3941        &self,
3942        parent: &str,
3943    ) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
3944        ProjectLocationDeliveryPipelineListCall {
3945            hub: self.hub,
3946            _parent: parent.to_string(),
3947            _page_token: Default::default(),
3948            _page_size: Default::default(),
3949            _order_by: Default::default(),
3950            _filter: Default::default(),
3951            _delegate: Default::default(),
3952            _additional_params: Default::default(),
3953            _scopes: Default::default(),
3954        }
3955    }
3956
3957    /// Create a builder to help you perform the following task:
3958    ///
3959    /// Updates the parameters of a single DeliveryPipeline.
3960    ///
3961    /// # Arguments
3962    ///
3963    /// * `request` - No description provided.
3964    /// * `name` - Optional. Name of the `DeliveryPipeline`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}`. The `deliveryPipeline` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
3965    pub fn locations_delivery_pipelines_patch(
3966        &self,
3967        request: DeliveryPipeline,
3968        name: &str,
3969    ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
3970        ProjectLocationDeliveryPipelinePatchCall {
3971            hub: self.hub,
3972            _request: request,
3973            _name: name.to_string(),
3974            _validate_only: Default::default(),
3975            _update_mask: Default::default(),
3976            _request_id: Default::default(),
3977            _allow_missing: Default::default(),
3978            _delegate: Default::default(),
3979            _additional_params: Default::default(),
3980            _scopes: Default::default(),
3981        }
3982    }
3983
3984    /// Create a builder to help you perform the following task:
3985    ///
3986    /// Creates a `Rollout` to roll back the specified target.
3987    ///
3988    /// # Arguments
3989    ///
3990    /// * `request` - No description provided.
3991    /// * `name` - Required. The `DeliveryPipeline` for which the rollback `Rollout` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
3992    pub fn locations_delivery_pipelines_rollback_target(
3993        &self,
3994        request: RollbackTargetRequest,
3995        name: &str,
3996    ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
3997        ProjectLocationDeliveryPipelineRollbackTargetCall {
3998            hub: self.hub,
3999            _request: request,
4000            _name: name.to_string(),
4001            _delegate: Default::default(),
4002            _additional_params: Default::default(),
4003            _scopes: Default::default(),
4004        }
4005    }
4006
4007    /// Create a builder to help you perform the following task:
4008    ///
4009    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4010    ///
4011    /// # Arguments
4012    ///
4013    /// * `request` - No description provided.
4014    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4015    pub fn locations_delivery_pipelines_set_iam_policy(
4016        &self,
4017        request: SetIamPolicyRequest,
4018        resource: &str,
4019    ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
4020        ProjectLocationDeliveryPipelineSetIamPolicyCall {
4021            hub: self.hub,
4022            _request: request,
4023            _resource: resource.to_string(),
4024            _delegate: Default::default(),
4025            _additional_params: Default::default(),
4026            _scopes: Default::default(),
4027        }
4028    }
4029
4030    /// Create a builder to help you perform the following task:
4031    ///
4032    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4033    ///
4034    /// # Arguments
4035    ///
4036    /// * `request` - No description provided.
4037    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4038    pub fn locations_delivery_pipelines_test_iam_permissions(
4039        &self,
4040        request: TestIamPermissionsRequest,
4041        resource: &str,
4042    ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
4043        ProjectLocationDeliveryPipelineTestIamPermissionCall {
4044            hub: self.hub,
4045            _request: request,
4046            _resource: resource.to_string(),
4047            _delegate: Default::default(),
4048            _additional_params: Default::default(),
4049            _scopes: Default::default(),
4050        }
4051    }
4052
4053    /// Create a builder to help you perform the following task:
4054    ///
4055    /// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
4056    ///
4057    /// # Arguments
4058    ///
4059    /// * `request` - No description provided.
4060    /// * `name` - The name of the operation resource to be cancelled.
4061    pub fn locations_operations_cancel(
4062        &self,
4063        request: CancelOperationRequest,
4064        name: &str,
4065    ) -> ProjectLocationOperationCancelCall<'a, C> {
4066        ProjectLocationOperationCancelCall {
4067            hub: self.hub,
4068            _request: request,
4069            _name: name.to_string(),
4070            _delegate: Default::default(),
4071            _additional_params: Default::default(),
4072            _scopes: Default::default(),
4073        }
4074    }
4075
4076    /// Create a builder to help you perform the following task:
4077    ///
4078    /// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
4079    ///
4080    /// # Arguments
4081    ///
4082    /// * `name` - The name of the operation resource to be deleted.
4083    pub fn locations_operations_delete(
4084        &self,
4085        name: &str,
4086    ) -> ProjectLocationOperationDeleteCall<'a, C> {
4087        ProjectLocationOperationDeleteCall {
4088            hub: self.hub,
4089            _name: name.to_string(),
4090            _delegate: Default::default(),
4091            _additional_params: Default::default(),
4092            _scopes: Default::default(),
4093        }
4094    }
4095
4096    /// Create a builder to help you perform the following task:
4097    ///
4098    /// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
4099    ///
4100    /// # Arguments
4101    ///
4102    /// * `name` - The name of the operation resource.
4103    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
4104        ProjectLocationOperationGetCall {
4105            hub: self.hub,
4106            _name: name.to_string(),
4107            _delegate: Default::default(),
4108            _additional_params: Default::default(),
4109            _scopes: Default::default(),
4110        }
4111    }
4112
4113    /// Create a builder to help you perform the following task:
4114    ///
4115    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
4116    ///
4117    /// # Arguments
4118    ///
4119    /// * `name` - The name of the operation's parent resource.
4120    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
4121        ProjectLocationOperationListCall {
4122            hub: self.hub,
4123            _name: name.to_string(),
4124            _page_token: Default::default(),
4125            _page_size: Default::default(),
4126            _filter: Default::default(),
4127            _delegate: Default::default(),
4128            _additional_params: Default::default(),
4129            _scopes: Default::default(),
4130        }
4131    }
4132
4133    /// Create a builder to help you perform the following task:
4134    ///
4135    /// Creates a new Target in a given project and location.
4136    ///
4137    /// # Arguments
4138    ///
4139    /// * `request` - No description provided.
4140    /// * `parent` - Required. The parent collection in which the `Target` should be created. Format should be `projects/{project_id}/locations/{location_name}`.
4141    pub fn locations_targets_create(
4142        &self,
4143        request: Target,
4144        parent: &str,
4145    ) -> ProjectLocationTargetCreateCall<'a, C> {
4146        ProjectLocationTargetCreateCall {
4147            hub: self.hub,
4148            _request: request,
4149            _parent: parent.to_string(),
4150            _validate_only: Default::default(),
4151            _target_id: Default::default(),
4152            _request_id: Default::default(),
4153            _delegate: Default::default(),
4154            _additional_params: Default::default(),
4155            _scopes: Default::default(),
4156        }
4157    }
4158
4159    /// Create a builder to help you perform the following task:
4160    ///
4161    /// Deletes a single Target.
4162    ///
4163    /// # Arguments
4164    ///
4165    /// * `name` - Required. The name of the `Target` to delete. Format should be `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
4166    pub fn locations_targets_delete(&self, name: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
4167        ProjectLocationTargetDeleteCall {
4168            hub: self.hub,
4169            _name: name.to_string(),
4170            _validate_only: Default::default(),
4171            _request_id: Default::default(),
4172            _etag: Default::default(),
4173            _allow_missing: Default::default(),
4174            _delegate: Default::default(),
4175            _additional_params: Default::default(),
4176            _scopes: Default::default(),
4177        }
4178    }
4179
4180    /// Create a builder to help you perform the following task:
4181    ///
4182    /// Gets details of a single Target.
4183    ///
4184    /// # Arguments
4185    ///
4186    /// * `name` - Required. Name of the `Target`. Format must be `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
4187    pub fn locations_targets_get(&self, name: &str) -> ProjectLocationTargetGetCall<'a, C> {
4188        ProjectLocationTargetGetCall {
4189            hub: self.hub,
4190            _name: name.to_string(),
4191            _delegate: Default::default(),
4192            _additional_params: Default::default(),
4193            _scopes: Default::default(),
4194        }
4195    }
4196
4197    /// Create a builder to help you perform the following task:
4198    ///
4199    /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4200    ///
4201    /// # Arguments
4202    ///
4203    /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4204    pub fn locations_targets_get_iam_policy(
4205        &self,
4206        resource: &str,
4207    ) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
4208        ProjectLocationTargetGetIamPolicyCall {
4209            hub: self.hub,
4210            _resource: resource.to_string(),
4211            _options_requested_policy_version: Default::default(),
4212            _delegate: Default::default(),
4213            _additional_params: Default::default(),
4214            _scopes: Default::default(),
4215        }
4216    }
4217
4218    /// Create a builder to help you perform the following task:
4219    ///
4220    /// Lists Targets in a given project and location.
4221    ///
4222    /// # Arguments
4223    ///
4224    /// * `parent` - Required. The parent, which owns this collection of targets. Format must be `projects/{project_id}/locations/{location_name}`.
4225    pub fn locations_targets_list(&self, parent: &str) -> ProjectLocationTargetListCall<'a, C> {
4226        ProjectLocationTargetListCall {
4227            hub: self.hub,
4228            _parent: parent.to_string(),
4229            _page_token: Default::default(),
4230            _page_size: Default::default(),
4231            _order_by: Default::default(),
4232            _filter: Default::default(),
4233            _delegate: Default::default(),
4234            _additional_params: Default::default(),
4235            _scopes: Default::default(),
4236        }
4237    }
4238
4239    /// Create a builder to help you perform the following task:
4240    ///
4241    /// Updates the parameters of a single Target.
4242    ///
4243    /// # Arguments
4244    ///
4245    /// * `request` - No description provided.
4246    /// * `name` - Optional. Name of the `Target`. Format is `projects/{project}/locations/{location}/targets/{target}`. The `target` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
4247    pub fn locations_targets_patch(
4248        &self,
4249        request: Target,
4250        name: &str,
4251    ) -> ProjectLocationTargetPatchCall<'a, C> {
4252        ProjectLocationTargetPatchCall {
4253            hub: self.hub,
4254            _request: request,
4255            _name: name.to_string(),
4256            _validate_only: Default::default(),
4257            _update_mask: Default::default(),
4258            _request_id: Default::default(),
4259            _allow_missing: Default::default(),
4260            _delegate: Default::default(),
4261            _additional_params: Default::default(),
4262            _scopes: Default::default(),
4263        }
4264    }
4265
4266    /// Create a builder to help you perform the following task:
4267    ///
4268    /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4269    ///
4270    /// # Arguments
4271    ///
4272    /// * `request` - No description provided.
4273    /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4274    pub fn locations_targets_set_iam_policy(
4275        &self,
4276        request: SetIamPolicyRequest,
4277        resource: &str,
4278    ) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
4279        ProjectLocationTargetSetIamPolicyCall {
4280            hub: self.hub,
4281            _request: request,
4282            _resource: resource.to_string(),
4283            _delegate: Default::default(),
4284            _additional_params: Default::default(),
4285            _scopes: Default::default(),
4286        }
4287    }
4288
4289    /// Create a builder to help you perform the following task:
4290    ///
4291    /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
4292    ///
4293    /// # Arguments
4294    ///
4295    /// * `request` - No description provided.
4296    /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
4297    pub fn locations_targets_test_iam_permissions(
4298        &self,
4299        request: TestIamPermissionsRequest,
4300        resource: &str,
4301    ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
4302        ProjectLocationTargetTestIamPermissionCall {
4303            hub: self.hub,
4304            _request: request,
4305            _resource: resource.to_string(),
4306            _delegate: Default::default(),
4307            _additional_params: Default::default(),
4308            _scopes: Default::default(),
4309        }
4310    }
4311
4312    /// Create a builder to help you perform the following task:
4313    ///
4314    /// Gets information about a location.
4315    ///
4316    /// # Arguments
4317    ///
4318    /// * `name` - Resource name for the location.
4319    pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
4320        ProjectLocationGetCall {
4321            hub: self.hub,
4322            _name: name.to_string(),
4323            _delegate: Default::default(),
4324            _additional_params: Default::default(),
4325            _scopes: Default::default(),
4326        }
4327    }
4328
4329    /// Create a builder to help you perform the following task:
4330    ///
4331    /// Gets the configuration for a location.
4332    ///
4333    /// # Arguments
4334    ///
4335    /// * `name` - Required. Name of requested configuration.
4336    pub fn locations_get_config(&self, name: &str) -> ProjectLocationGetConfigCall<'a, C> {
4337        ProjectLocationGetConfigCall {
4338            hub: self.hub,
4339            _name: name.to_string(),
4340            _delegate: Default::default(),
4341            _additional_params: Default::default(),
4342            _scopes: Default::default(),
4343        }
4344    }
4345
4346    /// Create a builder to help you perform the following task:
4347    ///
4348    /// Lists information about the supported locations for this service.
4349    ///
4350    /// # Arguments
4351    ///
4352    /// * `name` - The resource that owns the locations collection, if applicable.
4353    pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
4354        ProjectLocationListCall {
4355            hub: self.hub,
4356            _name: name.to_string(),
4357            _page_token: Default::default(),
4358            _page_size: Default::default(),
4359            _filter: Default::default(),
4360            _delegate: Default::default(),
4361            _additional_params: Default::default(),
4362            _scopes: Default::default(),
4363        }
4364    }
4365}
4366
4367// ###################
4368// CallBuilders   ###
4369// #################
4370
4371/// Creates a new CustomTargetType in a given project and location.
4372///
4373/// A builder for the *locations.customTargetTypes.create* method supported by a *project* resource.
4374/// It is not used directly, but through a [`ProjectMethods`] instance.
4375///
4376/// # Example
4377///
4378/// Instantiate a resource method builder
4379///
4380/// ```test_harness,no_run
4381/// # extern crate hyper;
4382/// # extern crate hyper_rustls;
4383/// # extern crate google_clouddeploy1 as clouddeploy1;
4384/// use clouddeploy1::api::CustomTargetType;
4385/// # async fn dox() {
4386/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4387///
4388/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4390/// #     secret,
4391/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4392/// # ).build().await.unwrap();
4393///
4394/// # let client = hyper_util::client::legacy::Client::builder(
4395/// #     hyper_util::rt::TokioExecutor::new()
4396/// # )
4397/// # .build(
4398/// #     hyper_rustls::HttpsConnectorBuilder::new()
4399/// #         .with_native_roots()
4400/// #         .unwrap()
4401/// #         .https_or_http()
4402/// #         .enable_http1()
4403/// #         .build()
4404/// # );
4405/// # let mut hub = CloudDeploy::new(client, auth);
4406/// // As the method needs a request, you would usually fill it with the desired information
4407/// // into the respective structure. Some of the parts shown here might not be applicable !
4408/// // Values shown here are possibly random and not representative !
4409/// let mut req = CustomTargetType::default();
4410///
4411/// // You can configure optional parameters by calling the respective setters at will, and
4412/// // execute the final call using `doit()`.
4413/// // Values shown here are possibly random and not representative !
4414/// let result = hub.projects().locations_custom_target_types_create(req, "parent")
4415///              .validate_only(true)
4416///              .request_id("invidunt")
4417///              .custom_target_type_id("amet")
4418///              .doit().await;
4419/// # }
4420/// ```
4421pub struct ProjectLocationCustomTargetTypeCreateCall<'a, C>
4422where
4423    C: 'a,
4424{
4425    hub: &'a CloudDeploy<C>,
4426    _request: CustomTargetType,
4427    _parent: String,
4428    _validate_only: Option<bool>,
4429    _request_id: Option<String>,
4430    _custom_target_type_id: Option<String>,
4431    _delegate: Option<&'a mut dyn common::Delegate>,
4432    _additional_params: HashMap<String, String>,
4433    _scopes: BTreeSet<String>,
4434}
4435
4436impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeCreateCall<'a, C> {}
4437
4438impl<'a, C> ProjectLocationCustomTargetTypeCreateCall<'a, C>
4439where
4440    C: common::Connector,
4441{
4442    /// Perform the operation you have build so far.
4443    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4444        use std::borrow::Cow;
4445        use std::io::{Read, Seek};
4446
4447        use common::{url::Params, ToParts};
4448        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4449
4450        let mut dd = common::DefaultDelegate;
4451        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4452        dlg.begin(common::MethodInfo {
4453            id: "clouddeploy.projects.locations.customTargetTypes.create",
4454            http_method: hyper::Method::POST,
4455        });
4456
4457        for &field in [
4458            "alt",
4459            "parent",
4460            "validateOnly",
4461            "requestId",
4462            "customTargetTypeId",
4463        ]
4464        .iter()
4465        {
4466            if self._additional_params.contains_key(field) {
4467                dlg.finished(false);
4468                return Err(common::Error::FieldClash(field));
4469            }
4470        }
4471
4472        let mut params = Params::with_capacity(7 + self._additional_params.len());
4473        params.push("parent", self._parent);
4474        if let Some(value) = self._validate_only.as_ref() {
4475            params.push("validateOnly", value.to_string());
4476        }
4477        if let Some(value) = self._request_id.as_ref() {
4478            params.push("requestId", value);
4479        }
4480        if let Some(value) = self._custom_target_type_id.as_ref() {
4481            params.push("customTargetTypeId", value);
4482        }
4483
4484        params.extend(self._additional_params.iter());
4485
4486        params.push("alt", "json");
4487        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customTargetTypes";
4488        if self._scopes.is_empty() {
4489            self._scopes
4490                .insert(Scope::CloudPlatform.as_ref().to_string());
4491        }
4492
4493        #[allow(clippy::single_element_loop)]
4494        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4495            url = params.uri_replacement(url, param_name, find_this, true);
4496        }
4497        {
4498            let to_remove = ["parent"];
4499            params.remove_params(&to_remove);
4500        }
4501
4502        let url = params.parse_with_url(&url);
4503
4504        let mut json_mime_type = mime::APPLICATION_JSON;
4505        let mut request_value_reader = {
4506            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4507            common::remove_json_null_values(&mut value);
4508            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4509            serde_json::to_writer(&mut dst, &value).unwrap();
4510            dst
4511        };
4512        let request_size = request_value_reader
4513            .seek(std::io::SeekFrom::End(0))
4514            .unwrap();
4515        request_value_reader
4516            .seek(std::io::SeekFrom::Start(0))
4517            .unwrap();
4518
4519        loop {
4520            let token = match self
4521                .hub
4522                .auth
4523                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4524                .await
4525            {
4526                Ok(token) => token,
4527                Err(e) => match dlg.token(e) {
4528                    Ok(token) => token,
4529                    Err(e) => {
4530                        dlg.finished(false);
4531                        return Err(common::Error::MissingToken(e));
4532                    }
4533                },
4534            };
4535            request_value_reader
4536                .seek(std::io::SeekFrom::Start(0))
4537                .unwrap();
4538            let mut req_result = {
4539                let client = &self.hub.client;
4540                dlg.pre_request();
4541                let mut req_builder = hyper::Request::builder()
4542                    .method(hyper::Method::POST)
4543                    .uri(url.as_str())
4544                    .header(USER_AGENT, self.hub._user_agent.clone());
4545
4546                if let Some(token) = token.as_ref() {
4547                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4548                }
4549
4550                let request = req_builder
4551                    .header(CONTENT_TYPE, json_mime_type.to_string())
4552                    .header(CONTENT_LENGTH, request_size as u64)
4553                    .body(common::to_body(
4554                        request_value_reader.get_ref().clone().into(),
4555                    ));
4556
4557                client.request(request.unwrap()).await
4558            };
4559
4560            match req_result {
4561                Err(err) => {
4562                    if let common::Retry::After(d) = dlg.http_error(&err) {
4563                        sleep(d).await;
4564                        continue;
4565                    }
4566                    dlg.finished(false);
4567                    return Err(common::Error::HttpError(err));
4568                }
4569                Ok(res) => {
4570                    let (mut parts, body) = res.into_parts();
4571                    let mut body = common::Body::new(body);
4572                    if !parts.status.is_success() {
4573                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4574                        let error = serde_json::from_str(&common::to_string(&bytes));
4575                        let response = common::to_response(parts, bytes.into());
4576
4577                        if let common::Retry::After(d) =
4578                            dlg.http_failure(&response, error.as_ref().ok())
4579                        {
4580                            sleep(d).await;
4581                            continue;
4582                        }
4583
4584                        dlg.finished(false);
4585
4586                        return Err(match error {
4587                            Ok(value) => common::Error::BadRequest(value),
4588                            _ => common::Error::Failure(response),
4589                        });
4590                    }
4591                    let response = {
4592                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4593                        let encoded = common::to_string(&bytes);
4594                        match serde_json::from_str(&encoded) {
4595                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4596                            Err(error) => {
4597                                dlg.response_json_decode_error(&encoded, &error);
4598                                return Err(common::Error::JsonDecodeError(
4599                                    encoded.to_string(),
4600                                    error,
4601                                ));
4602                            }
4603                        }
4604                    };
4605
4606                    dlg.finished(true);
4607                    return Ok(response);
4608                }
4609            }
4610        }
4611    }
4612
4613    ///
4614    /// Sets the *request* property to the given value.
4615    ///
4616    /// Even though the property as already been set when instantiating this call,
4617    /// we provide this method for API completeness.
4618    pub fn request(
4619        mut self,
4620        new_value: CustomTargetType,
4621    ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
4622        self._request = new_value;
4623        self
4624    }
4625    /// Required. The parent collection in which the `CustomTargetType` should be created. Format should be `projects/{project_id}/locations/{location_name}`.
4626    ///
4627    /// Sets the *parent* path property to the given value.
4628    ///
4629    /// Even though the property as already been set when instantiating this call,
4630    /// we provide this method for API completeness.
4631    pub fn parent(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
4632        self._parent = new_value.to_string();
4633        self
4634    }
4635    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
4636    ///
4637    /// Sets the *validate only* query property to the given value.
4638    pub fn validate_only(
4639        mut self,
4640        new_value: bool,
4641    ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
4642        self._validate_only = Some(new_value);
4643        self
4644    }
4645    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
4646    ///
4647    /// Sets the *request id* query property to the given value.
4648    pub fn request_id(
4649        mut self,
4650        new_value: &str,
4651    ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
4652        self._request_id = Some(new_value.to_string());
4653        self
4654    }
4655    /// Required. ID of the `CustomTargetType`.
4656    ///
4657    /// Sets the *custom target type id* query property to the given value.
4658    pub fn custom_target_type_id(
4659        mut self,
4660        new_value: &str,
4661    ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
4662        self._custom_target_type_id = Some(new_value.to_string());
4663        self
4664    }
4665    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4666    /// while executing the actual API request.
4667    ///
4668    /// ````text
4669    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4670    /// ````
4671    ///
4672    /// Sets the *delegate* property to the given value.
4673    pub fn delegate(
4674        mut self,
4675        new_value: &'a mut dyn common::Delegate,
4676    ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
4677        self._delegate = Some(new_value);
4678        self
4679    }
4680
4681    /// Set any additional parameter of the query string used in the request.
4682    /// It should be used to set parameters which are not yet available through their own
4683    /// setters.
4684    ///
4685    /// Please note that this method must not be used to set any of the known parameters
4686    /// which have their own setter method. If done anyway, the request will fail.
4687    ///
4688    /// # Additional Parameters
4689    ///
4690    /// * *$.xgafv* (query-string) - V1 error format.
4691    /// * *access_token* (query-string) - OAuth access token.
4692    /// * *alt* (query-string) - Data format for response.
4693    /// * *callback* (query-string) - JSONP
4694    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4695    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
4696    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4697    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4698    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
4699    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4700    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4701    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeCreateCall<'a, C>
4702    where
4703        T: AsRef<str>,
4704    {
4705        self._additional_params
4706            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4707        self
4708    }
4709
4710    /// Identifies the authorization scope for the method you are building.
4711    ///
4712    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4713    /// [`Scope::CloudPlatform`].
4714    ///
4715    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4716    /// tokens for more than one scope.
4717    ///
4718    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4719    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4720    /// sufficient, a read-write scope will do as well.
4721    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeCreateCall<'a, C>
4722    where
4723        St: AsRef<str>,
4724    {
4725        self._scopes.insert(String::from(scope.as_ref()));
4726        self
4727    }
4728    /// Identifies the authorization scope(s) for the method you are building.
4729    ///
4730    /// See [`Self::add_scope()`] for details.
4731    pub fn add_scopes<I, St>(
4732        mut self,
4733        scopes: I,
4734    ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C>
4735    where
4736        I: IntoIterator<Item = St>,
4737        St: AsRef<str>,
4738    {
4739        self._scopes
4740            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4741        self
4742    }
4743
4744    /// Removes all scopes, and no default scope will be used either.
4745    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4746    /// for details).
4747    pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
4748        self._scopes.clear();
4749        self
4750    }
4751}
4752
4753/// Deletes a single CustomTargetType.
4754///
4755/// A builder for the *locations.customTargetTypes.delete* method supported by a *project* resource.
4756/// It is not used directly, but through a [`ProjectMethods`] instance.
4757///
4758/// # Example
4759///
4760/// Instantiate a resource method builder
4761///
4762/// ```test_harness,no_run
4763/// # extern crate hyper;
4764/// # extern crate hyper_rustls;
4765/// # extern crate google_clouddeploy1 as clouddeploy1;
4766/// # async fn dox() {
4767/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4768///
4769/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4770/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4771/// #     secret,
4772/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4773/// # ).build().await.unwrap();
4774///
4775/// # let client = hyper_util::client::legacy::Client::builder(
4776/// #     hyper_util::rt::TokioExecutor::new()
4777/// # )
4778/// # .build(
4779/// #     hyper_rustls::HttpsConnectorBuilder::new()
4780/// #         .with_native_roots()
4781/// #         .unwrap()
4782/// #         .https_or_http()
4783/// #         .enable_http1()
4784/// #         .build()
4785/// # );
4786/// # let mut hub = CloudDeploy::new(client, auth);
4787/// // You can configure optional parameters by calling the respective setters at will, and
4788/// // execute the final call using `doit()`.
4789/// // Values shown here are possibly random and not representative !
4790/// let result = hub.projects().locations_custom_target_types_delete("name")
4791///              .validate_only(true)
4792///              .request_id("sed")
4793///              .etag("ut")
4794///              .allow_missing(true)
4795///              .doit().await;
4796/// # }
4797/// ```
4798pub struct ProjectLocationCustomTargetTypeDeleteCall<'a, C>
4799where
4800    C: 'a,
4801{
4802    hub: &'a CloudDeploy<C>,
4803    _name: String,
4804    _validate_only: Option<bool>,
4805    _request_id: Option<String>,
4806    _etag: Option<String>,
4807    _allow_missing: Option<bool>,
4808    _delegate: Option<&'a mut dyn common::Delegate>,
4809    _additional_params: HashMap<String, String>,
4810    _scopes: BTreeSet<String>,
4811}
4812
4813impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeDeleteCall<'a, C> {}
4814
4815impl<'a, C> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
4816where
4817    C: common::Connector,
4818{
4819    /// Perform the operation you have build so far.
4820    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
4821        use std::borrow::Cow;
4822        use std::io::{Read, Seek};
4823
4824        use common::{url::Params, ToParts};
4825        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4826
4827        let mut dd = common::DefaultDelegate;
4828        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4829        dlg.begin(common::MethodInfo {
4830            id: "clouddeploy.projects.locations.customTargetTypes.delete",
4831            http_method: hyper::Method::DELETE,
4832        });
4833
4834        for &field in [
4835            "alt",
4836            "name",
4837            "validateOnly",
4838            "requestId",
4839            "etag",
4840            "allowMissing",
4841        ]
4842        .iter()
4843        {
4844            if self._additional_params.contains_key(field) {
4845                dlg.finished(false);
4846                return Err(common::Error::FieldClash(field));
4847            }
4848        }
4849
4850        let mut params = Params::with_capacity(7 + self._additional_params.len());
4851        params.push("name", self._name);
4852        if let Some(value) = self._validate_only.as_ref() {
4853            params.push("validateOnly", value.to_string());
4854        }
4855        if let Some(value) = self._request_id.as_ref() {
4856            params.push("requestId", value);
4857        }
4858        if let Some(value) = self._etag.as_ref() {
4859            params.push("etag", value);
4860        }
4861        if let Some(value) = self._allow_missing.as_ref() {
4862            params.push("allowMissing", value.to_string());
4863        }
4864
4865        params.extend(self._additional_params.iter());
4866
4867        params.push("alt", "json");
4868        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4869        if self._scopes.is_empty() {
4870            self._scopes
4871                .insert(Scope::CloudPlatform.as_ref().to_string());
4872        }
4873
4874        #[allow(clippy::single_element_loop)]
4875        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4876            url = params.uri_replacement(url, param_name, find_this, true);
4877        }
4878        {
4879            let to_remove = ["name"];
4880            params.remove_params(&to_remove);
4881        }
4882
4883        let url = params.parse_with_url(&url);
4884
4885        loop {
4886            let token = match self
4887                .hub
4888                .auth
4889                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4890                .await
4891            {
4892                Ok(token) => token,
4893                Err(e) => match dlg.token(e) {
4894                    Ok(token) => token,
4895                    Err(e) => {
4896                        dlg.finished(false);
4897                        return Err(common::Error::MissingToken(e));
4898                    }
4899                },
4900            };
4901            let mut req_result = {
4902                let client = &self.hub.client;
4903                dlg.pre_request();
4904                let mut req_builder = hyper::Request::builder()
4905                    .method(hyper::Method::DELETE)
4906                    .uri(url.as_str())
4907                    .header(USER_AGENT, self.hub._user_agent.clone());
4908
4909                if let Some(token) = token.as_ref() {
4910                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4911                }
4912
4913                let request = req_builder
4914                    .header(CONTENT_LENGTH, 0_u64)
4915                    .body(common::to_body::<String>(None));
4916
4917                client.request(request.unwrap()).await
4918            };
4919
4920            match req_result {
4921                Err(err) => {
4922                    if let common::Retry::After(d) = dlg.http_error(&err) {
4923                        sleep(d).await;
4924                        continue;
4925                    }
4926                    dlg.finished(false);
4927                    return Err(common::Error::HttpError(err));
4928                }
4929                Ok(res) => {
4930                    let (mut parts, body) = res.into_parts();
4931                    let mut body = common::Body::new(body);
4932                    if !parts.status.is_success() {
4933                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4934                        let error = serde_json::from_str(&common::to_string(&bytes));
4935                        let response = common::to_response(parts, bytes.into());
4936
4937                        if let common::Retry::After(d) =
4938                            dlg.http_failure(&response, error.as_ref().ok())
4939                        {
4940                            sleep(d).await;
4941                            continue;
4942                        }
4943
4944                        dlg.finished(false);
4945
4946                        return Err(match error {
4947                            Ok(value) => common::Error::BadRequest(value),
4948                            _ => common::Error::Failure(response),
4949                        });
4950                    }
4951                    let response = {
4952                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4953                        let encoded = common::to_string(&bytes);
4954                        match serde_json::from_str(&encoded) {
4955                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4956                            Err(error) => {
4957                                dlg.response_json_decode_error(&encoded, &error);
4958                                return Err(common::Error::JsonDecodeError(
4959                                    encoded.to_string(),
4960                                    error,
4961                                ));
4962                            }
4963                        }
4964                    };
4965
4966                    dlg.finished(true);
4967                    return Ok(response);
4968                }
4969            }
4970        }
4971    }
4972
4973    /// Required. The name of the `CustomTargetType` to delete. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
4974    ///
4975    /// Sets the *name* path property to the given value.
4976    ///
4977    /// Even though the property as already been set when instantiating this call,
4978    /// we provide this method for API completeness.
4979    pub fn name(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
4980        self._name = new_value.to_string();
4981        self
4982    }
4983    /// Optional. If set to true, the request is validated but no actual change is made.
4984    ///
4985    /// Sets the *validate only* query property to the given value.
4986    pub fn validate_only(
4987        mut self,
4988        new_value: bool,
4989    ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
4990        self._validate_only = Some(new_value);
4991        self
4992    }
4993    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
4994    ///
4995    /// Sets the *request id* query property to the given value.
4996    pub fn request_id(
4997        mut self,
4998        new_value: &str,
4999    ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5000        self._request_id = Some(new_value.to_string());
5001        self
5002    }
5003    /// Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
5004    ///
5005    /// Sets the *etag* query property to the given value.
5006    pub fn etag(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5007        self._etag = Some(new_value.to_string());
5008        self
5009    }
5010    /// Optional. If set to true, then deleting an already deleted or non-existing `CustomTargetType` will succeed.
5011    ///
5012    /// Sets the *allow missing* query property to the given value.
5013    pub fn allow_missing(
5014        mut self,
5015        new_value: bool,
5016    ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5017        self._allow_missing = Some(new_value);
5018        self
5019    }
5020    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5021    /// while executing the actual API request.
5022    ///
5023    /// ````text
5024    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5025    /// ````
5026    ///
5027    /// Sets the *delegate* property to the given value.
5028    pub fn delegate(
5029        mut self,
5030        new_value: &'a mut dyn common::Delegate,
5031    ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5032        self._delegate = Some(new_value);
5033        self
5034    }
5035
5036    /// Set any additional parameter of the query string used in the request.
5037    /// It should be used to set parameters which are not yet available through their own
5038    /// setters.
5039    ///
5040    /// Please note that this method must not be used to set any of the known parameters
5041    /// which have their own setter method. If done anyway, the request will fail.
5042    ///
5043    /// # Additional Parameters
5044    ///
5045    /// * *$.xgafv* (query-string) - V1 error format.
5046    /// * *access_token* (query-string) - OAuth access token.
5047    /// * *alt* (query-string) - Data format for response.
5048    /// * *callback* (query-string) - JSONP
5049    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5050    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5051    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5052    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5053    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5054    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5055    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5056    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5057    where
5058        T: AsRef<str>,
5059    {
5060        self._additional_params
5061            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5062        self
5063    }
5064
5065    /// Identifies the authorization scope for the method you are building.
5066    ///
5067    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5068    /// [`Scope::CloudPlatform`].
5069    ///
5070    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5071    /// tokens for more than one scope.
5072    ///
5073    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5074    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5075    /// sufficient, a read-write scope will do as well.
5076    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5077    where
5078        St: AsRef<str>,
5079    {
5080        self._scopes.insert(String::from(scope.as_ref()));
5081        self
5082    }
5083    /// Identifies the authorization scope(s) for the method you are building.
5084    ///
5085    /// See [`Self::add_scope()`] for details.
5086    pub fn add_scopes<I, St>(
5087        mut self,
5088        scopes: I,
5089    ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5090    where
5091        I: IntoIterator<Item = St>,
5092        St: AsRef<str>,
5093    {
5094        self._scopes
5095            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5096        self
5097    }
5098
5099    /// Removes all scopes, and no default scope will be used either.
5100    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5101    /// for details).
5102    pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5103        self._scopes.clear();
5104        self
5105    }
5106}
5107
5108/// Gets details of a single CustomTargetType.
5109///
5110/// A builder for the *locations.customTargetTypes.get* method supported by a *project* resource.
5111/// It is not used directly, but through a [`ProjectMethods`] instance.
5112///
5113/// # Example
5114///
5115/// Instantiate a resource method builder
5116///
5117/// ```test_harness,no_run
5118/// # extern crate hyper;
5119/// # extern crate hyper_rustls;
5120/// # extern crate google_clouddeploy1 as clouddeploy1;
5121/// # async fn dox() {
5122/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5123///
5124/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5126/// #     secret,
5127/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5128/// # ).build().await.unwrap();
5129///
5130/// # let client = hyper_util::client::legacy::Client::builder(
5131/// #     hyper_util::rt::TokioExecutor::new()
5132/// # )
5133/// # .build(
5134/// #     hyper_rustls::HttpsConnectorBuilder::new()
5135/// #         .with_native_roots()
5136/// #         .unwrap()
5137/// #         .https_or_http()
5138/// #         .enable_http1()
5139/// #         .build()
5140/// # );
5141/// # let mut hub = CloudDeploy::new(client, auth);
5142/// // You can configure optional parameters by calling the respective setters at will, and
5143/// // execute the final call using `doit()`.
5144/// // Values shown here are possibly random and not representative !
5145/// let result = hub.projects().locations_custom_target_types_get("name")
5146///              .doit().await;
5147/// # }
5148/// ```
5149pub struct ProjectLocationCustomTargetTypeGetCall<'a, C>
5150where
5151    C: 'a,
5152{
5153    hub: &'a CloudDeploy<C>,
5154    _name: String,
5155    _delegate: Option<&'a mut dyn common::Delegate>,
5156    _additional_params: HashMap<String, String>,
5157    _scopes: BTreeSet<String>,
5158}
5159
5160impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeGetCall<'a, C> {}
5161
5162impl<'a, C> ProjectLocationCustomTargetTypeGetCall<'a, C>
5163where
5164    C: common::Connector,
5165{
5166    /// Perform the operation you have build so far.
5167    pub async fn doit(mut self) -> common::Result<(common::Response, CustomTargetType)> {
5168        use std::borrow::Cow;
5169        use std::io::{Read, Seek};
5170
5171        use common::{url::Params, ToParts};
5172        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5173
5174        let mut dd = common::DefaultDelegate;
5175        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5176        dlg.begin(common::MethodInfo {
5177            id: "clouddeploy.projects.locations.customTargetTypes.get",
5178            http_method: hyper::Method::GET,
5179        });
5180
5181        for &field in ["alt", "name"].iter() {
5182            if self._additional_params.contains_key(field) {
5183                dlg.finished(false);
5184                return Err(common::Error::FieldClash(field));
5185            }
5186        }
5187
5188        let mut params = Params::with_capacity(3 + self._additional_params.len());
5189        params.push("name", self._name);
5190
5191        params.extend(self._additional_params.iter());
5192
5193        params.push("alt", "json");
5194        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5195        if self._scopes.is_empty() {
5196            self._scopes
5197                .insert(Scope::CloudPlatform.as_ref().to_string());
5198        }
5199
5200        #[allow(clippy::single_element_loop)]
5201        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5202            url = params.uri_replacement(url, param_name, find_this, true);
5203        }
5204        {
5205            let to_remove = ["name"];
5206            params.remove_params(&to_remove);
5207        }
5208
5209        let url = params.parse_with_url(&url);
5210
5211        loop {
5212            let token = match self
5213                .hub
5214                .auth
5215                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5216                .await
5217            {
5218                Ok(token) => token,
5219                Err(e) => match dlg.token(e) {
5220                    Ok(token) => token,
5221                    Err(e) => {
5222                        dlg.finished(false);
5223                        return Err(common::Error::MissingToken(e));
5224                    }
5225                },
5226            };
5227            let mut req_result = {
5228                let client = &self.hub.client;
5229                dlg.pre_request();
5230                let mut req_builder = hyper::Request::builder()
5231                    .method(hyper::Method::GET)
5232                    .uri(url.as_str())
5233                    .header(USER_AGENT, self.hub._user_agent.clone());
5234
5235                if let Some(token) = token.as_ref() {
5236                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5237                }
5238
5239                let request = req_builder
5240                    .header(CONTENT_LENGTH, 0_u64)
5241                    .body(common::to_body::<String>(None));
5242
5243                client.request(request.unwrap()).await
5244            };
5245
5246            match req_result {
5247                Err(err) => {
5248                    if let common::Retry::After(d) = dlg.http_error(&err) {
5249                        sleep(d).await;
5250                        continue;
5251                    }
5252                    dlg.finished(false);
5253                    return Err(common::Error::HttpError(err));
5254                }
5255                Ok(res) => {
5256                    let (mut parts, body) = res.into_parts();
5257                    let mut body = common::Body::new(body);
5258                    if !parts.status.is_success() {
5259                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5260                        let error = serde_json::from_str(&common::to_string(&bytes));
5261                        let response = common::to_response(parts, bytes.into());
5262
5263                        if let common::Retry::After(d) =
5264                            dlg.http_failure(&response, error.as_ref().ok())
5265                        {
5266                            sleep(d).await;
5267                            continue;
5268                        }
5269
5270                        dlg.finished(false);
5271
5272                        return Err(match error {
5273                            Ok(value) => common::Error::BadRequest(value),
5274                            _ => common::Error::Failure(response),
5275                        });
5276                    }
5277                    let response = {
5278                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5279                        let encoded = common::to_string(&bytes);
5280                        match serde_json::from_str(&encoded) {
5281                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5282                            Err(error) => {
5283                                dlg.response_json_decode_error(&encoded, &error);
5284                                return Err(common::Error::JsonDecodeError(
5285                                    encoded.to_string(),
5286                                    error,
5287                                ));
5288                            }
5289                        }
5290                    };
5291
5292                    dlg.finished(true);
5293                    return Ok(response);
5294                }
5295            }
5296        }
5297    }
5298
5299    /// Required. Name of the `CustomTargetType`. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
5300    ///
5301    /// Sets the *name* path property to the given value.
5302    ///
5303    /// Even though the property as already been set when instantiating this call,
5304    /// we provide this method for API completeness.
5305    pub fn name(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
5306        self._name = new_value.to_string();
5307        self
5308    }
5309    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5310    /// while executing the actual API request.
5311    ///
5312    /// ````text
5313    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5314    /// ````
5315    ///
5316    /// Sets the *delegate* property to the given value.
5317    pub fn delegate(
5318        mut self,
5319        new_value: &'a mut dyn common::Delegate,
5320    ) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
5321        self._delegate = Some(new_value);
5322        self
5323    }
5324
5325    /// Set any additional parameter of the query string used in the request.
5326    /// It should be used to set parameters which are not yet available through their own
5327    /// setters.
5328    ///
5329    /// Please note that this method must not be used to set any of the known parameters
5330    /// which have their own setter method. If done anyway, the request will fail.
5331    ///
5332    /// # Additional Parameters
5333    ///
5334    /// * *$.xgafv* (query-string) - V1 error format.
5335    /// * *access_token* (query-string) - OAuth access token.
5336    /// * *alt* (query-string) - Data format for response.
5337    /// * *callback* (query-string) - JSONP
5338    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5339    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5340    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5341    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5342    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5343    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5344    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5345    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeGetCall<'a, C>
5346    where
5347        T: AsRef<str>,
5348    {
5349        self._additional_params
5350            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5351        self
5352    }
5353
5354    /// Identifies the authorization scope for the method you are building.
5355    ///
5356    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5357    /// [`Scope::CloudPlatform`].
5358    ///
5359    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5360    /// tokens for more than one scope.
5361    ///
5362    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5363    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5364    /// sufficient, a read-write scope will do as well.
5365    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeGetCall<'a, C>
5366    where
5367        St: AsRef<str>,
5368    {
5369        self._scopes.insert(String::from(scope.as_ref()));
5370        self
5371    }
5372    /// Identifies the authorization scope(s) for the method you are building.
5373    ///
5374    /// See [`Self::add_scope()`] for details.
5375    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCustomTargetTypeGetCall<'a, C>
5376    where
5377        I: IntoIterator<Item = St>,
5378        St: AsRef<str>,
5379    {
5380        self._scopes
5381            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5382        self
5383    }
5384
5385    /// Removes all scopes, and no default scope will be used either.
5386    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5387    /// for details).
5388    pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
5389        self._scopes.clear();
5390        self
5391    }
5392}
5393
5394/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
5395///
5396/// A builder for the *locations.customTargetTypes.getIamPolicy* method supported by a *project* resource.
5397/// It is not used directly, but through a [`ProjectMethods`] instance.
5398///
5399/// # Example
5400///
5401/// Instantiate a resource method builder
5402///
5403/// ```test_harness,no_run
5404/// # extern crate hyper;
5405/// # extern crate hyper_rustls;
5406/// # extern crate google_clouddeploy1 as clouddeploy1;
5407/// # async fn dox() {
5408/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5409///
5410/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5411/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5412/// #     secret,
5413/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5414/// # ).build().await.unwrap();
5415///
5416/// # let client = hyper_util::client::legacy::Client::builder(
5417/// #     hyper_util::rt::TokioExecutor::new()
5418/// # )
5419/// # .build(
5420/// #     hyper_rustls::HttpsConnectorBuilder::new()
5421/// #         .with_native_roots()
5422/// #         .unwrap()
5423/// #         .https_or_http()
5424/// #         .enable_http1()
5425/// #         .build()
5426/// # );
5427/// # let mut hub = CloudDeploy::new(client, auth);
5428/// // You can configure optional parameters by calling the respective setters at will, and
5429/// // execute the final call using `doit()`.
5430/// // Values shown here are possibly random and not representative !
5431/// let result = hub.projects().locations_custom_target_types_get_iam_policy("resource")
5432///              .options_requested_policy_version(-7)
5433///              .doit().await;
5434/// # }
5435/// ```
5436pub struct ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
5437where
5438    C: 'a,
5439{
5440    hub: &'a CloudDeploy<C>,
5441    _resource: String,
5442    _options_requested_policy_version: Option<i32>,
5443    _delegate: Option<&'a mut dyn common::Delegate>,
5444    _additional_params: HashMap<String, String>,
5445    _scopes: BTreeSet<String>,
5446}
5447
5448impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {}
5449
5450impl<'a, C> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
5451where
5452    C: common::Connector,
5453{
5454    /// Perform the operation you have build so far.
5455    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
5456        use std::borrow::Cow;
5457        use std::io::{Read, Seek};
5458
5459        use common::{url::Params, ToParts};
5460        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5461
5462        let mut dd = common::DefaultDelegate;
5463        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5464        dlg.begin(common::MethodInfo {
5465            id: "clouddeploy.projects.locations.customTargetTypes.getIamPolicy",
5466            http_method: hyper::Method::GET,
5467        });
5468
5469        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
5470            if self._additional_params.contains_key(field) {
5471                dlg.finished(false);
5472                return Err(common::Error::FieldClash(field));
5473            }
5474        }
5475
5476        let mut params = Params::with_capacity(4 + self._additional_params.len());
5477        params.push("resource", self._resource);
5478        if let Some(value) = self._options_requested_policy_version.as_ref() {
5479            params.push("options.requestedPolicyVersion", value.to_string());
5480        }
5481
5482        params.extend(self._additional_params.iter());
5483
5484        params.push("alt", "json");
5485        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
5486        if self._scopes.is_empty() {
5487            self._scopes
5488                .insert(Scope::CloudPlatform.as_ref().to_string());
5489        }
5490
5491        #[allow(clippy::single_element_loop)]
5492        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
5493            url = params.uri_replacement(url, param_name, find_this, true);
5494        }
5495        {
5496            let to_remove = ["resource"];
5497            params.remove_params(&to_remove);
5498        }
5499
5500        let url = params.parse_with_url(&url);
5501
5502        loop {
5503            let token = match self
5504                .hub
5505                .auth
5506                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5507                .await
5508            {
5509                Ok(token) => token,
5510                Err(e) => match dlg.token(e) {
5511                    Ok(token) => token,
5512                    Err(e) => {
5513                        dlg.finished(false);
5514                        return Err(common::Error::MissingToken(e));
5515                    }
5516                },
5517            };
5518            let mut req_result = {
5519                let client = &self.hub.client;
5520                dlg.pre_request();
5521                let mut req_builder = hyper::Request::builder()
5522                    .method(hyper::Method::GET)
5523                    .uri(url.as_str())
5524                    .header(USER_AGENT, self.hub._user_agent.clone());
5525
5526                if let Some(token) = token.as_ref() {
5527                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5528                }
5529
5530                let request = req_builder
5531                    .header(CONTENT_LENGTH, 0_u64)
5532                    .body(common::to_body::<String>(None));
5533
5534                client.request(request.unwrap()).await
5535            };
5536
5537            match req_result {
5538                Err(err) => {
5539                    if let common::Retry::After(d) = dlg.http_error(&err) {
5540                        sleep(d).await;
5541                        continue;
5542                    }
5543                    dlg.finished(false);
5544                    return Err(common::Error::HttpError(err));
5545                }
5546                Ok(res) => {
5547                    let (mut parts, body) = res.into_parts();
5548                    let mut body = common::Body::new(body);
5549                    if !parts.status.is_success() {
5550                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5551                        let error = serde_json::from_str(&common::to_string(&bytes));
5552                        let response = common::to_response(parts, bytes.into());
5553
5554                        if let common::Retry::After(d) =
5555                            dlg.http_failure(&response, error.as_ref().ok())
5556                        {
5557                            sleep(d).await;
5558                            continue;
5559                        }
5560
5561                        dlg.finished(false);
5562
5563                        return Err(match error {
5564                            Ok(value) => common::Error::BadRequest(value),
5565                            _ => common::Error::Failure(response),
5566                        });
5567                    }
5568                    let response = {
5569                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5570                        let encoded = common::to_string(&bytes);
5571                        match serde_json::from_str(&encoded) {
5572                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5573                            Err(error) => {
5574                                dlg.response_json_decode_error(&encoded, &error);
5575                                return Err(common::Error::JsonDecodeError(
5576                                    encoded.to_string(),
5577                                    error,
5578                                ));
5579                            }
5580                        }
5581                    };
5582
5583                    dlg.finished(true);
5584                    return Ok(response);
5585                }
5586            }
5587        }
5588    }
5589
5590    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
5591    ///
5592    /// Sets the *resource* path property to the given value.
5593    ///
5594    /// Even though the property as already been set when instantiating this call,
5595    /// we provide this method for API completeness.
5596    pub fn resource(
5597        mut self,
5598        new_value: &str,
5599    ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
5600        self._resource = new_value.to_string();
5601        self
5602    }
5603    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
5604    ///
5605    /// Sets the *options.requested policy version* query property to the given value.
5606    pub fn options_requested_policy_version(
5607        mut self,
5608        new_value: i32,
5609    ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
5610        self._options_requested_policy_version = Some(new_value);
5611        self
5612    }
5613    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5614    /// while executing the actual API request.
5615    ///
5616    /// ````text
5617    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5618    /// ````
5619    ///
5620    /// Sets the *delegate* property to the given value.
5621    pub fn delegate(
5622        mut self,
5623        new_value: &'a mut dyn common::Delegate,
5624    ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
5625        self._delegate = Some(new_value);
5626        self
5627    }
5628
5629    /// Set any additional parameter of the query string used in the request.
5630    /// It should be used to set parameters which are not yet available through their own
5631    /// setters.
5632    ///
5633    /// Please note that this method must not be used to set any of the known parameters
5634    /// which have their own setter method. If done anyway, the request will fail.
5635    ///
5636    /// # Additional Parameters
5637    ///
5638    /// * *$.xgafv* (query-string) - V1 error format.
5639    /// * *access_token* (query-string) - OAuth access token.
5640    /// * *alt* (query-string) - Data format for response.
5641    /// * *callback* (query-string) - JSONP
5642    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5643    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5644    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5645    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5646    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
5647    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5648    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5649    pub fn param<T>(
5650        mut self,
5651        name: T,
5652        value: T,
5653    ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
5654    where
5655        T: AsRef<str>,
5656    {
5657        self._additional_params
5658            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5659        self
5660    }
5661
5662    /// Identifies the authorization scope for the method you are building.
5663    ///
5664    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5665    /// [`Scope::CloudPlatform`].
5666    ///
5667    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5668    /// tokens for more than one scope.
5669    ///
5670    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5671    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5672    /// sufficient, a read-write scope will do as well.
5673    pub fn add_scope<St>(
5674        mut self,
5675        scope: St,
5676    ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
5677    where
5678        St: AsRef<str>,
5679    {
5680        self._scopes.insert(String::from(scope.as_ref()));
5681        self
5682    }
5683    /// Identifies the authorization scope(s) for the method you are building.
5684    ///
5685    /// See [`Self::add_scope()`] for details.
5686    pub fn add_scopes<I, St>(
5687        mut self,
5688        scopes: I,
5689    ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
5690    where
5691        I: IntoIterator<Item = St>,
5692        St: AsRef<str>,
5693    {
5694        self._scopes
5695            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5696        self
5697    }
5698
5699    /// Removes all scopes, and no default scope will be used either.
5700    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5701    /// for details).
5702    pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
5703        self._scopes.clear();
5704        self
5705    }
5706}
5707
5708/// Lists CustomTargetTypes in a given project and location.
5709///
5710/// A builder for the *locations.customTargetTypes.list* method supported by a *project* resource.
5711/// It is not used directly, but through a [`ProjectMethods`] instance.
5712///
5713/// # Example
5714///
5715/// Instantiate a resource method builder
5716///
5717/// ```test_harness,no_run
5718/// # extern crate hyper;
5719/// # extern crate hyper_rustls;
5720/// # extern crate google_clouddeploy1 as clouddeploy1;
5721/// # async fn dox() {
5722/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5723///
5724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5726/// #     secret,
5727/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5728/// # ).build().await.unwrap();
5729///
5730/// # let client = hyper_util::client::legacy::Client::builder(
5731/// #     hyper_util::rt::TokioExecutor::new()
5732/// # )
5733/// # .build(
5734/// #     hyper_rustls::HttpsConnectorBuilder::new()
5735/// #         .with_native_roots()
5736/// #         .unwrap()
5737/// #         .https_or_http()
5738/// #         .enable_http1()
5739/// #         .build()
5740/// # );
5741/// # let mut hub = CloudDeploy::new(client, auth);
5742/// // You can configure optional parameters by calling the respective setters at will, and
5743/// // execute the final call using `doit()`.
5744/// // Values shown here are possibly random and not representative !
5745/// let result = hub.projects().locations_custom_target_types_list("parent")
5746///              .page_token("ea")
5747///              .page_size(-99)
5748///              .order_by("Lorem")
5749///              .filter("eos")
5750///              .doit().await;
5751/// # }
5752/// ```
5753pub struct ProjectLocationCustomTargetTypeListCall<'a, C>
5754where
5755    C: 'a,
5756{
5757    hub: &'a CloudDeploy<C>,
5758    _parent: String,
5759    _page_token: Option<String>,
5760    _page_size: Option<i32>,
5761    _order_by: Option<String>,
5762    _filter: Option<String>,
5763    _delegate: Option<&'a mut dyn common::Delegate>,
5764    _additional_params: HashMap<String, String>,
5765    _scopes: BTreeSet<String>,
5766}
5767
5768impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeListCall<'a, C> {}
5769
5770impl<'a, C> ProjectLocationCustomTargetTypeListCall<'a, C>
5771where
5772    C: common::Connector,
5773{
5774    /// Perform the operation you have build so far.
5775    pub async fn doit(
5776        mut self,
5777    ) -> common::Result<(common::Response, ListCustomTargetTypesResponse)> {
5778        use std::borrow::Cow;
5779        use std::io::{Read, Seek};
5780
5781        use common::{url::Params, ToParts};
5782        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5783
5784        let mut dd = common::DefaultDelegate;
5785        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5786        dlg.begin(common::MethodInfo {
5787            id: "clouddeploy.projects.locations.customTargetTypes.list",
5788            http_method: hyper::Method::GET,
5789        });
5790
5791        for &field in [
5792            "alt",
5793            "parent",
5794            "pageToken",
5795            "pageSize",
5796            "orderBy",
5797            "filter",
5798        ]
5799        .iter()
5800        {
5801            if self._additional_params.contains_key(field) {
5802                dlg.finished(false);
5803                return Err(common::Error::FieldClash(field));
5804            }
5805        }
5806
5807        let mut params = Params::with_capacity(7 + self._additional_params.len());
5808        params.push("parent", self._parent);
5809        if let Some(value) = self._page_token.as_ref() {
5810            params.push("pageToken", value);
5811        }
5812        if let Some(value) = self._page_size.as_ref() {
5813            params.push("pageSize", value.to_string());
5814        }
5815        if let Some(value) = self._order_by.as_ref() {
5816            params.push("orderBy", value);
5817        }
5818        if let Some(value) = self._filter.as_ref() {
5819            params.push("filter", value);
5820        }
5821
5822        params.extend(self._additional_params.iter());
5823
5824        params.push("alt", "json");
5825        let mut url = self.hub._base_url.clone() + "v1/{+parent}/customTargetTypes";
5826        if self._scopes.is_empty() {
5827            self._scopes
5828                .insert(Scope::CloudPlatform.as_ref().to_string());
5829        }
5830
5831        #[allow(clippy::single_element_loop)]
5832        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5833            url = params.uri_replacement(url, param_name, find_this, true);
5834        }
5835        {
5836            let to_remove = ["parent"];
5837            params.remove_params(&to_remove);
5838        }
5839
5840        let url = params.parse_with_url(&url);
5841
5842        loop {
5843            let token = match self
5844                .hub
5845                .auth
5846                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5847                .await
5848            {
5849                Ok(token) => token,
5850                Err(e) => match dlg.token(e) {
5851                    Ok(token) => token,
5852                    Err(e) => {
5853                        dlg.finished(false);
5854                        return Err(common::Error::MissingToken(e));
5855                    }
5856                },
5857            };
5858            let mut req_result = {
5859                let client = &self.hub.client;
5860                dlg.pre_request();
5861                let mut req_builder = hyper::Request::builder()
5862                    .method(hyper::Method::GET)
5863                    .uri(url.as_str())
5864                    .header(USER_AGENT, self.hub._user_agent.clone());
5865
5866                if let Some(token) = token.as_ref() {
5867                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5868                }
5869
5870                let request = req_builder
5871                    .header(CONTENT_LENGTH, 0_u64)
5872                    .body(common::to_body::<String>(None));
5873
5874                client.request(request.unwrap()).await
5875            };
5876
5877            match req_result {
5878                Err(err) => {
5879                    if let common::Retry::After(d) = dlg.http_error(&err) {
5880                        sleep(d).await;
5881                        continue;
5882                    }
5883                    dlg.finished(false);
5884                    return Err(common::Error::HttpError(err));
5885                }
5886                Ok(res) => {
5887                    let (mut parts, body) = res.into_parts();
5888                    let mut body = common::Body::new(body);
5889                    if !parts.status.is_success() {
5890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5891                        let error = serde_json::from_str(&common::to_string(&bytes));
5892                        let response = common::to_response(parts, bytes.into());
5893
5894                        if let common::Retry::After(d) =
5895                            dlg.http_failure(&response, error.as_ref().ok())
5896                        {
5897                            sleep(d).await;
5898                            continue;
5899                        }
5900
5901                        dlg.finished(false);
5902
5903                        return Err(match error {
5904                            Ok(value) => common::Error::BadRequest(value),
5905                            _ => common::Error::Failure(response),
5906                        });
5907                    }
5908                    let response = {
5909                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5910                        let encoded = common::to_string(&bytes);
5911                        match serde_json::from_str(&encoded) {
5912                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5913                            Err(error) => {
5914                                dlg.response_json_decode_error(&encoded, &error);
5915                                return Err(common::Error::JsonDecodeError(
5916                                    encoded.to_string(),
5917                                    error,
5918                                ));
5919                            }
5920                        }
5921                    };
5922
5923                    dlg.finished(true);
5924                    return Ok(response);
5925                }
5926            }
5927        }
5928    }
5929
5930    /// Required. The parent that owns this collection of custom target types. Format must be `projects/{project_id}/locations/{location_name}`.
5931    ///
5932    /// Sets the *parent* path property to the given value.
5933    ///
5934    /// Even though the property as already been set when instantiating this call,
5935    /// we provide this method for API completeness.
5936    pub fn parent(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
5937        self._parent = new_value.to_string();
5938        self
5939    }
5940    /// Optional. A page token, received from a previous `ListCustomTargetTypes` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
5941    ///
5942    /// Sets the *page token* query property to the given value.
5943    pub fn page_token(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
5944        self._page_token = Some(new_value.to_string());
5945        self
5946    }
5947    /// Optional. The maximum number of `CustomTargetType` objects to return. The service may return fewer than this value. If unspecified, at most 50 `CustomTargetType` objects will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
5948    ///
5949    /// Sets the *page size* query property to the given value.
5950    pub fn page_size(mut self, new_value: i32) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
5951        self._page_size = Some(new_value);
5952        self
5953    }
5954    /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
5955    ///
5956    /// Sets the *order by* query property to the given value.
5957    pub fn order_by(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
5958        self._order_by = Some(new_value.to_string());
5959        self
5960    }
5961    /// Optional. Filter custom target types to be returned. See https://google.aip.dev/160 for more details.
5962    ///
5963    /// Sets the *filter* query property to the given value.
5964    pub fn filter(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
5965        self._filter = Some(new_value.to_string());
5966        self
5967    }
5968    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5969    /// while executing the actual API request.
5970    ///
5971    /// ````text
5972    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5973    /// ````
5974    ///
5975    /// Sets the *delegate* property to the given value.
5976    pub fn delegate(
5977        mut self,
5978        new_value: &'a mut dyn common::Delegate,
5979    ) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
5980        self._delegate = Some(new_value);
5981        self
5982    }
5983
5984    /// Set any additional parameter of the query string used in the request.
5985    /// It should be used to set parameters which are not yet available through their own
5986    /// setters.
5987    ///
5988    /// Please note that this method must not be used to set any of the known parameters
5989    /// which have their own setter method. If done anyway, the request will fail.
5990    ///
5991    /// # Additional Parameters
5992    ///
5993    /// * *$.xgafv* (query-string) - V1 error format.
5994    /// * *access_token* (query-string) - OAuth access token.
5995    /// * *alt* (query-string) - Data format for response.
5996    /// * *callback* (query-string) - JSONP
5997    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5998    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
5999    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6000    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6001    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6002    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6003    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6004    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeListCall<'a, C>
6005    where
6006        T: AsRef<str>,
6007    {
6008        self._additional_params
6009            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6010        self
6011    }
6012
6013    /// Identifies the authorization scope for the method you are building.
6014    ///
6015    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6016    /// [`Scope::CloudPlatform`].
6017    ///
6018    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6019    /// tokens for more than one scope.
6020    ///
6021    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6022    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6023    /// sufficient, a read-write scope will do as well.
6024    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeListCall<'a, C>
6025    where
6026        St: AsRef<str>,
6027    {
6028        self._scopes.insert(String::from(scope.as_ref()));
6029        self
6030    }
6031    /// Identifies the authorization scope(s) for the method you are building.
6032    ///
6033    /// See [`Self::add_scope()`] for details.
6034    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCustomTargetTypeListCall<'a, C>
6035    where
6036        I: IntoIterator<Item = St>,
6037        St: AsRef<str>,
6038    {
6039        self._scopes
6040            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6041        self
6042    }
6043
6044    /// Removes all scopes, and no default scope will be used either.
6045    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6046    /// for details).
6047    pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6048        self._scopes.clear();
6049        self
6050    }
6051}
6052
6053/// Updates a single CustomTargetType.
6054///
6055/// A builder for the *locations.customTargetTypes.patch* method supported by a *project* resource.
6056/// It is not used directly, but through a [`ProjectMethods`] instance.
6057///
6058/// # Example
6059///
6060/// Instantiate a resource method builder
6061///
6062/// ```test_harness,no_run
6063/// # extern crate hyper;
6064/// # extern crate hyper_rustls;
6065/// # extern crate google_clouddeploy1 as clouddeploy1;
6066/// use clouddeploy1::api::CustomTargetType;
6067/// # async fn dox() {
6068/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6069///
6070/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6072/// #     secret,
6073/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6074/// # ).build().await.unwrap();
6075///
6076/// # let client = hyper_util::client::legacy::Client::builder(
6077/// #     hyper_util::rt::TokioExecutor::new()
6078/// # )
6079/// # .build(
6080/// #     hyper_rustls::HttpsConnectorBuilder::new()
6081/// #         .with_native_roots()
6082/// #         .unwrap()
6083/// #         .https_or_http()
6084/// #         .enable_http1()
6085/// #         .build()
6086/// # );
6087/// # let mut hub = CloudDeploy::new(client, auth);
6088/// // As the method needs a request, you would usually fill it with the desired information
6089/// // into the respective structure. Some of the parts shown here might not be applicable !
6090/// // Values shown here are possibly random and not representative !
6091/// let mut req = CustomTargetType::default();
6092///
6093/// // You can configure optional parameters by calling the respective setters at will, and
6094/// // execute the final call using `doit()`.
6095/// // Values shown here are possibly random and not representative !
6096/// let result = hub.projects().locations_custom_target_types_patch(req, "name")
6097///              .validate_only(true)
6098///              .update_mask(FieldMask::new::<&str>(&[]))
6099///              .request_id("duo")
6100///              .allow_missing(false)
6101///              .doit().await;
6102/// # }
6103/// ```
6104pub struct ProjectLocationCustomTargetTypePatchCall<'a, C>
6105where
6106    C: 'a,
6107{
6108    hub: &'a CloudDeploy<C>,
6109    _request: CustomTargetType,
6110    _name: String,
6111    _validate_only: Option<bool>,
6112    _update_mask: Option<common::FieldMask>,
6113    _request_id: Option<String>,
6114    _allow_missing: Option<bool>,
6115    _delegate: Option<&'a mut dyn common::Delegate>,
6116    _additional_params: HashMap<String, String>,
6117    _scopes: BTreeSet<String>,
6118}
6119
6120impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypePatchCall<'a, C> {}
6121
6122impl<'a, C> ProjectLocationCustomTargetTypePatchCall<'a, C>
6123where
6124    C: common::Connector,
6125{
6126    /// Perform the operation you have build so far.
6127    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6128        use std::borrow::Cow;
6129        use std::io::{Read, Seek};
6130
6131        use common::{url::Params, ToParts};
6132        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6133
6134        let mut dd = common::DefaultDelegate;
6135        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6136        dlg.begin(common::MethodInfo {
6137            id: "clouddeploy.projects.locations.customTargetTypes.patch",
6138            http_method: hyper::Method::PATCH,
6139        });
6140
6141        for &field in [
6142            "alt",
6143            "name",
6144            "validateOnly",
6145            "updateMask",
6146            "requestId",
6147            "allowMissing",
6148        ]
6149        .iter()
6150        {
6151            if self._additional_params.contains_key(field) {
6152                dlg.finished(false);
6153                return Err(common::Error::FieldClash(field));
6154            }
6155        }
6156
6157        let mut params = Params::with_capacity(8 + self._additional_params.len());
6158        params.push("name", self._name);
6159        if let Some(value) = self._validate_only.as_ref() {
6160            params.push("validateOnly", value.to_string());
6161        }
6162        if let Some(value) = self._update_mask.as_ref() {
6163            params.push("updateMask", value.to_string());
6164        }
6165        if let Some(value) = self._request_id.as_ref() {
6166            params.push("requestId", value);
6167        }
6168        if let Some(value) = self._allow_missing.as_ref() {
6169            params.push("allowMissing", value.to_string());
6170        }
6171
6172        params.extend(self._additional_params.iter());
6173
6174        params.push("alt", "json");
6175        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6176        if self._scopes.is_empty() {
6177            self._scopes
6178                .insert(Scope::CloudPlatform.as_ref().to_string());
6179        }
6180
6181        #[allow(clippy::single_element_loop)]
6182        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6183            url = params.uri_replacement(url, param_name, find_this, true);
6184        }
6185        {
6186            let to_remove = ["name"];
6187            params.remove_params(&to_remove);
6188        }
6189
6190        let url = params.parse_with_url(&url);
6191
6192        let mut json_mime_type = mime::APPLICATION_JSON;
6193        let mut request_value_reader = {
6194            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6195            common::remove_json_null_values(&mut value);
6196            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6197            serde_json::to_writer(&mut dst, &value).unwrap();
6198            dst
6199        };
6200        let request_size = request_value_reader
6201            .seek(std::io::SeekFrom::End(0))
6202            .unwrap();
6203        request_value_reader
6204            .seek(std::io::SeekFrom::Start(0))
6205            .unwrap();
6206
6207        loop {
6208            let token = match self
6209                .hub
6210                .auth
6211                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6212                .await
6213            {
6214                Ok(token) => token,
6215                Err(e) => match dlg.token(e) {
6216                    Ok(token) => token,
6217                    Err(e) => {
6218                        dlg.finished(false);
6219                        return Err(common::Error::MissingToken(e));
6220                    }
6221                },
6222            };
6223            request_value_reader
6224                .seek(std::io::SeekFrom::Start(0))
6225                .unwrap();
6226            let mut req_result = {
6227                let client = &self.hub.client;
6228                dlg.pre_request();
6229                let mut req_builder = hyper::Request::builder()
6230                    .method(hyper::Method::PATCH)
6231                    .uri(url.as_str())
6232                    .header(USER_AGENT, self.hub._user_agent.clone());
6233
6234                if let Some(token) = token.as_ref() {
6235                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6236                }
6237
6238                let request = req_builder
6239                    .header(CONTENT_TYPE, json_mime_type.to_string())
6240                    .header(CONTENT_LENGTH, request_size as u64)
6241                    .body(common::to_body(
6242                        request_value_reader.get_ref().clone().into(),
6243                    ));
6244
6245                client.request(request.unwrap()).await
6246            };
6247
6248            match req_result {
6249                Err(err) => {
6250                    if let common::Retry::After(d) = dlg.http_error(&err) {
6251                        sleep(d).await;
6252                        continue;
6253                    }
6254                    dlg.finished(false);
6255                    return Err(common::Error::HttpError(err));
6256                }
6257                Ok(res) => {
6258                    let (mut parts, body) = res.into_parts();
6259                    let mut body = common::Body::new(body);
6260                    if !parts.status.is_success() {
6261                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6262                        let error = serde_json::from_str(&common::to_string(&bytes));
6263                        let response = common::to_response(parts, bytes.into());
6264
6265                        if let common::Retry::After(d) =
6266                            dlg.http_failure(&response, error.as_ref().ok())
6267                        {
6268                            sleep(d).await;
6269                            continue;
6270                        }
6271
6272                        dlg.finished(false);
6273
6274                        return Err(match error {
6275                            Ok(value) => common::Error::BadRequest(value),
6276                            _ => common::Error::Failure(response),
6277                        });
6278                    }
6279                    let response = {
6280                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6281                        let encoded = common::to_string(&bytes);
6282                        match serde_json::from_str(&encoded) {
6283                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6284                            Err(error) => {
6285                                dlg.response_json_decode_error(&encoded, &error);
6286                                return Err(common::Error::JsonDecodeError(
6287                                    encoded.to_string(),
6288                                    error,
6289                                ));
6290                            }
6291                        }
6292                    };
6293
6294                    dlg.finished(true);
6295                    return Ok(response);
6296                }
6297            }
6298        }
6299    }
6300
6301    ///
6302    /// Sets the *request* property to the given value.
6303    ///
6304    /// Even though the property as already been set when instantiating this call,
6305    /// we provide this method for API completeness.
6306    pub fn request(
6307        mut self,
6308        new_value: CustomTargetType,
6309    ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6310        self._request = new_value;
6311        self
6312    }
6313    /// Optional. Name of the `CustomTargetType`. Format is `projects/{project}/locations/{location}/customTargetTypes/{customTargetType}`. The `customTargetType` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
6314    ///
6315    /// Sets the *name* path property to the given value.
6316    ///
6317    /// Even though the property as already been set when instantiating this call,
6318    /// we provide this method for API completeness.
6319    pub fn name(mut self, new_value: &str) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6320        self._name = new_value.to_string();
6321        self
6322    }
6323    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
6324    ///
6325    /// Sets the *validate only* query property to the given value.
6326    pub fn validate_only(
6327        mut self,
6328        new_value: bool,
6329    ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6330        self._validate_only = Some(new_value);
6331        self
6332    }
6333    /// Required. Field mask is used to specify the fields to be overwritten in the `CustomTargetType` resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it's in the mask. If the user doesn't provide a mask then all fields are overwritten.
6334    ///
6335    /// Sets the *update mask* query property to the given value.
6336    pub fn update_mask(
6337        mut self,
6338        new_value: common::FieldMask,
6339    ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6340        self._update_mask = Some(new_value);
6341        self
6342    }
6343    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
6344    ///
6345    /// Sets the *request id* query property to the given value.
6346    pub fn request_id(
6347        mut self,
6348        new_value: &str,
6349    ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6350        self._request_id = Some(new_value.to_string());
6351        self
6352    }
6353    /// Optional. If set to true, updating a `CustomTargetType` that does not exist will result in the creation of a new `CustomTargetType`.
6354    ///
6355    /// Sets the *allow missing* query property to the given value.
6356    pub fn allow_missing(
6357        mut self,
6358        new_value: bool,
6359    ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6360        self._allow_missing = Some(new_value);
6361        self
6362    }
6363    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6364    /// while executing the actual API request.
6365    ///
6366    /// ````text
6367    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6368    /// ````
6369    ///
6370    /// Sets the *delegate* property to the given value.
6371    pub fn delegate(
6372        mut self,
6373        new_value: &'a mut dyn common::Delegate,
6374    ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6375        self._delegate = Some(new_value);
6376        self
6377    }
6378
6379    /// Set any additional parameter of the query string used in the request.
6380    /// It should be used to set parameters which are not yet available through their own
6381    /// setters.
6382    ///
6383    /// Please note that this method must not be used to set any of the known parameters
6384    /// which have their own setter method. If done anyway, the request will fail.
6385    ///
6386    /// # Additional Parameters
6387    ///
6388    /// * *$.xgafv* (query-string) - V1 error format.
6389    /// * *access_token* (query-string) - OAuth access token.
6390    /// * *alt* (query-string) - Data format for response.
6391    /// * *callback* (query-string) - JSONP
6392    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6393    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6394    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6395    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6396    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6397    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6398    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6399    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypePatchCall<'a, C>
6400    where
6401        T: AsRef<str>,
6402    {
6403        self._additional_params
6404            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6405        self
6406    }
6407
6408    /// Identifies the authorization scope for the method you are building.
6409    ///
6410    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6411    /// [`Scope::CloudPlatform`].
6412    ///
6413    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6414    /// tokens for more than one scope.
6415    ///
6416    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6417    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6418    /// sufficient, a read-write scope will do as well.
6419    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypePatchCall<'a, C>
6420    where
6421        St: AsRef<str>,
6422    {
6423        self._scopes.insert(String::from(scope.as_ref()));
6424        self
6425    }
6426    /// Identifies the authorization scope(s) for the method you are building.
6427    ///
6428    /// See [`Self::add_scope()`] for details.
6429    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCustomTargetTypePatchCall<'a, C>
6430    where
6431        I: IntoIterator<Item = St>,
6432        St: AsRef<str>,
6433    {
6434        self._scopes
6435            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6436        self
6437    }
6438
6439    /// Removes all scopes, and no default scope will be used either.
6440    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6441    /// for details).
6442    pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
6443        self._scopes.clear();
6444        self
6445    }
6446}
6447
6448/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
6449///
6450/// A builder for the *locations.customTargetTypes.setIamPolicy* method supported by a *project* resource.
6451/// It is not used directly, but through a [`ProjectMethods`] instance.
6452///
6453/// # Example
6454///
6455/// Instantiate a resource method builder
6456///
6457/// ```test_harness,no_run
6458/// # extern crate hyper;
6459/// # extern crate hyper_rustls;
6460/// # extern crate google_clouddeploy1 as clouddeploy1;
6461/// use clouddeploy1::api::SetIamPolicyRequest;
6462/// # async fn dox() {
6463/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6464///
6465/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6466/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6467/// #     secret,
6468/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6469/// # ).build().await.unwrap();
6470///
6471/// # let client = hyper_util::client::legacy::Client::builder(
6472/// #     hyper_util::rt::TokioExecutor::new()
6473/// # )
6474/// # .build(
6475/// #     hyper_rustls::HttpsConnectorBuilder::new()
6476/// #         .with_native_roots()
6477/// #         .unwrap()
6478/// #         .https_or_http()
6479/// #         .enable_http1()
6480/// #         .build()
6481/// # );
6482/// # let mut hub = CloudDeploy::new(client, auth);
6483/// // As the method needs a request, you would usually fill it with the desired information
6484/// // into the respective structure. Some of the parts shown here might not be applicable !
6485/// // Values shown here are possibly random and not representative !
6486/// let mut req = SetIamPolicyRequest::default();
6487///
6488/// // You can configure optional parameters by calling the respective setters at will, and
6489/// // execute the final call using `doit()`.
6490/// // Values shown here are possibly random and not representative !
6491/// let result = hub.projects().locations_custom_target_types_set_iam_policy(req, "resource")
6492///              .doit().await;
6493/// # }
6494/// ```
6495pub struct ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
6496where
6497    C: 'a,
6498{
6499    hub: &'a CloudDeploy<C>,
6500    _request: SetIamPolicyRequest,
6501    _resource: String,
6502    _delegate: Option<&'a mut dyn common::Delegate>,
6503    _additional_params: HashMap<String, String>,
6504    _scopes: BTreeSet<String>,
6505}
6506
6507impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {}
6508
6509impl<'a, C> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
6510where
6511    C: common::Connector,
6512{
6513    /// Perform the operation you have build so far.
6514    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6515        use std::borrow::Cow;
6516        use std::io::{Read, Seek};
6517
6518        use common::{url::Params, ToParts};
6519        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6520
6521        let mut dd = common::DefaultDelegate;
6522        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6523        dlg.begin(common::MethodInfo {
6524            id: "clouddeploy.projects.locations.customTargetTypes.setIamPolicy",
6525            http_method: hyper::Method::POST,
6526        });
6527
6528        for &field in ["alt", "resource"].iter() {
6529            if self._additional_params.contains_key(field) {
6530                dlg.finished(false);
6531                return Err(common::Error::FieldClash(field));
6532            }
6533        }
6534
6535        let mut params = Params::with_capacity(4 + self._additional_params.len());
6536        params.push("resource", self._resource);
6537
6538        params.extend(self._additional_params.iter());
6539
6540        params.push("alt", "json");
6541        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
6542        if self._scopes.is_empty() {
6543            self._scopes
6544                .insert(Scope::CloudPlatform.as_ref().to_string());
6545        }
6546
6547        #[allow(clippy::single_element_loop)]
6548        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6549            url = params.uri_replacement(url, param_name, find_this, true);
6550        }
6551        {
6552            let to_remove = ["resource"];
6553            params.remove_params(&to_remove);
6554        }
6555
6556        let url = params.parse_with_url(&url);
6557
6558        let mut json_mime_type = mime::APPLICATION_JSON;
6559        let mut request_value_reader = {
6560            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6561            common::remove_json_null_values(&mut value);
6562            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6563            serde_json::to_writer(&mut dst, &value).unwrap();
6564            dst
6565        };
6566        let request_size = request_value_reader
6567            .seek(std::io::SeekFrom::End(0))
6568            .unwrap();
6569        request_value_reader
6570            .seek(std::io::SeekFrom::Start(0))
6571            .unwrap();
6572
6573        loop {
6574            let token = match self
6575                .hub
6576                .auth
6577                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6578                .await
6579            {
6580                Ok(token) => token,
6581                Err(e) => match dlg.token(e) {
6582                    Ok(token) => token,
6583                    Err(e) => {
6584                        dlg.finished(false);
6585                        return Err(common::Error::MissingToken(e));
6586                    }
6587                },
6588            };
6589            request_value_reader
6590                .seek(std::io::SeekFrom::Start(0))
6591                .unwrap();
6592            let mut req_result = {
6593                let client = &self.hub.client;
6594                dlg.pre_request();
6595                let mut req_builder = hyper::Request::builder()
6596                    .method(hyper::Method::POST)
6597                    .uri(url.as_str())
6598                    .header(USER_AGENT, self.hub._user_agent.clone());
6599
6600                if let Some(token) = token.as_ref() {
6601                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6602                }
6603
6604                let request = req_builder
6605                    .header(CONTENT_TYPE, json_mime_type.to_string())
6606                    .header(CONTENT_LENGTH, request_size as u64)
6607                    .body(common::to_body(
6608                        request_value_reader.get_ref().clone().into(),
6609                    ));
6610
6611                client.request(request.unwrap()).await
6612            };
6613
6614            match req_result {
6615                Err(err) => {
6616                    if let common::Retry::After(d) = dlg.http_error(&err) {
6617                        sleep(d).await;
6618                        continue;
6619                    }
6620                    dlg.finished(false);
6621                    return Err(common::Error::HttpError(err));
6622                }
6623                Ok(res) => {
6624                    let (mut parts, body) = res.into_parts();
6625                    let mut body = common::Body::new(body);
6626                    if !parts.status.is_success() {
6627                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6628                        let error = serde_json::from_str(&common::to_string(&bytes));
6629                        let response = common::to_response(parts, bytes.into());
6630
6631                        if let common::Retry::After(d) =
6632                            dlg.http_failure(&response, error.as_ref().ok())
6633                        {
6634                            sleep(d).await;
6635                            continue;
6636                        }
6637
6638                        dlg.finished(false);
6639
6640                        return Err(match error {
6641                            Ok(value) => common::Error::BadRequest(value),
6642                            _ => common::Error::Failure(response),
6643                        });
6644                    }
6645                    let response = {
6646                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6647                        let encoded = common::to_string(&bytes);
6648                        match serde_json::from_str(&encoded) {
6649                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6650                            Err(error) => {
6651                                dlg.response_json_decode_error(&encoded, &error);
6652                                return Err(common::Error::JsonDecodeError(
6653                                    encoded.to_string(),
6654                                    error,
6655                                ));
6656                            }
6657                        }
6658                    };
6659
6660                    dlg.finished(true);
6661                    return Ok(response);
6662                }
6663            }
6664        }
6665    }
6666
6667    ///
6668    /// Sets the *request* property to the given value.
6669    ///
6670    /// Even though the property as already been set when instantiating this call,
6671    /// we provide this method for API completeness.
6672    pub fn request(
6673        mut self,
6674        new_value: SetIamPolicyRequest,
6675    ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
6676        self._request = new_value;
6677        self
6678    }
6679    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
6680    ///
6681    /// Sets the *resource* path property to the given value.
6682    ///
6683    /// Even though the property as already been set when instantiating this call,
6684    /// we provide this method for API completeness.
6685    pub fn resource(
6686        mut self,
6687        new_value: &str,
6688    ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
6689        self._resource = new_value.to_string();
6690        self
6691    }
6692    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6693    /// while executing the actual API request.
6694    ///
6695    /// ````text
6696    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6697    /// ````
6698    ///
6699    /// Sets the *delegate* property to the given value.
6700    pub fn delegate(
6701        mut self,
6702        new_value: &'a mut dyn common::Delegate,
6703    ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
6704        self._delegate = Some(new_value);
6705        self
6706    }
6707
6708    /// Set any additional parameter of the query string used in the request.
6709    /// It should be used to set parameters which are not yet available through their own
6710    /// setters.
6711    ///
6712    /// Please note that this method must not be used to set any of the known parameters
6713    /// which have their own setter method. If done anyway, the request will fail.
6714    ///
6715    /// # Additional Parameters
6716    ///
6717    /// * *$.xgafv* (query-string) - V1 error format.
6718    /// * *access_token* (query-string) - OAuth access token.
6719    /// * *alt* (query-string) - Data format for response.
6720    /// * *callback* (query-string) - JSONP
6721    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6722    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6723    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6724    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6725    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6726    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6727    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6728    pub fn param<T>(
6729        mut self,
6730        name: T,
6731        value: T,
6732    ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
6733    where
6734        T: AsRef<str>,
6735    {
6736        self._additional_params
6737            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6738        self
6739    }
6740
6741    /// Identifies the authorization scope for the method you are building.
6742    ///
6743    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6744    /// [`Scope::CloudPlatform`].
6745    ///
6746    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6747    /// tokens for more than one scope.
6748    ///
6749    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6750    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6751    /// sufficient, a read-write scope will do as well.
6752    pub fn add_scope<St>(
6753        mut self,
6754        scope: St,
6755    ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
6756    where
6757        St: AsRef<str>,
6758    {
6759        self._scopes.insert(String::from(scope.as_ref()));
6760        self
6761    }
6762    /// Identifies the authorization scope(s) for the method you are building.
6763    ///
6764    /// See [`Self::add_scope()`] for details.
6765    pub fn add_scopes<I, St>(
6766        mut self,
6767        scopes: I,
6768    ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
6769    where
6770        I: IntoIterator<Item = St>,
6771        St: AsRef<str>,
6772    {
6773        self._scopes
6774            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6775        self
6776    }
6777
6778    /// Removes all scopes, and no default scope will be used either.
6779    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6780    /// for details).
6781    pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
6782        self._scopes.clear();
6783        self
6784    }
6785}
6786
6787/// Cancels an AutomationRun. The `state` of the `AutomationRun` after cancelling is `CANCELLED`. `CancelAutomationRun` can be called on AutomationRun in the state `IN_PROGRESS` and `PENDING`; AutomationRun in a different state returns an `FAILED_PRECONDITION` error.
6788///
6789/// A builder for the *locations.deliveryPipelines.automationRuns.cancel* method supported by a *project* resource.
6790/// It is not used directly, but through a [`ProjectMethods`] instance.
6791///
6792/// # Example
6793///
6794/// Instantiate a resource method builder
6795///
6796/// ```test_harness,no_run
6797/// # extern crate hyper;
6798/// # extern crate hyper_rustls;
6799/// # extern crate google_clouddeploy1 as clouddeploy1;
6800/// use clouddeploy1::api::CancelAutomationRunRequest;
6801/// # async fn dox() {
6802/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6803///
6804/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6805/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6806/// #     secret,
6807/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6808/// # ).build().await.unwrap();
6809///
6810/// # let client = hyper_util::client::legacy::Client::builder(
6811/// #     hyper_util::rt::TokioExecutor::new()
6812/// # )
6813/// # .build(
6814/// #     hyper_rustls::HttpsConnectorBuilder::new()
6815/// #         .with_native_roots()
6816/// #         .unwrap()
6817/// #         .https_or_http()
6818/// #         .enable_http1()
6819/// #         .build()
6820/// # );
6821/// # let mut hub = CloudDeploy::new(client, auth);
6822/// // As the method needs a request, you would usually fill it with the desired information
6823/// // into the respective structure. Some of the parts shown here might not be applicable !
6824/// // Values shown here are possibly random and not representative !
6825/// let mut req = CancelAutomationRunRequest::default();
6826///
6827/// // You can configure optional parameters by calling the respective setters at will, and
6828/// // execute the final call using `doit()`.
6829/// // Values shown here are possibly random and not representative !
6830/// let result = hub.projects().locations_delivery_pipelines_automation_runs_cancel(req, "name")
6831///              .doit().await;
6832/// # }
6833/// ```
6834pub struct ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
6835where
6836    C: 'a,
6837{
6838    hub: &'a CloudDeploy<C>,
6839    _request: CancelAutomationRunRequest,
6840    _name: String,
6841    _delegate: Option<&'a mut dyn common::Delegate>,
6842    _additional_params: HashMap<String, String>,
6843    _scopes: BTreeSet<String>,
6844}
6845
6846impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {}
6847
6848impl<'a, C> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
6849where
6850    C: common::Connector,
6851{
6852    /// Perform the operation you have build so far.
6853    pub async fn doit(mut self) -> common::Result<(common::Response, CancelAutomationRunResponse)> {
6854        use std::borrow::Cow;
6855        use std::io::{Read, Seek};
6856
6857        use common::{url::Params, ToParts};
6858        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6859
6860        let mut dd = common::DefaultDelegate;
6861        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6862        dlg.begin(common::MethodInfo {
6863            id: "clouddeploy.projects.locations.deliveryPipelines.automationRuns.cancel",
6864            http_method: hyper::Method::POST,
6865        });
6866
6867        for &field in ["alt", "name"].iter() {
6868            if self._additional_params.contains_key(field) {
6869                dlg.finished(false);
6870                return Err(common::Error::FieldClash(field));
6871            }
6872        }
6873
6874        let mut params = Params::with_capacity(4 + self._additional_params.len());
6875        params.push("name", self._name);
6876
6877        params.extend(self._additional_params.iter());
6878
6879        params.push("alt", "json");
6880        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
6881        if self._scopes.is_empty() {
6882            self._scopes
6883                .insert(Scope::CloudPlatform.as_ref().to_string());
6884        }
6885
6886        #[allow(clippy::single_element_loop)]
6887        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6888            url = params.uri_replacement(url, param_name, find_this, true);
6889        }
6890        {
6891            let to_remove = ["name"];
6892            params.remove_params(&to_remove);
6893        }
6894
6895        let url = params.parse_with_url(&url);
6896
6897        let mut json_mime_type = mime::APPLICATION_JSON;
6898        let mut request_value_reader = {
6899            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6900            common::remove_json_null_values(&mut value);
6901            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6902            serde_json::to_writer(&mut dst, &value).unwrap();
6903            dst
6904        };
6905        let request_size = request_value_reader
6906            .seek(std::io::SeekFrom::End(0))
6907            .unwrap();
6908        request_value_reader
6909            .seek(std::io::SeekFrom::Start(0))
6910            .unwrap();
6911
6912        loop {
6913            let token = match self
6914                .hub
6915                .auth
6916                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6917                .await
6918            {
6919                Ok(token) => token,
6920                Err(e) => match dlg.token(e) {
6921                    Ok(token) => token,
6922                    Err(e) => {
6923                        dlg.finished(false);
6924                        return Err(common::Error::MissingToken(e));
6925                    }
6926                },
6927            };
6928            request_value_reader
6929                .seek(std::io::SeekFrom::Start(0))
6930                .unwrap();
6931            let mut req_result = {
6932                let client = &self.hub.client;
6933                dlg.pre_request();
6934                let mut req_builder = hyper::Request::builder()
6935                    .method(hyper::Method::POST)
6936                    .uri(url.as_str())
6937                    .header(USER_AGENT, self.hub._user_agent.clone());
6938
6939                if let Some(token) = token.as_ref() {
6940                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6941                }
6942
6943                let request = req_builder
6944                    .header(CONTENT_TYPE, json_mime_type.to_string())
6945                    .header(CONTENT_LENGTH, request_size as u64)
6946                    .body(common::to_body(
6947                        request_value_reader.get_ref().clone().into(),
6948                    ));
6949
6950                client.request(request.unwrap()).await
6951            };
6952
6953            match req_result {
6954                Err(err) => {
6955                    if let common::Retry::After(d) = dlg.http_error(&err) {
6956                        sleep(d).await;
6957                        continue;
6958                    }
6959                    dlg.finished(false);
6960                    return Err(common::Error::HttpError(err));
6961                }
6962                Ok(res) => {
6963                    let (mut parts, body) = res.into_parts();
6964                    let mut body = common::Body::new(body);
6965                    if !parts.status.is_success() {
6966                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6967                        let error = serde_json::from_str(&common::to_string(&bytes));
6968                        let response = common::to_response(parts, bytes.into());
6969
6970                        if let common::Retry::After(d) =
6971                            dlg.http_failure(&response, error.as_ref().ok())
6972                        {
6973                            sleep(d).await;
6974                            continue;
6975                        }
6976
6977                        dlg.finished(false);
6978
6979                        return Err(match error {
6980                            Ok(value) => common::Error::BadRequest(value),
6981                            _ => common::Error::Failure(response),
6982                        });
6983                    }
6984                    let response = {
6985                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6986                        let encoded = common::to_string(&bytes);
6987                        match serde_json::from_str(&encoded) {
6988                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6989                            Err(error) => {
6990                                dlg.response_json_decode_error(&encoded, &error);
6991                                return Err(common::Error::JsonDecodeError(
6992                                    encoded.to_string(),
6993                                    error,
6994                                ));
6995                            }
6996                        }
6997                    };
6998
6999                    dlg.finished(true);
7000                    return Ok(response);
7001                }
7002            }
7003        }
7004    }
7005
7006    ///
7007    /// Sets the *request* property to the given value.
7008    ///
7009    /// Even though the property as already been set when instantiating this call,
7010    /// we provide this method for API completeness.
7011    pub fn request(
7012        mut self,
7013        new_value: CancelAutomationRunRequest,
7014    ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7015        self._request = new_value;
7016        self
7017    }
7018    /// Required. Name of the `AutomationRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
7019    ///
7020    /// Sets the *name* path property to the given value.
7021    ///
7022    /// Even though the property as already been set when instantiating this call,
7023    /// we provide this method for API completeness.
7024    pub fn name(
7025        mut self,
7026        new_value: &str,
7027    ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7028        self._name = new_value.to_string();
7029        self
7030    }
7031    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7032    /// while executing the actual API request.
7033    ///
7034    /// ````text
7035    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7036    /// ````
7037    ///
7038    /// Sets the *delegate* property to the given value.
7039    pub fn delegate(
7040        mut self,
7041        new_value: &'a mut dyn common::Delegate,
7042    ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7043        self._delegate = Some(new_value);
7044        self
7045    }
7046
7047    /// Set any additional parameter of the query string used in the request.
7048    /// It should be used to set parameters which are not yet available through their own
7049    /// setters.
7050    ///
7051    /// Please note that this method must not be used to set any of the known parameters
7052    /// which have their own setter method. If done anyway, the request will fail.
7053    ///
7054    /// # Additional Parameters
7055    ///
7056    /// * *$.xgafv* (query-string) - V1 error format.
7057    /// * *access_token* (query-string) - OAuth access token.
7058    /// * *alt* (query-string) - Data format for response.
7059    /// * *callback* (query-string) - JSONP
7060    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7061    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7062    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7063    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7064    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7065    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7066    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7067    pub fn param<T>(
7068        mut self,
7069        name: T,
7070        value: T,
7071    ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7072    where
7073        T: AsRef<str>,
7074    {
7075        self._additional_params
7076            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7077        self
7078    }
7079
7080    /// Identifies the authorization scope for the method you are building.
7081    ///
7082    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7083    /// [`Scope::CloudPlatform`].
7084    ///
7085    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7086    /// tokens for more than one scope.
7087    ///
7088    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7089    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7090    /// sufficient, a read-write scope will do as well.
7091    pub fn add_scope<St>(
7092        mut self,
7093        scope: St,
7094    ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7095    where
7096        St: AsRef<str>,
7097    {
7098        self._scopes.insert(String::from(scope.as_ref()));
7099        self
7100    }
7101    /// Identifies the authorization scope(s) for the method you are building.
7102    ///
7103    /// See [`Self::add_scope()`] for details.
7104    pub fn add_scopes<I, St>(
7105        mut self,
7106        scopes: I,
7107    ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7108    where
7109        I: IntoIterator<Item = St>,
7110        St: AsRef<str>,
7111    {
7112        self._scopes
7113            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7114        self
7115    }
7116
7117    /// Removes all scopes, and no default scope will be used either.
7118    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7119    /// for details).
7120    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7121        self._scopes.clear();
7122        self
7123    }
7124}
7125
7126/// Gets details of a single AutomationRun.
7127///
7128/// A builder for the *locations.deliveryPipelines.automationRuns.get* method supported by a *project* resource.
7129/// It is not used directly, but through a [`ProjectMethods`] instance.
7130///
7131/// # Example
7132///
7133/// Instantiate a resource method builder
7134///
7135/// ```test_harness,no_run
7136/// # extern crate hyper;
7137/// # extern crate hyper_rustls;
7138/// # extern crate google_clouddeploy1 as clouddeploy1;
7139/// # async fn dox() {
7140/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7141///
7142/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7143/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7144/// #     secret,
7145/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7146/// # ).build().await.unwrap();
7147///
7148/// # let client = hyper_util::client::legacy::Client::builder(
7149/// #     hyper_util::rt::TokioExecutor::new()
7150/// # )
7151/// # .build(
7152/// #     hyper_rustls::HttpsConnectorBuilder::new()
7153/// #         .with_native_roots()
7154/// #         .unwrap()
7155/// #         .https_or_http()
7156/// #         .enable_http1()
7157/// #         .build()
7158/// # );
7159/// # let mut hub = CloudDeploy::new(client, auth);
7160/// // You can configure optional parameters by calling the respective setters at will, and
7161/// // execute the final call using `doit()`.
7162/// // Values shown here are possibly random and not representative !
7163/// let result = hub.projects().locations_delivery_pipelines_automation_runs_get("name")
7164///              .doit().await;
7165/// # }
7166/// ```
7167pub struct ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
7168where
7169    C: 'a,
7170{
7171    hub: &'a CloudDeploy<C>,
7172    _name: String,
7173    _delegate: Option<&'a mut dyn common::Delegate>,
7174    _additional_params: HashMap<String, String>,
7175    _scopes: BTreeSet<String>,
7176}
7177
7178impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {}
7179
7180impl<'a, C> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
7181where
7182    C: common::Connector,
7183{
7184    /// Perform the operation you have build so far.
7185    pub async fn doit(mut self) -> common::Result<(common::Response, AutomationRun)> {
7186        use std::borrow::Cow;
7187        use std::io::{Read, Seek};
7188
7189        use common::{url::Params, ToParts};
7190        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7191
7192        let mut dd = common::DefaultDelegate;
7193        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7194        dlg.begin(common::MethodInfo {
7195            id: "clouddeploy.projects.locations.deliveryPipelines.automationRuns.get",
7196            http_method: hyper::Method::GET,
7197        });
7198
7199        for &field in ["alt", "name"].iter() {
7200            if self._additional_params.contains_key(field) {
7201                dlg.finished(false);
7202                return Err(common::Error::FieldClash(field));
7203            }
7204        }
7205
7206        let mut params = Params::with_capacity(3 + self._additional_params.len());
7207        params.push("name", self._name);
7208
7209        params.extend(self._additional_params.iter());
7210
7211        params.push("alt", "json");
7212        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7213        if self._scopes.is_empty() {
7214            self._scopes
7215                .insert(Scope::CloudPlatform.as_ref().to_string());
7216        }
7217
7218        #[allow(clippy::single_element_loop)]
7219        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7220            url = params.uri_replacement(url, param_name, find_this, true);
7221        }
7222        {
7223            let to_remove = ["name"];
7224            params.remove_params(&to_remove);
7225        }
7226
7227        let url = params.parse_with_url(&url);
7228
7229        loop {
7230            let token = match self
7231                .hub
7232                .auth
7233                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7234                .await
7235            {
7236                Ok(token) => token,
7237                Err(e) => match dlg.token(e) {
7238                    Ok(token) => token,
7239                    Err(e) => {
7240                        dlg.finished(false);
7241                        return Err(common::Error::MissingToken(e));
7242                    }
7243                },
7244            };
7245            let mut req_result = {
7246                let client = &self.hub.client;
7247                dlg.pre_request();
7248                let mut req_builder = hyper::Request::builder()
7249                    .method(hyper::Method::GET)
7250                    .uri(url.as_str())
7251                    .header(USER_AGENT, self.hub._user_agent.clone());
7252
7253                if let Some(token) = token.as_ref() {
7254                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7255                }
7256
7257                let request = req_builder
7258                    .header(CONTENT_LENGTH, 0_u64)
7259                    .body(common::to_body::<String>(None));
7260
7261                client.request(request.unwrap()).await
7262            };
7263
7264            match req_result {
7265                Err(err) => {
7266                    if let common::Retry::After(d) = dlg.http_error(&err) {
7267                        sleep(d).await;
7268                        continue;
7269                    }
7270                    dlg.finished(false);
7271                    return Err(common::Error::HttpError(err));
7272                }
7273                Ok(res) => {
7274                    let (mut parts, body) = res.into_parts();
7275                    let mut body = common::Body::new(body);
7276                    if !parts.status.is_success() {
7277                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7278                        let error = serde_json::from_str(&common::to_string(&bytes));
7279                        let response = common::to_response(parts, bytes.into());
7280
7281                        if let common::Retry::After(d) =
7282                            dlg.http_failure(&response, error.as_ref().ok())
7283                        {
7284                            sleep(d).await;
7285                            continue;
7286                        }
7287
7288                        dlg.finished(false);
7289
7290                        return Err(match error {
7291                            Ok(value) => common::Error::BadRequest(value),
7292                            _ => common::Error::Failure(response),
7293                        });
7294                    }
7295                    let response = {
7296                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7297                        let encoded = common::to_string(&bytes);
7298                        match serde_json::from_str(&encoded) {
7299                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7300                            Err(error) => {
7301                                dlg.response_json_decode_error(&encoded, &error);
7302                                return Err(common::Error::JsonDecodeError(
7303                                    encoded.to_string(),
7304                                    error,
7305                                ));
7306                            }
7307                        }
7308                    };
7309
7310                    dlg.finished(true);
7311                    return Ok(response);
7312                }
7313            }
7314        }
7315    }
7316
7317    /// Required. Name of the `AutomationRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
7318    ///
7319    /// Sets the *name* path property to the given value.
7320    ///
7321    /// Even though the property as already been set when instantiating this call,
7322    /// we provide this method for API completeness.
7323    pub fn name(
7324        mut self,
7325        new_value: &str,
7326    ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
7327        self._name = new_value.to_string();
7328        self
7329    }
7330    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7331    /// while executing the actual API request.
7332    ///
7333    /// ````text
7334    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7335    /// ````
7336    ///
7337    /// Sets the *delegate* property to the given value.
7338    pub fn delegate(
7339        mut self,
7340        new_value: &'a mut dyn common::Delegate,
7341    ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
7342        self._delegate = Some(new_value);
7343        self
7344    }
7345
7346    /// Set any additional parameter of the query string used in the request.
7347    /// It should be used to set parameters which are not yet available through their own
7348    /// setters.
7349    ///
7350    /// Please note that this method must not be used to set any of the known parameters
7351    /// which have their own setter method. If done anyway, the request will fail.
7352    ///
7353    /// # Additional Parameters
7354    ///
7355    /// * *$.xgafv* (query-string) - V1 error format.
7356    /// * *access_token* (query-string) - OAuth access token.
7357    /// * *alt* (query-string) - Data format for response.
7358    /// * *callback* (query-string) - JSONP
7359    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7360    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7361    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7362    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7363    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7364    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7365    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7366    pub fn param<T>(
7367        mut self,
7368        name: T,
7369        value: T,
7370    ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
7371    where
7372        T: AsRef<str>,
7373    {
7374        self._additional_params
7375            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7376        self
7377    }
7378
7379    /// Identifies the authorization scope for the method you are building.
7380    ///
7381    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7382    /// [`Scope::CloudPlatform`].
7383    ///
7384    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7385    /// tokens for more than one scope.
7386    ///
7387    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7388    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7389    /// sufficient, a read-write scope will do as well.
7390    pub fn add_scope<St>(
7391        mut self,
7392        scope: St,
7393    ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
7394    where
7395        St: AsRef<str>,
7396    {
7397        self._scopes.insert(String::from(scope.as_ref()));
7398        self
7399    }
7400    /// Identifies the authorization scope(s) for the method you are building.
7401    ///
7402    /// See [`Self::add_scope()`] for details.
7403    pub fn add_scopes<I, St>(
7404        mut self,
7405        scopes: I,
7406    ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
7407    where
7408        I: IntoIterator<Item = St>,
7409        St: AsRef<str>,
7410    {
7411        self._scopes
7412            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7413        self
7414    }
7415
7416    /// Removes all scopes, and no default scope will be used either.
7417    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7418    /// for details).
7419    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
7420        self._scopes.clear();
7421        self
7422    }
7423}
7424
7425/// Lists AutomationRuns in a given project and location.
7426///
7427/// A builder for the *locations.deliveryPipelines.automationRuns.list* method supported by a *project* resource.
7428/// It is not used directly, but through a [`ProjectMethods`] instance.
7429///
7430/// # Example
7431///
7432/// Instantiate a resource method builder
7433///
7434/// ```test_harness,no_run
7435/// # extern crate hyper;
7436/// # extern crate hyper_rustls;
7437/// # extern crate google_clouddeploy1 as clouddeploy1;
7438/// # async fn dox() {
7439/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7440///
7441/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7442/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7443/// #     secret,
7444/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7445/// # ).build().await.unwrap();
7446///
7447/// # let client = hyper_util::client::legacy::Client::builder(
7448/// #     hyper_util::rt::TokioExecutor::new()
7449/// # )
7450/// # .build(
7451/// #     hyper_rustls::HttpsConnectorBuilder::new()
7452/// #         .with_native_roots()
7453/// #         .unwrap()
7454/// #         .https_or_http()
7455/// #         .enable_http1()
7456/// #         .build()
7457/// # );
7458/// # let mut hub = CloudDeploy::new(client, auth);
7459/// // You can configure optional parameters by calling the respective setters at will, and
7460/// // execute the final call using `doit()`.
7461/// // Values shown here are possibly random and not representative !
7462/// let result = hub.projects().locations_delivery_pipelines_automation_runs_list("parent")
7463///              .page_token("sed")
7464///              .page_size(-24)
7465///              .order_by("et")
7466///              .filter("vero")
7467///              .doit().await;
7468/// # }
7469/// ```
7470pub struct ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
7471where
7472    C: 'a,
7473{
7474    hub: &'a CloudDeploy<C>,
7475    _parent: String,
7476    _page_token: Option<String>,
7477    _page_size: Option<i32>,
7478    _order_by: Option<String>,
7479    _filter: Option<String>,
7480    _delegate: Option<&'a mut dyn common::Delegate>,
7481    _additional_params: HashMap<String, String>,
7482    _scopes: BTreeSet<String>,
7483}
7484
7485impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {}
7486
7487impl<'a, C> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
7488where
7489    C: common::Connector,
7490{
7491    /// Perform the operation you have build so far.
7492    pub async fn doit(mut self) -> common::Result<(common::Response, ListAutomationRunsResponse)> {
7493        use std::borrow::Cow;
7494        use std::io::{Read, Seek};
7495
7496        use common::{url::Params, ToParts};
7497        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7498
7499        let mut dd = common::DefaultDelegate;
7500        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7501        dlg.begin(common::MethodInfo {
7502            id: "clouddeploy.projects.locations.deliveryPipelines.automationRuns.list",
7503            http_method: hyper::Method::GET,
7504        });
7505
7506        for &field in [
7507            "alt",
7508            "parent",
7509            "pageToken",
7510            "pageSize",
7511            "orderBy",
7512            "filter",
7513        ]
7514        .iter()
7515        {
7516            if self._additional_params.contains_key(field) {
7517                dlg.finished(false);
7518                return Err(common::Error::FieldClash(field));
7519            }
7520        }
7521
7522        let mut params = Params::with_capacity(7 + self._additional_params.len());
7523        params.push("parent", self._parent);
7524        if let Some(value) = self._page_token.as_ref() {
7525            params.push("pageToken", value);
7526        }
7527        if let Some(value) = self._page_size.as_ref() {
7528            params.push("pageSize", value.to_string());
7529        }
7530        if let Some(value) = self._order_by.as_ref() {
7531            params.push("orderBy", value);
7532        }
7533        if let Some(value) = self._filter.as_ref() {
7534            params.push("filter", value);
7535        }
7536
7537        params.extend(self._additional_params.iter());
7538
7539        params.push("alt", "json");
7540        let mut url = self.hub._base_url.clone() + "v1/{+parent}/automationRuns";
7541        if self._scopes.is_empty() {
7542            self._scopes
7543                .insert(Scope::CloudPlatform.as_ref().to_string());
7544        }
7545
7546        #[allow(clippy::single_element_loop)]
7547        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7548            url = params.uri_replacement(url, param_name, find_this, true);
7549        }
7550        {
7551            let to_remove = ["parent"];
7552            params.remove_params(&to_remove);
7553        }
7554
7555        let url = params.parse_with_url(&url);
7556
7557        loop {
7558            let token = match self
7559                .hub
7560                .auth
7561                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7562                .await
7563            {
7564                Ok(token) => token,
7565                Err(e) => match dlg.token(e) {
7566                    Ok(token) => token,
7567                    Err(e) => {
7568                        dlg.finished(false);
7569                        return Err(common::Error::MissingToken(e));
7570                    }
7571                },
7572            };
7573            let mut req_result = {
7574                let client = &self.hub.client;
7575                dlg.pre_request();
7576                let mut req_builder = hyper::Request::builder()
7577                    .method(hyper::Method::GET)
7578                    .uri(url.as_str())
7579                    .header(USER_AGENT, self.hub._user_agent.clone());
7580
7581                if let Some(token) = token.as_ref() {
7582                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7583                }
7584
7585                let request = req_builder
7586                    .header(CONTENT_LENGTH, 0_u64)
7587                    .body(common::to_body::<String>(None));
7588
7589                client.request(request.unwrap()).await
7590            };
7591
7592            match req_result {
7593                Err(err) => {
7594                    if let common::Retry::After(d) = dlg.http_error(&err) {
7595                        sleep(d).await;
7596                        continue;
7597                    }
7598                    dlg.finished(false);
7599                    return Err(common::Error::HttpError(err));
7600                }
7601                Ok(res) => {
7602                    let (mut parts, body) = res.into_parts();
7603                    let mut body = common::Body::new(body);
7604                    if !parts.status.is_success() {
7605                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7606                        let error = serde_json::from_str(&common::to_string(&bytes));
7607                        let response = common::to_response(parts, bytes.into());
7608
7609                        if let common::Retry::After(d) =
7610                            dlg.http_failure(&response, error.as_ref().ok())
7611                        {
7612                            sleep(d).await;
7613                            continue;
7614                        }
7615
7616                        dlg.finished(false);
7617
7618                        return Err(match error {
7619                            Ok(value) => common::Error::BadRequest(value),
7620                            _ => common::Error::Failure(response),
7621                        });
7622                    }
7623                    let response = {
7624                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7625                        let encoded = common::to_string(&bytes);
7626                        match serde_json::from_str(&encoded) {
7627                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7628                            Err(error) => {
7629                                dlg.response_json_decode_error(&encoded, &error);
7630                                return Err(common::Error::JsonDecodeError(
7631                                    encoded.to_string(),
7632                                    error,
7633                                ));
7634                            }
7635                        }
7636                    };
7637
7638                    dlg.finished(true);
7639                    return Ok(response);
7640                }
7641            }
7642        }
7643    }
7644
7645    /// Required. The parent `Delivery Pipeline`, which owns this collection of automationRuns. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}`.
7646    ///
7647    /// Sets the *parent* path property to the given value.
7648    ///
7649    /// Even though the property as already been set when instantiating this call,
7650    /// we provide this method for API completeness.
7651    pub fn parent(
7652        mut self,
7653        new_value: &str,
7654    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
7655        self._parent = new_value.to_string();
7656        self
7657    }
7658    /// A page token, received from a previous `ListAutomationRuns` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
7659    ///
7660    /// Sets the *page token* query property to the given value.
7661    pub fn page_token(
7662        mut self,
7663        new_value: &str,
7664    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
7665        self._page_token = Some(new_value.to_string());
7666        self
7667    }
7668    /// The maximum number of automationRuns to return. The service may return fewer than this value. If unspecified, at most 50 automationRuns will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
7669    ///
7670    /// Sets the *page size* query property to the given value.
7671    pub fn page_size(
7672        mut self,
7673        new_value: i32,
7674    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
7675        self._page_size = Some(new_value);
7676        self
7677    }
7678    /// Field to sort by.
7679    ///
7680    /// Sets the *order by* query property to the given value.
7681    pub fn order_by(
7682        mut self,
7683        new_value: &str,
7684    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
7685        self._order_by = Some(new_value.to_string());
7686        self
7687    }
7688    /// Filter automationRuns to be returned. All fields can be used in the filter.
7689    ///
7690    /// Sets the *filter* query property to the given value.
7691    pub fn filter(
7692        mut self,
7693        new_value: &str,
7694    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
7695        self._filter = Some(new_value.to_string());
7696        self
7697    }
7698    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7699    /// while executing the actual API request.
7700    ///
7701    /// ````text
7702    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7703    /// ````
7704    ///
7705    /// Sets the *delegate* property to the given value.
7706    pub fn delegate(
7707        mut self,
7708        new_value: &'a mut dyn common::Delegate,
7709    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
7710        self._delegate = Some(new_value);
7711        self
7712    }
7713
7714    /// Set any additional parameter of the query string used in the request.
7715    /// It should be used to set parameters which are not yet available through their own
7716    /// setters.
7717    ///
7718    /// Please note that this method must not be used to set any of the known parameters
7719    /// which have their own setter method. If done anyway, the request will fail.
7720    ///
7721    /// # Additional Parameters
7722    ///
7723    /// * *$.xgafv* (query-string) - V1 error format.
7724    /// * *access_token* (query-string) - OAuth access token.
7725    /// * *alt* (query-string) - Data format for response.
7726    /// * *callback* (query-string) - JSONP
7727    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7728    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
7729    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7730    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7731    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
7732    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7733    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7734    pub fn param<T>(
7735        mut self,
7736        name: T,
7737        value: T,
7738    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
7739    where
7740        T: AsRef<str>,
7741    {
7742        self._additional_params
7743            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7744        self
7745    }
7746
7747    /// Identifies the authorization scope for the method you are building.
7748    ///
7749    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7750    /// [`Scope::CloudPlatform`].
7751    ///
7752    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7753    /// tokens for more than one scope.
7754    ///
7755    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7756    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7757    /// sufficient, a read-write scope will do as well.
7758    pub fn add_scope<St>(
7759        mut self,
7760        scope: St,
7761    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
7762    where
7763        St: AsRef<str>,
7764    {
7765        self._scopes.insert(String::from(scope.as_ref()));
7766        self
7767    }
7768    /// Identifies the authorization scope(s) for the method you are building.
7769    ///
7770    /// See [`Self::add_scope()`] for details.
7771    pub fn add_scopes<I, St>(
7772        mut self,
7773        scopes: I,
7774    ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
7775    where
7776        I: IntoIterator<Item = St>,
7777        St: AsRef<str>,
7778    {
7779        self._scopes
7780            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7781        self
7782    }
7783
7784    /// Removes all scopes, and no default scope will be used either.
7785    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7786    /// for details).
7787    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
7788        self._scopes.clear();
7789        self
7790    }
7791}
7792
7793/// Creates a new Automation in a given project and location.
7794///
7795/// A builder for the *locations.deliveryPipelines.automations.create* method supported by a *project* resource.
7796/// It is not used directly, but through a [`ProjectMethods`] instance.
7797///
7798/// # Example
7799///
7800/// Instantiate a resource method builder
7801///
7802/// ```test_harness,no_run
7803/// # extern crate hyper;
7804/// # extern crate hyper_rustls;
7805/// # extern crate google_clouddeploy1 as clouddeploy1;
7806/// use clouddeploy1::api::Automation;
7807/// # async fn dox() {
7808/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7809///
7810/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7811/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7812/// #     secret,
7813/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7814/// # ).build().await.unwrap();
7815///
7816/// # let client = hyper_util::client::legacy::Client::builder(
7817/// #     hyper_util::rt::TokioExecutor::new()
7818/// # )
7819/// # .build(
7820/// #     hyper_rustls::HttpsConnectorBuilder::new()
7821/// #         .with_native_roots()
7822/// #         .unwrap()
7823/// #         .https_or_http()
7824/// #         .enable_http1()
7825/// #         .build()
7826/// # );
7827/// # let mut hub = CloudDeploy::new(client, auth);
7828/// // As the method needs a request, you would usually fill it with the desired information
7829/// // into the respective structure. Some of the parts shown here might not be applicable !
7830/// // Values shown here are possibly random and not representative !
7831/// let mut req = Automation::default();
7832///
7833/// // You can configure optional parameters by calling the respective setters at will, and
7834/// // execute the final call using `doit()`.
7835/// // Values shown here are possibly random and not representative !
7836/// let result = hub.projects().locations_delivery_pipelines_automations_create(req, "parent")
7837///              .validate_only(false)
7838///              .request_id("duo")
7839///              .automation_id("dolore")
7840///              .doit().await;
7841/// # }
7842/// ```
7843pub struct ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
7844where
7845    C: 'a,
7846{
7847    hub: &'a CloudDeploy<C>,
7848    _request: Automation,
7849    _parent: String,
7850    _validate_only: Option<bool>,
7851    _request_id: Option<String>,
7852    _automation_id: Option<String>,
7853    _delegate: Option<&'a mut dyn common::Delegate>,
7854    _additional_params: HashMap<String, String>,
7855    _scopes: BTreeSet<String>,
7856}
7857
7858impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {}
7859
7860impl<'a, C> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
7861where
7862    C: common::Connector,
7863{
7864    /// Perform the operation you have build so far.
7865    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7866        use std::borrow::Cow;
7867        use std::io::{Read, Seek};
7868
7869        use common::{url::Params, ToParts};
7870        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7871
7872        let mut dd = common::DefaultDelegate;
7873        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7874        dlg.begin(common::MethodInfo {
7875            id: "clouddeploy.projects.locations.deliveryPipelines.automations.create",
7876            http_method: hyper::Method::POST,
7877        });
7878
7879        for &field in ["alt", "parent", "validateOnly", "requestId", "automationId"].iter() {
7880            if self._additional_params.contains_key(field) {
7881                dlg.finished(false);
7882                return Err(common::Error::FieldClash(field));
7883            }
7884        }
7885
7886        let mut params = Params::with_capacity(7 + self._additional_params.len());
7887        params.push("parent", self._parent);
7888        if let Some(value) = self._validate_only.as_ref() {
7889            params.push("validateOnly", value.to_string());
7890        }
7891        if let Some(value) = self._request_id.as_ref() {
7892            params.push("requestId", value);
7893        }
7894        if let Some(value) = self._automation_id.as_ref() {
7895            params.push("automationId", value);
7896        }
7897
7898        params.extend(self._additional_params.iter());
7899
7900        params.push("alt", "json");
7901        let mut url = self.hub._base_url.clone() + "v1/{+parent}/automations";
7902        if self._scopes.is_empty() {
7903            self._scopes
7904                .insert(Scope::CloudPlatform.as_ref().to_string());
7905        }
7906
7907        #[allow(clippy::single_element_loop)]
7908        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7909            url = params.uri_replacement(url, param_name, find_this, true);
7910        }
7911        {
7912            let to_remove = ["parent"];
7913            params.remove_params(&to_remove);
7914        }
7915
7916        let url = params.parse_with_url(&url);
7917
7918        let mut json_mime_type = mime::APPLICATION_JSON;
7919        let mut request_value_reader = {
7920            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7921            common::remove_json_null_values(&mut value);
7922            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7923            serde_json::to_writer(&mut dst, &value).unwrap();
7924            dst
7925        };
7926        let request_size = request_value_reader
7927            .seek(std::io::SeekFrom::End(0))
7928            .unwrap();
7929        request_value_reader
7930            .seek(std::io::SeekFrom::Start(0))
7931            .unwrap();
7932
7933        loop {
7934            let token = match self
7935                .hub
7936                .auth
7937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7938                .await
7939            {
7940                Ok(token) => token,
7941                Err(e) => match dlg.token(e) {
7942                    Ok(token) => token,
7943                    Err(e) => {
7944                        dlg.finished(false);
7945                        return Err(common::Error::MissingToken(e));
7946                    }
7947                },
7948            };
7949            request_value_reader
7950                .seek(std::io::SeekFrom::Start(0))
7951                .unwrap();
7952            let mut req_result = {
7953                let client = &self.hub.client;
7954                dlg.pre_request();
7955                let mut req_builder = hyper::Request::builder()
7956                    .method(hyper::Method::POST)
7957                    .uri(url.as_str())
7958                    .header(USER_AGENT, self.hub._user_agent.clone());
7959
7960                if let Some(token) = token.as_ref() {
7961                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7962                }
7963
7964                let request = req_builder
7965                    .header(CONTENT_TYPE, json_mime_type.to_string())
7966                    .header(CONTENT_LENGTH, request_size as u64)
7967                    .body(common::to_body(
7968                        request_value_reader.get_ref().clone().into(),
7969                    ));
7970
7971                client.request(request.unwrap()).await
7972            };
7973
7974            match req_result {
7975                Err(err) => {
7976                    if let common::Retry::After(d) = dlg.http_error(&err) {
7977                        sleep(d).await;
7978                        continue;
7979                    }
7980                    dlg.finished(false);
7981                    return Err(common::Error::HttpError(err));
7982                }
7983                Ok(res) => {
7984                    let (mut parts, body) = res.into_parts();
7985                    let mut body = common::Body::new(body);
7986                    if !parts.status.is_success() {
7987                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7988                        let error = serde_json::from_str(&common::to_string(&bytes));
7989                        let response = common::to_response(parts, bytes.into());
7990
7991                        if let common::Retry::After(d) =
7992                            dlg.http_failure(&response, error.as_ref().ok())
7993                        {
7994                            sleep(d).await;
7995                            continue;
7996                        }
7997
7998                        dlg.finished(false);
7999
8000                        return Err(match error {
8001                            Ok(value) => common::Error::BadRequest(value),
8002                            _ => common::Error::Failure(response),
8003                        });
8004                    }
8005                    let response = {
8006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8007                        let encoded = common::to_string(&bytes);
8008                        match serde_json::from_str(&encoded) {
8009                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8010                            Err(error) => {
8011                                dlg.response_json_decode_error(&encoded, &error);
8012                                return Err(common::Error::JsonDecodeError(
8013                                    encoded.to_string(),
8014                                    error,
8015                                ));
8016                            }
8017                        }
8018                    };
8019
8020                    dlg.finished(true);
8021                    return Ok(response);
8022                }
8023            }
8024        }
8025    }
8026
8027    ///
8028    /// Sets the *request* property to the given value.
8029    ///
8030    /// Even though the property as already been set when instantiating this call,
8031    /// we provide this method for API completeness.
8032    pub fn request(
8033        mut self,
8034        new_value: Automation,
8035    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8036        self._request = new_value;
8037        self
8038    }
8039    /// Required. The parent collection in which the `Automation` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
8040    ///
8041    /// Sets the *parent* path property to the given value.
8042    ///
8043    /// Even though the property as already been set when instantiating this call,
8044    /// we provide this method for API completeness.
8045    pub fn parent(
8046        mut self,
8047        new_value: &str,
8048    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8049        self._parent = new_value.to_string();
8050        self
8051    }
8052    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
8053    ///
8054    /// Sets the *validate only* query property to the given value.
8055    pub fn validate_only(
8056        mut self,
8057        new_value: bool,
8058    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8059        self._validate_only = Some(new_value);
8060        self
8061    }
8062    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
8063    ///
8064    /// Sets the *request id* query property to the given value.
8065    pub fn request_id(
8066        mut self,
8067        new_value: &str,
8068    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8069        self._request_id = Some(new_value.to_string());
8070        self
8071    }
8072    /// Required. ID of the `Automation`.
8073    ///
8074    /// Sets the *automation id* query property to the given value.
8075    pub fn automation_id(
8076        mut self,
8077        new_value: &str,
8078    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8079        self._automation_id = Some(new_value.to_string());
8080        self
8081    }
8082    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8083    /// while executing the actual API request.
8084    ///
8085    /// ````text
8086    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8087    /// ````
8088    ///
8089    /// Sets the *delegate* property to the given value.
8090    pub fn delegate(
8091        mut self,
8092        new_value: &'a mut dyn common::Delegate,
8093    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8094        self._delegate = Some(new_value);
8095        self
8096    }
8097
8098    /// Set any additional parameter of the query string used in the request.
8099    /// It should be used to set parameters which are not yet available through their own
8100    /// setters.
8101    ///
8102    /// Please note that this method must not be used to set any of the known parameters
8103    /// which have their own setter method. If done anyway, the request will fail.
8104    ///
8105    /// # Additional Parameters
8106    ///
8107    /// * *$.xgafv* (query-string) - V1 error format.
8108    /// * *access_token* (query-string) - OAuth access token.
8109    /// * *alt* (query-string) - Data format for response.
8110    /// * *callback* (query-string) - JSONP
8111    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8112    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8113    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8114    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8115    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8116    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8117    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8118    pub fn param<T>(
8119        mut self,
8120        name: T,
8121        value: T,
8122    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
8123    where
8124        T: AsRef<str>,
8125    {
8126        self._additional_params
8127            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8128        self
8129    }
8130
8131    /// Identifies the authorization scope for the method you are building.
8132    ///
8133    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8134    /// [`Scope::CloudPlatform`].
8135    ///
8136    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8137    /// tokens for more than one scope.
8138    ///
8139    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8140    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8141    /// sufficient, a read-write scope will do as well.
8142    pub fn add_scope<St>(
8143        mut self,
8144        scope: St,
8145    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
8146    where
8147        St: AsRef<str>,
8148    {
8149        self._scopes.insert(String::from(scope.as_ref()));
8150        self
8151    }
8152    /// Identifies the authorization scope(s) for the method you are building.
8153    ///
8154    /// See [`Self::add_scope()`] for details.
8155    pub fn add_scopes<I, St>(
8156        mut self,
8157        scopes: I,
8158    ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
8159    where
8160        I: IntoIterator<Item = St>,
8161        St: AsRef<str>,
8162    {
8163        self._scopes
8164            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8165        self
8166    }
8167
8168    /// Removes all scopes, and no default scope will be used either.
8169    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8170    /// for details).
8171    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8172        self._scopes.clear();
8173        self
8174    }
8175}
8176
8177/// Deletes a single Automation resource.
8178///
8179/// A builder for the *locations.deliveryPipelines.automations.delete* method supported by a *project* resource.
8180/// It is not used directly, but through a [`ProjectMethods`] instance.
8181///
8182/// # Example
8183///
8184/// Instantiate a resource method builder
8185///
8186/// ```test_harness,no_run
8187/// # extern crate hyper;
8188/// # extern crate hyper_rustls;
8189/// # extern crate google_clouddeploy1 as clouddeploy1;
8190/// # async fn dox() {
8191/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8192///
8193/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8194/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8195/// #     secret,
8196/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8197/// # ).build().await.unwrap();
8198///
8199/// # let client = hyper_util::client::legacy::Client::builder(
8200/// #     hyper_util::rt::TokioExecutor::new()
8201/// # )
8202/// # .build(
8203/// #     hyper_rustls::HttpsConnectorBuilder::new()
8204/// #         .with_native_roots()
8205/// #         .unwrap()
8206/// #         .https_or_http()
8207/// #         .enable_http1()
8208/// #         .build()
8209/// # );
8210/// # let mut hub = CloudDeploy::new(client, auth);
8211/// // You can configure optional parameters by calling the respective setters at will, and
8212/// // execute the final call using `doit()`.
8213/// // Values shown here are possibly random and not representative !
8214/// let result = hub.projects().locations_delivery_pipelines_automations_delete("name")
8215///              .validate_only(false)
8216///              .request_id("diam")
8217///              .etag("dolor")
8218///              .allow_missing(false)
8219///              .doit().await;
8220/// # }
8221/// ```
8222pub struct ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
8223where
8224    C: 'a,
8225{
8226    hub: &'a CloudDeploy<C>,
8227    _name: String,
8228    _validate_only: Option<bool>,
8229    _request_id: Option<String>,
8230    _etag: Option<String>,
8231    _allow_missing: Option<bool>,
8232    _delegate: Option<&'a mut dyn common::Delegate>,
8233    _additional_params: HashMap<String, String>,
8234    _scopes: BTreeSet<String>,
8235}
8236
8237impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {}
8238
8239impl<'a, C> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
8240where
8241    C: common::Connector,
8242{
8243    /// Perform the operation you have build so far.
8244    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8245        use std::borrow::Cow;
8246        use std::io::{Read, Seek};
8247
8248        use common::{url::Params, ToParts};
8249        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8250
8251        let mut dd = common::DefaultDelegate;
8252        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8253        dlg.begin(common::MethodInfo {
8254            id: "clouddeploy.projects.locations.deliveryPipelines.automations.delete",
8255            http_method: hyper::Method::DELETE,
8256        });
8257
8258        for &field in [
8259            "alt",
8260            "name",
8261            "validateOnly",
8262            "requestId",
8263            "etag",
8264            "allowMissing",
8265        ]
8266        .iter()
8267        {
8268            if self._additional_params.contains_key(field) {
8269                dlg.finished(false);
8270                return Err(common::Error::FieldClash(field));
8271            }
8272        }
8273
8274        let mut params = Params::with_capacity(7 + self._additional_params.len());
8275        params.push("name", self._name);
8276        if let Some(value) = self._validate_only.as_ref() {
8277            params.push("validateOnly", value.to_string());
8278        }
8279        if let Some(value) = self._request_id.as_ref() {
8280            params.push("requestId", value);
8281        }
8282        if let Some(value) = self._etag.as_ref() {
8283            params.push("etag", value);
8284        }
8285        if let Some(value) = self._allow_missing.as_ref() {
8286            params.push("allowMissing", value.to_string());
8287        }
8288
8289        params.extend(self._additional_params.iter());
8290
8291        params.push("alt", "json");
8292        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8293        if self._scopes.is_empty() {
8294            self._scopes
8295                .insert(Scope::CloudPlatform.as_ref().to_string());
8296        }
8297
8298        #[allow(clippy::single_element_loop)]
8299        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8300            url = params.uri_replacement(url, param_name, find_this, true);
8301        }
8302        {
8303            let to_remove = ["name"];
8304            params.remove_params(&to_remove);
8305        }
8306
8307        let url = params.parse_with_url(&url);
8308
8309        loop {
8310            let token = match self
8311                .hub
8312                .auth
8313                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8314                .await
8315            {
8316                Ok(token) => token,
8317                Err(e) => match dlg.token(e) {
8318                    Ok(token) => token,
8319                    Err(e) => {
8320                        dlg.finished(false);
8321                        return Err(common::Error::MissingToken(e));
8322                    }
8323                },
8324            };
8325            let mut req_result = {
8326                let client = &self.hub.client;
8327                dlg.pre_request();
8328                let mut req_builder = hyper::Request::builder()
8329                    .method(hyper::Method::DELETE)
8330                    .uri(url.as_str())
8331                    .header(USER_AGENT, self.hub._user_agent.clone());
8332
8333                if let Some(token) = token.as_ref() {
8334                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8335                }
8336
8337                let request = req_builder
8338                    .header(CONTENT_LENGTH, 0_u64)
8339                    .body(common::to_body::<String>(None));
8340
8341                client.request(request.unwrap()).await
8342            };
8343
8344            match req_result {
8345                Err(err) => {
8346                    if let common::Retry::After(d) = dlg.http_error(&err) {
8347                        sleep(d).await;
8348                        continue;
8349                    }
8350                    dlg.finished(false);
8351                    return Err(common::Error::HttpError(err));
8352                }
8353                Ok(res) => {
8354                    let (mut parts, body) = res.into_parts();
8355                    let mut body = common::Body::new(body);
8356                    if !parts.status.is_success() {
8357                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8358                        let error = serde_json::from_str(&common::to_string(&bytes));
8359                        let response = common::to_response(parts, bytes.into());
8360
8361                        if let common::Retry::After(d) =
8362                            dlg.http_failure(&response, error.as_ref().ok())
8363                        {
8364                            sleep(d).await;
8365                            continue;
8366                        }
8367
8368                        dlg.finished(false);
8369
8370                        return Err(match error {
8371                            Ok(value) => common::Error::BadRequest(value),
8372                            _ => common::Error::Failure(response),
8373                        });
8374                    }
8375                    let response = {
8376                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8377                        let encoded = common::to_string(&bytes);
8378                        match serde_json::from_str(&encoded) {
8379                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8380                            Err(error) => {
8381                                dlg.response_json_decode_error(&encoded, &error);
8382                                return Err(common::Error::JsonDecodeError(
8383                                    encoded.to_string(),
8384                                    error,
8385                                ));
8386                            }
8387                        }
8388                    };
8389
8390                    dlg.finished(true);
8391                    return Ok(response);
8392                }
8393            }
8394        }
8395    }
8396
8397    /// Required. The name of the `Automation` to delete. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
8398    ///
8399    /// Sets the *name* path property to the given value.
8400    ///
8401    /// Even though the property as already been set when instantiating this call,
8402    /// we provide this method for API completeness.
8403    pub fn name(
8404        mut self,
8405        new_value: &str,
8406    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
8407        self._name = new_value.to_string();
8408        self
8409    }
8410    /// Optional. If set, validate the request and verify whether the resource exists, but do not actually post it.
8411    ///
8412    /// Sets the *validate only* query property to the given value.
8413    pub fn validate_only(
8414        mut self,
8415        new_value: bool,
8416    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
8417        self._validate_only = Some(new_value);
8418        self
8419    }
8420    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
8421    ///
8422    /// Sets the *request id* query property to the given value.
8423    pub fn request_id(
8424        mut self,
8425        new_value: &str,
8426    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
8427        self._request_id = Some(new_value.to_string());
8428        self
8429    }
8430    /// Optional. The weak etag of the request. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
8431    ///
8432    /// Sets the *etag* query property to the given value.
8433    pub fn etag(
8434        mut self,
8435        new_value: &str,
8436    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
8437        self._etag = Some(new_value.to_string());
8438        self
8439    }
8440    /// Optional. If set to true, then deleting an already deleted or non-existing `Automation` will succeed.
8441    ///
8442    /// Sets the *allow missing* query property to the given value.
8443    pub fn allow_missing(
8444        mut self,
8445        new_value: bool,
8446    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
8447        self._allow_missing = Some(new_value);
8448        self
8449    }
8450    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8451    /// while executing the actual API request.
8452    ///
8453    /// ````text
8454    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8455    /// ````
8456    ///
8457    /// Sets the *delegate* property to the given value.
8458    pub fn delegate(
8459        mut self,
8460        new_value: &'a mut dyn common::Delegate,
8461    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
8462        self._delegate = Some(new_value);
8463        self
8464    }
8465
8466    /// Set any additional parameter of the query string used in the request.
8467    /// It should be used to set parameters which are not yet available through their own
8468    /// setters.
8469    ///
8470    /// Please note that this method must not be used to set any of the known parameters
8471    /// which have their own setter method. If done anyway, the request will fail.
8472    ///
8473    /// # Additional Parameters
8474    ///
8475    /// * *$.xgafv* (query-string) - V1 error format.
8476    /// * *access_token* (query-string) - OAuth access token.
8477    /// * *alt* (query-string) - Data format for response.
8478    /// * *callback* (query-string) - JSONP
8479    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8480    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8481    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8482    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8483    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8484    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8485    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8486    pub fn param<T>(
8487        mut self,
8488        name: T,
8489        value: T,
8490    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
8491    where
8492        T: AsRef<str>,
8493    {
8494        self._additional_params
8495            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8496        self
8497    }
8498
8499    /// Identifies the authorization scope for the method you are building.
8500    ///
8501    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8502    /// [`Scope::CloudPlatform`].
8503    ///
8504    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8505    /// tokens for more than one scope.
8506    ///
8507    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8508    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8509    /// sufficient, a read-write scope will do as well.
8510    pub fn add_scope<St>(
8511        mut self,
8512        scope: St,
8513    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
8514    where
8515        St: AsRef<str>,
8516    {
8517        self._scopes.insert(String::from(scope.as_ref()));
8518        self
8519    }
8520    /// Identifies the authorization scope(s) for the method you are building.
8521    ///
8522    /// See [`Self::add_scope()`] for details.
8523    pub fn add_scopes<I, St>(
8524        mut self,
8525        scopes: I,
8526    ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
8527    where
8528        I: IntoIterator<Item = St>,
8529        St: AsRef<str>,
8530    {
8531        self._scopes
8532            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8533        self
8534    }
8535
8536    /// Removes all scopes, and no default scope will be used either.
8537    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8538    /// for details).
8539    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
8540        self._scopes.clear();
8541        self
8542    }
8543}
8544
8545/// Gets details of a single Automation.
8546///
8547/// A builder for the *locations.deliveryPipelines.automations.get* method supported by a *project* resource.
8548/// It is not used directly, but through a [`ProjectMethods`] instance.
8549///
8550/// # Example
8551///
8552/// Instantiate a resource method builder
8553///
8554/// ```test_harness,no_run
8555/// # extern crate hyper;
8556/// # extern crate hyper_rustls;
8557/// # extern crate google_clouddeploy1 as clouddeploy1;
8558/// # async fn dox() {
8559/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8560///
8561/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8562/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8563/// #     secret,
8564/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8565/// # ).build().await.unwrap();
8566///
8567/// # let client = hyper_util::client::legacy::Client::builder(
8568/// #     hyper_util::rt::TokioExecutor::new()
8569/// # )
8570/// # .build(
8571/// #     hyper_rustls::HttpsConnectorBuilder::new()
8572/// #         .with_native_roots()
8573/// #         .unwrap()
8574/// #         .https_or_http()
8575/// #         .enable_http1()
8576/// #         .build()
8577/// # );
8578/// # let mut hub = CloudDeploy::new(client, auth);
8579/// // You can configure optional parameters by calling the respective setters at will, and
8580/// // execute the final call using `doit()`.
8581/// // Values shown here are possibly random and not representative !
8582/// let result = hub.projects().locations_delivery_pipelines_automations_get("name")
8583///              .doit().await;
8584/// # }
8585/// ```
8586pub struct ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
8587where
8588    C: 'a,
8589{
8590    hub: &'a CloudDeploy<C>,
8591    _name: String,
8592    _delegate: Option<&'a mut dyn common::Delegate>,
8593    _additional_params: HashMap<String, String>,
8594    _scopes: BTreeSet<String>,
8595}
8596
8597impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {}
8598
8599impl<'a, C> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
8600where
8601    C: common::Connector,
8602{
8603    /// Perform the operation you have build so far.
8604    pub async fn doit(mut self) -> common::Result<(common::Response, Automation)> {
8605        use std::borrow::Cow;
8606        use std::io::{Read, Seek};
8607
8608        use common::{url::Params, ToParts};
8609        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8610
8611        let mut dd = common::DefaultDelegate;
8612        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8613        dlg.begin(common::MethodInfo {
8614            id: "clouddeploy.projects.locations.deliveryPipelines.automations.get",
8615            http_method: hyper::Method::GET,
8616        });
8617
8618        for &field in ["alt", "name"].iter() {
8619            if self._additional_params.contains_key(field) {
8620                dlg.finished(false);
8621                return Err(common::Error::FieldClash(field));
8622            }
8623        }
8624
8625        let mut params = Params::with_capacity(3 + self._additional_params.len());
8626        params.push("name", self._name);
8627
8628        params.extend(self._additional_params.iter());
8629
8630        params.push("alt", "json");
8631        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8632        if self._scopes.is_empty() {
8633            self._scopes
8634                .insert(Scope::CloudPlatform.as_ref().to_string());
8635        }
8636
8637        #[allow(clippy::single_element_loop)]
8638        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8639            url = params.uri_replacement(url, param_name, find_this, true);
8640        }
8641        {
8642            let to_remove = ["name"];
8643            params.remove_params(&to_remove);
8644        }
8645
8646        let url = params.parse_with_url(&url);
8647
8648        loop {
8649            let token = match self
8650                .hub
8651                .auth
8652                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8653                .await
8654            {
8655                Ok(token) => token,
8656                Err(e) => match dlg.token(e) {
8657                    Ok(token) => token,
8658                    Err(e) => {
8659                        dlg.finished(false);
8660                        return Err(common::Error::MissingToken(e));
8661                    }
8662                },
8663            };
8664            let mut req_result = {
8665                let client = &self.hub.client;
8666                dlg.pre_request();
8667                let mut req_builder = hyper::Request::builder()
8668                    .method(hyper::Method::GET)
8669                    .uri(url.as_str())
8670                    .header(USER_AGENT, self.hub._user_agent.clone());
8671
8672                if let Some(token) = token.as_ref() {
8673                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8674                }
8675
8676                let request = req_builder
8677                    .header(CONTENT_LENGTH, 0_u64)
8678                    .body(common::to_body::<String>(None));
8679
8680                client.request(request.unwrap()).await
8681            };
8682
8683            match req_result {
8684                Err(err) => {
8685                    if let common::Retry::After(d) = dlg.http_error(&err) {
8686                        sleep(d).await;
8687                        continue;
8688                    }
8689                    dlg.finished(false);
8690                    return Err(common::Error::HttpError(err));
8691                }
8692                Ok(res) => {
8693                    let (mut parts, body) = res.into_parts();
8694                    let mut body = common::Body::new(body);
8695                    if !parts.status.is_success() {
8696                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8697                        let error = serde_json::from_str(&common::to_string(&bytes));
8698                        let response = common::to_response(parts, bytes.into());
8699
8700                        if let common::Retry::After(d) =
8701                            dlg.http_failure(&response, error.as_ref().ok())
8702                        {
8703                            sleep(d).await;
8704                            continue;
8705                        }
8706
8707                        dlg.finished(false);
8708
8709                        return Err(match error {
8710                            Ok(value) => common::Error::BadRequest(value),
8711                            _ => common::Error::Failure(response),
8712                        });
8713                    }
8714                    let response = {
8715                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8716                        let encoded = common::to_string(&bytes);
8717                        match serde_json::from_str(&encoded) {
8718                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8719                            Err(error) => {
8720                                dlg.response_json_decode_error(&encoded, &error);
8721                                return Err(common::Error::JsonDecodeError(
8722                                    encoded.to_string(),
8723                                    error,
8724                                ));
8725                            }
8726                        }
8727                    };
8728
8729                    dlg.finished(true);
8730                    return Ok(response);
8731                }
8732            }
8733        }
8734    }
8735
8736    /// Required. Name of the `Automation`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
8737    ///
8738    /// Sets the *name* path property to the given value.
8739    ///
8740    /// Even though the property as already been set when instantiating this call,
8741    /// we provide this method for API completeness.
8742    pub fn name(
8743        mut self,
8744        new_value: &str,
8745    ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
8746        self._name = new_value.to_string();
8747        self
8748    }
8749    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8750    /// while executing the actual API request.
8751    ///
8752    /// ````text
8753    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8754    /// ````
8755    ///
8756    /// Sets the *delegate* property to the given value.
8757    pub fn delegate(
8758        mut self,
8759        new_value: &'a mut dyn common::Delegate,
8760    ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
8761        self._delegate = Some(new_value);
8762        self
8763    }
8764
8765    /// Set any additional parameter of the query string used in the request.
8766    /// It should be used to set parameters which are not yet available through their own
8767    /// setters.
8768    ///
8769    /// Please note that this method must not be used to set any of the known parameters
8770    /// which have their own setter method. If done anyway, the request will fail.
8771    ///
8772    /// # Additional Parameters
8773    ///
8774    /// * *$.xgafv* (query-string) - V1 error format.
8775    /// * *access_token* (query-string) - OAuth access token.
8776    /// * *alt* (query-string) - Data format for response.
8777    /// * *callback* (query-string) - JSONP
8778    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8779    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
8780    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8781    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8782    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
8783    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8784    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8785    pub fn param<T>(
8786        mut self,
8787        name: T,
8788        value: T,
8789    ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
8790    where
8791        T: AsRef<str>,
8792    {
8793        self._additional_params
8794            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8795        self
8796    }
8797
8798    /// Identifies the authorization scope for the method you are building.
8799    ///
8800    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8801    /// [`Scope::CloudPlatform`].
8802    ///
8803    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8804    /// tokens for more than one scope.
8805    ///
8806    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8807    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8808    /// sufficient, a read-write scope will do as well.
8809    pub fn add_scope<St>(
8810        mut self,
8811        scope: St,
8812    ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
8813    where
8814        St: AsRef<str>,
8815    {
8816        self._scopes.insert(String::from(scope.as_ref()));
8817        self
8818    }
8819    /// Identifies the authorization scope(s) for the method you are building.
8820    ///
8821    /// See [`Self::add_scope()`] for details.
8822    pub fn add_scopes<I, St>(
8823        mut self,
8824        scopes: I,
8825    ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
8826    where
8827        I: IntoIterator<Item = St>,
8828        St: AsRef<str>,
8829    {
8830        self._scopes
8831            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8832        self
8833    }
8834
8835    /// Removes all scopes, and no default scope will be used either.
8836    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8837    /// for details).
8838    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
8839        self._scopes.clear();
8840        self
8841    }
8842}
8843
8844/// Lists Automations in a given project and location.
8845///
8846/// A builder for the *locations.deliveryPipelines.automations.list* method supported by a *project* resource.
8847/// It is not used directly, but through a [`ProjectMethods`] instance.
8848///
8849/// # Example
8850///
8851/// Instantiate a resource method builder
8852///
8853/// ```test_harness,no_run
8854/// # extern crate hyper;
8855/// # extern crate hyper_rustls;
8856/// # extern crate google_clouddeploy1 as clouddeploy1;
8857/// # async fn dox() {
8858/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8859///
8860/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8861/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8862/// #     secret,
8863/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8864/// # ).build().await.unwrap();
8865///
8866/// # let client = hyper_util::client::legacy::Client::builder(
8867/// #     hyper_util::rt::TokioExecutor::new()
8868/// # )
8869/// # .build(
8870/// #     hyper_rustls::HttpsConnectorBuilder::new()
8871/// #         .with_native_roots()
8872/// #         .unwrap()
8873/// #         .https_or_http()
8874/// #         .enable_http1()
8875/// #         .build()
8876/// # );
8877/// # let mut hub = CloudDeploy::new(client, auth);
8878/// // You can configure optional parameters by calling the respective setters at will, and
8879/// // execute the final call using `doit()`.
8880/// // Values shown here are possibly random and not representative !
8881/// let result = hub.projects().locations_delivery_pipelines_automations_list("parent")
8882///              .page_token("duo")
8883///              .page_size(-76)
8884///              .order_by("vero")
8885///              .filter("invidunt")
8886///              .doit().await;
8887/// # }
8888/// ```
8889pub struct ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
8890where
8891    C: 'a,
8892{
8893    hub: &'a CloudDeploy<C>,
8894    _parent: String,
8895    _page_token: Option<String>,
8896    _page_size: Option<i32>,
8897    _order_by: Option<String>,
8898    _filter: Option<String>,
8899    _delegate: Option<&'a mut dyn common::Delegate>,
8900    _additional_params: HashMap<String, String>,
8901    _scopes: BTreeSet<String>,
8902}
8903
8904impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {}
8905
8906impl<'a, C> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
8907where
8908    C: common::Connector,
8909{
8910    /// Perform the operation you have build so far.
8911    pub async fn doit(mut self) -> common::Result<(common::Response, ListAutomationsResponse)> {
8912        use std::borrow::Cow;
8913        use std::io::{Read, Seek};
8914
8915        use common::{url::Params, ToParts};
8916        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8917
8918        let mut dd = common::DefaultDelegate;
8919        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8920        dlg.begin(common::MethodInfo {
8921            id: "clouddeploy.projects.locations.deliveryPipelines.automations.list",
8922            http_method: hyper::Method::GET,
8923        });
8924
8925        for &field in [
8926            "alt",
8927            "parent",
8928            "pageToken",
8929            "pageSize",
8930            "orderBy",
8931            "filter",
8932        ]
8933        .iter()
8934        {
8935            if self._additional_params.contains_key(field) {
8936                dlg.finished(false);
8937                return Err(common::Error::FieldClash(field));
8938            }
8939        }
8940
8941        let mut params = Params::with_capacity(7 + self._additional_params.len());
8942        params.push("parent", self._parent);
8943        if let Some(value) = self._page_token.as_ref() {
8944            params.push("pageToken", value);
8945        }
8946        if let Some(value) = self._page_size.as_ref() {
8947            params.push("pageSize", value.to_string());
8948        }
8949        if let Some(value) = self._order_by.as_ref() {
8950            params.push("orderBy", value);
8951        }
8952        if let Some(value) = self._filter.as_ref() {
8953            params.push("filter", value);
8954        }
8955
8956        params.extend(self._additional_params.iter());
8957
8958        params.push("alt", "json");
8959        let mut url = self.hub._base_url.clone() + "v1/{+parent}/automations";
8960        if self._scopes.is_empty() {
8961            self._scopes
8962                .insert(Scope::CloudPlatform.as_ref().to_string());
8963        }
8964
8965        #[allow(clippy::single_element_loop)]
8966        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8967            url = params.uri_replacement(url, param_name, find_this, true);
8968        }
8969        {
8970            let to_remove = ["parent"];
8971            params.remove_params(&to_remove);
8972        }
8973
8974        let url = params.parse_with_url(&url);
8975
8976        loop {
8977            let token = match self
8978                .hub
8979                .auth
8980                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8981                .await
8982            {
8983                Ok(token) => token,
8984                Err(e) => match dlg.token(e) {
8985                    Ok(token) => token,
8986                    Err(e) => {
8987                        dlg.finished(false);
8988                        return Err(common::Error::MissingToken(e));
8989                    }
8990                },
8991            };
8992            let mut req_result = {
8993                let client = &self.hub.client;
8994                dlg.pre_request();
8995                let mut req_builder = hyper::Request::builder()
8996                    .method(hyper::Method::GET)
8997                    .uri(url.as_str())
8998                    .header(USER_AGENT, self.hub._user_agent.clone());
8999
9000                if let Some(token) = token.as_ref() {
9001                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9002                }
9003
9004                let request = req_builder
9005                    .header(CONTENT_LENGTH, 0_u64)
9006                    .body(common::to_body::<String>(None));
9007
9008                client.request(request.unwrap()).await
9009            };
9010
9011            match req_result {
9012                Err(err) => {
9013                    if let common::Retry::After(d) = dlg.http_error(&err) {
9014                        sleep(d).await;
9015                        continue;
9016                    }
9017                    dlg.finished(false);
9018                    return Err(common::Error::HttpError(err));
9019                }
9020                Ok(res) => {
9021                    let (mut parts, body) = res.into_parts();
9022                    let mut body = common::Body::new(body);
9023                    if !parts.status.is_success() {
9024                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9025                        let error = serde_json::from_str(&common::to_string(&bytes));
9026                        let response = common::to_response(parts, bytes.into());
9027
9028                        if let common::Retry::After(d) =
9029                            dlg.http_failure(&response, error.as_ref().ok())
9030                        {
9031                            sleep(d).await;
9032                            continue;
9033                        }
9034
9035                        dlg.finished(false);
9036
9037                        return Err(match error {
9038                            Ok(value) => common::Error::BadRequest(value),
9039                            _ => common::Error::Failure(response),
9040                        });
9041                    }
9042                    let response = {
9043                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9044                        let encoded = common::to_string(&bytes);
9045                        match serde_json::from_str(&encoded) {
9046                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9047                            Err(error) => {
9048                                dlg.response_json_decode_error(&encoded, &error);
9049                                return Err(common::Error::JsonDecodeError(
9050                                    encoded.to_string(),
9051                                    error,
9052                                ));
9053                            }
9054                        }
9055                    };
9056
9057                    dlg.finished(true);
9058                    return Ok(response);
9059                }
9060            }
9061        }
9062    }
9063
9064    /// Required. The parent `Delivery Pipeline`, which owns this collection of automations. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
9065    ///
9066    /// Sets the *parent* path property to the given value.
9067    ///
9068    /// Even though the property as already been set when instantiating this call,
9069    /// we provide this method for API completeness.
9070    pub fn parent(
9071        mut self,
9072        new_value: &str,
9073    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9074        self._parent = new_value.to_string();
9075        self
9076    }
9077    /// A page token, received from a previous `ListAutomations` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
9078    ///
9079    /// Sets the *page token* query property to the given value.
9080    pub fn page_token(
9081        mut self,
9082        new_value: &str,
9083    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9084        self._page_token = Some(new_value.to_string());
9085        self
9086    }
9087    /// The maximum number of automations to return. The service may return fewer than this value. If unspecified, at most 50 automations will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
9088    ///
9089    /// Sets the *page size* query property to the given value.
9090    pub fn page_size(
9091        mut self,
9092        new_value: i32,
9093    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9094        self._page_size = Some(new_value);
9095        self
9096    }
9097    /// Field to sort by.
9098    ///
9099    /// Sets the *order by* query property to the given value.
9100    pub fn order_by(
9101        mut self,
9102        new_value: &str,
9103    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9104        self._order_by = Some(new_value.to_string());
9105        self
9106    }
9107    /// Filter automations to be returned. All fields can be used in the filter.
9108    ///
9109    /// Sets the *filter* query property to the given value.
9110    pub fn filter(
9111        mut self,
9112        new_value: &str,
9113    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9114        self._filter = Some(new_value.to_string());
9115        self
9116    }
9117    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9118    /// while executing the actual API request.
9119    ///
9120    /// ````text
9121    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9122    /// ````
9123    ///
9124    /// Sets the *delegate* property to the given value.
9125    pub fn delegate(
9126        mut self,
9127        new_value: &'a mut dyn common::Delegate,
9128    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9129        self._delegate = Some(new_value);
9130        self
9131    }
9132
9133    /// Set any additional parameter of the query string used in the request.
9134    /// It should be used to set parameters which are not yet available through their own
9135    /// setters.
9136    ///
9137    /// Please note that this method must not be used to set any of the known parameters
9138    /// which have their own setter method. If done anyway, the request will fail.
9139    ///
9140    /// # Additional Parameters
9141    ///
9142    /// * *$.xgafv* (query-string) - V1 error format.
9143    /// * *access_token* (query-string) - OAuth access token.
9144    /// * *alt* (query-string) - Data format for response.
9145    /// * *callback* (query-string) - JSONP
9146    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9147    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9148    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9149    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9150    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9151    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9152    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9153    pub fn param<T>(
9154        mut self,
9155        name: T,
9156        value: T,
9157    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
9158    where
9159        T: AsRef<str>,
9160    {
9161        self._additional_params
9162            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9163        self
9164    }
9165
9166    /// Identifies the authorization scope for the method you are building.
9167    ///
9168    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9169    /// [`Scope::CloudPlatform`].
9170    ///
9171    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9172    /// tokens for more than one scope.
9173    ///
9174    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9175    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9176    /// sufficient, a read-write scope will do as well.
9177    pub fn add_scope<St>(
9178        mut self,
9179        scope: St,
9180    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
9181    where
9182        St: AsRef<str>,
9183    {
9184        self._scopes.insert(String::from(scope.as_ref()));
9185        self
9186    }
9187    /// Identifies the authorization scope(s) for the method you are building.
9188    ///
9189    /// See [`Self::add_scope()`] for details.
9190    pub fn add_scopes<I, St>(
9191        mut self,
9192        scopes: I,
9193    ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
9194    where
9195        I: IntoIterator<Item = St>,
9196        St: AsRef<str>,
9197    {
9198        self._scopes
9199            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9200        self
9201    }
9202
9203    /// Removes all scopes, and no default scope will be used either.
9204    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9205    /// for details).
9206    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9207        self._scopes.clear();
9208        self
9209    }
9210}
9211
9212/// Updates the parameters of a single Automation resource.
9213///
9214/// A builder for the *locations.deliveryPipelines.automations.patch* method supported by a *project* resource.
9215/// It is not used directly, but through a [`ProjectMethods`] instance.
9216///
9217/// # Example
9218///
9219/// Instantiate a resource method builder
9220///
9221/// ```test_harness,no_run
9222/// # extern crate hyper;
9223/// # extern crate hyper_rustls;
9224/// # extern crate google_clouddeploy1 as clouddeploy1;
9225/// use clouddeploy1::api::Automation;
9226/// # async fn dox() {
9227/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9228///
9229/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9230/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9231/// #     secret,
9232/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9233/// # ).build().await.unwrap();
9234///
9235/// # let client = hyper_util::client::legacy::Client::builder(
9236/// #     hyper_util::rt::TokioExecutor::new()
9237/// # )
9238/// # .build(
9239/// #     hyper_rustls::HttpsConnectorBuilder::new()
9240/// #         .with_native_roots()
9241/// #         .unwrap()
9242/// #         .https_or_http()
9243/// #         .enable_http1()
9244/// #         .build()
9245/// # );
9246/// # let mut hub = CloudDeploy::new(client, auth);
9247/// // As the method needs a request, you would usually fill it with the desired information
9248/// // into the respective structure. Some of the parts shown here might not be applicable !
9249/// // Values shown here are possibly random and not representative !
9250/// let mut req = Automation::default();
9251///
9252/// // You can configure optional parameters by calling the respective setters at will, and
9253/// // execute the final call using `doit()`.
9254/// // Values shown here are possibly random and not representative !
9255/// let result = hub.projects().locations_delivery_pipelines_automations_patch(req, "name")
9256///              .validate_only(false)
9257///              .update_mask(FieldMask::new::<&str>(&[]))
9258///              .request_id("elitr")
9259///              .allow_missing(true)
9260///              .doit().await;
9261/// # }
9262/// ```
9263pub struct ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
9264where
9265    C: 'a,
9266{
9267    hub: &'a CloudDeploy<C>,
9268    _request: Automation,
9269    _name: String,
9270    _validate_only: Option<bool>,
9271    _update_mask: Option<common::FieldMask>,
9272    _request_id: Option<String>,
9273    _allow_missing: Option<bool>,
9274    _delegate: Option<&'a mut dyn common::Delegate>,
9275    _additional_params: HashMap<String, String>,
9276    _scopes: BTreeSet<String>,
9277}
9278
9279impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {}
9280
9281impl<'a, C> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
9282where
9283    C: common::Connector,
9284{
9285    /// Perform the operation you have build so far.
9286    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9287        use std::borrow::Cow;
9288        use std::io::{Read, Seek};
9289
9290        use common::{url::Params, ToParts};
9291        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9292
9293        let mut dd = common::DefaultDelegate;
9294        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9295        dlg.begin(common::MethodInfo {
9296            id: "clouddeploy.projects.locations.deliveryPipelines.automations.patch",
9297            http_method: hyper::Method::PATCH,
9298        });
9299
9300        for &field in [
9301            "alt",
9302            "name",
9303            "validateOnly",
9304            "updateMask",
9305            "requestId",
9306            "allowMissing",
9307        ]
9308        .iter()
9309        {
9310            if self._additional_params.contains_key(field) {
9311                dlg.finished(false);
9312                return Err(common::Error::FieldClash(field));
9313            }
9314        }
9315
9316        let mut params = Params::with_capacity(8 + self._additional_params.len());
9317        params.push("name", self._name);
9318        if let Some(value) = self._validate_only.as_ref() {
9319            params.push("validateOnly", value.to_string());
9320        }
9321        if let Some(value) = self._update_mask.as_ref() {
9322            params.push("updateMask", value.to_string());
9323        }
9324        if let Some(value) = self._request_id.as_ref() {
9325            params.push("requestId", value);
9326        }
9327        if let Some(value) = self._allow_missing.as_ref() {
9328            params.push("allowMissing", value.to_string());
9329        }
9330
9331        params.extend(self._additional_params.iter());
9332
9333        params.push("alt", "json");
9334        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9335        if self._scopes.is_empty() {
9336            self._scopes
9337                .insert(Scope::CloudPlatform.as_ref().to_string());
9338        }
9339
9340        #[allow(clippy::single_element_loop)]
9341        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9342            url = params.uri_replacement(url, param_name, find_this, true);
9343        }
9344        {
9345            let to_remove = ["name"];
9346            params.remove_params(&to_remove);
9347        }
9348
9349        let url = params.parse_with_url(&url);
9350
9351        let mut json_mime_type = mime::APPLICATION_JSON;
9352        let mut request_value_reader = {
9353            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9354            common::remove_json_null_values(&mut value);
9355            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9356            serde_json::to_writer(&mut dst, &value).unwrap();
9357            dst
9358        };
9359        let request_size = request_value_reader
9360            .seek(std::io::SeekFrom::End(0))
9361            .unwrap();
9362        request_value_reader
9363            .seek(std::io::SeekFrom::Start(0))
9364            .unwrap();
9365
9366        loop {
9367            let token = match self
9368                .hub
9369                .auth
9370                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9371                .await
9372            {
9373                Ok(token) => token,
9374                Err(e) => match dlg.token(e) {
9375                    Ok(token) => token,
9376                    Err(e) => {
9377                        dlg.finished(false);
9378                        return Err(common::Error::MissingToken(e));
9379                    }
9380                },
9381            };
9382            request_value_reader
9383                .seek(std::io::SeekFrom::Start(0))
9384                .unwrap();
9385            let mut req_result = {
9386                let client = &self.hub.client;
9387                dlg.pre_request();
9388                let mut req_builder = hyper::Request::builder()
9389                    .method(hyper::Method::PATCH)
9390                    .uri(url.as_str())
9391                    .header(USER_AGENT, self.hub._user_agent.clone());
9392
9393                if let Some(token) = token.as_ref() {
9394                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9395                }
9396
9397                let request = req_builder
9398                    .header(CONTENT_TYPE, json_mime_type.to_string())
9399                    .header(CONTENT_LENGTH, request_size as u64)
9400                    .body(common::to_body(
9401                        request_value_reader.get_ref().clone().into(),
9402                    ));
9403
9404                client.request(request.unwrap()).await
9405            };
9406
9407            match req_result {
9408                Err(err) => {
9409                    if let common::Retry::After(d) = dlg.http_error(&err) {
9410                        sleep(d).await;
9411                        continue;
9412                    }
9413                    dlg.finished(false);
9414                    return Err(common::Error::HttpError(err));
9415                }
9416                Ok(res) => {
9417                    let (mut parts, body) = res.into_parts();
9418                    let mut body = common::Body::new(body);
9419                    if !parts.status.is_success() {
9420                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9421                        let error = serde_json::from_str(&common::to_string(&bytes));
9422                        let response = common::to_response(parts, bytes.into());
9423
9424                        if let common::Retry::After(d) =
9425                            dlg.http_failure(&response, error.as_ref().ok())
9426                        {
9427                            sleep(d).await;
9428                            continue;
9429                        }
9430
9431                        dlg.finished(false);
9432
9433                        return Err(match error {
9434                            Ok(value) => common::Error::BadRequest(value),
9435                            _ => common::Error::Failure(response),
9436                        });
9437                    }
9438                    let response = {
9439                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9440                        let encoded = common::to_string(&bytes);
9441                        match serde_json::from_str(&encoded) {
9442                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9443                            Err(error) => {
9444                                dlg.response_json_decode_error(&encoded, &error);
9445                                return Err(common::Error::JsonDecodeError(
9446                                    encoded.to_string(),
9447                                    error,
9448                                ));
9449                            }
9450                        }
9451                    };
9452
9453                    dlg.finished(true);
9454                    return Ok(response);
9455                }
9456            }
9457        }
9458    }
9459
9460    ///
9461    /// Sets the *request* property to the given value.
9462    ///
9463    /// Even though the property as already been set when instantiating this call,
9464    /// we provide this method for API completeness.
9465    pub fn request(
9466        mut self,
9467        new_value: Automation,
9468    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9469        self._request = new_value;
9470        self
9471    }
9472    /// Output only. Name of the `Automation`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automations/{automation}`.
9473    ///
9474    /// Sets the *name* path property to the given value.
9475    ///
9476    /// Even though the property as already been set when instantiating this call,
9477    /// we provide this method for API completeness.
9478    pub fn name(
9479        mut self,
9480        new_value: &str,
9481    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9482        self._name = new_value.to_string();
9483        self
9484    }
9485    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
9486    ///
9487    /// Sets the *validate only* query property to the given value.
9488    pub fn validate_only(
9489        mut self,
9490        new_value: bool,
9491    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9492        self._validate_only = Some(new_value);
9493        self
9494    }
9495    /// Required. Field mask is used to specify the fields to be overwritten in the `Automation` resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it's in the mask. If the user doesn't provide a mask then all fields are overwritten.
9496    ///
9497    /// Sets the *update mask* query property to the given value.
9498    pub fn update_mask(
9499        mut self,
9500        new_value: common::FieldMask,
9501    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9502        self._update_mask = Some(new_value);
9503        self
9504    }
9505    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
9506    ///
9507    /// Sets the *request id* query property to the given value.
9508    pub fn request_id(
9509        mut self,
9510        new_value: &str,
9511    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9512        self._request_id = Some(new_value.to_string());
9513        self
9514    }
9515    /// Optional. If set to true, updating a `Automation` that does not exist will result in the creation of a new `Automation`.
9516    ///
9517    /// Sets the *allow missing* query property to the given value.
9518    pub fn allow_missing(
9519        mut self,
9520        new_value: bool,
9521    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9522        self._allow_missing = Some(new_value);
9523        self
9524    }
9525    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9526    /// while executing the actual API request.
9527    ///
9528    /// ````text
9529    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9530    /// ````
9531    ///
9532    /// Sets the *delegate* property to the given value.
9533    pub fn delegate(
9534        mut self,
9535        new_value: &'a mut dyn common::Delegate,
9536    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9537        self._delegate = Some(new_value);
9538        self
9539    }
9540
9541    /// Set any additional parameter of the query string used in the request.
9542    /// It should be used to set parameters which are not yet available through their own
9543    /// setters.
9544    ///
9545    /// Please note that this method must not be used to set any of the known parameters
9546    /// which have their own setter method. If done anyway, the request will fail.
9547    ///
9548    /// # Additional Parameters
9549    ///
9550    /// * *$.xgafv* (query-string) - V1 error format.
9551    /// * *access_token* (query-string) - OAuth access token.
9552    /// * *alt* (query-string) - Data format for response.
9553    /// * *callback* (query-string) - JSONP
9554    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9555    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9556    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9557    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9558    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9559    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9560    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9561    pub fn param<T>(
9562        mut self,
9563        name: T,
9564        value: T,
9565    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
9566    where
9567        T: AsRef<str>,
9568    {
9569        self._additional_params
9570            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9571        self
9572    }
9573
9574    /// Identifies the authorization scope for the method you are building.
9575    ///
9576    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9577    /// [`Scope::CloudPlatform`].
9578    ///
9579    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9580    /// tokens for more than one scope.
9581    ///
9582    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9583    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9584    /// sufficient, a read-write scope will do as well.
9585    pub fn add_scope<St>(
9586        mut self,
9587        scope: St,
9588    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
9589    where
9590        St: AsRef<str>,
9591    {
9592        self._scopes.insert(String::from(scope.as_ref()));
9593        self
9594    }
9595    /// Identifies the authorization scope(s) for the method you are building.
9596    ///
9597    /// See [`Self::add_scope()`] for details.
9598    pub fn add_scopes<I, St>(
9599        mut self,
9600        scopes: I,
9601    ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
9602    where
9603        I: IntoIterator<Item = St>,
9604        St: AsRef<str>,
9605    {
9606        self._scopes
9607            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9608        self
9609    }
9610
9611    /// Removes all scopes, and no default scope will be used either.
9612    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9613    /// for details).
9614    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
9615        self._scopes.clear();
9616        self
9617    }
9618}
9619
9620/// Gets details of a single JobRun.
9621///
9622/// A builder for the *locations.deliveryPipelines.releases.rollouts.jobRuns.get* method supported by a *project* resource.
9623/// It is not used directly, but through a [`ProjectMethods`] instance.
9624///
9625/// # Example
9626///
9627/// Instantiate a resource method builder
9628///
9629/// ```test_harness,no_run
9630/// # extern crate hyper;
9631/// # extern crate hyper_rustls;
9632/// # extern crate google_clouddeploy1 as clouddeploy1;
9633/// # async fn dox() {
9634/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9635///
9636/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9637/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9638/// #     secret,
9639/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9640/// # ).build().await.unwrap();
9641///
9642/// # let client = hyper_util::client::legacy::Client::builder(
9643/// #     hyper_util::rt::TokioExecutor::new()
9644/// # )
9645/// # .build(
9646/// #     hyper_rustls::HttpsConnectorBuilder::new()
9647/// #         .with_native_roots()
9648/// #         .unwrap()
9649/// #         .https_or_http()
9650/// #         .enable_http1()
9651/// #         .build()
9652/// # );
9653/// # let mut hub = CloudDeploy::new(client, auth);
9654/// // You can configure optional parameters by calling the respective setters at will, and
9655/// // execute the final call using `doit()`.
9656/// // Values shown here are possibly random and not representative !
9657/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_job_runs_get("name")
9658///              .doit().await;
9659/// # }
9660/// ```
9661pub struct ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
9662where
9663    C: 'a,
9664{
9665    hub: &'a CloudDeploy<C>,
9666    _name: String,
9667    _delegate: Option<&'a mut dyn common::Delegate>,
9668    _additional_params: HashMap<String, String>,
9669    _scopes: BTreeSet<String>,
9670}
9671
9672impl<'a, C> common::CallBuilder
9673    for ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
9674{
9675}
9676
9677impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
9678where
9679    C: common::Connector,
9680{
9681    /// Perform the operation you have build so far.
9682    pub async fn doit(mut self) -> common::Result<(common::Response, JobRun)> {
9683        use std::borrow::Cow;
9684        use std::io::{Read, Seek};
9685
9686        use common::{url::Params, ToParts};
9687        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9688
9689        let mut dd = common::DefaultDelegate;
9690        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9691        dlg.begin(common::MethodInfo {
9692            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.jobRuns.get",
9693            http_method: hyper::Method::GET,
9694        });
9695
9696        for &field in ["alt", "name"].iter() {
9697            if self._additional_params.contains_key(field) {
9698                dlg.finished(false);
9699                return Err(common::Error::FieldClash(field));
9700            }
9701        }
9702
9703        let mut params = Params::with_capacity(3 + self._additional_params.len());
9704        params.push("name", self._name);
9705
9706        params.extend(self._additional_params.iter());
9707
9708        params.push("alt", "json");
9709        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9710        if self._scopes.is_empty() {
9711            self._scopes
9712                .insert(Scope::CloudPlatform.as_ref().to_string());
9713        }
9714
9715        #[allow(clippy::single_element_loop)]
9716        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9717            url = params.uri_replacement(url, param_name, find_this, true);
9718        }
9719        {
9720            let to_remove = ["name"];
9721            params.remove_params(&to_remove);
9722        }
9723
9724        let url = params.parse_with_url(&url);
9725
9726        loop {
9727            let token = match self
9728                .hub
9729                .auth
9730                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9731                .await
9732            {
9733                Ok(token) => token,
9734                Err(e) => match dlg.token(e) {
9735                    Ok(token) => token,
9736                    Err(e) => {
9737                        dlg.finished(false);
9738                        return Err(common::Error::MissingToken(e));
9739                    }
9740                },
9741            };
9742            let mut req_result = {
9743                let client = &self.hub.client;
9744                dlg.pre_request();
9745                let mut req_builder = hyper::Request::builder()
9746                    .method(hyper::Method::GET)
9747                    .uri(url.as_str())
9748                    .header(USER_AGENT, self.hub._user_agent.clone());
9749
9750                if let Some(token) = token.as_ref() {
9751                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9752                }
9753
9754                let request = req_builder
9755                    .header(CONTENT_LENGTH, 0_u64)
9756                    .body(common::to_body::<String>(None));
9757
9758                client.request(request.unwrap()).await
9759            };
9760
9761            match req_result {
9762                Err(err) => {
9763                    if let common::Retry::After(d) = dlg.http_error(&err) {
9764                        sleep(d).await;
9765                        continue;
9766                    }
9767                    dlg.finished(false);
9768                    return Err(common::Error::HttpError(err));
9769                }
9770                Ok(res) => {
9771                    let (mut parts, body) = res.into_parts();
9772                    let mut body = common::Body::new(body);
9773                    if !parts.status.is_success() {
9774                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9775                        let error = serde_json::from_str(&common::to_string(&bytes));
9776                        let response = common::to_response(parts, bytes.into());
9777
9778                        if let common::Retry::After(d) =
9779                            dlg.http_failure(&response, error.as_ref().ok())
9780                        {
9781                            sleep(d).await;
9782                            continue;
9783                        }
9784
9785                        dlg.finished(false);
9786
9787                        return Err(match error {
9788                            Ok(value) => common::Error::BadRequest(value),
9789                            _ => common::Error::Failure(response),
9790                        });
9791                    }
9792                    let response = {
9793                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9794                        let encoded = common::to_string(&bytes);
9795                        match serde_json::from_str(&encoded) {
9796                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9797                            Err(error) => {
9798                                dlg.response_json_decode_error(&encoded, &error);
9799                                return Err(common::Error::JsonDecodeError(
9800                                    encoded.to_string(),
9801                                    error,
9802                                ));
9803                            }
9804                        }
9805                    };
9806
9807                    dlg.finished(true);
9808                    return Ok(response);
9809                }
9810            }
9811        }
9812    }
9813
9814    /// Required. Name of the `JobRun`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}/jobRuns/{job_run_name}`.
9815    ///
9816    /// Sets the *name* path property to the given value.
9817    ///
9818    /// Even though the property as already been set when instantiating this call,
9819    /// we provide this method for API completeness.
9820    pub fn name(
9821        mut self,
9822        new_value: &str,
9823    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
9824        self._name = new_value.to_string();
9825        self
9826    }
9827    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9828    /// while executing the actual API request.
9829    ///
9830    /// ````text
9831    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9832    /// ````
9833    ///
9834    /// Sets the *delegate* property to the given value.
9835    pub fn delegate(
9836        mut self,
9837        new_value: &'a mut dyn common::Delegate,
9838    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
9839        self._delegate = Some(new_value);
9840        self
9841    }
9842
9843    /// Set any additional parameter of the query string used in the request.
9844    /// It should be used to set parameters which are not yet available through their own
9845    /// setters.
9846    ///
9847    /// Please note that this method must not be used to set any of the known parameters
9848    /// which have their own setter method. If done anyway, the request will fail.
9849    ///
9850    /// # Additional Parameters
9851    ///
9852    /// * *$.xgafv* (query-string) - V1 error format.
9853    /// * *access_token* (query-string) - OAuth access token.
9854    /// * *alt* (query-string) - Data format for response.
9855    /// * *callback* (query-string) - JSONP
9856    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9857    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
9858    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9859    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9860    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
9861    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9862    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9863    pub fn param<T>(
9864        mut self,
9865        name: T,
9866        value: T,
9867    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
9868    where
9869        T: AsRef<str>,
9870    {
9871        self._additional_params
9872            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9873        self
9874    }
9875
9876    /// Identifies the authorization scope for the method you are building.
9877    ///
9878    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9879    /// [`Scope::CloudPlatform`].
9880    ///
9881    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9882    /// tokens for more than one scope.
9883    ///
9884    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9885    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9886    /// sufficient, a read-write scope will do as well.
9887    pub fn add_scope<St>(
9888        mut self,
9889        scope: St,
9890    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
9891    where
9892        St: AsRef<str>,
9893    {
9894        self._scopes.insert(String::from(scope.as_ref()));
9895        self
9896    }
9897    /// Identifies the authorization scope(s) for the method you are building.
9898    ///
9899    /// See [`Self::add_scope()`] for details.
9900    pub fn add_scopes<I, St>(
9901        mut self,
9902        scopes: I,
9903    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
9904    where
9905        I: IntoIterator<Item = St>,
9906        St: AsRef<str>,
9907    {
9908        self._scopes
9909            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9910        self
9911    }
9912
9913    /// Removes all scopes, and no default scope will be used either.
9914    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9915    /// for details).
9916    pub fn clear_scopes(
9917        mut self,
9918    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
9919        self._scopes.clear();
9920        self
9921    }
9922}
9923
9924/// Lists JobRuns in a given project and location.
9925///
9926/// A builder for the *locations.deliveryPipelines.releases.rollouts.jobRuns.list* method supported by a *project* resource.
9927/// It is not used directly, but through a [`ProjectMethods`] instance.
9928///
9929/// # Example
9930///
9931/// Instantiate a resource method builder
9932///
9933/// ```test_harness,no_run
9934/// # extern crate hyper;
9935/// # extern crate hyper_rustls;
9936/// # extern crate google_clouddeploy1 as clouddeploy1;
9937/// # async fn dox() {
9938/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9939///
9940/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9941/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9942/// #     secret,
9943/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9944/// # ).build().await.unwrap();
9945///
9946/// # let client = hyper_util::client::legacy::Client::builder(
9947/// #     hyper_util::rt::TokioExecutor::new()
9948/// # )
9949/// # .build(
9950/// #     hyper_rustls::HttpsConnectorBuilder::new()
9951/// #         .with_native_roots()
9952/// #         .unwrap()
9953/// #         .https_or_http()
9954/// #         .enable_http1()
9955/// #         .build()
9956/// # );
9957/// # let mut hub = CloudDeploy::new(client, auth);
9958/// // You can configure optional parameters by calling the respective setters at will, and
9959/// // execute the final call using `doit()`.
9960/// // Values shown here are possibly random and not representative !
9961/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_job_runs_list("parent")
9962///              .page_token("takimata")
9963///              .page_size(-46)
9964///              .order_by("voluptua.")
9965///              .filter("et")
9966///              .doit().await;
9967/// # }
9968/// ```
9969pub struct ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
9970where
9971    C: 'a,
9972{
9973    hub: &'a CloudDeploy<C>,
9974    _parent: String,
9975    _page_token: Option<String>,
9976    _page_size: Option<i32>,
9977    _order_by: Option<String>,
9978    _filter: Option<String>,
9979    _delegate: Option<&'a mut dyn common::Delegate>,
9980    _additional_params: HashMap<String, String>,
9981    _scopes: BTreeSet<String>,
9982}
9983
9984impl<'a, C> common::CallBuilder
9985    for ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
9986{
9987}
9988
9989impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
9990where
9991    C: common::Connector,
9992{
9993    /// Perform the operation you have build so far.
9994    pub async fn doit(mut self) -> common::Result<(common::Response, ListJobRunsResponse)> {
9995        use std::borrow::Cow;
9996        use std::io::{Read, Seek};
9997
9998        use common::{url::Params, ToParts};
9999        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10000
10001        let mut dd = common::DefaultDelegate;
10002        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10003        dlg.begin(common::MethodInfo {
10004            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.jobRuns.list",
10005            http_method: hyper::Method::GET,
10006        });
10007
10008        for &field in [
10009            "alt",
10010            "parent",
10011            "pageToken",
10012            "pageSize",
10013            "orderBy",
10014            "filter",
10015        ]
10016        .iter()
10017        {
10018            if self._additional_params.contains_key(field) {
10019                dlg.finished(false);
10020                return Err(common::Error::FieldClash(field));
10021            }
10022        }
10023
10024        let mut params = Params::with_capacity(7 + self._additional_params.len());
10025        params.push("parent", self._parent);
10026        if let Some(value) = self._page_token.as_ref() {
10027            params.push("pageToken", value);
10028        }
10029        if let Some(value) = self._page_size.as_ref() {
10030            params.push("pageSize", value.to_string());
10031        }
10032        if let Some(value) = self._order_by.as_ref() {
10033            params.push("orderBy", value);
10034        }
10035        if let Some(value) = self._filter.as_ref() {
10036            params.push("filter", value);
10037        }
10038
10039        params.extend(self._additional_params.iter());
10040
10041        params.push("alt", "json");
10042        let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobRuns";
10043        if self._scopes.is_empty() {
10044            self._scopes
10045                .insert(Scope::CloudPlatform.as_ref().to_string());
10046        }
10047
10048        #[allow(clippy::single_element_loop)]
10049        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10050            url = params.uri_replacement(url, param_name, find_this, true);
10051        }
10052        {
10053            let to_remove = ["parent"];
10054            params.remove_params(&to_remove);
10055        }
10056
10057        let url = params.parse_with_url(&url);
10058
10059        loop {
10060            let token = match self
10061                .hub
10062                .auth
10063                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10064                .await
10065            {
10066                Ok(token) => token,
10067                Err(e) => match dlg.token(e) {
10068                    Ok(token) => token,
10069                    Err(e) => {
10070                        dlg.finished(false);
10071                        return Err(common::Error::MissingToken(e));
10072                    }
10073                },
10074            };
10075            let mut req_result = {
10076                let client = &self.hub.client;
10077                dlg.pre_request();
10078                let mut req_builder = hyper::Request::builder()
10079                    .method(hyper::Method::GET)
10080                    .uri(url.as_str())
10081                    .header(USER_AGENT, self.hub._user_agent.clone());
10082
10083                if let Some(token) = token.as_ref() {
10084                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10085                }
10086
10087                let request = req_builder
10088                    .header(CONTENT_LENGTH, 0_u64)
10089                    .body(common::to_body::<String>(None));
10090
10091                client.request(request.unwrap()).await
10092            };
10093
10094            match req_result {
10095                Err(err) => {
10096                    if let common::Retry::After(d) = dlg.http_error(&err) {
10097                        sleep(d).await;
10098                        continue;
10099                    }
10100                    dlg.finished(false);
10101                    return Err(common::Error::HttpError(err));
10102                }
10103                Ok(res) => {
10104                    let (mut parts, body) = res.into_parts();
10105                    let mut body = common::Body::new(body);
10106                    if !parts.status.is_success() {
10107                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10108                        let error = serde_json::from_str(&common::to_string(&bytes));
10109                        let response = common::to_response(parts, bytes.into());
10110
10111                        if let common::Retry::After(d) =
10112                            dlg.http_failure(&response, error.as_ref().ok())
10113                        {
10114                            sleep(d).await;
10115                            continue;
10116                        }
10117
10118                        dlg.finished(false);
10119
10120                        return Err(match error {
10121                            Ok(value) => common::Error::BadRequest(value),
10122                            _ => common::Error::Failure(response),
10123                        });
10124                    }
10125                    let response = {
10126                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10127                        let encoded = common::to_string(&bytes);
10128                        match serde_json::from_str(&encoded) {
10129                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10130                            Err(error) => {
10131                                dlg.response_json_decode_error(&encoded, &error);
10132                                return Err(common::Error::JsonDecodeError(
10133                                    encoded.to_string(),
10134                                    error,
10135                                ));
10136                            }
10137                        }
10138                    };
10139
10140                    dlg.finished(true);
10141                    return Ok(response);
10142                }
10143            }
10144        }
10145    }
10146
10147    /// Required. The `Rollout` which owns this collection of `JobRun` objects.
10148    ///
10149    /// Sets the *parent* path property to the given value.
10150    ///
10151    /// Even though the property as already been set when instantiating this call,
10152    /// we provide this method for API completeness.
10153    pub fn parent(
10154        mut self,
10155        new_value: &str,
10156    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
10157        self._parent = new_value.to_string();
10158        self
10159    }
10160    /// Optional. A page token, received from a previous `ListJobRuns` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
10161    ///
10162    /// Sets the *page token* query property to the given value.
10163    pub fn page_token(
10164        mut self,
10165        new_value: &str,
10166    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
10167        self._page_token = Some(new_value.to_string());
10168        self
10169    }
10170    /// Optional. The maximum number of `JobRun` objects to return. The service may return fewer than this value. If unspecified, at most 50 `JobRun` objects will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
10171    ///
10172    /// Sets the *page size* query property to the given value.
10173    pub fn page_size(
10174        mut self,
10175        new_value: i32,
10176    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
10177        self._page_size = Some(new_value);
10178        self
10179    }
10180    /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
10181    ///
10182    /// Sets the *order by* query property to the given value.
10183    pub fn order_by(
10184        mut self,
10185        new_value: &str,
10186    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
10187        self._order_by = Some(new_value.to_string());
10188        self
10189    }
10190    /// Optional. Filter results to be returned. See https://google.aip.dev/160 for more details.
10191    ///
10192    /// Sets the *filter* query property to the given value.
10193    pub fn filter(
10194        mut self,
10195        new_value: &str,
10196    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
10197        self._filter = Some(new_value.to_string());
10198        self
10199    }
10200    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10201    /// while executing the actual API request.
10202    ///
10203    /// ````text
10204    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10205    /// ````
10206    ///
10207    /// Sets the *delegate* property to the given value.
10208    pub fn delegate(
10209        mut self,
10210        new_value: &'a mut dyn common::Delegate,
10211    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
10212        self._delegate = Some(new_value);
10213        self
10214    }
10215
10216    /// Set any additional parameter of the query string used in the request.
10217    /// It should be used to set parameters which are not yet available through their own
10218    /// setters.
10219    ///
10220    /// Please note that this method must not be used to set any of the known parameters
10221    /// which have their own setter method. If done anyway, the request will fail.
10222    ///
10223    /// # Additional Parameters
10224    ///
10225    /// * *$.xgafv* (query-string) - V1 error format.
10226    /// * *access_token* (query-string) - OAuth access token.
10227    /// * *alt* (query-string) - Data format for response.
10228    /// * *callback* (query-string) - JSONP
10229    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10230    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10231    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10232    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10233    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10234    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10235    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10236    pub fn param<T>(
10237        mut self,
10238        name: T,
10239        value: T,
10240    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
10241    where
10242        T: AsRef<str>,
10243    {
10244        self._additional_params
10245            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10246        self
10247    }
10248
10249    /// Identifies the authorization scope for the method you are building.
10250    ///
10251    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10252    /// [`Scope::CloudPlatform`].
10253    ///
10254    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10255    /// tokens for more than one scope.
10256    ///
10257    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10258    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10259    /// sufficient, a read-write scope will do as well.
10260    pub fn add_scope<St>(
10261        mut self,
10262        scope: St,
10263    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
10264    where
10265        St: AsRef<str>,
10266    {
10267        self._scopes.insert(String::from(scope.as_ref()));
10268        self
10269    }
10270    /// Identifies the authorization scope(s) for the method you are building.
10271    ///
10272    /// See [`Self::add_scope()`] for details.
10273    pub fn add_scopes<I, St>(
10274        mut self,
10275        scopes: I,
10276    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
10277    where
10278        I: IntoIterator<Item = St>,
10279        St: AsRef<str>,
10280    {
10281        self._scopes
10282            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10283        self
10284    }
10285
10286    /// Removes all scopes, and no default scope will be used either.
10287    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10288    /// for details).
10289    pub fn clear_scopes(
10290        mut self,
10291    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
10292        self._scopes.clear();
10293        self
10294    }
10295}
10296
10297/// Terminates a Job Run in a given project and location.
10298///
10299/// A builder for the *locations.deliveryPipelines.releases.rollouts.jobRuns.terminate* method supported by a *project* resource.
10300/// It is not used directly, but through a [`ProjectMethods`] instance.
10301///
10302/// # Example
10303///
10304/// Instantiate a resource method builder
10305///
10306/// ```test_harness,no_run
10307/// # extern crate hyper;
10308/// # extern crate hyper_rustls;
10309/// # extern crate google_clouddeploy1 as clouddeploy1;
10310/// use clouddeploy1::api::TerminateJobRunRequest;
10311/// # async fn dox() {
10312/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10313///
10314/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10315/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10316/// #     secret,
10317/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10318/// # ).build().await.unwrap();
10319///
10320/// # let client = hyper_util::client::legacy::Client::builder(
10321/// #     hyper_util::rt::TokioExecutor::new()
10322/// # )
10323/// # .build(
10324/// #     hyper_rustls::HttpsConnectorBuilder::new()
10325/// #         .with_native_roots()
10326/// #         .unwrap()
10327/// #         .https_or_http()
10328/// #         .enable_http1()
10329/// #         .build()
10330/// # );
10331/// # let mut hub = CloudDeploy::new(client, auth);
10332/// // As the method needs a request, you would usually fill it with the desired information
10333/// // into the respective structure. Some of the parts shown here might not be applicable !
10334/// // Values shown here are possibly random and not representative !
10335/// let mut req = TerminateJobRunRequest::default();
10336///
10337/// // You can configure optional parameters by calling the respective setters at will, and
10338/// // execute the final call using `doit()`.
10339/// // Values shown here are possibly random and not representative !
10340/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_job_runs_terminate(req, "name")
10341///              .doit().await;
10342/// # }
10343/// ```
10344pub struct ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
10345where
10346    C: 'a,
10347{
10348    hub: &'a CloudDeploy<C>,
10349    _request: TerminateJobRunRequest,
10350    _name: String,
10351    _delegate: Option<&'a mut dyn common::Delegate>,
10352    _additional_params: HashMap<String, String>,
10353    _scopes: BTreeSet<String>,
10354}
10355
10356impl<'a, C> common::CallBuilder
10357    for ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
10358{
10359}
10360
10361impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
10362where
10363    C: common::Connector,
10364{
10365    /// Perform the operation you have build so far.
10366    pub async fn doit(mut self) -> common::Result<(common::Response, TerminateJobRunResponse)> {
10367        use std::borrow::Cow;
10368        use std::io::{Read, Seek};
10369
10370        use common::{url::Params, ToParts};
10371        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10372
10373        let mut dd = common::DefaultDelegate;
10374        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10375        dlg.begin(common::MethodInfo { id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.jobRuns.terminate",
10376                               http_method: hyper::Method::POST });
10377
10378        for &field in ["alt", "name"].iter() {
10379            if self._additional_params.contains_key(field) {
10380                dlg.finished(false);
10381                return Err(common::Error::FieldClash(field));
10382            }
10383        }
10384
10385        let mut params = Params::with_capacity(4 + self._additional_params.len());
10386        params.push("name", self._name);
10387
10388        params.extend(self._additional_params.iter());
10389
10390        params.push("alt", "json");
10391        let mut url = self.hub._base_url.clone() + "v1/{+name}:terminate";
10392        if self._scopes.is_empty() {
10393            self._scopes
10394                .insert(Scope::CloudPlatform.as_ref().to_string());
10395        }
10396
10397        #[allow(clippy::single_element_loop)]
10398        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10399            url = params.uri_replacement(url, param_name, find_this, true);
10400        }
10401        {
10402            let to_remove = ["name"];
10403            params.remove_params(&to_remove);
10404        }
10405
10406        let url = params.parse_with_url(&url);
10407
10408        let mut json_mime_type = mime::APPLICATION_JSON;
10409        let mut request_value_reader = {
10410            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10411            common::remove_json_null_values(&mut value);
10412            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10413            serde_json::to_writer(&mut dst, &value).unwrap();
10414            dst
10415        };
10416        let request_size = request_value_reader
10417            .seek(std::io::SeekFrom::End(0))
10418            .unwrap();
10419        request_value_reader
10420            .seek(std::io::SeekFrom::Start(0))
10421            .unwrap();
10422
10423        loop {
10424            let token = match self
10425                .hub
10426                .auth
10427                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10428                .await
10429            {
10430                Ok(token) => token,
10431                Err(e) => match dlg.token(e) {
10432                    Ok(token) => token,
10433                    Err(e) => {
10434                        dlg.finished(false);
10435                        return Err(common::Error::MissingToken(e));
10436                    }
10437                },
10438            };
10439            request_value_reader
10440                .seek(std::io::SeekFrom::Start(0))
10441                .unwrap();
10442            let mut req_result = {
10443                let client = &self.hub.client;
10444                dlg.pre_request();
10445                let mut req_builder = hyper::Request::builder()
10446                    .method(hyper::Method::POST)
10447                    .uri(url.as_str())
10448                    .header(USER_AGENT, self.hub._user_agent.clone());
10449
10450                if let Some(token) = token.as_ref() {
10451                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10452                }
10453
10454                let request = req_builder
10455                    .header(CONTENT_TYPE, json_mime_type.to_string())
10456                    .header(CONTENT_LENGTH, request_size as u64)
10457                    .body(common::to_body(
10458                        request_value_reader.get_ref().clone().into(),
10459                    ));
10460
10461                client.request(request.unwrap()).await
10462            };
10463
10464            match req_result {
10465                Err(err) => {
10466                    if let common::Retry::After(d) = dlg.http_error(&err) {
10467                        sleep(d).await;
10468                        continue;
10469                    }
10470                    dlg.finished(false);
10471                    return Err(common::Error::HttpError(err));
10472                }
10473                Ok(res) => {
10474                    let (mut parts, body) = res.into_parts();
10475                    let mut body = common::Body::new(body);
10476                    if !parts.status.is_success() {
10477                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10478                        let error = serde_json::from_str(&common::to_string(&bytes));
10479                        let response = common::to_response(parts, bytes.into());
10480
10481                        if let common::Retry::After(d) =
10482                            dlg.http_failure(&response, error.as_ref().ok())
10483                        {
10484                            sleep(d).await;
10485                            continue;
10486                        }
10487
10488                        dlg.finished(false);
10489
10490                        return Err(match error {
10491                            Ok(value) => common::Error::BadRequest(value),
10492                            _ => common::Error::Failure(response),
10493                        });
10494                    }
10495                    let response = {
10496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10497                        let encoded = common::to_string(&bytes);
10498                        match serde_json::from_str(&encoded) {
10499                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10500                            Err(error) => {
10501                                dlg.response_json_decode_error(&encoded, &error);
10502                                return Err(common::Error::JsonDecodeError(
10503                                    encoded.to_string(),
10504                                    error,
10505                                ));
10506                            }
10507                        }
10508                    };
10509
10510                    dlg.finished(true);
10511                    return Ok(response);
10512                }
10513            }
10514        }
10515    }
10516
10517    ///
10518    /// Sets the *request* property to the given value.
10519    ///
10520    /// Even though the property as already been set when instantiating this call,
10521    /// we provide this method for API completeness.
10522    pub fn request(
10523        mut self,
10524        new_value: TerminateJobRunRequest,
10525    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
10526        self._request = new_value;
10527        self
10528    }
10529    /// Required. Name of the `JobRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}`.
10530    ///
10531    /// Sets the *name* path property to the given value.
10532    ///
10533    /// Even though the property as already been set when instantiating this call,
10534    /// we provide this method for API completeness.
10535    pub fn name(
10536        mut self,
10537        new_value: &str,
10538    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
10539        self._name = new_value.to_string();
10540        self
10541    }
10542    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10543    /// while executing the actual API request.
10544    ///
10545    /// ````text
10546    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10547    /// ````
10548    ///
10549    /// Sets the *delegate* property to the given value.
10550    pub fn delegate(
10551        mut self,
10552        new_value: &'a mut dyn common::Delegate,
10553    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
10554        self._delegate = Some(new_value);
10555        self
10556    }
10557
10558    /// Set any additional parameter of the query string used in the request.
10559    /// It should be used to set parameters which are not yet available through their own
10560    /// setters.
10561    ///
10562    /// Please note that this method must not be used to set any of the known parameters
10563    /// which have their own setter method. If done anyway, the request will fail.
10564    ///
10565    /// # Additional Parameters
10566    ///
10567    /// * *$.xgafv* (query-string) - V1 error format.
10568    /// * *access_token* (query-string) - OAuth access token.
10569    /// * *alt* (query-string) - Data format for response.
10570    /// * *callback* (query-string) - JSONP
10571    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10572    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10573    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10574    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10575    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10576    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10577    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10578    pub fn param<T>(
10579        mut self,
10580        name: T,
10581        value: T,
10582    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
10583    where
10584        T: AsRef<str>,
10585    {
10586        self._additional_params
10587            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10588        self
10589    }
10590
10591    /// Identifies the authorization scope for the method you are building.
10592    ///
10593    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10594    /// [`Scope::CloudPlatform`].
10595    ///
10596    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10597    /// tokens for more than one scope.
10598    ///
10599    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10600    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10601    /// sufficient, a read-write scope will do as well.
10602    pub fn add_scope<St>(
10603        mut self,
10604        scope: St,
10605    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
10606    where
10607        St: AsRef<str>,
10608    {
10609        self._scopes.insert(String::from(scope.as_ref()));
10610        self
10611    }
10612    /// Identifies the authorization scope(s) for the method you are building.
10613    ///
10614    /// See [`Self::add_scope()`] for details.
10615    pub fn add_scopes<I, St>(
10616        mut self,
10617        scopes: I,
10618    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
10619    where
10620        I: IntoIterator<Item = St>,
10621        St: AsRef<str>,
10622    {
10623        self._scopes
10624            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10625        self
10626    }
10627
10628    /// Removes all scopes, and no default scope will be used either.
10629    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10630    /// for details).
10631    pub fn clear_scopes(
10632        mut self,
10633    ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
10634        self._scopes.clear();
10635        self
10636    }
10637}
10638
10639/// Advances a Rollout in a given project and location.
10640///
10641/// A builder for the *locations.deliveryPipelines.releases.rollouts.advance* method supported by a *project* resource.
10642/// It is not used directly, but through a [`ProjectMethods`] instance.
10643///
10644/// # Example
10645///
10646/// Instantiate a resource method builder
10647///
10648/// ```test_harness,no_run
10649/// # extern crate hyper;
10650/// # extern crate hyper_rustls;
10651/// # extern crate google_clouddeploy1 as clouddeploy1;
10652/// use clouddeploy1::api::AdvanceRolloutRequest;
10653/// # async fn dox() {
10654/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10655///
10656/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10657/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10658/// #     secret,
10659/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10660/// # ).build().await.unwrap();
10661///
10662/// # let client = hyper_util::client::legacy::Client::builder(
10663/// #     hyper_util::rt::TokioExecutor::new()
10664/// # )
10665/// # .build(
10666/// #     hyper_rustls::HttpsConnectorBuilder::new()
10667/// #         .with_native_roots()
10668/// #         .unwrap()
10669/// #         .https_or_http()
10670/// #         .enable_http1()
10671/// #         .build()
10672/// # );
10673/// # let mut hub = CloudDeploy::new(client, auth);
10674/// // As the method needs a request, you would usually fill it with the desired information
10675/// // into the respective structure. Some of the parts shown here might not be applicable !
10676/// // Values shown here are possibly random and not representative !
10677/// let mut req = AdvanceRolloutRequest::default();
10678///
10679/// // You can configure optional parameters by calling the respective setters at will, and
10680/// // execute the final call using `doit()`.
10681/// // Values shown here are possibly random and not representative !
10682/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_advance(req, "name")
10683///              .doit().await;
10684/// # }
10685/// ```
10686pub struct ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
10687where
10688    C: 'a,
10689{
10690    hub: &'a CloudDeploy<C>,
10691    _request: AdvanceRolloutRequest,
10692    _name: String,
10693    _delegate: Option<&'a mut dyn common::Delegate>,
10694    _additional_params: HashMap<String, String>,
10695    _scopes: BTreeSet<String>,
10696}
10697
10698impl<'a, C> common::CallBuilder
10699    for ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
10700{
10701}
10702
10703impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
10704where
10705    C: common::Connector,
10706{
10707    /// Perform the operation you have build so far.
10708    pub async fn doit(mut self) -> common::Result<(common::Response, AdvanceRolloutResponse)> {
10709        use std::borrow::Cow;
10710        use std::io::{Read, Seek};
10711
10712        use common::{url::Params, ToParts};
10713        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10714
10715        let mut dd = common::DefaultDelegate;
10716        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10717        dlg.begin(common::MethodInfo {
10718            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.advance",
10719            http_method: hyper::Method::POST,
10720        });
10721
10722        for &field in ["alt", "name"].iter() {
10723            if self._additional_params.contains_key(field) {
10724                dlg.finished(false);
10725                return Err(common::Error::FieldClash(field));
10726            }
10727        }
10728
10729        let mut params = Params::with_capacity(4 + self._additional_params.len());
10730        params.push("name", self._name);
10731
10732        params.extend(self._additional_params.iter());
10733
10734        params.push("alt", "json");
10735        let mut url = self.hub._base_url.clone() + "v1/{+name}:advance";
10736        if self._scopes.is_empty() {
10737            self._scopes
10738                .insert(Scope::CloudPlatform.as_ref().to_string());
10739        }
10740
10741        #[allow(clippy::single_element_loop)]
10742        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10743            url = params.uri_replacement(url, param_name, find_this, true);
10744        }
10745        {
10746            let to_remove = ["name"];
10747            params.remove_params(&to_remove);
10748        }
10749
10750        let url = params.parse_with_url(&url);
10751
10752        let mut json_mime_type = mime::APPLICATION_JSON;
10753        let mut request_value_reader = {
10754            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10755            common::remove_json_null_values(&mut value);
10756            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10757            serde_json::to_writer(&mut dst, &value).unwrap();
10758            dst
10759        };
10760        let request_size = request_value_reader
10761            .seek(std::io::SeekFrom::End(0))
10762            .unwrap();
10763        request_value_reader
10764            .seek(std::io::SeekFrom::Start(0))
10765            .unwrap();
10766
10767        loop {
10768            let token = match self
10769                .hub
10770                .auth
10771                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10772                .await
10773            {
10774                Ok(token) => token,
10775                Err(e) => match dlg.token(e) {
10776                    Ok(token) => token,
10777                    Err(e) => {
10778                        dlg.finished(false);
10779                        return Err(common::Error::MissingToken(e));
10780                    }
10781                },
10782            };
10783            request_value_reader
10784                .seek(std::io::SeekFrom::Start(0))
10785                .unwrap();
10786            let mut req_result = {
10787                let client = &self.hub.client;
10788                dlg.pre_request();
10789                let mut req_builder = hyper::Request::builder()
10790                    .method(hyper::Method::POST)
10791                    .uri(url.as_str())
10792                    .header(USER_AGENT, self.hub._user_agent.clone());
10793
10794                if let Some(token) = token.as_ref() {
10795                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10796                }
10797
10798                let request = req_builder
10799                    .header(CONTENT_TYPE, json_mime_type.to_string())
10800                    .header(CONTENT_LENGTH, request_size as u64)
10801                    .body(common::to_body(
10802                        request_value_reader.get_ref().clone().into(),
10803                    ));
10804
10805                client.request(request.unwrap()).await
10806            };
10807
10808            match req_result {
10809                Err(err) => {
10810                    if let common::Retry::After(d) = dlg.http_error(&err) {
10811                        sleep(d).await;
10812                        continue;
10813                    }
10814                    dlg.finished(false);
10815                    return Err(common::Error::HttpError(err));
10816                }
10817                Ok(res) => {
10818                    let (mut parts, body) = res.into_parts();
10819                    let mut body = common::Body::new(body);
10820                    if !parts.status.is_success() {
10821                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10822                        let error = serde_json::from_str(&common::to_string(&bytes));
10823                        let response = common::to_response(parts, bytes.into());
10824
10825                        if let common::Retry::After(d) =
10826                            dlg.http_failure(&response, error.as_ref().ok())
10827                        {
10828                            sleep(d).await;
10829                            continue;
10830                        }
10831
10832                        dlg.finished(false);
10833
10834                        return Err(match error {
10835                            Ok(value) => common::Error::BadRequest(value),
10836                            _ => common::Error::Failure(response),
10837                        });
10838                    }
10839                    let response = {
10840                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10841                        let encoded = common::to_string(&bytes);
10842                        match serde_json::from_str(&encoded) {
10843                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10844                            Err(error) => {
10845                                dlg.response_json_decode_error(&encoded, &error);
10846                                return Err(common::Error::JsonDecodeError(
10847                                    encoded.to_string(),
10848                                    error,
10849                                ));
10850                            }
10851                        }
10852                    };
10853
10854                    dlg.finished(true);
10855                    return Ok(response);
10856                }
10857            }
10858        }
10859    }
10860
10861    ///
10862    /// Sets the *request* property to the given value.
10863    ///
10864    /// Even though the property as already been set when instantiating this call,
10865    /// we provide this method for API completeness.
10866    pub fn request(
10867        mut self,
10868        new_value: AdvanceRolloutRequest,
10869    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
10870        self._request = new_value;
10871        self
10872    }
10873    /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
10874    ///
10875    /// Sets the *name* path property to the given value.
10876    ///
10877    /// Even though the property as already been set when instantiating this call,
10878    /// we provide this method for API completeness.
10879    pub fn name(
10880        mut self,
10881        new_value: &str,
10882    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
10883        self._name = new_value.to_string();
10884        self
10885    }
10886    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10887    /// while executing the actual API request.
10888    ///
10889    /// ````text
10890    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10891    /// ````
10892    ///
10893    /// Sets the *delegate* property to the given value.
10894    pub fn delegate(
10895        mut self,
10896        new_value: &'a mut dyn common::Delegate,
10897    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
10898        self._delegate = Some(new_value);
10899        self
10900    }
10901
10902    /// Set any additional parameter of the query string used in the request.
10903    /// It should be used to set parameters which are not yet available through their own
10904    /// setters.
10905    ///
10906    /// Please note that this method must not be used to set any of the known parameters
10907    /// which have their own setter method. If done anyway, the request will fail.
10908    ///
10909    /// # Additional Parameters
10910    ///
10911    /// * *$.xgafv* (query-string) - V1 error format.
10912    /// * *access_token* (query-string) - OAuth access token.
10913    /// * *alt* (query-string) - Data format for response.
10914    /// * *callback* (query-string) - JSONP
10915    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10916    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
10917    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10918    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10919    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
10920    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10921    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10922    pub fn param<T>(
10923        mut self,
10924        name: T,
10925        value: T,
10926    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
10927    where
10928        T: AsRef<str>,
10929    {
10930        self._additional_params
10931            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10932        self
10933    }
10934
10935    /// Identifies the authorization scope for the method you are building.
10936    ///
10937    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10938    /// [`Scope::CloudPlatform`].
10939    ///
10940    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10941    /// tokens for more than one scope.
10942    ///
10943    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10944    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10945    /// sufficient, a read-write scope will do as well.
10946    pub fn add_scope<St>(
10947        mut self,
10948        scope: St,
10949    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
10950    where
10951        St: AsRef<str>,
10952    {
10953        self._scopes.insert(String::from(scope.as_ref()));
10954        self
10955    }
10956    /// Identifies the authorization scope(s) for the method you are building.
10957    ///
10958    /// See [`Self::add_scope()`] for details.
10959    pub fn add_scopes<I, St>(
10960        mut self,
10961        scopes: I,
10962    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
10963    where
10964        I: IntoIterator<Item = St>,
10965        St: AsRef<str>,
10966    {
10967        self._scopes
10968            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10969        self
10970    }
10971
10972    /// Removes all scopes, and no default scope will be used either.
10973    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10974    /// for details).
10975    pub fn clear_scopes(
10976        mut self,
10977    ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
10978        self._scopes.clear();
10979        self
10980    }
10981}
10982
10983/// Approves a Rollout.
10984///
10985/// A builder for the *locations.deliveryPipelines.releases.rollouts.approve* method supported by a *project* resource.
10986/// It is not used directly, but through a [`ProjectMethods`] instance.
10987///
10988/// # Example
10989///
10990/// Instantiate a resource method builder
10991///
10992/// ```test_harness,no_run
10993/// # extern crate hyper;
10994/// # extern crate hyper_rustls;
10995/// # extern crate google_clouddeploy1 as clouddeploy1;
10996/// use clouddeploy1::api::ApproveRolloutRequest;
10997/// # async fn dox() {
10998/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10999///
11000/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11001/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11002/// #     secret,
11003/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11004/// # ).build().await.unwrap();
11005///
11006/// # let client = hyper_util::client::legacy::Client::builder(
11007/// #     hyper_util::rt::TokioExecutor::new()
11008/// # )
11009/// # .build(
11010/// #     hyper_rustls::HttpsConnectorBuilder::new()
11011/// #         .with_native_roots()
11012/// #         .unwrap()
11013/// #         .https_or_http()
11014/// #         .enable_http1()
11015/// #         .build()
11016/// # );
11017/// # let mut hub = CloudDeploy::new(client, auth);
11018/// // As the method needs a request, you would usually fill it with the desired information
11019/// // into the respective structure. Some of the parts shown here might not be applicable !
11020/// // Values shown here are possibly random and not representative !
11021/// let mut req = ApproveRolloutRequest::default();
11022///
11023/// // You can configure optional parameters by calling the respective setters at will, and
11024/// // execute the final call using `doit()`.
11025/// // Values shown here are possibly random and not representative !
11026/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_approve(req, "name")
11027///              .doit().await;
11028/// # }
11029/// ```
11030pub struct ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
11031where
11032    C: 'a,
11033{
11034    hub: &'a CloudDeploy<C>,
11035    _request: ApproveRolloutRequest,
11036    _name: String,
11037    _delegate: Option<&'a mut dyn common::Delegate>,
11038    _additional_params: HashMap<String, String>,
11039    _scopes: BTreeSet<String>,
11040}
11041
11042impl<'a, C> common::CallBuilder
11043    for ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
11044{
11045}
11046
11047impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
11048where
11049    C: common::Connector,
11050{
11051    /// Perform the operation you have build so far.
11052    pub async fn doit(mut self) -> common::Result<(common::Response, ApproveRolloutResponse)> {
11053        use std::borrow::Cow;
11054        use std::io::{Read, Seek};
11055
11056        use common::{url::Params, ToParts};
11057        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11058
11059        let mut dd = common::DefaultDelegate;
11060        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11061        dlg.begin(common::MethodInfo {
11062            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.approve",
11063            http_method: hyper::Method::POST,
11064        });
11065
11066        for &field in ["alt", "name"].iter() {
11067            if self._additional_params.contains_key(field) {
11068                dlg.finished(false);
11069                return Err(common::Error::FieldClash(field));
11070            }
11071        }
11072
11073        let mut params = Params::with_capacity(4 + self._additional_params.len());
11074        params.push("name", self._name);
11075
11076        params.extend(self._additional_params.iter());
11077
11078        params.push("alt", "json");
11079        let mut url = self.hub._base_url.clone() + "v1/{+name}:approve";
11080        if self._scopes.is_empty() {
11081            self._scopes
11082                .insert(Scope::CloudPlatform.as_ref().to_string());
11083        }
11084
11085        #[allow(clippy::single_element_loop)]
11086        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11087            url = params.uri_replacement(url, param_name, find_this, true);
11088        }
11089        {
11090            let to_remove = ["name"];
11091            params.remove_params(&to_remove);
11092        }
11093
11094        let url = params.parse_with_url(&url);
11095
11096        let mut json_mime_type = mime::APPLICATION_JSON;
11097        let mut request_value_reader = {
11098            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11099            common::remove_json_null_values(&mut value);
11100            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11101            serde_json::to_writer(&mut dst, &value).unwrap();
11102            dst
11103        };
11104        let request_size = request_value_reader
11105            .seek(std::io::SeekFrom::End(0))
11106            .unwrap();
11107        request_value_reader
11108            .seek(std::io::SeekFrom::Start(0))
11109            .unwrap();
11110
11111        loop {
11112            let token = match self
11113                .hub
11114                .auth
11115                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11116                .await
11117            {
11118                Ok(token) => token,
11119                Err(e) => match dlg.token(e) {
11120                    Ok(token) => token,
11121                    Err(e) => {
11122                        dlg.finished(false);
11123                        return Err(common::Error::MissingToken(e));
11124                    }
11125                },
11126            };
11127            request_value_reader
11128                .seek(std::io::SeekFrom::Start(0))
11129                .unwrap();
11130            let mut req_result = {
11131                let client = &self.hub.client;
11132                dlg.pre_request();
11133                let mut req_builder = hyper::Request::builder()
11134                    .method(hyper::Method::POST)
11135                    .uri(url.as_str())
11136                    .header(USER_AGENT, self.hub._user_agent.clone());
11137
11138                if let Some(token) = token.as_ref() {
11139                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11140                }
11141
11142                let request = req_builder
11143                    .header(CONTENT_TYPE, json_mime_type.to_string())
11144                    .header(CONTENT_LENGTH, request_size as u64)
11145                    .body(common::to_body(
11146                        request_value_reader.get_ref().clone().into(),
11147                    ));
11148
11149                client.request(request.unwrap()).await
11150            };
11151
11152            match req_result {
11153                Err(err) => {
11154                    if let common::Retry::After(d) = dlg.http_error(&err) {
11155                        sleep(d).await;
11156                        continue;
11157                    }
11158                    dlg.finished(false);
11159                    return Err(common::Error::HttpError(err));
11160                }
11161                Ok(res) => {
11162                    let (mut parts, body) = res.into_parts();
11163                    let mut body = common::Body::new(body);
11164                    if !parts.status.is_success() {
11165                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11166                        let error = serde_json::from_str(&common::to_string(&bytes));
11167                        let response = common::to_response(parts, bytes.into());
11168
11169                        if let common::Retry::After(d) =
11170                            dlg.http_failure(&response, error.as_ref().ok())
11171                        {
11172                            sleep(d).await;
11173                            continue;
11174                        }
11175
11176                        dlg.finished(false);
11177
11178                        return Err(match error {
11179                            Ok(value) => common::Error::BadRequest(value),
11180                            _ => common::Error::Failure(response),
11181                        });
11182                    }
11183                    let response = {
11184                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11185                        let encoded = common::to_string(&bytes);
11186                        match serde_json::from_str(&encoded) {
11187                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11188                            Err(error) => {
11189                                dlg.response_json_decode_error(&encoded, &error);
11190                                return Err(common::Error::JsonDecodeError(
11191                                    encoded.to_string(),
11192                                    error,
11193                                ));
11194                            }
11195                        }
11196                    };
11197
11198                    dlg.finished(true);
11199                    return Ok(response);
11200                }
11201            }
11202        }
11203    }
11204
11205    ///
11206    /// Sets the *request* property to the given value.
11207    ///
11208    /// Even though the property as already been set when instantiating this call,
11209    /// we provide this method for API completeness.
11210    pub fn request(
11211        mut self,
11212        new_value: ApproveRolloutRequest,
11213    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
11214        self._request = new_value;
11215        self
11216    }
11217    /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
11218    ///
11219    /// Sets the *name* path property to the given value.
11220    ///
11221    /// Even though the property as already been set when instantiating this call,
11222    /// we provide this method for API completeness.
11223    pub fn name(
11224        mut self,
11225        new_value: &str,
11226    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
11227        self._name = new_value.to_string();
11228        self
11229    }
11230    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11231    /// while executing the actual API request.
11232    ///
11233    /// ````text
11234    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11235    /// ````
11236    ///
11237    /// Sets the *delegate* property to the given value.
11238    pub fn delegate(
11239        mut self,
11240        new_value: &'a mut dyn common::Delegate,
11241    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
11242        self._delegate = Some(new_value);
11243        self
11244    }
11245
11246    /// Set any additional parameter of the query string used in the request.
11247    /// It should be used to set parameters which are not yet available through their own
11248    /// setters.
11249    ///
11250    /// Please note that this method must not be used to set any of the known parameters
11251    /// which have their own setter method. If done anyway, the request will fail.
11252    ///
11253    /// # Additional Parameters
11254    ///
11255    /// * *$.xgafv* (query-string) - V1 error format.
11256    /// * *access_token* (query-string) - OAuth access token.
11257    /// * *alt* (query-string) - Data format for response.
11258    /// * *callback* (query-string) - JSONP
11259    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11260    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11261    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11262    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11263    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11264    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11265    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11266    pub fn param<T>(
11267        mut self,
11268        name: T,
11269        value: T,
11270    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
11271    where
11272        T: AsRef<str>,
11273    {
11274        self._additional_params
11275            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11276        self
11277    }
11278
11279    /// Identifies the authorization scope for the method you are building.
11280    ///
11281    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11282    /// [`Scope::CloudPlatform`].
11283    ///
11284    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11285    /// tokens for more than one scope.
11286    ///
11287    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11288    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11289    /// sufficient, a read-write scope will do as well.
11290    pub fn add_scope<St>(
11291        mut self,
11292        scope: St,
11293    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
11294    where
11295        St: AsRef<str>,
11296    {
11297        self._scopes.insert(String::from(scope.as_ref()));
11298        self
11299    }
11300    /// Identifies the authorization scope(s) for the method you are building.
11301    ///
11302    /// See [`Self::add_scope()`] for details.
11303    pub fn add_scopes<I, St>(
11304        mut self,
11305        scopes: I,
11306    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
11307    where
11308        I: IntoIterator<Item = St>,
11309        St: AsRef<str>,
11310    {
11311        self._scopes
11312            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11313        self
11314    }
11315
11316    /// Removes all scopes, and no default scope will be used either.
11317    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11318    /// for details).
11319    pub fn clear_scopes(
11320        mut self,
11321    ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
11322        self._scopes.clear();
11323        self
11324    }
11325}
11326
11327/// Cancels a Rollout in a given project and location.
11328///
11329/// A builder for the *locations.deliveryPipelines.releases.rollouts.cancel* method supported by a *project* resource.
11330/// It is not used directly, but through a [`ProjectMethods`] instance.
11331///
11332/// # Example
11333///
11334/// Instantiate a resource method builder
11335///
11336/// ```test_harness,no_run
11337/// # extern crate hyper;
11338/// # extern crate hyper_rustls;
11339/// # extern crate google_clouddeploy1 as clouddeploy1;
11340/// use clouddeploy1::api::CancelRolloutRequest;
11341/// # async fn dox() {
11342/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11343///
11344/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11345/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11346/// #     secret,
11347/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11348/// # ).build().await.unwrap();
11349///
11350/// # let client = hyper_util::client::legacy::Client::builder(
11351/// #     hyper_util::rt::TokioExecutor::new()
11352/// # )
11353/// # .build(
11354/// #     hyper_rustls::HttpsConnectorBuilder::new()
11355/// #         .with_native_roots()
11356/// #         .unwrap()
11357/// #         .https_or_http()
11358/// #         .enable_http1()
11359/// #         .build()
11360/// # );
11361/// # let mut hub = CloudDeploy::new(client, auth);
11362/// // As the method needs a request, you would usually fill it with the desired information
11363/// // into the respective structure. Some of the parts shown here might not be applicable !
11364/// // Values shown here are possibly random and not representative !
11365/// let mut req = CancelRolloutRequest::default();
11366///
11367/// // You can configure optional parameters by calling the respective setters at will, and
11368/// // execute the final call using `doit()`.
11369/// // Values shown here are possibly random and not representative !
11370/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_cancel(req, "name")
11371///              .doit().await;
11372/// # }
11373/// ```
11374pub struct ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
11375where
11376    C: 'a,
11377{
11378    hub: &'a CloudDeploy<C>,
11379    _request: CancelRolloutRequest,
11380    _name: String,
11381    _delegate: Option<&'a mut dyn common::Delegate>,
11382    _additional_params: HashMap<String, String>,
11383    _scopes: BTreeSet<String>,
11384}
11385
11386impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {}
11387
11388impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
11389where
11390    C: common::Connector,
11391{
11392    /// Perform the operation you have build so far.
11393    pub async fn doit(mut self) -> common::Result<(common::Response, CancelRolloutResponse)> {
11394        use std::borrow::Cow;
11395        use std::io::{Read, Seek};
11396
11397        use common::{url::Params, ToParts};
11398        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11399
11400        let mut dd = common::DefaultDelegate;
11401        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11402        dlg.begin(common::MethodInfo {
11403            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.cancel",
11404            http_method: hyper::Method::POST,
11405        });
11406
11407        for &field in ["alt", "name"].iter() {
11408            if self._additional_params.contains_key(field) {
11409                dlg.finished(false);
11410                return Err(common::Error::FieldClash(field));
11411            }
11412        }
11413
11414        let mut params = Params::with_capacity(4 + self._additional_params.len());
11415        params.push("name", self._name);
11416
11417        params.extend(self._additional_params.iter());
11418
11419        params.push("alt", "json");
11420        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
11421        if self._scopes.is_empty() {
11422            self._scopes
11423                .insert(Scope::CloudPlatform.as_ref().to_string());
11424        }
11425
11426        #[allow(clippy::single_element_loop)]
11427        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11428            url = params.uri_replacement(url, param_name, find_this, true);
11429        }
11430        {
11431            let to_remove = ["name"];
11432            params.remove_params(&to_remove);
11433        }
11434
11435        let url = params.parse_with_url(&url);
11436
11437        let mut json_mime_type = mime::APPLICATION_JSON;
11438        let mut request_value_reader = {
11439            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11440            common::remove_json_null_values(&mut value);
11441            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11442            serde_json::to_writer(&mut dst, &value).unwrap();
11443            dst
11444        };
11445        let request_size = request_value_reader
11446            .seek(std::io::SeekFrom::End(0))
11447            .unwrap();
11448        request_value_reader
11449            .seek(std::io::SeekFrom::Start(0))
11450            .unwrap();
11451
11452        loop {
11453            let token = match self
11454                .hub
11455                .auth
11456                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11457                .await
11458            {
11459                Ok(token) => token,
11460                Err(e) => match dlg.token(e) {
11461                    Ok(token) => token,
11462                    Err(e) => {
11463                        dlg.finished(false);
11464                        return Err(common::Error::MissingToken(e));
11465                    }
11466                },
11467            };
11468            request_value_reader
11469                .seek(std::io::SeekFrom::Start(0))
11470                .unwrap();
11471            let mut req_result = {
11472                let client = &self.hub.client;
11473                dlg.pre_request();
11474                let mut req_builder = hyper::Request::builder()
11475                    .method(hyper::Method::POST)
11476                    .uri(url.as_str())
11477                    .header(USER_AGENT, self.hub._user_agent.clone());
11478
11479                if let Some(token) = token.as_ref() {
11480                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11481                }
11482
11483                let request = req_builder
11484                    .header(CONTENT_TYPE, json_mime_type.to_string())
11485                    .header(CONTENT_LENGTH, request_size as u64)
11486                    .body(common::to_body(
11487                        request_value_reader.get_ref().clone().into(),
11488                    ));
11489
11490                client.request(request.unwrap()).await
11491            };
11492
11493            match req_result {
11494                Err(err) => {
11495                    if let common::Retry::After(d) = dlg.http_error(&err) {
11496                        sleep(d).await;
11497                        continue;
11498                    }
11499                    dlg.finished(false);
11500                    return Err(common::Error::HttpError(err));
11501                }
11502                Ok(res) => {
11503                    let (mut parts, body) = res.into_parts();
11504                    let mut body = common::Body::new(body);
11505                    if !parts.status.is_success() {
11506                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11507                        let error = serde_json::from_str(&common::to_string(&bytes));
11508                        let response = common::to_response(parts, bytes.into());
11509
11510                        if let common::Retry::After(d) =
11511                            dlg.http_failure(&response, error.as_ref().ok())
11512                        {
11513                            sleep(d).await;
11514                            continue;
11515                        }
11516
11517                        dlg.finished(false);
11518
11519                        return Err(match error {
11520                            Ok(value) => common::Error::BadRequest(value),
11521                            _ => common::Error::Failure(response),
11522                        });
11523                    }
11524                    let response = {
11525                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11526                        let encoded = common::to_string(&bytes);
11527                        match serde_json::from_str(&encoded) {
11528                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11529                            Err(error) => {
11530                                dlg.response_json_decode_error(&encoded, &error);
11531                                return Err(common::Error::JsonDecodeError(
11532                                    encoded.to_string(),
11533                                    error,
11534                                ));
11535                            }
11536                        }
11537                    };
11538
11539                    dlg.finished(true);
11540                    return Ok(response);
11541                }
11542            }
11543        }
11544    }
11545
11546    ///
11547    /// Sets the *request* property to the given value.
11548    ///
11549    /// Even though the property as already been set when instantiating this call,
11550    /// we provide this method for API completeness.
11551    pub fn request(
11552        mut self,
11553        new_value: CancelRolloutRequest,
11554    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
11555        self._request = new_value;
11556        self
11557    }
11558    /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
11559    ///
11560    /// Sets the *name* path property to the given value.
11561    ///
11562    /// Even though the property as already been set when instantiating this call,
11563    /// we provide this method for API completeness.
11564    pub fn name(
11565        mut self,
11566        new_value: &str,
11567    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
11568        self._name = new_value.to_string();
11569        self
11570    }
11571    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11572    /// while executing the actual API request.
11573    ///
11574    /// ````text
11575    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11576    /// ````
11577    ///
11578    /// Sets the *delegate* property to the given value.
11579    pub fn delegate(
11580        mut self,
11581        new_value: &'a mut dyn common::Delegate,
11582    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
11583        self._delegate = Some(new_value);
11584        self
11585    }
11586
11587    /// Set any additional parameter of the query string used in the request.
11588    /// It should be used to set parameters which are not yet available through their own
11589    /// setters.
11590    ///
11591    /// Please note that this method must not be used to set any of the known parameters
11592    /// which have their own setter method. If done anyway, the request will fail.
11593    ///
11594    /// # Additional Parameters
11595    ///
11596    /// * *$.xgafv* (query-string) - V1 error format.
11597    /// * *access_token* (query-string) - OAuth access token.
11598    /// * *alt* (query-string) - Data format for response.
11599    /// * *callback* (query-string) - JSONP
11600    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11601    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
11602    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11603    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11604    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
11605    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11606    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11607    pub fn param<T>(
11608        mut self,
11609        name: T,
11610        value: T,
11611    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
11612    where
11613        T: AsRef<str>,
11614    {
11615        self._additional_params
11616            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11617        self
11618    }
11619
11620    /// Identifies the authorization scope for the method you are building.
11621    ///
11622    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11623    /// [`Scope::CloudPlatform`].
11624    ///
11625    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11626    /// tokens for more than one scope.
11627    ///
11628    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11629    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11630    /// sufficient, a read-write scope will do as well.
11631    pub fn add_scope<St>(
11632        mut self,
11633        scope: St,
11634    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
11635    where
11636        St: AsRef<str>,
11637    {
11638        self._scopes.insert(String::from(scope.as_ref()));
11639        self
11640    }
11641    /// Identifies the authorization scope(s) for the method you are building.
11642    ///
11643    /// See [`Self::add_scope()`] for details.
11644    pub fn add_scopes<I, St>(
11645        mut self,
11646        scopes: I,
11647    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
11648    where
11649        I: IntoIterator<Item = St>,
11650        St: AsRef<str>,
11651    {
11652        self._scopes
11653            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11654        self
11655    }
11656
11657    /// Removes all scopes, and no default scope will be used either.
11658    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11659    /// for details).
11660    pub fn clear_scopes(
11661        mut self,
11662    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
11663        self._scopes.clear();
11664        self
11665    }
11666}
11667
11668/// Creates a new Rollout in a given project and location.
11669///
11670/// A builder for the *locations.deliveryPipelines.releases.rollouts.create* method supported by a *project* resource.
11671/// It is not used directly, but through a [`ProjectMethods`] instance.
11672///
11673/// # Example
11674///
11675/// Instantiate a resource method builder
11676///
11677/// ```test_harness,no_run
11678/// # extern crate hyper;
11679/// # extern crate hyper_rustls;
11680/// # extern crate google_clouddeploy1 as clouddeploy1;
11681/// use clouddeploy1::api::Rollout;
11682/// # async fn dox() {
11683/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11684///
11685/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11686/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11687/// #     secret,
11688/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11689/// # ).build().await.unwrap();
11690///
11691/// # let client = hyper_util::client::legacy::Client::builder(
11692/// #     hyper_util::rt::TokioExecutor::new()
11693/// # )
11694/// # .build(
11695/// #     hyper_rustls::HttpsConnectorBuilder::new()
11696/// #         .with_native_roots()
11697/// #         .unwrap()
11698/// #         .https_or_http()
11699/// #         .enable_http1()
11700/// #         .build()
11701/// # );
11702/// # let mut hub = CloudDeploy::new(client, auth);
11703/// // As the method needs a request, you would usually fill it with the desired information
11704/// // into the respective structure. Some of the parts shown here might not be applicable !
11705/// // Values shown here are possibly random and not representative !
11706/// let mut req = Rollout::default();
11707///
11708/// // You can configure optional parameters by calling the respective setters at will, and
11709/// // execute the final call using `doit()`.
11710/// // Values shown here are possibly random and not representative !
11711/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_create(req, "parent")
11712///              .validate_only(true)
11713///              .starting_phase_id("et")
11714///              .rollout_id("accusam")
11715///              .request_id("voluptua.")
11716///              .doit().await;
11717/// # }
11718/// ```
11719pub struct ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
11720where
11721    C: 'a,
11722{
11723    hub: &'a CloudDeploy<C>,
11724    _request: Rollout,
11725    _parent: String,
11726    _validate_only: Option<bool>,
11727    _starting_phase_id: Option<String>,
11728    _rollout_id: Option<String>,
11729    _request_id: Option<String>,
11730    _delegate: Option<&'a mut dyn common::Delegate>,
11731    _additional_params: HashMap<String, String>,
11732    _scopes: BTreeSet<String>,
11733}
11734
11735impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {}
11736
11737impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
11738where
11739    C: common::Connector,
11740{
11741    /// Perform the operation you have build so far.
11742    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11743        use std::borrow::Cow;
11744        use std::io::{Read, Seek};
11745
11746        use common::{url::Params, ToParts};
11747        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11748
11749        let mut dd = common::DefaultDelegate;
11750        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11751        dlg.begin(common::MethodInfo {
11752            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.create",
11753            http_method: hyper::Method::POST,
11754        });
11755
11756        for &field in [
11757            "alt",
11758            "parent",
11759            "validateOnly",
11760            "startingPhaseId",
11761            "rolloutId",
11762            "requestId",
11763        ]
11764        .iter()
11765        {
11766            if self._additional_params.contains_key(field) {
11767                dlg.finished(false);
11768                return Err(common::Error::FieldClash(field));
11769            }
11770        }
11771
11772        let mut params = Params::with_capacity(8 + self._additional_params.len());
11773        params.push("parent", self._parent);
11774        if let Some(value) = self._validate_only.as_ref() {
11775            params.push("validateOnly", value.to_string());
11776        }
11777        if let Some(value) = self._starting_phase_id.as_ref() {
11778            params.push("startingPhaseId", value);
11779        }
11780        if let Some(value) = self._rollout_id.as_ref() {
11781            params.push("rolloutId", value);
11782        }
11783        if let Some(value) = self._request_id.as_ref() {
11784            params.push("requestId", value);
11785        }
11786
11787        params.extend(self._additional_params.iter());
11788
11789        params.push("alt", "json");
11790        let mut url = self.hub._base_url.clone() + "v1/{+parent}/rollouts";
11791        if self._scopes.is_empty() {
11792            self._scopes
11793                .insert(Scope::CloudPlatform.as_ref().to_string());
11794        }
11795
11796        #[allow(clippy::single_element_loop)]
11797        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11798            url = params.uri_replacement(url, param_name, find_this, true);
11799        }
11800        {
11801            let to_remove = ["parent"];
11802            params.remove_params(&to_remove);
11803        }
11804
11805        let url = params.parse_with_url(&url);
11806
11807        let mut json_mime_type = mime::APPLICATION_JSON;
11808        let mut request_value_reader = {
11809            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11810            common::remove_json_null_values(&mut value);
11811            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11812            serde_json::to_writer(&mut dst, &value).unwrap();
11813            dst
11814        };
11815        let request_size = request_value_reader
11816            .seek(std::io::SeekFrom::End(0))
11817            .unwrap();
11818        request_value_reader
11819            .seek(std::io::SeekFrom::Start(0))
11820            .unwrap();
11821
11822        loop {
11823            let token = match self
11824                .hub
11825                .auth
11826                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11827                .await
11828            {
11829                Ok(token) => token,
11830                Err(e) => match dlg.token(e) {
11831                    Ok(token) => token,
11832                    Err(e) => {
11833                        dlg.finished(false);
11834                        return Err(common::Error::MissingToken(e));
11835                    }
11836                },
11837            };
11838            request_value_reader
11839                .seek(std::io::SeekFrom::Start(0))
11840                .unwrap();
11841            let mut req_result = {
11842                let client = &self.hub.client;
11843                dlg.pre_request();
11844                let mut req_builder = hyper::Request::builder()
11845                    .method(hyper::Method::POST)
11846                    .uri(url.as_str())
11847                    .header(USER_AGENT, self.hub._user_agent.clone());
11848
11849                if let Some(token) = token.as_ref() {
11850                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11851                }
11852
11853                let request = req_builder
11854                    .header(CONTENT_TYPE, json_mime_type.to_string())
11855                    .header(CONTENT_LENGTH, request_size as u64)
11856                    .body(common::to_body(
11857                        request_value_reader.get_ref().clone().into(),
11858                    ));
11859
11860                client.request(request.unwrap()).await
11861            };
11862
11863            match req_result {
11864                Err(err) => {
11865                    if let common::Retry::After(d) = dlg.http_error(&err) {
11866                        sleep(d).await;
11867                        continue;
11868                    }
11869                    dlg.finished(false);
11870                    return Err(common::Error::HttpError(err));
11871                }
11872                Ok(res) => {
11873                    let (mut parts, body) = res.into_parts();
11874                    let mut body = common::Body::new(body);
11875                    if !parts.status.is_success() {
11876                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11877                        let error = serde_json::from_str(&common::to_string(&bytes));
11878                        let response = common::to_response(parts, bytes.into());
11879
11880                        if let common::Retry::After(d) =
11881                            dlg.http_failure(&response, error.as_ref().ok())
11882                        {
11883                            sleep(d).await;
11884                            continue;
11885                        }
11886
11887                        dlg.finished(false);
11888
11889                        return Err(match error {
11890                            Ok(value) => common::Error::BadRequest(value),
11891                            _ => common::Error::Failure(response),
11892                        });
11893                    }
11894                    let response = {
11895                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11896                        let encoded = common::to_string(&bytes);
11897                        match serde_json::from_str(&encoded) {
11898                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11899                            Err(error) => {
11900                                dlg.response_json_decode_error(&encoded, &error);
11901                                return Err(common::Error::JsonDecodeError(
11902                                    encoded.to_string(),
11903                                    error,
11904                                ));
11905                            }
11906                        }
11907                    };
11908
11909                    dlg.finished(true);
11910                    return Ok(response);
11911                }
11912            }
11913        }
11914    }
11915
11916    ///
11917    /// Sets the *request* property to the given value.
11918    ///
11919    /// Even though the property as already been set when instantiating this call,
11920    /// we provide this method for API completeness.
11921    pub fn request(
11922        mut self,
11923        new_value: Rollout,
11924    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
11925        self._request = new_value;
11926        self
11927    }
11928    /// Required. The parent collection in which the `Rollout` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
11929    ///
11930    /// Sets the *parent* path property to the given value.
11931    ///
11932    /// Even though the property as already been set when instantiating this call,
11933    /// we provide this method for API completeness.
11934    pub fn parent(
11935        mut self,
11936        new_value: &str,
11937    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
11938        self._parent = new_value.to_string();
11939        self
11940    }
11941    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
11942    ///
11943    /// Sets the *validate only* query property to the given value.
11944    pub fn validate_only(
11945        mut self,
11946        new_value: bool,
11947    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
11948        self._validate_only = Some(new_value);
11949        self
11950    }
11951    /// Optional. The starting phase ID for the `Rollout`. If empty the `Rollout` will start at the first phase.
11952    ///
11953    /// Sets the *starting phase id* query property to the given value.
11954    pub fn starting_phase_id(
11955        mut self,
11956        new_value: &str,
11957    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
11958        self._starting_phase_id = Some(new_value.to_string());
11959        self
11960    }
11961    /// Required. ID of the `Rollout`.
11962    ///
11963    /// Sets the *rollout id* query property to the given value.
11964    pub fn rollout_id(
11965        mut self,
11966        new_value: &str,
11967    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
11968        self._rollout_id = Some(new_value.to_string());
11969        self
11970    }
11971    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
11972    ///
11973    /// Sets the *request id* query property to the given value.
11974    pub fn request_id(
11975        mut self,
11976        new_value: &str,
11977    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
11978        self._request_id = Some(new_value.to_string());
11979        self
11980    }
11981    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11982    /// while executing the actual API request.
11983    ///
11984    /// ````text
11985    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11986    /// ````
11987    ///
11988    /// Sets the *delegate* property to the given value.
11989    pub fn delegate(
11990        mut self,
11991        new_value: &'a mut dyn common::Delegate,
11992    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
11993        self._delegate = Some(new_value);
11994        self
11995    }
11996
11997    /// Set any additional parameter of the query string used in the request.
11998    /// It should be used to set parameters which are not yet available through their own
11999    /// setters.
12000    ///
12001    /// Please note that this method must not be used to set any of the known parameters
12002    /// which have their own setter method. If done anyway, the request will fail.
12003    ///
12004    /// # Additional Parameters
12005    ///
12006    /// * *$.xgafv* (query-string) - V1 error format.
12007    /// * *access_token* (query-string) - OAuth access token.
12008    /// * *alt* (query-string) - Data format for response.
12009    /// * *callback* (query-string) - JSONP
12010    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12011    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12012    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12013    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12014    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12015    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12016    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12017    pub fn param<T>(
12018        mut self,
12019        name: T,
12020        value: T,
12021    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
12022    where
12023        T: AsRef<str>,
12024    {
12025        self._additional_params
12026            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12027        self
12028    }
12029
12030    /// Identifies the authorization scope for the method you are building.
12031    ///
12032    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12033    /// [`Scope::CloudPlatform`].
12034    ///
12035    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12036    /// tokens for more than one scope.
12037    ///
12038    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12039    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12040    /// sufficient, a read-write scope will do as well.
12041    pub fn add_scope<St>(
12042        mut self,
12043        scope: St,
12044    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
12045    where
12046        St: AsRef<str>,
12047    {
12048        self._scopes.insert(String::from(scope.as_ref()));
12049        self
12050    }
12051    /// Identifies the authorization scope(s) for the method you are building.
12052    ///
12053    /// See [`Self::add_scope()`] for details.
12054    pub fn add_scopes<I, St>(
12055        mut self,
12056        scopes: I,
12057    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
12058    where
12059        I: IntoIterator<Item = St>,
12060        St: AsRef<str>,
12061    {
12062        self._scopes
12063            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12064        self
12065    }
12066
12067    /// Removes all scopes, and no default scope will be used either.
12068    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12069    /// for details).
12070    pub fn clear_scopes(
12071        mut self,
12072    ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
12073        self._scopes.clear();
12074        self
12075    }
12076}
12077
12078/// Gets details of a single Rollout.
12079///
12080/// A builder for the *locations.deliveryPipelines.releases.rollouts.get* method supported by a *project* resource.
12081/// It is not used directly, but through a [`ProjectMethods`] instance.
12082///
12083/// # Example
12084///
12085/// Instantiate a resource method builder
12086///
12087/// ```test_harness,no_run
12088/// # extern crate hyper;
12089/// # extern crate hyper_rustls;
12090/// # extern crate google_clouddeploy1 as clouddeploy1;
12091/// # async fn dox() {
12092/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12093///
12094/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12095/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12096/// #     secret,
12097/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12098/// # ).build().await.unwrap();
12099///
12100/// # let client = hyper_util::client::legacy::Client::builder(
12101/// #     hyper_util::rt::TokioExecutor::new()
12102/// # )
12103/// # .build(
12104/// #     hyper_rustls::HttpsConnectorBuilder::new()
12105/// #         .with_native_roots()
12106/// #         .unwrap()
12107/// #         .https_or_http()
12108/// #         .enable_http1()
12109/// #         .build()
12110/// # );
12111/// # let mut hub = CloudDeploy::new(client, auth);
12112/// // You can configure optional parameters by calling the respective setters at will, and
12113/// // execute the final call using `doit()`.
12114/// // Values shown here are possibly random and not representative !
12115/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_get("name")
12116///              .doit().await;
12117/// # }
12118/// ```
12119pub struct ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
12120where
12121    C: 'a,
12122{
12123    hub: &'a CloudDeploy<C>,
12124    _name: String,
12125    _delegate: Option<&'a mut dyn common::Delegate>,
12126    _additional_params: HashMap<String, String>,
12127    _scopes: BTreeSet<String>,
12128}
12129
12130impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {}
12131
12132impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
12133where
12134    C: common::Connector,
12135{
12136    /// Perform the operation you have build so far.
12137    pub async fn doit(mut self) -> common::Result<(common::Response, Rollout)> {
12138        use std::borrow::Cow;
12139        use std::io::{Read, Seek};
12140
12141        use common::{url::Params, ToParts};
12142        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12143
12144        let mut dd = common::DefaultDelegate;
12145        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12146        dlg.begin(common::MethodInfo {
12147            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.get",
12148            http_method: hyper::Method::GET,
12149        });
12150
12151        for &field in ["alt", "name"].iter() {
12152            if self._additional_params.contains_key(field) {
12153                dlg.finished(false);
12154                return Err(common::Error::FieldClash(field));
12155            }
12156        }
12157
12158        let mut params = Params::with_capacity(3 + self._additional_params.len());
12159        params.push("name", self._name);
12160
12161        params.extend(self._additional_params.iter());
12162
12163        params.push("alt", "json");
12164        let mut url = self.hub._base_url.clone() + "v1/{+name}";
12165        if self._scopes.is_empty() {
12166            self._scopes
12167                .insert(Scope::CloudPlatform.as_ref().to_string());
12168        }
12169
12170        #[allow(clippy::single_element_loop)]
12171        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12172            url = params.uri_replacement(url, param_name, find_this, true);
12173        }
12174        {
12175            let to_remove = ["name"];
12176            params.remove_params(&to_remove);
12177        }
12178
12179        let url = params.parse_with_url(&url);
12180
12181        loop {
12182            let token = match self
12183                .hub
12184                .auth
12185                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12186                .await
12187            {
12188                Ok(token) => token,
12189                Err(e) => match dlg.token(e) {
12190                    Ok(token) => token,
12191                    Err(e) => {
12192                        dlg.finished(false);
12193                        return Err(common::Error::MissingToken(e));
12194                    }
12195                },
12196            };
12197            let mut req_result = {
12198                let client = &self.hub.client;
12199                dlg.pre_request();
12200                let mut req_builder = hyper::Request::builder()
12201                    .method(hyper::Method::GET)
12202                    .uri(url.as_str())
12203                    .header(USER_AGENT, self.hub._user_agent.clone());
12204
12205                if let Some(token) = token.as_ref() {
12206                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12207                }
12208
12209                let request = req_builder
12210                    .header(CONTENT_LENGTH, 0_u64)
12211                    .body(common::to_body::<String>(None));
12212
12213                client.request(request.unwrap()).await
12214            };
12215
12216            match req_result {
12217                Err(err) => {
12218                    if let common::Retry::After(d) = dlg.http_error(&err) {
12219                        sleep(d).await;
12220                        continue;
12221                    }
12222                    dlg.finished(false);
12223                    return Err(common::Error::HttpError(err));
12224                }
12225                Ok(res) => {
12226                    let (mut parts, body) = res.into_parts();
12227                    let mut body = common::Body::new(body);
12228                    if !parts.status.is_success() {
12229                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12230                        let error = serde_json::from_str(&common::to_string(&bytes));
12231                        let response = common::to_response(parts, bytes.into());
12232
12233                        if let common::Retry::After(d) =
12234                            dlg.http_failure(&response, error.as_ref().ok())
12235                        {
12236                            sleep(d).await;
12237                            continue;
12238                        }
12239
12240                        dlg.finished(false);
12241
12242                        return Err(match error {
12243                            Ok(value) => common::Error::BadRequest(value),
12244                            _ => common::Error::Failure(response),
12245                        });
12246                    }
12247                    let response = {
12248                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12249                        let encoded = common::to_string(&bytes);
12250                        match serde_json::from_str(&encoded) {
12251                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12252                            Err(error) => {
12253                                dlg.response_json_decode_error(&encoded, &error);
12254                                return Err(common::Error::JsonDecodeError(
12255                                    encoded.to_string(),
12256                                    error,
12257                                ));
12258                            }
12259                        }
12260                    };
12261
12262                    dlg.finished(true);
12263                    return Ok(response);
12264                }
12265            }
12266        }
12267    }
12268
12269    /// Required. Name of the `Rollout`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}`.
12270    ///
12271    /// Sets the *name* path property to the given value.
12272    ///
12273    /// Even though the property as already been set when instantiating this call,
12274    /// we provide this method for API completeness.
12275    pub fn name(
12276        mut self,
12277        new_value: &str,
12278    ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
12279        self._name = new_value.to_string();
12280        self
12281    }
12282    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12283    /// while executing the actual API request.
12284    ///
12285    /// ````text
12286    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12287    /// ````
12288    ///
12289    /// Sets the *delegate* property to the given value.
12290    pub fn delegate(
12291        mut self,
12292        new_value: &'a mut dyn common::Delegate,
12293    ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
12294        self._delegate = Some(new_value);
12295        self
12296    }
12297
12298    /// Set any additional parameter of the query string used in the request.
12299    /// It should be used to set parameters which are not yet available through their own
12300    /// setters.
12301    ///
12302    /// Please note that this method must not be used to set any of the known parameters
12303    /// which have their own setter method. If done anyway, the request will fail.
12304    ///
12305    /// # Additional Parameters
12306    ///
12307    /// * *$.xgafv* (query-string) - V1 error format.
12308    /// * *access_token* (query-string) - OAuth access token.
12309    /// * *alt* (query-string) - Data format for response.
12310    /// * *callback* (query-string) - JSONP
12311    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12312    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12313    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12314    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12315    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12316    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12317    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12318    pub fn param<T>(
12319        mut self,
12320        name: T,
12321        value: T,
12322    ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
12323    where
12324        T: AsRef<str>,
12325    {
12326        self._additional_params
12327            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12328        self
12329    }
12330
12331    /// Identifies the authorization scope for the method you are building.
12332    ///
12333    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12334    /// [`Scope::CloudPlatform`].
12335    ///
12336    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12337    /// tokens for more than one scope.
12338    ///
12339    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12340    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12341    /// sufficient, a read-write scope will do as well.
12342    pub fn add_scope<St>(
12343        mut self,
12344        scope: St,
12345    ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
12346    where
12347        St: AsRef<str>,
12348    {
12349        self._scopes.insert(String::from(scope.as_ref()));
12350        self
12351    }
12352    /// Identifies the authorization scope(s) for the method you are building.
12353    ///
12354    /// See [`Self::add_scope()`] for details.
12355    pub fn add_scopes<I, St>(
12356        mut self,
12357        scopes: I,
12358    ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
12359    where
12360        I: IntoIterator<Item = St>,
12361        St: AsRef<str>,
12362    {
12363        self._scopes
12364            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12365        self
12366    }
12367
12368    /// Removes all scopes, and no default scope will be used either.
12369    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12370    /// for details).
12371    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
12372        self._scopes.clear();
12373        self
12374    }
12375}
12376
12377/// Ignores the specified Job in a Rollout.
12378///
12379/// A builder for the *locations.deliveryPipelines.releases.rollouts.ignoreJob* method supported by a *project* resource.
12380/// It is not used directly, but through a [`ProjectMethods`] instance.
12381///
12382/// # Example
12383///
12384/// Instantiate a resource method builder
12385///
12386/// ```test_harness,no_run
12387/// # extern crate hyper;
12388/// # extern crate hyper_rustls;
12389/// # extern crate google_clouddeploy1 as clouddeploy1;
12390/// use clouddeploy1::api::IgnoreJobRequest;
12391/// # async fn dox() {
12392/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12393///
12394/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12395/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12396/// #     secret,
12397/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12398/// # ).build().await.unwrap();
12399///
12400/// # let client = hyper_util::client::legacy::Client::builder(
12401/// #     hyper_util::rt::TokioExecutor::new()
12402/// # )
12403/// # .build(
12404/// #     hyper_rustls::HttpsConnectorBuilder::new()
12405/// #         .with_native_roots()
12406/// #         .unwrap()
12407/// #         .https_or_http()
12408/// #         .enable_http1()
12409/// #         .build()
12410/// # );
12411/// # let mut hub = CloudDeploy::new(client, auth);
12412/// // As the method needs a request, you would usually fill it with the desired information
12413/// // into the respective structure. Some of the parts shown here might not be applicable !
12414/// // Values shown here are possibly random and not representative !
12415/// let mut req = IgnoreJobRequest::default();
12416///
12417/// // You can configure optional parameters by calling the respective setters at will, and
12418/// // execute the final call using `doit()`.
12419/// // Values shown here are possibly random and not representative !
12420/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_ignore_job(req, "rollout")
12421///              .doit().await;
12422/// # }
12423/// ```
12424pub struct ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
12425where
12426    C: 'a,
12427{
12428    hub: &'a CloudDeploy<C>,
12429    _request: IgnoreJobRequest,
12430    _rollout: String,
12431    _delegate: Option<&'a mut dyn common::Delegate>,
12432    _additional_params: HashMap<String, String>,
12433    _scopes: BTreeSet<String>,
12434}
12435
12436impl<'a, C> common::CallBuilder
12437    for ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
12438{
12439}
12440
12441impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
12442where
12443    C: common::Connector,
12444{
12445    /// Perform the operation you have build so far.
12446    pub async fn doit(mut self) -> common::Result<(common::Response, IgnoreJobResponse)> {
12447        use std::borrow::Cow;
12448        use std::io::{Read, Seek};
12449
12450        use common::{url::Params, ToParts};
12451        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12452
12453        let mut dd = common::DefaultDelegate;
12454        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12455        dlg.begin(common::MethodInfo {
12456            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.ignoreJob",
12457            http_method: hyper::Method::POST,
12458        });
12459
12460        for &field in ["alt", "rollout"].iter() {
12461            if self._additional_params.contains_key(field) {
12462                dlg.finished(false);
12463                return Err(common::Error::FieldClash(field));
12464            }
12465        }
12466
12467        let mut params = Params::with_capacity(4 + self._additional_params.len());
12468        params.push("rollout", self._rollout);
12469
12470        params.extend(self._additional_params.iter());
12471
12472        params.push("alt", "json");
12473        let mut url = self.hub._base_url.clone() + "v1/{+rollout}:ignoreJob";
12474        if self._scopes.is_empty() {
12475            self._scopes
12476                .insert(Scope::CloudPlatform.as_ref().to_string());
12477        }
12478
12479        #[allow(clippy::single_element_loop)]
12480        for &(find_this, param_name) in [("{+rollout}", "rollout")].iter() {
12481            url = params.uri_replacement(url, param_name, find_this, true);
12482        }
12483        {
12484            let to_remove = ["rollout"];
12485            params.remove_params(&to_remove);
12486        }
12487
12488        let url = params.parse_with_url(&url);
12489
12490        let mut json_mime_type = mime::APPLICATION_JSON;
12491        let mut request_value_reader = {
12492            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12493            common::remove_json_null_values(&mut value);
12494            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12495            serde_json::to_writer(&mut dst, &value).unwrap();
12496            dst
12497        };
12498        let request_size = request_value_reader
12499            .seek(std::io::SeekFrom::End(0))
12500            .unwrap();
12501        request_value_reader
12502            .seek(std::io::SeekFrom::Start(0))
12503            .unwrap();
12504
12505        loop {
12506            let token = match self
12507                .hub
12508                .auth
12509                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12510                .await
12511            {
12512                Ok(token) => token,
12513                Err(e) => match dlg.token(e) {
12514                    Ok(token) => token,
12515                    Err(e) => {
12516                        dlg.finished(false);
12517                        return Err(common::Error::MissingToken(e));
12518                    }
12519                },
12520            };
12521            request_value_reader
12522                .seek(std::io::SeekFrom::Start(0))
12523                .unwrap();
12524            let mut req_result = {
12525                let client = &self.hub.client;
12526                dlg.pre_request();
12527                let mut req_builder = hyper::Request::builder()
12528                    .method(hyper::Method::POST)
12529                    .uri(url.as_str())
12530                    .header(USER_AGENT, self.hub._user_agent.clone());
12531
12532                if let Some(token) = token.as_ref() {
12533                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12534                }
12535
12536                let request = req_builder
12537                    .header(CONTENT_TYPE, json_mime_type.to_string())
12538                    .header(CONTENT_LENGTH, request_size as u64)
12539                    .body(common::to_body(
12540                        request_value_reader.get_ref().clone().into(),
12541                    ));
12542
12543                client.request(request.unwrap()).await
12544            };
12545
12546            match req_result {
12547                Err(err) => {
12548                    if let common::Retry::After(d) = dlg.http_error(&err) {
12549                        sleep(d).await;
12550                        continue;
12551                    }
12552                    dlg.finished(false);
12553                    return Err(common::Error::HttpError(err));
12554                }
12555                Ok(res) => {
12556                    let (mut parts, body) = res.into_parts();
12557                    let mut body = common::Body::new(body);
12558                    if !parts.status.is_success() {
12559                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12560                        let error = serde_json::from_str(&common::to_string(&bytes));
12561                        let response = common::to_response(parts, bytes.into());
12562
12563                        if let common::Retry::After(d) =
12564                            dlg.http_failure(&response, error.as_ref().ok())
12565                        {
12566                            sleep(d).await;
12567                            continue;
12568                        }
12569
12570                        dlg.finished(false);
12571
12572                        return Err(match error {
12573                            Ok(value) => common::Error::BadRequest(value),
12574                            _ => common::Error::Failure(response),
12575                        });
12576                    }
12577                    let response = {
12578                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12579                        let encoded = common::to_string(&bytes);
12580                        match serde_json::from_str(&encoded) {
12581                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12582                            Err(error) => {
12583                                dlg.response_json_decode_error(&encoded, &error);
12584                                return Err(common::Error::JsonDecodeError(
12585                                    encoded.to_string(),
12586                                    error,
12587                                ));
12588                            }
12589                        }
12590                    };
12591
12592                    dlg.finished(true);
12593                    return Ok(response);
12594                }
12595            }
12596        }
12597    }
12598
12599    ///
12600    /// Sets the *request* property to the given value.
12601    ///
12602    /// Even though the property as already been set when instantiating this call,
12603    /// we provide this method for API completeness.
12604    pub fn request(
12605        mut self,
12606        new_value: IgnoreJobRequest,
12607    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
12608        self._request = new_value;
12609        self
12610    }
12611    /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
12612    ///
12613    /// Sets the *rollout* path property to the given value.
12614    ///
12615    /// Even though the property as already been set when instantiating this call,
12616    /// we provide this method for API completeness.
12617    pub fn rollout(
12618        mut self,
12619        new_value: &str,
12620    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
12621        self._rollout = new_value.to_string();
12622        self
12623    }
12624    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12625    /// while executing the actual API request.
12626    ///
12627    /// ````text
12628    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12629    /// ````
12630    ///
12631    /// Sets the *delegate* property to the given value.
12632    pub fn delegate(
12633        mut self,
12634        new_value: &'a mut dyn common::Delegate,
12635    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
12636        self._delegate = Some(new_value);
12637        self
12638    }
12639
12640    /// Set any additional parameter of the query string used in the request.
12641    /// It should be used to set parameters which are not yet available through their own
12642    /// setters.
12643    ///
12644    /// Please note that this method must not be used to set any of the known parameters
12645    /// which have their own setter method. If done anyway, the request will fail.
12646    ///
12647    /// # Additional Parameters
12648    ///
12649    /// * *$.xgafv* (query-string) - V1 error format.
12650    /// * *access_token* (query-string) - OAuth access token.
12651    /// * *alt* (query-string) - Data format for response.
12652    /// * *callback* (query-string) - JSONP
12653    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12654    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
12655    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12656    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12657    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
12658    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12659    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12660    pub fn param<T>(
12661        mut self,
12662        name: T,
12663        value: T,
12664    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
12665    where
12666        T: AsRef<str>,
12667    {
12668        self._additional_params
12669            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12670        self
12671    }
12672
12673    /// Identifies the authorization scope for the method you are building.
12674    ///
12675    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12676    /// [`Scope::CloudPlatform`].
12677    ///
12678    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12679    /// tokens for more than one scope.
12680    ///
12681    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12682    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12683    /// sufficient, a read-write scope will do as well.
12684    pub fn add_scope<St>(
12685        mut self,
12686        scope: St,
12687    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
12688    where
12689        St: AsRef<str>,
12690    {
12691        self._scopes.insert(String::from(scope.as_ref()));
12692        self
12693    }
12694    /// Identifies the authorization scope(s) for the method you are building.
12695    ///
12696    /// See [`Self::add_scope()`] for details.
12697    pub fn add_scopes<I, St>(
12698        mut self,
12699        scopes: I,
12700    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
12701    where
12702        I: IntoIterator<Item = St>,
12703        St: AsRef<str>,
12704    {
12705        self._scopes
12706            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12707        self
12708    }
12709
12710    /// Removes all scopes, and no default scope will be used either.
12711    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12712    /// for details).
12713    pub fn clear_scopes(
12714        mut self,
12715    ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
12716        self._scopes.clear();
12717        self
12718    }
12719}
12720
12721/// Lists Rollouts in a given project and location.
12722///
12723/// A builder for the *locations.deliveryPipelines.releases.rollouts.list* method supported by a *project* resource.
12724/// It is not used directly, but through a [`ProjectMethods`] instance.
12725///
12726/// # Example
12727///
12728/// Instantiate a resource method builder
12729///
12730/// ```test_harness,no_run
12731/// # extern crate hyper;
12732/// # extern crate hyper_rustls;
12733/// # extern crate google_clouddeploy1 as clouddeploy1;
12734/// # async fn dox() {
12735/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12736///
12737/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12739/// #     secret,
12740/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12741/// # ).build().await.unwrap();
12742///
12743/// # let client = hyper_util::client::legacy::Client::builder(
12744/// #     hyper_util::rt::TokioExecutor::new()
12745/// # )
12746/// # .build(
12747/// #     hyper_rustls::HttpsConnectorBuilder::new()
12748/// #         .with_native_roots()
12749/// #         .unwrap()
12750/// #         .https_or_http()
12751/// #         .enable_http1()
12752/// #         .build()
12753/// # );
12754/// # let mut hub = CloudDeploy::new(client, auth);
12755/// // You can configure optional parameters by calling the respective setters at will, and
12756/// // execute the final call using `doit()`.
12757/// // Values shown here are possibly random and not representative !
12758/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_list("parent")
12759///              .page_token("voluptua.")
12760///              .page_size(-2)
12761///              .order_by("ea")
12762///              .filter("sadipscing")
12763///              .doit().await;
12764/// # }
12765/// ```
12766pub struct ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
12767where
12768    C: 'a,
12769{
12770    hub: &'a CloudDeploy<C>,
12771    _parent: String,
12772    _page_token: Option<String>,
12773    _page_size: Option<i32>,
12774    _order_by: Option<String>,
12775    _filter: Option<String>,
12776    _delegate: Option<&'a mut dyn common::Delegate>,
12777    _additional_params: HashMap<String, String>,
12778    _scopes: BTreeSet<String>,
12779}
12780
12781impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {}
12782
12783impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
12784where
12785    C: common::Connector,
12786{
12787    /// Perform the operation you have build so far.
12788    pub async fn doit(mut self) -> common::Result<(common::Response, ListRolloutsResponse)> {
12789        use std::borrow::Cow;
12790        use std::io::{Read, Seek};
12791
12792        use common::{url::Params, ToParts};
12793        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12794
12795        let mut dd = common::DefaultDelegate;
12796        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12797        dlg.begin(common::MethodInfo {
12798            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.list",
12799            http_method: hyper::Method::GET,
12800        });
12801
12802        for &field in [
12803            "alt",
12804            "parent",
12805            "pageToken",
12806            "pageSize",
12807            "orderBy",
12808            "filter",
12809        ]
12810        .iter()
12811        {
12812            if self._additional_params.contains_key(field) {
12813                dlg.finished(false);
12814                return Err(common::Error::FieldClash(field));
12815            }
12816        }
12817
12818        let mut params = Params::with_capacity(7 + self._additional_params.len());
12819        params.push("parent", self._parent);
12820        if let Some(value) = self._page_token.as_ref() {
12821            params.push("pageToken", value);
12822        }
12823        if let Some(value) = self._page_size.as_ref() {
12824            params.push("pageSize", value.to_string());
12825        }
12826        if let Some(value) = self._order_by.as_ref() {
12827            params.push("orderBy", value);
12828        }
12829        if let Some(value) = self._filter.as_ref() {
12830            params.push("filter", value);
12831        }
12832
12833        params.extend(self._additional_params.iter());
12834
12835        params.push("alt", "json");
12836        let mut url = self.hub._base_url.clone() + "v1/{+parent}/rollouts";
12837        if self._scopes.is_empty() {
12838            self._scopes
12839                .insert(Scope::CloudPlatform.as_ref().to_string());
12840        }
12841
12842        #[allow(clippy::single_element_loop)]
12843        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12844            url = params.uri_replacement(url, param_name, find_this, true);
12845        }
12846        {
12847            let to_remove = ["parent"];
12848            params.remove_params(&to_remove);
12849        }
12850
12851        let url = params.parse_with_url(&url);
12852
12853        loop {
12854            let token = match self
12855                .hub
12856                .auth
12857                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12858                .await
12859            {
12860                Ok(token) => token,
12861                Err(e) => match dlg.token(e) {
12862                    Ok(token) => token,
12863                    Err(e) => {
12864                        dlg.finished(false);
12865                        return Err(common::Error::MissingToken(e));
12866                    }
12867                },
12868            };
12869            let mut req_result = {
12870                let client = &self.hub.client;
12871                dlg.pre_request();
12872                let mut req_builder = hyper::Request::builder()
12873                    .method(hyper::Method::GET)
12874                    .uri(url.as_str())
12875                    .header(USER_AGENT, self.hub._user_agent.clone());
12876
12877                if let Some(token) = token.as_ref() {
12878                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12879                }
12880
12881                let request = req_builder
12882                    .header(CONTENT_LENGTH, 0_u64)
12883                    .body(common::to_body::<String>(None));
12884
12885                client.request(request.unwrap()).await
12886            };
12887
12888            match req_result {
12889                Err(err) => {
12890                    if let common::Retry::After(d) = dlg.http_error(&err) {
12891                        sleep(d).await;
12892                        continue;
12893                    }
12894                    dlg.finished(false);
12895                    return Err(common::Error::HttpError(err));
12896                }
12897                Ok(res) => {
12898                    let (mut parts, body) = res.into_parts();
12899                    let mut body = common::Body::new(body);
12900                    if !parts.status.is_success() {
12901                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12902                        let error = serde_json::from_str(&common::to_string(&bytes));
12903                        let response = common::to_response(parts, bytes.into());
12904
12905                        if let common::Retry::After(d) =
12906                            dlg.http_failure(&response, error.as_ref().ok())
12907                        {
12908                            sleep(d).await;
12909                            continue;
12910                        }
12911
12912                        dlg.finished(false);
12913
12914                        return Err(match error {
12915                            Ok(value) => common::Error::BadRequest(value),
12916                            _ => common::Error::Failure(response),
12917                        });
12918                    }
12919                    let response = {
12920                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12921                        let encoded = common::to_string(&bytes);
12922                        match serde_json::from_str(&encoded) {
12923                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12924                            Err(error) => {
12925                                dlg.response_json_decode_error(&encoded, &error);
12926                                return Err(common::Error::JsonDecodeError(
12927                                    encoded.to_string(),
12928                                    error,
12929                                ));
12930                            }
12931                        }
12932                    };
12933
12934                    dlg.finished(true);
12935                    return Ok(response);
12936                }
12937            }
12938        }
12939    }
12940
12941    /// Required. The `Release` which owns this collection of `Rollout` objects.
12942    ///
12943    /// Sets the *parent* path property to the given value.
12944    ///
12945    /// Even though the property as already been set when instantiating this call,
12946    /// we provide this method for API completeness.
12947    pub fn parent(
12948        mut self,
12949        new_value: &str,
12950    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
12951        self._parent = new_value.to_string();
12952        self
12953    }
12954    /// Optional. A page token, received from a previous `ListRollouts` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
12955    ///
12956    /// Sets the *page token* query property to the given value.
12957    pub fn page_token(
12958        mut self,
12959        new_value: &str,
12960    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
12961        self._page_token = Some(new_value.to_string());
12962        self
12963    }
12964    /// Optional. The maximum number of `Rollout` objects to return. The service may return fewer than this value. If unspecified, at most 50 `Rollout` objects will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
12965    ///
12966    /// Sets the *page size* query property to the given value.
12967    pub fn page_size(
12968        mut self,
12969        new_value: i32,
12970    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
12971        self._page_size = Some(new_value);
12972        self
12973    }
12974    /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
12975    ///
12976    /// Sets the *order by* query property to the given value.
12977    pub fn order_by(
12978        mut self,
12979        new_value: &str,
12980    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
12981        self._order_by = Some(new_value.to_string());
12982        self
12983    }
12984    /// Optional. Filter rollouts to be returned. See https://google.aip.dev/160 for more details.
12985    ///
12986    /// Sets the *filter* query property to the given value.
12987    pub fn filter(
12988        mut self,
12989        new_value: &str,
12990    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
12991        self._filter = Some(new_value.to_string());
12992        self
12993    }
12994    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12995    /// while executing the actual API request.
12996    ///
12997    /// ````text
12998    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12999    /// ````
13000    ///
13001    /// Sets the *delegate* property to the given value.
13002    pub fn delegate(
13003        mut self,
13004        new_value: &'a mut dyn common::Delegate,
13005    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
13006        self._delegate = Some(new_value);
13007        self
13008    }
13009
13010    /// Set any additional parameter of the query string used in the request.
13011    /// It should be used to set parameters which are not yet available through their own
13012    /// setters.
13013    ///
13014    /// Please note that this method must not be used to set any of the known parameters
13015    /// which have their own setter method. If done anyway, the request will fail.
13016    ///
13017    /// # Additional Parameters
13018    ///
13019    /// * *$.xgafv* (query-string) - V1 error format.
13020    /// * *access_token* (query-string) - OAuth access token.
13021    /// * *alt* (query-string) - Data format for response.
13022    /// * *callback* (query-string) - JSONP
13023    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13024    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13025    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13026    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13027    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13028    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13029    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13030    pub fn param<T>(
13031        mut self,
13032        name: T,
13033        value: T,
13034    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
13035    where
13036        T: AsRef<str>,
13037    {
13038        self._additional_params
13039            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13040        self
13041    }
13042
13043    /// Identifies the authorization scope for the method you are building.
13044    ///
13045    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13046    /// [`Scope::CloudPlatform`].
13047    ///
13048    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13049    /// tokens for more than one scope.
13050    ///
13051    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13052    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13053    /// sufficient, a read-write scope will do as well.
13054    pub fn add_scope<St>(
13055        mut self,
13056        scope: St,
13057    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
13058    where
13059        St: AsRef<str>,
13060    {
13061        self._scopes.insert(String::from(scope.as_ref()));
13062        self
13063    }
13064    /// Identifies the authorization scope(s) for the method you are building.
13065    ///
13066    /// See [`Self::add_scope()`] for details.
13067    pub fn add_scopes<I, St>(
13068        mut self,
13069        scopes: I,
13070    ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
13071    where
13072        I: IntoIterator<Item = St>,
13073        St: AsRef<str>,
13074    {
13075        self._scopes
13076            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13077        self
13078    }
13079
13080    /// Removes all scopes, and no default scope will be used either.
13081    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13082    /// for details).
13083    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
13084        self._scopes.clear();
13085        self
13086    }
13087}
13088
13089/// Retries the specified Job in a Rollout.
13090///
13091/// A builder for the *locations.deliveryPipelines.releases.rollouts.retryJob* method supported by a *project* resource.
13092/// It is not used directly, but through a [`ProjectMethods`] instance.
13093///
13094/// # Example
13095///
13096/// Instantiate a resource method builder
13097///
13098/// ```test_harness,no_run
13099/// # extern crate hyper;
13100/// # extern crate hyper_rustls;
13101/// # extern crate google_clouddeploy1 as clouddeploy1;
13102/// use clouddeploy1::api::RetryJobRequest;
13103/// # async fn dox() {
13104/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13105///
13106/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13107/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13108/// #     secret,
13109/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13110/// # ).build().await.unwrap();
13111///
13112/// # let client = hyper_util::client::legacy::Client::builder(
13113/// #     hyper_util::rt::TokioExecutor::new()
13114/// # )
13115/// # .build(
13116/// #     hyper_rustls::HttpsConnectorBuilder::new()
13117/// #         .with_native_roots()
13118/// #         .unwrap()
13119/// #         .https_or_http()
13120/// #         .enable_http1()
13121/// #         .build()
13122/// # );
13123/// # let mut hub = CloudDeploy::new(client, auth);
13124/// // As the method needs a request, you would usually fill it with the desired information
13125/// // into the respective structure. Some of the parts shown here might not be applicable !
13126/// // Values shown here are possibly random and not representative !
13127/// let mut req = RetryJobRequest::default();
13128///
13129/// // You can configure optional parameters by calling the respective setters at will, and
13130/// // execute the final call using `doit()`.
13131/// // Values shown here are possibly random and not representative !
13132/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_retry_job(req, "rollout")
13133///              .doit().await;
13134/// # }
13135/// ```
13136pub struct ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
13137where
13138    C: 'a,
13139{
13140    hub: &'a CloudDeploy<C>,
13141    _request: RetryJobRequest,
13142    _rollout: String,
13143    _delegate: Option<&'a mut dyn common::Delegate>,
13144    _additional_params: HashMap<String, String>,
13145    _scopes: BTreeSet<String>,
13146}
13147
13148impl<'a, C> common::CallBuilder
13149    for ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
13150{
13151}
13152
13153impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
13154where
13155    C: common::Connector,
13156{
13157    /// Perform the operation you have build so far.
13158    pub async fn doit(mut self) -> common::Result<(common::Response, RetryJobResponse)> {
13159        use std::borrow::Cow;
13160        use std::io::{Read, Seek};
13161
13162        use common::{url::Params, ToParts};
13163        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13164
13165        let mut dd = common::DefaultDelegate;
13166        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13167        dlg.begin(common::MethodInfo {
13168            id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.retryJob",
13169            http_method: hyper::Method::POST,
13170        });
13171
13172        for &field in ["alt", "rollout"].iter() {
13173            if self._additional_params.contains_key(field) {
13174                dlg.finished(false);
13175                return Err(common::Error::FieldClash(field));
13176            }
13177        }
13178
13179        let mut params = Params::with_capacity(4 + self._additional_params.len());
13180        params.push("rollout", self._rollout);
13181
13182        params.extend(self._additional_params.iter());
13183
13184        params.push("alt", "json");
13185        let mut url = self.hub._base_url.clone() + "v1/{+rollout}:retryJob";
13186        if self._scopes.is_empty() {
13187            self._scopes
13188                .insert(Scope::CloudPlatform.as_ref().to_string());
13189        }
13190
13191        #[allow(clippy::single_element_loop)]
13192        for &(find_this, param_name) in [("{+rollout}", "rollout")].iter() {
13193            url = params.uri_replacement(url, param_name, find_this, true);
13194        }
13195        {
13196            let to_remove = ["rollout"];
13197            params.remove_params(&to_remove);
13198        }
13199
13200        let url = params.parse_with_url(&url);
13201
13202        let mut json_mime_type = mime::APPLICATION_JSON;
13203        let mut request_value_reader = {
13204            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13205            common::remove_json_null_values(&mut value);
13206            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13207            serde_json::to_writer(&mut dst, &value).unwrap();
13208            dst
13209        };
13210        let request_size = request_value_reader
13211            .seek(std::io::SeekFrom::End(0))
13212            .unwrap();
13213        request_value_reader
13214            .seek(std::io::SeekFrom::Start(0))
13215            .unwrap();
13216
13217        loop {
13218            let token = match self
13219                .hub
13220                .auth
13221                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13222                .await
13223            {
13224                Ok(token) => token,
13225                Err(e) => match dlg.token(e) {
13226                    Ok(token) => token,
13227                    Err(e) => {
13228                        dlg.finished(false);
13229                        return Err(common::Error::MissingToken(e));
13230                    }
13231                },
13232            };
13233            request_value_reader
13234                .seek(std::io::SeekFrom::Start(0))
13235                .unwrap();
13236            let mut req_result = {
13237                let client = &self.hub.client;
13238                dlg.pre_request();
13239                let mut req_builder = hyper::Request::builder()
13240                    .method(hyper::Method::POST)
13241                    .uri(url.as_str())
13242                    .header(USER_AGENT, self.hub._user_agent.clone());
13243
13244                if let Some(token) = token.as_ref() {
13245                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13246                }
13247
13248                let request = req_builder
13249                    .header(CONTENT_TYPE, json_mime_type.to_string())
13250                    .header(CONTENT_LENGTH, request_size as u64)
13251                    .body(common::to_body(
13252                        request_value_reader.get_ref().clone().into(),
13253                    ));
13254
13255                client.request(request.unwrap()).await
13256            };
13257
13258            match req_result {
13259                Err(err) => {
13260                    if let common::Retry::After(d) = dlg.http_error(&err) {
13261                        sleep(d).await;
13262                        continue;
13263                    }
13264                    dlg.finished(false);
13265                    return Err(common::Error::HttpError(err));
13266                }
13267                Ok(res) => {
13268                    let (mut parts, body) = res.into_parts();
13269                    let mut body = common::Body::new(body);
13270                    if !parts.status.is_success() {
13271                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13272                        let error = serde_json::from_str(&common::to_string(&bytes));
13273                        let response = common::to_response(parts, bytes.into());
13274
13275                        if let common::Retry::After(d) =
13276                            dlg.http_failure(&response, error.as_ref().ok())
13277                        {
13278                            sleep(d).await;
13279                            continue;
13280                        }
13281
13282                        dlg.finished(false);
13283
13284                        return Err(match error {
13285                            Ok(value) => common::Error::BadRequest(value),
13286                            _ => common::Error::Failure(response),
13287                        });
13288                    }
13289                    let response = {
13290                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13291                        let encoded = common::to_string(&bytes);
13292                        match serde_json::from_str(&encoded) {
13293                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13294                            Err(error) => {
13295                                dlg.response_json_decode_error(&encoded, &error);
13296                                return Err(common::Error::JsonDecodeError(
13297                                    encoded.to_string(),
13298                                    error,
13299                                ));
13300                            }
13301                        }
13302                    };
13303
13304                    dlg.finished(true);
13305                    return Ok(response);
13306                }
13307            }
13308        }
13309    }
13310
13311    ///
13312    /// Sets the *request* property to the given value.
13313    ///
13314    /// Even though the property as already been set when instantiating this call,
13315    /// we provide this method for API completeness.
13316    pub fn request(
13317        mut self,
13318        new_value: RetryJobRequest,
13319    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
13320        self._request = new_value;
13321        self
13322    }
13323    /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
13324    ///
13325    /// Sets the *rollout* path property to the given value.
13326    ///
13327    /// Even though the property as already been set when instantiating this call,
13328    /// we provide this method for API completeness.
13329    pub fn rollout(
13330        mut self,
13331        new_value: &str,
13332    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
13333        self._rollout = new_value.to_string();
13334        self
13335    }
13336    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13337    /// while executing the actual API request.
13338    ///
13339    /// ````text
13340    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13341    /// ````
13342    ///
13343    /// Sets the *delegate* property to the given value.
13344    pub fn delegate(
13345        mut self,
13346        new_value: &'a mut dyn common::Delegate,
13347    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
13348        self._delegate = Some(new_value);
13349        self
13350    }
13351
13352    /// Set any additional parameter of the query string used in the request.
13353    /// It should be used to set parameters which are not yet available through their own
13354    /// setters.
13355    ///
13356    /// Please note that this method must not be used to set any of the known parameters
13357    /// which have their own setter method. If done anyway, the request will fail.
13358    ///
13359    /// # Additional Parameters
13360    ///
13361    /// * *$.xgafv* (query-string) - V1 error format.
13362    /// * *access_token* (query-string) - OAuth access token.
13363    /// * *alt* (query-string) - Data format for response.
13364    /// * *callback* (query-string) - JSONP
13365    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13366    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13367    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13368    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13369    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13370    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13371    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13372    pub fn param<T>(
13373        mut self,
13374        name: T,
13375        value: T,
13376    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
13377    where
13378        T: AsRef<str>,
13379    {
13380        self._additional_params
13381            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13382        self
13383    }
13384
13385    /// Identifies the authorization scope for the method you are building.
13386    ///
13387    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13388    /// [`Scope::CloudPlatform`].
13389    ///
13390    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13391    /// tokens for more than one scope.
13392    ///
13393    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13394    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13395    /// sufficient, a read-write scope will do as well.
13396    pub fn add_scope<St>(
13397        mut self,
13398        scope: St,
13399    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
13400    where
13401        St: AsRef<str>,
13402    {
13403        self._scopes.insert(String::from(scope.as_ref()));
13404        self
13405    }
13406    /// Identifies the authorization scope(s) for the method you are building.
13407    ///
13408    /// See [`Self::add_scope()`] for details.
13409    pub fn add_scopes<I, St>(
13410        mut self,
13411        scopes: I,
13412    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
13413    where
13414        I: IntoIterator<Item = St>,
13415        St: AsRef<str>,
13416    {
13417        self._scopes
13418            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13419        self
13420    }
13421
13422    /// Removes all scopes, and no default scope will be used either.
13423    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13424    /// for details).
13425    pub fn clear_scopes(
13426        mut self,
13427    ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
13428        self._scopes.clear();
13429        self
13430    }
13431}
13432
13433/// Abandons a Release in the Delivery Pipeline.
13434///
13435/// A builder for the *locations.deliveryPipelines.releases.abandon* method supported by a *project* resource.
13436/// It is not used directly, but through a [`ProjectMethods`] instance.
13437///
13438/// # Example
13439///
13440/// Instantiate a resource method builder
13441///
13442/// ```test_harness,no_run
13443/// # extern crate hyper;
13444/// # extern crate hyper_rustls;
13445/// # extern crate google_clouddeploy1 as clouddeploy1;
13446/// use clouddeploy1::api::AbandonReleaseRequest;
13447/// # async fn dox() {
13448/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13449///
13450/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13451/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13452/// #     secret,
13453/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13454/// # ).build().await.unwrap();
13455///
13456/// # let client = hyper_util::client::legacy::Client::builder(
13457/// #     hyper_util::rt::TokioExecutor::new()
13458/// # )
13459/// # .build(
13460/// #     hyper_rustls::HttpsConnectorBuilder::new()
13461/// #         .with_native_roots()
13462/// #         .unwrap()
13463/// #         .https_or_http()
13464/// #         .enable_http1()
13465/// #         .build()
13466/// # );
13467/// # let mut hub = CloudDeploy::new(client, auth);
13468/// // As the method needs a request, you would usually fill it with the desired information
13469/// // into the respective structure. Some of the parts shown here might not be applicable !
13470/// // Values shown here are possibly random and not representative !
13471/// let mut req = AbandonReleaseRequest::default();
13472///
13473/// // You can configure optional parameters by calling the respective setters at will, and
13474/// // execute the final call using `doit()`.
13475/// // Values shown here are possibly random and not representative !
13476/// let result = hub.projects().locations_delivery_pipelines_releases_abandon(req, "name")
13477///              .doit().await;
13478/// # }
13479/// ```
13480pub struct ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
13481where
13482    C: 'a,
13483{
13484    hub: &'a CloudDeploy<C>,
13485    _request: AbandonReleaseRequest,
13486    _name: String,
13487    _delegate: Option<&'a mut dyn common::Delegate>,
13488    _additional_params: HashMap<String, String>,
13489    _scopes: BTreeSet<String>,
13490}
13491
13492impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {}
13493
13494impl<'a, C> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
13495where
13496    C: common::Connector,
13497{
13498    /// Perform the operation you have build so far.
13499    pub async fn doit(mut self) -> common::Result<(common::Response, AbandonReleaseResponse)> {
13500        use std::borrow::Cow;
13501        use std::io::{Read, Seek};
13502
13503        use common::{url::Params, ToParts};
13504        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13505
13506        let mut dd = common::DefaultDelegate;
13507        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13508        dlg.begin(common::MethodInfo {
13509            id: "clouddeploy.projects.locations.deliveryPipelines.releases.abandon",
13510            http_method: hyper::Method::POST,
13511        });
13512
13513        for &field in ["alt", "name"].iter() {
13514            if self._additional_params.contains_key(field) {
13515                dlg.finished(false);
13516                return Err(common::Error::FieldClash(field));
13517            }
13518        }
13519
13520        let mut params = Params::with_capacity(4 + self._additional_params.len());
13521        params.push("name", self._name);
13522
13523        params.extend(self._additional_params.iter());
13524
13525        params.push("alt", "json");
13526        let mut url = self.hub._base_url.clone() + "v1/{+name}:abandon";
13527        if self._scopes.is_empty() {
13528            self._scopes
13529                .insert(Scope::CloudPlatform.as_ref().to_string());
13530        }
13531
13532        #[allow(clippy::single_element_loop)]
13533        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13534            url = params.uri_replacement(url, param_name, find_this, true);
13535        }
13536        {
13537            let to_remove = ["name"];
13538            params.remove_params(&to_remove);
13539        }
13540
13541        let url = params.parse_with_url(&url);
13542
13543        let mut json_mime_type = mime::APPLICATION_JSON;
13544        let mut request_value_reader = {
13545            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13546            common::remove_json_null_values(&mut value);
13547            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13548            serde_json::to_writer(&mut dst, &value).unwrap();
13549            dst
13550        };
13551        let request_size = request_value_reader
13552            .seek(std::io::SeekFrom::End(0))
13553            .unwrap();
13554        request_value_reader
13555            .seek(std::io::SeekFrom::Start(0))
13556            .unwrap();
13557
13558        loop {
13559            let token = match self
13560                .hub
13561                .auth
13562                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13563                .await
13564            {
13565                Ok(token) => token,
13566                Err(e) => match dlg.token(e) {
13567                    Ok(token) => token,
13568                    Err(e) => {
13569                        dlg.finished(false);
13570                        return Err(common::Error::MissingToken(e));
13571                    }
13572                },
13573            };
13574            request_value_reader
13575                .seek(std::io::SeekFrom::Start(0))
13576                .unwrap();
13577            let mut req_result = {
13578                let client = &self.hub.client;
13579                dlg.pre_request();
13580                let mut req_builder = hyper::Request::builder()
13581                    .method(hyper::Method::POST)
13582                    .uri(url.as_str())
13583                    .header(USER_AGENT, self.hub._user_agent.clone());
13584
13585                if let Some(token) = token.as_ref() {
13586                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13587                }
13588
13589                let request = req_builder
13590                    .header(CONTENT_TYPE, json_mime_type.to_string())
13591                    .header(CONTENT_LENGTH, request_size as u64)
13592                    .body(common::to_body(
13593                        request_value_reader.get_ref().clone().into(),
13594                    ));
13595
13596                client.request(request.unwrap()).await
13597            };
13598
13599            match req_result {
13600                Err(err) => {
13601                    if let common::Retry::After(d) = dlg.http_error(&err) {
13602                        sleep(d).await;
13603                        continue;
13604                    }
13605                    dlg.finished(false);
13606                    return Err(common::Error::HttpError(err));
13607                }
13608                Ok(res) => {
13609                    let (mut parts, body) = res.into_parts();
13610                    let mut body = common::Body::new(body);
13611                    if !parts.status.is_success() {
13612                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13613                        let error = serde_json::from_str(&common::to_string(&bytes));
13614                        let response = common::to_response(parts, bytes.into());
13615
13616                        if let common::Retry::After(d) =
13617                            dlg.http_failure(&response, error.as_ref().ok())
13618                        {
13619                            sleep(d).await;
13620                            continue;
13621                        }
13622
13623                        dlg.finished(false);
13624
13625                        return Err(match error {
13626                            Ok(value) => common::Error::BadRequest(value),
13627                            _ => common::Error::Failure(response),
13628                        });
13629                    }
13630                    let response = {
13631                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13632                        let encoded = common::to_string(&bytes);
13633                        match serde_json::from_str(&encoded) {
13634                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13635                            Err(error) => {
13636                                dlg.response_json_decode_error(&encoded, &error);
13637                                return Err(common::Error::JsonDecodeError(
13638                                    encoded.to_string(),
13639                                    error,
13640                                ));
13641                            }
13642                        }
13643                    };
13644
13645                    dlg.finished(true);
13646                    return Ok(response);
13647                }
13648            }
13649        }
13650    }
13651
13652    ///
13653    /// Sets the *request* property to the given value.
13654    ///
13655    /// Even though the property as already been set when instantiating this call,
13656    /// we provide this method for API completeness.
13657    pub fn request(
13658        mut self,
13659        new_value: AbandonReleaseRequest,
13660    ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
13661        self._request = new_value;
13662        self
13663    }
13664    /// Required. Name of the Release. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}`.
13665    ///
13666    /// Sets the *name* path property to the given value.
13667    ///
13668    /// Even though the property as already been set when instantiating this call,
13669    /// we provide this method for API completeness.
13670    pub fn name(
13671        mut self,
13672        new_value: &str,
13673    ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
13674        self._name = new_value.to_string();
13675        self
13676    }
13677    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13678    /// while executing the actual API request.
13679    ///
13680    /// ````text
13681    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13682    /// ````
13683    ///
13684    /// Sets the *delegate* property to the given value.
13685    pub fn delegate(
13686        mut self,
13687        new_value: &'a mut dyn common::Delegate,
13688    ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
13689        self._delegate = Some(new_value);
13690        self
13691    }
13692
13693    /// Set any additional parameter of the query string used in the request.
13694    /// It should be used to set parameters which are not yet available through their own
13695    /// setters.
13696    ///
13697    /// Please note that this method must not be used to set any of the known parameters
13698    /// which have their own setter method. If done anyway, the request will fail.
13699    ///
13700    /// # Additional Parameters
13701    ///
13702    /// * *$.xgafv* (query-string) - V1 error format.
13703    /// * *access_token* (query-string) - OAuth access token.
13704    /// * *alt* (query-string) - Data format for response.
13705    /// * *callback* (query-string) - JSONP
13706    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13707    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
13708    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13709    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13710    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
13711    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13712    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13713    pub fn param<T>(
13714        mut self,
13715        name: T,
13716        value: T,
13717    ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
13718    where
13719        T: AsRef<str>,
13720    {
13721        self._additional_params
13722            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13723        self
13724    }
13725
13726    /// Identifies the authorization scope for the method you are building.
13727    ///
13728    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13729    /// [`Scope::CloudPlatform`].
13730    ///
13731    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13732    /// tokens for more than one scope.
13733    ///
13734    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13735    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13736    /// sufficient, a read-write scope will do as well.
13737    pub fn add_scope<St>(
13738        mut self,
13739        scope: St,
13740    ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
13741    where
13742        St: AsRef<str>,
13743    {
13744        self._scopes.insert(String::from(scope.as_ref()));
13745        self
13746    }
13747    /// Identifies the authorization scope(s) for the method you are building.
13748    ///
13749    /// See [`Self::add_scope()`] for details.
13750    pub fn add_scopes<I, St>(
13751        mut self,
13752        scopes: I,
13753    ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
13754    where
13755        I: IntoIterator<Item = St>,
13756        St: AsRef<str>,
13757    {
13758        self._scopes
13759            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13760        self
13761    }
13762
13763    /// Removes all scopes, and no default scope will be used either.
13764    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13765    /// for details).
13766    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
13767        self._scopes.clear();
13768        self
13769    }
13770}
13771
13772/// Creates a new Release in a given project and location.
13773///
13774/// A builder for the *locations.deliveryPipelines.releases.create* method supported by a *project* resource.
13775/// It is not used directly, but through a [`ProjectMethods`] instance.
13776///
13777/// # Example
13778///
13779/// Instantiate a resource method builder
13780///
13781/// ```test_harness,no_run
13782/// # extern crate hyper;
13783/// # extern crate hyper_rustls;
13784/// # extern crate google_clouddeploy1 as clouddeploy1;
13785/// use clouddeploy1::api::Release;
13786/// # async fn dox() {
13787/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13788///
13789/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13790/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13791/// #     secret,
13792/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13793/// # ).build().await.unwrap();
13794///
13795/// # let client = hyper_util::client::legacy::Client::builder(
13796/// #     hyper_util::rt::TokioExecutor::new()
13797/// # )
13798/// # .build(
13799/// #     hyper_rustls::HttpsConnectorBuilder::new()
13800/// #         .with_native_roots()
13801/// #         .unwrap()
13802/// #         .https_or_http()
13803/// #         .enable_http1()
13804/// #         .build()
13805/// # );
13806/// # let mut hub = CloudDeploy::new(client, auth);
13807/// // As the method needs a request, you would usually fill it with the desired information
13808/// // into the respective structure. Some of the parts shown here might not be applicable !
13809/// // Values shown here are possibly random and not representative !
13810/// let mut req = Release::default();
13811///
13812/// // You can configure optional parameters by calling the respective setters at will, and
13813/// // execute the final call using `doit()`.
13814/// // Values shown here are possibly random and not representative !
13815/// let result = hub.projects().locations_delivery_pipelines_releases_create(req, "parent")
13816///              .validate_only(true)
13817///              .request_id("sit")
13818///              .release_id("et")
13819///              .doit().await;
13820/// # }
13821/// ```
13822pub struct ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
13823where
13824    C: 'a,
13825{
13826    hub: &'a CloudDeploy<C>,
13827    _request: Release,
13828    _parent: String,
13829    _validate_only: Option<bool>,
13830    _request_id: Option<String>,
13831    _release_id: Option<String>,
13832    _delegate: Option<&'a mut dyn common::Delegate>,
13833    _additional_params: HashMap<String, String>,
13834    _scopes: BTreeSet<String>,
13835}
13836
13837impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {}
13838
13839impl<'a, C> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
13840where
13841    C: common::Connector,
13842{
13843    /// Perform the operation you have build so far.
13844    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13845        use std::borrow::Cow;
13846        use std::io::{Read, Seek};
13847
13848        use common::{url::Params, ToParts};
13849        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13850
13851        let mut dd = common::DefaultDelegate;
13852        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13853        dlg.begin(common::MethodInfo {
13854            id: "clouddeploy.projects.locations.deliveryPipelines.releases.create",
13855            http_method: hyper::Method::POST,
13856        });
13857
13858        for &field in ["alt", "parent", "validateOnly", "requestId", "releaseId"].iter() {
13859            if self._additional_params.contains_key(field) {
13860                dlg.finished(false);
13861                return Err(common::Error::FieldClash(field));
13862            }
13863        }
13864
13865        let mut params = Params::with_capacity(7 + self._additional_params.len());
13866        params.push("parent", self._parent);
13867        if let Some(value) = self._validate_only.as_ref() {
13868            params.push("validateOnly", value.to_string());
13869        }
13870        if let Some(value) = self._request_id.as_ref() {
13871            params.push("requestId", value);
13872        }
13873        if let Some(value) = self._release_id.as_ref() {
13874            params.push("releaseId", value);
13875        }
13876
13877        params.extend(self._additional_params.iter());
13878
13879        params.push("alt", "json");
13880        let mut url = self.hub._base_url.clone() + "v1/{+parent}/releases";
13881        if self._scopes.is_empty() {
13882            self._scopes
13883                .insert(Scope::CloudPlatform.as_ref().to_string());
13884        }
13885
13886        #[allow(clippy::single_element_loop)]
13887        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13888            url = params.uri_replacement(url, param_name, find_this, true);
13889        }
13890        {
13891            let to_remove = ["parent"];
13892            params.remove_params(&to_remove);
13893        }
13894
13895        let url = params.parse_with_url(&url);
13896
13897        let mut json_mime_type = mime::APPLICATION_JSON;
13898        let mut request_value_reader = {
13899            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13900            common::remove_json_null_values(&mut value);
13901            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13902            serde_json::to_writer(&mut dst, &value).unwrap();
13903            dst
13904        };
13905        let request_size = request_value_reader
13906            .seek(std::io::SeekFrom::End(0))
13907            .unwrap();
13908        request_value_reader
13909            .seek(std::io::SeekFrom::Start(0))
13910            .unwrap();
13911
13912        loop {
13913            let token = match self
13914                .hub
13915                .auth
13916                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13917                .await
13918            {
13919                Ok(token) => token,
13920                Err(e) => match dlg.token(e) {
13921                    Ok(token) => token,
13922                    Err(e) => {
13923                        dlg.finished(false);
13924                        return Err(common::Error::MissingToken(e));
13925                    }
13926                },
13927            };
13928            request_value_reader
13929                .seek(std::io::SeekFrom::Start(0))
13930                .unwrap();
13931            let mut req_result = {
13932                let client = &self.hub.client;
13933                dlg.pre_request();
13934                let mut req_builder = hyper::Request::builder()
13935                    .method(hyper::Method::POST)
13936                    .uri(url.as_str())
13937                    .header(USER_AGENT, self.hub._user_agent.clone());
13938
13939                if let Some(token) = token.as_ref() {
13940                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13941                }
13942
13943                let request = req_builder
13944                    .header(CONTENT_TYPE, json_mime_type.to_string())
13945                    .header(CONTENT_LENGTH, request_size as u64)
13946                    .body(common::to_body(
13947                        request_value_reader.get_ref().clone().into(),
13948                    ));
13949
13950                client.request(request.unwrap()).await
13951            };
13952
13953            match req_result {
13954                Err(err) => {
13955                    if let common::Retry::After(d) = dlg.http_error(&err) {
13956                        sleep(d).await;
13957                        continue;
13958                    }
13959                    dlg.finished(false);
13960                    return Err(common::Error::HttpError(err));
13961                }
13962                Ok(res) => {
13963                    let (mut parts, body) = res.into_parts();
13964                    let mut body = common::Body::new(body);
13965                    if !parts.status.is_success() {
13966                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13967                        let error = serde_json::from_str(&common::to_string(&bytes));
13968                        let response = common::to_response(parts, bytes.into());
13969
13970                        if let common::Retry::After(d) =
13971                            dlg.http_failure(&response, error.as_ref().ok())
13972                        {
13973                            sleep(d).await;
13974                            continue;
13975                        }
13976
13977                        dlg.finished(false);
13978
13979                        return Err(match error {
13980                            Ok(value) => common::Error::BadRequest(value),
13981                            _ => common::Error::Failure(response),
13982                        });
13983                    }
13984                    let response = {
13985                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13986                        let encoded = common::to_string(&bytes);
13987                        match serde_json::from_str(&encoded) {
13988                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13989                            Err(error) => {
13990                                dlg.response_json_decode_error(&encoded, &error);
13991                                return Err(common::Error::JsonDecodeError(
13992                                    encoded.to_string(),
13993                                    error,
13994                                ));
13995                            }
13996                        }
13997                    };
13998
13999                    dlg.finished(true);
14000                    return Ok(response);
14001                }
14002            }
14003        }
14004    }
14005
14006    ///
14007    /// Sets the *request* property to the given value.
14008    ///
14009    /// Even though the property as already been set when instantiating this call,
14010    /// we provide this method for API completeness.
14011    pub fn request(
14012        mut self,
14013        new_value: Release,
14014    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
14015        self._request = new_value;
14016        self
14017    }
14018    /// Required. The parent collection in which the `Release` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
14019    ///
14020    /// Sets the *parent* path property to the given value.
14021    ///
14022    /// Even though the property as already been set when instantiating this call,
14023    /// we provide this method for API completeness.
14024    pub fn parent(
14025        mut self,
14026        new_value: &str,
14027    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
14028        self._parent = new_value.to_string();
14029        self
14030    }
14031    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
14032    ///
14033    /// Sets the *validate only* query property to the given value.
14034    pub fn validate_only(
14035        mut self,
14036        new_value: bool,
14037    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
14038        self._validate_only = Some(new_value);
14039        self
14040    }
14041    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
14042    ///
14043    /// Sets the *request id* query property to the given value.
14044    pub fn request_id(
14045        mut self,
14046        new_value: &str,
14047    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
14048        self._request_id = Some(new_value.to_string());
14049        self
14050    }
14051    /// Required. ID of the `Release`.
14052    ///
14053    /// Sets the *release id* query property to the given value.
14054    pub fn release_id(
14055        mut self,
14056        new_value: &str,
14057    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
14058        self._release_id = Some(new_value.to_string());
14059        self
14060    }
14061    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14062    /// while executing the actual API request.
14063    ///
14064    /// ````text
14065    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14066    /// ````
14067    ///
14068    /// Sets the *delegate* property to the given value.
14069    pub fn delegate(
14070        mut self,
14071        new_value: &'a mut dyn common::Delegate,
14072    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
14073        self._delegate = Some(new_value);
14074        self
14075    }
14076
14077    /// Set any additional parameter of the query string used in the request.
14078    /// It should be used to set parameters which are not yet available through their own
14079    /// setters.
14080    ///
14081    /// Please note that this method must not be used to set any of the known parameters
14082    /// which have their own setter method. If done anyway, the request will fail.
14083    ///
14084    /// # Additional Parameters
14085    ///
14086    /// * *$.xgafv* (query-string) - V1 error format.
14087    /// * *access_token* (query-string) - OAuth access token.
14088    /// * *alt* (query-string) - Data format for response.
14089    /// * *callback* (query-string) - JSONP
14090    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14091    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14092    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14093    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14094    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14095    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14096    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14097    pub fn param<T>(
14098        mut self,
14099        name: T,
14100        value: T,
14101    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
14102    where
14103        T: AsRef<str>,
14104    {
14105        self._additional_params
14106            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14107        self
14108    }
14109
14110    /// Identifies the authorization scope for the method you are building.
14111    ///
14112    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14113    /// [`Scope::CloudPlatform`].
14114    ///
14115    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14116    /// tokens for more than one scope.
14117    ///
14118    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14119    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14120    /// sufficient, a read-write scope will do as well.
14121    pub fn add_scope<St>(
14122        mut self,
14123        scope: St,
14124    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
14125    where
14126        St: AsRef<str>,
14127    {
14128        self._scopes.insert(String::from(scope.as_ref()));
14129        self
14130    }
14131    /// Identifies the authorization scope(s) for the method you are building.
14132    ///
14133    /// See [`Self::add_scope()`] for details.
14134    pub fn add_scopes<I, St>(
14135        mut self,
14136        scopes: I,
14137    ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
14138    where
14139        I: IntoIterator<Item = St>,
14140        St: AsRef<str>,
14141    {
14142        self._scopes
14143            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14144        self
14145    }
14146
14147    /// Removes all scopes, and no default scope will be used either.
14148    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14149    /// for details).
14150    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
14151        self._scopes.clear();
14152        self
14153    }
14154}
14155
14156/// Gets details of a single Release.
14157///
14158/// A builder for the *locations.deliveryPipelines.releases.get* method supported by a *project* resource.
14159/// It is not used directly, but through a [`ProjectMethods`] instance.
14160///
14161/// # Example
14162///
14163/// Instantiate a resource method builder
14164///
14165/// ```test_harness,no_run
14166/// # extern crate hyper;
14167/// # extern crate hyper_rustls;
14168/// # extern crate google_clouddeploy1 as clouddeploy1;
14169/// # async fn dox() {
14170/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14171///
14172/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14173/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14174/// #     secret,
14175/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14176/// # ).build().await.unwrap();
14177///
14178/// # let client = hyper_util::client::legacy::Client::builder(
14179/// #     hyper_util::rt::TokioExecutor::new()
14180/// # )
14181/// # .build(
14182/// #     hyper_rustls::HttpsConnectorBuilder::new()
14183/// #         .with_native_roots()
14184/// #         .unwrap()
14185/// #         .https_or_http()
14186/// #         .enable_http1()
14187/// #         .build()
14188/// # );
14189/// # let mut hub = CloudDeploy::new(client, auth);
14190/// // You can configure optional parameters by calling the respective setters at will, and
14191/// // execute the final call using `doit()`.
14192/// // Values shown here are possibly random and not representative !
14193/// let result = hub.projects().locations_delivery_pipelines_releases_get("name")
14194///              .doit().await;
14195/// # }
14196/// ```
14197pub struct ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
14198where
14199    C: 'a,
14200{
14201    hub: &'a CloudDeploy<C>,
14202    _name: String,
14203    _delegate: Option<&'a mut dyn common::Delegate>,
14204    _additional_params: HashMap<String, String>,
14205    _scopes: BTreeSet<String>,
14206}
14207
14208impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {}
14209
14210impl<'a, C> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
14211where
14212    C: common::Connector,
14213{
14214    /// Perform the operation you have build so far.
14215    pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
14216        use std::borrow::Cow;
14217        use std::io::{Read, Seek};
14218
14219        use common::{url::Params, ToParts};
14220        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14221
14222        let mut dd = common::DefaultDelegate;
14223        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14224        dlg.begin(common::MethodInfo {
14225            id: "clouddeploy.projects.locations.deliveryPipelines.releases.get",
14226            http_method: hyper::Method::GET,
14227        });
14228
14229        for &field in ["alt", "name"].iter() {
14230            if self._additional_params.contains_key(field) {
14231                dlg.finished(false);
14232                return Err(common::Error::FieldClash(field));
14233            }
14234        }
14235
14236        let mut params = Params::with_capacity(3 + self._additional_params.len());
14237        params.push("name", self._name);
14238
14239        params.extend(self._additional_params.iter());
14240
14241        params.push("alt", "json");
14242        let mut url = self.hub._base_url.clone() + "v1/{+name}";
14243        if self._scopes.is_empty() {
14244            self._scopes
14245                .insert(Scope::CloudPlatform.as_ref().to_string());
14246        }
14247
14248        #[allow(clippy::single_element_loop)]
14249        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14250            url = params.uri_replacement(url, param_name, find_this, true);
14251        }
14252        {
14253            let to_remove = ["name"];
14254            params.remove_params(&to_remove);
14255        }
14256
14257        let url = params.parse_with_url(&url);
14258
14259        loop {
14260            let token = match self
14261                .hub
14262                .auth
14263                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14264                .await
14265            {
14266                Ok(token) => token,
14267                Err(e) => match dlg.token(e) {
14268                    Ok(token) => token,
14269                    Err(e) => {
14270                        dlg.finished(false);
14271                        return Err(common::Error::MissingToken(e));
14272                    }
14273                },
14274            };
14275            let mut req_result = {
14276                let client = &self.hub.client;
14277                dlg.pre_request();
14278                let mut req_builder = hyper::Request::builder()
14279                    .method(hyper::Method::GET)
14280                    .uri(url.as_str())
14281                    .header(USER_AGENT, self.hub._user_agent.clone());
14282
14283                if let Some(token) = token.as_ref() {
14284                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14285                }
14286
14287                let request = req_builder
14288                    .header(CONTENT_LENGTH, 0_u64)
14289                    .body(common::to_body::<String>(None));
14290
14291                client.request(request.unwrap()).await
14292            };
14293
14294            match req_result {
14295                Err(err) => {
14296                    if let common::Retry::After(d) = dlg.http_error(&err) {
14297                        sleep(d).await;
14298                        continue;
14299                    }
14300                    dlg.finished(false);
14301                    return Err(common::Error::HttpError(err));
14302                }
14303                Ok(res) => {
14304                    let (mut parts, body) = res.into_parts();
14305                    let mut body = common::Body::new(body);
14306                    if !parts.status.is_success() {
14307                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14308                        let error = serde_json::from_str(&common::to_string(&bytes));
14309                        let response = common::to_response(parts, bytes.into());
14310
14311                        if let common::Retry::After(d) =
14312                            dlg.http_failure(&response, error.as_ref().ok())
14313                        {
14314                            sleep(d).await;
14315                            continue;
14316                        }
14317
14318                        dlg.finished(false);
14319
14320                        return Err(match error {
14321                            Ok(value) => common::Error::BadRequest(value),
14322                            _ => common::Error::Failure(response),
14323                        });
14324                    }
14325                    let response = {
14326                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14327                        let encoded = common::to_string(&bytes);
14328                        match serde_json::from_str(&encoded) {
14329                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14330                            Err(error) => {
14331                                dlg.response_json_decode_error(&encoded, &error);
14332                                return Err(common::Error::JsonDecodeError(
14333                                    encoded.to_string(),
14334                                    error,
14335                                ));
14336                            }
14337                        }
14338                    };
14339
14340                    dlg.finished(true);
14341                    return Ok(response);
14342                }
14343            }
14344        }
14345    }
14346
14347    /// Required. Name of the `Release`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
14348    ///
14349    /// Sets the *name* path property to the given value.
14350    ///
14351    /// Even though the property as already been set when instantiating this call,
14352    /// we provide this method for API completeness.
14353    pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
14354        self._name = new_value.to_string();
14355        self
14356    }
14357    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14358    /// while executing the actual API request.
14359    ///
14360    /// ````text
14361    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14362    /// ````
14363    ///
14364    /// Sets the *delegate* property to the given value.
14365    pub fn delegate(
14366        mut self,
14367        new_value: &'a mut dyn common::Delegate,
14368    ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
14369        self._delegate = Some(new_value);
14370        self
14371    }
14372
14373    /// Set any additional parameter of the query string used in the request.
14374    /// It should be used to set parameters which are not yet available through their own
14375    /// setters.
14376    ///
14377    /// Please note that this method must not be used to set any of the known parameters
14378    /// which have their own setter method. If done anyway, the request will fail.
14379    ///
14380    /// # Additional Parameters
14381    ///
14382    /// * *$.xgafv* (query-string) - V1 error format.
14383    /// * *access_token* (query-string) - OAuth access token.
14384    /// * *alt* (query-string) - Data format for response.
14385    /// * *callback* (query-string) - JSONP
14386    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14387    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14388    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14389    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14390    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14391    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14392    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14393    pub fn param<T>(
14394        mut self,
14395        name: T,
14396        value: T,
14397    ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
14398    where
14399        T: AsRef<str>,
14400    {
14401        self._additional_params
14402            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14403        self
14404    }
14405
14406    /// Identifies the authorization scope for the method you are building.
14407    ///
14408    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14409    /// [`Scope::CloudPlatform`].
14410    ///
14411    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14412    /// tokens for more than one scope.
14413    ///
14414    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14415    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14416    /// sufficient, a read-write scope will do as well.
14417    pub fn add_scope<St>(
14418        mut self,
14419        scope: St,
14420    ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
14421    where
14422        St: AsRef<str>,
14423    {
14424        self._scopes.insert(String::from(scope.as_ref()));
14425        self
14426    }
14427    /// Identifies the authorization scope(s) for the method you are building.
14428    ///
14429    /// See [`Self::add_scope()`] for details.
14430    pub fn add_scopes<I, St>(
14431        mut self,
14432        scopes: I,
14433    ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
14434    where
14435        I: IntoIterator<Item = St>,
14436        St: AsRef<str>,
14437    {
14438        self._scopes
14439            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14440        self
14441    }
14442
14443    /// Removes all scopes, and no default scope will be used either.
14444    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14445    /// for details).
14446    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
14447        self._scopes.clear();
14448        self
14449    }
14450}
14451
14452/// Lists Releases in a given project and location.
14453///
14454/// A builder for the *locations.deliveryPipelines.releases.list* method supported by a *project* resource.
14455/// It is not used directly, but through a [`ProjectMethods`] instance.
14456///
14457/// # Example
14458///
14459/// Instantiate a resource method builder
14460///
14461/// ```test_harness,no_run
14462/// # extern crate hyper;
14463/// # extern crate hyper_rustls;
14464/// # extern crate google_clouddeploy1 as clouddeploy1;
14465/// # async fn dox() {
14466/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14467///
14468/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14469/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14470/// #     secret,
14471/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14472/// # ).build().await.unwrap();
14473///
14474/// # let client = hyper_util::client::legacy::Client::builder(
14475/// #     hyper_util::rt::TokioExecutor::new()
14476/// # )
14477/// # .build(
14478/// #     hyper_rustls::HttpsConnectorBuilder::new()
14479/// #         .with_native_roots()
14480/// #         .unwrap()
14481/// #         .https_or_http()
14482/// #         .enable_http1()
14483/// #         .build()
14484/// # );
14485/// # let mut hub = CloudDeploy::new(client, auth);
14486/// // You can configure optional parameters by calling the respective setters at will, and
14487/// // execute the final call using `doit()`.
14488/// // Values shown here are possibly random and not representative !
14489/// let result = hub.projects().locations_delivery_pipelines_releases_list("parent")
14490///              .page_token("ipsum")
14491///              .page_size(-18)
14492///              .order_by("sanctus")
14493///              .filter("Lorem")
14494///              .doit().await;
14495/// # }
14496/// ```
14497pub struct ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
14498where
14499    C: 'a,
14500{
14501    hub: &'a CloudDeploy<C>,
14502    _parent: String,
14503    _page_token: Option<String>,
14504    _page_size: Option<i32>,
14505    _order_by: Option<String>,
14506    _filter: Option<String>,
14507    _delegate: Option<&'a mut dyn common::Delegate>,
14508    _additional_params: HashMap<String, String>,
14509    _scopes: BTreeSet<String>,
14510}
14511
14512impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {}
14513
14514impl<'a, C> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
14515where
14516    C: common::Connector,
14517{
14518    /// Perform the operation you have build so far.
14519    pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
14520        use std::borrow::Cow;
14521        use std::io::{Read, Seek};
14522
14523        use common::{url::Params, ToParts};
14524        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14525
14526        let mut dd = common::DefaultDelegate;
14527        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14528        dlg.begin(common::MethodInfo {
14529            id: "clouddeploy.projects.locations.deliveryPipelines.releases.list",
14530            http_method: hyper::Method::GET,
14531        });
14532
14533        for &field in [
14534            "alt",
14535            "parent",
14536            "pageToken",
14537            "pageSize",
14538            "orderBy",
14539            "filter",
14540        ]
14541        .iter()
14542        {
14543            if self._additional_params.contains_key(field) {
14544                dlg.finished(false);
14545                return Err(common::Error::FieldClash(field));
14546            }
14547        }
14548
14549        let mut params = Params::with_capacity(7 + self._additional_params.len());
14550        params.push("parent", self._parent);
14551        if let Some(value) = self._page_token.as_ref() {
14552            params.push("pageToken", value);
14553        }
14554        if let Some(value) = self._page_size.as_ref() {
14555            params.push("pageSize", value.to_string());
14556        }
14557        if let Some(value) = self._order_by.as_ref() {
14558            params.push("orderBy", value);
14559        }
14560        if let Some(value) = self._filter.as_ref() {
14561            params.push("filter", value);
14562        }
14563
14564        params.extend(self._additional_params.iter());
14565
14566        params.push("alt", "json");
14567        let mut url = self.hub._base_url.clone() + "v1/{+parent}/releases";
14568        if self._scopes.is_empty() {
14569            self._scopes
14570                .insert(Scope::CloudPlatform.as_ref().to_string());
14571        }
14572
14573        #[allow(clippy::single_element_loop)]
14574        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14575            url = params.uri_replacement(url, param_name, find_this, true);
14576        }
14577        {
14578            let to_remove = ["parent"];
14579            params.remove_params(&to_remove);
14580        }
14581
14582        let url = params.parse_with_url(&url);
14583
14584        loop {
14585            let token = match self
14586                .hub
14587                .auth
14588                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14589                .await
14590            {
14591                Ok(token) => token,
14592                Err(e) => match dlg.token(e) {
14593                    Ok(token) => token,
14594                    Err(e) => {
14595                        dlg.finished(false);
14596                        return Err(common::Error::MissingToken(e));
14597                    }
14598                },
14599            };
14600            let mut req_result = {
14601                let client = &self.hub.client;
14602                dlg.pre_request();
14603                let mut req_builder = hyper::Request::builder()
14604                    .method(hyper::Method::GET)
14605                    .uri(url.as_str())
14606                    .header(USER_AGENT, self.hub._user_agent.clone());
14607
14608                if let Some(token) = token.as_ref() {
14609                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14610                }
14611
14612                let request = req_builder
14613                    .header(CONTENT_LENGTH, 0_u64)
14614                    .body(common::to_body::<String>(None));
14615
14616                client.request(request.unwrap()).await
14617            };
14618
14619            match req_result {
14620                Err(err) => {
14621                    if let common::Retry::After(d) = dlg.http_error(&err) {
14622                        sleep(d).await;
14623                        continue;
14624                    }
14625                    dlg.finished(false);
14626                    return Err(common::Error::HttpError(err));
14627                }
14628                Ok(res) => {
14629                    let (mut parts, body) = res.into_parts();
14630                    let mut body = common::Body::new(body);
14631                    if !parts.status.is_success() {
14632                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14633                        let error = serde_json::from_str(&common::to_string(&bytes));
14634                        let response = common::to_response(parts, bytes.into());
14635
14636                        if let common::Retry::After(d) =
14637                            dlg.http_failure(&response, error.as_ref().ok())
14638                        {
14639                            sleep(d).await;
14640                            continue;
14641                        }
14642
14643                        dlg.finished(false);
14644
14645                        return Err(match error {
14646                            Ok(value) => common::Error::BadRequest(value),
14647                            _ => common::Error::Failure(response),
14648                        });
14649                    }
14650                    let response = {
14651                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14652                        let encoded = common::to_string(&bytes);
14653                        match serde_json::from_str(&encoded) {
14654                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14655                            Err(error) => {
14656                                dlg.response_json_decode_error(&encoded, &error);
14657                                return Err(common::Error::JsonDecodeError(
14658                                    encoded.to_string(),
14659                                    error,
14660                                ));
14661                            }
14662                        }
14663                    };
14664
14665                    dlg.finished(true);
14666                    return Ok(response);
14667                }
14668            }
14669        }
14670    }
14671
14672    /// Required. The `DeliveryPipeline` which owns this collection of `Release` objects.
14673    ///
14674    /// Sets the *parent* path property to the given value.
14675    ///
14676    /// Even though the property as already been set when instantiating this call,
14677    /// we provide this method for API completeness.
14678    pub fn parent(
14679        mut self,
14680        new_value: &str,
14681    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
14682        self._parent = new_value.to_string();
14683        self
14684    }
14685    /// Optional. A page token, received from a previous `ListReleases` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
14686    ///
14687    /// Sets the *page token* query property to the given value.
14688    pub fn page_token(
14689        mut self,
14690        new_value: &str,
14691    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
14692        self._page_token = Some(new_value.to_string());
14693        self
14694    }
14695    /// Optional. The maximum number of `Release` objects to return. The service may return fewer than this value. If unspecified, at most 50 `Release` objects will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
14696    ///
14697    /// Sets the *page size* query property to the given value.
14698    pub fn page_size(
14699        mut self,
14700        new_value: i32,
14701    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
14702        self._page_size = Some(new_value);
14703        self
14704    }
14705    /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
14706    ///
14707    /// Sets the *order by* query property to the given value.
14708    pub fn order_by(
14709        mut self,
14710        new_value: &str,
14711    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
14712        self._order_by = Some(new_value.to_string());
14713        self
14714    }
14715    /// Optional. Filter releases to be returned. See https://google.aip.dev/160 for more details.
14716    ///
14717    /// Sets the *filter* query property to the given value.
14718    pub fn filter(
14719        mut self,
14720        new_value: &str,
14721    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
14722        self._filter = Some(new_value.to_string());
14723        self
14724    }
14725    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14726    /// while executing the actual API request.
14727    ///
14728    /// ````text
14729    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14730    /// ````
14731    ///
14732    /// Sets the *delegate* property to the given value.
14733    pub fn delegate(
14734        mut self,
14735        new_value: &'a mut dyn common::Delegate,
14736    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
14737        self._delegate = Some(new_value);
14738        self
14739    }
14740
14741    /// Set any additional parameter of the query string used in the request.
14742    /// It should be used to set parameters which are not yet available through their own
14743    /// setters.
14744    ///
14745    /// Please note that this method must not be used to set any of the known parameters
14746    /// which have their own setter method. If done anyway, the request will fail.
14747    ///
14748    /// # Additional Parameters
14749    ///
14750    /// * *$.xgafv* (query-string) - V1 error format.
14751    /// * *access_token* (query-string) - OAuth access token.
14752    /// * *alt* (query-string) - Data format for response.
14753    /// * *callback* (query-string) - JSONP
14754    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14755    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
14756    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14757    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14758    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
14759    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14760    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14761    pub fn param<T>(
14762        mut self,
14763        name: T,
14764        value: T,
14765    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
14766    where
14767        T: AsRef<str>,
14768    {
14769        self._additional_params
14770            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14771        self
14772    }
14773
14774    /// Identifies the authorization scope for the method you are building.
14775    ///
14776    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14777    /// [`Scope::CloudPlatform`].
14778    ///
14779    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14780    /// tokens for more than one scope.
14781    ///
14782    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14783    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14784    /// sufficient, a read-write scope will do as well.
14785    pub fn add_scope<St>(
14786        mut self,
14787        scope: St,
14788    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
14789    where
14790        St: AsRef<str>,
14791    {
14792        self._scopes.insert(String::from(scope.as_ref()));
14793        self
14794    }
14795    /// Identifies the authorization scope(s) for the method you are building.
14796    ///
14797    /// See [`Self::add_scope()`] for details.
14798    pub fn add_scopes<I, St>(
14799        mut self,
14800        scopes: I,
14801    ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
14802    where
14803        I: IntoIterator<Item = St>,
14804        St: AsRef<str>,
14805    {
14806        self._scopes
14807            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14808        self
14809    }
14810
14811    /// Removes all scopes, and no default scope will be used either.
14812    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14813    /// for details).
14814    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
14815        self._scopes.clear();
14816        self
14817    }
14818}
14819
14820/// Creates a new DeliveryPipeline in a given project and location.
14821///
14822/// A builder for the *locations.deliveryPipelines.create* method supported by a *project* resource.
14823/// It is not used directly, but through a [`ProjectMethods`] instance.
14824///
14825/// # Example
14826///
14827/// Instantiate a resource method builder
14828///
14829/// ```test_harness,no_run
14830/// # extern crate hyper;
14831/// # extern crate hyper_rustls;
14832/// # extern crate google_clouddeploy1 as clouddeploy1;
14833/// use clouddeploy1::api::DeliveryPipeline;
14834/// # async fn dox() {
14835/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14836///
14837/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14838/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14839/// #     secret,
14840/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14841/// # ).build().await.unwrap();
14842///
14843/// # let client = hyper_util::client::legacy::Client::builder(
14844/// #     hyper_util::rt::TokioExecutor::new()
14845/// # )
14846/// # .build(
14847/// #     hyper_rustls::HttpsConnectorBuilder::new()
14848/// #         .with_native_roots()
14849/// #         .unwrap()
14850/// #         .https_or_http()
14851/// #         .enable_http1()
14852/// #         .build()
14853/// # );
14854/// # let mut hub = CloudDeploy::new(client, auth);
14855/// // As the method needs a request, you would usually fill it with the desired information
14856/// // into the respective structure. Some of the parts shown here might not be applicable !
14857/// // Values shown here are possibly random and not representative !
14858/// let mut req = DeliveryPipeline::default();
14859///
14860/// // You can configure optional parameters by calling the respective setters at will, and
14861/// // execute the final call using `doit()`.
14862/// // Values shown here are possibly random and not representative !
14863/// let result = hub.projects().locations_delivery_pipelines_create(req, "parent")
14864///              .validate_only(true)
14865///              .request_id("et")
14866///              .delivery_pipeline_id("sed")
14867///              .doit().await;
14868/// # }
14869/// ```
14870pub struct ProjectLocationDeliveryPipelineCreateCall<'a, C>
14871where
14872    C: 'a,
14873{
14874    hub: &'a CloudDeploy<C>,
14875    _request: DeliveryPipeline,
14876    _parent: String,
14877    _validate_only: Option<bool>,
14878    _request_id: Option<String>,
14879    _delivery_pipeline_id: Option<String>,
14880    _delegate: Option<&'a mut dyn common::Delegate>,
14881    _additional_params: HashMap<String, String>,
14882    _scopes: BTreeSet<String>,
14883}
14884
14885impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineCreateCall<'a, C> {}
14886
14887impl<'a, C> ProjectLocationDeliveryPipelineCreateCall<'a, C>
14888where
14889    C: common::Connector,
14890{
14891    /// Perform the operation you have build so far.
14892    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14893        use std::borrow::Cow;
14894        use std::io::{Read, Seek};
14895
14896        use common::{url::Params, ToParts};
14897        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14898
14899        let mut dd = common::DefaultDelegate;
14900        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14901        dlg.begin(common::MethodInfo {
14902            id: "clouddeploy.projects.locations.deliveryPipelines.create",
14903            http_method: hyper::Method::POST,
14904        });
14905
14906        for &field in [
14907            "alt",
14908            "parent",
14909            "validateOnly",
14910            "requestId",
14911            "deliveryPipelineId",
14912        ]
14913        .iter()
14914        {
14915            if self._additional_params.contains_key(field) {
14916                dlg.finished(false);
14917                return Err(common::Error::FieldClash(field));
14918            }
14919        }
14920
14921        let mut params = Params::with_capacity(7 + self._additional_params.len());
14922        params.push("parent", self._parent);
14923        if let Some(value) = self._validate_only.as_ref() {
14924            params.push("validateOnly", value.to_string());
14925        }
14926        if let Some(value) = self._request_id.as_ref() {
14927            params.push("requestId", value);
14928        }
14929        if let Some(value) = self._delivery_pipeline_id.as_ref() {
14930            params.push("deliveryPipelineId", value);
14931        }
14932
14933        params.extend(self._additional_params.iter());
14934
14935        params.push("alt", "json");
14936        let mut url = self.hub._base_url.clone() + "v1/{+parent}/deliveryPipelines";
14937        if self._scopes.is_empty() {
14938            self._scopes
14939                .insert(Scope::CloudPlatform.as_ref().to_string());
14940        }
14941
14942        #[allow(clippy::single_element_loop)]
14943        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14944            url = params.uri_replacement(url, param_name, find_this, true);
14945        }
14946        {
14947            let to_remove = ["parent"];
14948            params.remove_params(&to_remove);
14949        }
14950
14951        let url = params.parse_with_url(&url);
14952
14953        let mut json_mime_type = mime::APPLICATION_JSON;
14954        let mut request_value_reader = {
14955            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14956            common::remove_json_null_values(&mut value);
14957            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14958            serde_json::to_writer(&mut dst, &value).unwrap();
14959            dst
14960        };
14961        let request_size = request_value_reader
14962            .seek(std::io::SeekFrom::End(0))
14963            .unwrap();
14964        request_value_reader
14965            .seek(std::io::SeekFrom::Start(0))
14966            .unwrap();
14967
14968        loop {
14969            let token = match self
14970                .hub
14971                .auth
14972                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14973                .await
14974            {
14975                Ok(token) => token,
14976                Err(e) => match dlg.token(e) {
14977                    Ok(token) => token,
14978                    Err(e) => {
14979                        dlg.finished(false);
14980                        return Err(common::Error::MissingToken(e));
14981                    }
14982                },
14983            };
14984            request_value_reader
14985                .seek(std::io::SeekFrom::Start(0))
14986                .unwrap();
14987            let mut req_result = {
14988                let client = &self.hub.client;
14989                dlg.pre_request();
14990                let mut req_builder = hyper::Request::builder()
14991                    .method(hyper::Method::POST)
14992                    .uri(url.as_str())
14993                    .header(USER_AGENT, self.hub._user_agent.clone());
14994
14995                if let Some(token) = token.as_ref() {
14996                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14997                }
14998
14999                let request = req_builder
15000                    .header(CONTENT_TYPE, json_mime_type.to_string())
15001                    .header(CONTENT_LENGTH, request_size as u64)
15002                    .body(common::to_body(
15003                        request_value_reader.get_ref().clone().into(),
15004                    ));
15005
15006                client.request(request.unwrap()).await
15007            };
15008
15009            match req_result {
15010                Err(err) => {
15011                    if let common::Retry::After(d) = dlg.http_error(&err) {
15012                        sleep(d).await;
15013                        continue;
15014                    }
15015                    dlg.finished(false);
15016                    return Err(common::Error::HttpError(err));
15017                }
15018                Ok(res) => {
15019                    let (mut parts, body) = res.into_parts();
15020                    let mut body = common::Body::new(body);
15021                    if !parts.status.is_success() {
15022                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15023                        let error = serde_json::from_str(&common::to_string(&bytes));
15024                        let response = common::to_response(parts, bytes.into());
15025
15026                        if let common::Retry::After(d) =
15027                            dlg.http_failure(&response, error.as_ref().ok())
15028                        {
15029                            sleep(d).await;
15030                            continue;
15031                        }
15032
15033                        dlg.finished(false);
15034
15035                        return Err(match error {
15036                            Ok(value) => common::Error::BadRequest(value),
15037                            _ => common::Error::Failure(response),
15038                        });
15039                    }
15040                    let response = {
15041                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15042                        let encoded = common::to_string(&bytes);
15043                        match serde_json::from_str(&encoded) {
15044                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15045                            Err(error) => {
15046                                dlg.response_json_decode_error(&encoded, &error);
15047                                return Err(common::Error::JsonDecodeError(
15048                                    encoded.to_string(),
15049                                    error,
15050                                ));
15051                            }
15052                        }
15053                    };
15054
15055                    dlg.finished(true);
15056                    return Ok(response);
15057                }
15058            }
15059        }
15060    }
15061
15062    ///
15063    /// Sets the *request* property to the given value.
15064    ///
15065    /// Even though the property as already been set when instantiating this call,
15066    /// we provide this method for API completeness.
15067    pub fn request(
15068        mut self,
15069        new_value: DeliveryPipeline,
15070    ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
15071        self._request = new_value;
15072        self
15073    }
15074    /// Required. The parent collection in which the `DeliveryPipeline` should be created. Format should be `projects/{project_id}/locations/{location_name}`.
15075    ///
15076    /// Sets the *parent* path property to the given value.
15077    ///
15078    /// Even though the property as already been set when instantiating this call,
15079    /// we provide this method for API completeness.
15080    pub fn parent(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
15081        self._parent = new_value.to_string();
15082        self
15083    }
15084    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
15085    ///
15086    /// Sets the *validate only* query property to the given value.
15087    pub fn validate_only(
15088        mut self,
15089        new_value: bool,
15090    ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
15091        self._validate_only = Some(new_value);
15092        self
15093    }
15094    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
15095    ///
15096    /// Sets the *request id* query property to the given value.
15097    pub fn request_id(
15098        mut self,
15099        new_value: &str,
15100    ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
15101        self._request_id = Some(new_value.to_string());
15102        self
15103    }
15104    /// Required. ID of the `DeliveryPipeline`.
15105    ///
15106    /// Sets the *delivery pipeline id* query property to the given value.
15107    pub fn delivery_pipeline_id(
15108        mut self,
15109        new_value: &str,
15110    ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
15111        self._delivery_pipeline_id = Some(new_value.to_string());
15112        self
15113    }
15114    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15115    /// while executing the actual API request.
15116    ///
15117    /// ````text
15118    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15119    /// ````
15120    ///
15121    /// Sets the *delegate* property to the given value.
15122    pub fn delegate(
15123        mut self,
15124        new_value: &'a mut dyn common::Delegate,
15125    ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
15126        self._delegate = Some(new_value);
15127        self
15128    }
15129
15130    /// Set any additional parameter of the query string used in the request.
15131    /// It should be used to set parameters which are not yet available through their own
15132    /// setters.
15133    ///
15134    /// Please note that this method must not be used to set any of the known parameters
15135    /// which have their own setter method. If done anyway, the request will fail.
15136    ///
15137    /// # Additional Parameters
15138    ///
15139    /// * *$.xgafv* (query-string) - V1 error format.
15140    /// * *access_token* (query-string) - OAuth access token.
15141    /// * *alt* (query-string) - Data format for response.
15142    /// * *callback* (query-string) - JSONP
15143    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15144    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15145    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15146    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15147    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15148    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15149    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15150    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineCreateCall<'a, C>
15151    where
15152        T: AsRef<str>,
15153    {
15154        self._additional_params
15155            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15156        self
15157    }
15158
15159    /// Identifies the authorization scope for the method you are building.
15160    ///
15161    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15162    /// [`Scope::CloudPlatform`].
15163    ///
15164    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15165    /// tokens for more than one scope.
15166    ///
15167    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15168    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15169    /// sufficient, a read-write scope will do as well.
15170    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineCreateCall<'a, C>
15171    where
15172        St: AsRef<str>,
15173    {
15174        self._scopes.insert(String::from(scope.as_ref()));
15175        self
15176    }
15177    /// Identifies the authorization scope(s) for the method you are building.
15178    ///
15179    /// See [`Self::add_scope()`] for details.
15180    pub fn add_scopes<I, St>(
15181        mut self,
15182        scopes: I,
15183    ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C>
15184    where
15185        I: IntoIterator<Item = St>,
15186        St: AsRef<str>,
15187    {
15188        self._scopes
15189            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15190        self
15191    }
15192
15193    /// Removes all scopes, and no default scope will be used either.
15194    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15195    /// for details).
15196    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
15197        self._scopes.clear();
15198        self
15199    }
15200}
15201
15202/// Deletes a single DeliveryPipeline.
15203///
15204/// A builder for the *locations.deliveryPipelines.delete* method supported by a *project* resource.
15205/// It is not used directly, but through a [`ProjectMethods`] instance.
15206///
15207/// # Example
15208///
15209/// Instantiate a resource method builder
15210///
15211/// ```test_harness,no_run
15212/// # extern crate hyper;
15213/// # extern crate hyper_rustls;
15214/// # extern crate google_clouddeploy1 as clouddeploy1;
15215/// # async fn dox() {
15216/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15217///
15218/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15219/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15220/// #     secret,
15221/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15222/// # ).build().await.unwrap();
15223///
15224/// # let client = hyper_util::client::legacy::Client::builder(
15225/// #     hyper_util::rt::TokioExecutor::new()
15226/// # )
15227/// # .build(
15228/// #     hyper_rustls::HttpsConnectorBuilder::new()
15229/// #         .with_native_roots()
15230/// #         .unwrap()
15231/// #         .https_or_http()
15232/// #         .enable_http1()
15233/// #         .build()
15234/// # );
15235/// # let mut hub = CloudDeploy::new(client, auth);
15236/// // You can configure optional parameters by calling the respective setters at will, and
15237/// // execute the final call using `doit()`.
15238/// // Values shown here are possibly random and not representative !
15239/// let result = hub.projects().locations_delivery_pipelines_delete("name")
15240///              .validate_only(false)
15241///              .request_id("elitr")
15242///              .force(false)
15243///              .etag("no")
15244///              .allow_missing(false)
15245///              .doit().await;
15246/// # }
15247/// ```
15248pub struct ProjectLocationDeliveryPipelineDeleteCall<'a, C>
15249where
15250    C: 'a,
15251{
15252    hub: &'a CloudDeploy<C>,
15253    _name: String,
15254    _validate_only: Option<bool>,
15255    _request_id: Option<String>,
15256    _force: Option<bool>,
15257    _etag: Option<String>,
15258    _allow_missing: Option<bool>,
15259    _delegate: Option<&'a mut dyn common::Delegate>,
15260    _additional_params: HashMap<String, String>,
15261    _scopes: BTreeSet<String>,
15262}
15263
15264impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineDeleteCall<'a, C> {}
15265
15266impl<'a, C> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
15267where
15268    C: common::Connector,
15269{
15270    /// Perform the operation you have build so far.
15271    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15272        use std::borrow::Cow;
15273        use std::io::{Read, Seek};
15274
15275        use common::{url::Params, ToParts};
15276        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15277
15278        let mut dd = common::DefaultDelegate;
15279        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15280        dlg.begin(common::MethodInfo {
15281            id: "clouddeploy.projects.locations.deliveryPipelines.delete",
15282            http_method: hyper::Method::DELETE,
15283        });
15284
15285        for &field in [
15286            "alt",
15287            "name",
15288            "validateOnly",
15289            "requestId",
15290            "force",
15291            "etag",
15292            "allowMissing",
15293        ]
15294        .iter()
15295        {
15296            if self._additional_params.contains_key(field) {
15297                dlg.finished(false);
15298                return Err(common::Error::FieldClash(field));
15299            }
15300        }
15301
15302        let mut params = Params::with_capacity(8 + self._additional_params.len());
15303        params.push("name", self._name);
15304        if let Some(value) = self._validate_only.as_ref() {
15305            params.push("validateOnly", value.to_string());
15306        }
15307        if let Some(value) = self._request_id.as_ref() {
15308            params.push("requestId", value);
15309        }
15310        if let Some(value) = self._force.as_ref() {
15311            params.push("force", value.to_string());
15312        }
15313        if let Some(value) = self._etag.as_ref() {
15314            params.push("etag", value);
15315        }
15316        if let Some(value) = self._allow_missing.as_ref() {
15317            params.push("allowMissing", value.to_string());
15318        }
15319
15320        params.extend(self._additional_params.iter());
15321
15322        params.push("alt", "json");
15323        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15324        if self._scopes.is_empty() {
15325            self._scopes
15326                .insert(Scope::CloudPlatform.as_ref().to_string());
15327        }
15328
15329        #[allow(clippy::single_element_loop)]
15330        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15331            url = params.uri_replacement(url, param_name, find_this, true);
15332        }
15333        {
15334            let to_remove = ["name"];
15335            params.remove_params(&to_remove);
15336        }
15337
15338        let url = params.parse_with_url(&url);
15339
15340        loop {
15341            let token = match self
15342                .hub
15343                .auth
15344                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15345                .await
15346            {
15347                Ok(token) => token,
15348                Err(e) => match dlg.token(e) {
15349                    Ok(token) => token,
15350                    Err(e) => {
15351                        dlg.finished(false);
15352                        return Err(common::Error::MissingToken(e));
15353                    }
15354                },
15355            };
15356            let mut req_result = {
15357                let client = &self.hub.client;
15358                dlg.pre_request();
15359                let mut req_builder = hyper::Request::builder()
15360                    .method(hyper::Method::DELETE)
15361                    .uri(url.as_str())
15362                    .header(USER_AGENT, self.hub._user_agent.clone());
15363
15364                if let Some(token) = token.as_ref() {
15365                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15366                }
15367
15368                let request = req_builder
15369                    .header(CONTENT_LENGTH, 0_u64)
15370                    .body(common::to_body::<String>(None));
15371
15372                client.request(request.unwrap()).await
15373            };
15374
15375            match req_result {
15376                Err(err) => {
15377                    if let common::Retry::After(d) = dlg.http_error(&err) {
15378                        sleep(d).await;
15379                        continue;
15380                    }
15381                    dlg.finished(false);
15382                    return Err(common::Error::HttpError(err));
15383                }
15384                Ok(res) => {
15385                    let (mut parts, body) = res.into_parts();
15386                    let mut body = common::Body::new(body);
15387                    if !parts.status.is_success() {
15388                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15389                        let error = serde_json::from_str(&common::to_string(&bytes));
15390                        let response = common::to_response(parts, bytes.into());
15391
15392                        if let common::Retry::After(d) =
15393                            dlg.http_failure(&response, error.as_ref().ok())
15394                        {
15395                            sleep(d).await;
15396                            continue;
15397                        }
15398
15399                        dlg.finished(false);
15400
15401                        return Err(match error {
15402                            Ok(value) => common::Error::BadRequest(value),
15403                            _ => common::Error::Failure(response),
15404                        });
15405                    }
15406                    let response = {
15407                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15408                        let encoded = common::to_string(&bytes);
15409                        match serde_json::from_str(&encoded) {
15410                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15411                            Err(error) => {
15412                                dlg.response_json_decode_error(&encoded, &error);
15413                                return Err(common::Error::JsonDecodeError(
15414                                    encoded.to_string(),
15415                                    error,
15416                                ));
15417                            }
15418                        }
15419                    };
15420
15421                    dlg.finished(true);
15422                    return Ok(response);
15423                }
15424            }
15425        }
15426    }
15427
15428    /// Required. The name of the `DeliveryPipeline` to delete. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
15429    ///
15430    /// Sets the *name* path property to the given value.
15431    ///
15432    /// Even though the property as already been set when instantiating this call,
15433    /// we provide this method for API completeness.
15434    pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15435        self._name = new_value.to_string();
15436        self
15437    }
15438    /// Optional. If set, validate the request and preview the review, but do not actually post it.
15439    ///
15440    /// Sets the *validate only* query property to the given value.
15441    pub fn validate_only(
15442        mut self,
15443        new_value: bool,
15444    ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15445        self._validate_only = Some(new_value);
15446        self
15447    }
15448    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
15449    ///
15450    /// Sets the *request id* query property to the given value.
15451    pub fn request_id(
15452        mut self,
15453        new_value: &str,
15454    ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15455        self._request_id = Some(new_value.to_string());
15456        self
15457    }
15458    /// Optional. If set to true, all child resources under this pipeline will also be deleted. Otherwise, the request will only work if the pipeline has no child resources.
15459    ///
15460    /// Sets the *force* query property to the given value.
15461    pub fn force(mut self, new_value: bool) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15462        self._force = Some(new_value);
15463        self
15464    }
15465    /// Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
15466    ///
15467    /// Sets the *etag* query property to the given value.
15468    pub fn etag(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15469        self._etag = Some(new_value.to_string());
15470        self
15471    }
15472    /// Optional. If set to true, then deleting an already deleted or non-existing `DeliveryPipeline` will succeed.
15473    ///
15474    /// Sets the *allow missing* query property to the given value.
15475    pub fn allow_missing(
15476        mut self,
15477        new_value: bool,
15478    ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15479        self._allow_missing = Some(new_value);
15480        self
15481    }
15482    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15483    /// while executing the actual API request.
15484    ///
15485    /// ````text
15486    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15487    /// ````
15488    ///
15489    /// Sets the *delegate* property to the given value.
15490    pub fn delegate(
15491        mut self,
15492        new_value: &'a mut dyn common::Delegate,
15493    ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15494        self._delegate = Some(new_value);
15495        self
15496    }
15497
15498    /// Set any additional parameter of the query string used in the request.
15499    /// It should be used to set parameters which are not yet available through their own
15500    /// setters.
15501    ///
15502    /// Please note that this method must not be used to set any of the known parameters
15503    /// which have their own setter method. If done anyway, the request will fail.
15504    ///
15505    /// # Additional Parameters
15506    ///
15507    /// * *$.xgafv* (query-string) - V1 error format.
15508    /// * *access_token* (query-string) - OAuth access token.
15509    /// * *alt* (query-string) - Data format for response.
15510    /// * *callback* (query-string) - JSONP
15511    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15512    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15513    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15514    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15515    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15516    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15517    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15518    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
15519    where
15520        T: AsRef<str>,
15521    {
15522        self._additional_params
15523            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15524        self
15525    }
15526
15527    /// Identifies the authorization scope for the method you are building.
15528    ///
15529    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15530    /// [`Scope::CloudPlatform`].
15531    ///
15532    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15533    /// tokens for more than one scope.
15534    ///
15535    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15536    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15537    /// sufficient, a read-write scope will do as well.
15538    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
15539    where
15540        St: AsRef<str>,
15541    {
15542        self._scopes.insert(String::from(scope.as_ref()));
15543        self
15544    }
15545    /// Identifies the authorization scope(s) for the method you are building.
15546    ///
15547    /// See [`Self::add_scope()`] for details.
15548    pub fn add_scopes<I, St>(
15549        mut self,
15550        scopes: I,
15551    ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
15552    where
15553        I: IntoIterator<Item = St>,
15554        St: AsRef<str>,
15555    {
15556        self._scopes
15557            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15558        self
15559    }
15560
15561    /// Removes all scopes, and no default scope will be used either.
15562    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15563    /// for details).
15564    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
15565        self._scopes.clear();
15566        self
15567    }
15568}
15569
15570/// Gets details of a single DeliveryPipeline.
15571///
15572/// A builder for the *locations.deliveryPipelines.get* method supported by a *project* resource.
15573/// It is not used directly, but through a [`ProjectMethods`] instance.
15574///
15575/// # Example
15576///
15577/// Instantiate a resource method builder
15578///
15579/// ```test_harness,no_run
15580/// # extern crate hyper;
15581/// # extern crate hyper_rustls;
15582/// # extern crate google_clouddeploy1 as clouddeploy1;
15583/// # async fn dox() {
15584/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15585///
15586/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15587/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15588/// #     secret,
15589/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15590/// # ).build().await.unwrap();
15591///
15592/// # let client = hyper_util::client::legacy::Client::builder(
15593/// #     hyper_util::rt::TokioExecutor::new()
15594/// # )
15595/// # .build(
15596/// #     hyper_rustls::HttpsConnectorBuilder::new()
15597/// #         .with_native_roots()
15598/// #         .unwrap()
15599/// #         .https_or_http()
15600/// #         .enable_http1()
15601/// #         .build()
15602/// # );
15603/// # let mut hub = CloudDeploy::new(client, auth);
15604/// // You can configure optional parameters by calling the respective setters at will, and
15605/// // execute the final call using `doit()`.
15606/// // Values shown here are possibly random and not representative !
15607/// let result = hub.projects().locations_delivery_pipelines_get("name")
15608///              .doit().await;
15609/// # }
15610/// ```
15611pub struct ProjectLocationDeliveryPipelineGetCall<'a, C>
15612where
15613    C: 'a,
15614{
15615    hub: &'a CloudDeploy<C>,
15616    _name: String,
15617    _delegate: Option<&'a mut dyn common::Delegate>,
15618    _additional_params: HashMap<String, String>,
15619    _scopes: BTreeSet<String>,
15620}
15621
15622impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineGetCall<'a, C> {}
15623
15624impl<'a, C> ProjectLocationDeliveryPipelineGetCall<'a, C>
15625where
15626    C: common::Connector,
15627{
15628    /// Perform the operation you have build so far.
15629    pub async fn doit(mut self) -> common::Result<(common::Response, DeliveryPipeline)> {
15630        use std::borrow::Cow;
15631        use std::io::{Read, Seek};
15632
15633        use common::{url::Params, ToParts};
15634        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15635
15636        let mut dd = common::DefaultDelegate;
15637        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15638        dlg.begin(common::MethodInfo {
15639            id: "clouddeploy.projects.locations.deliveryPipelines.get",
15640            http_method: hyper::Method::GET,
15641        });
15642
15643        for &field in ["alt", "name"].iter() {
15644            if self._additional_params.contains_key(field) {
15645                dlg.finished(false);
15646                return Err(common::Error::FieldClash(field));
15647            }
15648        }
15649
15650        let mut params = Params::with_capacity(3 + self._additional_params.len());
15651        params.push("name", self._name);
15652
15653        params.extend(self._additional_params.iter());
15654
15655        params.push("alt", "json");
15656        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15657        if self._scopes.is_empty() {
15658            self._scopes
15659                .insert(Scope::CloudPlatform.as_ref().to_string());
15660        }
15661
15662        #[allow(clippy::single_element_loop)]
15663        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15664            url = params.uri_replacement(url, param_name, find_this, true);
15665        }
15666        {
15667            let to_remove = ["name"];
15668            params.remove_params(&to_remove);
15669        }
15670
15671        let url = params.parse_with_url(&url);
15672
15673        loop {
15674            let token = match self
15675                .hub
15676                .auth
15677                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15678                .await
15679            {
15680                Ok(token) => token,
15681                Err(e) => match dlg.token(e) {
15682                    Ok(token) => token,
15683                    Err(e) => {
15684                        dlg.finished(false);
15685                        return Err(common::Error::MissingToken(e));
15686                    }
15687                },
15688            };
15689            let mut req_result = {
15690                let client = &self.hub.client;
15691                dlg.pre_request();
15692                let mut req_builder = hyper::Request::builder()
15693                    .method(hyper::Method::GET)
15694                    .uri(url.as_str())
15695                    .header(USER_AGENT, self.hub._user_agent.clone());
15696
15697                if let Some(token) = token.as_ref() {
15698                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15699                }
15700
15701                let request = req_builder
15702                    .header(CONTENT_LENGTH, 0_u64)
15703                    .body(common::to_body::<String>(None));
15704
15705                client.request(request.unwrap()).await
15706            };
15707
15708            match req_result {
15709                Err(err) => {
15710                    if let common::Retry::After(d) = dlg.http_error(&err) {
15711                        sleep(d).await;
15712                        continue;
15713                    }
15714                    dlg.finished(false);
15715                    return Err(common::Error::HttpError(err));
15716                }
15717                Ok(res) => {
15718                    let (mut parts, body) = res.into_parts();
15719                    let mut body = common::Body::new(body);
15720                    if !parts.status.is_success() {
15721                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15722                        let error = serde_json::from_str(&common::to_string(&bytes));
15723                        let response = common::to_response(parts, bytes.into());
15724
15725                        if let common::Retry::After(d) =
15726                            dlg.http_failure(&response, error.as_ref().ok())
15727                        {
15728                            sleep(d).await;
15729                            continue;
15730                        }
15731
15732                        dlg.finished(false);
15733
15734                        return Err(match error {
15735                            Ok(value) => common::Error::BadRequest(value),
15736                            _ => common::Error::Failure(response),
15737                        });
15738                    }
15739                    let response = {
15740                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15741                        let encoded = common::to_string(&bytes);
15742                        match serde_json::from_str(&encoded) {
15743                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15744                            Err(error) => {
15745                                dlg.response_json_decode_error(&encoded, &error);
15746                                return Err(common::Error::JsonDecodeError(
15747                                    encoded.to_string(),
15748                                    error,
15749                                ));
15750                            }
15751                        }
15752                    };
15753
15754                    dlg.finished(true);
15755                    return Ok(response);
15756                }
15757            }
15758        }
15759    }
15760
15761    /// Required. Name of the `DeliveryPipeline`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
15762    ///
15763    /// Sets the *name* path property to the given value.
15764    ///
15765    /// Even though the property as already been set when instantiating this call,
15766    /// we provide this method for API completeness.
15767    pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
15768        self._name = new_value.to_string();
15769        self
15770    }
15771    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15772    /// while executing the actual API request.
15773    ///
15774    /// ````text
15775    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15776    /// ````
15777    ///
15778    /// Sets the *delegate* property to the given value.
15779    pub fn delegate(
15780        mut self,
15781        new_value: &'a mut dyn common::Delegate,
15782    ) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
15783        self._delegate = Some(new_value);
15784        self
15785    }
15786
15787    /// Set any additional parameter of the query string used in the request.
15788    /// It should be used to set parameters which are not yet available through their own
15789    /// setters.
15790    ///
15791    /// Please note that this method must not be used to set any of the known parameters
15792    /// which have their own setter method. If done anyway, the request will fail.
15793    ///
15794    /// # Additional Parameters
15795    ///
15796    /// * *$.xgafv* (query-string) - V1 error format.
15797    /// * *access_token* (query-string) - OAuth access token.
15798    /// * *alt* (query-string) - Data format for response.
15799    /// * *callback* (query-string) - JSONP
15800    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15801    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
15802    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15803    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15804    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
15805    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15806    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15807    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineGetCall<'a, C>
15808    where
15809        T: AsRef<str>,
15810    {
15811        self._additional_params
15812            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15813        self
15814    }
15815
15816    /// Identifies the authorization scope for the method you are building.
15817    ///
15818    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15819    /// [`Scope::CloudPlatform`].
15820    ///
15821    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15822    /// tokens for more than one scope.
15823    ///
15824    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15825    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15826    /// sufficient, a read-write scope will do as well.
15827    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineGetCall<'a, C>
15828    where
15829        St: AsRef<str>,
15830    {
15831        self._scopes.insert(String::from(scope.as_ref()));
15832        self
15833    }
15834    /// Identifies the authorization scope(s) for the method you are building.
15835    ///
15836    /// See [`Self::add_scope()`] for details.
15837    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeliveryPipelineGetCall<'a, C>
15838    where
15839        I: IntoIterator<Item = St>,
15840        St: AsRef<str>,
15841    {
15842        self._scopes
15843            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15844        self
15845    }
15846
15847    /// Removes all scopes, and no default scope will be used either.
15848    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15849    /// for details).
15850    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
15851        self._scopes.clear();
15852        self
15853    }
15854}
15855
15856/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
15857///
15858/// A builder for the *locations.deliveryPipelines.getIamPolicy* method supported by a *project* resource.
15859/// It is not used directly, but through a [`ProjectMethods`] instance.
15860///
15861/// # Example
15862///
15863/// Instantiate a resource method builder
15864///
15865/// ```test_harness,no_run
15866/// # extern crate hyper;
15867/// # extern crate hyper_rustls;
15868/// # extern crate google_clouddeploy1 as clouddeploy1;
15869/// # async fn dox() {
15870/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15871///
15872/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15873/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15874/// #     secret,
15875/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15876/// # ).build().await.unwrap();
15877///
15878/// # let client = hyper_util::client::legacy::Client::builder(
15879/// #     hyper_util::rt::TokioExecutor::new()
15880/// # )
15881/// # .build(
15882/// #     hyper_rustls::HttpsConnectorBuilder::new()
15883/// #         .with_native_roots()
15884/// #         .unwrap()
15885/// #         .https_or_http()
15886/// #         .enable_http1()
15887/// #         .build()
15888/// # );
15889/// # let mut hub = CloudDeploy::new(client, auth);
15890/// // You can configure optional parameters by calling the respective setters at will, and
15891/// // execute the final call using `doit()`.
15892/// // Values shown here are possibly random and not representative !
15893/// let result = hub.projects().locations_delivery_pipelines_get_iam_policy("resource")
15894///              .options_requested_policy_version(-32)
15895///              .doit().await;
15896/// # }
15897/// ```
15898pub struct ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
15899where
15900    C: 'a,
15901{
15902    hub: &'a CloudDeploy<C>,
15903    _resource: String,
15904    _options_requested_policy_version: Option<i32>,
15905    _delegate: Option<&'a mut dyn common::Delegate>,
15906    _additional_params: HashMap<String, String>,
15907    _scopes: BTreeSet<String>,
15908}
15909
15910impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {}
15911
15912impl<'a, C> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
15913where
15914    C: common::Connector,
15915{
15916    /// Perform the operation you have build so far.
15917    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
15918        use std::borrow::Cow;
15919        use std::io::{Read, Seek};
15920
15921        use common::{url::Params, ToParts};
15922        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15923
15924        let mut dd = common::DefaultDelegate;
15925        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15926        dlg.begin(common::MethodInfo {
15927            id: "clouddeploy.projects.locations.deliveryPipelines.getIamPolicy",
15928            http_method: hyper::Method::GET,
15929        });
15930
15931        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
15932            if self._additional_params.contains_key(field) {
15933                dlg.finished(false);
15934                return Err(common::Error::FieldClash(field));
15935            }
15936        }
15937
15938        let mut params = Params::with_capacity(4 + self._additional_params.len());
15939        params.push("resource", self._resource);
15940        if let Some(value) = self._options_requested_policy_version.as_ref() {
15941            params.push("options.requestedPolicyVersion", value.to_string());
15942        }
15943
15944        params.extend(self._additional_params.iter());
15945
15946        params.push("alt", "json");
15947        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
15948        if self._scopes.is_empty() {
15949            self._scopes
15950                .insert(Scope::CloudPlatform.as_ref().to_string());
15951        }
15952
15953        #[allow(clippy::single_element_loop)]
15954        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
15955            url = params.uri_replacement(url, param_name, find_this, true);
15956        }
15957        {
15958            let to_remove = ["resource"];
15959            params.remove_params(&to_remove);
15960        }
15961
15962        let url = params.parse_with_url(&url);
15963
15964        loop {
15965            let token = match self
15966                .hub
15967                .auth
15968                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15969                .await
15970            {
15971                Ok(token) => token,
15972                Err(e) => match dlg.token(e) {
15973                    Ok(token) => token,
15974                    Err(e) => {
15975                        dlg.finished(false);
15976                        return Err(common::Error::MissingToken(e));
15977                    }
15978                },
15979            };
15980            let mut req_result = {
15981                let client = &self.hub.client;
15982                dlg.pre_request();
15983                let mut req_builder = hyper::Request::builder()
15984                    .method(hyper::Method::GET)
15985                    .uri(url.as_str())
15986                    .header(USER_AGENT, self.hub._user_agent.clone());
15987
15988                if let Some(token) = token.as_ref() {
15989                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15990                }
15991
15992                let request = req_builder
15993                    .header(CONTENT_LENGTH, 0_u64)
15994                    .body(common::to_body::<String>(None));
15995
15996                client.request(request.unwrap()).await
15997            };
15998
15999            match req_result {
16000                Err(err) => {
16001                    if let common::Retry::After(d) = dlg.http_error(&err) {
16002                        sleep(d).await;
16003                        continue;
16004                    }
16005                    dlg.finished(false);
16006                    return Err(common::Error::HttpError(err));
16007                }
16008                Ok(res) => {
16009                    let (mut parts, body) = res.into_parts();
16010                    let mut body = common::Body::new(body);
16011                    if !parts.status.is_success() {
16012                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16013                        let error = serde_json::from_str(&common::to_string(&bytes));
16014                        let response = common::to_response(parts, bytes.into());
16015
16016                        if let common::Retry::After(d) =
16017                            dlg.http_failure(&response, error.as_ref().ok())
16018                        {
16019                            sleep(d).await;
16020                            continue;
16021                        }
16022
16023                        dlg.finished(false);
16024
16025                        return Err(match error {
16026                            Ok(value) => common::Error::BadRequest(value),
16027                            _ => common::Error::Failure(response),
16028                        });
16029                    }
16030                    let response = {
16031                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16032                        let encoded = common::to_string(&bytes);
16033                        match serde_json::from_str(&encoded) {
16034                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16035                            Err(error) => {
16036                                dlg.response_json_decode_error(&encoded, &error);
16037                                return Err(common::Error::JsonDecodeError(
16038                                    encoded.to_string(),
16039                                    error,
16040                                ));
16041                            }
16042                        }
16043                    };
16044
16045                    dlg.finished(true);
16046                    return Ok(response);
16047                }
16048            }
16049        }
16050    }
16051
16052    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
16053    ///
16054    /// Sets the *resource* path property to the given value.
16055    ///
16056    /// Even though the property as already been set when instantiating this call,
16057    /// we provide this method for API completeness.
16058    pub fn resource(
16059        mut self,
16060        new_value: &str,
16061    ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
16062        self._resource = new_value.to_string();
16063        self
16064    }
16065    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
16066    ///
16067    /// Sets the *options.requested policy version* query property to the given value.
16068    pub fn options_requested_policy_version(
16069        mut self,
16070        new_value: i32,
16071    ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
16072        self._options_requested_policy_version = Some(new_value);
16073        self
16074    }
16075    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16076    /// while executing the actual API request.
16077    ///
16078    /// ````text
16079    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16080    /// ````
16081    ///
16082    /// Sets the *delegate* property to the given value.
16083    pub fn delegate(
16084        mut self,
16085        new_value: &'a mut dyn common::Delegate,
16086    ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
16087        self._delegate = Some(new_value);
16088        self
16089    }
16090
16091    /// Set any additional parameter of the query string used in the request.
16092    /// It should be used to set parameters which are not yet available through their own
16093    /// setters.
16094    ///
16095    /// Please note that this method must not be used to set any of the known parameters
16096    /// which have their own setter method. If done anyway, the request will fail.
16097    ///
16098    /// # Additional Parameters
16099    ///
16100    /// * *$.xgafv* (query-string) - V1 error format.
16101    /// * *access_token* (query-string) - OAuth access token.
16102    /// * *alt* (query-string) - Data format for response.
16103    /// * *callback* (query-string) - JSONP
16104    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16105    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16106    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16107    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16108    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16109    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16110    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16111    pub fn param<T>(
16112        mut self,
16113        name: T,
16114        value: T,
16115    ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
16116    where
16117        T: AsRef<str>,
16118    {
16119        self._additional_params
16120            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16121        self
16122    }
16123
16124    /// Identifies the authorization scope for the method you are building.
16125    ///
16126    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16127    /// [`Scope::CloudPlatform`].
16128    ///
16129    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16130    /// tokens for more than one scope.
16131    ///
16132    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16133    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16134    /// sufficient, a read-write scope will do as well.
16135    pub fn add_scope<St>(
16136        mut self,
16137        scope: St,
16138    ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
16139    where
16140        St: AsRef<str>,
16141    {
16142        self._scopes.insert(String::from(scope.as_ref()));
16143        self
16144    }
16145    /// Identifies the authorization scope(s) for the method you are building.
16146    ///
16147    /// See [`Self::add_scope()`] for details.
16148    pub fn add_scopes<I, St>(
16149        mut self,
16150        scopes: I,
16151    ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
16152    where
16153        I: IntoIterator<Item = St>,
16154        St: AsRef<str>,
16155    {
16156        self._scopes
16157            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16158        self
16159    }
16160
16161    /// Removes all scopes, and no default scope will be used either.
16162    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16163    /// for details).
16164    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
16165        self._scopes.clear();
16166        self
16167    }
16168}
16169
16170/// Lists DeliveryPipelines in a given project and location.
16171///
16172/// A builder for the *locations.deliveryPipelines.list* method supported by a *project* resource.
16173/// It is not used directly, but through a [`ProjectMethods`] instance.
16174///
16175/// # Example
16176///
16177/// Instantiate a resource method builder
16178///
16179/// ```test_harness,no_run
16180/// # extern crate hyper;
16181/// # extern crate hyper_rustls;
16182/// # extern crate google_clouddeploy1 as clouddeploy1;
16183/// # async fn dox() {
16184/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16185///
16186/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16187/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16188/// #     secret,
16189/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16190/// # ).build().await.unwrap();
16191///
16192/// # let client = hyper_util::client::legacy::Client::builder(
16193/// #     hyper_util::rt::TokioExecutor::new()
16194/// # )
16195/// # .build(
16196/// #     hyper_rustls::HttpsConnectorBuilder::new()
16197/// #         .with_native_roots()
16198/// #         .unwrap()
16199/// #         .https_or_http()
16200/// #         .enable_http1()
16201/// #         .build()
16202/// # );
16203/// # let mut hub = CloudDeploy::new(client, auth);
16204/// // You can configure optional parameters by calling the respective setters at will, and
16205/// // execute the final call using `doit()`.
16206/// // Values shown here are possibly random and not representative !
16207/// let result = hub.projects().locations_delivery_pipelines_list("parent")
16208///              .page_token("sadipscing")
16209///              .page_size(-31)
16210///              .order_by("aliquyam")
16211///              .filter("amet")
16212///              .doit().await;
16213/// # }
16214/// ```
16215pub struct ProjectLocationDeliveryPipelineListCall<'a, C>
16216where
16217    C: 'a,
16218{
16219    hub: &'a CloudDeploy<C>,
16220    _parent: String,
16221    _page_token: Option<String>,
16222    _page_size: Option<i32>,
16223    _order_by: Option<String>,
16224    _filter: Option<String>,
16225    _delegate: Option<&'a mut dyn common::Delegate>,
16226    _additional_params: HashMap<String, String>,
16227    _scopes: BTreeSet<String>,
16228}
16229
16230impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineListCall<'a, C> {}
16231
16232impl<'a, C> ProjectLocationDeliveryPipelineListCall<'a, C>
16233where
16234    C: common::Connector,
16235{
16236    /// Perform the operation you have build so far.
16237    pub async fn doit(
16238        mut self,
16239    ) -> common::Result<(common::Response, ListDeliveryPipelinesResponse)> {
16240        use std::borrow::Cow;
16241        use std::io::{Read, Seek};
16242
16243        use common::{url::Params, ToParts};
16244        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16245
16246        let mut dd = common::DefaultDelegate;
16247        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16248        dlg.begin(common::MethodInfo {
16249            id: "clouddeploy.projects.locations.deliveryPipelines.list",
16250            http_method: hyper::Method::GET,
16251        });
16252
16253        for &field in [
16254            "alt",
16255            "parent",
16256            "pageToken",
16257            "pageSize",
16258            "orderBy",
16259            "filter",
16260        ]
16261        .iter()
16262        {
16263            if self._additional_params.contains_key(field) {
16264                dlg.finished(false);
16265                return Err(common::Error::FieldClash(field));
16266            }
16267        }
16268
16269        let mut params = Params::with_capacity(7 + self._additional_params.len());
16270        params.push("parent", self._parent);
16271        if let Some(value) = self._page_token.as_ref() {
16272            params.push("pageToken", value);
16273        }
16274        if let Some(value) = self._page_size.as_ref() {
16275            params.push("pageSize", value.to_string());
16276        }
16277        if let Some(value) = self._order_by.as_ref() {
16278            params.push("orderBy", value);
16279        }
16280        if let Some(value) = self._filter.as_ref() {
16281            params.push("filter", value);
16282        }
16283
16284        params.extend(self._additional_params.iter());
16285
16286        params.push("alt", "json");
16287        let mut url = self.hub._base_url.clone() + "v1/{+parent}/deliveryPipelines";
16288        if self._scopes.is_empty() {
16289            self._scopes
16290                .insert(Scope::CloudPlatform.as_ref().to_string());
16291        }
16292
16293        #[allow(clippy::single_element_loop)]
16294        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16295            url = params.uri_replacement(url, param_name, find_this, true);
16296        }
16297        {
16298            let to_remove = ["parent"];
16299            params.remove_params(&to_remove);
16300        }
16301
16302        let url = params.parse_with_url(&url);
16303
16304        loop {
16305            let token = match self
16306                .hub
16307                .auth
16308                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16309                .await
16310            {
16311                Ok(token) => token,
16312                Err(e) => match dlg.token(e) {
16313                    Ok(token) => token,
16314                    Err(e) => {
16315                        dlg.finished(false);
16316                        return Err(common::Error::MissingToken(e));
16317                    }
16318                },
16319            };
16320            let mut req_result = {
16321                let client = &self.hub.client;
16322                dlg.pre_request();
16323                let mut req_builder = hyper::Request::builder()
16324                    .method(hyper::Method::GET)
16325                    .uri(url.as_str())
16326                    .header(USER_AGENT, self.hub._user_agent.clone());
16327
16328                if let Some(token) = token.as_ref() {
16329                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16330                }
16331
16332                let request = req_builder
16333                    .header(CONTENT_LENGTH, 0_u64)
16334                    .body(common::to_body::<String>(None));
16335
16336                client.request(request.unwrap()).await
16337            };
16338
16339            match req_result {
16340                Err(err) => {
16341                    if let common::Retry::After(d) = dlg.http_error(&err) {
16342                        sleep(d).await;
16343                        continue;
16344                    }
16345                    dlg.finished(false);
16346                    return Err(common::Error::HttpError(err));
16347                }
16348                Ok(res) => {
16349                    let (mut parts, body) = res.into_parts();
16350                    let mut body = common::Body::new(body);
16351                    if !parts.status.is_success() {
16352                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16353                        let error = serde_json::from_str(&common::to_string(&bytes));
16354                        let response = common::to_response(parts, bytes.into());
16355
16356                        if let common::Retry::After(d) =
16357                            dlg.http_failure(&response, error.as_ref().ok())
16358                        {
16359                            sleep(d).await;
16360                            continue;
16361                        }
16362
16363                        dlg.finished(false);
16364
16365                        return Err(match error {
16366                            Ok(value) => common::Error::BadRequest(value),
16367                            _ => common::Error::Failure(response),
16368                        });
16369                    }
16370                    let response = {
16371                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16372                        let encoded = common::to_string(&bytes);
16373                        match serde_json::from_str(&encoded) {
16374                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16375                            Err(error) => {
16376                                dlg.response_json_decode_error(&encoded, &error);
16377                                return Err(common::Error::JsonDecodeError(
16378                                    encoded.to_string(),
16379                                    error,
16380                                ));
16381                            }
16382                        }
16383                    };
16384
16385                    dlg.finished(true);
16386                    return Ok(response);
16387                }
16388            }
16389        }
16390    }
16391
16392    /// Required. The parent, which owns this collection of pipelines. Format must be `projects/{project_id}/locations/{location_name}`.
16393    ///
16394    /// Sets the *parent* path property to the given value.
16395    ///
16396    /// Even though the property as already been set when instantiating this call,
16397    /// we provide this method for API completeness.
16398    pub fn parent(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
16399        self._parent = new_value.to_string();
16400        self
16401    }
16402    /// A page token, received from a previous `ListDeliveryPipelines` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
16403    ///
16404    /// Sets the *page token* query property to the given value.
16405    pub fn page_token(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
16406        self._page_token = Some(new_value.to_string());
16407        self
16408    }
16409    /// The maximum number of pipelines to return. The service may return fewer than this value. If unspecified, at most 50 pipelines will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
16410    ///
16411    /// Sets the *page size* query property to the given value.
16412    pub fn page_size(mut self, new_value: i32) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
16413        self._page_size = Some(new_value);
16414        self
16415    }
16416    /// Field to sort by. See https://google.aip.dev/132#ordering for more details.
16417    ///
16418    /// Sets the *order by* query property to the given value.
16419    pub fn order_by(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
16420        self._order_by = Some(new_value.to_string());
16421        self
16422    }
16423    /// Filter pipelines to be returned. See https://google.aip.dev/160 for more details.
16424    ///
16425    /// Sets the *filter* query property to the given value.
16426    pub fn filter(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
16427        self._filter = Some(new_value.to_string());
16428        self
16429    }
16430    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16431    /// while executing the actual API request.
16432    ///
16433    /// ````text
16434    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16435    /// ````
16436    ///
16437    /// Sets the *delegate* property to the given value.
16438    pub fn delegate(
16439        mut self,
16440        new_value: &'a mut dyn common::Delegate,
16441    ) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
16442        self._delegate = Some(new_value);
16443        self
16444    }
16445
16446    /// Set any additional parameter of the query string used in the request.
16447    /// It should be used to set parameters which are not yet available through their own
16448    /// setters.
16449    ///
16450    /// Please note that this method must not be used to set any of the known parameters
16451    /// which have their own setter method. If done anyway, the request will fail.
16452    ///
16453    /// # Additional Parameters
16454    ///
16455    /// * *$.xgafv* (query-string) - V1 error format.
16456    /// * *access_token* (query-string) - OAuth access token.
16457    /// * *alt* (query-string) - Data format for response.
16458    /// * *callback* (query-string) - JSONP
16459    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16460    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16461    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16462    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16463    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16464    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16465    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16466    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineListCall<'a, C>
16467    where
16468        T: AsRef<str>,
16469    {
16470        self._additional_params
16471            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16472        self
16473    }
16474
16475    /// Identifies the authorization scope for the method you are building.
16476    ///
16477    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16478    /// [`Scope::CloudPlatform`].
16479    ///
16480    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16481    /// tokens for more than one scope.
16482    ///
16483    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16484    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16485    /// sufficient, a read-write scope will do as well.
16486    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineListCall<'a, C>
16487    where
16488        St: AsRef<str>,
16489    {
16490        self._scopes.insert(String::from(scope.as_ref()));
16491        self
16492    }
16493    /// Identifies the authorization scope(s) for the method you are building.
16494    ///
16495    /// See [`Self::add_scope()`] for details.
16496    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeliveryPipelineListCall<'a, C>
16497    where
16498        I: IntoIterator<Item = St>,
16499        St: AsRef<str>,
16500    {
16501        self._scopes
16502            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16503        self
16504    }
16505
16506    /// Removes all scopes, and no default scope will be used either.
16507    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16508    /// for details).
16509    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
16510        self._scopes.clear();
16511        self
16512    }
16513}
16514
16515/// Updates the parameters of a single DeliveryPipeline.
16516///
16517/// A builder for the *locations.deliveryPipelines.patch* method supported by a *project* resource.
16518/// It is not used directly, but through a [`ProjectMethods`] instance.
16519///
16520/// # Example
16521///
16522/// Instantiate a resource method builder
16523///
16524/// ```test_harness,no_run
16525/// # extern crate hyper;
16526/// # extern crate hyper_rustls;
16527/// # extern crate google_clouddeploy1 as clouddeploy1;
16528/// use clouddeploy1::api::DeliveryPipeline;
16529/// # async fn dox() {
16530/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16531///
16532/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16533/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16534/// #     secret,
16535/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16536/// # ).build().await.unwrap();
16537///
16538/// # let client = hyper_util::client::legacy::Client::builder(
16539/// #     hyper_util::rt::TokioExecutor::new()
16540/// # )
16541/// # .build(
16542/// #     hyper_rustls::HttpsConnectorBuilder::new()
16543/// #         .with_native_roots()
16544/// #         .unwrap()
16545/// #         .https_or_http()
16546/// #         .enable_http1()
16547/// #         .build()
16548/// # );
16549/// # let mut hub = CloudDeploy::new(client, auth);
16550/// // As the method needs a request, you would usually fill it with the desired information
16551/// // into the respective structure. Some of the parts shown here might not be applicable !
16552/// // Values shown here are possibly random and not representative !
16553/// let mut req = DeliveryPipeline::default();
16554///
16555/// // You can configure optional parameters by calling the respective setters at will, and
16556/// // execute the final call using `doit()`.
16557/// // Values shown here are possibly random and not representative !
16558/// let result = hub.projects().locations_delivery_pipelines_patch(req, "name")
16559///              .validate_only(false)
16560///              .update_mask(FieldMask::new::<&str>(&[]))
16561///              .request_id("consetetur")
16562///              .allow_missing(true)
16563///              .doit().await;
16564/// # }
16565/// ```
16566pub struct ProjectLocationDeliveryPipelinePatchCall<'a, C>
16567where
16568    C: 'a,
16569{
16570    hub: &'a CloudDeploy<C>,
16571    _request: DeliveryPipeline,
16572    _name: String,
16573    _validate_only: Option<bool>,
16574    _update_mask: Option<common::FieldMask>,
16575    _request_id: Option<String>,
16576    _allow_missing: Option<bool>,
16577    _delegate: Option<&'a mut dyn common::Delegate>,
16578    _additional_params: HashMap<String, String>,
16579    _scopes: BTreeSet<String>,
16580}
16581
16582impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelinePatchCall<'a, C> {}
16583
16584impl<'a, C> ProjectLocationDeliveryPipelinePatchCall<'a, C>
16585where
16586    C: common::Connector,
16587{
16588    /// Perform the operation you have build so far.
16589    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16590        use std::borrow::Cow;
16591        use std::io::{Read, Seek};
16592
16593        use common::{url::Params, ToParts};
16594        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16595
16596        let mut dd = common::DefaultDelegate;
16597        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16598        dlg.begin(common::MethodInfo {
16599            id: "clouddeploy.projects.locations.deliveryPipelines.patch",
16600            http_method: hyper::Method::PATCH,
16601        });
16602
16603        for &field in [
16604            "alt",
16605            "name",
16606            "validateOnly",
16607            "updateMask",
16608            "requestId",
16609            "allowMissing",
16610        ]
16611        .iter()
16612        {
16613            if self._additional_params.contains_key(field) {
16614                dlg.finished(false);
16615                return Err(common::Error::FieldClash(field));
16616            }
16617        }
16618
16619        let mut params = Params::with_capacity(8 + self._additional_params.len());
16620        params.push("name", self._name);
16621        if let Some(value) = self._validate_only.as_ref() {
16622            params.push("validateOnly", value.to_string());
16623        }
16624        if let Some(value) = self._update_mask.as_ref() {
16625            params.push("updateMask", value.to_string());
16626        }
16627        if let Some(value) = self._request_id.as_ref() {
16628            params.push("requestId", value);
16629        }
16630        if let Some(value) = self._allow_missing.as_ref() {
16631            params.push("allowMissing", value.to_string());
16632        }
16633
16634        params.extend(self._additional_params.iter());
16635
16636        params.push("alt", "json");
16637        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16638        if self._scopes.is_empty() {
16639            self._scopes
16640                .insert(Scope::CloudPlatform.as_ref().to_string());
16641        }
16642
16643        #[allow(clippy::single_element_loop)]
16644        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16645            url = params.uri_replacement(url, param_name, find_this, true);
16646        }
16647        {
16648            let to_remove = ["name"];
16649            params.remove_params(&to_remove);
16650        }
16651
16652        let url = params.parse_with_url(&url);
16653
16654        let mut json_mime_type = mime::APPLICATION_JSON;
16655        let mut request_value_reader = {
16656            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16657            common::remove_json_null_values(&mut value);
16658            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16659            serde_json::to_writer(&mut dst, &value).unwrap();
16660            dst
16661        };
16662        let request_size = request_value_reader
16663            .seek(std::io::SeekFrom::End(0))
16664            .unwrap();
16665        request_value_reader
16666            .seek(std::io::SeekFrom::Start(0))
16667            .unwrap();
16668
16669        loop {
16670            let token = match self
16671                .hub
16672                .auth
16673                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16674                .await
16675            {
16676                Ok(token) => token,
16677                Err(e) => match dlg.token(e) {
16678                    Ok(token) => token,
16679                    Err(e) => {
16680                        dlg.finished(false);
16681                        return Err(common::Error::MissingToken(e));
16682                    }
16683                },
16684            };
16685            request_value_reader
16686                .seek(std::io::SeekFrom::Start(0))
16687                .unwrap();
16688            let mut req_result = {
16689                let client = &self.hub.client;
16690                dlg.pre_request();
16691                let mut req_builder = hyper::Request::builder()
16692                    .method(hyper::Method::PATCH)
16693                    .uri(url.as_str())
16694                    .header(USER_AGENT, self.hub._user_agent.clone());
16695
16696                if let Some(token) = token.as_ref() {
16697                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16698                }
16699
16700                let request = req_builder
16701                    .header(CONTENT_TYPE, json_mime_type.to_string())
16702                    .header(CONTENT_LENGTH, request_size as u64)
16703                    .body(common::to_body(
16704                        request_value_reader.get_ref().clone().into(),
16705                    ));
16706
16707                client.request(request.unwrap()).await
16708            };
16709
16710            match req_result {
16711                Err(err) => {
16712                    if let common::Retry::After(d) = dlg.http_error(&err) {
16713                        sleep(d).await;
16714                        continue;
16715                    }
16716                    dlg.finished(false);
16717                    return Err(common::Error::HttpError(err));
16718                }
16719                Ok(res) => {
16720                    let (mut parts, body) = res.into_parts();
16721                    let mut body = common::Body::new(body);
16722                    if !parts.status.is_success() {
16723                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16724                        let error = serde_json::from_str(&common::to_string(&bytes));
16725                        let response = common::to_response(parts, bytes.into());
16726
16727                        if let common::Retry::After(d) =
16728                            dlg.http_failure(&response, error.as_ref().ok())
16729                        {
16730                            sleep(d).await;
16731                            continue;
16732                        }
16733
16734                        dlg.finished(false);
16735
16736                        return Err(match error {
16737                            Ok(value) => common::Error::BadRequest(value),
16738                            _ => common::Error::Failure(response),
16739                        });
16740                    }
16741                    let response = {
16742                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16743                        let encoded = common::to_string(&bytes);
16744                        match serde_json::from_str(&encoded) {
16745                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16746                            Err(error) => {
16747                                dlg.response_json_decode_error(&encoded, &error);
16748                                return Err(common::Error::JsonDecodeError(
16749                                    encoded.to_string(),
16750                                    error,
16751                                ));
16752                            }
16753                        }
16754                    };
16755
16756                    dlg.finished(true);
16757                    return Ok(response);
16758                }
16759            }
16760        }
16761    }
16762
16763    ///
16764    /// Sets the *request* property to the given value.
16765    ///
16766    /// Even though the property as already been set when instantiating this call,
16767    /// we provide this method for API completeness.
16768    pub fn request(
16769        mut self,
16770        new_value: DeliveryPipeline,
16771    ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16772        self._request = new_value;
16773        self
16774    }
16775    /// Optional. Name of the `DeliveryPipeline`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}`. The `deliveryPipeline` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
16776    ///
16777    /// Sets the *name* path property to the given value.
16778    ///
16779    /// Even though the property as already been set when instantiating this call,
16780    /// we provide this method for API completeness.
16781    pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16782        self._name = new_value.to_string();
16783        self
16784    }
16785    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
16786    ///
16787    /// Sets the *validate only* query property to the given value.
16788    pub fn validate_only(
16789        mut self,
16790        new_value: bool,
16791    ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16792        self._validate_only = Some(new_value);
16793        self
16794    }
16795    /// Required. Field mask is used to specify the fields to be overwritten in the `DeliveryPipeline` resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it's in the mask. If the user doesn't provide a mask then all fields are overwritten.
16796    ///
16797    /// Sets the *update mask* query property to the given value.
16798    pub fn update_mask(
16799        mut self,
16800        new_value: common::FieldMask,
16801    ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16802        self._update_mask = Some(new_value);
16803        self
16804    }
16805    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
16806    ///
16807    /// Sets the *request id* query property to the given value.
16808    pub fn request_id(
16809        mut self,
16810        new_value: &str,
16811    ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16812        self._request_id = Some(new_value.to_string());
16813        self
16814    }
16815    /// Optional. If set to true, updating a `DeliveryPipeline` that does not exist will result in the creation of a new `DeliveryPipeline`.
16816    ///
16817    /// Sets the *allow missing* query property to the given value.
16818    pub fn allow_missing(
16819        mut self,
16820        new_value: bool,
16821    ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16822        self._allow_missing = Some(new_value);
16823        self
16824    }
16825    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16826    /// while executing the actual API request.
16827    ///
16828    /// ````text
16829    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16830    /// ````
16831    ///
16832    /// Sets the *delegate* property to the given value.
16833    pub fn delegate(
16834        mut self,
16835        new_value: &'a mut dyn common::Delegate,
16836    ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16837        self._delegate = Some(new_value);
16838        self
16839    }
16840
16841    /// Set any additional parameter of the query string used in the request.
16842    /// It should be used to set parameters which are not yet available through their own
16843    /// setters.
16844    ///
16845    /// Please note that this method must not be used to set any of the known parameters
16846    /// which have their own setter method. If done anyway, the request will fail.
16847    ///
16848    /// # Additional Parameters
16849    ///
16850    /// * *$.xgafv* (query-string) - V1 error format.
16851    /// * *access_token* (query-string) - OAuth access token.
16852    /// * *alt* (query-string) - Data format for response.
16853    /// * *callback* (query-string) - JSONP
16854    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16855    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
16856    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16857    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16858    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
16859    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16860    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16861    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelinePatchCall<'a, C>
16862    where
16863        T: AsRef<str>,
16864    {
16865        self._additional_params
16866            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16867        self
16868    }
16869
16870    /// Identifies the authorization scope for the method you are building.
16871    ///
16872    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16873    /// [`Scope::CloudPlatform`].
16874    ///
16875    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16876    /// tokens for more than one scope.
16877    ///
16878    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16879    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16880    /// sufficient, a read-write scope will do as well.
16881    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelinePatchCall<'a, C>
16882    where
16883        St: AsRef<str>,
16884    {
16885        self._scopes.insert(String::from(scope.as_ref()));
16886        self
16887    }
16888    /// Identifies the authorization scope(s) for the method you are building.
16889    ///
16890    /// See [`Self::add_scope()`] for details.
16891    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeliveryPipelinePatchCall<'a, C>
16892    where
16893        I: IntoIterator<Item = St>,
16894        St: AsRef<str>,
16895    {
16896        self._scopes
16897            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16898        self
16899    }
16900
16901    /// Removes all scopes, and no default scope will be used either.
16902    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16903    /// for details).
16904    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
16905        self._scopes.clear();
16906        self
16907    }
16908}
16909
16910/// Creates a `Rollout` to roll back the specified target.
16911///
16912/// A builder for the *locations.deliveryPipelines.rollbackTarget* method supported by a *project* resource.
16913/// It is not used directly, but through a [`ProjectMethods`] instance.
16914///
16915/// # Example
16916///
16917/// Instantiate a resource method builder
16918///
16919/// ```test_harness,no_run
16920/// # extern crate hyper;
16921/// # extern crate hyper_rustls;
16922/// # extern crate google_clouddeploy1 as clouddeploy1;
16923/// use clouddeploy1::api::RollbackTargetRequest;
16924/// # async fn dox() {
16925/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16926///
16927/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16928/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16929/// #     secret,
16930/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16931/// # ).build().await.unwrap();
16932///
16933/// # let client = hyper_util::client::legacy::Client::builder(
16934/// #     hyper_util::rt::TokioExecutor::new()
16935/// # )
16936/// # .build(
16937/// #     hyper_rustls::HttpsConnectorBuilder::new()
16938/// #         .with_native_roots()
16939/// #         .unwrap()
16940/// #         .https_or_http()
16941/// #         .enable_http1()
16942/// #         .build()
16943/// # );
16944/// # let mut hub = CloudDeploy::new(client, auth);
16945/// // As the method needs a request, you would usually fill it with the desired information
16946/// // into the respective structure. Some of the parts shown here might not be applicable !
16947/// // Values shown here are possibly random and not representative !
16948/// let mut req = RollbackTargetRequest::default();
16949///
16950/// // You can configure optional parameters by calling the respective setters at will, and
16951/// // execute the final call using `doit()`.
16952/// // Values shown here are possibly random and not representative !
16953/// let result = hub.projects().locations_delivery_pipelines_rollback_target(req, "name")
16954///              .doit().await;
16955/// # }
16956/// ```
16957pub struct ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
16958where
16959    C: 'a,
16960{
16961    hub: &'a CloudDeploy<C>,
16962    _request: RollbackTargetRequest,
16963    _name: String,
16964    _delegate: Option<&'a mut dyn common::Delegate>,
16965    _additional_params: HashMap<String, String>,
16966    _scopes: BTreeSet<String>,
16967}
16968
16969impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {}
16970
16971impl<'a, C> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
16972where
16973    C: common::Connector,
16974{
16975    /// Perform the operation you have build so far.
16976    pub async fn doit(mut self) -> common::Result<(common::Response, RollbackTargetResponse)> {
16977        use std::borrow::Cow;
16978        use std::io::{Read, Seek};
16979
16980        use common::{url::Params, ToParts};
16981        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16982
16983        let mut dd = common::DefaultDelegate;
16984        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16985        dlg.begin(common::MethodInfo {
16986            id: "clouddeploy.projects.locations.deliveryPipelines.rollbackTarget",
16987            http_method: hyper::Method::POST,
16988        });
16989
16990        for &field in ["alt", "name"].iter() {
16991            if self._additional_params.contains_key(field) {
16992                dlg.finished(false);
16993                return Err(common::Error::FieldClash(field));
16994            }
16995        }
16996
16997        let mut params = Params::with_capacity(4 + self._additional_params.len());
16998        params.push("name", self._name);
16999
17000        params.extend(self._additional_params.iter());
17001
17002        params.push("alt", "json");
17003        let mut url = self.hub._base_url.clone() + "v1/{+name}:rollbackTarget";
17004        if self._scopes.is_empty() {
17005            self._scopes
17006                .insert(Scope::CloudPlatform.as_ref().to_string());
17007        }
17008
17009        #[allow(clippy::single_element_loop)]
17010        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17011            url = params.uri_replacement(url, param_name, find_this, true);
17012        }
17013        {
17014            let to_remove = ["name"];
17015            params.remove_params(&to_remove);
17016        }
17017
17018        let url = params.parse_with_url(&url);
17019
17020        let mut json_mime_type = mime::APPLICATION_JSON;
17021        let mut request_value_reader = {
17022            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17023            common::remove_json_null_values(&mut value);
17024            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17025            serde_json::to_writer(&mut dst, &value).unwrap();
17026            dst
17027        };
17028        let request_size = request_value_reader
17029            .seek(std::io::SeekFrom::End(0))
17030            .unwrap();
17031        request_value_reader
17032            .seek(std::io::SeekFrom::Start(0))
17033            .unwrap();
17034
17035        loop {
17036            let token = match self
17037                .hub
17038                .auth
17039                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17040                .await
17041            {
17042                Ok(token) => token,
17043                Err(e) => match dlg.token(e) {
17044                    Ok(token) => token,
17045                    Err(e) => {
17046                        dlg.finished(false);
17047                        return Err(common::Error::MissingToken(e));
17048                    }
17049                },
17050            };
17051            request_value_reader
17052                .seek(std::io::SeekFrom::Start(0))
17053                .unwrap();
17054            let mut req_result = {
17055                let client = &self.hub.client;
17056                dlg.pre_request();
17057                let mut req_builder = hyper::Request::builder()
17058                    .method(hyper::Method::POST)
17059                    .uri(url.as_str())
17060                    .header(USER_AGENT, self.hub._user_agent.clone());
17061
17062                if let Some(token) = token.as_ref() {
17063                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17064                }
17065
17066                let request = req_builder
17067                    .header(CONTENT_TYPE, json_mime_type.to_string())
17068                    .header(CONTENT_LENGTH, request_size as u64)
17069                    .body(common::to_body(
17070                        request_value_reader.get_ref().clone().into(),
17071                    ));
17072
17073                client.request(request.unwrap()).await
17074            };
17075
17076            match req_result {
17077                Err(err) => {
17078                    if let common::Retry::After(d) = dlg.http_error(&err) {
17079                        sleep(d).await;
17080                        continue;
17081                    }
17082                    dlg.finished(false);
17083                    return Err(common::Error::HttpError(err));
17084                }
17085                Ok(res) => {
17086                    let (mut parts, body) = res.into_parts();
17087                    let mut body = common::Body::new(body);
17088                    if !parts.status.is_success() {
17089                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17090                        let error = serde_json::from_str(&common::to_string(&bytes));
17091                        let response = common::to_response(parts, bytes.into());
17092
17093                        if let common::Retry::After(d) =
17094                            dlg.http_failure(&response, error.as_ref().ok())
17095                        {
17096                            sleep(d).await;
17097                            continue;
17098                        }
17099
17100                        dlg.finished(false);
17101
17102                        return Err(match error {
17103                            Ok(value) => common::Error::BadRequest(value),
17104                            _ => common::Error::Failure(response),
17105                        });
17106                    }
17107                    let response = {
17108                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17109                        let encoded = common::to_string(&bytes);
17110                        match serde_json::from_str(&encoded) {
17111                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17112                            Err(error) => {
17113                                dlg.response_json_decode_error(&encoded, &error);
17114                                return Err(common::Error::JsonDecodeError(
17115                                    encoded.to_string(),
17116                                    error,
17117                                ));
17118                            }
17119                        }
17120                    };
17121
17122                    dlg.finished(true);
17123                    return Ok(response);
17124                }
17125            }
17126        }
17127    }
17128
17129    ///
17130    /// Sets the *request* property to the given value.
17131    ///
17132    /// Even though the property as already been set when instantiating this call,
17133    /// we provide this method for API completeness.
17134    pub fn request(
17135        mut self,
17136        new_value: RollbackTargetRequest,
17137    ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
17138        self._request = new_value;
17139        self
17140    }
17141    /// Required. The `DeliveryPipeline` for which the rollback `Rollout` should be created. Format should be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
17142    ///
17143    /// Sets the *name* path property to the given value.
17144    ///
17145    /// Even though the property as already been set when instantiating this call,
17146    /// we provide this method for API completeness.
17147    pub fn name(
17148        mut self,
17149        new_value: &str,
17150    ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
17151        self._name = new_value.to_string();
17152        self
17153    }
17154    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17155    /// while executing the actual API request.
17156    ///
17157    /// ````text
17158    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17159    /// ````
17160    ///
17161    /// Sets the *delegate* property to the given value.
17162    pub fn delegate(
17163        mut self,
17164        new_value: &'a mut dyn common::Delegate,
17165    ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
17166        self._delegate = Some(new_value);
17167        self
17168    }
17169
17170    /// Set any additional parameter of the query string used in the request.
17171    /// It should be used to set parameters which are not yet available through their own
17172    /// setters.
17173    ///
17174    /// Please note that this method must not be used to set any of the known parameters
17175    /// which have their own setter method. If done anyway, the request will fail.
17176    ///
17177    /// # Additional Parameters
17178    ///
17179    /// * *$.xgafv* (query-string) - V1 error format.
17180    /// * *access_token* (query-string) - OAuth access token.
17181    /// * *alt* (query-string) - Data format for response.
17182    /// * *callback* (query-string) - JSONP
17183    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17184    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17185    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17186    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17187    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17188    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17189    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17190    pub fn param<T>(
17191        mut self,
17192        name: T,
17193        value: T,
17194    ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
17195    where
17196        T: AsRef<str>,
17197    {
17198        self._additional_params
17199            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17200        self
17201    }
17202
17203    /// Identifies the authorization scope for the method you are building.
17204    ///
17205    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17206    /// [`Scope::CloudPlatform`].
17207    ///
17208    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17209    /// tokens for more than one scope.
17210    ///
17211    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17212    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17213    /// sufficient, a read-write scope will do as well.
17214    pub fn add_scope<St>(
17215        mut self,
17216        scope: St,
17217    ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
17218    where
17219        St: AsRef<str>,
17220    {
17221        self._scopes.insert(String::from(scope.as_ref()));
17222        self
17223    }
17224    /// Identifies the authorization scope(s) for the method you are building.
17225    ///
17226    /// See [`Self::add_scope()`] for details.
17227    pub fn add_scopes<I, St>(
17228        mut self,
17229        scopes: I,
17230    ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
17231    where
17232        I: IntoIterator<Item = St>,
17233        St: AsRef<str>,
17234    {
17235        self._scopes
17236            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17237        self
17238    }
17239
17240    /// Removes all scopes, and no default scope will be used either.
17241    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17242    /// for details).
17243    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
17244        self._scopes.clear();
17245        self
17246    }
17247}
17248
17249/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
17250///
17251/// A builder for the *locations.deliveryPipelines.setIamPolicy* method supported by a *project* resource.
17252/// It is not used directly, but through a [`ProjectMethods`] instance.
17253///
17254/// # Example
17255///
17256/// Instantiate a resource method builder
17257///
17258/// ```test_harness,no_run
17259/// # extern crate hyper;
17260/// # extern crate hyper_rustls;
17261/// # extern crate google_clouddeploy1 as clouddeploy1;
17262/// use clouddeploy1::api::SetIamPolicyRequest;
17263/// # async fn dox() {
17264/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17265///
17266/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17267/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17268/// #     secret,
17269/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17270/// # ).build().await.unwrap();
17271///
17272/// # let client = hyper_util::client::legacy::Client::builder(
17273/// #     hyper_util::rt::TokioExecutor::new()
17274/// # )
17275/// # .build(
17276/// #     hyper_rustls::HttpsConnectorBuilder::new()
17277/// #         .with_native_roots()
17278/// #         .unwrap()
17279/// #         .https_or_http()
17280/// #         .enable_http1()
17281/// #         .build()
17282/// # );
17283/// # let mut hub = CloudDeploy::new(client, auth);
17284/// // As the method needs a request, you would usually fill it with the desired information
17285/// // into the respective structure. Some of the parts shown here might not be applicable !
17286/// // Values shown here are possibly random and not representative !
17287/// let mut req = SetIamPolicyRequest::default();
17288///
17289/// // You can configure optional parameters by calling the respective setters at will, and
17290/// // execute the final call using `doit()`.
17291/// // Values shown here are possibly random and not representative !
17292/// let result = hub.projects().locations_delivery_pipelines_set_iam_policy(req, "resource")
17293///              .doit().await;
17294/// # }
17295/// ```
17296pub struct ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
17297where
17298    C: 'a,
17299{
17300    hub: &'a CloudDeploy<C>,
17301    _request: SetIamPolicyRequest,
17302    _resource: String,
17303    _delegate: Option<&'a mut dyn common::Delegate>,
17304    _additional_params: HashMap<String, String>,
17305    _scopes: BTreeSet<String>,
17306}
17307
17308impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {}
17309
17310impl<'a, C> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
17311where
17312    C: common::Connector,
17313{
17314    /// Perform the operation you have build so far.
17315    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
17316        use std::borrow::Cow;
17317        use std::io::{Read, Seek};
17318
17319        use common::{url::Params, ToParts};
17320        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17321
17322        let mut dd = common::DefaultDelegate;
17323        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17324        dlg.begin(common::MethodInfo {
17325            id: "clouddeploy.projects.locations.deliveryPipelines.setIamPolicy",
17326            http_method: hyper::Method::POST,
17327        });
17328
17329        for &field in ["alt", "resource"].iter() {
17330            if self._additional_params.contains_key(field) {
17331                dlg.finished(false);
17332                return Err(common::Error::FieldClash(field));
17333            }
17334        }
17335
17336        let mut params = Params::with_capacity(4 + self._additional_params.len());
17337        params.push("resource", self._resource);
17338
17339        params.extend(self._additional_params.iter());
17340
17341        params.push("alt", "json");
17342        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
17343        if self._scopes.is_empty() {
17344            self._scopes
17345                .insert(Scope::CloudPlatform.as_ref().to_string());
17346        }
17347
17348        #[allow(clippy::single_element_loop)]
17349        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17350            url = params.uri_replacement(url, param_name, find_this, true);
17351        }
17352        {
17353            let to_remove = ["resource"];
17354            params.remove_params(&to_remove);
17355        }
17356
17357        let url = params.parse_with_url(&url);
17358
17359        let mut json_mime_type = mime::APPLICATION_JSON;
17360        let mut request_value_reader = {
17361            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17362            common::remove_json_null_values(&mut value);
17363            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17364            serde_json::to_writer(&mut dst, &value).unwrap();
17365            dst
17366        };
17367        let request_size = request_value_reader
17368            .seek(std::io::SeekFrom::End(0))
17369            .unwrap();
17370        request_value_reader
17371            .seek(std::io::SeekFrom::Start(0))
17372            .unwrap();
17373
17374        loop {
17375            let token = match self
17376                .hub
17377                .auth
17378                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17379                .await
17380            {
17381                Ok(token) => token,
17382                Err(e) => match dlg.token(e) {
17383                    Ok(token) => token,
17384                    Err(e) => {
17385                        dlg.finished(false);
17386                        return Err(common::Error::MissingToken(e));
17387                    }
17388                },
17389            };
17390            request_value_reader
17391                .seek(std::io::SeekFrom::Start(0))
17392                .unwrap();
17393            let mut req_result = {
17394                let client = &self.hub.client;
17395                dlg.pre_request();
17396                let mut req_builder = hyper::Request::builder()
17397                    .method(hyper::Method::POST)
17398                    .uri(url.as_str())
17399                    .header(USER_AGENT, self.hub._user_agent.clone());
17400
17401                if let Some(token) = token.as_ref() {
17402                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17403                }
17404
17405                let request = req_builder
17406                    .header(CONTENT_TYPE, json_mime_type.to_string())
17407                    .header(CONTENT_LENGTH, request_size as u64)
17408                    .body(common::to_body(
17409                        request_value_reader.get_ref().clone().into(),
17410                    ));
17411
17412                client.request(request.unwrap()).await
17413            };
17414
17415            match req_result {
17416                Err(err) => {
17417                    if let common::Retry::After(d) = dlg.http_error(&err) {
17418                        sleep(d).await;
17419                        continue;
17420                    }
17421                    dlg.finished(false);
17422                    return Err(common::Error::HttpError(err));
17423                }
17424                Ok(res) => {
17425                    let (mut parts, body) = res.into_parts();
17426                    let mut body = common::Body::new(body);
17427                    if !parts.status.is_success() {
17428                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17429                        let error = serde_json::from_str(&common::to_string(&bytes));
17430                        let response = common::to_response(parts, bytes.into());
17431
17432                        if let common::Retry::After(d) =
17433                            dlg.http_failure(&response, error.as_ref().ok())
17434                        {
17435                            sleep(d).await;
17436                            continue;
17437                        }
17438
17439                        dlg.finished(false);
17440
17441                        return Err(match error {
17442                            Ok(value) => common::Error::BadRequest(value),
17443                            _ => common::Error::Failure(response),
17444                        });
17445                    }
17446                    let response = {
17447                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17448                        let encoded = common::to_string(&bytes);
17449                        match serde_json::from_str(&encoded) {
17450                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17451                            Err(error) => {
17452                                dlg.response_json_decode_error(&encoded, &error);
17453                                return Err(common::Error::JsonDecodeError(
17454                                    encoded.to_string(),
17455                                    error,
17456                                ));
17457                            }
17458                        }
17459                    };
17460
17461                    dlg.finished(true);
17462                    return Ok(response);
17463                }
17464            }
17465        }
17466    }
17467
17468    ///
17469    /// Sets the *request* property to the given value.
17470    ///
17471    /// Even though the property as already been set when instantiating this call,
17472    /// we provide this method for API completeness.
17473    pub fn request(
17474        mut self,
17475        new_value: SetIamPolicyRequest,
17476    ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
17477        self._request = new_value;
17478        self
17479    }
17480    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
17481    ///
17482    /// Sets the *resource* path property to the given value.
17483    ///
17484    /// Even though the property as already been set when instantiating this call,
17485    /// we provide this method for API completeness.
17486    pub fn resource(
17487        mut self,
17488        new_value: &str,
17489    ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
17490        self._resource = new_value.to_string();
17491        self
17492    }
17493    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17494    /// while executing the actual API request.
17495    ///
17496    /// ````text
17497    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17498    /// ````
17499    ///
17500    /// Sets the *delegate* property to the given value.
17501    pub fn delegate(
17502        mut self,
17503        new_value: &'a mut dyn common::Delegate,
17504    ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
17505        self._delegate = Some(new_value);
17506        self
17507    }
17508
17509    /// Set any additional parameter of the query string used in the request.
17510    /// It should be used to set parameters which are not yet available through their own
17511    /// setters.
17512    ///
17513    /// Please note that this method must not be used to set any of the known parameters
17514    /// which have their own setter method. If done anyway, the request will fail.
17515    ///
17516    /// # Additional Parameters
17517    ///
17518    /// * *$.xgafv* (query-string) - V1 error format.
17519    /// * *access_token* (query-string) - OAuth access token.
17520    /// * *alt* (query-string) - Data format for response.
17521    /// * *callback* (query-string) - JSONP
17522    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17523    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17524    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17525    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17526    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17527    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17528    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17529    pub fn param<T>(
17530        mut self,
17531        name: T,
17532        value: T,
17533    ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
17534    where
17535        T: AsRef<str>,
17536    {
17537        self._additional_params
17538            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17539        self
17540    }
17541
17542    /// Identifies the authorization scope for the method you are building.
17543    ///
17544    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17545    /// [`Scope::CloudPlatform`].
17546    ///
17547    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17548    /// tokens for more than one scope.
17549    ///
17550    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17551    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17552    /// sufficient, a read-write scope will do as well.
17553    pub fn add_scope<St>(
17554        mut self,
17555        scope: St,
17556    ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
17557    where
17558        St: AsRef<str>,
17559    {
17560        self._scopes.insert(String::from(scope.as_ref()));
17561        self
17562    }
17563    /// Identifies the authorization scope(s) for the method you are building.
17564    ///
17565    /// See [`Self::add_scope()`] for details.
17566    pub fn add_scopes<I, St>(
17567        mut self,
17568        scopes: I,
17569    ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
17570    where
17571        I: IntoIterator<Item = St>,
17572        St: AsRef<str>,
17573    {
17574        self._scopes
17575            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17576        self
17577    }
17578
17579    /// Removes all scopes, and no default scope will be used either.
17580    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17581    /// for details).
17582    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
17583        self._scopes.clear();
17584        self
17585    }
17586}
17587
17588/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
17589///
17590/// A builder for the *locations.deliveryPipelines.testIamPermissions* method supported by a *project* resource.
17591/// It is not used directly, but through a [`ProjectMethods`] instance.
17592///
17593/// # Example
17594///
17595/// Instantiate a resource method builder
17596///
17597/// ```test_harness,no_run
17598/// # extern crate hyper;
17599/// # extern crate hyper_rustls;
17600/// # extern crate google_clouddeploy1 as clouddeploy1;
17601/// use clouddeploy1::api::TestIamPermissionsRequest;
17602/// # async fn dox() {
17603/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17604///
17605/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17606/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17607/// #     secret,
17608/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17609/// # ).build().await.unwrap();
17610///
17611/// # let client = hyper_util::client::legacy::Client::builder(
17612/// #     hyper_util::rt::TokioExecutor::new()
17613/// # )
17614/// # .build(
17615/// #     hyper_rustls::HttpsConnectorBuilder::new()
17616/// #         .with_native_roots()
17617/// #         .unwrap()
17618/// #         .https_or_http()
17619/// #         .enable_http1()
17620/// #         .build()
17621/// # );
17622/// # let mut hub = CloudDeploy::new(client, auth);
17623/// // As the method needs a request, you would usually fill it with the desired information
17624/// // into the respective structure. Some of the parts shown here might not be applicable !
17625/// // Values shown here are possibly random and not representative !
17626/// let mut req = TestIamPermissionsRequest::default();
17627///
17628/// // You can configure optional parameters by calling the respective setters at will, and
17629/// // execute the final call using `doit()`.
17630/// // Values shown here are possibly random and not representative !
17631/// let result = hub.projects().locations_delivery_pipelines_test_iam_permissions(req, "resource")
17632///              .doit().await;
17633/// # }
17634/// ```
17635pub struct ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
17636where
17637    C: 'a,
17638{
17639    hub: &'a CloudDeploy<C>,
17640    _request: TestIamPermissionsRequest,
17641    _resource: String,
17642    _delegate: Option<&'a mut dyn common::Delegate>,
17643    _additional_params: HashMap<String, String>,
17644    _scopes: BTreeSet<String>,
17645}
17646
17647impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {}
17648
17649impl<'a, C> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
17650where
17651    C: common::Connector,
17652{
17653    /// Perform the operation you have build so far.
17654    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
17655        use std::borrow::Cow;
17656        use std::io::{Read, Seek};
17657
17658        use common::{url::Params, ToParts};
17659        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17660
17661        let mut dd = common::DefaultDelegate;
17662        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17663        dlg.begin(common::MethodInfo {
17664            id: "clouddeploy.projects.locations.deliveryPipelines.testIamPermissions",
17665            http_method: hyper::Method::POST,
17666        });
17667
17668        for &field in ["alt", "resource"].iter() {
17669            if self._additional_params.contains_key(field) {
17670                dlg.finished(false);
17671                return Err(common::Error::FieldClash(field));
17672            }
17673        }
17674
17675        let mut params = Params::with_capacity(4 + self._additional_params.len());
17676        params.push("resource", self._resource);
17677
17678        params.extend(self._additional_params.iter());
17679
17680        params.push("alt", "json");
17681        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
17682        if self._scopes.is_empty() {
17683            self._scopes
17684                .insert(Scope::CloudPlatform.as_ref().to_string());
17685        }
17686
17687        #[allow(clippy::single_element_loop)]
17688        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17689            url = params.uri_replacement(url, param_name, find_this, true);
17690        }
17691        {
17692            let to_remove = ["resource"];
17693            params.remove_params(&to_remove);
17694        }
17695
17696        let url = params.parse_with_url(&url);
17697
17698        let mut json_mime_type = mime::APPLICATION_JSON;
17699        let mut request_value_reader = {
17700            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17701            common::remove_json_null_values(&mut value);
17702            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17703            serde_json::to_writer(&mut dst, &value).unwrap();
17704            dst
17705        };
17706        let request_size = request_value_reader
17707            .seek(std::io::SeekFrom::End(0))
17708            .unwrap();
17709        request_value_reader
17710            .seek(std::io::SeekFrom::Start(0))
17711            .unwrap();
17712
17713        loop {
17714            let token = match self
17715                .hub
17716                .auth
17717                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17718                .await
17719            {
17720                Ok(token) => token,
17721                Err(e) => match dlg.token(e) {
17722                    Ok(token) => token,
17723                    Err(e) => {
17724                        dlg.finished(false);
17725                        return Err(common::Error::MissingToken(e));
17726                    }
17727                },
17728            };
17729            request_value_reader
17730                .seek(std::io::SeekFrom::Start(0))
17731                .unwrap();
17732            let mut req_result = {
17733                let client = &self.hub.client;
17734                dlg.pre_request();
17735                let mut req_builder = hyper::Request::builder()
17736                    .method(hyper::Method::POST)
17737                    .uri(url.as_str())
17738                    .header(USER_AGENT, self.hub._user_agent.clone());
17739
17740                if let Some(token) = token.as_ref() {
17741                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17742                }
17743
17744                let request = req_builder
17745                    .header(CONTENT_TYPE, json_mime_type.to_string())
17746                    .header(CONTENT_LENGTH, request_size as u64)
17747                    .body(common::to_body(
17748                        request_value_reader.get_ref().clone().into(),
17749                    ));
17750
17751                client.request(request.unwrap()).await
17752            };
17753
17754            match req_result {
17755                Err(err) => {
17756                    if let common::Retry::After(d) = dlg.http_error(&err) {
17757                        sleep(d).await;
17758                        continue;
17759                    }
17760                    dlg.finished(false);
17761                    return Err(common::Error::HttpError(err));
17762                }
17763                Ok(res) => {
17764                    let (mut parts, body) = res.into_parts();
17765                    let mut body = common::Body::new(body);
17766                    if !parts.status.is_success() {
17767                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17768                        let error = serde_json::from_str(&common::to_string(&bytes));
17769                        let response = common::to_response(parts, bytes.into());
17770
17771                        if let common::Retry::After(d) =
17772                            dlg.http_failure(&response, error.as_ref().ok())
17773                        {
17774                            sleep(d).await;
17775                            continue;
17776                        }
17777
17778                        dlg.finished(false);
17779
17780                        return Err(match error {
17781                            Ok(value) => common::Error::BadRequest(value),
17782                            _ => common::Error::Failure(response),
17783                        });
17784                    }
17785                    let response = {
17786                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17787                        let encoded = common::to_string(&bytes);
17788                        match serde_json::from_str(&encoded) {
17789                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17790                            Err(error) => {
17791                                dlg.response_json_decode_error(&encoded, &error);
17792                                return Err(common::Error::JsonDecodeError(
17793                                    encoded.to_string(),
17794                                    error,
17795                                ));
17796                            }
17797                        }
17798                    };
17799
17800                    dlg.finished(true);
17801                    return Ok(response);
17802                }
17803            }
17804        }
17805    }
17806
17807    ///
17808    /// Sets the *request* property to the given value.
17809    ///
17810    /// Even though the property as already been set when instantiating this call,
17811    /// we provide this method for API completeness.
17812    pub fn request(
17813        mut self,
17814        new_value: TestIamPermissionsRequest,
17815    ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
17816        self._request = new_value;
17817        self
17818    }
17819    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
17820    ///
17821    /// Sets the *resource* path property to the given value.
17822    ///
17823    /// Even though the property as already been set when instantiating this call,
17824    /// we provide this method for API completeness.
17825    pub fn resource(
17826        mut self,
17827        new_value: &str,
17828    ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
17829        self._resource = new_value.to_string();
17830        self
17831    }
17832    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17833    /// while executing the actual API request.
17834    ///
17835    /// ````text
17836    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17837    /// ````
17838    ///
17839    /// Sets the *delegate* property to the given value.
17840    pub fn delegate(
17841        mut self,
17842        new_value: &'a mut dyn common::Delegate,
17843    ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
17844        self._delegate = Some(new_value);
17845        self
17846    }
17847
17848    /// Set any additional parameter of the query string used in the request.
17849    /// It should be used to set parameters which are not yet available through their own
17850    /// setters.
17851    ///
17852    /// Please note that this method must not be used to set any of the known parameters
17853    /// which have their own setter method. If done anyway, the request will fail.
17854    ///
17855    /// # Additional Parameters
17856    ///
17857    /// * *$.xgafv* (query-string) - V1 error format.
17858    /// * *access_token* (query-string) - OAuth access token.
17859    /// * *alt* (query-string) - Data format for response.
17860    /// * *callback* (query-string) - JSONP
17861    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17862    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
17863    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17864    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17865    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
17866    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17867    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17868    pub fn param<T>(
17869        mut self,
17870        name: T,
17871        value: T,
17872    ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
17873    where
17874        T: AsRef<str>,
17875    {
17876        self._additional_params
17877            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17878        self
17879    }
17880
17881    /// Identifies the authorization scope for the method you are building.
17882    ///
17883    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17884    /// [`Scope::CloudPlatform`].
17885    ///
17886    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17887    /// tokens for more than one scope.
17888    ///
17889    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17890    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17891    /// sufficient, a read-write scope will do as well.
17892    pub fn add_scope<St>(
17893        mut self,
17894        scope: St,
17895    ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
17896    where
17897        St: AsRef<str>,
17898    {
17899        self._scopes.insert(String::from(scope.as_ref()));
17900        self
17901    }
17902    /// Identifies the authorization scope(s) for the method you are building.
17903    ///
17904    /// See [`Self::add_scope()`] for details.
17905    pub fn add_scopes<I, St>(
17906        mut self,
17907        scopes: I,
17908    ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
17909    where
17910        I: IntoIterator<Item = St>,
17911        St: AsRef<str>,
17912    {
17913        self._scopes
17914            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17915        self
17916    }
17917
17918    /// Removes all scopes, and no default scope will be used either.
17919    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17920    /// for details).
17921    pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
17922        self._scopes.clear();
17923        self
17924    }
17925}
17926
17927/// Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
17928///
17929/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
17930/// It is not used directly, but through a [`ProjectMethods`] instance.
17931///
17932/// # Example
17933///
17934/// Instantiate a resource method builder
17935///
17936/// ```test_harness,no_run
17937/// # extern crate hyper;
17938/// # extern crate hyper_rustls;
17939/// # extern crate google_clouddeploy1 as clouddeploy1;
17940/// use clouddeploy1::api::CancelOperationRequest;
17941/// # async fn dox() {
17942/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17943///
17944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17946/// #     secret,
17947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17948/// # ).build().await.unwrap();
17949///
17950/// # let client = hyper_util::client::legacy::Client::builder(
17951/// #     hyper_util::rt::TokioExecutor::new()
17952/// # )
17953/// # .build(
17954/// #     hyper_rustls::HttpsConnectorBuilder::new()
17955/// #         .with_native_roots()
17956/// #         .unwrap()
17957/// #         .https_or_http()
17958/// #         .enable_http1()
17959/// #         .build()
17960/// # );
17961/// # let mut hub = CloudDeploy::new(client, auth);
17962/// // As the method needs a request, you would usually fill it with the desired information
17963/// // into the respective structure. Some of the parts shown here might not be applicable !
17964/// // Values shown here are possibly random and not representative !
17965/// let mut req = CancelOperationRequest::default();
17966///
17967/// // You can configure optional parameters by calling the respective setters at will, and
17968/// // execute the final call using `doit()`.
17969/// // Values shown here are possibly random and not representative !
17970/// let result = hub.projects().locations_operations_cancel(req, "name")
17971///              .doit().await;
17972/// # }
17973/// ```
17974pub struct ProjectLocationOperationCancelCall<'a, C>
17975where
17976    C: 'a,
17977{
17978    hub: &'a CloudDeploy<C>,
17979    _request: CancelOperationRequest,
17980    _name: String,
17981    _delegate: Option<&'a mut dyn common::Delegate>,
17982    _additional_params: HashMap<String, String>,
17983    _scopes: BTreeSet<String>,
17984}
17985
17986impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
17987
17988impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
17989where
17990    C: common::Connector,
17991{
17992    /// Perform the operation you have build so far.
17993    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
17994        use std::borrow::Cow;
17995        use std::io::{Read, Seek};
17996
17997        use common::{url::Params, ToParts};
17998        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17999
18000        let mut dd = common::DefaultDelegate;
18001        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18002        dlg.begin(common::MethodInfo {
18003            id: "clouddeploy.projects.locations.operations.cancel",
18004            http_method: hyper::Method::POST,
18005        });
18006
18007        for &field in ["alt", "name"].iter() {
18008            if self._additional_params.contains_key(field) {
18009                dlg.finished(false);
18010                return Err(common::Error::FieldClash(field));
18011            }
18012        }
18013
18014        let mut params = Params::with_capacity(4 + self._additional_params.len());
18015        params.push("name", self._name);
18016
18017        params.extend(self._additional_params.iter());
18018
18019        params.push("alt", "json");
18020        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
18021        if self._scopes.is_empty() {
18022            self._scopes
18023                .insert(Scope::CloudPlatform.as_ref().to_string());
18024        }
18025
18026        #[allow(clippy::single_element_loop)]
18027        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18028            url = params.uri_replacement(url, param_name, find_this, true);
18029        }
18030        {
18031            let to_remove = ["name"];
18032            params.remove_params(&to_remove);
18033        }
18034
18035        let url = params.parse_with_url(&url);
18036
18037        let mut json_mime_type = mime::APPLICATION_JSON;
18038        let mut request_value_reader = {
18039            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18040            common::remove_json_null_values(&mut value);
18041            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18042            serde_json::to_writer(&mut dst, &value).unwrap();
18043            dst
18044        };
18045        let request_size = request_value_reader
18046            .seek(std::io::SeekFrom::End(0))
18047            .unwrap();
18048        request_value_reader
18049            .seek(std::io::SeekFrom::Start(0))
18050            .unwrap();
18051
18052        loop {
18053            let token = match self
18054                .hub
18055                .auth
18056                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18057                .await
18058            {
18059                Ok(token) => token,
18060                Err(e) => match dlg.token(e) {
18061                    Ok(token) => token,
18062                    Err(e) => {
18063                        dlg.finished(false);
18064                        return Err(common::Error::MissingToken(e));
18065                    }
18066                },
18067            };
18068            request_value_reader
18069                .seek(std::io::SeekFrom::Start(0))
18070                .unwrap();
18071            let mut req_result = {
18072                let client = &self.hub.client;
18073                dlg.pre_request();
18074                let mut req_builder = hyper::Request::builder()
18075                    .method(hyper::Method::POST)
18076                    .uri(url.as_str())
18077                    .header(USER_AGENT, self.hub._user_agent.clone());
18078
18079                if let Some(token) = token.as_ref() {
18080                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18081                }
18082
18083                let request = req_builder
18084                    .header(CONTENT_TYPE, json_mime_type.to_string())
18085                    .header(CONTENT_LENGTH, request_size as u64)
18086                    .body(common::to_body(
18087                        request_value_reader.get_ref().clone().into(),
18088                    ));
18089
18090                client.request(request.unwrap()).await
18091            };
18092
18093            match req_result {
18094                Err(err) => {
18095                    if let common::Retry::After(d) = dlg.http_error(&err) {
18096                        sleep(d).await;
18097                        continue;
18098                    }
18099                    dlg.finished(false);
18100                    return Err(common::Error::HttpError(err));
18101                }
18102                Ok(res) => {
18103                    let (mut parts, body) = res.into_parts();
18104                    let mut body = common::Body::new(body);
18105                    if !parts.status.is_success() {
18106                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18107                        let error = serde_json::from_str(&common::to_string(&bytes));
18108                        let response = common::to_response(parts, bytes.into());
18109
18110                        if let common::Retry::After(d) =
18111                            dlg.http_failure(&response, error.as_ref().ok())
18112                        {
18113                            sleep(d).await;
18114                            continue;
18115                        }
18116
18117                        dlg.finished(false);
18118
18119                        return Err(match error {
18120                            Ok(value) => common::Error::BadRequest(value),
18121                            _ => common::Error::Failure(response),
18122                        });
18123                    }
18124                    let response = {
18125                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18126                        let encoded = common::to_string(&bytes);
18127                        match serde_json::from_str(&encoded) {
18128                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18129                            Err(error) => {
18130                                dlg.response_json_decode_error(&encoded, &error);
18131                                return Err(common::Error::JsonDecodeError(
18132                                    encoded.to_string(),
18133                                    error,
18134                                ));
18135                            }
18136                        }
18137                    };
18138
18139                    dlg.finished(true);
18140                    return Ok(response);
18141                }
18142            }
18143        }
18144    }
18145
18146    ///
18147    /// Sets the *request* property to the given value.
18148    ///
18149    /// Even though the property as already been set when instantiating this call,
18150    /// we provide this method for API completeness.
18151    pub fn request(
18152        mut self,
18153        new_value: CancelOperationRequest,
18154    ) -> ProjectLocationOperationCancelCall<'a, C> {
18155        self._request = new_value;
18156        self
18157    }
18158    /// The name of the operation resource to be cancelled.
18159    ///
18160    /// Sets the *name* path property to the given value.
18161    ///
18162    /// Even though the property as already been set when instantiating this call,
18163    /// we provide this method for API completeness.
18164    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
18165        self._name = new_value.to_string();
18166        self
18167    }
18168    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18169    /// while executing the actual API request.
18170    ///
18171    /// ````text
18172    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18173    /// ````
18174    ///
18175    /// Sets the *delegate* property to the given value.
18176    pub fn delegate(
18177        mut self,
18178        new_value: &'a mut dyn common::Delegate,
18179    ) -> ProjectLocationOperationCancelCall<'a, C> {
18180        self._delegate = Some(new_value);
18181        self
18182    }
18183
18184    /// Set any additional parameter of the query string used in the request.
18185    /// It should be used to set parameters which are not yet available through their own
18186    /// setters.
18187    ///
18188    /// Please note that this method must not be used to set any of the known parameters
18189    /// which have their own setter method. If done anyway, the request will fail.
18190    ///
18191    /// # Additional Parameters
18192    ///
18193    /// * *$.xgafv* (query-string) - V1 error format.
18194    /// * *access_token* (query-string) - OAuth access token.
18195    /// * *alt* (query-string) - Data format for response.
18196    /// * *callback* (query-string) - JSONP
18197    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18198    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18199    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18200    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18201    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18202    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18203    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18204    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
18205    where
18206        T: AsRef<str>,
18207    {
18208        self._additional_params
18209            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18210        self
18211    }
18212
18213    /// Identifies the authorization scope for the method you are building.
18214    ///
18215    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18216    /// [`Scope::CloudPlatform`].
18217    ///
18218    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18219    /// tokens for more than one scope.
18220    ///
18221    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18222    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18223    /// sufficient, a read-write scope will do as well.
18224    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
18225    where
18226        St: AsRef<str>,
18227    {
18228        self._scopes.insert(String::from(scope.as_ref()));
18229        self
18230    }
18231    /// Identifies the authorization scope(s) for the method you are building.
18232    ///
18233    /// See [`Self::add_scope()`] for details.
18234    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
18235    where
18236        I: IntoIterator<Item = St>,
18237        St: AsRef<str>,
18238    {
18239        self._scopes
18240            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18241        self
18242    }
18243
18244    /// Removes all scopes, and no default scope will be used either.
18245    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18246    /// for details).
18247    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
18248        self._scopes.clear();
18249        self
18250    }
18251}
18252
18253/// Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
18254///
18255/// A builder for the *locations.operations.delete* method supported by a *project* resource.
18256/// It is not used directly, but through a [`ProjectMethods`] instance.
18257///
18258/// # Example
18259///
18260/// Instantiate a resource method builder
18261///
18262/// ```test_harness,no_run
18263/// # extern crate hyper;
18264/// # extern crate hyper_rustls;
18265/// # extern crate google_clouddeploy1 as clouddeploy1;
18266/// # async fn dox() {
18267/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18268///
18269/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18270/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18271/// #     secret,
18272/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18273/// # ).build().await.unwrap();
18274///
18275/// # let client = hyper_util::client::legacy::Client::builder(
18276/// #     hyper_util::rt::TokioExecutor::new()
18277/// # )
18278/// # .build(
18279/// #     hyper_rustls::HttpsConnectorBuilder::new()
18280/// #         .with_native_roots()
18281/// #         .unwrap()
18282/// #         .https_or_http()
18283/// #         .enable_http1()
18284/// #         .build()
18285/// # );
18286/// # let mut hub = CloudDeploy::new(client, auth);
18287/// // You can configure optional parameters by calling the respective setters at will, and
18288/// // execute the final call using `doit()`.
18289/// // Values shown here are possibly random and not representative !
18290/// let result = hub.projects().locations_operations_delete("name")
18291///              .doit().await;
18292/// # }
18293/// ```
18294pub struct ProjectLocationOperationDeleteCall<'a, C>
18295where
18296    C: 'a,
18297{
18298    hub: &'a CloudDeploy<C>,
18299    _name: String,
18300    _delegate: Option<&'a mut dyn common::Delegate>,
18301    _additional_params: HashMap<String, String>,
18302    _scopes: BTreeSet<String>,
18303}
18304
18305impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
18306
18307impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
18308where
18309    C: common::Connector,
18310{
18311    /// Perform the operation you have build so far.
18312    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
18313        use std::borrow::Cow;
18314        use std::io::{Read, Seek};
18315
18316        use common::{url::Params, ToParts};
18317        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18318
18319        let mut dd = common::DefaultDelegate;
18320        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18321        dlg.begin(common::MethodInfo {
18322            id: "clouddeploy.projects.locations.operations.delete",
18323            http_method: hyper::Method::DELETE,
18324        });
18325
18326        for &field in ["alt", "name"].iter() {
18327            if self._additional_params.contains_key(field) {
18328                dlg.finished(false);
18329                return Err(common::Error::FieldClash(field));
18330            }
18331        }
18332
18333        let mut params = Params::with_capacity(3 + self._additional_params.len());
18334        params.push("name", self._name);
18335
18336        params.extend(self._additional_params.iter());
18337
18338        params.push("alt", "json");
18339        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18340        if self._scopes.is_empty() {
18341            self._scopes
18342                .insert(Scope::CloudPlatform.as_ref().to_string());
18343        }
18344
18345        #[allow(clippy::single_element_loop)]
18346        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18347            url = params.uri_replacement(url, param_name, find_this, true);
18348        }
18349        {
18350            let to_remove = ["name"];
18351            params.remove_params(&to_remove);
18352        }
18353
18354        let url = params.parse_with_url(&url);
18355
18356        loop {
18357            let token = match self
18358                .hub
18359                .auth
18360                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18361                .await
18362            {
18363                Ok(token) => token,
18364                Err(e) => match dlg.token(e) {
18365                    Ok(token) => token,
18366                    Err(e) => {
18367                        dlg.finished(false);
18368                        return Err(common::Error::MissingToken(e));
18369                    }
18370                },
18371            };
18372            let mut req_result = {
18373                let client = &self.hub.client;
18374                dlg.pre_request();
18375                let mut req_builder = hyper::Request::builder()
18376                    .method(hyper::Method::DELETE)
18377                    .uri(url.as_str())
18378                    .header(USER_AGENT, self.hub._user_agent.clone());
18379
18380                if let Some(token) = token.as_ref() {
18381                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18382                }
18383
18384                let request = req_builder
18385                    .header(CONTENT_LENGTH, 0_u64)
18386                    .body(common::to_body::<String>(None));
18387
18388                client.request(request.unwrap()).await
18389            };
18390
18391            match req_result {
18392                Err(err) => {
18393                    if let common::Retry::After(d) = dlg.http_error(&err) {
18394                        sleep(d).await;
18395                        continue;
18396                    }
18397                    dlg.finished(false);
18398                    return Err(common::Error::HttpError(err));
18399                }
18400                Ok(res) => {
18401                    let (mut parts, body) = res.into_parts();
18402                    let mut body = common::Body::new(body);
18403                    if !parts.status.is_success() {
18404                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18405                        let error = serde_json::from_str(&common::to_string(&bytes));
18406                        let response = common::to_response(parts, bytes.into());
18407
18408                        if let common::Retry::After(d) =
18409                            dlg.http_failure(&response, error.as_ref().ok())
18410                        {
18411                            sleep(d).await;
18412                            continue;
18413                        }
18414
18415                        dlg.finished(false);
18416
18417                        return Err(match error {
18418                            Ok(value) => common::Error::BadRequest(value),
18419                            _ => common::Error::Failure(response),
18420                        });
18421                    }
18422                    let response = {
18423                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18424                        let encoded = common::to_string(&bytes);
18425                        match serde_json::from_str(&encoded) {
18426                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18427                            Err(error) => {
18428                                dlg.response_json_decode_error(&encoded, &error);
18429                                return Err(common::Error::JsonDecodeError(
18430                                    encoded.to_string(),
18431                                    error,
18432                                ));
18433                            }
18434                        }
18435                    };
18436
18437                    dlg.finished(true);
18438                    return Ok(response);
18439                }
18440            }
18441        }
18442    }
18443
18444    /// The name of the operation resource to be deleted.
18445    ///
18446    /// Sets the *name* path property to the given value.
18447    ///
18448    /// Even though the property as already been set when instantiating this call,
18449    /// we provide this method for API completeness.
18450    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
18451        self._name = new_value.to_string();
18452        self
18453    }
18454    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18455    /// while executing the actual API request.
18456    ///
18457    /// ````text
18458    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18459    /// ````
18460    ///
18461    /// Sets the *delegate* property to the given value.
18462    pub fn delegate(
18463        mut self,
18464        new_value: &'a mut dyn common::Delegate,
18465    ) -> ProjectLocationOperationDeleteCall<'a, C> {
18466        self._delegate = Some(new_value);
18467        self
18468    }
18469
18470    /// Set any additional parameter of the query string used in the request.
18471    /// It should be used to set parameters which are not yet available through their own
18472    /// setters.
18473    ///
18474    /// Please note that this method must not be used to set any of the known parameters
18475    /// which have their own setter method. If done anyway, the request will fail.
18476    ///
18477    /// # Additional Parameters
18478    ///
18479    /// * *$.xgafv* (query-string) - V1 error format.
18480    /// * *access_token* (query-string) - OAuth access token.
18481    /// * *alt* (query-string) - Data format for response.
18482    /// * *callback* (query-string) - JSONP
18483    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18484    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18485    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18486    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18487    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18488    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18489    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18490    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
18491    where
18492        T: AsRef<str>,
18493    {
18494        self._additional_params
18495            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18496        self
18497    }
18498
18499    /// Identifies the authorization scope for the method you are building.
18500    ///
18501    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18502    /// [`Scope::CloudPlatform`].
18503    ///
18504    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18505    /// tokens for more than one scope.
18506    ///
18507    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18508    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18509    /// sufficient, a read-write scope will do as well.
18510    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
18511    where
18512        St: AsRef<str>,
18513    {
18514        self._scopes.insert(String::from(scope.as_ref()));
18515        self
18516    }
18517    /// Identifies the authorization scope(s) for the method you are building.
18518    ///
18519    /// See [`Self::add_scope()`] for details.
18520    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
18521    where
18522        I: IntoIterator<Item = St>,
18523        St: AsRef<str>,
18524    {
18525        self._scopes
18526            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18527        self
18528    }
18529
18530    /// Removes all scopes, and no default scope will be used either.
18531    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18532    /// for details).
18533    pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
18534        self._scopes.clear();
18535        self
18536    }
18537}
18538
18539/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
18540///
18541/// A builder for the *locations.operations.get* method supported by a *project* resource.
18542/// It is not used directly, but through a [`ProjectMethods`] instance.
18543///
18544/// # Example
18545///
18546/// Instantiate a resource method builder
18547///
18548/// ```test_harness,no_run
18549/// # extern crate hyper;
18550/// # extern crate hyper_rustls;
18551/// # extern crate google_clouddeploy1 as clouddeploy1;
18552/// # async fn dox() {
18553/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18554///
18555/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18556/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18557/// #     secret,
18558/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18559/// # ).build().await.unwrap();
18560///
18561/// # let client = hyper_util::client::legacy::Client::builder(
18562/// #     hyper_util::rt::TokioExecutor::new()
18563/// # )
18564/// # .build(
18565/// #     hyper_rustls::HttpsConnectorBuilder::new()
18566/// #         .with_native_roots()
18567/// #         .unwrap()
18568/// #         .https_or_http()
18569/// #         .enable_http1()
18570/// #         .build()
18571/// # );
18572/// # let mut hub = CloudDeploy::new(client, auth);
18573/// // You can configure optional parameters by calling the respective setters at will, and
18574/// // execute the final call using `doit()`.
18575/// // Values shown here are possibly random and not representative !
18576/// let result = hub.projects().locations_operations_get("name")
18577///              .doit().await;
18578/// # }
18579/// ```
18580pub struct ProjectLocationOperationGetCall<'a, C>
18581where
18582    C: 'a,
18583{
18584    hub: &'a CloudDeploy<C>,
18585    _name: String,
18586    _delegate: Option<&'a mut dyn common::Delegate>,
18587    _additional_params: HashMap<String, String>,
18588    _scopes: BTreeSet<String>,
18589}
18590
18591impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
18592
18593impl<'a, C> ProjectLocationOperationGetCall<'a, C>
18594where
18595    C: common::Connector,
18596{
18597    /// Perform the operation you have build so far.
18598    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18599        use std::borrow::Cow;
18600        use std::io::{Read, Seek};
18601
18602        use common::{url::Params, ToParts};
18603        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18604
18605        let mut dd = common::DefaultDelegate;
18606        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18607        dlg.begin(common::MethodInfo {
18608            id: "clouddeploy.projects.locations.operations.get",
18609            http_method: hyper::Method::GET,
18610        });
18611
18612        for &field in ["alt", "name"].iter() {
18613            if self._additional_params.contains_key(field) {
18614                dlg.finished(false);
18615                return Err(common::Error::FieldClash(field));
18616            }
18617        }
18618
18619        let mut params = Params::with_capacity(3 + self._additional_params.len());
18620        params.push("name", self._name);
18621
18622        params.extend(self._additional_params.iter());
18623
18624        params.push("alt", "json");
18625        let mut url = self.hub._base_url.clone() + "v1/{+name}";
18626        if self._scopes.is_empty() {
18627            self._scopes
18628                .insert(Scope::CloudPlatform.as_ref().to_string());
18629        }
18630
18631        #[allow(clippy::single_element_loop)]
18632        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18633            url = params.uri_replacement(url, param_name, find_this, true);
18634        }
18635        {
18636            let to_remove = ["name"];
18637            params.remove_params(&to_remove);
18638        }
18639
18640        let url = params.parse_with_url(&url);
18641
18642        loop {
18643            let token = match self
18644                .hub
18645                .auth
18646                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18647                .await
18648            {
18649                Ok(token) => token,
18650                Err(e) => match dlg.token(e) {
18651                    Ok(token) => token,
18652                    Err(e) => {
18653                        dlg.finished(false);
18654                        return Err(common::Error::MissingToken(e));
18655                    }
18656                },
18657            };
18658            let mut req_result = {
18659                let client = &self.hub.client;
18660                dlg.pre_request();
18661                let mut req_builder = hyper::Request::builder()
18662                    .method(hyper::Method::GET)
18663                    .uri(url.as_str())
18664                    .header(USER_AGENT, self.hub._user_agent.clone());
18665
18666                if let Some(token) = token.as_ref() {
18667                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18668                }
18669
18670                let request = req_builder
18671                    .header(CONTENT_LENGTH, 0_u64)
18672                    .body(common::to_body::<String>(None));
18673
18674                client.request(request.unwrap()).await
18675            };
18676
18677            match req_result {
18678                Err(err) => {
18679                    if let common::Retry::After(d) = dlg.http_error(&err) {
18680                        sleep(d).await;
18681                        continue;
18682                    }
18683                    dlg.finished(false);
18684                    return Err(common::Error::HttpError(err));
18685                }
18686                Ok(res) => {
18687                    let (mut parts, body) = res.into_parts();
18688                    let mut body = common::Body::new(body);
18689                    if !parts.status.is_success() {
18690                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18691                        let error = serde_json::from_str(&common::to_string(&bytes));
18692                        let response = common::to_response(parts, bytes.into());
18693
18694                        if let common::Retry::After(d) =
18695                            dlg.http_failure(&response, error.as_ref().ok())
18696                        {
18697                            sleep(d).await;
18698                            continue;
18699                        }
18700
18701                        dlg.finished(false);
18702
18703                        return Err(match error {
18704                            Ok(value) => common::Error::BadRequest(value),
18705                            _ => common::Error::Failure(response),
18706                        });
18707                    }
18708                    let response = {
18709                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18710                        let encoded = common::to_string(&bytes);
18711                        match serde_json::from_str(&encoded) {
18712                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18713                            Err(error) => {
18714                                dlg.response_json_decode_error(&encoded, &error);
18715                                return Err(common::Error::JsonDecodeError(
18716                                    encoded.to_string(),
18717                                    error,
18718                                ));
18719                            }
18720                        }
18721                    };
18722
18723                    dlg.finished(true);
18724                    return Ok(response);
18725                }
18726            }
18727        }
18728    }
18729
18730    /// The name of the operation resource.
18731    ///
18732    /// Sets the *name* path property to the given value.
18733    ///
18734    /// Even though the property as already been set when instantiating this call,
18735    /// we provide this method for API completeness.
18736    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
18737        self._name = new_value.to_string();
18738        self
18739    }
18740    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18741    /// while executing the actual API request.
18742    ///
18743    /// ````text
18744    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18745    /// ````
18746    ///
18747    /// Sets the *delegate* property to the given value.
18748    pub fn delegate(
18749        mut self,
18750        new_value: &'a mut dyn common::Delegate,
18751    ) -> ProjectLocationOperationGetCall<'a, C> {
18752        self._delegate = Some(new_value);
18753        self
18754    }
18755
18756    /// Set any additional parameter of the query string used in the request.
18757    /// It should be used to set parameters which are not yet available through their own
18758    /// setters.
18759    ///
18760    /// Please note that this method must not be used to set any of the known parameters
18761    /// which have their own setter method. If done anyway, the request will fail.
18762    ///
18763    /// # Additional Parameters
18764    ///
18765    /// * *$.xgafv* (query-string) - V1 error format.
18766    /// * *access_token* (query-string) - OAuth access token.
18767    /// * *alt* (query-string) - Data format for response.
18768    /// * *callback* (query-string) - JSONP
18769    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18770    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
18771    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18772    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18773    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
18774    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18775    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18776    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
18777    where
18778        T: AsRef<str>,
18779    {
18780        self._additional_params
18781            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18782        self
18783    }
18784
18785    /// Identifies the authorization scope for the method you are building.
18786    ///
18787    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18788    /// [`Scope::CloudPlatform`].
18789    ///
18790    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18791    /// tokens for more than one scope.
18792    ///
18793    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18794    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18795    /// sufficient, a read-write scope will do as well.
18796    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
18797    where
18798        St: AsRef<str>,
18799    {
18800        self._scopes.insert(String::from(scope.as_ref()));
18801        self
18802    }
18803    /// Identifies the authorization scope(s) for the method you are building.
18804    ///
18805    /// See [`Self::add_scope()`] for details.
18806    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
18807    where
18808        I: IntoIterator<Item = St>,
18809        St: AsRef<str>,
18810    {
18811        self._scopes
18812            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18813        self
18814    }
18815
18816    /// Removes all scopes, and no default scope will be used either.
18817    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18818    /// for details).
18819    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
18820        self._scopes.clear();
18821        self
18822    }
18823}
18824
18825/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
18826///
18827/// A builder for the *locations.operations.list* method supported by a *project* resource.
18828/// It is not used directly, but through a [`ProjectMethods`] instance.
18829///
18830/// # Example
18831///
18832/// Instantiate a resource method builder
18833///
18834/// ```test_harness,no_run
18835/// # extern crate hyper;
18836/// # extern crate hyper_rustls;
18837/// # extern crate google_clouddeploy1 as clouddeploy1;
18838/// # async fn dox() {
18839/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18840///
18841/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18842/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18843/// #     secret,
18844/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18845/// # ).build().await.unwrap();
18846///
18847/// # let client = hyper_util::client::legacy::Client::builder(
18848/// #     hyper_util::rt::TokioExecutor::new()
18849/// # )
18850/// # .build(
18851/// #     hyper_rustls::HttpsConnectorBuilder::new()
18852/// #         .with_native_roots()
18853/// #         .unwrap()
18854/// #         .https_or_http()
18855/// #         .enable_http1()
18856/// #         .build()
18857/// # );
18858/// # let mut hub = CloudDeploy::new(client, auth);
18859/// // You can configure optional parameters by calling the respective setters at will, and
18860/// // execute the final call using `doit()`.
18861/// // Values shown here are possibly random and not representative !
18862/// let result = hub.projects().locations_operations_list("name")
18863///              .page_token("sed")
18864///              .page_size(-75)
18865///              .filter("Lorem")
18866///              .doit().await;
18867/// # }
18868/// ```
18869pub struct ProjectLocationOperationListCall<'a, C>
18870where
18871    C: 'a,
18872{
18873    hub: &'a CloudDeploy<C>,
18874    _name: String,
18875    _page_token: Option<String>,
18876    _page_size: Option<i32>,
18877    _filter: Option<String>,
18878    _delegate: Option<&'a mut dyn common::Delegate>,
18879    _additional_params: HashMap<String, String>,
18880    _scopes: BTreeSet<String>,
18881}
18882
18883impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
18884
18885impl<'a, C> ProjectLocationOperationListCall<'a, C>
18886where
18887    C: common::Connector,
18888{
18889    /// Perform the operation you have build so far.
18890    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
18891        use std::borrow::Cow;
18892        use std::io::{Read, Seek};
18893
18894        use common::{url::Params, ToParts};
18895        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18896
18897        let mut dd = common::DefaultDelegate;
18898        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18899        dlg.begin(common::MethodInfo {
18900            id: "clouddeploy.projects.locations.operations.list",
18901            http_method: hyper::Method::GET,
18902        });
18903
18904        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
18905            if self._additional_params.contains_key(field) {
18906                dlg.finished(false);
18907                return Err(common::Error::FieldClash(field));
18908            }
18909        }
18910
18911        let mut params = Params::with_capacity(6 + self._additional_params.len());
18912        params.push("name", self._name);
18913        if let Some(value) = self._page_token.as_ref() {
18914            params.push("pageToken", value);
18915        }
18916        if let Some(value) = self._page_size.as_ref() {
18917            params.push("pageSize", value.to_string());
18918        }
18919        if let Some(value) = self._filter.as_ref() {
18920            params.push("filter", value);
18921        }
18922
18923        params.extend(self._additional_params.iter());
18924
18925        params.push("alt", "json");
18926        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
18927        if self._scopes.is_empty() {
18928            self._scopes
18929                .insert(Scope::CloudPlatform.as_ref().to_string());
18930        }
18931
18932        #[allow(clippy::single_element_loop)]
18933        for &(find_this, param_name) in [("{+name}", "name")].iter() {
18934            url = params.uri_replacement(url, param_name, find_this, true);
18935        }
18936        {
18937            let to_remove = ["name"];
18938            params.remove_params(&to_remove);
18939        }
18940
18941        let url = params.parse_with_url(&url);
18942
18943        loop {
18944            let token = match self
18945                .hub
18946                .auth
18947                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18948                .await
18949            {
18950                Ok(token) => token,
18951                Err(e) => match dlg.token(e) {
18952                    Ok(token) => token,
18953                    Err(e) => {
18954                        dlg.finished(false);
18955                        return Err(common::Error::MissingToken(e));
18956                    }
18957                },
18958            };
18959            let mut req_result = {
18960                let client = &self.hub.client;
18961                dlg.pre_request();
18962                let mut req_builder = hyper::Request::builder()
18963                    .method(hyper::Method::GET)
18964                    .uri(url.as_str())
18965                    .header(USER_AGENT, self.hub._user_agent.clone());
18966
18967                if let Some(token) = token.as_ref() {
18968                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18969                }
18970
18971                let request = req_builder
18972                    .header(CONTENT_LENGTH, 0_u64)
18973                    .body(common::to_body::<String>(None));
18974
18975                client.request(request.unwrap()).await
18976            };
18977
18978            match req_result {
18979                Err(err) => {
18980                    if let common::Retry::After(d) = dlg.http_error(&err) {
18981                        sleep(d).await;
18982                        continue;
18983                    }
18984                    dlg.finished(false);
18985                    return Err(common::Error::HttpError(err));
18986                }
18987                Ok(res) => {
18988                    let (mut parts, body) = res.into_parts();
18989                    let mut body = common::Body::new(body);
18990                    if !parts.status.is_success() {
18991                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18992                        let error = serde_json::from_str(&common::to_string(&bytes));
18993                        let response = common::to_response(parts, bytes.into());
18994
18995                        if let common::Retry::After(d) =
18996                            dlg.http_failure(&response, error.as_ref().ok())
18997                        {
18998                            sleep(d).await;
18999                            continue;
19000                        }
19001
19002                        dlg.finished(false);
19003
19004                        return Err(match error {
19005                            Ok(value) => common::Error::BadRequest(value),
19006                            _ => common::Error::Failure(response),
19007                        });
19008                    }
19009                    let response = {
19010                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19011                        let encoded = common::to_string(&bytes);
19012                        match serde_json::from_str(&encoded) {
19013                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19014                            Err(error) => {
19015                                dlg.response_json_decode_error(&encoded, &error);
19016                                return Err(common::Error::JsonDecodeError(
19017                                    encoded.to_string(),
19018                                    error,
19019                                ));
19020                            }
19021                        }
19022                    };
19023
19024                    dlg.finished(true);
19025                    return Ok(response);
19026                }
19027            }
19028        }
19029    }
19030
19031    /// The name of the operation's parent resource.
19032    ///
19033    /// Sets the *name* path property to the given value.
19034    ///
19035    /// Even though the property as already been set when instantiating this call,
19036    /// we provide this method for API completeness.
19037    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
19038        self._name = new_value.to_string();
19039        self
19040    }
19041    /// The standard list page token.
19042    ///
19043    /// Sets the *page token* query property to the given value.
19044    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
19045        self._page_token = Some(new_value.to_string());
19046        self
19047    }
19048    /// The standard list page size.
19049    ///
19050    /// Sets the *page size* query property to the given value.
19051    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
19052        self._page_size = Some(new_value);
19053        self
19054    }
19055    /// The standard list filter.
19056    ///
19057    /// Sets the *filter* query property to the given value.
19058    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
19059        self._filter = Some(new_value.to_string());
19060        self
19061    }
19062    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19063    /// while executing the actual API request.
19064    ///
19065    /// ````text
19066    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19067    /// ````
19068    ///
19069    /// Sets the *delegate* property to the given value.
19070    pub fn delegate(
19071        mut self,
19072        new_value: &'a mut dyn common::Delegate,
19073    ) -> ProjectLocationOperationListCall<'a, C> {
19074        self._delegate = Some(new_value);
19075        self
19076    }
19077
19078    /// Set any additional parameter of the query string used in the request.
19079    /// It should be used to set parameters which are not yet available through their own
19080    /// setters.
19081    ///
19082    /// Please note that this method must not be used to set any of the known parameters
19083    /// which have their own setter method. If done anyway, the request will fail.
19084    ///
19085    /// # Additional Parameters
19086    ///
19087    /// * *$.xgafv* (query-string) - V1 error format.
19088    /// * *access_token* (query-string) - OAuth access token.
19089    /// * *alt* (query-string) - Data format for response.
19090    /// * *callback* (query-string) - JSONP
19091    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19092    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19093    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19094    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19095    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19096    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19097    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19098    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
19099    where
19100        T: AsRef<str>,
19101    {
19102        self._additional_params
19103            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19104        self
19105    }
19106
19107    /// Identifies the authorization scope for the method you are building.
19108    ///
19109    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19110    /// [`Scope::CloudPlatform`].
19111    ///
19112    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19113    /// tokens for more than one scope.
19114    ///
19115    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19116    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19117    /// sufficient, a read-write scope will do as well.
19118    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
19119    where
19120        St: AsRef<str>,
19121    {
19122        self._scopes.insert(String::from(scope.as_ref()));
19123        self
19124    }
19125    /// Identifies the authorization scope(s) for the method you are building.
19126    ///
19127    /// See [`Self::add_scope()`] for details.
19128    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
19129    where
19130        I: IntoIterator<Item = St>,
19131        St: AsRef<str>,
19132    {
19133        self._scopes
19134            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19135        self
19136    }
19137
19138    /// Removes all scopes, and no default scope will be used either.
19139    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19140    /// for details).
19141    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
19142        self._scopes.clear();
19143        self
19144    }
19145}
19146
19147/// Creates a new Target in a given project and location.
19148///
19149/// A builder for the *locations.targets.create* method supported by a *project* resource.
19150/// It is not used directly, but through a [`ProjectMethods`] instance.
19151///
19152/// # Example
19153///
19154/// Instantiate a resource method builder
19155///
19156/// ```test_harness,no_run
19157/// # extern crate hyper;
19158/// # extern crate hyper_rustls;
19159/// # extern crate google_clouddeploy1 as clouddeploy1;
19160/// use clouddeploy1::api::Target;
19161/// # async fn dox() {
19162/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19163///
19164/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19165/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19166/// #     secret,
19167/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19168/// # ).build().await.unwrap();
19169///
19170/// # let client = hyper_util::client::legacy::Client::builder(
19171/// #     hyper_util::rt::TokioExecutor::new()
19172/// # )
19173/// # .build(
19174/// #     hyper_rustls::HttpsConnectorBuilder::new()
19175/// #         .with_native_roots()
19176/// #         .unwrap()
19177/// #         .https_or_http()
19178/// #         .enable_http1()
19179/// #         .build()
19180/// # );
19181/// # let mut hub = CloudDeploy::new(client, auth);
19182/// // As the method needs a request, you would usually fill it with the desired information
19183/// // into the respective structure. Some of the parts shown here might not be applicable !
19184/// // Values shown here are possibly random and not representative !
19185/// let mut req = Target::default();
19186///
19187/// // You can configure optional parameters by calling the respective setters at will, and
19188/// // execute the final call using `doit()`.
19189/// // Values shown here are possibly random and not representative !
19190/// let result = hub.projects().locations_targets_create(req, "parent")
19191///              .validate_only(true)
19192///              .target_id("sea")
19193///              .request_id("et")
19194///              .doit().await;
19195/// # }
19196/// ```
19197pub struct ProjectLocationTargetCreateCall<'a, C>
19198where
19199    C: 'a,
19200{
19201    hub: &'a CloudDeploy<C>,
19202    _request: Target,
19203    _parent: String,
19204    _validate_only: Option<bool>,
19205    _target_id: Option<String>,
19206    _request_id: Option<String>,
19207    _delegate: Option<&'a mut dyn common::Delegate>,
19208    _additional_params: HashMap<String, String>,
19209    _scopes: BTreeSet<String>,
19210}
19211
19212impl<'a, C> common::CallBuilder for ProjectLocationTargetCreateCall<'a, C> {}
19213
19214impl<'a, C> ProjectLocationTargetCreateCall<'a, C>
19215where
19216    C: common::Connector,
19217{
19218    /// Perform the operation you have build so far.
19219    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19220        use std::borrow::Cow;
19221        use std::io::{Read, Seek};
19222
19223        use common::{url::Params, ToParts};
19224        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19225
19226        let mut dd = common::DefaultDelegate;
19227        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19228        dlg.begin(common::MethodInfo {
19229            id: "clouddeploy.projects.locations.targets.create",
19230            http_method: hyper::Method::POST,
19231        });
19232
19233        for &field in ["alt", "parent", "validateOnly", "targetId", "requestId"].iter() {
19234            if self._additional_params.contains_key(field) {
19235                dlg.finished(false);
19236                return Err(common::Error::FieldClash(field));
19237            }
19238        }
19239
19240        let mut params = Params::with_capacity(7 + self._additional_params.len());
19241        params.push("parent", self._parent);
19242        if let Some(value) = self._validate_only.as_ref() {
19243            params.push("validateOnly", value.to_string());
19244        }
19245        if let Some(value) = self._target_id.as_ref() {
19246            params.push("targetId", value);
19247        }
19248        if let Some(value) = self._request_id.as_ref() {
19249            params.push("requestId", value);
19250        }
19251
19252        params.extend(self._additional_params.iter());
19253
19254        params.push("alt", "json");
19255        let mut url = self.hub._base_url.clone() + "v1/{+parent}/targets";
19256        if self._scopes.is_empty() {
19257            self._scopes
19258                .insert(Scope::CloudPlatform.as_ref().to_string());
19259        }
19260
19261        #[allow(clippy::single_element_loop)]
19262        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19263            url = params.uri_replacement(url, param_name, find_this, true);
19264        }
19265        {
19266            let to_remove = ["parent"];
19267            params.remove_params(&to_remove);
19268        }
19269
19270        let url = params.parse_with_url(&url);
19271
19272        let mut json_mime_type = mime::APPLICATION_JSON;
19273        let mut request_value_reader = {
19274            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19275            common::remove_json_null_values(&mut value);
19276            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19277            serde_json::to_writer(&mut dst, &value).unwrap();
19278            dst
19279        };
19280        let request_size = request_value_reader
19281            .seek(std::io::SeekFrom::End(0))
19282            .unwrap();
19283        request_value_reader
19284            .seek(std::io::SeekFrom::Start(0))
19285            .unwrap();
19286
19287        loop {
19288            let token = match self
19289                .hub
19290                .auth
19291                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19292                .await
19293            {
19294                Ok(token) => token,
19295                Err(e) => match dlg.token(e) {
19296                    Ok(token) => token,
19297                    Err(e) => {
19298                        dlg.finished(false);
19299                        return Err(common::Error::MissingToken(e));
19300                    }
19301                },
19302            };
19303            request_value_reader
19304                .seek(std::io::SeekFrom::Start(0))
19305                .unwrap();
19306            let mut req_result = {
19307                let client = &self.hub.client;
19308                dlg.pre_request();
19309                let mut req_builder = hyper::Request::builder()
19310                    .method(hyper::Method::POST)
19311                    .uri(url.as_str())
19312                    .header(USER_AGENT, self.hub._user_agent.clone());
19313
19314                if let Some(token) = token.as_ref() {
19315                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19316                }
19317
19318                let request = req_builder
19319                    .header(CONTENT_TYPE, json_mime_type.to_string())
19320                    .header(CONTENT_LENGTH, request_size as u64)
19321                    .body(common::to_body(
19322                        request_value_reader.get_ref().clone().into(),
19323                    ));
19324
19325                client.request(request.unwrap()).await
19326            };
19327
19328            match req_result {
19329                Err(err) => {
19330                    if let common::Retry::After(d) = dlg.http_error(&err) {
19331                        sleep(d).await;
19332                        continue;
19333                    }
19334                    dlg.finished(false);
19335                    return Err(common::Error::HttpError(err));
19336                }
19337                Ok(res) => {
19338                    let (mut parts, body) = res.into_parts();
19339                    let mut body = common::Body::new(body);
19340                    if !parts.status.is_success() {
19341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19342                        let error = serde_json::from_str(&common::to_string(&bytes));
19343                        let response = common::to_response(parts, bytes.into());
19344
19345                        if let common::Retry::After(d) =
19346                            dlg.http_failure(&response, error.as_ref().ok())
19347                        {
19348                            sleep(d).await;
19349                            continue;
19350                        }
19351
19352                        dlg.finished(false);
19353
19354                        return Err(match error {
19355                            Ok(value) => common::Error::BadRequest(value),
19356                            _ => common::Error::Failure(response),
19357                        });
19358                    }
19359                    let response = {
19360                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19361                        let encoded = common::to_string(&bytes);
19362                        match serde_json::from_str(&encoded) {
19363                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19364                            Err(error) => {
19365                                dlg.response_json_decode_error(&encoded, &error);
19366                                return Err(common::Error::JsonDecodeError(
19367                                    encoded.to_string(),
19368                                    error,
19369                                ));
19370                            }
19371                        }
19372                    };
19373
19374                    dlg.finished(true);
19375                    return Ok(response);
19376                }
19377            }
19378        }
19379    }
19380
19381    ///
19382    /// Sets the *request* property to the given value.
19383    ///
19384    /// Even though the property as already been set when instantiating this call,
19385    /// we provide this method for API completeness.
19386    pub fn request(mut self, new_value: Target) -> ProjectLocationTargetCreateCall<'a, C> {
19387        self._request = new_value;
19388        self
19389    }
19390    /// Required. The parent collection in which the `Target` should be created. Format should be `projects/{project_id}/locations/{location_name}`.
19391    ///
19392    /// Sets the *parent* path property to the given value.
19393    ///
19394    /// Even though the property as already been set when instantiating this call,
19395    /// we provide this method for API completeness.
19396    pub fn parent(mut self, new_value: &str) -> ProjectLocationTargetCreateCall<'a, C> {
19397        self._parent = new_value.to_string();
19398        self
19399    }
19400    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
19401    ///
19402    /// Sets the *validate only* query property to the given value.
19403    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTargetCreateCall<'a, C> {
19404        self._validate_only = Some(new_value);
19405        self
19406    }
19407    /// Required. ID of the `Target`.
19408    ///
19409    /// Sets the *target id* query property to the given value.
19410    pub fn target_id(mut self, new_value: &str) -> ProjectLocationTargetCreateCall<'a, C> {
19411        self._target_id = Some(new_value.to_string());
19412        self
19413    }
19414    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
19415    ///
19416    /// Sets the *request id* query property to the given value.
19417    pub fn request_id(mut self, new_value: &str) -> ProjectLocationTargetCreateCall<'a, C> {
19418        self._request_id = Some(new_value.to_string());
19419        self
19420    }
19421    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19422    /// while executing the actual API request.
19423    ///
19424    /// ````text
19425    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19426    /// ````
19427    ///
19428    /// Sets the *delegate* property to the given value.
19429    pub fn delegate(
19430        mut self,
19431        new_value: &'a mut dyn common::Delegate,
19432    ) -> ProjectLocationTargetCreateCall<'a, C> {
19433        self._delegate = Some(new_value);
19434        self
19435    }
19436
19437    /// Set any additional parameter of the query string used in the request.
19438    /// It should be used to set parameters which are not yet available through their own
19439    /// setters.
19440    ///
19441    /// Please note that this method must not be used to set any of the known parameters
19442    /// which have their own setter method. If done anyway, the request will fail.
19443    ///
19444    /// # Additional Parameters
19445    ///
19446    /// * *$.xgafv* (query-string) - V1 error format.
19447    /// * *access_token* (query-string) - OAuth access token.
19448    /// * *alt* (query-string) - Data format for response.
19449    /// * *callback* (query-string) - JSONP
19450    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19451    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19452    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19453    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19454    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19455    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19456    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19457    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetCreateCall<'a, C>
19458    where
19459        T: AsRef<str>,
19460    {
19461        self._additional_params
19462            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19463        self
19464    }
19465
19466    /// Identifies the authorization scope for the method you are building.
19467    ///
19468    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19469    /// [`Scope::CloudPlatform`].
19470    ///
19471    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19472    /// tokens for more than one scope.
19473    ///
19474    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19475    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19476    /// sufficient, a read-write scope will do as well.
19477    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetCreateCall<'a, C>
19478    where
19479        St: AsRef<str>,
19480    {
19481        self._scopes.insert(String::from(scope.as_ref()));
19482        self
19483    }
19484    /// Identifies the authorization scope(s) for the method you are building.
19485    ///
19486    /// See [`Self::add_scope()`] for details.
19487    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetCreateCall<'a, C>
19488    where
19489        I: IntoIterator<Item = St>,
19490        St: AsRef<str>,
19491    {
19492        self._scopes
19493            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19494        self
19495    }
19496
19497    /// Removes all scopes, and no default scope will be used either.
19498    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19499    /// for details).
19500    pub fn clear_scopes(mut self) -> ProjectLocationTargetCreateCall<'a, C> {
19501        self._scopes.clear();
19502        self
19503    }
19504}
19505
19506/// Deletes a single Target.
19507///
19508/// A builder for the *locations.targets.delete* method supported by a *project* resource.
19509/// It is not used directly, but through a [`ProjectMethods`] instance.
19510///
19511/// # Example
19512///
19513/// Instantiate a resource method builder
19514///
19515/// ```test_harness,no_run
19516/// # extern crate hyper;
19517/// # extern crate hyper_rustls;
19518/// # extern crate google_clouddeploy1 as clouddeploy1;
19519/// # async fn dox() {
19520/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19521///
19522/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19523/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19524/// #     secret,
19525/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19526/// # ).build().await.unwrap();
19527///
19528/// # let client = hyper_util::client::legacy::Client::builder(
19529/// #     hyper_util::rt::TokioExecutor::new()
19530/// # )
19531/// # .build(
19532/// #     hyper_rustls::HttpsConnectorBuilder::new()
19533/// #         .with_native_roots()
19534/// #         .unwrap()
19535/// #         .https_or_http()
19536/// #         .enable_http1()
19537/// #         .build()
19538/// # );
19539/// # let mut hub = CloudDeploy::new(client, auth);
19540/// // You can configure optional parameters by calling the respective setters at will, and
19541/// // execute the final call using `doit()`.
19542/// // Values shown here are possibly random and not representative !
19543/// let result = hub.projects().locations_targets_delete("name")
19544///              .validate_only(false)
19545///              .request_id("eirmod")
19546///              .etag("Lorem")
19547///              .allow_missing(true)
19548///              .doit().await;
19549/// # }
19550/// ```
19551pub struct ProjectLocationTargetDeleteCall<'a, C>
19552where
19553    C: 'a,
19554{
19555    hub: &'a CloudDeploy<C>,
19556    _name: String,
19557    _validate_only: Option<bool>,
19558    _request_id: Option<String>,
19559    _etag: Option<String>,
19560    _allow_missing: Option<bool>,
19561    _delegate: Option<&'a mut dyn common::Delegate>,
19562    _additional_params: HashMap<String, String>,
19563    _scopes: BTreeSet<String>,
19564}
19565
19566impl<'a, C> common::CallBuilder for ProjectLocationTargetDeleteCall<'a, C> {}
19567
19568impl<'a, C> ProjectLocationTargetDeleteCall<'a, C>
19569where
19570    C: common::Connector,
19571{
19572    /// Perform the operation you have build so far.
19573    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19574        use std::borrow::Cow;
19575        use std::io::{Read, Seek};
19576
19577        use common::{url::Params, ToParts};
19578        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19579
19580        let mut dd = common::DefaultDelegate;
19581        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19582        dlg.begin(common::MethodInfo {
19583            id: "clouddeploy.projects.locations.targets.delete",
19584            http_method: hyper::Method::DELETE,
19585        });
19586
19587        for &field in [
19588            "alt",
19589            "name",
19590            "validateOnly",
19591            "requestId",
19592            "etag",
19593            "allowMissing",
19594        ]
19595        .iter()
19596        {
19597            if self._additional_params.contains_key(field) {
19598                dlg.finished(false);
19599                return Err(common::Error::FieldClash(field));
19600            }
19601        }
19602
19603        let mut params = Params::with_capacity(7 + self._additional_params.len());
19604        params.push("name", self._name);
19605        if let Some(value) = self._validate_only.as_ref() {
19606            params.push("validateOnly", value.to_string());
19607        }
19608        if let Some(value) = self._request_id.as_ref() {
19609            params.push("requestId", value);
19610        }
19611        if let Some(value) = self._etag.as_ref() {
19612            params.push("etag", value);
19613        }
19614        if let Some(value) = self._allow_missing.as_ref() {
19615            params.push("allowMissing", value.to_string());
19616        }
19617
19618        params.extend(self._additional_params.iter());
19619
19620        params.push("alt", "json");
19621        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19622        if self._scopes.is_empty() {
19623            self._scopes
19624                .insert(Scope::CloudPlatform.as_ref().to_string());
19625        }
19626
19627        #[allow(clippy::single_element_loop)]
19628        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19629            url = params.uri_replacement(url, param_name, find_this, true);
19630        }
19631        {
19632            let to_remove = ["name"];
19633            params.remove_params(&to_remove);
19634        }
19635
19636        let url = params.parse_with_url(&url);
19637
19638        loop {
19639            let token = match self
19640                .hub
19641                .auth
19642                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19643                .await
19644            {
19645                Ok(token) => token,
19646                Err(e) => match dlg.token(e) {
19647                    Ok(token) => token,
19648                    Err(e) => {
19649                        dlg.finished(false);
19650                        return Err(common::Error::MissingToken(e));
19651                    }
19652                },
19653            };
19654            let mut req_result = {
19655                let client = &self.hub.client;
19656                dlg.pre_request();
19657                let mut req_builder = hyper::Request::builder()
19658                    .method(hyper::Method::DELETE)
19659                    .uri(url.as_str())
19660                    .header(USER_AGENT, self.hub._user_agent.clone());
19661
19662                if let Some(token) = token.as_ref() {
19663                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19664                }
19665
19666                let request = req_builder
19667                    .header(CONTENT_LENGTH, 0_u64)
19668                    .body(common::to_body::<String>(None));
19669
19670                client.request(request.unwrap()).await
19671            };
19672
19673            match req_result {
19674                Err(err) => {
19675                    if let common::Retry::After(d) = dlg.http_error(&err) {
19676                        sleep(d).await;
19677                        continue;
19678                    }
19679                    dlg.finished(false);
19680                    return Err(common::Error::HttpError(err));
19681                }
19682                Ok(res) => {
19683                    let (mut parts, body) = res.into_parts();
19684                    let mut body = common::Body::new(body);
19685                    if !parts.status.is_success() {
19686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19687                        let error = serde_json::from_str(&common::to_string(&bytes));
19688                        let response = common::to_response(parts, bytes.into());
19689
19690                        if let common::Retry::After(d) =
19691                            dlg.http_failure(&response, error.as_ref().ok())
19692                        {
19693                            sleep(d).await;
19694                            continue;
19695                        }
19696
19697                        dlg.finished(false);
19698
19699                        return Err(match error {
19700                            Ok(value) => common::Error::BadRequest(value),
19701                            _ => common::Error::Failure(response),
19702                        });
19703                    }
19704                    let response = {
19705                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19706                        let encoded = common::to_string(&bytes);
19707                        match serde_json::from_str(&encoded) {
19708                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19709                            Err(error) => {
19710                                dlg.response_json_decode_error(&encoded, &error);
19711                                return Err(common::Error::JsonDecodeError(
19712                                    encoded.to_string(),
19713                                    error,
19714                                ));
19715                            }
19716                        }
19717                    };
19718
19719                    dlg.finished(true);
19720                    return Ok(response);
19721                }
19722            }
19723        }
19724    }
19725
19726    /// Required. The name of the `Target` to delete. Format should be `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
19727    ///
19728    /// Sets the *name* path property to the given value.
19729    ///
19730    /// Even though the property as already been set when instantiating this call,
19731    /// we provide this method for API completeness.
19732    pub fn name(mut self, new_value: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
19733        self._name = new_value.to_string();
19734        self
19735    }
19736    /// Optional. If set, validate the request and preview the review, but do not actually post it.
19737    ///
19738    /// Sets the *validate only* query property to the given value.
19739    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTargetDeleteCall<'a, C> {
19740        self._validate_only = Some(new_value);
19741        self
19742    }
19743    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
19744    ///
19745    /// Sets the *request id* query property to the given value.
19746    pub fn request_id(mut self, new_value: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
19747        self._request_id = Some(new_value.to_string());
19748        self
19749    }
19750    /// Optional. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
19751    ///
19752    /// Sets the *etag* query property to the given value.
19753    pub fn etag(mut self, new_value: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
19754        self._etag = Some(new_value.to_string());
19755        self
19756    }
19757    /// Optional. If set to true, then deleting an already deleted or non-existing `Target` will succeed.
19758    ///
19759    /// Sets the *allow missing* query property to the given value.
19760    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationTargetDeleteCall<'a, C> {
19761        self._allow_missing = Some(new_value);
19762        self
19763    }
19764    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19765    /// while executing the actual API request.
19766    ///
19767    /// ````text
19768    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19769    /// ````
19770    ///
19771    /// Sets the *delegate* property to the given value.
19772    pub fn delegate(
19773        mut self,
19774        new_value: &'a mut dyn common::Delegate,
19775    ) -> ProjectLocationTargetDeleteCall<'a, C> {
19776        self._delegate = Some(new_value);
19777        self
19778    }
19779
19780    /// Set any additional parameter of the query string used in the request.
19781    /// It should be used to set parameters which are not yet available through their own
19782    /// setters.
19783    ///
19784    /// Please note that this method must not be used to set any of the known parameters
19785    /// which have their own setter method. If done anyway, the request will fail.
19786    ///
19787    /// # Additional Parameters
19788    ///
19789    /// * *$.xgafv* (query-string) - V1 error format.
19790    /// * *access_token* (query-string) - OAuth access token.
19791    /// * *alt* (query-string) - Data format for response.
19792    /// * *callback* (query-string) - JSONP
19793    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19794    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
19795    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19796    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19797    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
19798    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19799    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19800    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetDeleteCall<'a, C>
19801    where
19802        T: AsRef<str>,
19803    {
19804        self._additional_params
19805            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19806        self
19807    }
19808
19809    /// Identifies the authorization scope for the method you are building.
19810    ///
19811    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19812    /// [`Scope::CloudPlatform`].
19813    ///
19814    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19815    /// tokens for more than one scope.
19816    ///
19817    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19818    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19819    /// sufficient, a read-write scope will do as well.
19820    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetDeleteCall<'a, C>
19821    where
19822        St: AsRef<str>,
19823    {
19824        self._scopes.insert(String::from(scope.as_ref()));
19825        self
19826    }
19827    /// Identifies the authorization scope(s) for the method you are building.
19828    ///
19829    /// See [`Self::add_scope()`] for details.
19830    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetDeleteCall<'a, C>
19831    where
19832        I: IntoIterator<Item = St>,
19833        St: AsRef<str>,
19834    {
19835        self._scopes
19836            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19837        self
19838    }
19839
19840    /// Removes all scopes, and no default scope will be used either.
19841    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19842    /// for details).
19843    pub fn clear_scopes(mut self) -> ProjectLocationTargetDeleteCall<'a, C> {
19844        self._scopes.clear();
19845        self
19846    }
19847}
19848
19849/// Gets details of a single Target.
19850///
19851/// A builder for the *locations.targets.get* method supported by a *project* resource.
19852/// It is not used directly, but through a [`ProjectMethods`] instance.
19853///
19854/// # Example
19855///
19856/// Instantiate a resource method builder
19857///
19858/// ```test_harness,no_run
19859/// # extern crate hyper;
19860/// # extern crate hyper_rustls;
19861/// # extern crate google_clouddeploy1 as clouddeploy1;
19862/// # async fn dox() {
19863/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19864///
19865/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19866/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19867/// #     secret,
19868/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19869/// # ).build().await.unwrap();
19870///
19871/// # let client = hyper_util::client::legacy::Client::builder(
19872/// #     hyper_util::rt::TokioExecutor::new()
19873/// # )
19874/// # .build(
19875/// #     hyper_rustls::HttpsConnectorBuilder::new()
19876/// #         .with_native_roots()
19877/// #         .unwrap()
19878/// #         .https_or_http()
19879/// #         .enable_http1()
19880/// #         .build()
19881/// # );
19882/// # let mut hub = CloudDeploy::new(client, auth);
19883/// // You can configure optional parameters by calling the respective setters at will, and
19884/// // execute the final call using `doit()`.
19885/// // Values shown here are possibly random and not representative !
19886/// let result = hub.projects().locations_targets_get("name")
19887///              .doit().await;
19888/// # }
19889/// ```
19890pub struct ProjectLocationTargetGetCall<'a, C>
19891where
19892    C: 'a,
19893{
19894    hub: &'a CloudDeploy<C>,
19895    _name: String,
19896    _delegate: Option<&'a mut dyn common::Delegate>,
19897    _additional_params: HashMap<String, String>,
19898    _scopes: BTreeSet<String>,
19899}
19900
19901impl<'a, C> common::CallBuilder for ProjectLocationTargetGetCall<'a, C> {}
19902
19903impl<'a, C> ProjectLocationTargetGetCall<'a, C>
19904where
19905    C: common::Connector,
19906{
19907    /// Perform the operation you have build so far.
19908    pub async fn doit(mut self) -> common::Result<(common::Response, Target)> {
19909        use std::borrow::Cow;
19910        use std::io::{Read, Seek};
19911
19912        use common::{url::Params, ToParts};
19913        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19914
19915        let mut dd = common::DefaultDelegate;
19916        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19917        dlg.begin(common::MethodInfo {
19918            id: "clouddeploy.projects.locations.targets.get",
19919            http_method: hyper::Method::GET,
19920        });
19921
19922        for &field in ["alt", "name"].iter() {
19923            if self._additional_params.contains_key(field) {
19924                dlg.finished(false);
19925                return Err(common::Error::FieldClash(field));
19926            }
19927        }
19928
19929        let mut params = Params::with_capacity(3 + self._additional_params.len());
19930        params.push("name", self._name);
19931
19932        params.extend(self._additional_params.iter());
19933
19934        params.push("alt", "json");
19935        let mut url = self.hub._base_url.clone() + "v1/{+name}";
19936        if self._scopes.is_empty() {
19937            self._scopes
19938                .insert(Scope::CloudPlatform.as_ref().to_string());
19939        }
19940
19941        #[allow(clippy::single_element_loop)]
19942        for &(find_this, param_name) in [("{+name}", "name")].iter() {
19943            url = params.uri_replacement(url, param_name, find_this, true);
19944        }
19945        {
19946            let to_remove = ["name"];
19947            params.remove_params(&to_remove);
19948        }
19949
19950        let url = params.parse_with_url(&url);
19951
19952        loop {
19953            let token = match self
19954                .hub
19955                .auth
19956                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19957                .await
19958            {
19959                Ok(token) => token,
19960                Err(e) => match dlg.token(e) {
19961                    Ok(token) => token,
19962                    Err(e) => {
19963                        dlg.finished(false);
19964                        return Err(common::Error::MissingToken(e));
19965                    }
19966                },
19967            };
19968            let mut req_result = {
19969                let client = &self.hub.client;
19970                dlg.pre_request();
19971                let mut req_builder = hyper::Request::builder()
19972                    .method(hyper::Method::GET)
19973                    .uri(url.as_str())
19974                    .header(USER_AGENT, self.hub._user_agent.clone());
19975
19976                if let Some(token) = token.as_ref() {
19977                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19978                }
19979
19980                let request = req_builder
19981                    .header(CONTENT_LENGTH, 0_u64)
19982                    .body(common::to_body::<String>(None));
19983
19984                client.request(request.unwrap()).await
19985            };
19986
19987            match req_result {
19988                Err(err) => {
19989                    if let common::Retry::After(d) = dlg.http_error(&err) {
19990                        sleep(d).await;
19991                        continue;
19992                    }
19993                    dlg.finished(false);
19994                    return Err(common::Error::HttpError(err));
19995                }
19996                Ok(res) => {
19997                    let (mut parts, body) = res.into_parts();
19998                    let mut body = common::Body::new(body);
19999                    if !parts.status.is_success() {
20000                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20001                        let error = serde_json::from_str(&common::to_string(&bytes));
20002                        let response = common::to_response(parts, bytes.into());
20003
20004                        if let common::Retry::After(d) =
20005                            dlg.http_failure(&response, error.as_ref().ok())
20006                        {
20007                            sleep(d).await;
20008                            continue;
20009                        }
20010
20011                        dlg.finished(false);
20012
20013                        return Err(match error {
20014                            Ok(value) => common::Error::BadRequest(value),
20015                            _ => common::Error::Failure(response),
20016                        });
20017                    }
20018                    let response = {
20019                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20020                        let encoded = common::to_string(&bytes);
20021                        match serde_json::from_str(&encoded) {
20022                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20023                            Err(error) => {
20024                                dlg.response_json_decode_error(&encoded, &error);
20025                                return Err(common::Error::JsonDecodeError(
20026                                    encoded.to_string(),
20027                                    error,
20028                                ));
20029                            }
20030                        }
20031                    };
20032
20033                    dlg.finished(true);
20034                    return Ok(response);
20035                }
20036            }
20037        }
20038    }
20039
20040    /// Required. Name of the `Target`. Format must be `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
20041    ///
20042    /// Sets the *name* path property to the given value.
20043    ///
20044    /// Even though the property as already been set when instantiating this call,
20045    /// we provide this method for API completeness.
20046    pub fn name(mut self, new_value: &str) -> ProjectLocationTargetGetCall<'a, C> {
20047        self._name = new_value.to_string();
20048        self
20049    }
20050    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20051    /// while executing the actual API request.
20052    ///
20053    /// ````text
20054    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20055    /// ````
20056    ///
20057    /// Sets the *delegate* property to the given value.
20058    pub fn delegate(
20059        mut self,
20060        new_value: &'a mut dyn common::Delegate,
20061    ) -> ProjectLocationTargetGetCall<'a, C> {
20062        self._delegate = Some(new_value);
20063        self
20064    }
20065
20066    /// Set any additional parameter of the query string used in the request.
20067    /// It should be used to set parameters which are not yet available through their own
20068    /// setters.
20069    ///
20070    /// Please note that this method must not be used to set any of the known parameters
20071    /// which have their own setter method. If done anyway, the request will fail.
20072    ///
20073    /// # Additional Parameters
20074    ///
20075    /// * *$.xgafv* (query-string) - V1 error format.
20076    /// * *access_token* (query-string) - OAuth access token.
20077    /// * *alt* (query-string) - Data format for response.
20078    /// * *callback* (query-string) - JSONP
20079    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20080    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20081    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20082    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20083    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20084    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20085    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20086    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetGetCall<'a, C>
20087    where
20088        T: AsRef<str>,
20089    {
20090        self._additional_params
20091            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20092        self
20093    }
20094
20095    /// Identifies the authorization scope for the method you are building.
20096    ///
20097    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20098    /// [`Scope::CloudPlatform`].
20099    ///
20100    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20101    /// tokens for more than one scope.
20102    ///
20103    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20104    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20105    /// sufficient, a read-write scope will do as well.
20106    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetGetCall<'a, C>
20107    where
20108        St: AsRef<str>,
20109    {
20110        self._scopes.insert(String::from(scope.as_ref()));
20111        self
20112    }
20113    /// Identifies the authorization scope(s) for the method you are building.
20114    ///
20115    /// See [`Self::add_scope()`] for details.
20116    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetGetCall<'a, C>
20117    where
20118        I: IntoIterator<Item = St>,
20119        St: AsRef<str>,
20120    {
20121        self._scopes
20122            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20123        self
20124    }
20125
20126    /// Removes all scopes, and no default scope will be used either.
20127    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20128    /// for details).
20129    pub fn clear_scopes(mut self) -> ProjectLocationTargetGetCall<'a, C> {
20130        self._scopes.clear();
20131        self
20132    }
20133}
20134
20135/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
20136///
20137/// A builder for the *locations.targets.getIamPolicy* method supported by a *project* resource.
20138/// It is not used directly, but through a [`ProjectMethods`] instance.
20139///
20140/// # Example
20141///
20142/// Instantiate a resource method builder
20143///
20144/// ```test_harness,no_run
20145/// # extern crate hyper;
20146/// # extern crate hyper_rustls;
20147/// # extern crate google_clouddeploy1 as clouddeploy1;
20148/// # async fn dox() {
20149/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20150///
20151/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20152/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20153/// #     secret,
20154/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20155/// # ).build().await.unwrap();
20156///
20157/// # let client = hyper_util::client::legacy::Client::builder(
20158/// #     hyper_util::rt::TokioExecutor::new()
20159/// # )
20160/// # .build(
20161/// #     hyper_rustls::HttpsConnectorBuilder::new()
20162/// #         .with_native_roots()
20163/// #         .unwrap()
20164/// #         .https_or_http()
20165/// #         .enable_http1()
20166/// #         .build()
20167/// # );
20168/// # let mut hub = CloudDeploy::new(client, auth);
20169/// // You can configure optional parameters by calling the respective setters at will, and
20170/// // execute the final call using `doit()`.
20171/// // Values shown here are possibly random and not representative !
20172/// let result = hub.projects().locations_targets_get_iam_policy("resource")
20173///              .options_requested_policy_version(-81)
20174///              .doit().await;
20175/// # }
20176/// ```
20177pub struct ProjectLocationTargetGetIamPolicyCall<'a, C>
20178where
20179    C: 'a,
20180{
20181    hub: &'a CloudDeploy<C>,
20182    _resource: String,
20183    _options_requested_policy_version: Option<i32>,
20184    _delegate: Option<&'a mut dyn common::Delegate>,
20185    _additional_params: HashMap<String, String>,
20186    _scopes: BTreeSet<String>,
20187}
20188
20189impl<'a, C> common::CallBuilder for ProjectLocationTargetGetIamPolicyCall<'a, C> {}
20190
20191impl<'a, C> ProjectLocationTargetGetIamPolicyCall<'a, C>
20192where
20193    C: common::Connector,
20194{
20195    /// Perform the operation you have build so far.
20196    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
20197        use std::borrow::Cow;
20198        use std::io::{Read, Seek};
20199
20200        use common::{url::Params, ToParts};
20201        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20202
20203        let mut dd = common::DefaultDelegate;
20204        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20205        dlg.begin(common::MethodInfo {
20206            id: "clouddeploy.projects.locations.targets.getIamPolicy",
20207            http_method: hyper::Method::GET,
20208        });
20209
20210        for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
20211            if self._additional_params.contains_key(field) {
20212                dlg.finished(false);
20213                return Err(common::Error::FieldClash(field));
20214            }
20215        }
20216
20217        let mut params = Params::with_capacity(4 + self._additional_params.len());
20218        params.push("resource", self._resource);
20219        if let Some(value) = self._options_requested_policy_version.as_ref() {
20220            params.push("options.requestedPolicyVersion", value.to_string());
20221        }
20222
20223        params.extend(self._additional_params.iter());
20224
20225        params.push("alt", "json");
20226        let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
20227        if self._scopes.is_empty() {
20228            self._scopes
20229                .insert(Scope::CloudPlatform.as_ref().to_string());
20230        }
20231
20232        #[allow(clippy::single_element_loop)]
20233        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20234            url = params.uri_replacement(url, param_name, find_this, true);
20235        }
20236        {
20237            let to_remove = ["resource"];
20238            params.remove_params(&to_remove);
20239        }
20240
20241        let url = params.parse_with_url(&url);
20242
20243        loop {
20244            let token = match self
20245                .hub
20246                .auth
20247                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20248                .await
20249            {
20250                Ok(token) => token,
20251                Err(e) => match dlg.token(e) {
20252                    Ok(token) => token,
20253                    Err(e) => {
20254                        dlg.finished(false);
20255                        return Err(common::Error::MissingToken(e));
20256                    }
20257                },
20258            };
20259            let mut req_result = {
20260                let client = &self.hub.client;
20261                dlg.pre_request();
20262                let mut req_builder = hyper::Request::builder()
20263                    .method(hyper::Method::GET)
20264                    .uri(url.as_str())
20265                    .header(USER_AGENT, self.hub._user_agent.clone());
20266
20267                if let Some(token) = token.as_ref() {
20268                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20269                }
20270
20271                let request = req_builder
20272                    .header(CONTENT_LENGTH, 0_u64)
20273                    .body(common::to_body::<String>(None));
20274
20275                client.request(request.unwrap()).await
20276            };
20277
20278            match req_result {
20279                Err(err) => {
20280                    if let common::Retry::After(d) = dlg.http_error(&err) {
20281                        sleep(d).await;
20282                        continue;
20283                    }
20284                    dlg.finished(false);
20285                    return Err(common::Error::HttpError(err));
20286                }
20287                Ok(res) => {
20288                    let (mut parts, body) = res.into_parts();
20289                    let mut body = common::Body::new(body);
20290                    if !parts.status.is_success() {
20291                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20292                        let error = serde_json::from_str(&common::to_string(&bytes));
20293                        let response = common::to_response(parts, bytes.into());
20294
20295                        if let common::Retry::After(d) =
20296                            dlg.http_failure(&response, error.as_ref().ok())
20297                        {
20298                            sleep(d).await;
20299                            continue;
20300                        }
20301
20302                        dlg.finished(false);
20303
20304                        return Err(match error {
20305                            Ok(value) => common::Error::BadRequest(value),
20306                            _ => common::Error::Failure(response),
20307                        });
20308                    }
20309                    let response = {
20310                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20311                        let encoded = common::to_string(&bytes);
20312                        match serde_json::from_str(&encoded) {
20313                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20314                            Err(error) => {
20315                                dlg.response_json_decode_error(&encoded, &error);
20316                                return Err(common::Error::JsonDecodeError(
20317                                    encoded.to_string(),
20318                                    error,
20319                                ));
20320                            }
20321                        }
20322                    };
20323
20324                    dlg.finished(true);
20325                    return Ok(response);
20326                }
20327            }
20328        }
20329    }
20330
20331    /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
20332    ///
20333    /// Sets the *resource* path property to the given value.
20334    ///
20335    /// Even though the property as already been set when instantiating this call,
20336    /// we provide this method for API completeness.
20337    pub fn resource(mut self, new_value: &str) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
20338        self._resource = new_value.to_string();
20339        self
20340    }
20341    /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
20342    ///
20343    /// Sets the *options.requested policy version* query property to the given value.
20344    pub fn options_requested_policy_version(
20345        mut self,
20346        new_value: i32,
20347    ) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
20348        self._options_requested_policy_version = Some(new_value);
20349        self
20350    }
20351    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20352    /// while executing the actual API request.
20353    ///
20354    /// ````text
20355    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20356    /// ````
20357    ///
20358    /// Sets the *delegate* property to the given value.
20359    pub fn delegate(
20360        mut self,
20361        new_value: &'a mut dyn common::Delegate,
20362    ) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
20363        self._delegate = Some(new_value);
20364        self
20365    }
20366
20367    /// Set any additional parameter of the query string used in the request.
20368    /// It should be used to set parameters which are not yet available through their own
20369    /// setters.
20370    ///
20371    /// Please note that this method must not be used to set any of the known parameters
20372    /// which have their own setter method. If done anyway, the request will fail.
20373    ///
20374    /// # Additional Parameters
20375    ///
20376    /// * *$.xgafv* (query-string) - V1 error format.
20377    /// * *access_token* (query-string) - OAuth access token.
20378    /// * *alt* (query-string) - Data format for response.
20379    /// * *callback* (query-string) - JSONP
20380    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20381    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20382    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20383    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20384    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20385    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20386    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20387    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetGetIamPolicyCall<'a, C>
20388    where
20389        T: AsRef<str>,
20390    {
20391        self._additional_params
20392            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20393        self
20394    }
20395
20396    /// Identifies the authorization scope for the method you are building.
20397    ///
20398    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20399    /// [`Scope::CloudPlatform`].
20400    ///
20401    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20402    /// tokens for more than one scope.
20403    ///
20404    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20405    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20406    /// sufficient, a read-write scope will do as well.
20407    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetGetIamPolicyCall<'a, C>
20408    where
20409        St: AsRef<str>,
20410    {
20411        self._scopes.insert(String::from(scope.as_ref()));
20412        self
20413    }
20414    /// Identifies the authorization scope(s) for the method you are building.
20415    ///
20416    /// See [`Self::add_scope()`] for details.
20417    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetGetIamPolicyCall<'a, C>
20418    where
20419        I: IntoIterator<Item = St>,
20420        St: AsRef<str>,
20421    {
20422        self._scopes
20423            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20424        self
20425    }
20426
20427    /// Removes all scopes, and no default scope will be used either.
20428    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20429    /// for details).
20430    pub fn clear_scopes(mut self) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
20431        self._scopes.clear();
20432        self
20433    }
20434}
20435
20436/// Lists Targets in a given project and location.
20437///
20438/// A builder for the *locations.targets.list* method supported by a *project* resource.
20439/// It is not used directly, but through a [`ProjectMethods`] instance.
20440///
20441/// # Example
20442///
20443/// Instantiate a resource method builder
20444///
20445/// ```test_harness,no_run
20446/// # extern crate hyper;
20447/// # extern crate hyper_rustls;
20448/// # extern crate google_clouddeploy1 as clouddeploy1;
20449/// # async fn dox() {
20450/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20451///
20452/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20453/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20454/// #     secret,
20455/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20456/// # ).build().await.unwrap();
20457///
20458/// # let client = hyper_util::client::legacy::Client::builder(
20459/// #     hyper_util::rt::TokioExecutor::new()
20460/// # )
20461/// # .build(
20462/// #     hyper_rustls::HttpsConnectorBuilder::new()
20463/// #         .with_native_roots()
20464/// #         .unwrap()
20465/// #         .https_or_http()
20466/// #         .enable_http1()
20467/// #         .build()
20468/// # );
20469/// # let mut hub = CloudDeploy::new(client, auth);
20470/// // You can configure optional parameters by calling the respective setters at will, and
20471/// // execute the final call using `doit()`.
20472/// // Values shown here are possibly random and not representative !
20473/// let result = hub.projects().locations_targets_list("parent")
20474///              .page_token("sea")
20475///              .page_size(-59)
20476///              .order_by("Lorem")
20477///              .filter("et")
20478///              .doit().await;
20479/// # }
20480/// ```
20481pub struct ProjectLocationTargetListCall<'a, C>
20482where
20483    C: 'a,
20484{
20485    hub: &'a CloudDeploy<C>,
20486    _parent: String,
20487    _page_token: Option<String>,
20488    _page_size: Option<i32>,
20489    _order_by: Option<String>,
20490    _filter: Option<String>,
20491    _delegate: Option<&'a mut dyn common::Delegate>,
20492    _additional_params: HashMap<String, String>,
20493    _scopes: BTreeSet<String>,
20494}
20495
20496impl<'a, C> common::CallBuilder for ProjectLocationTargetListCall<'a, C> {}
20497
20498impl<'a, C> ProjectLocationTargetListCall<'a, C>
20499where
20500    C: common::Connector,
20501{
20502    /// Perform the operation you have build so far.
20503    pub async fn doit(mut self) -> common::Result<(common::Response, ListTargetsResponse)> {
20504        use std::borrow::Cow;
20505        use std::io::{Read, Seek};
20506
20507        use common::{url::Params, ToParts};
20508        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20509
20510        let mut dd = common::DefaultDelegate;
20511        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20512        dlg.begin(common::MethodInfo {
20513            id: "clouddeploy.projects.locations.targets.list",
20514            http_method: hyper::Method::GET,
20515        });
20516
20517        for &field in [
20518            "alt",
20519            "parent",
20520            "pageToken",
20521            "pageSize",
20522            "orderBy",
20523            "filter",
20524        ]
20525        .iter()
20526        {
20527            if self._additional_params.contains_key(field) {
20528                dlg.finished(false);
20529                return Err(common::Error::FieldClash(field));
20530            }
20531        }
20532
20533        let mut params = Params::with_capacity(7 + self._additional_params.len());
20534        params.push("parent", self._parent);
20535        if let Some(value) = self._page_token.as_ref() {
20536            params.push("pageToken", value);
20537        }
20538        if let Some(value) = self._page_size.as_ref() {
20539            params.push("pageSize", value.to_string());
20540        }
20541        if let Some(value) = self._order_by.as_ref() {
20542            params.push("orderBy", value);
20543        }
20544        if let Some(value) = self._filter.as_ref() {
20545            params.push("filter", value);
20546        }
20547
20548        params.extend(self._additional_params.iter());
20549
20550        params.push("alt", "json");
20551        let mut url = self.hub._base_url.clone() + "v1/{+parent}/targets";
20552        if self._scopes.is_empty() {
20553            self._scopes
20554                .insert(Scope::CloudPlatform.as_ref().to_string());
20555        }
20556
20557        #[allow(clippy::single_element_loop)]
20558        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20559            url = params.uri_replacement(url, param_name, find_this, true);
20560        }
20561        {
20562            let to_remove = ["parent"];
20563            params.remove_params(&to_remove);
20564        }
20565
20566        let url = params.parse_with_url(&url);
20567
20568        loop {
20569            let token = match self
20570                .hub
20571                .auth
20572                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20573                .await
20574            {
20575                Ok(token) => token,
20576                Err(e) => match dlg.token(e) {
20577                    Ok(token) => token,
20578                    Err(e) => {
20579                        dlg.finished(false);
20580                        return Err(common::Error::MissingToken(e));
20581                    }
20582                },
20583            };
20584            let mut req_result = {
20585                let client = &self.hub.client;
20586                dlg.pre_request();
20587                let mut req_builder = hyper::Request::builder()
20588                    .method(hyper::Method::GET)
20589                    .uri(url.as_str())
20590                    .header(USER_AGENT, self.hub._user_agent.clone());
20591
20592                if let Some(token) = token.as_ref() {
20593                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20594                }
20595
20596                let request = req_builder
20597                    .header(CONTENT_LENGTH, 0_u64)
20598                    .body(common::to_body::<String>(None));
20599
20600                client.request(request.unwrap()).await
20601            };
20602
20603            match req_result {
20604                Err(err) => {
20605                    if let common::Retry::After(d) = dlg.http_error(&err) {
20606                        sleep(d).await;
20607                        continue;
20608                    }
20609                    dlg.finished(false);
20610                    return Err(common::Error::HttpError(err));
20611                }
20612                Ok(res) => {
20613                    let (mut parts, body) = res.into_parts();
20614                    let mut body = common::Body::new(body);
20615                    if !parts.status.is_success() {
20616                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20617                        let error = serde_json::from_str(&common::to_string(&bytes));
20618                        let response = common::to_response(parts, bytes.into());
20619
20620                        if let common::Retry::After(d) =
20621                            dlg.http_failure(&response, error.as_ref().ok())
20622                        {
20623                            sleep(d).await;
20624                            continue;
20625                        }
20626
20627                        dlg.finished(false);
20628
20629                        return Err(match error {
20630                            Ok(value) => common::Error::BadRequest(value),
20631                            _ => common::Error::Failure(response),
20632                        });
20633                    }
20634                    let response = {
20635                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20636                        let encoded = common::to_string(&bytes);
20637                        match serde_json::from_str(&encoded) {
20638                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20639                            Err(error) => {
20640                                dlg.response_json_decode_error(&encoded, &error);
20641                                return Err(common::Error::JsonDecodeError(
20642                                    encoded.to_string(),
20643                                    error,
20644                                ));
20645                            }
20646                        }
20647                    };
20648
20649                    dlg.finished(true);
20650                    return Ok(response);
20651                }
20652            }
20653        }
20654    }
20655
20656    /// Required. The parent, which owns this collection of targets. Format must be `projects/{project_id}/locations/{location_name}`.
20657    ///
20658    /// Sets the *parent* path property to the given value.
20659    ///
20660    /// Even though the property as already been set when instantiating this call,
20661    /// we provide this method for API completeness.
20662    pub fn parent(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
20663        self._parent = new_value.to_string();
20664        self
20665    }
20666    /// Optional. A page token, received from a previous `ListTargets` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
20667    ///
20668    /// Sets the *page token* query property to the given value.
20669    pub fn page_token(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
20670        self._page_token = Some(new_value.to_string());
20671        self
20672    }
20673    /// Optional. The maximum number of `Target` objects to return. The service may return fewer than this value. If unspecified, at most 50 `Target` objects will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
20674    ///
20675    /// Sets the *page size* query property to the given value.
20676    pub fn page_size(mut self, new_value: i32) -> ProjectLocationTargetListCall<'a, C> {
20677        self._page_size = Some(new_value);
20678        self
20679    }
20680    /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
20681    ///
20682    /// Sets the *order by* query property to the given value.
20683    pub fn order_by(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
20684        self._order_by = Some(new_value.to_string());
20685        self
20686    }
20687    /// Optional. Filter targets to be returned. See https://google.aip.dev/160 for more details.
20688    ///
20689    /// Sets the *filter* query property to the given value.
20690    pub fn filter(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
20691        self._filter = Some(new_value.to_string());
20692        self
20693    }
20694    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20695    /// while executing the actual API request.
20696    ///
20697    /// ````text
20698    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20699    /// ````
20700    ///
20701    /// Sets the *delegate* property to the given value.
20702    pub fn delegate(
20703        mut self,
20704        new_value: &'a mut dyn common::Delegate,
20705    ) -> ProjectLocationTargetListCall<'a, C> {
20706        self._delegate = Some(new_value);
20707        self
20708    }
20709
20710    /// Set any additional parameter of the query string used in the request.
20711    /// It should be used to set parameters which are not yet available through their own
20712    /// setters.
20713    ///
20714    /// Please note that this method must not be used to set any of the known parameters
20715    /// which have their own setter method. If done anyway, the request will fail.
20716    ///
20717    /// # Additional Parameters
20718    ///
20719    /// * *$.xgafv* (query-string) - V1 error format.
20720    /// * *access_token* (query-string) - OAuth access token.
20721    /// * *alt* (query-string) - Data format for response.
20722    /// * *callback* (query-string) - JSONP
20723    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20724    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
20725    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20726    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20727    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
20728    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20729    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20730    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetListCall<'a, C>
20731    where
20732        T: AsRef<str>,
20733    {
20734        self._additional_params
20735            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20736        self
20737    }
20738
20739    /// Identifies the authorization scope for the method you are building.
20740    ///
20741    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20742    /// [`Scope::CloudPlatform`].
20743    ///
20744    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20745    /// tokens for more than one scope.
20746    ///
20747    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20748    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20749    /// sufficient, a read-write scope will do as well.
20750    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetListCall<'a, C>
20751    where
20752        St: AsRef<str>,
20753    {
20754        self._scopes.insert(String::from(scope.as_ref()));
20755        self
20756    }
20757    /// Identifies the authorization scope(s) for the method you are building.
20758    ///
20759    /// See [`Self::add_scope()`] for details.
20760    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetListCall<'a, C>
20761    where
20762        I: IntoIterator<Item = St>,
20763        St: AsRef<str>,
20764    {
20765        self._scopes
20766            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20767        self
20768    }
20769
20770    /// Removes all scopes, and no default scope will be used either.
20771    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20772    /// for details).
20773    pub fn clear_scopes(mut self) -> ProjectLocationTargetListCall<'a, C> {
20774        self._scopes.clear();
20775        self
20776    }
20777}
20778
20779/// Updates the parameters of a single Target.
20780///
20781/// A builder for the *locations.targets.patch* method supported by a *project* resource.
20782/// It is not used directly, but through a [`ProjectMethods`] instance.
20783///
20784/// # Example
20785///
20786/// Instantiate a resource method builder
20787///
20788/// ```test_harness,no_run
20789/// # extern crate hyper;
20790/// # extern crate hyper_rustls;
20791/// # extern crate google_clouddeploy1 as clouddeploy1;
20792/// use clouddeploy1::api::Target;
20793/// # async fn dox() {
20794/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20795///
20796/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20797/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20798/// #     secret,
20799/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20800/// # ).build().await.unwrap();
20801///
20802/// # let client = hyper_util::client::legacy::Client::builder(
20803/// #     hyper_util::rt::TokioExecutor::new()
20804/// # )
20805/// # .build(
20806/// #     hyper_rustls::HttpsConnectorBuilder::new()
20807/// #         .with_native_roots()
20808/// #         .unwrap()
20809/// #         .https_or_http()
20810/// #         .enable_http1()
20811/// #         .build()
20812/// # );
20813/// # let mut hub = CloudDeploy::new(client, auth);
20814/// // As the method needs a request, you would usually fill it with the desired information
20815/// // into the respective structure. Some of the parts shown here might not be applicable !
20816/// // Values shown here are possibly random and not representative !
20817/// let mut req = Target::default();
20818///
20819/// // You can configure optional parameters by calling the respective setters at will, and
20820/// // execute the final call using `doit()`.
20821/// // Values shown here are possibly random and not representative !
20822/// let result = hub.projects().locations_targets_patch(req, "name")
20823///              .validate_only(true)
20824///              .update_mask(FieldMask::new::<&str>(&[]))
20825///              .request_id("erat")
20826///              .allow_missing(true)
20827///              .doit().await;
20828/// # }
20829/// ```
20830pub struct ProjectLocationTargetPatchCall<'a, C>
20831where
20832    C: 'a,
20833{
20834    hub: &'a CloudDeploy<C>,
20835    _request: Target,
20836    _name: String,
20837    _validate_only: Option<bool>,
20838    _update_mask: Option<common::FieldMask>,
20839    _request_id: Option<String>,
20840    _allow_missing: Option<bool>,
20841    _delegate: Option<&'a mut dyn common::Delegate>,
20842    _additional_params: HashMap<String, String>,
20843    _scopes: BTreeSet<String>,
20844}
20845
20846impl<'a, C> common::CallBuilder for ProjectLocationTargetPatchCall<'a, C> {}
20847
20848impl<'a, C> ProjectLocationTargetPatchCall<'a, C>
20849where
20850    C: common::Connector,
20851{
20852    /// Perform the operation you have build so far.
20853    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20854        use std::borrow::Cow;
20855        use std::io::{Read, Seek};
20856
20857        use common::{url::Params, ToParts};
20858        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20859
20860        let mut dd = common::DefaultDelegate;
20861        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20862        dlg.begin(common::MethodInfo {
20863            id: "clouddeploy.projects.locations.targets.patch",
20864            http_method: hyper::Method::PATCH,
20865        });
20866
20867        for &field in [
20868            "alt",
20869            "name",
20870            "validateOnly",
20871            "updateMask",
20872            "requestId",
20873            "allowMissing",
20874        ]
20875        .iter()
20876        {
20877            if self._additional_params.contains_key(field) {
20878                dlg.finished(false);
20879                return Err(common::Error::FieldClash(field));
20880            }
20881        }
20882
20883        let mut params = Params::with_capacity(8 + self._additional_params.len());
20884        params.push("name", self._name);
20885        if let Some(value) = self._validate_only.as_ref() {
20886            params.push("validateOnly", value.to_string());
20887        }
20888        if let Some(value) = self._update_mask.as_ref() {
20889            params.push("updateMask", value.to_string());
20890        }
20891        if let Some(value) = self._request_id.as_ref() {
20892            params.push("requestId", value);
20893        }
20894        if let Some(value) = self._allow_missing.as_ref() {
20895            params.push("allowMissing", value.to_string());
20896        }
20897
20898        params.extend(self._additional_params.iter());
20899
20900        params.push("alt", "json");
20901        let mut url = self.hub._base_url.clone() + "v1/{+name}";
20902        if self._scopes.is_empty() {
20903            self._scopes
20904                .insert(Scope::CloudPlatform.as_ref().to_string());
20905        }
20906
20907        #[allow(clippy::single_element_loop)]
20908        for &(find_this, param_name) in [("{+name}", "name")].iter() {
20909            url = params.uri_replacement(url, param_name, find_this, true);
20910        }
20911        {
20912            let to_remove = ["name"];
20913            params.remove_params(&to_remove);
20914        }
20915
20916        let url = params.parse_with_url(&url);
20917
20918        let mut json_mime_type = mime::APPLICATION_JSON;
20919        let mut request_value_reader = {
20920            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20921            common::remove_json_null_values(&mut value);
20922            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20923            serde_json::to_writer(&mut dst, &value).unwrap();
20924            dst
20925        };
20926        let request_size = request_value_reader
20927            .seek(std::io::SeekFrom::End(0))
20928            .unwrap();
20929        request_value_reader
20930            .seek(std::io::SeekFrom::Start(0))
20931            .unwrap();
20932
20933        loop {
20934            let token = match self
20935                .hub
20936                .auth
20937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20938                .await
20939            {
20940                Ok(token) => token,
20941                Err(e) => match dlg.token(e) {
20942                    Ok(token) => token,
20943                    Err(e) => {
20944                        dlg.finished(false);
20945                        return Err(common::Error::MissingToken(e));
20946                    }
20947                },
20948            };
20949            request_value_reader
20950                .seek(std::io::SeekFrom::Start(0))
20951                .unwrap();
20952            let mut req_result = {
20953                let client = &self.hub.client;
20954                dlg.pre_request();
20955                let mut req_builder = hyper::Request::builder()
20956                    .method(hyper::Method::PATCH)
20957                    .uri(url.as_str())
20958                    .header(USER_AGENT, self.hub._user_agent.clone());
20959
20960                if let Some(token) = token.as_ref() {
20961                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20962                }
20963
20964                let request = req_builder
20965                    .header(CONTENT_TYPE, json_mime_type.to_string())
20966                    .header(CONTENT_LENGTH, request_size as u64)
20967                    .body(common::to_body(
20968                        request_value_reader.get_ref().clone().into(),
20969                    ));
20970
20971                client.request(request.unwrap()).await
20972            };
20973
20974            match req_result {
20975                Err(err) => {
20976                    if let common::Retry::After(d) = dlg.http_error(&err) {
20977                        sleep(d).await;
20978                        continue;
20979                    }
20980                    dlg.finished(false);
20981                    return Err(common::Error::HttpError(err));
20982                }
20983                Ok(res) => {
20984                    let (mut parts, body) = res.into_parts();
20985                    let mut body = common::Body::new(body);
20986                    if !parts.status.is_success() {
20987                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20988                        let error = serde_json::from_str(&common::to_string(&bytes));
20989                        let response = common::to_response(parts, bytes.into());
20990
20991                        if let common::Retry::After(d) =
20992                            dlg.http_failure(&response, error.as_ref().ok())
20993                        {
20994                            sleep(d).await;
20995                            continue;
20996                        }
20997
20998                        dlg.finished(false);
20999
21000                        return Err(match error {
21001                            Ok(value) => common::Error::BadRequest(value),
21002                            _ => common::Error::Failure(response),
21003                        });
21004                    }
21005                    let response = {
21006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21007                        let encoded = common::to_string(&bytes);
21008                        match serde_json::from_str(&encoded) {
21009                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21010                            Err(error) => {
21011                                dlg.response_json_decode_error(&encoded, &error);
21012                                return Err(common::Error::JsonDecodeError(
21013                                    encoded.to_string(),
21014                                    error,
21015                                ));
21016                            }
21017                        }
21018                    };
21019
21020                    dlg.finished(true);
21021                    return Ok(response);
21022                }
21023            }
21024        }
21025    }
21026
21027    ///
21028    /// Sets the *request* property to the given value.
21029    ///
21030    /// Even though the property as already been set when instantiating this call,
21031    /// we provide this method for API completeness.
21032    pub fn request(mut self, new_value: Target) -> ProjectLocationTargetPatchCall<'a, C> {
21033        self._request = new_value;
21034        self
21035    }
21036    /// Optional. Name of the `Target`. Format is `projects/{project}/locations/{location}/targets/{target}`. The `target` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
21037    ///
21038    /// Sets the *name* path property to the given value.
21039    ///
21040    /// Even though the property as already been set when instantiating this call,
21041    /// we provide this method for API completeness.
21042    pub fn name(mut self, new_value: &str) -> ProjectLocationTargetPatchCall<'a, C> {
21043        self._name = new_value.to_string();
21044        self
21045    }
21046    /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
21047    ///
21048    /// Sets the *validate only* query property to the given value.
21049    pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTargetPatchCall<'a, C> {
21050        self._validate_only = Some(new_value);
21051        self
21052    }
21053    /// Required. Field mask is used to specify the fields to be overwritten in the Target resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it's in the mask. If the user doesn't provide a mask then all fields are overwritten.
21054    ///
21055    /// Sets the *update mask* query property to the given value.
21056    pub fn update_mask(
21057        mut self,
21058        new_value: common::FieldMask,
21059    ) -> ProjectLocationTargetPatchCall<'a, C> {
21060        self._update_mask = Some(new_value);
21061        self
21062    }
21063    /// Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server knows to ignore the request if it has already been completed. The server guarantees that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).
21064    ///
21065    /// Sets the *request id* query property to the given value.
21066    pub fn request_id(mut self, new_value: &str) -> ProjectLocationTargetPatchCall<'a, C> {
21067        self._request_id = Some(new_value.to_string());
21068        self
21069    }
21070    /// Optional. If set to true, updating a `Target` that does not exist will result in the creation of a new `Target`.
21071    ///
21072    /// Sets the *allow missing* query property to the given value.
21073    pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationTargetPatchCall<'a, C> {
21074        self._allow_missing = Some(new_value);
21075        self
21076    }
21077    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21078    /// while executing the actual API request.
21079    ///
21080    /// ````text
21081    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21082    /// ````
21083    ///
21084    /// Sets the *delegate* property to the given value.
21085    pub fn delegate(
21086        mut self,
21087        new_value: &'a mut dyn common::Delegate,
21088    ) -> ProjectLocationTargetPatchCall<'a, C> {
21089        self._delegate = Some(new_value);
21090        self
21091    }
21092
21093    /// Set any additional parameter of the query string used in the request.
21094    /// It should be used to set parameters which are not yet available through their own
21095    /// setters.
21096    ///
21097    /// Please note that this method must not be used to set any of the known parameters
21098    /// which have their own setter method. If done anyway, the request will fail.
21099    ///
21100    /// # Additional Parameters
21101    ///
21102    /// * *$.xgafv* (query-string) - V1 error format.
21103    /// * *access_token* (query-string) - OAuth access token.
21104    /// * *alt* (query-string) - Data format for response.
21105    /// * *callback* (query-string) - JSONP
21106    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21107    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21108    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21109    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21110    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21111    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21112    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21113    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetPatchCall<'a, C>
21114    where
21115        T: AsRef<str>,
21116    {
21117        self._additional_params
21118            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21119        self
21120    }
21121
21122    /// Identifies the authorization scope for the method you are building.
21123    ///
21124    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21125    /// [`Scope::CloudPlatform`].
21126    ///
21127    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21128    /// tokens for more than one scope.
21129    ///
21130    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21131    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21132    /// sufficient, a read-write scope will do as well.
21133    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetPatchCall<'a, C>
21134    where
21135        St: AsRef<str>,
21136    {
21137        self._scopes.insert(String::from(scope.as_ref()));
21138        self
21139    }
21140    /// Identifies the authorization scope(s) for the method you are building.
21141    ///
21142    /// See [`Self::add_scope()`] for details.
21143    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetPatchCall<'a, C>
21144    where
21145        I: IntoIterator<Item = St>,
21146        St: AsRef<str>,
21147    {
21148        self._scopes
21149            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21150        self
21151    }
21152
21153    /// Removes all scopes, and no default scope will be used either.
21154    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21155    /// for details).
21156    pub fn clear_scopes(mut self) -> ProjectLocationTargetPatchCall<'a, C> {
21157        self._scopes.clear();
21158        self
21159    }
21160}
21161
21162/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
21163///
21164/// A builder for the *locations.targets.setIamPolicy* method supported by a *project* resource.
21165/// It is not used directly, but through a [`ProjectMethods`] instance.
21166///
21167/// # Example
21168///
21169/// Instantiate a resource method builder
21170///
21171/// ```test_harness,no_run
21172/// # extern crate hyper;
21173/// # extern crate hyper_rustls;
21174/// # extern crate google_clouddeploy1 as clouddeploy1;
21175/// use clouddeploy1::api::SetIamPolicyRequest;
21176/// # async fn dox() {
21177/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21178///
21179/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21180/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21181/// #     secret,
21182/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21183/// # ).build().await.unwrap();
21184///
21185/// # let client = hyper_util::client::legacy::Client::builder(
21186/// #     hyper_util::rt::TokioExecutor::new()
21187/// # )
21188/// # .build(
21189/// #     hyper_rustls::HttpsConnectorBuilder::new()
21190/// #         .with_native_roots()
21191/// #         .unwrap()
21192/// #         .https_or_http()
21193/// #         .enable_http1()
21194/// #         .build()
21195/// # );
21196/// # let mut hub = CloudDeploy::new(client, auth);
21197/// // As the method needs a request, you would usually fill it with the desired information
21198/// // into the respective structure. Some of the parts shown here might not be applicable !
21199/// // Values shown here are possibly random and not representative !
21200/// let mut req = SetIamPolicyRequest::default();
21201///
21202/// // You can configure optional parameters by calling the respective setters at will, and
21203/// // execute the final call using `doit()`.
21204/// // Values shown here are possibly random and not representative !
21205/// let result = hub.projects().locations_targets_set_iam_policy(req, "resource")
21206///              .doit().await;
21207/// # }
21208/// ```
21209pub struct ProjectLocationTargetSetIamPolicyCall<'a, C>
21210where
21211    C: 'a,
21212{
21213    hub: &'a CloudDeploy<C>,
21214    _request: SetIamPolicyRequest,
21215    _resource: String,
21216    _delegate: Option<&'a mut dyn common::Delegate>,
21217    _additional_params: HashMap<String, String>,
21218    _scopes: BTreeSet<String>,
21219}
21220
21221impl<'a, C> common::CallBuilder for ProjectLocationTargetSetIamPolicyCall<'a, C> {}
21222
21223impl<'a, C> ProjectLocationTargetSetIamPolicyCall<'a, C>
21224where
21225    C: common::Connector,
21226{
21227    /// Perform the operation you have build so far.
21228    pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
21229        use std::borrow::Cow;
21230        use std::io::{Read, Seek};
21231
21232        use common::{url::Params, ToParts};
21233        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21234
21235        let mut dd = common::DefaultDelegate;
21236        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21237        dlg.begin(common::MethodInfo {
21238            id: "clouddeploy.projects.locations.targets.setIamPolicy",
21239            http_method: hyper::Method::POST,
21240        });
21241
21242        for &field in ["alt", "resource"].iter() {
21243            if self._additional_params.contains_key(field) {
21244                dlg.finished(false);
21245                return Err(common::Error::FieldClash(field));
21246            }
21247        }
21248
21249        let mut params = Params::with_capacity(4 + self._additional_params.len());
21250        params.push("resource", self._resource);
21251
21252        params.extend(self._additional_params.iter());
21253
21254        params.push("alt", "json");
21255        let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
21256        if self._scopes.is_empty() {
21257            self._scopes
21258                .insert(Scope::CloudPlatform.as_ref().to_string());
21259        }
21260
21261        #[allow(clippy::single_element_loop)]
21262        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
21263            url = params.uri_replacement(url, param_name, find_this, true);
21264        }
21265        {
21266            let to_remove = ["resource"];
21267            params.remove_params(&to_remove);
21268        }
21269
21270        let url = params.parse_with_url(&url);
21271
21272        let mut json_mime_type = mime::APPLICATION_JSON;
21273        let mut request_value_reader = {
21274            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21275            common::remove_json_null_values(&mut value);
21276            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21277            serde_json::to_writer(&mut dst, &value).unwrap();
21278            dst
21279        };
21280        let request_size = request_value_reader
21281            .seek(std::io::SeekFrom::End(0))
21282            .unwrap();
21283        request_value_reader
21284            .seek(std::io::SeekFrom::Start(0))
21285            .unwrap();
21286
21287        loop {
21288            let token = match self
21289                .hub
21290                .auth
21291                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21292                .await
21293            {
21294                Ok(token) => token,
21295                Err(e) => match dlg.token(e) {
21296                    Ok(token) => token,
21297                    Err(e) => {
21298                        dlg.finished(false);
21299                        return Err(common::Error::MissingToken(e));
21300                    }
21301                },
21302            };
21303            request_value_reader
21304                .seek(std::io::SeekFrom::Start(0))
21305                .unwrap();
21306            let mut req_result = {
21307                let client = &self.hub.client;
21308                dlg.pre_request();
21309                let mut req_builder = hyper::Request::builder()
21310                    .method(hyper::Method::POST)
21311                    .uri(url.as_str())
21312                    .header(USER_AGENT, self.hub._user_agent.clone());
21313
21314                if let Some(token) = token.as_ref() {
21315                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21316                }
21317
21318                let request = req_builder
21319                    .header(CONTENT_TYPE, json_mime_type.to_string())
21320                    .header(CONTENT_LENGTH, request_size as u64)
21321                    .body(common::to_body(
21322                        request_value_reader.get_ref().clone().into(),
21323                    ));
21324
21325                client.request(request.unwrap()).await
21326            };
21327
21328            match req_result {
21329                Err(err) => {
21330                    if let common::Retry::After(d) = dlg.http_error(&err) {
21331                        sleep(d).await;
21332                        continue;
21333                    }
21334                    dlg.finished(false);
21335                    return Err(common::Error::HttpError(err));
21336                }
21337                Ok(res) => {
21338                    let (mut parts, body) = res.into_parts();
21339                    let mut body = common::Body::new(body);
21340                    if !parts.status.is_success() {
21341                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21342                        let error = serde_json::from_str(&common::to_string(&bytes));
21343                        let response = common::to_response(parts, bytes.into());
21344
21345                        if let common::Retry::After(d) =
21346                            dlg.http_failure(&response, error.as_ref().ok())
21347                        {
21348                            sleep(d).await;
21349                            continue;
21350                        }
21351
21352                        dlg.finished(false);
21353
21354                        return Err(match error {
21355                            Ok(value) => common::Error::BadRequest(value),
21356                            _ => common::Error::Failure(response),
21357                        });
21358                    }
21359                    let response = {
21360                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21361                        let encoded = common::to_string(&bytes);
21362                        match serde_json::from_str(&encoded) {
21363                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21364                            Err(error) => {
21365                                dlg.response_json_decode_error(&encoded, &error);
21366                                return Err(common::Error::JsonDecodeError(
21367                                    encoded.to_string(),
21368                                    error,
21369                                ));
21370                            }
21371                        }
21372                    };
21373
21374                    dlg.finished(true);
21375                    return Ok(response);
21376                }
21377            }
21378        }
21379    }
21380
21381    ///
21382    /// Sets the *request* property to the given value.
21383    ///
21384    /// Even though the property as already been set when instantiating this call,
21385    /// we provide this method for API completeness.
21386    pub fn request(
21387        mut self,
21388        new_value: SetIamPolicyRequest,
21389    ) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
21390        self._request = new_value;
21391        self
21392    }
21393    /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
21394    ///
21395    /// Sets the *resource* path property to the given value.
21396    ///
21397    /// Even though the property as already been set when instantiating this call,
21398    /// we provide this method for API completeness.
21399    pub fn resource(mut self, new_value: &str) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
21400        self._resource = new_value.to_string();
21401        self
21402    }
21403    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21404    /// while executing the actual API request.
21405    ///
21406    /// ````text
21407    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21408    /// ````
21409    ///
21410    /// Sets the *delegate* property to the given value.
21411    pub fn delegate(
21412        mut self,
21413        new_value: &'a mut dyn common::Delegate,
21414    ) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
21415        self._delegate = Some(new_value);
21416        self
21417    }
21418
21419    /// Set any additional parameter of the query string used in the request.
21420    /// It should be used to set parameters which are not yet available through their own
21421    /// setters.
21422    ///
21423    /// Please note that this method must not be used to set any of the known parameters
21424    /// which have their own setter method. If done anyway, the request will fail.
21425    ///
21426    /// # Additional Parameters
21427    ///
21428    /// * *$.xgafv* (query-string) - V1 error format.
21429    /// * *access_token* (query-string) - OAuth access token.
21430    /// * *alt* (query-string) - Data format for response.
21431    /// * *callback* (query-string) - JSONP
21432    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21433    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21434    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21435    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21436    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21437    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21438    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21439    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetSetIamPolicyCall<'a, C>
21440    where
21441        T: AsRef<str>,
21442    {
21443        self._additional_params
21444            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21445        self
21446    }
21447
21448    /// Identifies the authorization scope for the method you are building.
21449    ///
21450    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21451    /// [`Scope::CloudPlatform`].
21452    ///
21453    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21454    /// tokens for more than one scope.
21455    ///
21456    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21457    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21458    /// sufficient, a read-write scope will do as well.
21459    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetSetIamPolicyCall<'a, C>
21460    where
21461        St: AsRef<str>,
21462    {
21463        self._scopes.insert(String::from(scope.as_ref()));
21464        self
21465    }
21466    /// Identifies the authorization scope(s) for the method you are building.
21467    ///
21468    /// See [`Self::add_scope()`] for details.
21469    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetSetIamPolicyCall<'a, C>
21470    where
21471        I: IntoIterator<Item = St>,
21472        St: AsRef<str>,
21473    {
21474        self._scopes
21475            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21476        self
21477    }
21478
21479    /// Removes all scopes, and no default scope will be used either.
21480    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21481    /// for details).
21482    pub fn clear_scopes(mut self) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
21483        self._scopes.clear();
21484        self
21485    }
21486}
21487
21488/// Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
21489///
21490/// A builder for the *locations.targets.testIamPermissions* method supported by a *project* resource.
21491/// It is not used directly, but through a [`ProjectMethods`] instance.
21492///
21493/// # Example
21494///
21495/// Instantiate a resource method builder
21496///
21497/// ```test_harness,no_run
21498/// # extern crate hyper;
21499/// # extern crate hyper_rustls;
21500/// # extern crate google_clouddeploy1 as clouddeploy1;
21501/// use clouddeploy1::api::TestIamPermissionsRequest;
21502/// # async fn dox() {
21503/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21504///
21505/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21506/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21507/// #     secret,
21508/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21509/// # ).build().await.unwrap();
21510///
21511/// # let client = hyper_util::client::legacy::Client::builder(
21512/// #     hyper_util::rt::TokioExecutor::new()
21513/// # )
21514/// # .build(
21515/// #     hyper_rustls::HttpsConnectorBuilder::new()
21516/// #         .with_native_roots()
21517/// #         .unwrap()
21518/// #         .https_or_http()
21519/// #         .enable_http1()
21520/// #         .build()
21521/// # );
21522/// # let mut hub = CloudDeploy::new(client, auth);
21523/// // As the method needs a request, you would usually fill it with the desired information
21524/// // into the respective structure. Some of the parts shown here might not be applicable !
21525/// // Values shown here are possibly random and not representative !
21526/// let mut req = TestIamPermissionsRequest::default();
21527///
21528/// // You can configure optional parameters by calling the respective setters at will, and
21529/// // execute the final call using `doit()`.
21530/// // Values shown here are possibly random and not representative !
21531/// let result = hub.projects().locations_targets_test_iam_permissions(req, "resource")
21532///              .doit().await;
21533/// # }
21534/// ```
21535pub struct ProjectLocationTargetTestIamPermissionCall<'a, C>
21536where
21537    C: 'a,
21538{
21539    hub: &'a CloudDeploy<C>,
21540    _request: TestIamPermissionsRequest,
21541    _resource: String,
21542    _delegate: Option<&'a mut dyn common::Delegate>,
21543    _additional_params: HashMap<String, String>,
21544    _scopes: BTreeSet<String>,
21545}
21546
21547impl<'a, C> common::CallBuilder for ProjectLocationTargetTestIamPermissionCall<'a, C> {}
21548
21549impl<'a, C> ProjectLocationTargetTestIamPermissionCall<'a, C>
21550where
21551    C: common::Connector,
21552{
21553    /// Perform the operation you have build so far.
21554    pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
21555        use std::borrow::Cow;
21556        use std::io::{Read, Seek};
21557
21558        use common::{url::Params, ToParts};
21559        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21560
21561        let mut dd = common::DefaultDelegate;
21562        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21563        dlg.begin(common::MethodInfo {
21564            id: "clouddeploy.projects.locations.targets.testIamPermissions",
21565            http_method: hyper::Method::POST,
21566        });
21567
21568        for &field in ["alt", "resource"].iter() {
21569            if self._additional_params.contains_key(field) {
21570                dlg.finished(false);
21571                return Err(common::Error::FieldClash(field));
21572            }
21573        }
21574
21575        let mut params = Params::with_capacity(4 + self._additional_params.len());
21576        params.push("resource", self._resource);
21577
21578        params.extend(self._additional_params.iter());
21579
21580        params.push("alt", "json");
21581        let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
21582        if self._scopes.is_empty() {
21583            self._scopes
21584                .insert(Scope::CloudPlatform.as_ref().to_string());
21585        }
21586
21587        #[allow(clippy::single_element_loop)]
21588        for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
21589            url = params.uri_replacement(url, param_name, find_this, true);
21590        }
21591        {
21592            let to_remove = ["resource"];
21593            params.remove_params(&to_remove);
21594        }
21595
21596        let url = params.parse_with_url(&url);
21597
21598        let mut json_mime_type = mime::APPLICATION_JSON;
21599        let mut request_value_reader = {
21600            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21601            common::remove_json_null_values(&mut value);
21602            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21603            serde_json::to_writer(&mut dst, &value).unwrap();
21604            dst
21605        };
21606        let request_size = request_value_reader
21607            .seek(std::io::SeekFrom::End(0))
21608            .unwrap();
21609        request_value_reader
21610            .seek(std::io::SeekFrom::Start(0))
21611            .unwrap();
21612
21613        loop {
21614            let token = match self
21615                .hub
21616                .auth
21617                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21618                .await
21619            {
21620                Ok(token) => token,
21621                Err(e) => match dlg.token(e) {
21622                    Ok(token) => token,
21623                    Err(e) => {
21624                        dlg.finished(false);
21625                        return Err(common::Error::MissingToken(e));
21626                    }
21627                },
21628            };
21629            request_value_reader
21630                .seek(std::io::SeekFrom::Start(0))
21631                .unwrap();
21632            let mut req_result = {
21633                let client = &self.hub.client;
21634                dlg.pre_request();
21635                let mut req_builder = hyper::Request::builder()
21636                    .method(hyper::Method::POST)
21637                    .uri(url.as_str())
21638                    .header(USER_AGENT, self.hub._user_agent.clone());
21639
21640                if let Some(token) = token.as_ref() {
21641                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21642                }
21643
21644                let request = req_builder
21645                    .header(CONTENT_TYPE, json_mime_type.to_string())
21646                    .header(CONTENT_LENGTH, request_size as u64)
21647                    .body(common::to_body(
21648                        request_value_reader.get_ref().clone().into(),
21649                    ));
21650
21651                client.request(request.unwrap()).await
21652            };
21653
21654            match req_result {
21655                Err(err) => {
21656                    if let common::Retry::After(d) = dlg.http_error(&err) {
21657                        sleep(d).await;
21658                        continue;
21659                    }
21660                    dlg.finished(false);
21661                    return Err(common::Error::HttpError(err));
21662                }
21663                Ok(res) => {
21664                    let (mut parts, body) = res.into_parts();
21665                    let mut body = common::Body::new(body);
21666                    if !parts.status.is_success() {
21667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21668                        let error = serde_json::from_str(&common::to_string(&bytes));
21669                        let response = common::to_response(parts, bytes.into());
21670
21671                        if let common::Retry::After(d) =
21672                            dlg.http_failure(&response, error.as_ref().ok())
21673                        {
21674                            sleep(d).await;
21675                            continue;
21676                        }
21677
21678                        dlg.finished(false);
21679
21680                        return Err(match error {
21681                            Ok(value) => common::Error::BadRequest(value),
21682                            _ => common::Error::Failure(response),
21683                        });
21684                    }
21685                    let response = {
21686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21687                        let encoded = common::to_string(&bytes);
21688                        match serde_json::from_str(&encoded) {
21689                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21690                            Err(error) => {
21691                                dlg.response_json_decode_error(&encoded, &error);
21692                                return Err(common::Error::JsonDecodeError(
21693                                    encoded.to_string(),
21694                                    error,
21695                                ));
21696                            }
21697                        }
21698                    };
21699
21700                    dlg.finished(true);
21701                    return Ok(response);
21702                }
21703            }
21704        }
21705    }
21706
21707    ///
21708    /// Sets the *request* property to the given value.
21709    ///
21710    /// Even though the property as already been set when instantiating this call,
21711    /// we provide this method for API completeness.
21712    pub fn request(
21713        mut self,
21714        new_value: TestIamPermissionsRequest,
21715    ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
21716        self._request = new_value;
21717        self
21718    }
21719    /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.
21720    ///
21721    /// Sets the *resource* path property to the given value.
21722    ///
21723    /// Even though the property as already been set when instantiating this call,
21724    /// we provide this method for API completeness.
21725    pub fn resource(
21726        mut self,
21727        new_value: &str,
21728    ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
21729        self._resource = new_value.to_string();
21730        self
21731    }
21732    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21733    /// while executing the actual API request.
21734    ///
21735    /// ````text
21736    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21737    /// ````
21738    ///
21739    /// Sets the *delegate* property to the given value.
21740    pub fn delegate(
21741        mut self,
21742        new_value: &'a mut dyn common::Delegate,
21743    ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
21744        self._delegate = Some(new_value);
21745        self
21746    }
21747
21748    /// Set any additional parameter of the query string used in the request.
21749    /// It should be used to set parameters which are not yet available through their own
21750    /// setters.
21751    ///
21752    /// Please note that this method must not be used to set any of the known parameters
21753    /// which have their own setter method. If done anyway, the request will fail.
21754    ///
21755    /// # Additional Parameters
21756    ///
21757    /// * *$.xgafv* (query-string) - V1 error format.
21758    /// * *access_token* (query-string) - OAuth access token.
21759    /// * *alt* (query-string) - Data format for response.
21760    /// * *callback* (query-string) - JSONP
21761    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21762    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
21763    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21764    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21765    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
21766    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21767    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21768    pub fn param<T>(
21769        mut self,
21770        name: T,
21771        value: T,
21772    ) -> ProjectLocationTargetTestIamPermissionCall<'a, C>
21773    where
21774        T: AsRef<str>,
21775    {
21776        self._additional_params
21777            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21778        self
21779    }
21780
21781    /// Identifies the authorization scope for the method you are building.
21782    ///
21783    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21784    /// [`Scope::CloudPlatform`].
21785    ///
21786    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21787    /// tokens for more than one scope.
21788    ///
21789    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21790    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21791    /// sufficient, a read-write scope will do as well.
21792    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetTestIamPermissionCall<'a, C>
21793    where
21794        St: AsRef<str>,
21795    {
21796        self._scopes.insert(String::from(scope.as_ref()));
21797        self
21798    }
21799    /// Identifies the authorization scope(s) for the method you are building.
21800    ///
21801    /// See [`Self::add_scope()`] for details.
21802    pub fn add_scopes<I, St>(
21803        mut self,
21804        scopes: I,
21805    ) -> ProjectLocationTargetTestIamPermissionCall<'a, C>
21806    where
21807        I: IntoIterator<Item = St>,
21808        St: AsRef<str>,
21809    {
21810        self._scopes
21811            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21812        self
21813    }
21814
21815    /// Removes all scopes, and no default scope will be used either.
21816    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21817    /// for details).
21818    pub fn clear_scopes(mut self) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
21819        self._scopes.clear();
21820        self
21821    }
21822}
21823
21824/// Gets information about a location.
21825///
21826/// A builder for the *locations.get* method supported by a *project* resource.
21827/// It is not used directly, but through a [`ProjectMethods`] instance.
21828///
21829/// # Example
21830///
21831/// Instantiate a resource method builder
21832///
21833/// ```test_harness,no_run
21834/// # extern crate hyper;
21835/// # extern crate hyper_rustls;
21836/// # extern crate google_clouddeploy1 as clouddeploy1;
21837/// # async fn dox() {
21838/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21839///
21840/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21841/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21842/// #     secret,
21843/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21844/// # ).build().await.unwrap();
21845///
21846/// # let client = hyper_util::client::legacy::Client::builder(
21847/// #     hyper_util::rt::TokioExecutor::new()
21848/// # )
21849/// # .build(
21850/// #     hyper_rustls::HttpsConnectorBuilder::new()
21851/// #         .with_native_roots()
21852/// #         .unwrap()
21853/// #         .https_or_http()
21854/// #         .enable_http1()
21855/// #         .build()
21856/// # );
21857/// # let mut hub = CloudDeploy::new(client, auth);
21858/// // You can configure optional parameters by calling the respective setters at will, and
21859/// // execute the final call using `doit()`.
21860/// // Values shown here are possibly random and not representative !
21861/// let result = hub.projects().locations_get("name")
21862///              .doit().await;
21863/// # }
21864/// ```
21865pub struct ProjectLocationGetCall<'a, C>
21866where
21867    C: 'a,
21868{
21869    hub: &'a CloudDeploy<C>,
21870    _name: String,
21871    _delegate: Option<&'a mut dyn common::Delegate>,
21872    _additional_params: HashMap<String, String>,
21873    _scopes: BTreeSet<String>,
21874}
21875
21876impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
21877
21878impl<'a, C> ProjectLocationGetCall<'a, C>
21879where
21880    C: common::Connector,
21881{
21882    /// Perform the operation you have build so far.
21883    pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
21884        use std::borrow::Cow;
21885        use std::io::{Read, Seek};
21886
21887        use common::{url::Params, ToParts};
21888        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21889
21890        let mut dd = common::DefaultDelegate;
21891        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21892        dlg.begin(common::MethodInfo {
21893            id: "clouddeploy.projects.locations.get",
21894            http_method: hyper::Method::GET,
21895        });
21896
21897        for &field in ["alt", "name"].iter() {
21898            if self._additional_params.contains_key(field) {
21899                dlg.finished(false);
21900                return Err(common::Error::FieldClash(field));
21901            }
21902        }
21903
21904        let mut params = Params::with_capacity(3 + self._additional_params.len());
21905        params.push("name", self._name);
21906
21907        params.extend(self._additional_params.iter());
21908
21909        params.push("alt", "json");
21910        let mut url = self.hub._base_url.clone() + "v1/{+name}";
21911        if self._scopes.is_empty() {
21912            self._scopes
21913                .insert(Scope::CloudPlatform.as_ref().to_string());
21914        }
21915
21916        #[allow(clippy::single_element_loop)]
21917        for &(find_this, param_name) in [("{+name}", "name")].iter() {
21918            url = params.uri_replacement(url, param_name, find_this, true);
21919        }
21920        {
21921            let to_remove = ["name"];
21922            params.remove_params(&to_remove);
21923        }
21924
21925        let url = params.parse_with_url(&url);
21926
21927        loop {
21928            let token = match self
21929                .hub
21930                .auth
21931                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21932                .await
21933            {
21934                Ok(token) => token,
21935                Err(e) => match dlg.token(e) {
21936                    Ok(token) => token,
21937                    Err(e) => {
21938                        dlg.finished(false);
21939                        return Err(common::Error::MissingToken(e));
21940                    }
21941                },
21942            };
21943            let mut req_result = {
21944                let client = &self.hub.client;
21945                dlg.pre_request();
21946                let mut req_builder = hyper::Request::builder()
21947                    .method(hyper::Method::GET)
21948                    .uri(url.as_str())
21949                    .header(USER_AGENT, self.hub._user_agent.clone());
21950
21951                if let Some(token) = token.as_ref() {
21952                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21953                }
21954
21955                let request = req_builder
21956                    .header(CONTENT_LENGTH, 0_u64)
21957                    .body(common::to_body::<String>(None));
21958
21959                client.request(request.unwrap()).await
21960            };
21961
21962            match req_result {
21963                Err(err) => {
21964                    if let common::Retry::After(d) = dlg.http_error(&err) {
21965                        sleep(d).await;
21966                        continue;
21967                    }
21968                    dlg.finished(false);
21969                    return Err(common::Error::HttpError(err));
21970                }
21971                Ok(res) => {
21972                    let (mut parts, body) = res.into_parts();
21973                    let mut body = common::Body::new(body);
21974                    if !parts.status.is_success() {
21975                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21976                        let error = serde_json::from_str(&common::to_string(&bytes));
21977                        let response = common::to_response(parts, bytes.into());
21978
21979                        if let common::Retry::After(d) =
21980                            dlg.http_failure(&response, error.as_ref().ok())
21981                        {
21982                            sleep(d).await;
21983                            continue;
21984                        }
21985
21986                        dlg.finished(false);
21987
21988                        return Err(match error {
21989                            Ok(value) => common::Error::BadRequest(value),
21990                            _ => common::Error::Failure(response),
21991                        });
21992                    }
21993                    let response = {
21994                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21995                        let encoded = common::to_string(&bytes);
21996                        match serde_json::from_str(&encoded) {
21997                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21998                            Err(error) => {
21999                                dlg.response_json_decode_error(&encoded, &error);
22000                                return Err(common::Error::JsonDecodeError(
22001                                    encoded.to_string(),
22002                                    error,
22003                                ));
22004                            }
22005                        }
22006                    };
22007
22008                    dlg.finished(true);
22009                    return Ok(response);
22010                }
22011            }
22012        }
22013    }
22014
22015    /// Resource name for the location.
22016    ///
22017    /// Sets the *name* path property to the given value.
22018    ///
22019    /// Even though the property as already been set when instantiating this call,
22020    /// we provide this method for API completeness.
22021    pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
22022        self._name = new_value.to_string();
22023        self
22024    }
22025    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22026    /// while executing the actual API request.
22027    ///
22028    /// ````text
22029    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22030    /// ````
22031    ///
22032    /// Sets the *delegate* property to the given value.
22033    pub fn delegate(
22034        mut self,
22035        new_value: &'a mut dyn common::Delegate,
22036    ) -> ProjectLocationGetCall<'a, C> {
22037        self._delegate = Some(new_value);
22038        self
22039    }
22040
22041    /// Set any additional parameter of the query string used in the request.
22042    /// It should be used to set parameters which are not yet available through their own
22043    /// setters.
22044    ///
22045    /// Please note that this method must not be used to set any of the known parameters
22046    /// which have their own setter method. If done anyway, the request will fail.
22047    ///
22048    /// # Additional Parameters
22049    ///
22050    /// * *$.xgafv* (query-string) - V1 error format.
22051    /// * *access_token* (query-string) - OAuth access token.
22052    /// * *alt* (query-string) - Data format for response.
22053    /// * *callback* (query-string) - JSONP
22054    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22055    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22056    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22057    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22058    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22059    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22060    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22061    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
22062    where
22063        T: AsRef<str>,
22064    {
22065        self._additional_params
22066            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22067        self
22068    }
22069
22070    /// Identifies the authorization scope for the method you are building.
22071    ///
22072    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22073    /// [`Scope::CloudPlatform`].
22074    ///
22075    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22076    /// tokens for more than one scope.
22077    ///
22078    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22079    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22080    /// sufficient, a read-write scope will do as well.
22081    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
22082    where
22083        St: AsRef<str>,
22084    {
22085        self._scopes.insert(String::from(scope.as_ref()));
22086        self
22087    }
22088    /// Identifies the authorization scope(s) for the method you are building.
22089    ///
22090    /// See [`Self::add_scope()`] for details.
22091    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
22092    where
22093        I: IntoIterator<Item = St>,
22094        St: AsRef<str>,
22095    {
22096        self._scopes
22097            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22098        self
22099    }
22100
22101    /// Removes all scopes, and no default scope will be used either.
22102    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22103    /// for details).
22104    pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
22105        self._scopes.clear();
22106        self
22107    }
22108}
22109
22110/// Gets the configuration for a location.
22111///
22112/// A builder for the *locations.getConfig* method supported by a *project* resource.
22113/// It is not used directly, but through a [`ProjectMethods`] instance.
22114///
22115/// # Example
22116///
22117/// Instantiate a resource method builder
22118///
22119/// ```test_harness,no_run
22120/// # extern crate hyper;
22121/// # extern crate hyper_rustls;
22122/// # extern crate google_clouddeploy1 as clouddeploy1;
22123/// # async fn dox() {
22124/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22125///
22126/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22127/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22128/// #     secret,
22129/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22130/// # ).build().await.unwrap();
22131///
22132/// # let client = hyper_util::client::legacy::Client::builder(
22133/// #     hyper_util::rt::TokioExecutor::new()
22134/// # )
22135/// # .build(
22136/// #     hyper_rustls::HttpsConnectorBuilder::new()
22137/// #         .with_native_roots()
22138/// #         .unwrap()
22139/// #         .https_or_http()
22140/// #         .enable_http1()
22141/// #         .build()
22142/// # );
22143/// # let mut hub = CloudDeploy::new(client, auth);
22144/// // You can configure optional parameters by calling the respective setters at will, and
22145/// // execute the final call using `doit()`.
22146/// // Values shown here are possibly random and not representative !
22147/// let result = hub.projects().locations_get_config("name")
22148///              .doit().await;
22149/// # }
22150/// ```
22151pub struct ProjectLocationGetConfigCall<'a, C>
22152where
22153    C: 'a,
22154{
22155    hub: &'a CloudDeploy<C>,
22156    _name: String,
22157    _delegate: Option<&'a mut dyn common::Delegate>,
22158    _additional_params: HashMap<String, String>,
22159    _scopes: BTreeSet<String>,
22160}
22161
22162impl<'a, C> common::CallBuilder for ProjectLocationGetConfigCall<'a, C> {}
22163
22164impl<'a, C> ProjectLocationGetConfigCall<'a, C>
22165where
22166    C: common::Connector,
22167{
22168    /// Perform the operation you have build so far.
22169    pub async fn doit(mut self) -> common::Result<(common::Response, Config)> {
22170        use std::borrow::Cow;
22171        use std::io::{Read, Seek};
22172
22173        use common::{url::Params, ToParts};
22174        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22175
22176        let mut dd = common::DefaultDelegate;
22177        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22178        dlg.begin(common::MethodInfo {
22179            id: "clouddeploy.projects.locations.getConfig",
22180            http_method: hyper::Method::GET,
22181        });
22182
22183        for &field in ["alt", "name"].iter() {
22184            if self._additional_params.contains_key(field) {
22185                dlg.finished(false);
22186                return Err(common::Error::FieldClash(field));
22187            }
22188        }
22189
22190        let mut params = Params::with_capacity(3 + self._additional_params.len());
22191        params.push("name", self._name);
22192
22193        params.extend(self._additional_params.iter());
22194
22195        params.push("alt", "json");
22196        let mut url = self.hub._base_url.clone() + "v1/{+name}";
22197        if self._scopes.is_empty() {
22198            self._scopes
22199                .insert(Scope::CloudPlatform.as_ref().to_string());
22200        }
22201
22202        #[allow(clippy::single_element_loop)]
22203        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22204            url = params.uri_replacement(url, param_name, find_this, true);
22205        }
22206        {
22207            let to_remove = ["name"];
22208            params.remove_params(&to_remove);
22209        }
22210
22211        let url = params.parse_with_url(&url);
22212
22213        loop {
22214            let token = match self
22215                .hub
22216                .auth
22217                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22218                .await
22219            {
22220                Ok(token) => token,
22221                Err(e) => match dlg.token(e) {
22222                    Ok(token) => token,
22223                    Err(e) => {
22224                        dlg.finished(false);
22225                        return Err(common::Error::MissingToken(e));
22226                    }
22227                },
22228            };
22229            let mut req_result = {
22230                let client = &self.hub.client;
22231                dlg.pre_request();
22232                let mut req_builder = hyper::Request::builder()
22233                    .method(hyper::Method::GET)
22234                    .uri(url.as_str())
22235                    .header(USER_AGENT, self.hub._user_agent.clone());
22236
22237                if let Some(token) = token.as_ref() {
22238                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22239                }
22240
22241                let request = req_builder
22242                    .header(CONTENT_LENGTH, 0_u64)
22243                    .body(common::to_body::<String>(None));
22244
22245                client.request(request.unwrap()).await
22246            };
22247
22248            match req_result {
22249                Err(err) => {
22250                    if let common::Retry::After(d) = dlg.http_error(&err) {
22251                        sleep(d).await;
22252                        continue;
22253                    }
22254                    dlg.finished(false);
22255                    return Err(common::Error::HttpError(err));
22256                }
22257                Ok(res) => {
22258                    let (mut parts, body) = res.into_parts();
22259                    let mut body = common::Body::new(body);
22260                    if !parts.status.is_success() {
22261                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22262                        let error = serde_json::from_str(&common::to_string(&bytes));
22263                        let response = common::to_response(parts, bytes.into());
22264
22265                        if let common::Retry::After(d) =
22266                            dlg.http_failure(&response, error.as_ref().ok())
22267                        {
22268                            sleep(d).await;
22269                            continue;
22270                        }
22271
22272                        dlg.finished(false);
22273
22274                        return Err(match error {
22275                            Ok(value) => common::Error::BadRequest(value),
22276                            _ => common::Error::Failure(response),
22277                        });
22278                    }
22279                    let response = {
22280                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22281                        let encoded = common::to_string(&bytes);
22282                        match serde_json::from_str(&encoded) {
22283                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22284                            Err(error) => {
22285                                dlg.response_json_decode_error(&encoded, &error);
22286                                return Err(common::Error::JsonDecodeError(
22287                                    encoded.to_string(),
22288                                    error,
22289                                ));
22290                            }
22291                        }
22292                    };
22293
22294                    dlg.finished(true);
22295                    return Ok(response);
22296                }
22297            }
22298        }
22299    }
22300
22301    /// Required. Name of requested configuration.
22302    ///
22303    /// Sets the *name* path property to the given value.
22304    ///
22305    /// Even though the property as already been set when instantiating this call,
22306    /// we provide this method for API completeness.
22307    pub fn name(mut self, new_value: &str) -> ProjectLocationGetConfigCall<'a, C> {
22308        self._name = new_value.to_string();
22309        self
22310    }
22311    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22312    /// while executing the actual API request.
22313    ///
22314    /// ````text
22315    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22316    /// ````
22317    ///
22318    /// Sets the *delegate* property to the given value.
22319    pub fn delegate(
22320        mut self,
22321        new_value: &'a mut dyn common::Delegate,
22322    ) -> ProjectLocationGetConfigCall<'a, C> {
22323        self._delegate = Some(new_value);
22324        self
22325    }
22326
22327    /// Set any additional parameter of the query string used in the request.
22328    /// It should be used to set parameters which are not yet available through their own
22329    /// setters.
22330    ///
22331    /// Please note that this method must not be used to set any of the known parameters
22332    /// which have their own setter method. If done anyway, the request will fail.
22333    ///
22334    /// # Additional Parameters
22335    ///
22336    /// * *$.xgafv* (query-string) - V1 error format.
22337    /// * *access_token* (query-string) - OAuth access token.
22338    /// * *alt* (query-string) - Data format for response.
22339    /// * *callback* (query-string) - JSONP
22340    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22341    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22342    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22343    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22344    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22345    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22346    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22347    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetConfigCall<'a, C>
22348    where
22349        T: AsRef<str>,
22350    {
22351        self._additional_params
22352            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22353        self
22354    }
22355
22356    /// Identifies the authorization scope for the method you are building.
22357    ///
22358    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22359    /// [`Scope::CloudPlatform`].
22360    ///
22361    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22362    /// tokens for more than one scope.
22363    ///
22364    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22365    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22366    /// sufficient, a read-write scope will do as well.
22367    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetConfigCall<'a, C>
22368    where
22369        St: AsRef<str>,
22370    {
22371        self._scopes.insert(String::from(scope.as_ref()));
22372        self
22373    }
22374    /// Identifies the authorization scope(s) for the method you are building.
22375    ///
22376    /// See [`Self::add_scope()`] for details.
22377    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetConfigCall<'a, C>
22378    where
22379        I: IntoIterator<Item = St>,
22380        St: AsRef<str>,
22381    {
22382        self._scopes
22383            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22384        self
22385    }
22386
22387    /// Removes all scopes, and no default scope will be used either.
22388    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22389    /// for details).
22390    pub fn clear_scopes(mut self) -> ProjectLocationGetConfigCall<'a, C> {
22391        self._scopes.clear();
22392        self
22393    }
22394}
22395
22396/// Lists information about the supported locations for this service.
22397///
22398/// A builder for the *locations.list* method supported by a *project* resource.
22399/// It is not used directly, but through a [`ProjectMethods`] instance.
22400///
22401/// # Example
22402///
22403/// Instantiate a resource method builder
22404///
22405/// ```test_harness,no_run
22406/// # extern crate hyper;
22407/// # extern crate hyper_rustls;
22408/// # extern crate google_clouddeploy1 as clouddeploy1;
22409/// # async fn dox() {
22410/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22411///
22412/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22413/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22414/// #     secret,
22415/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22416/// # ).build().await.unwrap();
22417///
22418/// # let client = hyper_util::client::legacy::Client::builder(
22419/// #     hyper_util::rt::TokioExecutor::new()
22420/// # )
22421/// # .build(
22422/// #     hyper_rustls::HttpsConnectorBuilder::new()
22423/// #         .with_native_roots()
22424/// #         .unwrap()
22425/// #         .https_or_http()
22426/// #         .enable_http1()
22427/// #         .build()
22428/// # );
22429/// # let mut hub = CloudDeploy::new(client, auth);
22430/// // You can configure optional parameters by calling the respective setters at will, and
22431/// // execute the final call using `doit()`.
22432/// // Values shown here are possibly random and not representative !
22433/// let result = hub.projects().locations_list("name")
22434///              .page_token("sit")
22435///              .page_size(-32)
22436///              .filter("eos")
22437///              .doit().await;
22438/// # }
22439/// ```
22440pub struct ProjectLocationListCall<'a, C>
22441where
22442    C: 'a,
22443{
22444    hub: &'a CloudDeploy<C>,
22445    _name: String,
22446    _page_token: Option<String>,
22447    _page_size: Option<i32>,
22448    _filter: Option<String>,
22449    _delegate: Option<&'a mut dyn common::Delegate>,
22450    _additional_params: HashMap<String, String>,
22451    _scopes: BTreeSet<String>,
22452}
22453
22454impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
22455
22456impl<'a, C> ProjectLocationListCall<'a, C>
22457where
22458    C: common::Connector,
22459{
22460    /// Perform the operation you have build so far.
22461    pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
22462        use std::borrow::Cow;
22463        use std::io::{Read, Seek};
22464
22465        use common::{url::Params, ToParts};
22466        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22467
22468        let mut dd = common::DefaultDelegate;
22469        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22470        dlg.begin(common::MethodInfo {
22471            id: "clouddeploy.projects.locations.list",
22472            http_method: hyper::Method::GET,
22473        });
22474
22475        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
22476            if self._additional_params.contains_key(field) {
22477                dlg.finished(false);
22478                return Err(common::Error::FieldClash(field));
22479            }
22480        }
22481
22482        let mut params = Params::with_capacity(6 + self._additional_params.len());
22483        params.push("name", self._name);
22484        if let Some(value) = self._page_token.as_ref() {
22485            params.push("pageToken", value);
22486        }
22487        if let Some(value) = self._page_size.as_ref() {
22488            params.push("pageSize", value.to_string());
22489        }
22490        if let Some(value) = self._filter.as_ref() {
22491            params.push("filter", value);
22492        }
22493
22494        params.extend(self._additional_params.iter());
22495
22496        params.push("alt", "json");
22497        let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
22498        if self._scopes.is_empty() {
22499            self._scopes
22500                .insert(Scope::CloudPlatform.as_ref().to_string());
22501        }
22502
22503        #[allow(clippy::single_element_loop)]
22504        for &(find_this, param_name) in [("{+name}", "name")].iter() {
22505            url = params.uri_replacement(url, param_name, find_this, true);
22506        }
22507        {
22508            let to_remove = ["name"];
22509            params.remove_params(&to_remove);
22510        }
22511
22512        let url = params.parse_with_url(&url);
22513
22514        loop {
22515            let token = match self
22516                .hub
22517                .auth
22518                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22519                .await
22520            {
22521                Ok(token) => token,
22522                Err(e) => match dlg.token(e) {
22523                    Ok(token) => token,
22524                    Err(e) => {
22525                        dlg.finished(false);
22526                        return Err(common::Error::MissingToken(e));
22527                    }
22528                },
22529            };
22530            let mut req_result = {
22531                let client = &self.hub.client;
22532                dlg.pre_request();
22533                let mut req_builder = hyper::Request::builder()
22534                    .method(hyper::Method::GET)
22535                    .uri(url.as_str())
22536                    .header(USER_AGENT, self.hub._user_agent.clone());
22537
22538                if let Some(token) = token.as_ref() {
22539                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22540                }
22541
22542                let request = req_builder
22543                    .header(CONTENT_LENGTH, 0_u64)
22544                    .body(common::to_body::<String>(None));
22545
22546                client.request(request.unwrap()).await
22547            };
22548
22549            match req_result {
22550                Err(err) => {
22551                    if let common::Retry::After(d) = dlg.http_error(&err) {
22552                        sleep(d).await;
22553                        continue;
22554                    }
22555                    dlg.finished(false);
22556                    return Err(common::Error::HttpError(err));
22557                }
22558                Ok(res) => {
22559                    let (mut parts, body) = res.into_parts();
22560                    let mut body = common::Body::new(body);
22561                    if !parts.status.is_success() {
22562                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22563                        let error = serde_json::from_str(&common::to_string(&bytes));
22564                        let response = common::to_response(parts, bytes.into());
22565
22566                        if let common::Retry::After(d) =
22567                            dlg.http_failure(&response, error.as_ref().ok())
22568                        {
22569                            sleep(d).await;
22570                            continue;
22571                        }
22572
22573                        dlg.finished(false);
22574
22575                        return Err(match error {
22576                            Ok(value) => common::Error::BadRequest(value),
22577                            _ => common::Error::Failure(response),
22578                        });
22579                    }
22580                    let response = {
22581                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22582                        let encoded = common::to_string(&bytes);
22583                        match serde_json::from_str(&encoded) {
22584                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22585                            Err(error) => {
22586                                dlg.response_json_decode_error(&encoded, &error);
22587                                return Err(common::Error::JsonDecodeError(
22588                                    encoded.to_string(),
22589                                    error,
22590                                ));
22591                            }
22592                        }
22593                    };
22594
22595                    dlg.finished(true);
22596                    return Ok(response);
22597                }
22598            }
22599        }
22600    }
22601
22602    /// The resource that owns the locations collection, if applicable.
22603    ///
22604    /// Sets the *name* path property to the given value.
22605    ///
22606    /// Even though the property as already been set when instantiating this call,
22607    /// we provide this method for API completeness.
22608    pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
22609        self._name = new_value.to_string();
22610        self
22611    }
22612    /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
22613    ///
22614    /// Sets the *page token* query property to the given value.
22615    pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
22616        self._page_token = Some(new_value.to_string());
22617        self
22618    }
22619    /// The maximum number of results to return. If not set, the service selects a default.
22620    ///
22621    /// Sets the *page size* query property to the given value.
22622    pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
22623        self._page_size = Some(new_value);
22624        self
22625    }
22626    /// A filter to narrow down results to a preferred subset. The filtering language accepts strings like `"displayName=tokyo"`, and is documented in more detail in [AIP-160](https://google.aip.dev/160).
22627    ///
22628    /// Sets the *filter* query property to the given value.
22629    pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
22630        self._filter = Some(new_value.to_string());
22631        self
22632    }
22633    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22634    /// while executing the actual API request.
22635    ///
22636    /// ````text
22637    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22638    /// ````
22639    ///
22640    /// Sets the *delegate* property to the given value.
22641    pub fn delegate(
22642        mut self,
22643        new_value: &'a mut dyn common::Delegate,
22644    ) -> ProjectLocationListCall<'a, C> {
22645        self._delegate = Some(new_value);
22646        self
22647    }
22648
22649    /// Set any additional parameter of the query string used in the request.
22650    /// It should be used to set parameters which are not yet available through their own
22651    /// setters.
22652    ///
22653    /// Please note that this method must not be used to set any of the known parameters
22654    /// which have their own setter method. If done anyway, the request will fail.
22655    ///
22656    /// # Additional Parameters
22657    ///
22658    /// * *$.xgafv* (query-string) - V1 error format.
22659    /// * *access_token* (query-string) - OAuth access token.
22660    /// * *alt* (query-string) - Data format for response.
22661    /// * *callback* (query-string) - JSONP
22662    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22663    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
22664    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22665    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22666    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
22667    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22668    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22669    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
22670    where
22671        T: AsRef<str>,
22672    {
22673        self._additional_params
22674            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22675        self
22676    }
22677
22678    /// Identifies the authorization scope for the method you are building.
22679    ///
22680    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22681    /// [`Scope::CloudPlatform`].
22682    ///
22683    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22684    /// tokens for more than one scope.
22685    ///
22686    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22687    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22688    /// sufficient, a read-write scope will do as well.
22689    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
22690    where
22691        St: AsRef<str>,
22692    {
22693        self._scopes.insert(String::from(scope.as_ref()));
22694        self
22695    }
22696    /// Identifies the authorization scope(s) for the method you are building.
22697    ///
22698    /// See [`Self::add_scope()`] for details.
22699    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
22700    where
22701        I: IntoIterator<Item = St>,
22702        St: AsRef<str>,
22703    {
22704        self._scopes
22705            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22706        self
22707    }
22708
22709    /// Removes all scopes, and no default scope will be used either.
22710    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22711    /// for details).
22712    pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
22713        self._scopes.clear();
22714        self
22715    }
22716}