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::Rollout;
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 connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = CloudDeploy::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Rollout::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_create(req, "parent")
99/// .validate_only(false)
100/// .starting_phase_id("dolor")
101/// .rollout_id("ea")
102/// .request_id("ipsum")
103/// .add_override_deploy_policy("invidunt")
104/// .doit().await;
105///
106/// match result {
107/// Err(e) => match e {
108/// // The Error enum provides details about what exactly happened.
109/// // You can also just use its `Debug`, `Display` or `Error` traits
110/// Error::HttpError(_)
111/// |Error::Io(_)
112/// |Error::MissingAPIKey
113/// |Error::MissingToken(_)
114/// |Error::Cancelled
115/// |Error::UploadSizeLimitExceeded(_, _)
116/// |Error::Failure(_)
117/// |Error::BadRequest(_)
118/// |Error::FieldClash(_)
119/// |Error::JsonDecodeError(_, _) => println!("{}", e),
120/// },
121/// Ok(res) => println!("Success: {:?}", res),
122/// }
123/// # }
124/// ```
125#[derive(Clone)]
126pub struct CloudDeploy<C> {
127 pub client: common::Client<C>,
128 pub auth: Box<dyn common::GetToken>,
129 _user_agent: String,
130 _base_url: String,
131 _root_url: String,
132}
133
134impl<C> common::Hub for CloudDeploy<C> {}
135
136impl<'a, C> CloudDeploy<C> {
137 pub fn new<A: 'static + common::GetToken>(
138 client: common::Client<C>,
139 auth: A,
140 ) -> CloudDeploy<C> {
141 CloudDeploy {
142 client,
143 auth: Box::new(auth),
144 _user_agent: "google-api-rust-client/7.0.0".to_string(),
145 _base_url: "https://clouddeploy.googleapis.com/".to_string(),
146 _root_url: "https://clouddeploy.googleapis.com/".to_string(),
147 }
148 }
149
150 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
151 ProjectMethods { hub: self }
152 }
153
154 /// Set the user-agent header field to use in all requests to the server.
155 /// It defaults to `google-api-rust-client/7.0.0`.
156 ///
157 /// Returns the previously set user-agent.
158 pub fn user_agent(&mut self, agent_name: String) -> String {
159 std::mem::replace(&mut self._user_agent, agent_name)
160 }
161
162 /// Set the base url to use in all requests to the server.
163 /// It defaults to `https://clouddeploy.googleapis.com/`.
164 ///
165 /// Returns the previously set base url.
166 pub fn base_url(&mut self, new_base_url: String) -> String {
167 std::mem::replace(&mut self._base_url, new_base_url)
168 }
169
170 /// Set the root url to use in all requests to the server.
171 /// It defaults to `https://clouddeploy.googleapis.com/`.
172 ///
173 /// Returns the previously set root url.
174 pub fn root_url(&mut self, new_root_url: String) -> String {
175 std::mem::replace(&mut self._root_url, new_root_url)
176 }
177}
178
179// ############
180// SCHEMAS ###
181// ##########
182/// The request object used by `AbandonRelease`.
183///
184/// # Activities
185///
186/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
187/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
188///
189/// * [locations delivery pipelines releases abandon projects](ProjectLocationDeliveryPipelineReleaseAbandonCall) (request)
190#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
191#[serde_with::serde_as]
192#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
193pub struct AbandonReleaseRequest {
194 _never_set: Option<bool>,
195}
196
197impl common::RequestValue for AbandonReleaseRequest {}
198
199/// The response object for `AbandonRelease`.
200///
201/// # Activities
202///
203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
205///
206/// * [locations delivery pipelines releases abandon projects](ProjectLocationDeliveryPipelineReleaseAbandonCall) (response)
207#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
208#[serde_with::serde_as]
209#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
210pub struct AbandonReleaseResponse {
211 _never_set: Option<bool>,
212}
213
214impl common::ResponseResult for AbandonReleaseResponse {}
215
216/// An advanceChildRollout Job.
217///
218/// This type is not used in any activity, and only used as *part* of another schema.
219///
220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
221#[serde_with::serde_as]
222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
223pub struct AdvanceChildRolloutJob {
224 _never_set: Option<bool>,
225}
226
227impl common::Part for AdvanceChildRolloutJob {}
228
229/// AdvanceChildRolloutJobRun contains information specific to a advanceChildRollout `JobRun`.
230///
231/// This type is not used in any activity, and only used as *part* of another schema.
232///
233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
234#[serde_with::serde_as]
235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
236pub struct AdvanceChildRolloutJobRun {
237 /// Output only. Name of the `ChildRollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
238 pub rollout: Option<String>,
239 /// Output only. the ID of the ChildRollout's Phase.
240 #[serde(rename = "rolloutPhaseId")]
241 pub rollout_phase_id: Option<String>,
242}
243
244impl common::Part for AdvanceChildRolloutJobRun {}
245
246/// Contains the information of an automated advance-rollout operation.
247///
248/// This type is not used in any activity, and only used as *part* of another schema.
249///
250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
251#[serde_with::serde_as]
252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
253pub struct AdvanceRolloutOperation {
254 /// Output only. The phase the rollout will be advanced to.
255 #[serde(rename = "destinationPhase")]
256 pub destination_phase: Option<String>,
257 /// Output only. The name of the rollout that initiates the `AutomationRun`.
258 pub rollout: Option<String>,
259 /// Output only. The phase of a deployment that initiated the operation.
260 #[serde(rename = "sourcePhase")]
261 pub source_phase: Option<String>,
262 /// Output only. How long the operation will be paused.
263 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
264 pub wait: Option<chrono::Duration>,
265}
266
267impl common::Part for AdvanceRolloutOperation {}
268
269/// The request object used by `AdvanceRollout`.
270///
271/// # Activities
272///
273/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
274/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
275///
276/// * [locations delivery pipelines releases rollouts advance projects](ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall) (request)
277#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
278#[serde_with::serde_as]
279#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
280pub struct AdvanceRolloutRequest {
281 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
282 #[serde(rename = "overrideDeployPolicy")]
283 pub override_deploy_policy: Option<Vec<String>>,
284 /// Required. The phase ID to advance the `Rollout` to.
285 #[serde(rename = "phaseId")]
286 pub phase_id: Option<String>,
287}
288
289impl common::RequestValue for AdvanceRolloutRequest {}
290
291/// The response object from `AdvanceRollout`.
292///
293/// # Activities
294///
295/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
296/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
297///
298/// * [locations delivery pipelines releases rollouts advance projects](ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall) (response)
299#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
300#[serde_with::serde_as]
301#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
302pub struct AdvanceRolloutResponse {
303 _never_set: Option<bool>,
304}
305
306impl common::ResponseResult for AdvanceRolloutResponse {}
307
308/// The `AdvanceRollout` automation rule will automatically advance a successful Rollout to the next phase.
309///
310/// This type is not used in any activity, and only used as *part* of another schema.
311///
312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
313#[serde_with::serde_as]
314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
315pub struct AdvanceRolloutRule {
316 /// Output only. Information around the state of the Automation rule.
317 pub condition: Option<AutomationRuleCondition>,
318 /// 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])?`.
319 pub id: Option<String>,
320 /// 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])?$`.
321 #[serde(rename = "sourcePhases")]
322 pub source_phases: Option<Vec<String>>,
323 /// Optional. How long to wait after a rollout is finished.
324 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
325 pub wait: Option<chrono::Duration>,
326}
327
328impl common::Part for AdvanceRolloutRule {}
329
330/// Information specifying an Anthos Cluster.
331///
332/// This type is not used in any activity, and only used as *part* of another schema.
333///
334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
335#[serde_with::serde_as]
336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
337pub struct AnthosCluster {
338 /// Optional. Membership of the GKE Hub-registered cluster to which to apply the Skaffold configuration. Format is `projects/{project}/locations/{location}/memberships/{membership_name}`.
339 pub membership: Option<String>,
340}
341
342impl common::Part for AnthosCluster {}
343
344/// The request object used by `ApproveRollout`.
345///
346/// # Activities
347///
348/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
349/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
350///
351/// * [locations delivery pipelines releases rollouts approve projects](ProjectLocationDeliveryPipelineReleaseRolloutApproveCall) (request)
352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
353#[serde_with::serde_as]
354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
355pub struct ApproveRolloutRequest {
356 /// Required. True = approve; false = reject
357 pub approved: Option<bool>,
358 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
359 #[serde(rename = "overrideDeployPolicy")]
360 pub override_deploy_policy: Option<Vec<String>>,
361}
362
363impl common::RequestValue for ApproveRolloutRequest {}
364
365/// The response object from `ApproveRollout`.
366///
367/// # Activities
368///
369/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
370/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
371///
372/// * [locations delivery pipelines releases rollouts approve projects](ProjectLocationDeliveryPipelineReleaseRolloutApproveCall) (response)
373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
374#[serde_with::serde_as]
375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
376pub struct ApproveRolloutResponse {
377 _never_set: Option<bool>,
378}
379
380impl common::ResponseResult for ApproveRolloutResponse {}
381
382/// Information about entities associated with a `Target`.
383///
384/// This type is not used in any activity, and only used as *part* of another schema.
385///
386#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
387#[serde_with::serde_as]
388#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
389pub struct AssociatedEntities {
390 /// Optional. Information specifying Anthos clusters as associated entities.
391 #[serde(rename = "anthosClusters")]
392 pub anthos_clusters: Option<Vec<AnthosCluster>>,
393 /// Optional. Information specifying GKE clusters as associated entities.
394 #[serde(rename = "gkeClusters")]
395 pub gke_clusters: Option<Vec<GkeCluster>>,
396}
397
398impl common::Part for AssociatedEntities {}
399
400/// 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.
401///
402/// This type is not used in any activity, and only used as *part* of another schema.
403///
404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
405#[serde_with::serde_as]
406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
407pub struct AuditConfig {
408 /// The configuration for logging of each type of permission.
409 #[serde(rename = "auditLogConfigs")]
410 pub audit_log_configs: Option<Vec<AuditLogConfig>>,
411 /// 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.
412 pub service: Option<String>,
413}
414
415impl common::Part for AuditConfig {}
416
417/// 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.
418///
419/// This type is not used in any activity, and only used as *part* of another schema.
420///
421#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
422#[serde_with::serde_as]
423#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
424pub struct AuditLogConfig {
425 /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members.
426 #[serde(rename = "exemptedMembers")]
427 pub exempted_members: Option<Vec<String>>,
428 /// The log type that this config enables.
429 #[serde(rename = "logType")]
430 pub log_type: Option<String>,
431}
432
433impl common::Part for AuditLogConfig {}
434
435/// 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.
436///
437/// # Activities
438///
439/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
440/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
441///
442/// * [locations delivery pipelines automations create projects](ProjectLocationDeliveryPipelineAutomationCreateCall) (request)
443/// * [locations delivery pipelines automations get projects](ProjectLocationDeliveryPipelineAutomationGetCall) (response)
444/// * [locations delivery pipelines automations patch projects](ProjectLocationDeliveryPipelineAutomationPatchCall) (request)
445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
446#[serde_with::serde_as]
447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
448pub struct Automation {
449 /// 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.
450 pub annotations: Option<HashMap<String, String>>,
451 /// Output only. Time at which the automation was created.
452 #[serde(rename = "createTime")]
453 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
454 /// Optional. Description of the `Automation`. Max length is 255 characters.
455 pub description: Option<String>,
456 /// 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.
457 pub etag: Option<String>,
458 /// 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.
459 pub labels: Option<HashMap<String, String>>,
460 /// Output only. Name of the `Automation`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automations/{automation}`.
461 pub name: Option<String>,
462 /// 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.
463 pub rules: Option<Vec<AutomationRule>>,
464 /// Required. Selected resources to which the automation will be applied.
465 pub selector: Option<AutomationResourceSelector>,
466 /// Required. Email address of the user-managed IAM service account that creates Cloud Deploy release and rollout resources.
467 #[serde(rename = "serviceAccount")]
468 pub service_account: Option<String>,
469 /// Optional. When Suspended, automation is deactivated from execution.
470 pub suspended: Option<bool>,
471 /// Output only. Unique identifier of the `Automation`.
472 pub uid: Option<String>,
473 /// Output only. Time at which the automation was updated.
474 #[serde(rename = "updateTime")]
475 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
476}
477
478impl common::RequestValue for Automation {}
479impl common::ResponseResult for Automation {}
480
481/// AutomationResourceSelector contains the information to select the resources to which an Automation is going to be applied.
482///
483/// This type is not used in any activity, and only used as *part* of another schema.
484///
485#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
486#[serde_with::serde_as]
487#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
488pub struct AutomationResourceSelector {
489 /// Optional. Contains attributes about a target.
490 pub targets: Option<Vec<TargetAttribute>>,
491}
492
493impl common::Part for AutomationResourceSelector {}
494
495/// AutomationRolloutMetadata contains Automation-related actions that were performed on a rollout.
496///
497/// This type is not used in any activity, and only used as *part* of another schema.
498///
499#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
500#[serde_with::serde_as]
501#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
502pub struct AutomationRolloutMetadata {
503 /// Output only. The names of the AutomationRuns initiated by an advance rollout rule.
504 #[serde(rename = "advanceAutomationRuns")]
505 pub advance_automation_runs: Option<Vec<String>>,
506 /// Output only. The name of the AutomationRun initiated by a promote release rule.
507 #[serde(rename = "promoteAutomationRun")]
508 pub promote_automation_run: Option<String>,
509 /// Output only. The names of the AutomationRuns initiated by a repair rollout rule.
510 #[serde(rename = "repairAutomationRuns")]
511 pub repair_automation_runs: Option<Vec<String>>,
512}
513
514impl common::Part for AutomationRolloutMetadata {}
515
516/// `AutomationRule` defines the automation activities.
517///
518/// This type is not used in any activity, and only used as *part* of another schema.
519///
520#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
521#[serde_with::serde_as]
522#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
523pub struct AutomationRule {
524 /// Optional. The `AdvanceRolloutRule` will automatically advance a successful Rollout.
525 #[serde(rename = "advanceRolloutRule")]
526 pub advance_rollout_rule: Option<AdvanceRolloutRule>,
527 /// Optional. `PromoteReleaseRule` will automatically promote a release from the current target to a specified target.
528 #[serde(rename = "promoteReleaseRule")]
529 pub promote_release_rule: Option<PromoteReleaseRule>,
530 /// Optional. The `RepairRolloutRule` will automatically repair a failed rollout.
531 #[serde(rename = "repairRolloutRule")]
532 pub repair_rollout_rule: Option<RepairRolloutRule>,
533 /// Optional. The `TimedPromoteReleaseRule` will automatically promote a release from the current target(s) to the specified target(s) on a configured schedule.
534 #[serde(rename = "timedPromoteReleaseRule")]
535 pub timed_promote_release_rule: Option<TimedPromoteReleaseRule>,
536}
537
538impl common::Part for AutomationRule {}
539
540/// `AutomationRuleCondition` contains conditions relevant to an `Automation` rule.
541///
542/// This type is not used in any activity, and only used as *part* of another schema.
543///
544#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
545#[serde_with::serde_as]
546#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
547pub struct AutomationRuleCondition {
548 /// Optional. Details around targets enumerated in the rule.
549 #[serde(rename = "targetsPresentCondition")]
550 pub targets_present_condition: Option<TargetsPresentCondition>,
551 /// Optional. TimedPromoteReleaseCondition contains rule conditions specific to a an Automation with a timed promote release rule defined.
552 #[serde(rename = "timedPromoteReleaseCondition")]
553 pub timed_promote_release_condition: Option<TimedPromoteReleaseCondition>,
554}
555
556impl common::Part for AutomationRuleCondition {}
557
558/// An `AutomationRun` resource in the Cloud Deploy API. An `AutomationRun` represents an execution instance of an automation rule.
559///
560/// # Activities
561///
562/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
563/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
564///
565/// * [locations delivery pipelines automation runs get projects](ProjectLocationDeliveryPipelineAutomationRunGetCall) (response)
566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
567#[serde_with::serde_as]
568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
569pub struct AutomationRun {
570 /// Output only. Advances a rollout to the next phase.
571 #[serde(rename = "advanceRolloutOperation")]
572 pub advance_rollout_operation: Option<AdvanceRolloutOperation>,
573 /// Output only. The ID of the automation that initiated the operation.
574 #[serde(rename = "automationId")]
575 pub automation_id: Option<String>,
576 /// Output only. Snapshot of the Automation taken at AutomationRun creation time.
577 #[serde(rename = "automationSnapshot")]
578 pub automation_snapshot: Option<Automation>,
579 /// Output only. Time at which the `AutomationRun` was created.
580 #[serde(rename = "createTime")]
581 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
582 /// 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.
583 pub etag: Option<String>,
584 /// Output only. Time the `AutomationRun` expires. An `AutomationRun` expires after 14 days from its creation date.
585 #[serde(rename = "expireTime")]
586 pub expire_time: Option<chrono::DateTime<chrono::offset::Utc>>,
587 /// Output only. Name of the `AutomationRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
588 pub name: Option<String>,
589 /// Output only. Contains information about what policies prevented the `AutomationRun` from proceeding.
590 #[serde(rename = "policyViolation")]
591 pub policy_violation: Option<PolicyViolation>,
592 /// Output only. Promotes a release to a specified 'Target'.
593 #[serde(rename = "promoteReleaseOperation")]
594 pub promote_release_operation: Option<PromoteReleaseOperation>,
595 /// Output only. Repairs a failed 'Rollout'.
596 #[serde(rename = "repairRolloutOperation")]
597 pub repair_rollout_operation: Option<RepairRolloutOperation>,
598 /// Output only. The ID of the automation rule that initiated the operation.
599 #[serde(rename = "ruleId")]
600 pub rule_id: Option<String>,
601 /// Output only. Email address of the user-managed IAM service account that performs the operations against Cloud Deploy resources.
602 #[serde(rename = "serviceAccount")]
603 pub service_account: Option<String>,
604 /// Output only. Current state of the `AutomationRun`.
605 pub state: Option<String>,
606 /// Output only. Explains the current state of the `AutomationRun`. Present only when an explanation is needed.
607 #[serde(rename = "stateDescription")]
608 pub state_description: Option<String>,
609 /// Output only. The ID of the source target that initiates the `AutomationRun`. The value of this field is the last segment of a target name.
610 #[serde(rename = "targetId")]
611 pub target_id: Option<String>,
612 /// Output only. Promotes a release to a specified 'Target' as defined in a Timed Promote Release rule.
613 #[serde(rename = "timedPromoteReleaseOperation")]
614 pub timed_promote_release_operation: Option<TimedPromoteReleaseOperation>,
615 /// Output only. Time at which the automationRun was updated.
616 #[serde(rename = "updateTime")]
617 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
618 /// Output only. Earliest time the `AutomationRun` will attempt to resume. Wait-time is configured by `wait` in automation rule.
619 #[serde(rename = "waitUntilTime")]
620 pub wait_until_time: Option<chrono::DateTime<chrono::offset::Utc>>,
621}
622
623impl common::ResponseResult for AutomationRun {}
624
625/// Associates `members`, or principals, with a `role`.
626///
627/// This type is not used in any activity, and only used as *part* of another schema.
628///
629#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
630#[serde_with::serde_as]
631#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
632pub struct Binding {
633 /// 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).
634 pub condition: Option<Expr>,
635 /// 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`.
636 pub members: Option<Vec<String>>,
637 /// 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).
638 pub role: Option<String>,
639}
640
641impl common::Part for Binding {}
642
643/// Description of an a image to use during Skaffold rendering.
644///
645/// This type is not used in any activity, and only used as *part* of another schema.
646///
647#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
648#[serde_with::serde_as]
649#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
650pub struct BuildArtifact {
651 /// Optional. Image name in Skaffold configuration.
652 pub image: Option<String>,
653 /// Optional. 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".
654 pub tag: Option<String>,
655}
656
657impl common::Part for BuildArtifact {}
658
659/// Canary represents the canary deployment strategy.
660///
661/// This type is not used in any activity, and only used as *part* of another schema.
662///
663#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
664#[serde_with::serde_as]
665#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
666pub struct Canary {
667 /// Optional. Configures the progressive based deployment for a Target.
668 #[serde(rename = "canaryDeployment")]
669 pub canary_deployment: Option<CanaryDeployment>,
670 /// Optional. Configures the progressive based deployment for a Target, but allows customizing at the phase level where a phase represents each of the percentage deployments.
671 #[serde(rename = "customCanaryDeployment")]
672 pub custom_canary_deployment: Option<CustomCanaryDeployment>,
673 /// 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.
674 #[serde(rename = "runtimeConfig")]
675 pub runtime_config: Option<RuntimeConfig>,
676}
677
678impl common::Part for Canary {}
679
680/// CanaryDeployment represents the canary deployment configuration
681///
682/// This type is not used in any activity, and only used as *part* of another schema.
683///
684#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
685#[serde_with::serde_as]
686#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
687pub struct CanaryDeployment {
688 /// 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.
689 pub percentages: Option<Vec<i32>>,
690 /// Optional. Configuration for the postdeploy job of the last phase. If this is not configured, there will be no postdeploy job for this phase.
691 pub postdeploy: Option<Postdeploy>,
692 /// Optional. Configuration for the predeploy job of the first phase. If this is not configured, there will be no predeploy job for this phase.
693 pub predeploy: Option<Predeploy>,
694 /// Optional. Whether to run verify tests after each percentage deployment via `skaffold verify`.
695 pub verify: Option<bool>,
696}
697
698impl common::Part for CanaryDeployment {}
699
700/// The request object used by `CancelAutomationRun`.
701///
702/// # Activities
703///
704/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
705/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
706///
707/// * [locations delivery pipelines automation runs cancel projects](ProjectLocationDeliveryPipelineAutomationRunCancelCall) (request)
708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
709#[serde_with::serde_as]
710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
711pub struct CancelAutomationRunRequest {
712 _never_set: Option<bool>,
713}
714
715impl common::RequestValue for CancelAutomationRunRequest {}
716
717/// The response object from `CancelAutomationRun`.
718///
719/// # Activities
720///
721/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
722/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
723///
724/// * [locations delivery pipelines automation runs cancel projects](ProjectLocationDeliveryPipelineAutomationRunCancelCall) (response)
725#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
726#[serde_with::serde_as]
727#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
728pub struct CancelAutomationRunResponse {
729 _never_set: Option<bool>,
730}
731
732impl common::ResponseResult for CancelAutomationRunResponse {}
733
734/// The request message for Operations.CancelOperation.
735///
736/// # Activities
737///
738/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
739/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
740///
741/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
742#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
743#[serde_with::serde_as]
744#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
745pub struct CancelOperationRequest {
746 _never_set: Option<bool>,
747}
748
749impl common::RequestValue for CancelOperationRequest {}
750
751/// The request object used by `CancelRollout`.
752///
753/// # Activities
754///
755/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
756/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
757///
758/// * [locations delivery pipelines releases rollouts cancel projects](ProjectLocationDeliveryPipelineReleaseRolloutCancelCall) (request)
759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
760#[serde_with::serde_as]
761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
762pub struct CancelRolloutRequest {
763 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
764 #[serde(rename = "overrideDeployPolicy")]
765 pub override_deploy_policy: Option<Vec<String>>,
766}
767
768impl common::RequestValue for CancelRolloutRequest {}
769
770/// The response object from `CancelRollout`.
771///
772/// # Activities
773///
774/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
775/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
776///
777/// * [locations delivery pipelines releases rollouts cancel projects](ProjectLocationDeliveryPipelineReleaseRolloutCancelCall) (response)
778#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
779#[serde_with::serde_as]
780#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
781pub struct CancelRolloutResponse {
782 _never_set: Option<bool>,
783}
784
785impl common::ResponseResult for CancelRolloutResponse {}
786
787/// ChildRollouts job composition
788///
789/// This type is not used in any activity, and only used as *part* of another schema.
790///
791#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
792#[serde_with::serde_as]
793#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
794pub struct ChildRolloutJobs {
795 /// Output only. List of AdvanceChildRolloutJobs
796 #[serde(rename = "advanceRolloutJobs")]
797 pub advance_rollout_jobs: Option<Vec<Job>>,
798 /// Output only. List of CreateChildRolloutJobs
799 #[serde(rename = "createRolloutJobs")]
800 pub create_rollout_jobs: Option<Vec<Job>>,
801}
802
803impl common::Part for ChildRolloutJobs {}
804
805/// CloudRunConfig contains the Cloud Run runtime configuration.
806///
807/// This type is not used in any activity, and only used as *part* of another schema.
808///
809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
810#[serde_with::serde_as]
811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
812pub struct CloudRunConfig {
813 /// Optional. 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.
814 #[serde(rename = "automaticTrafficControl")]
815 pub automatic_traffic_control: Option<bool>,
816 /// Optional. A list of tags that are added to the canary revision while the canary phase is in progress.
817 #[serde(rename = "canaryRevisionTags")]
818 pub canary_revision_tags: Option<Vec<String>>,
819 /// Optional. A list of tags that are added to the prior revision while the canary phase is in progress.
820 #[serde(rename = "priorRevisionTags")]
821 pub prior_revision_tags: Option<Vec<String>>,
822 /// Optional. A list of tags that are added to the final stable revision when the stable phase is applied.
823 #[serde(rename = "stableRevisionTags")]
824 pub stable_revision_tags: Option<Vec<String>>,
825}
826
827impl common::Part for CloudRunConfig {}
828
829/// Information specifying where to deploy a Cloud Run Service.
830///
831/// This type is not used in any activity, and only used as *part* of another schema.
832///
833#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
834#[serde_with::serde_as]
835#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
836pub struct CloudRunLocation {
837 /// Required. The location for the Cloud Run Service. Format must be `projects/{project}/locations/{location}`.
838 pub location: Option<String>,
839}
840
841impl common::Part for CloudRunLocation {}
842
843/// CloudRunMetadata contains information from a Cloud Run deployment.
844///
845/// This type is not used in any activity, and only used as *part* of another schema.
846///
847#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
848#[serde_with::serde_as]
849#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
850pub struct CloudRunMetadata {
851 /// Output only. The name of the Cloud Run job that is associated with a `Rollout`. Format is `projects/{project}/locations/{location}/jobs/{job_name}`.
852 pub job: Option<String>,
853 /// Output only. The Cloud Run Revision id associated with a `Rollout`.
854 pub revision: Option<String>,
855 /// Output only. The name of the Cloud Run Service that is associated with a `Rollout`. Format is `projects/{project}/locations/{location}/services/{service}`.
856 pub service: Option<String>,
857 /// Output only. The Cloud Run Service urls that are associated with a `Rollout`.
858 #[serde(rename = "serviceUrls")]
859 pub service_urls: Option<Vec<String>>,
860}
861
862impl common::Part for CloudRunMetadata {}
863
864/// CloudRunRenderMetadata contains Cloud Run information associated with a `Release` render.
865///
866/// This type is not used in any activity, and only used as *part* of another schema.
867///
868#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
869#[serde_with::serde_as]
870#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
871pub struct CloudRunRenderMetadata {
872 /// Output only. The name of the Cloud Run Service in the rendered manifest. Format is `projects/{project}/locations/{location}/services/{service}`.
873 pub service: Option<String>,
874}
875
876impl common::Part for CloudRunRenderMetadata {}
877
878/// Service-wide configuration.
879///
880/// # Activities
881///
882/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
883/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
884///
885/// * [locations get config projects](ProjectLocationGetConfigCall) (response)
886#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
887#[serde_with::serde_as]
888#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
889pub struct Config {
890 /// Default Skaffold version that is assigned when a Release is created without specifying a Skaffold version.
891 #[serde(rename = "defaultSkaffoldVersion")]
892 pub default_skaffold_version: Option<String>,
893 /// Output only. Default tool versions. These tool versions are assigned when a Release is created without specifying tool versions.
894 #[serde(rename = "defaultToolVersions")]
895 pub default_tool_versions: Option<ToolVersions>,
896 /// Name of the configuration.
897 pub name: Option<String>,
898 /// All supported versions of Skaffold.
899 #[serde(rename = "supportedVersions")]
900 pub supported_versions: Option<Vec<SkaffoldVersion>>,
901}
902
903impl common::ResponseResult for Config {}
904
905/// A createChildRollout Job.
906///
907/// This type is not used in any activity, and only used as *part* of another schema.
908///
909#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
910#[serde_with::serde_as]
911#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
912pub struct CreateChildRolloutJob {
913 _never_set: Option<bool>,
914}
915
916impl common::Part for CreateChildRolloutJob {}
917
918/// CreateChildRolloutJobRun contains information specific to a createChildRollout `JobRun`.
919///
920/// This type is not used in any activity, and only used as *part* of another schema.
921///
922#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
923#[serde_with::serde_as]
924#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
925pub struct CreateChildRolloutJobRun {
926 /// Output only. Name of the `ChildRollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
927 pub rollout: Option<String>,
928 /// Output only. The ID of the childRollout Phase initiated by this JobRun.
929 #[serde(rename = "rolloutPhaseId")]
930 pub rollout_phase_id: Option<String>,
931}
932
933impl common::Part for CreateChildRolloutJobRun {}
934
935/// CustomCanaryDeployment represents the custom canary deployment configuration.
936///
937/// This type is not used in any activity, and only used as *part* of another schema.
938///
939#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
940#[serde_with::serde_as]
941#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
942pub struct CustomCanaryDeployment {
943 /// Required. Configuration for each phase in the canary deployment in the order executed.
944 #[serde(rename = "phaseConfigs")]
945 pub phase_configs: Option<Vec<PhaseConfig>>,
946}
947
948impl common::Part for CustomCanaryDeployment {}
949
950/// CustomMetadata contains information from a user-defined operation.
951///
952/// This type is not used in any activity, and only used as *part* of another schema.
953///
954#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
955#[serde_with::serde_as]
956#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
957pub struct CustomMetadata {
958 /// Output only. Key-value pairs provided by the user-defined operation.
959 pub values: Option<HashMap<String, String>>,
960}
961
962impl common::Part for CustomMetadata {}
963
964/// Information specifying a Custom Target.
965///
966/// This type is not used in any activity, and only used as *part* of another schema.
967///
968#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
969#[serde_with::serde_as]
970#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
971pub struct CustomTarget {
972 /// Required. The name of the CustomTargetType. Format must be `projects/{project}/locations/{location}/customTargetTypes/{custom_target_type}`.
973 #[serde(rename = "customTargetType")]
974 pub custom_target_type: Option<String>,
975}
976
977impl common::Part for CustomTarget {}
978
979/// CustomTargetDeployMetadata contains information from a Custom Target deploy operation.
980///
981/// This type is not used in any activity, and only used as *part* of another schema.
982///
983#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
984#[serde_with::serde_as]
985#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
986pub struct CustomTargetDeployMetadata {
987 /// Output only. Skip message provided in the results of a custom deploy operation.
988 #[serde(rename = "skipMessage")]
989 pub skip_message: Option<String>,
990}
991
992impl common::Part for CustomTargetDeployMetadata {}
993
994/// CustomTargetSkaffoldActions represents the `CustomTargetType` configuration using Skaffold custom actions.
995///
996/// This type is not used in any activity, and only used as *part* of another schema.
997///
998#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
999#[serde_with::serde_as]
1000#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1001pub struct CustomTargetSkaffoldActions {
1002 /// Required. The Skaffold custom action responsible for deploy operations.
1003 #[serde(rename = "deployAction")]
1004 pub deploy_action: Option<String>,
1005 /// Optional. List of Skaffold modules Cloud Deploy will include in the Skaffold Config as required before performing diagnose.
1006 #[serde(rename = "includeSkaffoldModules")]
1007 pub include_skaffold_modules: Option<Vec<SkaffoldModules>>,
1008 /// Optional. The Skaffold custom action responsible for render operations. If not provided then Cloud Deploy will perform the render operations via `skaffold render`.
1009 #[serde(rename = "renderAction")]
1010 pub render_action: Option<String>,
1011}
1012
1013impl common::Part for CustomTargetSkaffoldActions {}
1014
1015/// 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.
1016///
1017/// # Activities
1018///
1019/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1020/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1021///
1022/// * [locations custom target types create projects](ProjectLocationCustomTargetTypeCreateCall) (request)
1023/// * [locations custom target types get projects](ProjectLocationCustomTargetTypeGetCall) (response)
1024/// * [locations custom target types patch projects](ProjectLocationCustomTargetTypePatchCall) (request)
1025#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1026#[serde_with::serde_as]
1027#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1028pub struct CustomTargetType {
1029 /// 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.
1030 pub annotations: Option<HashMap<String, String>>,
1031 /// Output only. Time at which the `CustomTargetType` was created.
1032 #[serde(rename = "createTime")]
1033 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1034 /// Optional. Configures render and deploy for the `CustomTargetType` using Skaffold custom actions.
1035 #[serde(rename = "customActions")]
1036 pub custom_actions: Option<CustomTargetSkaffoldActions>,
1037 /// Output only. Resource id of the `CustomTargetType`.
1038 #[serde(rename = "customTargetTypeId")]
1039 pub custom_target_type_id: Option<String>,
1040 /// Optional. Description of the `CustomTargetType`. Max length is 255 characters.
1041 pub description: Option<String>,
1042 /// 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.
1043 pub etag: Option<String>,
1044 /// 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.
1045 pub labels: Option<HashMap<String, String>>,
1046 /// Identifier. 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])?`
1047 pub name: Option<String>,
1048 /// Output only. Unique identifier of the `CustomTargetType`.
1049 pub uid: Option<String>,
1050 /// Output only. Most recent time at which the `CustomTargetType` was updated.
1051 #[serde(rename = "updateTime")]
1052 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1053}
1054
1055impl common::RequestValue for CustomTargetType {}
1056impl common::ResponseResult for CustomTargetType {}
1057
1058/// 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
1059///
1060/// This type is not used in any activity, and only used as *part* of another schema.
1061///
1062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1063#[serde_with::serde_as]
1064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1065pub struct Date {
1066 /// 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.
1067 pub day: Option<i32>,
1068 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
1069 pub month: Option<i32>,
1070 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
1071 pub year: Option<i32>,
1072}
1073
1074impl common::Part for Date {}
1075
1076/// Execution using the default Cloud Build pool.
1077///
1078/// This type is not used in any activity, and only used as *part* of another schema.
1079///
1080#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1081#[serde_with::serde_as]
1082#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1083pub struct DefaultPool {
1084 /// 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.
1085 #[serde(rename = "artifactStorage")]
1086 pub artifact_storage: Option<String>,
1087 /// Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) will be used.
1088 #[serde(rename = "serviceAccount")]
1089 pub service_account: Option<String>,
1090}
1091
1092impl common::Part for DefaultPool {}
1093
1094/// A `DeliveryPipeline` resource in the Cloud Deploy API. A `DeliveryPipeline` defines a pipeline through which a Skaffold configuration can progress.
1095///
1096/// # Activities
1097///
1098/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1099/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1100///
1101/// * [locations delivery pipelines create projects](ProjectLocationDeliveryPipelineCreateCall) (request)
1102/// * [locations delivery pipelines get projects](ProjectLocationDeliveryPipelineGetCall) (response)
1103/// * [locations delivery pipelines patch projects](ProjectLocationDeliveryPipelinePatchCall) (request)
1104#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1105#[serde_with::serde_as]
1106#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1107pub struct DeliveryPipeline {
1108 /// Optional. User annotations. These attributes can only be set and used by the user, and not by Cloud Deploy.
1109 pub annotations: Option<HashMap<String, String>>,
1110 /// Output only. Information around the state of the Delivery Pipeline.
1111 pub condition: Option<PipelineCondition>,
1112 /// Output only. Time at which the pipeline was created.
1113 #[serde(rename = "createTime")]
1114 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1115 /// Optional. Description of the `DeliveryPipeline`. Max length is 255 characters.
1116 pub description: Option<String>,
1117 /// 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.
1118 pub etag: Option<String>,
1119 /// 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.
1120 pub labels: Option<HashMap<String, String>>,
1121 /// Identifier. 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])?`
1122 pub name: Option<String>,
1123 /// Optional. SerialPipeline defines a sequential set of stages for a `DeliveryPipeline`.
1124 #[serde(rename = "serialPipeline")]
1125 pub serial_pipeline: Option<SerialPipeline>,
1126 /// Optional. When suspended, no new releases or rollouts can be created, but in-progress ones will complete.
1127 pub suspended: Option<bool>,
1128 /// Output only. Unique identifier of the `DeliveryPipeline`.
1129 pub uid: Option<String>,
1130 /// Output only. Most recent time at which the pipeline was updated.
1131 #[serde(rename = "updateTime")]
1132 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1133}
1134
1135impl common::RequestValue for DeliveryPipeline {}
1136impl common::ResponseResult for DeliveryPipeline {}
1137
1138/// Contains criteria for selecting DeliveryPipelines.
1139///
1140/// This type is not used in any activity, and only used as *part* of another schema.
1141///
1142#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1143#[serde_with::serde_as]
1144#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1145pub struct DeliveryPipelineAttribute {
1146 /// Optional. ID of the `DeliveryPipeline`. The value of this field could be one of the following: * The last segment of a pipeline name * "*", all delivery pipelines in a location
1147 pub id: Option<String>,
1148 /// DeliveryPipeline labels.
1149 pub labels: Option<HashMap<String, String>>,
1150}
1151
1152impl common::Part for DeliveryPipelineAttribute {}
1153
1154/// The artifacts produced by a deploy operation.
1155///
1156/// This type is not used in any activity, and only used as *part* of another schema.
1157///
1158#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1159#[serde_with::serde_as]
1160#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1161pub struct DeployArtifact {
1162 /// Output only. URI of a directory containing the artifacts. All paths are relative to this location.
1163 #[serde(rename = "artifactUri")]
1164 pub artifact_uri: Option<String>,
1165 /// Output only. File paths of the manifests applied during the deploy operation relative to the URI.
1166 #[serde(rename = "manifestPaths")]
1167 pub manifest_paths: Option<Vec<String>>,
1168}
1169
1170impl common::Part for DeployArtifact {}
1171
1172/// A deploy Job.
1173///
1174/// This type is not used in any activity, and only used as *part* of another schema.
1175///
1176#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1177#[serde_with::serde_as]
1178#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1179pub struct DeployJob {
1180 _never_set: Option<bool>,
1181}
1182
1183impl common::Part for DeployJob {}
1184
1185/// DeployJobRun contains information specific to a deploy `JobRun`.
1186///
1187/// This type is not used in any activity, and only used as *part* of another schema.
1188///
1189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1190#[serde_with::serde_as]
1191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1192pub struct DeployJobRun {
1193 /// Output only. The artifact of a deploy job run, if available.
1194 pub artifact: Option<DeployArtifact>,
1195 /// Output only. The resource name of the Cloud Build `Build` object that is used to deploy. Format is `projects/{project}/locations/{location}/builds/{build}`.
1196 pub build: Option<String>,
1197 /// Output only. The reason the deploy failed. This will always be unspecified while the deploy is in progress or if it succeeded.
1198 #[serde(rename = "failureCause")]
1199 pub failure_cause: Option<String>,
1200 /// Output only. Additional information about the deploy failure, if available.
1201 #[serde(rename = "failureMessage")]
1202 pub failure_message: Option<String>,
1203 /// Output only. Metadata containing information about the deploy job run.
1204 pub metadata: Option<DeployJobRunMetadata>,
1205}
1206
1207impl common::Part for DeployJobRun {}
1208
1209/// DeployJobRunMetadata surfaces information associated with a `DeployJobRun` to the user.
1210///
1211/// This type is not used in any activity, and only used as *part* of another schema.
1212///
1213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1214#[serde_with::serde_as]
1215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1216pub struct DeployJobRunMetadata {
1217 /// Output only. The name of the Cloud Run Service that is associated with a `DeployJobRun`.
1218 #[serde(rename = "cloudRun")]
1219 pub cloud_run: Option<CloudRunMetadata>,
1220 /// Output only. Custom metadata provided by user-defined deploy operation.
1221 pub custom: Option<CustomMetadata>,
1222 /// Output only. Custom Target metadata associated with a `DeployJobRun`.
1223 #[serde(rename = "customTarget")]
1224 pub custom_target: Option<CustomTargetDeployMetadata>,
1225}
1226
1227impl common::Part for DeployJobRunMetadata {}
1228
1229/// DeployParameters contains deploy parameters information.
1230///
1231/// This type is not used in any activity, and only used as *part* of another schema.
1232///
1233#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1234#[serde_with::serde_as]
1235#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1236pub struct DeployParameters {
1237 /// 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).
1238 #[serde(rename = "matchTargetLabels")]
1239 pub match_target_labels: Option<HashMap<String, String>>,
1240 /// Required. Values are deploy parameters in key-value pairs.
1241 pub values: Option<HashMap<String, String>>,
1242}
1243
1244impl common::Part for DeployParameters {}
1245
1246/// A `DeployPolicy` resource in the Cloud Deploy API. A `DeployPolicy` inhibits manual or automation-driven actions within a Delivery Pipeline or Target.
1247///
1248/// # Activities
1249///
1250/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1251/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1252///
1253/// * [locations deploy policies create projects](ProjectLocationDeployPolicyCreateCall) (request)
1254/// * [locations deploy policies get projects](ProjectLocationDeployPolicyGetCall) (response)
1255/// * [locations deploy policies patch projects](ProjectLocationDeployPolicyPatchCall) (request)
1256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1257#[serde_with::serde_as]
1258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1259pub struct DeployPolicy {
1260 /// 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.
1261 pub annotations: Option<HashMap<String, String>>,
1262 /// Output only. Time at which the deploy policy was created.
1263 #[serde(rename = "createTime")]
1264 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1265 /// Optional. Description of the `DeployPolicy`. Max length is 255 characters.
1266 pub description: Option<String>,
1267 /// The weak etag of the `DeployPolicy` 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.
1268 pub etag: Option<String>,
1269 /// 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.
1270 pub labels: Option<HashMap<String, String>>,
1271 /// Output only. Name of the `DeployPolicy`. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`. The `deployPolicy` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
1272 pub name: Option<String>,
1273 /// Required. Rules to apply. At least one rule must be present.
1274 pub rules: Option<Vec<PolicyRule>>,
1275 /// Required. Selected resources to which the policy will be applied. At least one selector is required. If one selector matches the resource the policy applies. For example, if there are two selectors and the action being attempted matches one of them, the policy will apply to that action.
1276 pub selectors: Option<Vec<DeployPolicyResourceSelector>>,
1277 /// Optional. When suspended, the policy will not prevent actions from occurring, even if the action violates the policy.
1278 pub suspended: Option<bool>,
1279 /// Output only. Unique identifier of the `DeployPolicy`.
1280 pub uid: Option<String>,
1281 /// Output only. Most recent time at which the deploy policy was updated.
1282 #[serde(rename = "updateTime")]
1283 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1284}
1285
1286impl common::RequestValue for DeployPolicy {}
1287impl common::ResponseResult for DeployPolicy {}
1288
1289/// Contains information on the resources to select for a deploy policy. Attributes provided must all match the resource in order for policy restrictions to apply. For example, if delivery pipelines attributes given are an id "prod" and labels "foo: bar", a delivery pipeline resource must match both that id and have that label in order to be subject to the policy.
1290///
1291/// This type is not used in any activity, and only used as *part* of another schema.
1292///
1293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1294#[serde_with::serde_as]
1295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1296pub struct DeployPolicyResourceSelector {
1297 /// Optional. Contains attributes about a delivery pipeline.
1298 #[serde(rename = "deliveryPipeline")]
1299 pub delivery_pipeline: Option<DeliveryPipelineAttribute>,
1300 /// Optional. Contains attributes about a target.
1301 pub target: Option<TargetAttribute>,
1302}
1303
1304impl common::Part for DeployPolicyResourceSelector {}
1305
1306/// Deployment job composition.
1307///
1308/// This type is not used in any activity, and only used as *part* of another schema.
1309///
1310#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1311#[serde_with::serde_as]
1312#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1313pub struct DeploymentJobs {
1314 /// Output only. The deploy Job. This is the deploy job in the phase.
1315 #[serde(rename = "deployJob")]
1316 pub deploy_job: Option<Job>,
1317 /// Output only. The postdeploy Job, which is the last job on the phase.
1318 #[serde(rename = "postdeployJob")]
1319 pub postdeploy_job: Option<Job>,
1320 /// Output only. The predeploy Job, which is the first job on the phase.
1321 #[serde(rename = "predeployJob")]
1322 pub predeploy_job: Option<Job>,
1323 /// Output only. The verify Job. Runs after a deploy if the deploy succeeds.
1324 #[serde(rename = "verifyJob")]
1325 pub verify_job: Option<Job>,
1326}
1327
1328impl common::Part for DeploymentJobs {}
1329
1330/// 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); }
1331///
1332/// # Activities
1333///
1334/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1335/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1336///
1337/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1338/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
1339#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1340#[serde_with::serde_as]
1341#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1342pub struct Empty {
1343 _never_set: Option<bool>,
1344}
1345
1346impl common::ResponseResult for Empty {}
1347
1348/// Configuration of the environment to use when calling Skaffold.
1349///
1350/// This type is not used in any activity, and only used as *part* of another schema.
1351///
1352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1353#[serde_with::serde_as]
1354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1355pub struct ExecutionConfig {
1356 /// 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.
1357 #[serde(rename = "artifactStorage")]
1358 pub artifact_storage: Option<String>,
1359 /// Optional. Use default Cloud Build pool.
1360 #[serde(rename = "defaultPool")]
1361 pub default_pool: Option<DefaultPool>,
1362 /// 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.
1363 #[serde(rename = "executionTimeout")]
1364 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1365 pub execution_timeout: Option<chrono::Duration>,
1366 /// Optional. Use private Cloud Build pool.
1367 #[serde(rename = "privatePool")]
1368 pub private_pool: Option<PrivatePool>,
1369 /// Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) is used.
1370 #[serde(rename = "serviceAccount")]
1371 pub service_account: Option<String>,
1372 /// Required. Usages when this configuration should be applied.
1373 pub usages: Option<Vec<String>>,
1374 /// Optional. If true, additional logging will be enabled when running builds in this execution environment.
1375 pub verbose: Option<bool>,
1376 /// 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.
1377 #[serde(rename = "workerPool")]
1378 pub worker_pool: Option<String>,
1379}
1380
1381impl common::Part for ExecutionConfig {}
1382
1383/// 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.
1384///
1385/// This type is not used in any activity, and only used as *part* of another schema.
1386///
1387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1388#[serde_with::serde_as]
1389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1390pub struct Expr {
1391 /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI.
1392 pub description: Option<String>,
1393 /// Textual representation of an expression in Common Expression Language syntax.
1394 pub expression: Option<String>,
1395 /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file.
1396 pub location: Option<String>,
1397 /// 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.
1398 pub title: Option<String>,
1399}
1400
1401impl common::Part for Expr {}
1402
1403/// Information about the Kubernetes Gateway API service mesh configuration.
1404///
1405/// This type is not used in any activity, and only used as *part* of another schema.
1406///
1407#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1408#[serde_with::serde_as]
1409#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1410pub struct GatewayServiceMesh {
1411 /// Required. Name of the Kubernetes Deployment whose traffic is managed by the specified HTTPRoute and Service.
1412 pub deployment: Option<String>,
1413 /// Required. Name of the Gateway API HTTPRoute.
1414 #[serde(rename = "httpRoute")]
1415 pub http_route: Option<String>,
1416 /// Optional. The label to use when selecting Pods for the Deployment and Service resources. This label must already be present in both resources.
1417 #[serde(rename = "podSelectorLabel")]
1418 pub pod_selector_label: Option<String>,
1419 /// Optional. Route destinations allow configuring the Gateway API HTTPRoute to be deployed to additional clusters. This option is available for multi-cluster service mesh set ups that require the route to exist in the clusters that call the service. If unspecified, the HTTPRoute will only be deployed to the Target cluster.
1420 #[serde(rename = "routeDestinations")]
1421 pub route_destinations: Option<RouteDestinations>,
1422 /// 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.
1423 #[serde(rename = "routeUpdateWaitTime")]
1424 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1425 pub route_update_wait_time: Option<chrono::Duration>,
1426 /// Required. Name of the Kubernetes Service.
1427 pub service: Option<String>,
1428 /// 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.
1429 #[serde(rename = "stableCutbackDuration")]
1430 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
1431 pub stable_cutback_duration: Option<chrono::Duration>,
1432}
1433
1434impl common::Part for GatewayServiceMesh {}
1435
1436/// Information specifying a GKE Cluster.
1437///
1438/// This type is not used in any activity, and only used as *part* of another schema.
1439///
1440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1441#[serde_with::serde_as]
1442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1443pub struct GkeCluster {
1444 /// Optional. Information specifying a GKE Cluster. Format is `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`.
1445 pub cluster: Option<String>,
1446 /// Optional. If set, the cluster will be accessed using the DNS endpoint. Note that both `dns_endpoint` and `internal_ip` cannot be set to true.
1447 #[serde(rename = "dnsEndpoint")]
1448 pub dns_endpoint: Option<bool>,
1449 /// 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). Note that `internal_ip` and `dns_endpoint` cannot both be set to true.
1450 #[serde(rename = "internalIp")]
1451 pub internal_ip: Option<bool>,
1452 /// Optional. If set, used to configure a [proxy](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#proxy) to the Kubernetes server.
1453 #[serde(rename = "proxyUrl")]
1454 pub proxy_url: Option<String>,
1455}
1456
1457impl common::Part for GkeCluster {}
1458
1459/// The request object used by `IgnoreJob`.
1460///
1461/// # Activities
1462///
1463/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1464/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1465///
1466/// * [locations delivery pipelines releases rollouts ignore job projects](ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall) (request)
1467#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1468#[serde_with::serde_as]
1469#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1470pub struct IgnoreJobRequest {
1471 /// Required. The job ID for the Job to ignore.
1472 #[serde(rename = "jobId")]
1473 pub job_id: Option<String>,
1474 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
1475 #[serde(rename = "overrideDeployPolicy")]
1476 pub override_deploy_policy: Option<Vec<String>>,
1477 /// Required. The phase ID the Job to ignore belongs to.
1478 #[serde(rename = "phaseId")]
1479 pub phase_id: Option<String>,
1480}
1481
1482impl common::RequestValue for IgnoreJobRequest {}
1483
1484/// The response object from `IgnoreJob`.
1485///
1486/// # Activities
1487///
1488/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1489/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1490///
1491/// * [locations delivery pipelines releases rollouts ignore job projects](ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall) (response)
1492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1493#[serde_with::serde_as]
1494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1495pub struct IgnoreJobResponse {
1496 _never_set: Option<bool>,
1497}
1498
1499impl common::ResponseResult for IgnoreJobResponse {}
1500
1501/// Job represents an operation for a `Rollout`.
1502///
1503/// This type is not used in any activity, and only used as *part* of another schema.
1504///
1505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1506#[serde_with::serde_as]
1507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1508pub struct Job {
1509 /// Output only. An advanceChildRollout Job.
1510 #[serde(rename = "advanceChildRolloutJob")]
1511 pub advance_child_rollout_job: Option<AdvanceChildRolloutJob>,
1512 /// Output only. A createChildRollout Job.
1513 #[serde(rename = "createChildRolloutJob")]
1514 pub create_child_rollout_job: Option<CreateChildRolloutJob>,
1515 /// Output only. A deploy Job.
1516 #[serde(rename = "deployJob")]
1517 pub deploy_job: Option<DeployJob>,
1518 /// Output only. The ID of the Job.
1519 pub id: Option<String>,
1520 /// Output only. The name of the `JobRun` responsible for the most recent invocation of this Job.
1521 #[serde(rename = "jobRun")]
1522 pub job_run: Option<String>,
1523 /// Output only. A postdeploy Job.
1524 #[serde(rename = "postdeployJob")]
1525 pub postdeploy_job: Option<PostdeployJob>,
1526 /// Output only. A predeploy Job.
1527 #[serde(rename = "predeployJob")]
1528 pub predeploy_job: Option<PredeployJob>,
1529 /// Output only. Additional information on why the Job was skipped, if available.
1530 #[serde(rename = "skipMessage")]
1531 pub skip_message: Option<String>,
1532 /// Output only. The current state of the Job.
1533 pub state: Option<String>,
1534 /// Output only. A verify Job.
1535 #[serde(rename = "verifyJob")]
1536 pub verify_job: Option<VerifyJob>,
1537}
1538
1539impl common::Part for Job {}
1540
1541/// A `JobRun` resource in the Cloud Deploy API. A `JobRun` contains information of a single `Rollout` job evaluation.
1542///
1543/// # Activities
1544///
1545/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1546/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1547///
1548/// * [locations delivery pipelines releases rollouts job runs get projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall) (response)
1549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1550#[serde_with::serde_as]
1551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1552pub struct JobRun {
1553 /// Output only. Information specific to an advanceChildRollout `JobRun`
1554 #[serde(rename = "advanceChildRolloutJobRun")]
1555 pub advance_child_rollout_job_run: Option<AdvanceChildRolloutJobRun>,
1556 /// Output only. Information specific to a createChildRollout `JobRun`.
1557 #[serde(rename = "createChildRolloutJobRun")]
1558 pub create_child_rollout_job_run: Option<CreateChildRolloutJobRun>,
1559 /// Output only. Time at which the `JobRun` was created.
1560 #[serde(rename = "createTime")]
1561 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1562 /// Output only. Information specific to a deploy `JobRun`.
1563 #[serde(rename = "deployJobRun")]
1564 pub deploy_job_run: Option<DeployJobRun>,
1565 /// Output only. Time at which the `JobRun` ended.
1566 #[serde(rename = "endTime")]
1567 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1568 /// 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.
1569 pub etag: Option<String>,
1570 /// Output only. ID of the `Rollout` job this `JobRun` corresponds to.
1571 #[serde(rename = "jobId")]
1572 pub job_id: Option<String>,
1573 /// Output only. Name of the `JobRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{releases}/rollouts/{rollouts}/jobRuns/{uuid}`.
1574 pub name: Option<String>,
1575 /// Output only. ID of the `Rollout` phase this `JobRun` belongs in.
1576 #[serde(rename = "phaseId")]
1577 pub phase_id: Option<String>,
1578 /// Output only. Information specific to a postdeploy `JobRun`.
1579 #[serde(rename = "postdeployJobRun")]
1580 pub postdeploy_job_run: Option<PostdeployJobRun>,
1581 /// Output only. Information specific to a predeploy `JobRun`.
1582 #[serde(rename = "predeployJobRun")]
1583 pub predeploy_job_run: Option<PredeployJobRun>,
1584 /// Output only. Time at which the `JobRun` was started.
1585 #[serde(rename = "startTime")]
1586 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
1587 /// Output only. The current state of the `JobRun`.
1588 pub state: Option<String>,
1589 /// Output only. Unique identifier of the `JobRun`.
1590 pub uid: Option<String>,
1591 /// Output only. Information specific to a verify `JobRun`.
1592 #[serde(rename = "verifyJobRun")]
1593 pub verify_job_run: Option<VerifyJobRun>,
1594}
1595
1596impl common::ResponseResult for JobRun {}
1597
1598/// KubernetesConfig contains the Kubernetes runtime configuration.
1599///
1600/// This type is not used in any activity, and only used as *part* of another schema.
1601///
1602#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1603#[serde_with::serde_as]
1604#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1605pub struct KubernetesConfig {
1606 /// Optional. Kubernetes Gateway API service mesh configuration.
1607 #[serde(rename = "gatewayServiceMesh")]
1608 pub gateway_service_mesh: Option<GatewayServiceMesh>,
1609 /// Optional. Kubernetes Service networking configuration.
1610 #[serde(rename = "serviceNetworking")]
1611 pub service_networking: Option<ServiceNetworking>,
1612}
1613
1614impl common::Part for KubernetesConfig {}
1615
1616/// The response object from `ListAutomationRuns`.
1617///
1618/// # Activities
1619///
1620/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1621/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1622///
1623/// * [locations delivery pipelines automation runs list projects](ProjectLocationDeliveryPipelineAutomationRunListCall) (response)
1624#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1625#[serde_with::serde_as]
1626#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1627pub struct ListAutomationRunsResponse {
1628 /// The `AutomationRuns` objects.
1629 #[serde(rename = "automationRuns")]
1630 pub automation_runs: Option<Vec<AutomationRun>>,
1631 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1632 #[serde(rename = "nextPageToken")]
1633 pub next_page_token: Option<String>,
1634 /// Locations that could not be reached.
1635 pub unreachable: Option<Vec<String>>,
1636}
1637
1638impl common::ResponseResult for ListAutomationRunsResponse {}
1639
1640/// The response object from `ListAutomations`.
1641///
1642/// # Activities
1643///
1644/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1645/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1646///
1647/// * [locations delivery pipelines automations list projects](ProjectLocationDeliveryPipelineAutomationListCall) (response)
1648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1649#[serde_with::serde_as]
1650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1651pub struct ListAutomationsResponse {
1652 /// The `Automation` objects.
1653 pub automations: Option<Vec<Automation>>,
1654 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1655 #[serde(rename = "nextPageToken")]
1656 pub next_page_token: Option<String>,
1657 /// Locations that could not be reached.
1658 pub unreachable: Option<Vec<String>>,
1659}
1660
1661impl common::ResponseResult for ListAutomationsResponse {}
1662
1663/// The response object from `ListCustomTargetTypes.`
1664///
1665/// # Activities
1666///
1667/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1668/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1669///
1670/// * [locations custom target types list projects](ProjectLocationCustomTargetTypeListCall) (response)
1671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1672#[serde_with::serde_as]
1673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1674pub struct ListCustomTargetTypesResponse {
1675 /// The `CustomTargetType` objects.
1676 #[serde(rename = "customTargetTypes")]
1677 pub custom_target_types: Option<Vec<CustomTargetType>>,
1678 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1679 #[serde(rename = "nextPageToken")]
1680 pub next_page_token: Option<String>,
1681 /// Locations that could not be reached.
1682 pub unreachable: Option<Vec<String>>,
1683}
1684
1685impl common::ResponseResult for ListCustomTargetTypesResponse {}
1686
1687/// The response object from `ListDeliveryPipelines`.
1688///
1689/// # Activities
1690///
1691/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1692/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1693///
1694/// * [locations delivery pipelines list projects](ProjectLocationDeliveryPipelineListCall) (response)
1695#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1696#[serde_with::serde_as]
1697#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1698pub struct ListDeliveryPipelinesResponse {
1699 /// The `DeliveryPipeline` objects.
1700 #[serde(rename = "deliveryPipelines")]
1701 pub delivery_pipelines: Option<Vec<DeliveryPipeline>>,
1702 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1703 #[serde(rename = "nextPageToken")]
1704 pub next_page_token: Option<String>,
1705 /// Locations that could not be reached.
1706 pub unreachable: Option<Vec<String>>,
1707}
1708
1709impl common::ResponseResult for ListDeliveryPipelinesResponse {}
1710
1711/// The response object from `ListDeployPolicies`.
1712///
1713/// # Activities
1714///
1715/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1716/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1717///
1718/// * [locations deploy policies list projects](ProjectLocationDeployPolicyListCall) (response)
1719#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1720#[serde_with::serde_as]
1721#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1722pub struct ListDeployPoliciesResponse {
1723 /// The `DeployPolicy` objects.
1724 #[serde(rename = "deployPolicies")]
1725 pub deploy_policies: Option<Vec<DeployPolicy>>,
1726 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1727 #[serde(rename = "nextPageToken")]
1728 pub next_page_token: Option<String>,
1729 /// Locations that could not be reached.
1730 pub unreachable: Option<Vec<String>>,
1731}
1732
1733impl common::ResponseResult for ListDeployPoliciesResponse {}
1734
1735/// ListJobRunsResponse is the response object returned by `ListJobRuns`.
1736///
1737/// # Activities
1738///
1739/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1740/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1741///
1742/// * [locations delivery pipelines releases rollouts job runs list projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall) (response)
1743#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1744#[serde_with::serde_as]
1745#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1746pub struct ListJobRunsResponse {
1747 /// The `JobRun` objects.
1748 #[serde(rename = "jobRuns")]
1749 pub job_runs: Option<Vec<JobRun>>,
1750 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1751 #[serde(rename = "nextPageToken")]
1752 pub next_page_token: Option<String>,
1753 /// Locations that could not be reached
1754 pub unreachable: Option<Vec<String>>,
1755}
1756
1757impl common::ResponseResult for ListJobRunsResponse {}
1758
1759/// The response message for Locations.ListLocations.
1760///
1761/// # Activities
1762///
1763/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1764/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1765///
1766/// * [locations list projects](ProjectLocationListCall) (response)
1767#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1768#[serde_with::serde_as]
1769#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1770pub struct ListLocationsResponse {
1771 /// A list of locations that matches the specified filter in the request.
1772 pub locations: Option<Vec<Location>>,
1773 /// The standard List next-page token.
1774 #[serde(rename = "nextPageToken")]
1775 pub next_page_token: Option<String>,
1776}
1777
1778impl common::ResponseResult for ListLocationsResponse {}
1779
1780/// The response message for Operations.ListOperations.
1781///
1782/// # Activities
1783///
1784/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1785/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1786///
1787/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1788#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1789#[serde_with::serde_as]
1790#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1791pub struct ListOperationsResponse {
1792 /// The standard List next-page token.
1793 #[serde(rename = "nextPageToken")]
1794 pub next_page_token: Option<String>,
1795 /// A list of operations that matches the specified filter in the request.
1796 pub operations: Option<Vec<Operation>>,
1797 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
1798 pub unreachable: Option<Vec<String>>,
1799}
1800
1801impl common::ResponseResult for ListOperationsResponse {}
1802
1803/// The response object from `ListReleases`.
1804///
1805/// # Activities
1806///
1807/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1808/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1809///
1810/// * [locations delivery pipelines releases list projects](ProjectLocationDeliveryPipelineReleaseListCall) (response)
1811#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1812#[serde_with::serde_as]
1813#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1814pub struct ListReleasesResponse {
1815 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1816 #[serde(rename = "nextPageToken")]
1817 pub next_page_token: Option<String>,
1818 /// The `Release` objects.
1819 pub releases: Option<Vec<Release>>,
1820 /// Locations that could not be reached.
1821 pub unreachable: Option<Vec<String>>,
1822}
1823
1824impl common::ResponseResult for ListReleasesResponse {}
1825
1826/// ListRolloutsResponse is the response object returned by `ListRollouts`.
1827///
1828/// # Activities
1829///
1830/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1831/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1832///
1833/// * [locations delivery pipelines releases rollouts list projects](ProjectLocationDeliveryPipelineReleaseRolloutListCall) (response)
1834#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1835#[serde_with::serde_as]
1836#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1837pub struct ListRolloutsResponse {
1838 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1839 #[serde(rename = "nextPageToken")]
1840 pub next_page_token: Option<String>,
1841 /// The `Rollout` objects.
1842 pub rollouts: Option<Vec<Rollout>>,
1843 /// Locations that could not be reached.
1844 pub unreachable: Option<Vec<String>>,
1845}
1846
1847impl common::ResponseResult for ListRolloutsResponse {}
1848
1849/// The response object from `ListTargets`.
1850///
1851/// # Activities
1852///
1853/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1854/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1855///
1856/// * [locations targets list projects](ProjectLocationTargetListCall) (response)
1857#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1858#[serde_with::serde_as]
1859#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1860pub struct ListTargetsResponse {
1861 /// A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages.
1862 #[serde(rename = "nextPageToken")]
1863 pub next_page_token: Option<String>,
1864 /// The `Target` objects.
1865 pub targets: Option<Vec<Target>>,
1866 /// Locations that could not be reached.
1867 pub unreachable: Option<Vec<String>>,
1868}
1869
1870impl common::ResponseResult for ListTargetsResponse {}
1871
1872/// A resource that represents a Google Cloud location.
1873///
1874/// # Activities
1875///
1876/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1877/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1878///
1879/// * [locations get projects](ProjectLocationGetCall) (response)
1880#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1881#[serde_with::serde_as]
1882#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1883pub struct Location {
1884 /// The friendly name for this location, typically a nearby city name. For example, "Tokyo".
1885 #[serde(rename = "displayName")]
1886 pub display_name: Option<String>,
1887 /// Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
1888 pub labels: Option<HashMap<String, String>>,
1889 /// The canonical id for this location. For example: `"us-east1"`.
1890 #[serde(rename = "locationId")]
1891 pub location_id: Option<String>,
1892 /// Service-specific metadata. For example the available capacity at the given location.
1893 pub metadata: Option<HashMap<String, serde_json::Value>>,
1894 /// Resource name for the location, which may vary between implementations. For example: `"projects/example-project/locations/us-east1"`
1895 pub name: Option<String>,
1896}
1897
1898impl common::ResponseResult for Location {}
1899
1900/// Metadata includes information associated with a `Rollout`.
1901///
1902/// This type is not used in any activity, and only used as *part* of another schema.
1903///
1904#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1905#[serde_with::serde_as]
1906#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1907pub struct Metadata {
1908 /// Output only. AutomationRolloutMetadata contains the information about the interactions between Automation service and this rollout.
1909 pub automation: Option<AutomationRolloutMetadata>,
1910 /// Output only. The name of the Cloud Run Service that is associated with a `Rollout`.
1911 #[serde(rename = "cloudRun")]
1912 pub cloud_run: Option<CloudRunMetadata>,
1913 /// Output only. Custom metadata provided by user-defined `Rollout` operations.
1914 pub custom: Option<CustomMetadata>,
1915}
1916
1917impl common::Part for Metadata {}
1918
1919/// Information specifying a multiTarget.
1920///
1921/// This type is not used in any activity, and only used as *part* of another schema.
1922///
1923#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1924#[serde_with::serde_as]
1925#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1926pub struct MultiTarget {
1927 /// Required. The target_ids of this multiTarget.
1928 #[serde(rename = "targetIds")]
1929 pub target_ids: Option<Vec<String>>,
1930}
1931
1932impl common::Part for MultiTarget {}
1933
1934/// One-time window within which actions are restricted. For example, blocking actions over New Year's Eve from December 31st at 5pm to January 1st at 9am.
1935///
1936/// This type is not used in any activity, and only used as *part* of another schema.
1937///
1938#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1939#[serde_with::serde_as]
1940#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1941pub struct OneTimeWindow {
1942 /// Required. End date.
1943 #[serde(rename = "endDate")]
1944 pub end_date: Option<Date>,
1945 /// Required. End time (exclusive). You may use 24:00 for the end of the day.
1946 #[serde(rename = "endTime")]
1947 pub end_time: Option<TimeOfDay>,
1948 /// Required. Start date.
1949 #[serde(rename = "startDate")]
1950 pub start_date: Option<Date>,
1951 /// Required. Start time (inclusive). Use 00:00 for the beginning of the day.
1952 #[serde(rename = "startTime")]
1953 pub start_time: Option<TimeOfDay>,
1954}
1955
1956impl common::Part for OneTimeWindow {}
1957
1958/// This resource represents a long-running operation that is the result of a network API call.
1959///
1960/// # Activities
1961///
1962/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1963/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1964///
1965/// * [locations custom target types create projects](ProjectLocationCustomTargetTypeCreateCall) (response)
1966/// * [locations custom target types delete projects](ProjectLocationCustomTargetTypeDeleteCall) (response)
1967/// * [locations custom target types patch projects](ProjectLocationCustomTargetTypePatchCall) (response)
1968/// * [locations delivery pipelines automations create projects](ProjectLocationDeliveryPipelineAutomationCreateCall) (response)
1969/// * [locations delivery pipelines automations delete projects](ProjectLocationDeliveryPipelineAutomationDeleteCall) (response)
1970/// * [locations delivery pipelines automations patch projects](ProjectLocationDeliveryPipelineAutomationPatchCall) (response)
1971/// * [locations delivery pipelines releases rollouts create projects](ProjectLocationDeliveryPipelineReleaseRolloutCreateCall) (response)
1972/// * [locations delivery pipelines releases create projects](ProjectLocationDeliveryPipelineReleaseCreateCall) (response)
1973/// * [locations delivery pipelines create projects](ProjectLocationDeliveryPipelineCreateCall) (response)
1974/// * [locations delivery pipelines delete projects](ProjectLocationDeliveryPipelineDeleteCall) (response)
1975/// * [locations delivery pipelines patch projects](ProjectLocationDeliveryPipelinePatchCall) (response)
1976/// * [locations deploy policies create projects](ProjectLocationDeployPolicyCreateCall) (response)
1977/// * [locations deploy policies delete projects](ProjectLocationDeployPolicyDeleteCall) (response)
1978/// * [locations deploy policies patch projects](ProjectLocationDeployPolicyPatchCall) (response)
1979/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
1980/// * [locations targets create projects](ProjectLocationTargetCreateCall) (response)
1981/// * [locations targets delete projects](ProjectLocationTargetDeleteCall) (response)
1982/// * [locations targets patch projects](ProjectLocationTargetPatchCall) (response)
1983#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1984#[serde_with::serde_as]
1985#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1986pub struct Operation {
1987 /// 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.
1988 pub done: Option<bool>,
1989 /// The error result of the operation in case of failure or cancellation.
1990 pub error: Option<Status>,
1991 /// 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.
1992 pub metadata: Option<HashMap<String, serde_json::Value>>,
1993 /// 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}`.
1994 pub name: Option<String>,
1995 /// 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`.
1996 pub response: Option<HashMap<String, serde_json::Value>>,
1997}
1998
1999impl common::ResponseResult for Operation {}
2000
2001/// Phase represents a collection of jobs that are logically grouped together for a `Rollout`.
2002///
2003/// This type is not used in any activity, and only used as *part* of another schema.
2004///
2005#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2006#[serde_with::serde_as]
2007#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2008pub struct Phase {
2009 /// Output only. ChildRollout job composition.
2010 #[serde(rename = "childRolloutJobs")]
2011 pub child_rollout_jobs: Option<ChildRolloutJobs>,
2012 /// Output only. Deployment job composition.
2013 #[serde(rename = "deploymentJobs")]
2014 pub deployment_jobs: Option<DeploymentJobs>,
2015 /// Output only. The ID of the Phase.
2016 pub id: Option<String>,
2017 /// Output only. Additional information on why the Phase was skipped, if available.
2018 #[serde(rename = "skipMessage")]
2019 pub skip_message: Option<String>,
2020 /// Output only. Current state of the Phase.
2021 pub state: Option<String>,
2022}
2023
2024impl common::Part for Phase {}
2025
2026/// Contains the paths to the artifacts, relative to the URI, for a phase.
2027///
2028/// This type is not used in any activity, and only used as *part* of another schema.
2029///
2030#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2031#[serde_with::serde_as]
2032#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2033pub struct PhaseArtifact {
2034 /// Output only. File path of the directory of rendered job manifests relative to the URI. This is only set if it is applicable.
2035 #[serde(rename = "jobManifestsPath")]
2036 pub job_manifests_path: Option<String>,
2037 /// Output only. File path of the rendered manifest relative to the URI.
2038 #[serde(rename = "manifestPath")]
2039 pub manifest_path: Option<String>,
2040 /// Output only. File path of the resolved Skaffold configuration relative to the URI.
2041 #[serde(rename = "skaffoldConfigPath")]
2042 pub skaffold_config_path: Option<String>,
2043}
2044
2045impl common::Part for PhaseArtifact {}
2046
2047/// PhaseConfig represents the configuration for a phase in the custom canary deployment.
2048///
2049/// This type is not used in any activity, and only used as *part* of another schema.
2050///
2051#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2052#[serde_with::serde_as]
2053#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2054pub struct PhaseConfig {
2055 /// Required. Percentage deployment for the phase.
2056 pub percentage: Option<i32>,
2057 /// 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])?$`.
2058 #[serde(rename = "phaseId")]
2059 pub phase_id: Option<String>,
2060 /// Optional. Configuration for the postdeploy job of this phase. If this is not configured, there will be no postdeploy job for this phase.
2061 pub postdeploy: Option<Postdeploy>,
2062 /// Optional. Configuration for the predeploy job of this phase. If this is not configured, there will be no predeploy job for this phase.
2063 pub predeploy: Option<Predeploy>,
2064 /// Optional. Skaffold profiles to use when rendering the manifest for this phase. These are in addition to the profiles list specified in the `DeliveryPipeline` stage.
2065 pub profiles: Option<Vec<String>>,
2066 /// Optional. Whether to run verify tests after the deployment via `skaffold verify`.
2067 pub verify: Option<bool>,
2068}
2069
2070impl common::Part for PhaseConfig {}
2071
2072/// PipelineCondition contains all conditions relevant to a Delivery Pipeline.
2073///
2074/// This type is not used in any activity, and only used as *part* of another schema.
2075///
2076#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2077#[serde_with::serde_as]
2078#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2079pub struct PipelineCondition {
2080 /// Details around the Pipeline's overall status.
2081 #[serde(rename = "pipelineReadyCondition")]
2082 pub pipeline_ready_condition: Option<PipelineReadyCondition>,
2083 /// Details around targets enumerated in the pipeline.
2084 #[serde(rename = "targetsPresentCondition")]
2085 pub targets_present_condition: Option<TargetsPresentCondition>,
2086 /// Details on the whether the targets enumerated in the pipeline are of the same type.
2087 #[serde(rename = "targetsTypeCondition")]
2088 pub targets_type_condition: Option<TargetsTypeCondition>,
2089}
2090
2091impl common::Part for PipelineCondition {}
2092
2093/// PipelineReadyCondition contains information around the status of the Pipeline.
2094///
2095/// This type is not used in any activity, and only used as *part* of another schema.
2096///
2097#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2098#[serde_with::serde_as]
2099#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2100pub struct PipelineReadyCondition {
2101 /// 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.
2102 pub status: Option<bool>,
2103 /// Last time the condition was updated.
2104 #[serde(rename = "updateTime")]
2105 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2106}
2107
2108impl common::Part for PipelineReadyCondition {}
2109
2110/// 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/).
2111///
2112/// # Activities
2113///
2114/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2115/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2116///
2117/// * [locations custom target types get iam policy projects](ProjectLocationCustomTargetTypeGetIamPolicyCall) (response)
2118/// * [locations custom target types set iam policy projects](ProjectLocationCustomTargetTypeSetIamPolicyCall) (response)
2119/// * [locations delivery pipelines get iam policy projects](ProjectLocationDeliveryPipelineGetIamPolicyCall) (response)
2120/// * [locations delivery pipelines set iam policy projects](ProjectLocationDeliveryPipelineSetIamPolicyCall) (response)
2121/// * [locations deploy policies get iam policy projects](ProjectLocationDeployPolicyGetIamPolicyCall) (response)
2122/// * [locations deploy policies set iam policy projects](ProjectLocationDeployPolicySetIamPolicyCall) (response)
2123/// * [locations targets get iam policy projects](ProjectLocationTargetGetIamPolicyCall) (response)
2124/// * [locations targets set iam policy projects](ProjectLocationTargetSetIamPolicyCall) (response)
2125#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2126#[serde_with::serde_as]
2127#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2128pub struct Policy {
2129 /// Specifies cloud audit logging configuration for this policy.
2130 #[serde(rename = "auditConfigs")]
2131 pub audit_configs: Option<Vec<AuditConfig>>,
2132 /// 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`.
2133 pub bindings: Option<Vec<Binding>>,
2134 /// `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.
2135 #[serde_as(as = "Option<common::serde::standard_base64::Wrapper>")]
2136 pub etag: Option<Vec<u8>>,
2137 /// 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).
2138 pub version: Option<i32>,
2139}
2140
2141impl common::ResponseResult for Policy {}
2142
2143/// Deploy Policy rule.
2144///
2145/// This type is not used in any activity, and only used as *part* of another schema.
2146///
2147#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2148#[serde_with::serde_as]
2149#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2150pub struct PolicyRule {
2151 /// Optional. Rollout restrictions.
2152 #[serde(rename = "rolloutRestriction")]
2153 pub rollout_restriction: Option<RolloutRestriction>,
2154}
2155
2156impl common::Part for PolicyRule {}
2157
2158/// Returned from an action if one or more policies were violated, and therefore the action was prevented. Contains information about what policies were violated and why.
2159///
2160/// This type is not used in any activity, and only used as *part* of another schema.
2161///
2162#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2163#[serde_with::serde_as]
2164#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2165pub struct PolicyViolation {
2166 /// Policy violation details.
2167 #[serde(rename = "policyViolationDetails")]
2168 pub policy_violation_details: Option<Vec<PolicyViolationDetails>>,
2169}
2170
2171impl common::Part for PolicyViolation {}
2172
2173/// Policy violation details.
2174///
2175/// This type is not used in any activity, and only used as *part* of another schema.
2176///
2177#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2178#[serde_with::serde_as]
2179#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2180pub struct PolicyViolationDetails {
2181 /// User readable message about why the request violated a policy. This is not intended for machine parsing.
2182 #[serde(rename = "failureMessage")]
2183 pub failure_message: Option<String>,
2184 /// Name of the policy that was violated. Policy resource will be in the format of `projects/{project}/locations/{location}/policies/{policy}`.
2185 pub policy: Option<String>,
2186 /// Id of the rule that triggered the policy violation.
2187 #[serde(rename = "ruleId")]
2188 pub rule_id: Option<String>,
2189}
2190
2191impl common::Part for PolicyViolationDetails {}
2192
2193/// Postdeploy contains the postdeploy job configuration information.
2194///
2195/// This type is not used in any activity, and only used as *part* of another schema.
2196///
2197#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2198#[serde_with::serde_as]
2199#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2200pub struct Postdeploy {
2201 /// Optional. A sequence of Skaffold custom actions to invoke during execution of the postdeploy job.
2202 pub actions: Option<Vec<String>>,
2203}
2204
2205impl common::Part for Postdeploy {}
2206
2207/// A postdeploy Job.
2208///
2209/// This type is not used in any activity, and only used as *part* of another schema.
2210///
2211#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2212#[serde_with::serde_as]
2213#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2214pub struct PostdeployJob {
2215 /// Output only. The custom actions that the postdeploy Job executes.
2216 pub actions: Option<Vec<String>>,
2217}
2218
2219impl common::Part for PostdeployJob {}
2220
2221/// PostdeployJobRun contains information specific to a postdeploy `JobRun`.
2222///
2223/// This type is not used in any activity, and only used as *part* of another schema.
2224///
2225#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2226#[serde_with::serde_as]
2227#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2228pub struct PostdeployJobRun {
2229 /// 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}`.
2230 pub build: Option<String>,
2231 /// Output only. The reason the postdeploy failed. This will always be unspecified while the postdeploy is in progress or if it succeeded.
2232 #[serde(rename = "failureCause")]
2233 pub failure_cause: Option<String>,
2234 /// Output only. Additional information about the postdeploy failure, if available.
2235 #[serde(rename = "failureMessage")]
2236 pub failure_message: Option<String>,
2237}
2238
2239impl common::Part for PostdeployJobRun {}
2240
2241/// Predeploy contains the predeploy job configuration information.
2242///
2243/// This type is not used in any activity, and only used as *part* of another schema.
2244///
2245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2246#[serde_with::serde_as]
2247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2248pub struct Predeploy {
2249 /// Optional. A sequence of Skaffold custom actions to invoke during execution of the predeploy job.
2250 pub actions: Option<Vec<String>>,
2251}
2252
2253impl common::Part for Predeploy {}
2254
2255/// A predeploy Job.
2256///
2257/// This type is not used in any activity, and only used as *part* of another schema.
2258///
2259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2260#[serde_with::serde_as]
2261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2262pub struct PredeployJob {
2263 /// Output only. The custom actions that the predeploy Job executes.
2264 pub actions: Option<Vec<String>>,
2265}
2266
2267impl common::Part for PredeployJob {}
2268
2269/// PredeployJobRun contains information specific to a predeploy `JobRun`.
2270///
2271/// This type is not used in any activity, and only used as *part* of another schema.
2272///
2273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2274#[serde_with::serde_as]
2275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2276pub struct PredeployJobRun {
2277 /// 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}`.
2278 pub build: Option<String>,
2279 /// Output only. The reason the predeploy failed. This will always be unspecified while the predeploy is in progress or if it succeeded.
2280 #[serde(rename = "failureCause")]
2281 pub failure_cause: Option<String>,
2282 /// Output only. Additional information about the predeploy failure, if available.
2283 #[serde(rename = "failureMessage")]
2284 pub failure_message: Option<String>,
2285}
2286
2287impl common::Part for PredeployJobRun {}
2288
2289/// Execution using a private Cloud Build pool.
2290///
2291/// This type is not used in any activity, and only used as *part* of another schema.
2292///
2293#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2294#[serde_with::serde_as]
2295#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2296pub struct PrivatePool {
2297 /// 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.
2298 #[serde(rename = "artifactStorage")]
2299 pub artifact_storage: Option<String>,
2300 /// Optional. Google service account to use for execution. If unspecified, the project execution service account (-compute@developer.gserviceaccount.com) will be used.
2301 #[serde(rename = "serviceAccount")]
2302 pub service_account: Option<String>,
2303 /// Required. Resource name of the Cloud Build worker pool to use. The format is `projects/{project}/locations/{location}/workerPools/{pool}`.
2304 #[serde(rename = "workerPool")]
2305 pub worker_pool: Option<String>,
2306}
2307
2308impl common::Part for PrivatePool {}
2309
2310/// Contains the information of an automated promote-release operation.
2311///
2312/// This type is not used in any activity, and only used as *part* of another schema.
2313///
2314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2315#[serde_with::serde_as]
2316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2317pub struct PromoteReleaseOperation {
2318 /// Output only. The starting phase of the rollout created by this operation.
2319 pub phase: Option<String>,
2320 /// Output only. The name of the rollout that initiates the `AutomationRun`.
2321 pub rollout: Option<String>,
2322 /// 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.
2323 #[serde(rename = "targetId")]
2324 pub target_id: Option<String>,
2325 /// Output only. How long the operation will be paused.
2326 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2327 pub wait: Option<chrono::Duration>,
2328}
2329
2330impl common::Part for PromoteReleaseOperation {}
2331
2332/// The `PromoteRelease` rule will automatically promote a release from the current target to a specified target.
2333///
2334/// This type is not used in any activity, and only used as *part* of another schema.
2335///
2336#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2337#[serde_with::serde_as]
2338#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2339pub struct PromoteReleaseRule {
2340 /// Output only. Information around the state of the Automation rule.
2341 pub condition: Option<AutomationRuleCondition>,
2342 /// Optional. The starting phase of the rollout created by this operation. Default to the first phase.
2343 #[serde(rename = "destinationPhase")]
2344 pub destination_phase: Option<String>,
2345 /// 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 * "@next", the next target in the promotion sequence
2346 #[serde(rename = "destinationTargetId")]
2347 pub destination_target_id: Option<String>,
2348 /// 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])?`.
2349 pub id: Option<String>,
2350 /// Optional. How long the release need to be paused until being promoted to the next target.
2351 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2352 pub wait: Option<chrono::Duration>,
2353}
2354
2355impl common::Part for PromoteReleaseRule {}
2356
2357/// A `Release` resource in the Cloud Deploy API. A `Release` defines a specific Skaffold configuration instance that can be deployed.
2358///
2359/// # Activities
2360///
2361/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2362/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2363///
2364/// * [locations delivery pipelines releases create projects](ProjectLocationDeliveryPipelineReleaseCreateCall) (request)
2365/// * [locations delivery pipelines releases get projects](ProjectLocationDeliveryPipelineReleaseGetCall) (response)
2366#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2367#[serde_with::serde_as]
2368#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2369pub struct Release {
2370 /// Output only. Indicates whether this is an abandoned release.
2371 pub abandoned: Option<bool>,
2372 /// 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.
2373 pub annotations: Option<HashMap<String, String>>,
2374 /// Optional. List of artifacts to pass through to Skaffold command.
2375 #[serde(rename = "buildArtifacts")]
2376 pub build_artifacts: Option<Vec<BuildArtifact>>,
2377 /// Output only. Information around the state of the Release.
2378 pub condition: Option<ReleaseCondition>,
2379 /// Output only. Time at which the `Release` was created.
2380 #[serde(rename = "createTime")]
2381 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2382 /// Output only. Snapshot of the custom target types referenced by the targets taken at release creation time.
2383 #[serde(rename = "customTargetTypeSnapshots")]
2384 pub custom_target_type_snapshots: Option<Vec<CustomTargetType>>,
2385 /// Output only. Snapshot of the parent pipeline taken at release creation time.
2386 #[serde(rename = "deliveryPipelineSnapshot")]
2387 pub delivery_pipeline_snapshot: Option<DeliveryPipeline>,
2388 /// Optional. The deploy parameters to use for all targets in this release.
2389 #[serde(rename = "deployParameters")]
2390 pub deploy_parameters: Option<HashMap<String, String>>,
2391 /// Optional. Description of the `Release`. Max length is 255 characters.
2392 pub description: Option<String>,
2393 /// 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.
2394 pub etag: Option<String>,
2395 /// 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.
2396 pub labels: Option<HashMap<String, String>>,
2397 /// Identifier. 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])?`
2398 pub name: Option<String>,
2399 /// Output only. Time at which the render completed.
2400 #[serde(rename = "renderEndTime")]
2401 pub render_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2402 /// Output only. Time at which the render began.
2403 #[serde(rename = "renderStartTime")]
2404 pub render_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2405 /// Output only. Current state of the render operation.
2406 #[serde(rename = "renderState")]
2407 pub render_state: Option<String>,
2408 /// Optional. Filepath of the Skaffold config inside of the config URI.
2409 #[serde(rename = "skaffoldConfigPath")]
2410 pub skaffold_config_path: Option<String>,
2411 /// Optional. Cloud Storage URI of tar.gz archive containing Skaffold configuration.
2412 #[serde(rename = "skaffoldConfigUri")]
2413 pub skaffold_config_uri: Option<String>,
2414 /// Optional. 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.
2415 #[serde(rename = "skaffoldVersion")]
2416 pub skaffold_version: Option<String>,
2417 /// Output only. Map from target ID to the target artifacts created during the render operation.
2418 #[serde(rename = "targetArtifacts")]
2419 pub target_artifacts: Option<HashMap<String, TargetArtifact>>,
2420 /// Output only. Map from target ID to details of the render operation for that target.
2421 #[serde(rename = "targetRenders")]
2422 pub target_renders: Option<HashMap<String, TargetRender>>,
2423 /// Output only. Snapshot of the targets taken at release creation time.
2424 #[serde(rename = "targetSnapshots")]
2425 pub target_snapshots: Option<Vec<Target>>,
2426 /// Optional. The tool versions to use for this release and all subsequent operations involving this release. If unset, then it will freeze the tool versions at the time of release creation.
2427 #[serde(rename = "toolVersions")]
2428 pub tool_versions: Option<ToolVersions>,
2429 /// Output only. Unique identifier of the `Release`.
2430 pub uid: Option<String>,
2431}
2432
2433impl common::RequestValue for Release {}
2434impl common::ResponseResult for Release {}
2435
2436/// ReleaseCondition contains all conditions relevant to a Release.
2437///
2438/// This type is not used in any activity, and only used as *part* of another schema.
2439///
2440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2441#[serde_with::serde_as]
2442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2443pub struct ReleaseCondition {
2444 /// Output only. Details around the support state of the release's Docker version.
2445 #[serde(rename = "dockerVersionSupportedCondition")]
2446 pub docker_version_supported_condition: Option<ToolVersionSupportedCondition>,
2447 /// Output only. Details around the support state of the release's Helm version.
2448 #[serde(rename = "helmVersionSupportedCondition")]
2449 pub helm_version_supported_condition: Option<ToolVersionSupportedCondition>,
2450 /// Output only. Details around the support state of the release's Kpt version.
2451 #[serde(rename = "kptVersionSupportedCondition")]
2452 pub kpt_version_supported_condition: Option<ToolVersionSupportedCondition>,
2453 /// Output only. Details around the support state of the release's Kubectl version.
2454 #[serde(rename = "kubectlVersionSupportedCondition")]
2455 pub kubectl_version_supported_condition: Option<ToolVersionSupportedCondition>,
2456 /// Output only. Details around the support state of the release's Kustomize version.
2457 #[serde(rename = "kustomizeVersionSupportedCondition")]
2458 pub kustomize_version_supported_condition: Option<ToolVersionSupportedCondition>,
2459 /// Details around the Releases's overall status.
2460 #[serde(rename = "releaseReadyCondition")]
2461 pub release_ready_condition: Option<ReleaseReadyCondition>,
2462 /// Details around the support state of the release's Skaffold version.
2463 #[serde(rename = "skaffoldSupportedCondition")]
2464 pub skaffold_supported_condition: Option<SkaffoldSupportedCondition>,
2465 /// Output only. Details around the support state of the release's Skaffold version.
2466 #[serde(rename = "skaffoldVersionSupportedCondition")]
2467 pub skaffold_version_supported_condition: Option<ToolVersionSupportedCondition>,
2468}
2469
2470impl common::Part for ReleaseCondition {}
2471
2472/// ReleaseReadyCondition contains information around the status of the Release. If a release is not ready, you cannot create a rollout with the release.
2473///
2474/// This type is not used in any activity, and only used as *part* of another schema.
2475///
2476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2477#[serde_with::serde_as]
2478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2479pub struct ReleaseReadyCondition {
2480 /// 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.
2481 pub status: Option<bool>,
2482}
2483
2484impl common::Part for ReleaseReadyCondition {}
2485
2486/// RenderMetadata includes information associated with a `Release` render.
2487///
2488/// This type is not used in any activity, and only used as *part* of another schema.
2489///
2490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2491#[serde_with::serde_as]
2492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2493pub struct RenderMetadata {
2494 /// Output only. Metadata associated with rendering for Cloud Run.
2495 #[serde(rename = "cloudRun")]
2496 pub cloud_run: Option<CloudRunRenderMetadata>,
2497 /// Output only. Custom metadata provided by user-defined render operation.
2498 pub custom: Option<CustomMetadata>,
2499}
2500
2501impl common::Part for RenderMetadata {}
2502
2503/// RepairPhase tracks the repair attempts that have been made for each `RepairPhaseConfig` specified in the `Automation` resource.
2504///
2505/// This type is not used in any activity, and only used as *part* of another schema.
2506///
2507#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2508#[serde_with::serde_as]
2509#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2510pub struct RepairPhase {
2511 /// Output only. Records of the retry attempts for retry repair mode.
2512 pub retry: Option<RetryPhase>,
2513 /// Output only. Rollback attempt for rollback repair mode .
2514 pub rollback: Option<RollbackAttempt>,
2515}
2516
2517impl common::Part for RepairPhase {}
2518
2519/// Configuration of the repair phase.
2520///
2521/// This type is not used in any activity, and only used as *part* of another schema.
2522///
2523#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2524#[serde_with::serde_as]
2525#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2526pub struct RepairPhaseConfig {
2527 /// Optional. Retries a failed job.
2528 pub retry: Option<Retry>,
2529 /// Optional. Rolls back a `Rollout`.
2530 pub rollback: Option<Rollback>,
2531}
2532
2533impl common::Part for RepairPhaseConfig {}
2534
2535/// Contains the information for an automated `repair rollout` operation.
2536///
2537/// This type is not used in any activity, and only used as *part* of another schema.
2538///
2539#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2540#[serde_with::serde_as]
2541#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2542pub struct RepairRolloutOperation {
2543 /// Output only. The index of the current repair action in the repair sequence.
2544 #[serde(rename = "currentRepairPhaseIndex")]
2545 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2546 pub current_repair_phase_index: Option<i64>,
2547 /// Output only. The job ID for the Job to repair.
2548 #[serde(rename = "jobId")]
2549 pub job_id: Option<String>,
2550 /// Output only. The phase ID of the phase that includes the job being repaired.
2551 #[serde(rename = "phaseId")]
2552 pub phase_id: Option<String>,
2553 /// Output only. Records of the repair attempts. Each repair phase may have multiple retry attempts or single rollback attempt.
2554 #[serde(rename = "repairPhases")]
2555 pub repair_phases: Option<Vec<RepairPhase>>,
2556 /// Output only. The name of the rollout that initiates the `AutomationRun`.
2557 pub rollout: Option<String>,
2558}
2559
2560impl common::Part for RepairRolloutOperation {}
2561
2562/// The `RepairRolloutRule` automation rule will automatically repair a failed `Rollout`.
2563///
2564/// This type is not used in any activity, and only used as *part* of another schema.
2565///
2566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2567#[serde_with::serde_as]
2568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2569pub struct RepairRolloutRule {
2570 /// Output only. Information around the state of the 'Automation' rule.
2571 pub condition: Option<AutomationRuleCondition>,
2572 /// 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])?`.
2573 pub id: Option<String>,
2574 /// 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])?$`.
2575 pub jobs: Option<Vec<String>>,
2576 /// Optional. Phases within which jobs are subject to automatic repair actions on failure. Proceeds only after phase name matched any one in the list, or for all phases if unspecified. 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])?$`.
2577 pub phases: Option<Vec<String>>,
2578 /// Required. Defines the types of automatic repair phases for failed jobs.
2579 #[serde(rename = "repairPhases")]
2580 pub repair_phases: Option<Vec<RepairPhaseConfig>>,
2581}
2582
2583impl common::Part for RepairRolloutRule {}
2584
2585/// Retries the failed job.
2586///
2587/// This type is not used in any activity, and only used as *part* of another schema.
2588///
2589#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2590#[serde_with::serde_as]
2591#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2592pub struct Retry {
2593 /// Required. Total number of retries. Retry is skipped if set to 0; The minimum value is 1, and the maximum value is 10.
2594 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2595 pub attempts: Option<i64>,
2596 /// Optional. The pattern of how wait time will be increased. Default is linear. Backoff mode will be ignored if `wait` is 0.
2597 #[serde(rename = "backoffMode")]
2598 pub backoff_mode: Option<String>,
2599 /// Optional. How long to wait for the first retry. Default is 0, and the maximum value is 14d.
2600 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2601 pub wait: Option<chrono::Duration>,
2602}
2603
2604impl common::Part for Retry {}
2605
2606/// RetryAttempt represents an action of retrying the failed Cloud Deploy job.
2607///
2608/// This type is not used in any activity, and only used as *part* of another schema.
2609///
2610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2611#[serde_with::serde_as]
2612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2613pub struct RetryAttempt {
2614 /// Output only. The index of this retry attempt.
2615 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2616 pub attempt: Option<i64>,
2617 /// Output only. Valid state of this retry action.
2618 pub state: Option<String>,
2619 /// Output only. Description of the state of the Retry.
2620 #[serde(rename = "stateDesc")]
2621 pub state_desc: Option<String>,
2622 /// Output only. How long the operation will be paused.
2623 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2624 pub wait: Option<chrono::Duration>,
2625}
2626
2627impl common::Part for RetryAttempt {}
2628
2629/// RetryJobRequest is the request object used by `RetryJob`.
2630///
2631/// # Activities
2632///
2633/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2634/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2635///
2636/// * [locations delivery pipelines releases rollouts retry job projects](ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall) (request)
2637#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2638#[serde_with::serde_as]
2639#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2640pub struct RetryJobRequest {
2641 /// Required. The job ID for the Job to retry.
2642 #[serde(rename = "jobId")]
2643 pub job_id: Option<String>,
2644 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
2645 #[serde(rename = "overrideDeployPolicy")]
2646 pub override_deploy_policy: Option<Vec<String>>,
2647 /// Required. The phase ID the Job to retry belongs to.
2648 #[serde(rename = "phaseId")]
2649 pub phase_id: Option<String>,
2650}
2651
2652impl common::RequestValue for RetryJobRequest {}
2653
2654/// The response object from ‘RetryJob’.
2655///
2656/// # Activities
2657///
2658/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2659/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2660///
2661/// * [locations delivery pipelines releases rollouts retry job projects](ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall) (response)
2662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2663#[serde_with::serde_as]
2664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2665pub struct RetryJobResponse {
2666 _never_set: Option<bool>,
2667}
2668
2669impl common::ResponseResult for RetryJobResponse {}
2670
2671/// RetryPhase contains the retry attempts and the metadata for initiating a new attempt.
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 RetryPhase {
2679 /// Output only. Detail of a retry action.
2680 pub attempts: Option<Vec<RetryAttempt>>,
2681 /// Output only. The pattern of how the wait time of the retry attempt is calculated.
2682 #[serde(rename = "backoffMode")]
2683 pub backoff_mode: Option<String>,
2684 /// Output only. The number of attempts that have been made.
2685 #[serde(rename = "totalAttempts")]
2686 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2687 pub total_attempts: Option<i64>,
2688}
2689
2690impl common::Part for RetryPhase {}
2691
2692/// Rolls back a `Rollout`.
2693///
2694/// This type is not used in any activity, and only used as *part* of another schema.
2695///
2696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2697#[serde_with::serde_as]
2698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2699pub struct Rollback {
2700 /// Optional. The starting phase ID for the `Rollout`. If unspecified, the `Rollout` will start in the stable phase.
2701 #[serde(rename = "destinationPhase")]
2702 pub destination_phase: Option<String>,
2703 /// Optional. If pending rollout exists on the target, the rollback operation will be aborted.
2704 #[serde(rename = "disableRollbackIfRolloutPending")]
2705 pub disable_rollback_if_rollout_pending: Option<bool>,
2706}
2707
2708impl common::Part for Rollback {}
2709
2710/// RollbackAttempt represents an action of rolling back a Cloud Deploy 'Target'.
2711///
2712/// This type is not used in any activity, and only used as *part* of another schema.
2713///
2714#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2715#[serde_with::serde_as]
2716#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2717pub struct RollbackAttempt {
2718 /// Output only. The phase to which the rollout will be rolled back to.
2719 #[serde(rename = "destinationPhase")]
2720 pub destination_phase: Option<String>,
2721 /// Output only. If active rollout exists on the target, abort this rollback.
2722 #[serde(rename = "disableRollbackIfRolloutPending")]
2723 pub disable_rollback_if_rollout_pending: Option<bool>,
2724 /// Output only. ID of the rollback `Rollout` to create.
2725 #[serde(rename = "rolloutId")]
2726 pub rollout_id: Option<String>,
2727 /// Output only. Valid state of this rollback action.
2728 pub state: Option<String>,
2729 /// Output only. Description of the state of the Rollback.
2730 #[serde(rename = "stateDesc")]
2731 pub state_desc: Option<String>,
2732}
2733
2734impl common::Part for RollbackAttempt {}
2735
2736/// Configs for the Rollback rollout.
2737///
2738/// This type is not used in any activity, and only used as *part* of another schema.
2739///
2740#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2741#[serde_with::serde_as]
2742#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2743pub struct RollbackTargetConfig {
2744 /// Optional. The rollback `Rollout` to create.
2745 pub rollout: Option<Rollout>,
2746 /// Optional. The starting phase ID for the `Rollout`. If unspecified, the `Rollout` will start in the stable phase.
2747 #[serde(rename = "startingPhaseId")]
2748 pub starting_phase_id: Option<String>,
2749}
2750
2751impl common::Part for RollbackTargetConfig {}
2752
2753/// The request object for `RollbackTarget`.
2754///
2755/// # Activities
2756///
2757/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2758/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2759///
2760/// * [locations delivery pipelines rollback target projects](ProjectLocationDeliveryPipelineRollbackTargetCall) (request)
2761#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2762#[serde_with::serde_as]
2763#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2764pub struct RollbackTargetRequest {
2765 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deploy_policy}`.
2766 #[serde(rename = "overrideDeployPolicy")]
2767 pub override_deploy_policy: Option<Vec<String>>,
2768 /// 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`.
2769 #[serde(rename = "releaseId")]
2770 pub release_id: Option<String>,
2771 /// Optional. Configs for the rollback `Rollout`.
2772 #[serde(rename = "rollbackConfig")]
2773 pub rollback_config: Option<RollbackTargetConfig>,
2774 /// Required. ID of the rollback `Rollout` to create.
2775 #[serde(rename = "rolloutId")]
2776 pub rollout_id: Option<String>,
2777 /// Optional. If provided, this must be the latest `Rollout` that is on the `Target`.
2778 #[serde(rename = "rolloutToRollBack")]
2779 pub rollout_to_roll_back: Option<String>,
2780 /// Required. ID of the `Target` that is being rolled back.
2781 #[serde(rename = "targetId")]
2782 pub target_id: Option<String>,
2783 /// Optional. If set to true, the request is validated and the user is provided with a `RollbackTargetResponse`.
2784 #[serde(rename = "validateOnly")]
2785 pub validate_only: Option<bool>,
2786}
2787
2788impl common::RequestValue for RollbackTargetRequest {}
2789
2790/// The response object from `RollbackTarget`.
2791///
2792/// # Activities
2793///
2794/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2795/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2796///
2797/// * [locations delivery pipelines rollback target projects](ProjectLocationDeliveryPipelineRollbackTargetCall) (response)
2798#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2799#[serde_with::serde_as]
2800#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2801pub struct RollbackTargetResponse {
2802 /// The config of the rollback `Rollout` created or will be created.
2803 #[serde(rename = "rollbackConfig")]
2804 pub rollback_config: Option<RollbackTargetConfig>,
2805}
2806
2807impl common::ResponseResult for RollbackTargetResponse {}
2808
2809/// A `Rollout` resource in the Cloud Deploy API. A `Rollout` contains information around a specific deployment to a `Target`.
2810///
2811/// # Activities
2812///
2813/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2814/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2815///
2816/// * [locations delivery pipelines releases rollouts create projects](ProjectLocationDeliveryPipelineReleaseRolloutCreateCall) (request)
2817/// * [locations delivery pipelines releases rollouts get projects](ProjectLocationDeliveryPipelineReleaseRolloutGetCall) (response)
2818#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2819#[serde_with::serde_as]
2820#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2821pub struct Rollout {
2822 /// Output only. The AutomationRun actively repairing the rollout.
2823 #[serde(rename = "activeRepairAutomationRun")]
2824 pub active_repair_automation_run: Option<String>,
2825 /// 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.
2826 pub annotations: Option<HashMap<String, String>>,
2827 /// Output only. Approval state of the `Rollout`.
2828 #[serde(rename = "approvalState")]
2829 pub approval_state: Option<String>,
2830 /// Output only. Time at which the `Rollout` was approved.
2831 #[serde(rename = "approveTime")]
2832 pub approve_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2833 /// Output only. Name of the `ControllerRollout`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
2834 #[serde(rename = "controllerRollout")]
2835 pub controller_rollout: Option<String>,
2836 /// Output only. Time at which the `Rollout` was created.
2837 #[serde(rename = "createTime")]
2838 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2839 /// Output only. Time at which the `Rollout` finished deploying.
2840 #[serde(rename = "deployEndTime")]
2841 pub deploy_end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2842 /// Output only. The reason this rollout failed. This will always be unspecified while the rollout is in progress.
2843 #[serde(rename = "deployFailureCause")]
2844 pub deploy_failure_cause: Option<String>,
2845 /// Output only. Time at which the `Rollout` started deploying.
2846 #[serde(rename = "deployStartTime")]
2847 pub deploy_start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2848 /// 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}`.
2849 #[serde(rename = "deployingBuild")]
2850 pub deploying_build: Option<String>,
2851 /// Optional. Description of the `Rollout` for user purposes. Max length is 255 characters.
2852 pub description: Option<String>,
2853 /// Output only. Time at which the `Rollout` was enqueued.
2854 #[serde(rename = "enqueueTime")]
2855 pub enqueue_time: Option<chrono::DateTime<chrono::offset::Utc>>,
2856 /// 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.
2857 pub etag: Option<String>,
2858 /// Output only. Additional information about the rollout failure, if available.
2859 #[serde(rename = "failureReason")]
2860 pub failure_reason: Option<String>,
2861 /// 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.
2862 pub labels: Option<HashMap<String, String>>,
2863 /// Output only. Metadata contains information about the rollout.
2864 pub metadata: Option<Metadata>,
2865 /// Identifier. 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])?`
2866 pub name: Option<String>,
2867 /// Output only. The phases that represent the workflows of this `Rollout`.
2868 pub phases: Option<Vec<Phase>>,
2869 /// Output only. Name of the `Rollout` that is rolled back by this `Rollout`. Empty if this `Rollout` wasn't created as a rollback.
2870 #[serde(rename = "rollbackOfRollout")]
2871 pub rollback_of_rollout: Option<String>,
2872 /// Output only. Names of `Rollouts` that rolled back this `Rollout`.
2873 #[serde(rename = "rolledBackByRollouts")]
2874 pub rolled_back_by_rollouts: Option<Vec<String>>,
2875 /// Output only. Current state of the `Rollout`.
2876 pub state: Option<String>,
2877 /// Required. The ID of Target to which this `Rollout` is deploying.
2878 #[serde(rename = "targetId")]
2879 pub target_id: Option<String>,
2880 /// Output only. Unique identifier of the `Rollout`.
2881 pub uid: Option<String>,
2882}
2883
2884impl common::RequestValue for Rollout {}
2885impl common::ResponseResult for Rollout {}
2886
2887/// Rollout restrictions.
2888///
2889/// This type is not used in any activity, and only used as *part* of another schema.
2890///
2891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2892#[serde_with::serde_as]
2893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2894pub struct RolloutRestriction {
2895 /// Optional. Rollout actions to be restricted as part of the policy. If left empty, all actions will be restricted.
2896 pub actions: Option<Vec<String>>,
2897 /// Required. Restriction rule ID. Required and must be unique within a DeployPolicy. The format is `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
2898 pub id: Option<String>,
2899 /// Optional. What invoked the action. If left empty, all invoker types will be restricted.
2900 pub invokers: Option<Vec<String>>,
2901 /// Required. Time window within which actions are restricted.
2902 #[serde(rename = "timeWindows")]
2903 pub time_windows: Option<TimeWindows>,
2904}
2905
2906impl common::Part for RolloutRestriction {}
2907
2908/// Information about route destinations for the Gateway API service mesh.
2909///
2910/// This type is not used in any activity, and only used as *part* of another schema.
2911///
2912#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2913#[serde_with::serde_as]
2914#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2915pub struct RouteDestinations {
2916 /// Required. The clusters where the Gateway API HTTPRoute resource will be deployed to. Valid entries include the associated entities IDs configured in the Target resource and "@self" to include the Target cluster.
2917 #[serde(rename = "destinationIds")]
2918 pub destination_ids: Option<Vec<String>>,
2919 /// Optional. Whether to propagate the Kubernetes Service to the route destination clusters. The Service will always be deployed to the Target cluster even if the HTTPRoute is not. This option may be used to facilitate successful DNS lookup in the route destination clusters. Can only be set to true if destinations are specified.
2920 #[serde(rename = "propagateService")]
2921 pub propagate_service: Option<bool>,
2922}
2923
2924impl common::Part for RouteDestinations {}
2925
2926/// RuntimeConfig contains the runtime specific configurations for a deployment strategy.
2927///
2928/// This type is not used in any activity, and only used as *part* of another schema.
2929///
2930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2931#[serde_with::serde_as]
2932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2933pub struct RuntimeConfig {
2934 /// Optional. Cloud Run runtime configuration.
2935 #[serde(rename = "cloudRun")]
2936 pub cloud_run: Option<CloudRunConfig>,
2937 /// Optional. Kubernetes runtime configuration.
2938 pub kubernetes: Option<KubernetesConfig>,
2939}
2940
2941impl common::Part for RuntimeConfig {}
2942
2943/// SerialPipeline defines a sequential set of stages for a `DeliveryPipeline`.
2944///
2945/// This type is not used in any activity, and only used as *part* of another schema.
2946///
2947#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2948#[serde_with::serde_as]
2949#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2950pub struct SerialPipeline {
2951 /// Optional. Each stage specifies configuration for a `Target`. The ordering of this list defines the promotion flow.
2952 pub stages: Option<Vec<Stage>>,
2953}
2954
2955impl common::Part for SerialPipeline {}
2956
2957/// Information about the Kubernetes Service networking configuration.
2958///
2959/// This type is not used in any activity, and only used as *part* of another schema.
2960///
2961#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2962#[serde_with::serde_as]
2963#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2964pub struct ServiceNetworking {
2965 /// Required. Name of the Kubernetes Deployment whose traffic is managed by the specified Service.
2966 pub deployment: Option<String>,
2967 /// 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.
2968 #[serde(rename = "disablePodOverprovisioning")]
2969 pub disable_pod_overprovisioning: Option<bool>,
2970 /// Optional. The label to use when selecting Pods for the Deployment resource. This label must already be present in the Deployment.
2971 #[serde(rename = "podSelectorLabel")]
2972 pub pod_selector_label: Option<String>,
2973 /// Required. Name of the Kubernetes Service.
2974 pub service: Option<String>,
2975}
2976
2977impl common::Part for ServiceNetworking {}
2978
2979/// Request message for `SetIamPolicy` method.
2980///
2981/// # Activities
2982///
2983/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2984/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2985///
2986/// * [locations custom target types set iam policy projects](ProjectLocationCustomTargetTypeSetIamPolicyCall) (request)
2987/// * [locations delivery pipelines set iam policy projects](ProjectLocationDeliveryPipelineSetIamPolicyCall) (request)
2988/// * [locations deploy policies set iam policy projects](ProjectLocationDeployPolicySetIamPolicyCall) (request)
2989/// * [locations targets set iam policy projects](ProjectLocationTargetSetIamPolicyCall) (request)
2990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2991#[serde_with::serde_as]
2992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2993pub struct SetIamPolicyRequest {
2994 /// 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.
2995 pub policy: Option<Policy>,
2996 /// 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"`
2997 #[serde(rename = "updateMask")]
2998 pub update_mask: Option<common::FieldMask>,
2999}
3000
3001impl common::RequestValue for SetIamPolicyRequest {}
3002
3003/// Cloud Build V2 Repository containing Skaffold Configs.
3004///
3005/// This type is not used in any activity, and only used as *part* of another schema.
3006///
3007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3008#[serde_with::serde_as]
3009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3010pub struct SkaffoldGCBRepoSource {
3011 /// Optional. Relative path from the repository root to the Skaffold Config file.
3012 pub path: Option<String>,
3013 /// Optional. Branch or tag to use when cloning the repository.
3014 #[serde(rename = "ref")]
3015 pub ref_: Option<String>,
3016 /// Required. Name of the Cloud Build V2 Repository. Format is projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}.
3017 pub repository: Option<String>,
3018}
3019
3020impl common::Part for SkaffoldGCBRepoSource {}
3021
3022/// Cloud Storage bucket containing Skaffold Config modules.
3023///
3024/// This type is not used in any activity, and only used as *part* of another schema.
3025///
3026#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3027#[serde_with::serde_as]
3028#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3029pub struct SkaffoldGCSSource {
3030 /// Optional. Relative path from the source to the Skaffold file.
3031 pub path: Option<String>,
3032 /// 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".
3033 pub source: Option<String>,
3034}
3035
3036impl common::Part for SkaffoldGCSSource {}
3037
3038/// Git repository containing Skaffold Config modules.
3039///
3040/// This type is not used in any activity, and only used as *part* of another schema.
3041///
3042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3043#[serde_with::serde_as]
3044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3045pub struct SkaffoldGitSource {
3046 /// Optional. Relative path from the repository root to the Skaffold file.
3047 pub path: Option<String>,
3048 /// Optional. Git branch or tag to use when cloning the repository.
3049 #[serde(rename = "ref")]
3050 pub ref_: Option<String>,
3051 /// Required. Git repository the package should be cloned from.
3052 pub repo: Option<String>,
3053}
3054
3055impl common::Part for SkaffoldGitSource {}
3056
3057/// Skaffold Config modules and their remote source.
3058///
3059/// This type is not used in any activity, and only used as *part* of another schema.
3060///
3061#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3062#[serde_with::serde_as]
3063#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3064pub struct SkaffoldModules {
3065 /// Optional. The Skaffold Config modules to use from the specified source.
3066 pub configs: Option<Vec<String>>,
3067 /// Optional. Remote git repository containing the Skaffold Config modules.
3068 pub git: Option<SkaffoldGitSource>,
3069 /// Optional. Cloud Build V2 repository containing the Skaffold Config modules.
3070 #[serde(rename = "googleCloudBuildRepo")]
3071 pub google_cloud_build_repo: Option<SkaffoldGCBRepoSource>,
3072 /// Optional. Cloud Storage bucket containing the Skaffold Config modules.
3073 #[serde(rename = "googleCloudStorage")]
3074 pub google_cloud_storage: Option<SkaffoldGCSSource>,
3075}
3076
3077impl common::Part for SkaffoldModules {}
3078
3079/// SkaffoldSupportedCondition contains information about when support for the release's version of Skaffold ends.
3080///
3081/// This type is not used in any activity, and only used as *part* of another schema.
3082///
3083#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3084#[serde_with::serde_as]
3085#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3086pub struct SkaffoldSupportedCondition {
3087 /// The time at which this release's version of Skaffold will enter maintenance mode.
3088 #[serde(rename = "maintenanceModeTime")]
3089 pub maintenance_mode_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3090 /// The Skaffold support state for this release's version of Skaffold.
3091 #[serde(rename = "skaffoldSupportState")]
3092 pub skaffold_support_state: Option<String>,
3093 /// True if the version of Skaffold used by this release is supported.
3094 pub status: Option<bool>,
3095 /// The time at which this release's version of Skaffold will no longer be supported.
3096 #[serde(rename = "supportExpirationTime")]
3097 pub support_expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3098}
3099
3100impl common::Part for SkaffoldSupportedCondition {}
3101
3102/// Details of a supported Skaffold version.
3103///
3104/// This type is not used in any activity, and only used as *part* of another schema.
3105///
3106#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3107#[serde_with::serde_as]
3108#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3109pub struct SkaffoldVersion {
3110 /// The time at which this version of Skaffold will enter maintenance mode.
3111 #[serde(rename = "maintenanceModeTime")]
3112 pub maintenance_mode_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3113 /// Date when this version is expected to no longer be supported.
3114 #[serde(rename = "supportEndDate")]
3115 pub support_end_date: Option<Date>,
3116 /// The time at which this version of Skaffold will no longer be supported.
3117 #[serde(rename = "supportExpirationTime")]
3118 pub support_expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3119 /// Release version number. For example, "1.20.3".
3120 pub version: Option<String>,
3121}
3122
3123impl common::Part for SkaffoldVersion {}
3124
3125/// Stage specifies a location to which to deploy.
3126///
3127/// This type is not used in any activity, and only used as *part* of another schema.
3128///
3129#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3130#[serde_with::serde_as]
3131#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3132pub struct Stage {
3133 /// Optional. The deploy parameters to use for the target in this stage.
3134 #[serde(rename = "deployParameters")]
3135 pub deploy_parameters: Option<Vec<DeployParameters>>,
3136 /// Optional. Skaffold profiles to use when rendering the manifest for this stage's `Target`.
3137 pub profiles: Option<Vec<String>>,
3138 /// Optional. The strategy to use for a `Rollout` to this stage.
3139 pub strategy: Option<Strategy>,
3140 /// Optional. 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`.
3141 #[serde(rename = "targetId")]
3142 pub target_id: Option<String>,
3143}
3144
3145impl common::Part for Stage {}
3146
3147/// Standard represents the standard deployment strategy.
3148///
3149/// This type is not used in any activity, and only used as *part* of another schema.
3150///
3151#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3152#[serde_with::serde_as]
3153#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3154pub struct Standard {
3155 /// Optional. Configuration for the postdeploy job. If this is not configured, the postdeploy job will not be present.
3156 pub postdeploy: Option<Postdeploy>,
3157 /// Optional. Configuration for the predeploy job. If this is not configured, the predeploy job will not be present.
3158 pub predeploy: Option<Predeploy>,
3159 /// Optional. Whether to verify a deployment via `skaffold verify`.
3160 pub verify: Option<bool>,
3161}
3162
3163impl common::Part for Standard {}
3164
3165/// 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).
3166///
3167/// This type is not used in any activity, and only used as *part* of another schema.
3168///
3169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3170#[serde_with::serde_as]
3171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3172pub struct Status {
3173 /// The status code, which should be an enum value of google.rpc.Code.
3174 pub code: Option<i32>,
3175 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
3176 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
3177 /// 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.
3178 pub message: Option<String>,
3179}
3180
3181impl common::Part for Status {}
3182
3183/// Strategy contains deployment strategy information.
3184///
3185/// This type is not used in any activity, and only used as *part* of another schema.
3186///
3187#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3188#[serde_with::serde_as]
3189#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3190pub struct Strategy {
3191 /// Optional. Canary deployment strategy provides progressive percentage based deployments to a Target.
3192 pub canary: Option<Canary>,
3193 /// Optional. Standard deployment strategy executes a single deploy and allows verifying the deployment.
3194 pub standard: Option<Standard>,
3195}
3196
3197impl common::Part for Strategy {}
3198
3199/// A `Target` resource in the Cloud Deploy API. A `Target` defines a location to which a Skaffold configuration can be deployed.
3200///
3201/// # Activities
3202///
3203/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3204/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3205///
3206/// * [locations targets create projects](ProjectLocationTargetCreateCall) (request)
3207/// * [locations targets get projects](ProjectLocationTargetGetCall) (response)
3208/// * [locations targets patch projects](ProjectLocationTargetPatchCall) (request)
3209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3210#[serde_with::serde_as]
3211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3212pub struct Target {
3213 /// 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.
3214 pub annotations: Option<HashMap<String, String>>,
3215 /// Optional. Information specifying an Anthos Cluster.
3216 #[serde(rename = "anthosCluster")]
3217 pub anthos_cluster: Option<AnthosCluster>,
3218 /// Optional. Map of entity IDs to their associated entities. Associated entities allows specifying places other than the deployment target for specific features. For example, the Gateway API canary can be configured to deploy the HTTPRoute to a different cluster(s) than the deployment cluster using associated entities. An entity ID 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])?$`.
3219 #[serde(rename = "associatedEntities")]
3220 pub associated_entities: Option<HashMap<String, AssociatedEntities>>,
3221 /// Output only. Time at which the `Target` was created.
3222 #[serde(rename = "createTime")]
3223 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3224 /// Optional. Information specifying a Custom Target.
3225 #[serde(rename = "customTarget")]
3226 pub custom_target: Option<CustomTarget>,
3227 /// Optional. The deploy parameters to use for this target.
3228 #[serde(rename = "deployParameters")]
3229 pub deploy_parameters: Option<HashMap<String, String>>,
3230 /// Optional. Description of the `Target`. Max length is 255 characters.
3231 pub description: Option<String>,
3232 /// 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.
3233 pub etag: Option<String>,
3234 /// Optional. 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`.
3235 #[serde(rename = "executionConfigs")]
3236 pub execution_configs: Option<Vec<ExecutionConfig>>,
3237 /// Optional. Information specifying a GKE Cluster.
3238 pub gke: Option<GkeCluster>,
3239 /// 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.
3240 pub labels: Option<HashMap<String, String>>,
3241 /// Optional. Information specifying a multiTarget.
3242 #[serde(rename = "multiTarget")]
3243 pub multi_target: Option<MultiTarget>,
3244 /// Identifier. 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])?`
3245 pub name: Option<String>,
3246 /// Optional. Whether or not the `Target` requires approval.
3247 #[serde(rename = "requireApproval")]
3248 pub require_approval: Option<bool>,
3249 /// Optional. Information specifying a Cloud Run deployment target.
3250 pub run: Option<CloudRunLocation>,
3251 /// Output only. Resource id of the `Target`.
3252 #[serde(rename = "targetId")]
3253 pub target_id: Option<String>,
3254 /// Output only. Unique identifier of the `Target`.
3255 pub uid: Option<String>,
3256 /// Output only. Most recent time at which the `Target` was updated.
3257 #[serde(rename = "updateTime")]
3258 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3259}
3260
3261impl common::RequestValue for Target {}
3262impl common::ResponseResult for Target {}
3263
3264/// The artifacts produced by a target render operation.
3265///
3266/// This type is not used in any activity, and only used as *part* of another schema.
3267///
3268#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3269#[serde_with::serde_as]
3270#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3271pub struct TargetArtifact {
3272 /// 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.
3273 #[serde(rename = "artifactUri")]
3274 pub artifact_uri: Option<String>,
3275 /// Output only. File path of the rendered manifest relative to the URI for the stable phase.
3276 #[serde(rename = "manifestPath")]
3277 pub manifest_path: Option<String>,
3278 /// Output only. Map from the phase ID to the phase artifacts for the `Target`.
3279 #[serde(rename = "phaseArtifacts")]
3280 pub phase_artifacts: Option<HashMap<String, PhaseArtifact>>,
3281 /// Output only. File path of the resolved Skaffold configuration for the stable phase, relative to the URI.
3282 #[serde(rename = "skaffoldConfigPath")]
3283 pub skaffold_config_path: Option<String>,
3284}
3285
3286impl common::Part for TargetArtifact {}
3287
3288/// Contains criteria for selecting Targets. This could be used to select targets for a Deploy Policy or for an Automation.
3289///
3290/// This type is not used in any activity, and only used as *part* of another schema.
3291///
3292#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3293#[serde_with::serde_as]
3294#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3295pub struct TargetAttribute {
3296 /// Optional. ID of the `Target`. The value of this field could be one of the following: * The last segment of a target name * "*", all targets in a location
3297 pub id: Option<String>,
3298 /// Target labels.
3299 pub labels: Option<HashMap<String, String>>,
3300}
3301
3302impl common::Part for TargetAttribute {}
3303
3304/// Details of rendering for a single target.
3305///
3306/// This type is not used in any activity, and only used as *part* of another schema.
3307///
3308#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3309#[serde_with::serde_as]
3310#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3311pub struct TargetRender {
3312 /// Output only. Reason this render failed. This will always be unspecified while the render in progress.
3313 #[serde(rename = "failureCause")]
3314 pub failure_cause: Option<String>,
3315 /// Output only. Additional information about the render failure, if available.
3316 #[serde(rename = "failureMessage")]
3317 pub failure_message: Option<String>,
3318 /// Output only. Metadata related to the `Release` render for this Target.
3319 pub metadata: Option<RenderMetadata>,
3320 /// 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}`.
3321 #[serde(rename = "renderingBuild")]
3322 pub rendering_build: Option<String>,
3323 /// Output only. Current state of the render operation for this Target.
3324 #[serde(rename = "renderingState")]
3325 pub rendering_state: Option<String>,
3326}
3327
3328impl common::Part for TargetRender {}
3329
3330/// The targets involved in a single timed promotion.
3331///
3332/// This type is not used in any activity, and only used as *part* of another schema.
3333///
3334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3335#[serde_with::serde_as]
3336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3337pub struct Targets {
3338 /// Optional. The destination target ID.
3339 #[serde(rename = "destinationTargetId")]
3340 pub destination_target_id: Option<String>,
3341 /// Optional. The source target ID.
3342 #[serde(rename = "sourceTargetId")]
3343 pub source_target_id: Option<String>,
3344}
3345
3346impl common::Part for Targets {}
3347
3348/// `TargetsPresentCondition` contains information on any Targets referenced in the Delivery Pipeline that do not actually exist.
3349///
3350/// This type is not used in any activity, and only used as *part* of another schema.
3351///
3352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3353#[serde_with::serde_as]
3354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3355pub struct TargetsPresentCondition {
3356 /// The list of Target names that do not exist. For example, `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
3357 #[serde(rename = "missingTargets")]
3358 pub missing_targets: Option<Vec<String>>,
3359 /// True if there aren't any missing Targets.
3360 pub status: Option<bool>,
3361 /// Last time the condition was updated.
3362 #[serde(rename = "updateTime")]
3363 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3364}
3365
3366impl common::Part for TargetsPresentCondition {}
3367
3368/// TargetsTypeCondition contains information on whether the Targets defined in the Delivery Pipeline are of the same type.
3369///
3370/// This type is not used in any activity, and only used as *part* of another schema.
3371///
3372#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3373#[serde_with::serde_as]
3374#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3375pub struct TargetsTypeCondition {
3376 /// Human readable error message.
3377 #[serde(rename = "errorDetails")]
3378 pub error_details: Option<String>,
3379 /// 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.
3380 pub status: Option<bool>,
3381}
3382
3383impl common::Part for TargetsTypeCondition {}
3384
3385/// The request object used by `TerminateJobRun`.
3386///
3387/// # Activities
3388///
3389/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3390/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3391///
3392/// * [locations delivery pipelines releases rollouts job runs terminate projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall) (request)
3393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3394#[serde_with::serde_as]
3395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3396pub struct TerminateJobRunRequest {
3397 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
3398 #[serde(rename = "overrideDeployPolicy")]
3399 pub override_deploy_policy: Option<Vec<String>>,
3400}
3401
3402impl common::RequestValue for TerminateJobRunRequest {}
3403
3404/// The response object from `TerminateJobRun`.
3405///
3406/// # Activities
3407///
3408/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3409/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3410///
3411/// * [locations delivery pipelines releases rollouts job runs terminate projects](ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall) (response)
3412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3413#[serde_with::serde_as]
3414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3415pub struct TerminateJobRunResponse {
3416 _never_set: Option<bool>,
3417}
3418
3419impl common::ResponseResult for TerminateJobRunResponse {}
3420
3421/// Request message for `TestIamPermissions` method.
3422///
3423/// # Activities
3424///
3425/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3426/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3427///
3428/// * [locations delivery pipelines test iam permissions projects](ProjectLocationDeliveryPipelineTestIamPermissionCall) (request)
3429/// * [locations targets test iam permissions projects](ProjectLocationTargetTestIamPermissionCall) (request)
3430#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3431#[serde_with::serde_as]
3432#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3433pub struct TestIamPermissionsRequest {
3434 /// 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).
3435 pub permissions: Option<Vec<String>>,
3436}
3437
3438impl common::RequestValue for TestIamPermissionsRequest {}
3439
3440/// Response message for `TestIamPermissions` method.
3441///
3442/// # Activities
3443///
3444/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3445/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3446///
3447/// * [locations delivery pipelines test iam permissions projects](ProjectLocationDeliveryPipelineTestIamPermissionCall) (response)
3448/// * [locations targets test iam permissions projects](ProjectLocationTargetTestIamPermissionCall) (response)
3449#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3450#[serde_with::serde_as]
3451#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3452pub struct TestIamPermissionsResponse {
3453 /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed.
3454 pub permissions: Option<Vec<String>>,
3455}
3456
3457impl common::ResponseResult for TestIamPermissionsResponse {}
3458
3459/// Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`.
3460///
3461/// This type is not used in any activity, and only used as *part* of another schema.
3462///
3463#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3464#[serde_with::serde_as]
3465#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3466pub struct TimeOfDay {
3467 /// Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time.
3468 pub hours: Option<i32>,
3469 /// Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.
3470 pub minutes: Option<i32>,
3471 /// Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.
3472 pub nanos: Option<i32>,
3473 /// Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.
3474 pub seconds: Option<i32>,
3475}
3476
3477impl common::Part for TimeOfDay {}
3478
3479/// Time windows within which actions are restricted. See the [documentation](https://cloud.google.com/deploy/docs/deploy-policy#dates_times) for more information on how to configure dates/times.
3480///
3481/// This type is not used in any activity, and only used as *part* of another schema.
3482///
3483#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3484#[serde_with::serde_as]
3485#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3486pub struct TimeWindows {
3487 /// Optional. One-time windows within which actions are restricted.
3488 #[serde(rename = "oneTimeWindows")]
3489 pub one_time_windows: Option<Vec<OneTimeWindow>>,
3490 /// Required. The time zone in IANA format [IANA Time Zone Database](https://www.iana.org/time-zones) (e.g. America/New_York).
3491 #[serde(rename = "timeZone")]
3492 pub time_zone: Option<String>,
3493 /// Optional. Recurring weekly windows within which actions are restricted.
3494 #[serde(rename = "weeklyWindows")]
3495 pub weekly_windows: Option<Vec<WeeklyWindow>>,
3496}
3497
3498impl common::Part for TimeWindows {}
3499
3500/// `TimedPromoteReleaseCondition` contains conditions specific to an Automation with a Timed Promote Release rule defined.
3501///
3502/// This type is not used in any activity, and only used as *part* of another schema.
3503///
3504#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3505#[serde_with::serde_as]
3506#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3507pub struct TimedPromoteReleaseCondition {
3508 /// Output only. When the next scheduled promotion(s) will occur.
3509 #[serde(rename = "nextPromotionTime")]
3510 pub next_promotion_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3511 /// Output only. A list of targets involved in the upcoming timed promotion(s).
3512 #[serde(rename = "targetsList")]
3513 pub targets_list: Option<Vec<Targets>>,
3514}
3515
3516impl common::Part for TimedPromoteReleaseCondition {}
3517
3518/// Contains the information of an automated timed promote-release operation.
3519///
3520/// This type is not used in any activity, and only used as *part* of another schema.
3521///
3522#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3523#[serde_with::serde_as]
3524#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3525pub struct TimedPromoteReleaseOperation {
3526 /// Output only. The starting phase of the rollout created by this operation.
3527 pub phase: Option<String>,
3528 /// Output only. The name of the release to be promoted.
3529 pub release: Option<String>,
3530 /// 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.
3531 #[serde(rename = "targetId")]
3532 pub target_id: Option<String>,
3533}
3534
3535impl common::Part for TimedPromoteReleaseOperation {}
3536
3537/// The `TimedPromoteReleaseRule` will automatically promote a release from the current target(s) to the specified target(s) on a configured schedule.
3538///
3539/// This type is not used in any activity, and only used as *part* of another schema.
3540///
3541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3542#[serde_with::serde_as]
3543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3544pub struct TimedPromoteReleaseRule {
3545 /// Output only. Information around the state of the Automation rule.
3546 pub condition: Option<AutomationRuleCondition>,
3547 /// Optional. The starting phase of the rollout created by this rule. Default to the first phase.
3548 #[serde(rename = "destinationPhase")]
3549 pub destination_phase: Option<String>,
3550 /// 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 * "@next", the next target in the promotion sequence
3551 #[serde(rename = "destinationTargetId")]
3552 pub destination_target_id: Option<String>,
3553 /// 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])?`.
3554 pub id: Option<String>,
3555 /// Required. Schedule in crontab format. e.g. "0 9 * * 1" for every Monday at 9am.
3556 pub schedule: Option<String>,
3557 /// Required. The time zone in IANA format [IANA Time Zone Database](https://www.iana.org/time-zones) (e.g. America/New_York).
3558 #[serde(rename = "timeZone")]
3559 pub time_zone: Option<String>,
3560}
3561
3562impl common::Part for TimedPromoteReleaseRule {}
3563
3564/// ToolVersionSupportedCondition contains information about when support for the release's version of a Tool ends.
3565///
3566/// This type is not used in any activity, and only used as *part* of another schema.
3567///
3568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3569#[serde_with::serde_as]
3570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3571pub struct ToolVersionSupportedCondition {
3572 /// Output only. The time at which this release's version of the Tool will enter maintenance mode.
3573 #[serde(rename = "maintenanceModeTime")]
3574 pub maintenance_mode_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3575 /// Output only. True if the version of Tool used by this release is supported.
3576 pub status: Option<bool>,
3577 /// Output only. The time at which this release's version of the Tool will no longer be supported.
3578 #[serde(rename = "supportExpirationTime")]
3579 pub support_expiration_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3580 /// Output only. The Tool support state for this release's version of the Tool.
3581 #[serde(rename = "toolVersionSupportState")]
3582 pub tool_version_support_state: Option<String>,
3583}
3584
3585impl common::Part for ToolVersionSupportedCondition {}
3586
3587/// Details of ToolVersions for the release.
3588///
3589/// This type is not used in any activity, and only used as *part* of another schema.
3590///
3591#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3592#[serde_with::serde_as]
3593#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3594pub struct ToolVersions {
3595 /// Optional. The docker version to use for Cloud Deploy operations.
3596 pub docker: Option<String>,
3597 /// Optional. The helm version to use for Cloud Deploy operations.
3598 pub helm: Option<String>,
3599 /// Optional. The kpt version to use for Cloud Deploy operations.
3600 pub kpt: Option<String>,
3601 /// Optional. The kubectl version to use for Cloud Deploy operations.
3602 pub kubectl: Option<String>,
3603 /// Optional. The kustomize version to use for Cloud Deploy operations.
3604 pub kustomize: Option<String>,
3605 /// Optional. The skaffold version to use for Cloud Deploy operations.
3606 pub skaffold: Option<String>,
3607}
3608
3609impl common::Part for ToolVersions {}
3610
3611/// A verify Job.
3612///
3613/// This type is not used in any activity, and only used as *part* of another schema.
3614///
3615#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3616#[serde_with::serde_as]
3617#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3618pub struct VerifyJob {
3619 _never_set: Option<bool>,
3620}
3621
3622impl common::Part for VerifyJob {}
3623
3624/// VerifyJobRun contains information specific to a verify `JobRun`.
3625///
3626/// This type is not used in any activity, and only used as *part* of another schema.
3627///
3628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3629#[serde_with::serde_as]
3630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3631pub struct VerifyJobRun {
3632 /// Output only. URI of a directory containing the verify artifacts. This contains the Skaffold event log.
3633 #[serde(rename = "artifactUri")]
3634 pub artifact_uri: Option<String>,
3635 /// Output only. The resource name of the Cloud Build `Build` object that is used to verify. Format is `projects/{project}/locations/{location}/builds/{build}`.
3636 pub build: Option<String>,
3637 /// Output only. File path of the Skaffold event log relative to the artifact URI.
3638 #[serde(rename = "eventLogPath")]
3639 pub event_log_path: Option<String>,
3640 /// Output only. The reason the verify failed. This will always be unspecified while the verify is in progress or if it succeeded.
3641 #[serde(rename = "failureCause")]
3642 pub failure_cause: Option<String>,
3643 /// Output only. Additional information about the verify failure, if available.
3644 #[serde(rename = "failureMessage")]
3645 pub failure_message: Option<String>,
3646}
3647
3648impl common::Part for VerifyJobRun {}
3649
3650/// Weekly windows. For example, blocking actions every Saturday and Sunday. Another example would be blocking actions every weekday from 5pm to midnight.
3651///
3652/// This type is not used in any activity, and only used as *part* of another schema.
3653///
3654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3655#[serde_with::serde_as]
3656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3657pub struct WeeklyWindow {
3658 /// Optional. Days of week. If left empty, all days of the week will be included.
3659 #[serde(rename = "daysOfWeek")]
3660 pub days_of_week: Option<Vec<String>>,
3661 /// Optional. End time (exclusive). Use 24:00 to indicate midnight. If you specify end_time you must also specify start_time. If left empty, this will block for the entire day for the days specified in days_of_week.
3662 #[serde(rename = "endTime")]
3663 pub end_time: Option<TimeOfDay>,
3664 /// Optional. Start time (inclusive). Use 00:00 for the beginning of the day. If you specify start_time you must also specify end_time. If left empty, this will block for the entire day for the days specified in days_of_week.
3665 #[serde(rename = "startTime")]
3666 pub start_time: Option<TimeOfDay>,
3667}
3668
3669impl common::Part for WeeklyWindow {}
3670
3671// ###################
3672// MethodBuilders ###
3673// #################
3674
3675/// A builder providing access to all methods supported on *project* resources.
3676/// It is not used directly, but through the [`CloudDeploy`] hub.
3677///
3678/// # Example
3679///
3680/// Instantiate a resource builder
3681///
3682/// ```test_harness,no_run
3683/// extern crate hyper;
3684/// extern crate hyper_rustls;
3685/// extern crate google_clouddeploy1 as clouddeploy1;
3686///
3687/// # async fn dox() {
3688/// use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3689///
3690/// let secret: yup_oauth2::ApplicationSecret = Default::default();
3691/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
3692/// .with_native_roots()
3693/// .unwrap()
3694/// .https_only()
3695/// .enable_http2()
3696/// .build();
3697///
3698/// let executor = hyper_util::rt::TokioExecutor::new();
3699/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3700/// secret,
3701/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3702/// yup_oauth2::client::CustomHyperClientBuilder::from(
3703/// hyper_util::client::legacy::Client::builder(executor).build(connector),
3704/// ),
3705/// ).build().await.unwrap();
3706///
3707/// let client = hyper_util::client::legacy::Client::builder(
3708/// hyper_util::rt::TokioExecutor::new()
3709/// )
3710/// .build(
3711/// hyper_rustls::HttpsConnectorBuilder::new()
3712/// .with_native_roots()
3713/// .unwrap()
3714/// .https_or_http()
3715/// .enable_http2()
3716/// .build()
3717/// );
3718/// let mut hub = CloudDeploy::new(client, auth);
3719/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
3720/// // 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_deploy_policies_create(...)`, `locations_deploy_policies_delete(...)`, `locations_deploy_policies_get(...)`, `locations_deploy_policies_get_iam_policy(...)`, `locations_deploy_policies_list(...)`, `locations_deploy_policies_patch(...)`, `locations_deploy_policies_set_iam_policy(...)`, `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(...)`
3721/// // to build up your call.
3722/// let rb = hub.projects();
3723/// # }
3724/// ```
3725pub struct ProjectMethods<'a, C>
3726where
3727 C: 'a,
3728{
3729 hub: &'a CloudDeploy<C>,
3730}
3731
3732impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
3733
3734impl<'a, C> ProjectMethods<'a, C> {
3735 /// Create a builder to help you perform the following task:
3736 ///
3737 /// Creates a new CustomTargetType in a given project and location.
3738 ///
3739 /// # Arguments
3740 ///
3741 /// * `request` - No description provided.
3742 /// * `parent` - Required. The parent collection in which the `CustomTargetType` must be created. The format is `projects/{project_id}/locations/{location_name}`.
3743 pub fn locations_custom_target_types_create(
3744 &self,
3745 request: CustomTargetType,
3746 parent: &str,
3747 ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
3748 ProjectLocationCustomTargetTypeCreateCall {
3749 hub: self.hub,
3750 _request: request,
3751 _parent: parent.to_string(),
3752 _validate_only: Default::default(),
3753 _request_id: Default::default(),
3754 _custom_target_type_id: Default::default(),
3755 _delegate: Default::default(),
3756 _additional_params: Default::default(),
3757 _scopes: Default::default(),
3758 }
3759 }
3760
3761 /// Create a builder to help you perform the following task:
3762 ///
3763 /// Deletes a single CustomTargetType.
3764 ///
3765 /// # Arguments
3766 ///
3767 /// * `name` - Required. The name of the `CustomTargetType` to delete. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
3768 pub fn locations_custom_target_types_delete(
3769 &self,
3770 name: &str,
3771 ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
3772 ProjectLocationCustomTargetTypeDeleteCall {
3773 hub: self.hub,
3774 _name: name.to_string(),
3775 _validate_only: Default::default(),
3776 _request_id: Default::default(),
3777 _etag: Default::default(),
3778 _allow_missing: Default::default(),
3779 _delegate: Default::default(),
3780 _additional_params: Default::default(),
3781 _scopes: Default::default(),
3782 }
3783 }
3784
3785 /// Create a builder to help you perform the following task:
3786 ///
3787 /// Gets details of a single CustomTargetType.
3788 ///
3789 /// # Arguments
3790 ///
3791 /// * `name` - Required. Name of the `CustomTargetType`. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
3792 pub fn locations_custom_target_types_get(
3793 &self,
3794 name: &str,
3795 ) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
3796 ProjectLocationCustomTargetTypeGetCall {
3797 hub: self.hub,
3798 _name: name.to_string(),
3799 _delegate: Default::default(),
3800 _additional_params: Default::default(),
3801 _scopes: Default::default(),
3802 }
3803 }
3804
3805 /// Create a builder to help you perform the following task:
3806 ///
3807 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
3808 ///
3809 /// # Arguments
3810 ///
3811 /// * `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.
3812 pub fn locations_custom_target_types_get_iam_policy(
3813 &self,
3814 resource: &str,
3815 ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
3816 ProjectLocationCustomTargetTypeGetIamPolicyCall {
3817 hub: self.hub,
3818 _resource: resource.to_string(),
3819 _options_requested_policy_version: Default::default(),
3820 _delegate: Default::default(),
3821 _additional_params: Default::default(),
3822 _scopes: Default::default(),
3823 }
3824 }
3825
3826 /// Create a builder to help you perform the following task:
3827 ///
3828 /// Lists CustomTargetTypes in a given project and location.
3829 ///
3830 /// # Arguments
3831 ///
3832 /// * `parent` - Required. The parent that owns this collection of custom target types. Format must be `projects/{project_id}/locations/{location_name}`.
3833 pub fn locations_custom_target_types_list(
3834 &self,
3835 parent: &str,
3836 ) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
3837 ProjectLocationCustomTargetTypeListCall {
3838 hub: self.hub,
3839 _parent: parent.to_string(),
3840 _page_token: Default::default(),
3841 _page_size: Default::default(),
3842 _order_by: Default::default(),
3843 _filter: Default::default(),
3844 _delegate: Default::default(),
3845 _additional_params: Default::default(),
3846 _scopes: Default::default(),
3847 }
3848 }
3849
3850 /// Create a builder to help you perform the following task:
3851 ///
3852 /// Updates a single CustomTargetType.
3853 ///
3854 /// # Arguments
3855 ///
3856 /// * `request` - No description provided.
3857 /// * `name` - Identifier. 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])?`
3858 pub fn locations_custom_target_types_patch(
3859 &self,
3860 request: CustomTargetType,
3861 name: &str,
3862 ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
3863 ProjectLocationCustomTargetTypePatchCall {
3864 hub: self.hub,
3865 _request: request,
3866 _name: name.to_string(),
3867 _validate_only: Default::default(),
3868 _update_mask: Default::default(),
3869 _request_id: Default::default(),
3870 _allow_missing: Default::default(),
3871 _delegate: Default::default(),
3872 _additional_params: Default::default(),
3873 _scopes: Default::default(),
3874 }
3875 }
3876
3877 /// Create a builder to help you perform the following task:
3878 ///
3879 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
3880 ///
3881 /// # Arguments
3882 ///
3883 /// * `request` - No description provided.
3884 /// * `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.
3885 pub fn locations_custom_target_types_set_iam_policy(
3886 &self,
3887 request: SetIamPolicyRequest,
3888 resource: &str,
3889 ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
3890 ProjectLocationCustomTargetTypeSetIamPolicyCall {
3891 hub: self.hub,
3892 _request: request,
3893 _resource: resource.to_string(),
3894 _delegate: Default::default(),
3895 _additional_params: Default::default(),
3896 _scopes: Default::default(),
3897 }
3898 }
3899
3900 /// Create a builder to help you perform the following task:
3901 ///
3902 /// 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.
3903 ///
3904 /// # Arguments
3905 ///
3906 /// * `request` - No description provided.
3907 /// * `name` - Required. Name of the `AutomationRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
3908 pub fn locations_delivery_pipelines_automation_runs_cancel(
3909 &self,
3910 request: CancelAutomationRunRequest,
3911 name: &str,
3912 ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
3913 ProjectLocationDeliveryPipelineAutomationRunCancelCall {
3914 hub: self.hub,
3915 _request: request,
3916 _name: name.to_string(),
3917 _delegate: Default::default(),
3918 _additional_params: Default::default(),
3919 _scopes: Default::default(),
3920 }
3921 }
3922
3923 /// Create a builder to help you perform the following task:
3924 ///
3925 /// Gets details of a single AutomationRun.
3926 ///
3927 /// # Arguments
3928 ///
3929 /// * `name` - Required. Name of the `AutomationRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
3930 pub fn locations_delivery_pipelines_automation_runs_get(
3931 &self,
3932 name: &str,
3933 ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
3934 ProjectLocationDeliveryPipelineAutomationRunGetCall {
3935 hub: self.hub,
3936 _name: name.to_string(),
3937 _delegate: Default::default(),
3938 _additional_params: Default::default(),
3939 _scopes: Default::default(),
3940 }
3941 }
3942
3943 /// Create a builder to help you perform the following task:
3944 ///
3945 /// Lists AutomationRuns in a given project and location.
3946 ///
3947 /// # Arguments
3948 ///
3949 /// * `parent` - Required. The parent `Delivery Pipeline`, which owns this collection of automationRuns. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}`.
3950 pub fn locations_delivery_pipelines_automation_runs_list(
3951 &self,
3952 parent: &str,
3953 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
3954 ProjectLocationDeliveryPipelineAutomationRunListCall {
3955 hub: self.hub,
3956 _parent: parent.to_string(),
3957 _page_token: Default::default(),
3958 _page_size: Default::default(),
3959 _order_by: Default::default(),
3960 _filter: Default::default(),
3961 _delegate: Default::default(),
3962 _additional_params: Default::default(),
3963 _scopes: Default::default(),
3964 }
3965 }
3966
3967 /// Create a builder to help you perform the following task:
3968 ///
3969 /// Creates a new Automation in a given project and location.
3970 ///
3971 /// # Arguments
3972 ///
3973 /// * `request` - No description provided.
3974 /// * `parent` - Required. The parent collection in which the `Automation` must be created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
3975 pub fn locations_delivery_pipelines_automations_create(
3976 &self,
3977 request: Automation,
3978 parent: &str,
3979 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
3980 ProjectLocationDeliveryPipelineAutomationCreateCall {
3981 hub: self.hub,
3982 _request: request,
3983 _parent: parent.to_string(),
3984 _validate_only: Default::default(),
3985 _request_id: Default::default(),
3986 _automation_id: Default::default(),
3987 _delegate: Default::default(),
3988 _additional_params: Default::default(),
3989 _scopes: Default::default(),
3990 }
3991 }
3992
3993 /// Create a builder to help you perform the following task:
3994 ///
3995 /// Deletes a single Automation resource.
3996 ///
3997 /// # Arguments
3998 ///
3999 /// * `name` - Required. The name of the `Automation` to delete. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
4000 pub fn locations_delivery_pipelines_automations_delete(
4001 &self,
4002 name: &str,
4003 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
4004 ProjectLocationDeliveryPipelineAutomationDeleteCall {
4005 hub: self.hub,
4006 _name: name.to_string(),
4007 _validate_only: Default::default(),
4008 _request_id: Default::default(),
4009 _etag: Default::default(),
4010 _allow_missing: Default::default(),
4011 _delegate: Default::default(),
4012 _additional_params: Default::default(),
4013 _scopes: Default::default(),
4014 }
4015 }
4016
4017 /// Create a builder to help you perform the following task:
4018 ///
4019 /// Gets details of a single Automation.
4020 ///
4021 /// # Arguments
4022 ///
4023 /// * `name` - Required. Name of the `Automation`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
4024 pub fn locations_delivery_pipelines_automations_get(
4025 &self,
4026 name: &str,
4027 ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
4028 ProjectLocationDeliveryPipelineAutomationGetCall {
4029 hub: self.hub,
4030 _name: name.to_string(),
4031 _delegate: Default::default(),
4032 _additional_params: Default::default(),
4033 _scopes: Default::default(),
4034 }
4035 }
4036
4037 /// Create a builder to help you perform the following task:
4038 ///
4039 /// Lists Automations in a given project and location.
4040 ///
4041 /// # Arguments
4042 ///
4043 /// * `parent` - Required. The parent `Delivery Pipeline`, which owns this collection of automations. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
4044 pub fn locations_delivery_pipelines_automations_list(
4045 &self,
4046 parent: &str,
4047 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
4048 ProjectLocationDeliveryPipelineAutomationListCall {
4049 hub: self.hub,
4050 _parent: parent.to_string(),
4051 _page_token: Default::default(),
4052 _page_size: Default::default(),
4053 _order_by: Default::default(),
4054 _filter: Default::default(),
4055 _delegate: Default::default(),
4056 _additional_params: Default::default(),
4057 _scopes: Default::default(),
4058 }
4059 }
4060
4061 /// Create a builder to help you perform the following task:
4062 ///
4063 /// Updates the parameters of a single Automation resource.
4064 ///
4065 /// # Arguments
4066 ///
4067 /// * `request` - No description provided.
4068 /// * `name` - Output only. Name of the `Automation`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automations/{automation}`.
4069 pub fn locations_delivery_pipelines_automations_patch(
4070 &self,
4071 request: Automation,
4072 name: &str,
4073 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
4074 ProjectLocationDeliveryPipelineAutomationPatchCall {
4075 hub: self.hub,
4076 _request: request,
4077 _name: name.to_string(),
4078 _validate_only: Default::default(),
4079 _update_mask: Default::default(),
4080 _request_id: Default::default(),
4081 _allow_missing: Default::default(),
4082 _delegate: Default::default(),
4083 _additional_params: Default::default(),
4084 _scopes: Default::default(),
4085 }
4086 }
4087
4088 /// Create a builder to help you perform the following task:
4089 ///
4090 /// Gets details of a single JobRun.
4091 ///
4092 /// # Arguments
4093 ///
4094 /// * `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}`.
4095 pub fn locations_delivery_pipelines_releases_rollouts_job_runs_get(
4096 &self,
4097 name: &str,
4098 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
4099 ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall {
4100 hub: self.hub,
4101 _name: name.to_string(),
4102 _delegate: Default::default(),
4103 _additional_params: Default::default(),
4104 _scopes: Default::default(),
4105 }
4106 }
4107
4108 /// Create a builder to help you perform the following task:
4109 ///
4110 /// Lists JobRuns in a given project and location.
4111 ///
4112 /// # Arguments
4113 ///
4114 /// * `parent` - Required. The `Rollout` which owns this collection of `JobRun` objects.
4115 pub fn locations_delivery_pipelines_releases_rollouts_job_runs_list(
4116 &self,
4117 parent: &str,
4118 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
4119 ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall {
4120 hub: self.hub,
4121 _parent: parent.to_string(),
4122 _page_token: Default::default(),
4123 _page_size: Default::default(),
4124 _order_by: Default::default(),
4125 _filter: Default::default(),
4126 _delegate: Default::default(),
4127 _additional_params: Default::default(),
4128 _scopes: Default::default(),
4129 }
4130 }
4131
4132 /// Create a builder to help you perform the following task:
4133 ///
4134 /// Terminates a Job Run in a given project and location.
4135 ///
4136 /// # Arguments
4137 ///
4138 /// * `request` - No description provided.
4139 /// * `name` - Required. Name of the `JobRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}`.
4140 pub fn locations_delivery_pipelines_releases_rollouts_job_runs_terminate(
4141 &self,
4142 request: TerminateJobRunRequest,
4143 name: &str,
4144 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
4145 ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall {
4146 hub: self.hub,
4147 _request: request,
4148 _name: name.to_string(),
4149 _delegate: Default::default(),
4150 _additional_params: Default::default(),
4151 _scopes: Default::default(),
4152 }
4153 }
4154
4155 /// Create a builder to help you perform the following task:
4156 ///
4157 /// Advances a Rollout in a given project and location.
4158 ///
4159 /// # Arguments
4160 ///
4161 /// * `request` - No description provided.
4162 /// * `name` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
4163 pub fn locations_delivery_pipelines_releases_rollouts_advance(
4164 &self,
4165 request: AdvanceRolloutRequest,
4166 name: &str,
4167 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
4168 ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall {
4169 hub: self.hub,
4170 _request: request,
4171 _name: name.to_string(),
4172 _delegate: Default::default(),
4173 _additional_params: Default::default(),
4174 _scopes: Default::default(),
4175 }
4176 }
4177
4178 /// Create a builder to help you perform the following task:
4179 ///
4180 /// Approves a Rollout.
4181 ///
4182 /// # Arguments
4183 ///
4184 /// * `request` - No description provided.
4185 /// * `name` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
4186 pub fn locations_delivery_pipelines_releases_rollouts_approve(
4187 &self,
4188 request: ApproveRolloutRequest,
4189 name: &str,
4190 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
4191 ProjectLocationDeliveryPipelineReleaseRolloutApproveCall {
4192 hub: self.hub,
4193 _request: request,
4194 _name: name.to_string(),
4195 _delegate: Default::default(),
4196 _additional_params: Default::default(),
4197 _scopes: Default::default(),
4198 }
4199 }
4200
4201 /// Create a builder to help you perform the following task:
4202 ///
4203 /// Cancels a Rollout in a given project and location.
4204 ///
4205 /// # Arguments
4206 ///
4207 /// * `request` - No description provided.
4208 /// * `name` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
4209 pub fn locations_delivery_pipelines_releases_rollouts_cancel(
4210 &self,
4211 request: CancelRolloutRequest,
4212 name: &str,
4213 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
4214 ProjectLocationDeliveryPipelineReleaseRolloutCancelCall {
4215 hub: self.hub,
4216 _request: request,
4217 _name: name.to_string(),
4218 _delegate: Default::default(),
4219 _additional_params: Default::default(),
4220 _scopes: Default::default(),
4221 }
4222 }
4223
4224 /// Create a builder to help you perform the following task:
4225 ///
4226 /// Creates a new Rollout in a given project and location.
4227 ///
4228 /// # Arguments
4229 ///
4230 /// * `request` - No description provided.
4231 /// * `parent` - Required. The parent collection in which the `Rollout` must be created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
4232 pub fn locations_delivery_pipelines_releases_rollouts_create(
4233 &self,
4234 request: Rollout,
4235 parent: &str,
4236 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
4237 ProjectLocationDeliveryPipelineReleaseRolloutCreateCall {
4238 hub: self.hub,
4239 _request: request,
4240 _parent: parent.to_string(),
4241 _validate_only: Default::default(),
4242 _starting_phase_id: Default::default(),
4243 _rollout_id: Default::default(),
4244 _request_id: Default::default(),
4245 _override_deploy_policy: Default::default(),
4246 _delegate: Default::default(),
4247 _additional_params: Default::default(),
4248 _scopes: Default::default(),
4249 }
4250 }
4251
4252 /// Create a builder to help you perform the following task:
4253 ///
4254 /// Gets details of a single Rollout.
4255 ///
4256 /// # Arguments
4257 ///
4258 /// * `name` - Required. Name of the `Rollout`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}`.
4259 pub fn locations_delivery_pipelines_releases_rollouts_get(
4260 &self,
4261 name: &str,
4262 ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
4263 ProjectLocationDeliveryPipelineReleaseRolloutGetCall {
4264 hub: self.hub,
4265 _name: name.to_string(),
4266 _delegate: Default::default(),
4267 _additional_params: Default::default(),
4268 _scopes: Default::default(),
4269 }
4270 }
4271
4272 /// Create a builder to help you perform the following task:
4273 ///
4274 /// Ignores the specified Job in a Rollout.
4275 ///
4276 /// # Arguments
4277 ///
4278 /// * `request` - No description provided.
4279 /// * `rollout` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
4280 pub fn locations_delivery_pipelines_releases_rollouts_ignore_job(
4281 &self,
4282 request: IgnoreJobRequest,
4283 rollout: &str,
4284 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
4285 ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall {
4286 hub: self.hub,
4287 _request: request,
4288 _rollout: rollout.to_string(),
4289 _delegate: Default::default(),
4290 _additional_params: Default::default(),
4291 _scopes: Default::default(),
4292 }
4293 }
4294
4295 /// Create a builder to help you perform the following task:
4296 ///
4297 /// Lists Rollouts in a given project and location.
4298 ///
4299 /// # Arguments
4300 ///
4301 /// * `parent` - Required. The `Release` which owns this collection of `Rollout` objects.
4302 pub fn locations_delivery_pipelines_releases_rollouts_list(
4303 &self,
4304 parent: &str,
4305 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
4306 ProjectLocationDeliveryPipelineReleaseRolloutListCall {
4307 hub: self.hub,
4308 _parent: parent.to_string(),
4309 _page_token: Default::default(),
4310 _page_size: Default::default(),
4311 _order_by: Default::default(),
4312 _filter: Default::default(),
4313 _delegate: Default::default(),
4314 _additional_params: Default::default(),
4315 _scopes: Default::default(),
4316 }
4317 }
4318
4319 /// Create a builder to help you perform the following task:
4320 ///
4321 /// Retries the specified Job in a Rollout.
4322 ///
4323 /// # Arguments
4324 ///
4325 /// * `request` - No description provided.
4326 /// * `rollout` - Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
4327 pub fn locations_delivery_pipelines_releases_rollouts_retry_job(
4328 &self,
4329 request: RetryJobRequest,
4330 rollout: &str,
4331 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
4332 ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall {
4333 hub: self.hub,
4334 _request: request,
4335 _rollout: rollout.to_string(),
4336 _delegate: Default::default(),
4337 _additional_params: Default::default(),
4338 _scopes: Default::default(),
4339 }
4340 }
4341
4342 /// Create a builder to help you perform the following task:
4343 ///
4344 /// Abandons a Release in the Delivery Pipeline.
4345 ///
4346 /// # Arguments
4347 ///
4348 /// * `request` - No description provided.
4349 /// * `name` - Required. Name of the Release. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}`.
4350 pub fn locations_delivery_pipelines_releases_abandon(
4351 &self,
4352 request: AbandonReleaseRequest,
4353 name: &str,
4354 ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
4355 ProjectLocationDeliveryPipelineReleaseAbandonCall {
4356 hub: self.hub,
4357 _request: request,
4358 _name: name.to_string(),
4359 _delegate: Default::default(),
4360 _additional_params: Default::default(),
4361 _scopes: Default::default(),
4362 }
4363 }
4364
4365 /// Create a builder to help you perform the following task:
4366 ///
4367 /// Creates a new Release in a given project and location.
4368 ///
4369 /// # Arguments
4370 ///
4371 /// * `request` - No description provided.
4372 /// * `parent` - Required. The parent collection in which the `Release` is created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
4373 pub fn locations_delivery_pipelines_releases_create(
4374 &self,
4375 request: Release,
4376 parent: &str,
4377 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
4378 ProjectLocationDeliveryPipelineReleaseCreateCall {
4379 hub: self.hub,
4380 _request: request,
4381 _parent: parent.to_string(),
4382 _validate_only: Default::default(),
4383 _request_id: Default::default(),
4384 _release_id: Default::default(),
4385 _override_deploy_policy: Default::default(),
4386 _delegate: Default::default(),
4387 _additional_params: Default::default(),
4388 _scopes: Default::default(),
4389 }
4390 }
4391
4392 /// Create a builder to help you perform the following task:
4393 ///
4394 /// Gets details of a single Release.
4395 ///
4396 /// # Arguments
4397 ///
4398 /// * `name` - Required. Name of the `Release`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
4399 pub fn locations_delivery_pipelines_releases_get(
4400 &self,
4401 name: &str,
4402 ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
4403 ProjectLocationDeliveryPipelineReleaseGetCall {
4404 hub: self.hub,
4405 _name: name.to_string(),
4406 _delegate: Default::default(),
4407 _additional_params: Default::default(),
4408 _scopes: Default::default(),
4409 }
4410 }
4411
4412 /// Create a builder to help you perform the following task:
4413 ///
4414 /// Lists Releases in a given project and location.
4415 ///
4416 /// # Arguments
4417 ///
4418 /// * `parent` - Required. The `DeliveryPipeline` which owns this collection of `Release` objects.
4419 pub fn locations_delivery_pipelines_releases_list(
4420 &self,
4421 parent: &str,
4422 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
4423 ProjectLocationDeliveryPipelineReleaseListCall {
4424 hub: self.hub,
4425 _parent: parent.to_string(),
4426 _page_token: Default::default(),
4427 _page_size: Default::default(),
4428 _order_by: Default::default(),
4429 _filter: Default::default(),
4430 _delegate: Default::default(),
4431 _additional_params: Default::default(),
4432 _scopes: Default::default(),
4433 }
4434 }
4435
4436 /// Create a builder to help you perform the following task:
4437 ///
4438 /// Creates a new DeliveryPipeline in a given project and location.
4439 ///
4440 /// # Arguments
4441 ///
4442 /// * `request` - No description provided.
4443 /// * `parent` - Required. The parent collection in which the `DeliveryPipeline` must be created. The format is `projects/{project_id}/locations/{location_name}`.
4444 pub fn locations_delivery_pipelines_create(
4445 &self,
4446 request: DeliveryPipeline,
4447 parent: &str,
4448 ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
4449 ProjectLocationDeliveryPipelineCreateCall {
4450 hub: self.hub,
4451 _request: request,
4452 _parent: parent.to_string(),
4453 _validate_only: Default::default(),
4454 _request_id: Default::default(),
4455 _delivery_pipeline_id: Default::default(),
4456 _delegate: Default::default(),
4457 _additional_params: Default::default(),
4458 _scopes: Default::default(),
4459 }
4460 }
4461
4462 /// Create a builder to help you perform the following task:
4463 ///
4464 /// Deletes a single DeliveryPipeline.
4465 ///
4466 /// # Arguments
4467 ///
4468 /// * `name` - Required. The name of the `DeliveryPipeline` to delete. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
4469 pub fn locations_delivery_pipelines_delete(
4470 &self,
4471 name: &str,
4472 ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
4473 ProjectLocationDeliveryPipelineDeleteCall {
4474 hub: self.hub,
4475 _name: name.to_string(),
4476 _validate_only: Default::default(),
4477 _request_id: Default::default(),
4478 _force: Default::default(),
4479 _etag: Default::default(),
4480 _allow_missing: Default::default(),
4481 _delegate: Default::default(),
4482 _additional_params: Default::default(),
4483 _scopes: Default::default(),
4484 }
4485 }
4486
4487 /// Create a builder to help you perform the following task:
4488 ///
4489 /// Gets details of a single DeliveryPipeline.
4490 ///
4491 /// # Arguments
4492 ///
4493 /// * `name` - Required. Name of the `DeliveryPipeline`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
4494 pub fn locations_delivery_pipelines_get(
4495 &self,
4496 name: &str,
4497 ) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
4498 ProjectLocationDeliveryPipelineGetCall {
4499 hub: self.hub,
4500 _name: name.to_string(),
4501 _delegate: Default::default(),
4502 _additional_params: Default::default(),
4503 _scopes: Default::default(),
4504 }
4505 }
4506
4507 /// Create a builder to help you perform the following task:
4508 ///
4509 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4510 ///
4511 /// # Arguments
4512 ///
4513 /// * `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.
4514 pub fn locations_delivery_pipelines_get_iam_policy(
4515 &self,
4516 resource: &str,
4517 ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
4518 ProjectLocationDeliveryPipelineGetIamPolicyCall {
4519 hub: self.hub,
4520 _resource: resource.to_string(),
4521 _options_requested_policy_version: Default::default(),
4522 _delegate: Default::default(),
4523 _additional_params: Default::default(),
4524 _scopes: Default::default(),
4525 }
4526 }
4527
4528 /// Create a builder to help you perform the following task:
4529 ///
4530 /// Lists DeliveryPipelines in a given project and location.
4531 ///
4532 /// # Arguments
4533 ///
4534 /// * `parent` - Required. The parent, which owns this collection of pipelines. Format must be `projects/{project_id}/locations/{location_name}`.
4535 pub fn locations_delivery_pipelines_list(
4536 &self,
4537 parent: &str,
4538 ) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
4539 ProjectLocationDeliveryPipelineListCall {
4540 hub: self.hub,
4541 _parent: parent.to_string(),
4542 _page_token: Default::default(),
4543 _page_size: Default::default(),
4544 _order_by: Default::default(),
4545 _filter: Default::default(),
4546 _delegate: Default::default(),
4547 _additional_params: Default::default(),
4548 _scopes: Default::default(),
4549 }
4550 }
4551
4552 /// Create a builder to help you perform the following task:
4553 ///
4554 /// Updates the parameters of a single DeliveryPipeline.
4555 ///
4556 /// # Arguments
4557 ///
4558 /// * `request` - No description provided.
4559 /// * `name` - Identifier. 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])?`
4560 pub fn locations_delivery_pipelines_patch(
4561 &self,
4562 request: DeliveryPipeline,
4563 name: &str,
4564 ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
4565 ProjectLocationDeliveryPipelinePatchCall {
4566 hub: self.hub,
4567 _request: request,
4568 _name: name.to_string(),
4569 _validate_only: Default::default(),
4570 _update_mask: Default::default(),
4571 _request_id: Default::default(),
4572 _allow_missing: Default::default(),
4573 _delegate: Default::default(),
4574 _additional_params: Default::default(),
4575 _scopes: Default::default(),
4576 }
4577 }
4578
4579 /// Create a builder to help you perform the following task:
4580 ///
4581 /// Creates a `Rollout` to roll back the specified target.
4582 ///
4583 /// # Arguments
4584 ///
4585 /// * `request` - No description provided.
4586 /// * `name` - Required. The `DeliveryPipeline` for which the rollback `Rollout` must be created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
4587 pub fn locations_delivery_pipelines_rollback_target(
4588 &self,
4589 request: RollbackTargetRequest,
4590 name: &str,
4591 ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
4592 ProjectLocationDeliveryPipelineRollbackTargetCall {
4593 hub: self.hub,
4594 _request: request,
4595 _name: name.to_string(),
4596 _delegate: Default::default(),
4597 _additional_params: Default::default(),
4598 _scopes: Default::default(),
4599 }
4600 }
4601
4602 /// Create a builder to help you perform the following task:
4603 ///
4604 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4605 ///
4606 /// # Arguments
4607 ///
4608 /// * `request` - No description provided.
4609 /// * `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.
4610 pub fn locations_delivery_pipelines_set_iam_policy(
4611 &self,
4612 request: SetIamPolicyRequest,
4613 resource: &str,
4614 ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
4615 ProjectLocationDeliveryPipelineSetIamPolicyCall {
4616 hub: self.hub,
4617 _request: request,
4618 _resource: resource.to_string(),
4619 _delegate: Default::default(),
4620 _additional_params: Default::default(),
4621 _scopes: Default::default(),
4622 }
4623 }
4624
4625 /// Create a builder to help you perform the following task:
4626 ///
4627 /// 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.
4628 ///
4629 /// # Arguments
4630 ///
4631 /// * `request` - No description provided.
4632 /// * `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.
4633 pub fn locations_delivery_pipelines_test_iam_permissions(
4634 &self,
4635 request: TestIamPermissionsRequest,
4636 resource: &str,
4637 ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
4638 ProjectLocationDeliveryPipelineTestIamPermissionCall {
4639 hub: self.hub,
4640 _request: request,
4641 _resource: resource.to_string(),
4642 _delegate: Default::default(),
4643 _additional_params: Default::default(),
4644 _scopes: Default::default(),
4645 }
4646 }
4647
4648 /// Create a builder to help you perform the following task:
4649 ///
4650 /// Creates a new DeployPolicy in a given project and location.
4651 ///
4652 /// # Arguments
4653 ///
4654 /// * `request` - No description provided.
4655 /// * `parent` - Required. The parent collection in which the `DeployPolicy` must be created. The format is `projects/{project_id}/locations/{location_name}`.
4656 pub fn locations_deploy_policies_create(
4657 &self,
4658 request: DeployPolicy,
4659 parent: &str,
4660 ) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
4661 ProjectLocationDeployPolicyCreateCall {
4662 hub: self.hub,
4663 _request: request,
4664 _parent: parent.to_string(),
4665 _validate_only: Default::default(),
4666 _request_id: Default::default(),
4667 _deploy_policy_id: Default::default(),
4668 _delegate: Default::default(),
4669 _additional_params: Default::default(),
4670 _scopes: Default::default(),
4671 }
4672 }
4673
4674 /// Create a builder to help you perform the following task:
4675 ///
4676 /// Deletes a single DeployPolicy.
4677 ///
4678 /// # Arguments
4679 ///
4680 /// * `name` - Required. The name of the `DeployPolicy` to delete. The format is `projects/{project_id}/locations/{location_name}/deployPolicies/{deploy_policy_name}`.
4681 pub fn locations_deploy_policies_delete(
4682 &self,
4683 name: &str,
4684 ) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
4685 ProjectLocationDeployPolicyDeleteCall {
4686 hub: self.hub,
4687 _name: name.to_string(),
4688 _validate_only: Default::default(),
4689 _request_id: Default::default(),
4690 _etag: Default::default(),
4691 _allow_missing: Default::default(),
4692 _delegate: Default::default(),
4693 _additional_params: Default::default(),
4694 _scopes: Default::default(),
4695 }
4696 }
4697
4698 /// Create a builder to help you perform the following task:
4699 ///
4700 /// Gets details of a single DeployPolicy.
4701 ///
4702 /// # Arguments
4703 ///
4704 /// * `name` - Required. Name of the `DeployPolicy`. Format must be `projects/{project_id}/locations/{location_name}/deployPolicies/{deploy_policy_name}`.
4705 pub fn locations_deploy_policies_get(
4706 &self,
4707 name: &str,
4708 ) -> ProjectLocationDeployPolicyGetCall<'a, C> {
4709 ProjectLocationDeployPolicyGetCall {
4710 hub: self.hub,
4711 _name: name.to_string(),
4712 _delegate: Default::default(),
4713 _additional_params: Default::default(),
4714 _scopes: Default::default(),
4715 }
4716 }
4717
4718 /// Create a builder to help you perform the following task:
4719 ///
4720 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4721 ///
4722 /// # Arguments
4723 ///
4724 /// * `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.
4725 pub fn locations_deploy_policies_get_iam_policy(
4726 &self,
4727 resource: &str,
4728 ) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C> {
4729 ProjectLocationDeployPolicyGetIamPolicyCall {
4730 hub: self.hub,
4731 _resource: resource.to_string(),
4732 _options_requested_policy_version: Default::default(),
4733 _delegate: Default::default(),
4734 _additional_params: Default::default(),
4735 _scopes: Default::default(),
4736 }
4737 }
4738
4739 /// Create a builder to help you perform the following task:
4740 ///
4741 /// Lists DeployPolicies in a given project and location.
4742 ///
4743 /// # Arguments
4744 ///
4745 /// * `parent` - Required. The parent, which owns this collection of deploy policies. Format must be `projects/{project_id}/locations/{location_name}`.
4746 pub fn locations_deploy_policies_list(
4747 &self,
4748 parent: &str,
4749 ) -> ProjectLocationDeployPolicyListCall<'a, C> {
4750 ProjectLocationDeployPolicyListCall {
4751 hub: self.hub,
4752 _parent: parent.to_string(),
4753 _page_token: Default::default(),
4754 _page_size: Default::default(),
4755 _order_by: Default::default(),
4756 _filter: Default::default(),
4757 _delegate: Default::default(),
4758 _additional_params: Default::default(),
4759 _scopes: Default::default(),
4760 }
4761 }
4762
4763 /// Create a builder to help you perform the following task:
4764 ///
4765 /// Updates the parameters of a single DeployPolicy.
4766 ///
4767 /// # Arguments
4768 ///
4769 /// * `request` - No description provided.
4770 /// * `name` - Output only. Name of the `DeployPolicy`. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`. The `deployPolicy` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
4771 pub fn locations_deploy_policies_patch(
4772 &self,
4773 request: DeployPolicy,
4774 name: &str,
4775 ) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
4776 ProjectLocationDeployPolicyPatchCall {
4777 hub: self.hub,
4778 _request: request,
4779 _name: name.to_string(),
4780 _validate_only: Default::default(),
4781 _update_mask: Default::default(),
4782 _request_id: Default::default(),
4783 _allow_missing: Default::default(),
4784 _delegate: Default::default(),
4785 _additional_params: Default::default(),
4786 _scopes: Default::default(),
4787 }
4788 }
4789
4790 /// Create a builder to help you perform the following task:
4791 ///
4792 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
4793 ///
4794 /// # Arguments
4795 ///
4796 /// * `request` - No description provided.
4797 /// * `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.
4798 pub fn locations_deploy_policies_set_iam_policy(
4799 &self,
4800 request: SetIamPolicyRequest,
4801 resource: &str,
4802 ) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C> {
4803 ProjectLocationDeployPolicySetIamPolicyCall {
4804 hub: self.hub,
4805 _request: request,
4806 _resource: resource.to_string(),
4807 _delegate: Default::default(),
4808 _additional_params: Default::default(),
4809 _scopes: Default::default(),
4810 }
4811 }
4812
4813 /// Create a builder to help you perform the following task:
4814 ///
4815 /// 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`.
4816 ///
4817 /// # Arguments
4818 ///
4819 /// * `request` - No description provided.
4820 /// * `name` - The name of the operation resource to be cancelled.
4821 pub fn locations_operations_cancel(
4822 &self,
4823 request: CancelOperationRequest,
4824 name: &str,
4825 ) -> ProjectLocationOperationCancelCall<'a, C> {
4826 ProjectLocationOperationCancelCall {
4827 hub: self.hub,
4828 _request: request,
4829 _name: name.to_string(),
4830 _delegate: Default::default(),
4831 _additional_params: Default::default(),
4832 _scopes: Default::default(),
4833 }
4834 }
4835
4836 /// Create a builder to help you perform the following task:
4837 ///
4838 /// 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`.
4839 ///
4840 /// # Arguments
4841 ///
4842 /// * `name` - The name of the operation resource to be deleted.
4843 pub fn locations_operations_delete(
4844 &self,
4845 name: &str,
4846 ) -> ProjectLocationOperationDeleteCall<'a, C> {
4847 ProjectLocationOperationDeleteCall {
4848 hub: self.hub,
4849 _name: name.to_string(),
4850 _delegate: Default::default(),
4851 _additional_params: Default::default(),
4852 _scopes: Default::default(),
4853 }
4854 }
4855
4856 /// Create a builder to help you perform the following task:
4857 ///
4858 /// 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.
4859 ///
4860 /// # Arguments
4861 ///
4862 /// * `name` - The name of the operation resource.
4863 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
4864 ProjectLocationOperationGetCall {
4865 hub: self.hub,
4866 _name: name.to_string(),
4867 _delegate: Default::default(),
4868 _additional_params: Default::default(),
4869 _scopes: Default::default(),
4870 }
4871 }
4872
4873 /// Create a builder to help you perform the following task:
4874 ///
4875 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
4876 ///
4877 /// # Arguments
4878 ///
4879 /// * `name` - The name of the operation's parent resource.
4880 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
4881 ProjectLocationOperationListCall {
4882 hub: self.hub,
4883 _name: name.to_string(),
4884 _return_partial_success: Default::default(),
4885 _page_token: Default::default(),
4886 _page_size: Default::default(),
4887 _filter: Default::default(),
4888 _delegate: Default::default(),
4889 _additional_params: Default::default(),
4890 _scopes: Default::default(),
4891 }
4892 }
4893
4894 /// Create a builder to help you perform the following task:
4895 ///
4896 /// Creates a new Target in a given project and location.
4897 ///
4898 /// # Arguments
4899 ///
4900 /// * `request` - No description provided.
4901 /// * `parent` - Required. The parent collection in which the `Target` must be created. The format is `projects/{project_id}/locations/{location_name}`.
4902 pub fn locations_targets_create(
4903 &self,
4904 request: Target,
4905 parent: &str,
4906 ) -> ProjectLocationTargetCreateCall<'a, C> {
4907 ProjectLocationTargetCreateCall {
4908 hub: self.hub,
4909 _request: request,
4910 _parent: parent.to_string(),
4911 _validate_only: Default::default(),
4912 _target_id: Default::default(),
4913 _request_id: Default::default(),
4914 _delegate: Default::default(),
4915 _additional_params: Default::default(),
4916 _scopes: Default::default(),
4917 }
4918 }
4919
4920 /// Create a builder to help you perform the following task:
4921 ///
4922 /// Deletes a single Target.
4923 ///
4924 /// # Arguments
4925 ///
4926 /// * `name` - Required. The name of the `Target` to delete. The format is `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
4927 pub fn locations_targets_delete(&self, name: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
4928 ProjectLocationTargetDeleteCall {
4929 hub: self.hub,
4930 _name: name.to_string(),
4931 _validate_only: Default::default(),
4932 _request_id: Default::default(),
4933 _etag: Default::default(),
4934 _allow_missing: Default::default(),
4935 _delegate: Default::default(),
4936 _additional_params: Default::default(),
4937 _scopes: Default::default(),
4938 }
4939 }
4940
4941 /// Create a builder to help you perform the following task:
4942 ///
4943 /// Gets details of a single Target.
4944 ///
4945 /// # Arguments
4946 ///
4947 /// * `name` - Required. Name of the `Target`. Format must be `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
4948 pub fn locations_targets_get(&self, name: &str) -> ProjectLocationTargetGetCall<'a, C> {
4949 ProjectLocationTargetGetCall {
4950 hub: self.hub,
4951 _name: name.to_string(),
4952 _delegate: Default::default(),
4953 _additional_params: Default::default(),
4954 _scopes: Default::default(),
4955 }
4956 }
4957
4958 /// Create a builder to help you perform the following task:
4959 ///
4960 /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
4961 ///
4962 /// # Arguments
4963 ///
4964 /// * `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.
4965 pub fn locations_targets_get_iam_policy(
4966 &self,
4967 resource: &str,
4968 ) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
4969 ProjectLocationTargetGetIamPolicyCall {
4970 hub: self.hub,
4971 _resource: resource.to_string(),
4972 _options_requested_policy_version: Default::default(),
4973 _delegate: Default::default(),
4974 _additional_params: Default::default(),
4975 _scopes: Default::default(),
4976 }
4977 }
4978
4979 /// Create a builder to help you perform the following task:
4980 ///
4981 /// Lists Targets in a given project and location.
4982 ///
4983 /// # Arguments
4984 ///
4985 /// * `parent` - Required. The parent, which owns this collection of targets. Format must be `projects/{project_id}/locations/{location_name}`.
4986 pub fn locations_targets_list(&self, parent: &str) -> ProjectLocationTargetListCall<'a, C> {
4987 ProjectLocationTargetListCall {
4988 hub: self.hub,
4989 _parent: parent.to_string(),
4990 _page_token: Default::default(),
4991 _page_size: Default::default(),
4992 _order_by: Default::default(),
4993 _filter: Default::default(),
4994 _delegate: Default::default(),
4995 _additional_params: Default::default(),
4996 _scopes: Default::default(),
4997 }
4998 }
4999
5000 /// Create a builder to help you perform the following task:
5001 ///
5002 /// Updates the parameters of a single Target.
5003 ///
5004 /// # Arguments
5005 ///
5006 /// * `request` - No description provided.
5007 /// * `name` - Identifier. 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])?`
5008 pub fn locations_targets_patch(
5009 &self,
5010 request: Target,
5011 name: &str,
5012 ) -> ProjectLocationTargetPatchCall<'a, C> {
5013 ProjectLocationTargetPatchCall {
5014 hub: self.hub,
5015 _request: request,
5016 _name: name.to_string(),
5017 _validate_only: Default::default(),
5018 _update_mask: Default::default(),
5019 _request_id: Default::default(),
5020 _allow_missing: Default::default(),
5021 _delegate: Default::default(),
5022 _additional_params: Default::default(),
5023 _scopes: Default::default(),
5024 }
5025 }
5026
5027 /// Create a builder to help you perform the following task:
5028 ///
5029 /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
5030 ///
5031 /// # Arguments
5032 ///
5033 /// * `request` - No description provided.
5034 /// * `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.
5035 pub fn locations_targets_set_iam_policy(
5036 &self,
5037 request: SetIamPolicyRequest,
5038 resource: &str,
5039 ) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
5040 ProjectLocationTargetSetIamPolicyCall {
5041 hub: self.hub,
5042 _request: request,
5043 _resource: resource.to_string(),
5044 _delegate: Default::default(),
5045 _additional_params: Default::default(),
5046 _scopes: Default::default(),
5047 }
5048 }
5049
5050 /// Create a builder to help you perform the following task:
5051 ///
5052 /// 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.
5053 ///
5054 /// # Arguments
5055 ///
5056 /// * `request` - No description provided.
5057 /// * `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.
5058 pub fn locations_targets_test_iam_permissions(
5059 &self,
5060 request: TestIamPermissionsRequest,
5061 resource: &str,
5062 ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
5063 ProjectLocationTargetTestIamPermissionCall {
5064 hub: self.hub,
5065 _request: request,
5066 _resource: resource.to_string(),
5067 _delegate: Default::default(),
5068 _additional_params: Default::default(),
5069 _scopes: Default::default(),
5070 }
5071 }
5072
5073 /// Create a builder to help you perform the following task:
5074 ///
5075 /// Gets information about a location.
5076 ///
5077 /// # Arguments
5078 ///
5079 /// * `name` - Resource name for the location.
5080 pub fn locations_get(&self, name: &str) -> ProjectLocationGetCall<'a, C> {
5081 ProjectLocationGetCall {
5082 hub: self.hub,
5083 _name: name.to_string(),
5084 _delegate: Default::default(),
5085 _additional_params: Default::default(),
5086 _scopes: Default::default(),
5087 }
5088 }
5089
5090 /// Create a builder to help you perform the following task:
5091 ///
5092 /// Gets the configuration for a location.
5093 ///
5094 /// # Arguments
5095 ///
5096 /// * `name` - Required. Name of requested configuration.
5097 pub fn locations_get_config(&self, name: &str) -> ProjectLocationGetConfigCall<'a, C> {
5098 ProjectLocationGetConfigCall {
5099 hub: self.hub,
5100 _name: name.to_string(),
5101 _delegate: Default::default(),
5102 _additional_params: Default::default(),
5103 _scopes: Default::default(),
5104 }
5105 }
5106
5107 /// Create a builder to help you perform the following task:
5108 ///
5109 /// Lists information about the supported locations for this service.
5110 ///
5111 /// # Arguments
5112 ///
5113 /// * `name` - The resource that owns the locations collection, if applicable.
5114 pub fn locations_list(&self, name: &str) -> ProjectLocationListCall<'a, C> {
5115 ProjectLocationListCall {
5116 hub: self.hub,
5117 _name: name.to_string(),
5118 _page_token: Default::default(),
5119 _page_size: Default::default(),
5120 _filter: Default::default(),
5121 _extra_location_types: Default::default(),
5122 _delegate: Default::default(),
5123 _additional_params: Default::default(),
5124 _scopes: Default::default(),
5125 }
5126 }
5127}
5128
5129// ###################
5130// CallBuilders ###
5131// #################
5132
5133/// Creates a new CustomTargetType in a given project and location.
5134///
5135/// A builder for the *locations.customTargetTypes.create* method supported by a *project* resource.
5136/// It is not used directly, but through a [`ProjectMethods`] instance.
5137///
5138/// # Example
5139///
5140/// Instantiate a resource method builder
5141///
5142/// ```test_harness,no_run
5143/// # extern crate hyper;
5144/// # extern crate hyper_rustls;
5145/// # extern crate google_clouddeploy1 as clouddeploy1;
5146/// use clouddeploy1::api::CustomTargetType;
5147/// # async fn dox() {
5148/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5149///
5150/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5151/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5152/// # .with_native_roots()
5153/// # .unwrap()
5154/// # .https_only()
5155/// # .enable_http2()
5156/// # .build();
5157///
5158/// # let executor = hyper_util::rt::TokioExecutor::new();
5159/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5160/// # secret,
5161/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5162/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5163/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5164/// # ),
5165/// # ).build().await.unwrap();
5166///
5167/// # let client = hyper_util::client::legacy::Client::builder(
5168/// # hyper_util::rt::TokioExecutor::new()
5169/// # )
5170/// # .build(
5171/// # hyper_rustls::HttpsConnectorBuilder::new()
5172/// # .with_native_roots()
5173/// # .unwrap()
5174/// # .https_or_http()
5175/// # .enable_http2()
5176/// # .build()
5177/// # );
5178/// # let mut hub = CloudDeploy::new(client, auth);
5179/// // As the method needs a request, you would usually fill it with the desired information
5180/// // into the respective structure. Some of the parts shown here might not be applicable !
5181/// // Values shown here are possibly random and not representative !
5182/// let mut req = CustomTargetType::default();
5183///
5184/// // You can configure optional parameters by calling the respective setters at will, and
5185/// // execute the final call using `doit()`.
5186/// // Values shown here are possibly random and not representative !
5187/// let result = hub.projects().locations_custom_target_types_create(req, "parent")
5188/// .validate_only(true)
5189/// .request_id("sed")
5190/// .custom_target_type_id("ut")
5191/// .doit().await;
5192/// # }
5193/// ```
5194pub struct ProjectLocationCustomTargetTypeCreateCall<'a, C>
5195where
5196 C: 'a,
5197{
5198 hub: &'a CloudDeploy<C>,
5199 _request: CustomTargetType,
5200 _parent: String,
5201 _validate_only: Option<bool>,
5202 _request_id: Option<String>,
5203 _custom_target_type_id: Option<String>,
5204 _delegate: Option<&'a mut dyn common::Delegate>,
5205 _additional_params: HashMap<String, String>,
5206 _scopes: BTreeSet<String>,
5207}
5208
5209impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeCreateCall<'a, C> {}
5210
5211impl<'a, C> ProjectLocationCustomTargetTypeCreateCall<'a, C>
5212where
5213 C: common::Connector,
5214{
5215 /// Perform the operation you have build so far.
5216 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5217 use std::borrow::Cow;
5218 use std::io::{Read, Seek};
5219
5220 use common::{url::Params, ToParts};
5221 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5222
5223 let mut dd = common::DefaultDelegate;
5224 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5225 dlg.begin(common::MethodInfo {
5226 id: "clouddeploy.projects.locations.customTargetTypes.create",
5227 http_method: hyper::Method::POST,
5228 });
5229
5230 for &field in [
5231 "alt",
5232 "parent",
5233 "validateOnly",
5234 "requestId",
5235 "customTargetTypeId",
5236 ]
5237 .iter()
5238 {
5239 if self._additional_params.contains_key(field) {
5240 dlg.finished(false);
5241 return Err(common::Error::FieldClash(field));
5242 }
5243 }
5244
5245 let mut params = Params::with_capacity(7 + self._additional_params.len());
5246 params.push("parent", self._parent);
5247 if let Some(value) = self._validate_only.as_ref() {
5248 params.push("validateOnly", value.to_string());
5249 }
5250 if let Some(value) = self._request_id.as_ref() {
5251 params.push("requestId", value);
5252 }
5253 if let Some(value) = self._custom_target_type_id.as_ref() {
5254 params.push("customTargetTypeId", value);
5255 }
5256
5257 params.extend(self._additional_params.iter());
5258
5259 params.push("alt", "json");
5260 let mut url = self.hub._base_url.clone() + "v1/{+parent}/customTargetTypes";
5261 if self._scopes.is_empty() {
5262 self._scopes
5263 .insert(Scope::CloudPlatform.as_ref().to_string());
5264 }
5265
5266 #[allow(clippy::single_element_loop)]
5267 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5268 url = params.uri_replacement(url, param_name, find_this, true);
5269 }
5270 {
5271 let to_remove = ["parent"];
5272 params.remove_params(&to_remove);
5273 }
5274
5275 let url = params.parse_with_url(&url);
5276
5277 let mut json_mime_type = mime::APPLICATION_JSON;
5278 let mut request_value_reader = {
5279 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5280 common::remove_json_null_values(&mut value);
5281 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5282 serde_json::to_writer(&mut dst, &value).unwrap();
5283 dst
5284 };
5285 let request_size = request_value_reader
5286 .seek(std::io::SeekFrom::End(0))
5287 .unwrap();
5288 request_value_reader
5289 .seek(std::io::SeekFrom::Start(0))
5290 .unwrap();
5291
5292 loop {
5293 let token = match self
5294 .hub
5295 .auth
5296 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5297 .await
5298 {
5299 Ok(token) => token,
5300 Err(e) => match dlg.token(e) {
5301 Ok(token) => token,
5302 Err(e) => {
5303 dlg.finished(false);
5304 return Err(common::Error::MissingToken(e));
5305 }
5306 },
5307 };
5308 request_value_reader
5309 .seek(std::io::SeekFrom::Start(0))
5310 .unwrap();
5311 let mut req_result = {
5312 let client = &self.hub.client;
5313 dlg.pre_request();
5314 let mut req_builder = hyper::Request::builder()
5315 .method(hyper::Method::POST)
5316 .uri(url.as_str())
5317 .header(USER_AGENT, self.hub._user_agent.clone());
5318
5319 if let Some(token) = token.as_ref() {
5320 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5321 }
5322
5323 let request = req_builder
5324 .header(CONTENT_TYPE, json_mime_type.to_string())
5325 .header(CONTENT_LENGTH, request_size as u64)
5326 .body(common::to_body(
5327 request_value_reader.get_ref().clone().into(),
5328 ));
5329
5330 client.request(request.unwrap()).await
5331 };
5332
5333 match req_result {
5334 Err(err) => {
5335 if let common::Retry::After(d) = dlg.http_error(&err) {
5336 sleep(d).await;
5337 continue;
5338 }
5339 dlg.finished(false);
5340 return Err(common::Error::HttpError(err));
5341 }
5342 Ok(res) => {
5343 let (mut parts, body) = res.into_parts();
5344 let mut body = common::Body::new(body);
5345 if !parts.status.is_success() {
5346 let bytes = common::to_bytes(body).await.unwrap_or_default();
5347 let error = serde_json::from_str(&common::to_string(&bytes));
5348 let response = common::to_response(parts, bytes.into());
5349
5350 if let common::Retry::After(d) =
5351 dlg.http_failure(&response, error.as_ref().ok())
5352 {
5353 sleep(d).await;
5354 continue;
5355 }
5356
5357 dlg.finished(false);
5358
5359 return Err(match error {
5360 Ok(value) => common::Error::BadRequest(value),
5361 _ => common::Error::Failure(response),
5362 });
5363 }
5364 let response = {
5365 let bytes = common::to_bytes(body).await.unwrap_or_default();
5366 let encoded = common::to_string(&bytes);
5367 match serde_json::from_str(&encoded) {
5368 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5369 Err(error) => {
5370 dlg.response_json_decode_error(&encoded, &error);
5371 return Err(common::Error::JsonDecodeError(
5372 encoded.to_string(),
5373 error,
5374 ));
5375 }
5376 }
5377 };
5378
5379 dlg.finished(true);
5380 return Ok(response);
5381 }
5382 }
5383 }
5384 }
5385
5386 ///
5387 /// Sets the *request* property to the given value.
5388 ///
5389 /// Even though the property as already been set when instantiating this call,
5390 /// we provide this method for API completeness.
5391 pub fn request(
5392 mut self,
5393 new_value: CustomTargetType,
5394 ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
5395 self._request = new_value;
5396 self
5397 }
5398 /// Required. The parent collection in which the `CustomTargetType` must be created. The format is `projects/{project_id}/locations/{location_name}`.
5399 ///
5400 /// Sets the *parent* path property to the given value.
5401 ///
5402 /// Even though the property as already been set when instantiating this call,
5403 /// we provide this method for API completeness.
5404 pub fn parent(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
5405 self._parent = new_value.to_string();
5406 self
5407 }
5408 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
5409 ///
5410 /// Sets the *validate only* query property to the given value.
5411 pub fn validate_only(
5412 mut self,
5413 new_value: bool,
5414 ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
5415 self._validate_only = Some(new_value);
5416 self
5417 }
5418 /// 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).
5419 ///
5420 /// Sets the *request id* query property to the given value.
5421 pub fn request_id(
5422 mut self,
5423 new_value: &str,
5424 ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
5425 self._request_id = Some(new_value.to_string());
5426 self
5427 }
5428 /// Required. ID of the `CustomTargetType`.
5429 ///
5430 /// Sets the *custom target type id* query property to the given value.
5431 pub fn custom_target_type_id(
5432 mut self,
5433 new_value: &str,
5434 ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
5435 self._custom_target_type_id = Some(new_value.to_string());
5436 self
5437 }
5438 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5439 /// while executing the actual API request.
5440 ///
5441 /// ````text
5442 /// It should be used to handle progress information, and to implement a certain level of resilience.
5443 /// ````
5444 ///
5445 /// Sets the *delegate* property to the given value.
5446 pub fn delegate(
5447 mut self,
5448 new_value: &'a mut dyn common::Delegate,
5449 ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
5450 self._delegate = Some(new_value);
5451 self
5452 }
5453
5454 /// Set any additional parameter of the query string used in the request.
5455 /// It should be used to set parameters which are not yet available through their own
5456 /// setters.
5457 ///
5458 /// Please note that this method must not be used to set any of the known parameters
5459 /// which have their own setter method. If done anyway, the request will fail.
5460 ///
5461 /// # Additional Parameters
5462 ///
5463 /// * *$.xgafv* (query-string) - V1 error format.
5464 /// * *access_token* (query-string) - OAuth access token.
5465 /// * *alt* (query-string) - Data format for response.
5466 /// * *callback* (query-string) - JSONP
5467 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5468 /// * *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.
5469 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5470 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5471 /// * *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.
5472 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5473 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5474 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeCreateCall<'a, C>
5475 where
5476 T: AsRef<str>,
5477 {
5478 self._additional_params
5479 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5480 self
5481 }
5482
5483 /// Identifies the authorization scope for the method you are building.
5484 ///
5485 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5486 /// [`Scope::CloudPlatform`].
5487 ///
5488 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5489 /// tokens for more than one scope.
5490 ///
5491 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5492 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5493 /// sufficient, a read-write scope will do as well.
5494 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeCreateCall<'a, C>
5495 where
5496 St: AsRef<str>,
5497 {
5498 self._scopes.insert(String::from(scope.as_ref()));
5499 self
5500 }
5501 /// Identifies the authorization scope(s) for the method you are building.
5502 ///
5503 /// See [`Self::add_scope()`] for details.
5504 pub fn add_scopes<I, St>(
5505 mut self,
5506 scopes: I,
5507 ) -> ProjectLocationCustomTargetTypeCreateCall<'a, C>
5508 where
5509 I: IntoIterator<Item = St>,
5510 St: AsRef<str>,
5511 {
5512 self._scopes
5513 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5514 self
5515 }
5516
5517 /// Removes all scopes, and no default scope will be used either.
5518 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5519 /// for details).
5520 pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeCreateCall<'a, C> {
5521 self._scopes.clear();
5522 self
5523 }
5524}
5525
5526/// Deletes a single CustomTargetType.
5527///
5528/// A builder for the *locations.customTargetTypes.delete* method supported by a *project* resource.
5529/// It is not used directly, but through a [`ProjectMethods`] instance.
5530///
5531/// # Example
5532///
5533/// Instantiate a resource method builder
5534///
5535/// ```test_harness,no_run
5536/// # extern crate hyper;
5537/// # extern crate hyper_rustls;
5538/// # extern crate google_clouddeploy1 as clouddeploy1;
5539/// # async fn dox() {
5540/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5541///
5542/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5543/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5544/// # .with_native_roots()
5545/// # .unwrap()
5546/// # .https_only()
5547/// # .enable_http2()
5548/// # .build();
5549///
5550/// # let executor = hyper_util::rt::TokioExecutor::new();
5551/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5552/// # secret,
5553/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5554/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5555/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5556/// # ),
5557/// # ).build().await.unwrap();
5558///
5559/// # let client = hyper_util::client::legacy::Client::builder(
5560/// # hyper_util::rt::TokioExecutor::new()
5561/// # )
5562/// # .build(
5563/// # hyper_rustls::HttpsConnectorBuilder::new()
5564/// # .with_native_roots()
5565/// # .unwrap()
5566/// # .https_or_http()
5567/// # .enable_http2()
5568/// # .build()
5569/// # );
5570/// # let mut hub = CloudDeploy::new(client, auth);
5571/// // You can configure optional parameters by calling the respective setters at will, and
5572/// // execute the final call using `doit()`.
5573/// // Values shown here are possibly random and not representative !
5574/// let result = hub.projects().locations_custom_target_types_delete("name")
5575/// .validate_only(true)
5576/// .request_id("ipsum")
5577/// .etag("ipsum")
5578/// .allow_missing(true)
5579/// .doit().await;
5580/// # }
5581/// ```
5582pub struct ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5583where
5584 C: 'a,
5585{
5586 hub: &'a CloudDeploy<C>,
5587 _name: String,
5588 _validate_only: Option<bool>,
5589 _request_id: Option<String>,
5590 _etag: Option<String>,
5591 _allow_missing: Option<bool>,
5592 _delegate: Option<&'a mut dyn common::Delegate>,
5593 _additional_params: HashMap<String, String>,
5594 _scopes: BTreeSet<String>,
5595}
5596
5597impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeDeleteCall<'a, C> {}
5598
5599impl<'a, C> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5600where
5601 C: common::Connector,
5602{
5603 /// Perform the operation you have build so far.
5604 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5605 use std::borrow::Cow;
5606 use std::io::{Read, Seek};
5607
5608 use common::{url::Params, ToParts};
5609 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5610
5611 let mut dd = common::DefaultDelegate;
5612 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5613 dlg.begin(common::MethodInfo {
5614 id: "clouddeploy.projects.locations.customTargetTypes.delete",
5615 http_method: hyper::Method::DELETE,
5616 });
5617
5618 for &field in [
5619 "alt",
5620 "name",
5621 "validateOnly",
5622 "requestId",
5623 "etag",
5624 "allowMissing",
5625 ]
5626 .iter()
5627 {
5628 if self._additional_params.contains_key(field) {
5629 dlg.finished(false);
5630 return Err(common::Error::FieldClash(field));
5631 }
5632 }
5633
5634 let mut params = Params::with_capacity(7 + self._additional_params.len());
5635 params.push("name", self._name);
5636 if let Some(value) = self._validate_only.as_ref() {
5637 params.push("validateOnly", value.to_string());
5638 }
5639 if let Some(value) = self._request_id.as_ref() {
5640 params.push("requestId", value);
5641 }
5642 if let Some(value) = self._etag.as_ref() {
5643 params.push("etag", value);
5644 }
5645 if let Some(value) = self._allow_missing.as_ref() {
5646 params.push("allowMissing", value.to_string());
5647 }
5648
5649 params.extend(self._additional_params.iter());
5650
5651 params.push("alt", "json");
5652 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5653 if self._scopes.is_empty() {
5654 self._scopes
5655 .insert(Scope::CloudPlatform.as_ref().to_string());
5656 }
5657
5658 #[allow(clippy::single_element_loop)]
5659 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5660 url = params.uri_replacement(url, param_name, find_this, true);
5661 }
5662 {
5663 let to_remove = ["name"];
5664 params.remove_params(&to_remove);
5665 }
5666
5667 let url = params.parse_with_url(&url);
5668
5669 loop {
5670 let token = match self
5671 .hub
5672 .auth
5673 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5674 .await
5675 {
5676 Ok(token) => token,
5677 Err(e) => match dlg.token(e) {
5678 Ok(token) => token,
5679 Err(e) => {
5680 dlg.finished(false);
5681 return Err(common::Error::MissingToken(e));
5682 }
5683 },
5684 };
5685 let mut req_result = {
5686 let client = &self.hub.client;
5687 dlg.pre_request();
5688 let mut req_builder = hyper::Request::builder()
5689 .method(hyper::Method::DELETE)
5690 .uri(url.as_str())
5691 .header(USER_AGENT, self.hub._user_agent.clone());
5692
5693 if let Some(token) = token.as_ref() {
5694 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5695 }
5696
5697 let request = req_builder
5698 .header(CONTENT_LENGTH, 0_u64)
5699 .body(common::to_body::<String>(None));
5700
5701 client.request(request.unwrap()).await
5702 };
5703
5704 match req_result {
5705 Err(err) => {
5706 if let common::Retry::After(d) = dlg.http_error(&err) {
5707 sleep(d).await;
5708 continue;
5709 }
5710 dlg.finished(false);
5711 return Err(common::Error::HttpError(err));
5712 }
5713 Ok(res) => {
5714 let (mut parts, body) = res.into_parts();
5715 let mut body = common::Body::new(body);
5716 if !parts.status.is_success() {
5717 let bytes = common::to_bytes(body).await.unwrap_or_default();
5718 let error = serde_json::from_str(&common::to_string(&bytes));
5719 let response = common::to_response(parts, bytes.into());
5720
5721 if let common::Retry::After(d) =
5722 dlg.http_failure(&response, error.as_ref().ok())
5723 {
5724 sleep(d).await;
5725 continue;
5726 }
5727
5728 dlg.finished(false);
5729
5730 return Err(match error {
5731 Ok(value) => common::Error::BadRequest(value),
5732 _ => common::Error::Failure(response),
5733 });
5734 }
5735 let response = {
5736 let bytes = common::to_bytes(body).await.unwrap_or_default();
5737 let encoded = common::to_string(&bytes);
5738 match serde_json::from_str(&encoded) {
5739 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5740 Err(error) => {
5741 dlg.response_json_decode_error(&encoded, &error);
5742 return Err(common::Error::JsonDecodeError(
5743 encoded.to_string(),
5744 error,
5745 ));
5746 }
5747 }
5748 };
5749
5750 dlg.finished(true);
5751 return Ok(response);
5752 }
5753 }
5754 }
5755 }
5756
5757 /// Required. The name of the `CustomTargetType` to delete. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
5758 ///
5759 /// Sets the *name* path property to the given value.
5760 ///
5761 /// Even though the property as already been set when instantiating this call,
5762 /// we provide this method for API completeness.
5763 pub fn name(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5764 self._name = new_value.to_string();
5765 self
5766 }
5767 /// Optional. If set to true, the request is validated but no actual change is made.
5768 ///
5769 /// Sets the *validate only* query property to the given value.
5770 pub fn validate_only(
5771 mut self,
5772 new_value: bool,
5773 ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5774 self._validate_only = Some(new_value);
5775 self
5776 }
5777 /// 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).
5778 ///
5779 /// Sets the *request id* query property to the given value.
5780 pub fn request_id(
5781 mut self,
5782 new_value: &str,
5783 ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5784 self._request_id = Some(new_value.to_string());
5785 self
5786 }
5787 /// 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.
5788 ///
5789 /// Sets the *etag* query property to the given value.
5790 pub fn etag(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5791 self._etag = Some(new_value.to_string());
5792 self
5793 }
5794 /// Optional. If set to true, then deleting an already deleted or non-existing `CustomTargetType` will succeed.
5795 ///
5796 /// Sets the *allow missing* query property to the given value.
5797 pub fn allow_missing(
5798 mut self,
5799 new_value: bool,
5800 ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5801 self._allow_missing = Some(new_value);
5802 self
5803 }
5804 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5805 /// while executing the actual API request.
5806 ///
5807 /// ````text
5808 /// It should be used to handle progress information, and to implement a certain level of resilience.
5809 /// ````
5810 ///
5811 /// Sets the *delegate* property to the given value.
5812 pub fn delegate(
5813 mut self,
5814 new_value: &'a mut dyn common::Delegate,
5815 ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5816 self._delegate = Some(new_value);
5817 self
5818 }
5819
5820 /// Set any additional parameter of the query string used in the request.
5821 /// It should be used to set parameters which are not yet available through their own
5822 /// setters.
5823 ///
5824 /// Please note that this method must not be used to set any of the known parameters
5825 /// which have their own setter method. If done anyway, the request will fail.
5826 ///
5827 /// # Additional Parameters
5828 ///
5829 /// * *$.xgafv* (query-string) - V1 error format.
5830 /// * *access_token* (query-string) - OAuth access token.
5831 /// * *alt* (query-string) - Data format for response.
5832 /// * *callback* (query-string) - JSONP
5833 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5834 /// * *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.
5835 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5836 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5837 /// * *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.
5838 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5839 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5840 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5841 where
5842 T: AsRef<str>,
5843 {
5844 self._additional_params
5845 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5846 self
5847 }
5848
5849 /// Identifies the authorization scope for the method you are building.
5850 ///
5851 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5852 /// [`Scope::CloudPlatform`].
5853 ///
5854 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5855 /// tokens for more than one scope.
5856 ///
5857 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5858 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5859 /// sufficient, a read-write scope will do as well.
5860 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5861 where
5862 St: AsRef<str>,
5863 {
5864 self._scopes.insert(String::from(scope.as_ref()));
5865 self
5866 }
5867 /// Identifies the authorization scope(s) for the method you are building.
5868 ///
5869 /// See [`Self::add_scope()`] for details.
5870 pub fn add_scopes<I, St>(
5871 mut self,
5872 scopes: I,
5873 ) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C>
5874 where
5875 I: IntoIterator<Item = St>,
5876 St: AsRef<str>,
5877 {
5878 self._scopes
5879 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5880 self
5881 }
5882
5883 /// Removes all scopes, and no default scope will be used either.
5884 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5885 /// for details).
5886 pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeDeleteCall<'a, C> {
5887 self._scopes.clear();
5888 self
5889 }
5890}
5891
5892/// Gets details of a single CustomTargetType.
5893///
5894/// A builder for the *locations.customTargetTypes.get* method supported by a *project* resource.
5895/// It is not used directly, but through a [`ProjectMethods`] instance.
5896///
5897/// # Example
5898///
5899/// Instantiate a resource method builder
5900///
5901/// ```test_harness,no_run
5902/// # extern crate hyper;
5903/// # extern crate hyper_rustls;
5904/// # extern crate google_clouddeploy1 as clouddeploy1;
5905/// # async fn dox() {
5906/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5907///
5908/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5909/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5910/// # .with_native_roots()
5911/// # .unwrap()
5912/// # .https_only()
5913/// # .enable_http2()
5914/// # .build();
5915///
5916/// # let executor = hyper_util::rt::TokioExecutor::new();
5917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5918/// # secret,
5919/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5920/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5921/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5922/// # ),
5923/// # ).build().await.unwrap();
5924///
5925/// # let client = hyper_util::client::legacy::Client::builder(
5926/// # hyper_util::rt::TokioExecutor::new()
5927/// # )
5928/// # .build(
5929/// # hyper_rustls::HttpsConnectorBuilder::new()
5930/// # .with_native_roots()
5931/// # .unwrap()
5932/// # .https_or_http()
5933/// # .enable_http2()
5934/// # .build()
5935/// # );
5936/// # let mut hub = CloudDeploy::new(client, auth);
5937/// // You can configure optional parameters by calling the respective setters at will, and
5938/// // execute the final call using `doit()`.
5939/// // Values shown here are possibly random and not representative !
5940/// let result = hub.projects().locations_custom_target_types_get("name")
5941/// .doit().await;
5942/// # }
5943/// ```
5944pub struct ProjectLocationCustomTargetTypeGetCall<'a, C>
5945where
5946 C: 'a,
5947{
5948 hub: &'a CloudDeploy<C>,
5949 _name: String,
5950 _delegate: Option<&'a mut dyn common::Delegate>,
5951 _additional_params: HashMap<String, String>,
5952 _scopes: BTreeSet<String>,
5953}
5954
5955impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeGetCall<'a, C> {}
5956
5957impl<'a, C> ProjectLocationCustomTargetTypeGetCall<'a, C>
5958where
5959 C: common::Connector,
5960{
5961 /// Perform the operation you have build so far.
5962 pub async fn doit(mut self) -> common::Result<(common::Response, CustomTargetType)> {
5963 use std::borrow::Cow;
5964 use std::io::{Read, Seek};
5965
5966 use common::{url::Params, ToParts};
5967 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5968
5969 let mut dd = common::DefaultDelegate;
5970 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5971 dlg.begin(common::MethodInfo {
5972 id: "clouddeploy.projects.locations.customTargetTypes.get",
5973 http_method: hyper::Method::GET,
5974 });
5975
5976 for &field in ["alt", "name"].iter() {
5977 if self._additional_params.contains_key(field) {
5978 dlg.finished(false);
5979 return Err(common::Error::FieldClash(field));
5980 }
5981 }
5982
5983 let mut params = Params::with_capacity(3 + self._additional_params.len());
5984 params.push("name", self._name);
5985
5986 params.extend(self._additional_params.iter());
5987
5988 params.push("alt", "json");
5989 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5990 if self._scopes.is_empty() {
5991 self._scopes
5992 .insert(Scope::CloudPlatform.as_ref().to_string());
5993 }
5994
5995 #[allow(clippy::single_element_loop)]
5996 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5997 url = params.uri_replacement(url, param_name, find_this, true);
5998 }
5999 {
6000 let to_remove = ["name"];
6001 params.remove_params(&to_remove);
6002 }
6003
6004 let url = params.parse_with_url(&url);
6005
6006 loop {
6007 let token = match self
6008 .hub
6009 .auth
6010 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6011 .await
6012 {
6013 Ok(token) => token,
6014 Err(e) => match dlg.token(e) {
6015 Ok(token) => token,
6016 Err(e) => {
6017 dlg.finished(false);
6018 return Err(common::Error::MissingToken(e));
6019 }
6020 },
6021 };
6022 let mut req_result = {
6023 let client = &self.hub.client;
6024 dlg.pre_request();
6025 let mut req_builder = hyper::Request::builder()
6026 .method(hyper::Method::GET)
6027 .uri(url.as_str())
6028 .header(USER_AGENT, self.hub._user_agent.clone());
6029
6030 if let Some(token) = token.as_ref() {
6031 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6032 }
6033
6034 let request = req_builder
6035 .header(CONTENT_LENGTH, 0_u64)
6036 .body(common::to_body::<String>(None));
6037
6038 client.request(request.unwrap()).await
6039 };
6040
6041 match req_result {
6042 Err(err) => {
6043 if let common::Retry::After(d) = dlg.http_error(&err) {
6044 sleep(d).await;
6045 continue;
6046 }
6047 dlg.finished(false);
6048 return Err(common::Error::HttpError(err));
6049 }
6050 Ok(res) => {
6051 let (mut parts, body) = res.into_parts();
6052 let mut body = common::Body::new(body);
6053 if !parts.status.is_success() {
6054 let bytes = common::to_bytes(body).await.unwrap_or_default();
6055 let error = serde_json::from_str(&common::to_string(&bytes));
6056 let response = common::to_response(parts, bytes.into());
6057
6058 if let common::Retry::After(d) =
6059 dlg.http_failure(&response, error.as_ref().ok())
6060 {
6061 sleep(d).await;
6062 continue;
6063 }
6064
6065 dlg.finished(false);
6066
6067 return Err(match error {
6068 Ok(value) => common::Error::BadRequest(value),
6069 _ => common::Error::Failure(response),
6070 });
6071 }
6072 let response = {
6073 let bytes = common::to_bytes(body).await.unwrap_or_default();
6074 let encoded = common::to_string(&bytes);
6075 match serde_json::from_str(&encoded) {
6076 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6077 Err(error) => {
6078 dlg.response_json_decode_error(&encoded, &error);
6079 return Err(common::Error::JsonDecodeError(
6080 encoded.to_string(),
6081 error,
6082 ));
6083 }
6084 }
6085 };
6086
6087 dlg.finished(true);
6088 return Ok(response);
6089 }
6090 }
6091 }
6092 }
6093
6094 /// Required. Name of the `CustomTargetType`. Format must be `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`.
6095 ///
6096 /// Sets the *name* path property to the given value.
6097 ///
6098 /// Even though the property as already been set when instantiating this call,
6099 /// we provide this method for API completeness.
6100 pub fn name(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
6101 self._name = new_value.to_string();
6102 self
6103 }
6104 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6105 /// while executing the actual API request.
6106 ///
6107 /// ````text
6108 /// It should be used to handle progress information, and to implement a certain level of resilience.
6109 /// ````
6110 ///
6111 /// Sets the *delegate* property to the given value.
6112 pub fn delegate(
6113 mut self,
6114 new_value: &'a mut dyn common::Delegate,
6115 ) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
6116 self._delegate = Some(new_value);
6117 self
6118 }
6119
6120 /// Set any additional parameter of the query string used in the request.
6121 /// It should be used to set parameters which are not yet available through their own
6122 /// setters.
6123 ///
6124 /// Please note that this method must not be used to set any of the known parameters
6125 /// which have their own setter method. If done anyway, the request will fail.
6126 ///
6127 /// # Additional Parameters
6128 ///
6129 /// * *$.xgafv* (query-string) - V1 error format.
6130 /// * *access_token* (query-string) - OAuth access token.
6131 /// * *alt* (query-string) - Data format for response.
6132 /// * *callback* (query-string) - JSONP
6133 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6134 /// * *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.
6135 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6136 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6137 /// * *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.
6138 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6139 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6140 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeGetCall<'a, C>
6141 where
6142 T: AsRef<str>,
6143 {
6144 self._additional_params
6145 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6146 self
6147 }
6148
6149 /// Identifies the authorization scope for the method you are building.
6150 ///
6151 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6152 /// [`Scope::CloudPlatform`].
6153 ///
6154 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6155 /// tokens for more than one scope.
6156 ///
6157 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6158 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6159 /// sufficient, a read-write scope will do as well.
6160 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeGetCall<'a, C>
6161 where
6162 St: AsRef<str>,
6163 {
6164 self._scopes.insert(String::from(scope.as_ref()));
6165 self
6166 }
6167 /// Identifies the authorization scope(s) for the method you are building.
6168 ///
6169 /// See [`Self::add_scope()`] for details.
6170 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCustomTargetTypeGetCall<'a, C>
6171 where
6172 I: IntoIterator<Item = St>,
6173 St: AsRef<str>,
6174 {
6175 self._scopes
6176 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6177 self
6178 }
6179
6180 /// Removes all scopes, and no default scope will be used either.
6181 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6182 /// for details).
6183 pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeGetCall<'a, C> {
6184 self._scopes.clear();
6185 self
6186 }
6187}
6188
6189/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
6190///
6191/// A builder for the *locations.customTargetTypes.getIamPolicy* method supported by a *project* resource.
6192/// It is not used directly, but through a [`ProjectMethods`] instance.
6193///
6194/// # Example
6195///
6196/// Instantiate a resource method builder
6197///
6198/// ```test_harness,no_run
6199/// # extern crate hyper;
6200/// # extern crate hyper_rustls;
6201/// # extern crate google_clouddeploy1 as clouddeploy1;
6202/// # async fn dox() {
6203/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6204///
6205/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6206/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6207/// # .with_native_roots()
6208/// # .unwrap()
6209/// # .https_only()
6210/// # .enable_http2()
6211/// # .build();
6212///
6213/// # let executor = hyper_util::rt::TokioExecutor::new();
6214/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6215/// # secret,
6216/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6217/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6218/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6219/// # ),
6220/// # ).build().await.unwrap();
6221///
6222/// # let client = hyper_util::client::legacy::Client::builder(
6223/// # hyper_util::rt::TokioExecutor::new()
6224/// # )
6225/// # .build(
6226/// # hyper_rustls::HttpsConnectorBuilder::new()
6227/// # .with_native_roots()
6228/// # .unwrap()
6229/// # .https_or_http()
6230/// # .enable_http2()
6231/// # .build()
6232/// # );
6233/// # let mut hub = CloudDeploy::new(client, auth);
6234/// // You can configure optional parameters by calling the respective setters at will, and
6235/// // execute the final call using `doit()`.
6236/// // Values shown here are possibly random and not representative !
6237/// let result = hub.projects().locations_custom_target_types_get_iam_policy("resource")
6238/// .options_requested_policy_version(-56)
6239/// .doit().await;
6240/// # }
6241/// ```
6242pub struct ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
6243where
6244 C: 'a,
6245{
6246 hub: &'a CloudDeploy<C>,
6247 _resource: String,
6248 _options_requested_policy_version: Option<i32>,
6249 _delegate: Option<&'a mut dyn common::Delegate>,
6250 _additional_params: HashMap<String, String>,
6251 _scopes: BTreeSet<String>,
6252}
6253
6254impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {}
6255
6256impl<'a, C> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
6257where
6258 C: common::Connector,
6259{
6260 /// Perform the operation you have build so far.
6261 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
6262 use std::borrow::Cow;
6263 use std::io::{Read, Seek};
6264
6265 use common::{url::Params, ToParts};
6266 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6267
6268 let mut dd = common::DefaultDelegate;
6269 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6270 dlg.begin(common::MethodInfo {
6271 id: "clouddeploy.projects.locations.customTargetTypes.getIamPolicy",
6272 http_method: hyper::Method::GET,
6273 });
6274
6275 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
6276 if self._additional_params.contains_key(field) {
6277 dlg.finished(false);
6278 return Err(common::Error::FieldClash(field));
6279 }
6280 }
6281
6282 let mut params = Params::with_capacity(4 + self._additional_params.len());
6283 params.push("resource", self._resource);
6284 if let Some(value) = self._options_requested_policy_version.as_ref() {
6285 params.push("options.requestedPolicyVersion", value.to_string());
6286 }
6287
6288 params.extend(self._additional_params.iter());
6289
6290 params.push("alt", "json");
6291 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
6292 if self._scopes.is_empty() {
6293 self._scopes
6294 .insert(Scope::CloudPlatform.as_ref().to_string());
6295 }
6296
6297 #[allow(clippy::single_element_loop)]
6298 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
6299 url = params.uri_replacement(url, param_name, find_this, true);
6300 }
6301 {
6302 let to_remove = ["resource"];
6303 params.remove_params(&to_remove);
6304 }
6305
6306 let url = params.parse_with_url(&url);
6307
6308 loop {
6309 let token = match self
6310 .hub
6311 .auth
6312 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6313 .await
6314 {
6315 Ok(token) => token,
6316 Err(e) => match dlg.token(e) {
6317 Ok(token) => token,
6318 Err(e) => {
6319 dlg.finished(false);
6320 return Err(common::Error::MissingToken(e));
6321 }
6322 },
6323 };
6324 let mut req_result = {
6325 let client = &self.hub.client;
6326 dlg.pre_request();
6327 let mut req_builder = hyper::Request::builder()
6328 .method(hyper::Method::GET)
6329 .uri(url.as_str())
6330 .header(USER_AGENT, self.hub._user_agent.clone());
6331
6332 if let Some(token) = token.as_ref() {
6333 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6334 }
6335
6336 let request = req_builder
6337 .header(CONTENT_LENGTH, 0_u64)
6338 .body(common::to_body::<String>(None));
6339
6340 client.request(request.unwrap()).await
6341 };
6342
6343 match req_result {
6344 Err(err) => {
6345 if let common::Retry::After(d) = dlg.http_error(&err) {
6346 sleep(d).await;
6347 continue;
6348 }
6349 dlg.finished(false);
6350 return Err(common::Error::HttpError(err));
6351 }
6352 Ok(res) => {
6353 let (mut parts, body) = res.into_parts();
6354 let mut body = common::Body::new(body);
6355 if !parts.status.is_success() {
6356 let bytes = common::to_bytes(body).await.unwrap_or_default();
6357 let error = serde_json::from_str(&common::to_string(&bytes));
6358 let response = common::to_response(parts, bytes.into());
6359
6360 if let common::Retry::After(d) =
6361 dlg.http_failure(&response, error.as_ref().ok())
6362 {
6363 sleep(d).await;
6364 continue;
6365 }
6366
6367 dlg.finished(false);
6368
6369 return Err(match error {
6370 Ok(value) => common::Error::BadRequest(value),
6371 _ => common::Error::Failure(response),
6372 });
6373 }
6374 let response = {
6375 let bytes = common::to_bytes(body).await.unwrap_or_default();
6376 let encoded = common::to_string(&bytes);
6377 match serde_json::from_str(&encoded) {
6378 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6379 Err(error) => {
6380 dlg.response_json_decode_error(&encoded, &error);
6381 return Err(common::Error::JsonDecodeError(
6382 encoded.to_string(),
6383 error,
6384 ));
6385 }
6386 }
6387 };
6388
6389 dlg.finished(true);
6390 return Ok(response);
6391 }
6392 }
6393 }
6394 }
6395
6396 /// 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.
6397 ///
6398 /// Sets the *resource* path property to the given value.
6399 ///
6400 /// Even though the property as already been set when instantiating this call,
6401 /// we provide this method for API completeness.
6402 pub fn resource(
6403 mut self,
6404 new_value: &str,
6405 ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
6406 self._resource = new_value.to_string();
6407 self
6408 }
6409 /// 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).
6410 ///
6411 /// Sets the *options.requested policy version* query property to the given value.
6412 pub fn options_requested_policy_version(
6413 mut self,
6414 new_value: i32,
6415 ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
6416 self._options_requested_policy_version = Some(new_value);
6417 self
6418 }
6419 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6420 /// while executing the actual API request.
6421 ///
6422 /// ````text
6423 /// It should be used to handle progress information, and to implement a certain level of resilience.
6424 /// ````
6425 ///
6426 /// Sets the *delegate* property to the given value.
6427 pub fn delegate(
6428 mut self,
6429 new_value: &'a mut dyn common::Delegate,
6430 ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
6431 self._delegate = Some(new_value);
6432 self
6433 }
6434
6435 /// Set any additional parameter of the query string used in the request.
6436 /// It should be used to set parameters which are not yet available through their own
6437 /// setters.
6438 ///
6439 /// Please note that this method must not be used to set any of the known parameters
6440 /// which have their own setter method. If done anyway, the request will fail.
6441 ///
6442 /// # Additional Parameters
6443 ///
6444 /// * *$.xgafv* (query-string) - V1 error format.
6445 /// * *access_token* (query-string) - OAuth access token.
6446 /// * *alt* (query-string) - Data format for response.
6447 /// * *callback* (query-string) - JSONP
6448 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6449 /// * *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.
6450 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6451 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6452 /// * *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.
6453 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6454 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6455 pub fn param<T>(
6456 mut self,
6457 name: T,
6458 value: T,
6459 ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
6460 where
6461 T: AsRef<str>,
6462 {
6463 self._additional_params
6464 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6465 self
6466 }
6467
6468 /// Identifies the authorization scope for the method you are building.
6469 ///
6470 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6471 /// [`Scope::CloudPlatform`].
6472 ///
6473 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6474 /// tokens for more than one scope.
6475 ///
6476 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6477 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6478 /// sufficient, a read-write scope will do as well.
6479 pub fn add_scope<St>(
6480 mut self,
6481 scope: St,
6482 ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
6483 where
6484 St: AsRef<str>,
6485 {
6486 self._scopes.insert(String::from(scope.as_ref()));
6487 self
6488 }
6489 /// Identifies the authorization scope(s) for the method you are building.
6490 ///
6491 /// See [`Self::add_scope()`] for details.
6492 pub fn add_scopes<I, St>(
6493 mut self,
6494 scopes: I,
6495 ) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C>
6496 where
6497 I: IntoIterator<Item = St>,
6498 St: AsRef<str>,
6499 {
6500 self._scopes
6501 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6502 self
6503 }
6504
6505 /// Removes all scopes, and no default scope will be used either.
6506 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6507 /// for details).
6508 pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeGetIamPolicyCall<'a, C> {
6509 self._scopes.clear();
6510 self
6511 }
6512}
6513
6514/// Lists CustomTargetTypes in a given project and location.
6515///
6516/// A builder for the *locations.customTargetTypes.list* method supported by a *project* resource.
6517/// It is not used directly, but through a [`ProjectMethods`] instance.
6518///
6519/// # Example
6520///
6521/// Instantiate a resource method builder
6522///
6523/// ```test_harness,no_run
6524/// # extern crate hyper;
6525/// # extern crate hyper_rustls;
6526/// # extern crate google_clouddeploy1 as clouddeploy1;
6527/// # async fn dox() {
6528/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6529///
6530/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6531/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6532/// # .with_native_roots()
6533/// # .unwrap()
6534/// # .https_only()
6535/// # .enable_http2()
6536/// # .build();
6537///
6538/// # let executor = hyper_util::rt::TokioExecutor::new();
6539/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6540/// # secret,
6541/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6542/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6543/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6544/// # ),
6545/// # ).build().await.unwrap();
6546///
6547/// # let client = hyper_util::client::legacy::Client::builder(
6548/// # hyper_util::rt::TokioExecutor::new()
6549/// # )
6550/// # .build(
6551/// # hyper_rustls::HttpsConnectorBuilder::new()
6552/// # .with_native_roots()
6553/// # .unwrap()
6554/// # .https_or_http()
6555/// # .enable_http2()
6556/// # .build()
6557/// # );
6558/// # let mut hub = CloudDeploy::new(client, auth);
6559/// // You can configure optional parameters by calling the respective setters at will, and
6560/// // execute the final call using `doit()`.
6561/// // Values shown here are possibly random and not representative !
6562/// let result = hub.projects().locations_custom_target_types_list("parent")
6563/// .page_token("labore")
6564/// .page_size(-43)
6565/// .order_by("duo")
6566/// .filter("sed")
6567/// .doit().await;
6568/// # }
6569/// ```
6570pub struct ProjectLocationCustomTargetTypeListCall<'a, C>
6571where
6572 C: 'a,
6573{
6574 hub: &'a CloudDeploy<C>,
6575 _parent: String,
6576 _page_token: Option<String>,
6577 _page_size: Option<i32>,
6578 _order_by: Option<String>,
6579 _filter: Option<String>,
6580 _delegate: Option<&'a mut dyn common::Delegate>,
6581 _additional_params: HashMap<String, String>,
6582 _scopes: BTreeSet<String>,
6583}
6584
6585impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeListCall<'a, C> {}
6586
6587impl<'a, C> ProjectLocationCustomTargetTypeListCall<'a, C>
6588where
6589 C: common::Connector,
6590{
6591 /// Perform the operation you have build so far.
6592 pub async fn doit(
6593 mut self,
6594 ) -> common::Result<(common::Response, ListCustomTargetTypesResponse)> {
6595 use std::borrow::Cow;
6596 use std::io::{Read, Seek};
6597
6598 use common::{url::Params, ToParts};
6599 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6600
6601 let mut dd = common::DefaultDelegate;
6602 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6603 dlg.begin(common::MethodInfo {
6604 id: "clouddeploy.projects.locations.customTargetTypes.list",
6605 http_method: hyper::Method::GET,
6606 });
6607
6608 for &field in [
6609 "alt",
6610 "parent",
6611 "pageToken",
6612 "pageSize",
6613 "orderBy",
6614 "filter",
6615 ]
6616 .iter()
6617 {
6618 if self._additional_params.contains_key(field) {
6619 dlg.finished(false);
6620 return Err(common::Error::FieldClash(field));
6621 }
6622 }
6623
6624 let mut params = Params::with_capacity(7 + self._additional_params.len());
6625 params.push("parent", self._parent);
6626 if let Some(value) = self._page_token.as_ref() {
6627 params.push("pageToken", value);
6628 }
6629 if let Some(value) = self._page_size.as_ref() {
6630 params.push("pageSize", value.to_string());
6631 }
6632 if let Some(value) = self._order_by.as_ref() {
6633 params.push("orderBy", value);
6634 }
6635 if let Some(value) = self._filter.as_ref() {
6636 params.push("filter", value);
6637 }
6638
6639 params.extend(self._additional_params.iter());
6640
6641 params.push("alt", "json");
6642 let mut url = self.hub._base_url.clone() + "v1/{+parent}/customTargetTypes";
6643 if self._scopes.is_empty() {
6644 self._scopes
6645 .insert(Scope::CloudPlatform.as_ref().to_string());
6646 }
6647
6648 #[allow(clippy::single_element_loop)]
6649 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6650 url = params.uri_replacement(url, param_name, find_this, true);
6651 }
6652 {
6653 let to_remove = ["parent"];
6654 params.remove_params(&to_remove);
6655 }
6656
6657 let url = params.parse_with_url(&url);
6658
6659 loop {
6660 let token = match self
6661 .hub
6662 .auth
6663 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6664 .await
6665 {
6666 Ok(token) => token,
6667 Err(e) => match dlg.token(e) {
6668 Ok(token) => token,
6669 Err(e) => {
6670 dlg.finished(false);
6671 return Err(common::Error::MissingToken(e));
6672 }
6673 },
6674 };
6675 let mut req_result = {
6676 let client = &self.hub.client;
6677 dlg.pre_request();
6678 let mut req_builder = hyper::Request::builder()
6679 .method(hyper::Method::GET)
6680 .uri(url.as_str())
6681 .header(USER_AGENT, self.hub._user_agent.clone());
6682
6683 if let Some(token) = token.as_ref() {
6684 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6685 }
6686
6687 let request = req_builder
6688 .header(CONTENT_LENGTH, 0_u64)
6689 .body(common::to_body::<String>(None));
6690
6691 client.request(request.unwrap()).await
6692 };
6693
6694 match req_result {
6695 Err(err) => {
6696 if let common::Retry::After(d) = dlg.http_error(&err) {
6697 sleep(d).await;
6698 continue;
6699 }
6700 dlg.finished(false);
6701 return Err(common::Error::HttpError(err));
6702 }
6703 Ok(res) => {
6704 let (mut parts, body) = res.into_parts();
6705 let mut body = common::Body::new(body);
6706 if !parts.status.is_success() {
6707 let bytes = common::to_bytes(body).await.unwrap_or_default();
6708 let error = serde_json::from_str(&common::to_string(&bytes));
6709 let response = common::to_response(parts, bytes.into());
6710
6711 if let common::Retry::After(d) =
6712 dlg.http_failure(&response, error.as_ref().ok())
6713 {
6714 sleep(d).await;
6715 continue;
6716 }
6717
6718 dlg.finished(false);
6719
6720 return Err(match error {
6721 Ok(value) => common::Error::BadRequest(value),
6722 _ => common::Error::Failure(response),
6723 });
6724 }
6725 let response = {
6726 let bytes = common::to_bytes(body).await.unwrap_or_default();
6727 let encoded = common::to_string(&bytes);
6728 match serde_json::from_str(&encoded) {
6729 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6730 Err(error) => {
6731 dlg.response_json_decode_error(&encoded, &error);
6732 return Err(common::Error::JsonDecodeError(
6733 encoded.to_string(),
6734 error,
6735 ));
6736 }
6737 }
6738 };
6739
6740 dlg.finished(true);
6741 return Ok(response);
6742 }
6743 }
6744 }
6745 }
6746
6747 /// Required. The parent that owns this collection of custom target types. Format must be `projects/{project_id}/locations/{location_name}`.
6748 ///
6749 /// Sets the *parent* path property to the given value.
6750 ///
6751 /// Even though the property as already been set when instantiating this call,
6752 /// we provide this method for API completeness.
6753 pub fn parent(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6754 self._parent = new_value.to_string();
6755 self
6756 }
6757 /// 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.
6758 ///
6759 /// Sets the *page token* query property to the given value.
6760 pub fn page_token(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6761 self._page_token = Some(new_value.to_string());
6762 self
6763 }
6764 /// 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.
6765 ///
6766 /// Sets the *page size* query property to the given value.
6767 pub fn page_size(mut self, new_value: i32) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6768 self._page_size = Some(new_value);
6769 self
6770 }
6771 /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
6772 ///
6773 /// Sets the *order by* query property to the given value.
6774 pub fn order_by(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6775 self._order_by = Some(new_value.to_string());
6776 self
6777 }
6778 /// Optional. Filter custom target types to be returned. See https://google.aip.dev/160 for more details.
6779 ///
6780 /// Sets the *filter* query property to the given value.
6781 pub fn filter(mut self, new_value: &str) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6782 self._filter = Some(new_value.to_string());
6783 self
6784 }
6785 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6786 /// while executing the actual API request.
6787 ///
6788 /// ````text
6789 /// It should be used to handle progress information, and to implement a certain level of resilience.
6790 /// ````
6791 ///
6792 /// Sets the *delegate* property to the given value.
6793 pub fn delegate(
6794 mut self,
6795 new_value: &'a mut dyn common::Delegate,
6796 ) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6797 self._delegate = Some(new_value);
6798 self
6799 }
6800
6801 /// Set any additional parameter of the query string used in the request.
6802 /// It should be used to set parameters which are not yet available through their own
6803 /// setters.
6804 ///
6805 /// Please note that this method must not be used to set any of the known parameters
6806 /// which have their own setter method. If done anyway, the request will fail.
6807 ///
6808 /// # Additional Parameters
6809 ///
6810 /// * *$.xgafv* (query-string) - V1 error format.
6811 /// * *access_token* (query-string) - OAuth access token.
6812 /// * *alt* (query-string) - Data format for response.
6813 /// * *callback* (query-string) - JSONP
6814 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6815 /// * *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.
6816 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6817 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6818 /// * *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.
6819 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6820 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6821 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypeListCall<'a, C>
6822 where
6823 T: AsRef<str>,
6824 {
6825 self._additional_params
6826 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6827 self
6828 }
6829
6830 /// Identifies the authorization scope for the method you are building.
6831 ///
6832 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6833 /// [`Scope::CloudPlatform`].
6834 ///
6835 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6836 /// tokens for more than one scope.
6837 ///
6838 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6839 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6840 /// sufficient, a read-write scope will do as well.
6841 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypeListCall<'a, C>
6842 where
6843 St: AsRef<str>,
6844 {
6845 self._scopes.insert(String::from(scope.as_ref()));
6846 self
6847 }
6848 /// Identifies the authorization scope(s) for the method you are building.
6849 ///
6850 /// See [`Self::add_scope()`] for details.
6851 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCustomTargetTypeListCall<'a, C>
6852 where
6853 I: IntoIterator<Item = St>,
6854 St: AsRef<str>,
6855 {
6856 self._scopes
6857 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6858 self
6859 }
6860
6861 /// Removes all scopes, and no default scope will be used either.
6862 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6863 /// for details).
6864 pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeListCall<'a, C> {
6865 self._scopes.clear();
6866 self
6867 }
6868}
6869
6870/// Updates a single CustomTargetType.
6871///
6872/// A builder for the *locations.customTargetTypes.patch* method supported by a *project* resource.
6873/// It is not used directly, but through a [`ProjectMethods`] instance.
6874///
6875/// # Example
6876///
6877/// Instantiate a resource method builder
6878///
6879/// ```test_harness,no_run
6880/// # extern crate hyper;
6881/// # extern crate hyper_rustls;
6882/// # extern crate google_clouddeploy1 as clouddeploy1;
6883/// use clouddeploy1::api::CustomTargetType;
6884/// # async fn dox() {
6885/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6886///
6887/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6888/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6889/// # .with_native_roots()
6890/// # .unwrap()
6891/// # .https_only()
6892/// # .enable_http2()
6893/// # .build();
6894///
6895/// # let executor = hyper_util::rt::TokioExecutor::new();
6896/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6897/// # secret,
6898/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6899/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6900/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6901/// # ),
6902/// # ).build().await.unwrap();
6903///
6904/// # let client = hyper_util::client::legacy::Client::builder(
6905/// # hyper_util::rt::TokioExecutor::new()
6906/// # )
6907/// # .build(
6908/// # hyper_rustls::HttpsConnectorBuilder::new()
6909/// # .with_native_roots()
6910/// # .unwrap()
6911/// # .https_or_http()
6912/// # .enable_http2()
6913/// # .build()
6914/// # );
6915/// # let mut hub = CloudDeploy::new(client, auth);
6916/// // As the method needs a request, you would usually fill it with the desired information
6917/// // into the respective structure. Some of the parts shown here might not be applicable !
6918/// // Values shown here are possibly random and not representative !
6919/// let mut req = CustomTargetType::default();
6920///
6921/// // You can configure optional parameters by calling the respective setters at will, and
6922/// // execute the final call using `doit()`.
6923/// // Values shown here are possibly random and not representative !
6924/// let result = hub.projects().locations_custom_target_types_patch(req, "name")
6925/// .validate_only(true)
6926/// .update_mask(FieldMask::new::<&str>(&[]))
6927/// .request_id("et")
6928/// .allow_missing(true)
6929/// .doit().await;
6930/// # }
6931/// ```
6932pub struct ProjectLocationCustomTargetTypePatchCall<'a, C>
6933where
6934 C: 'a,
6935{
6936 hub: &'a CloudDeploy<C>,
6937 _request: CustomTargetType,
6938 _name: String,
6939 _validate_only: Option<bool>,
6940 _update_mask: Option<common::FieldMask>,
6941 _request_id: Option<String>,
6942 _allow_missing: Option<bool>,
6943 _delegate: Option<&'a mut dyn common::Delegate>,
6944 _additional_params: HashMap<String, String>,
6945 _scopes: BTreeSet<String>,
6946}
6947
6948impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypePatchCall<'a, C> {}
6949
6950impl<'a, C> ProjectLocationCustomTargetTypePatchCall<'a, C>
6951where
6952 C: common::Connector,
6953{
6954 /// Perform the operation you have build so far.
6955 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6956 use std::borrow::Cow;
6957 use std::io::{Read, Seek};
6958
6959 use common::{url::Params, ToParts};
6960 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6961
6962 let mut dd = common::DefaultDelegate;
6963 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6964 dlg.begin(common::MethodInfo {
6965 id: "clouddeploy.projects.locations.customTargetTypes.patch",
6966 http_method: hyper::Method::PATCH,
6967 });
6968
6969 for &field in [
6970 "alt",
6971 "name",
6972 "validateOnly",
6973 "updateMask",
6974 "requestId",
6975 "allowMissing",
6976 ]
6977 .iter()
6978 {
6979 if self._additional_params.contains_key(field) {
6980 dlg.finished(false);
6981 return Err(common::Error::FieldClash(field));
6982 }
6983 }
6984
6985 let mut params = Params::with_capacity(8 + self._additional_params.len());
6986 params.push("name", self._name);
6987 if let Some(value) = self._validate_only.as_ref() {
6988 params.push("validateOnly", value.to_string());
6989 }
6990 if let Some(value) = self._update_mask.as_ref() {
6991 params.push("updateMask", value.to_string());
6992 }
6993 if let Some(value) = self._request_id.as_ref() {
6994 params.push("requestId", value);
6995 }
6996 if let Some(value) = self._allow_missing.as_ref() {
6997 params.push("allowMissing", value.to_string());
6998 }
6999
7000 params.extend(self._additional_params.iter());
7001
7002 params.push("alt", "json");
7003 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7004 if self._scopes.is_empty() {
7005 self._scopes
7006 .insert(Scope::CloudPlatform.as_ref().to_string());
7007 }
7008
7009 #[allow(clippy::single_element_loop)]
7010 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7011 url = params.uri_replacement(url, param_name, find_this, true);
7012 }
7013 {
7014 let to_remove = ["name"];
7015 params.remove_params(&to_remove);
7016 }
7017
7018 let url = params.parse_with_url(&url);
7019
7020 let mut json_mime_type = mime::APPLICATION_JSON;
7021 let mut request_value_reader = {
7022 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7023 common::remove_json_null_values(&mut value);
7024 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7025 serde_json::to_writer(&mut dst, &value).unwrap();
7026 dst
7027 };
7028 let request_size = request_value_reader
7029 .seek(std::io::SeekFrom::End(0))
7030 .unwrap();
7031 request_value_reader
7032 .seek(std::io::SeekFrom::Start(0))
7033 .unwrap();
7034
7035 loop {
7036 let token = match self
7037 .hub
7038 .auth
7039 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7040 .await
7041 {
7042 Ok(token) => token,
7043 Err(e) => match dlg.token(e) {
7044 Ok(token) => token,
7045 Err(e) => {
7046 dlg.finished(false);
7047 return Err(common::Error::MissingToken(e));
7048 }
7049 },
7050 };
7051 request_value_reader
7052 .seek(std::io::SeekFrom::Start(0))
7053 .unwrap();
7054 let mut req_result = {
7055 let client = &self.hub.client;
7056 dlg.pre_request();
7057 let mut req_builder = hyper::Request::builder()
7058 .method(hyper::Method::PATCH)
7059 .uri(url.as_str())
7060 .header(USER_AGENT, self.hub._user_agent.clone());
7061
7062 if let Some(token) = token.as_ref() {
7063 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7064 }
7065
7066 let request = req_builder
7067 .header(CONTENT_TYPE, json_mime_type.to_string())
7068 .header(CONTENT_LENGTH, request_size as u64)
7069 .body(common::to_body(
7070 request_value_reader.get_ref().clone().into(),
7071 ));
7072
7073 client.request(request.unwrap()).await
7074 };
7075
7076 match req_result {
7077 Err(err) => {
7078 if let common::Retry::After(d) = dlg.http_error(&err) {
7079 sleep(d).await;
7080 continue;
7081 }
7082 dlg.finished(false);
7083 return Err(common::Error::HttpError(err));
7084 }
7085 Ok(res) => {
7086 let (mut parts, body) = res.into_parts();
7087 let mut body = common::Body::new(body);
7088 if !parts.status.is_success() {
7089 let bytes = common::to_bytes(body).await.unwrap_or_default();
7090 let error = serde_json::from_str(&common::to_string(&bytes));
7091 let response = common::to_response(parts, bytes.into());
7092
7093 if let common::Retry::After(d) =
7094 dlg.http_failure(&response, error.as_ref().ok())
7095 {
7096 sleep(d).await;
7097 continue;
7098 }
7099
7100 dlg.finished(false);
7101
7102 return Err(match error {
7103 Ok(value) => common::Error::BadRequest(value),
7104 _ => common::Error::Failure(response),
7105 });
7106 }
7107 let response = {
7108 let bytes = common::to_bytes(body).await.unwrap_or_default();
7109 let encoded = common::to_string(&bytes);
7110 match serde_json::from_str(&encoded) {
7111 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7112 Err(error) => {
7113 dlg.response_json_decode_error(&encoded, &error);
7114 return Err(common::Error::JsonDecodeError(
7115 encoded.to_string(),
7116 error,
7117 ));
7118 }
7119 }
7120 };
7121
7122 dlg.finished(true);
7123 return Ok(response);
7124 }
7125 }
7126 }
7127 }
7128
7129 ///
7130 /// Sets the *request* property to the given value.
7131 ///
7132 /// Even though the property as already been set when instantiating this call,
7133 /// we provide this method for API completeness.
7134 pub fn request(
7135 mut self,
7136 new_value: CustomTargetType,
7137 ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7138 self._request = new_value;
7139 self
7140 }
7141 /// Identifier. 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])?`
7142 ///
7143 /// Sets the *name* path property to the given value.
7144 ///
7145 /// Even though the property as already been set when instantiating this call,
7146 /// we provide this method for API completeness.
7147 pub fn name(mut self, new_value: &str) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7148 self._name = new_value.to_string();
7149 self
7150 }
7151 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
7152 ///
7153 /// Sets the *validate only* query property to the given value.
7154 pub fn validate_only(
7155 mut self,
7156 new_value: bool,
7157 ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7158 self._validate_only = Some(new_value);
7159 self
7160 }
7161 /// Required. Field mask is used to specify the fields to be overwritten by the update in the `CustomTargetType` resource. 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.
7162 ///
7163 /// Sets the *update mask* query property to the given value.
7164 pub fn update_mask(
7165 mut self,
7166 new_value: common::FieldMask,
7167 ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7168 self._update_mask = Some(new_value);
7169 self
7170 }
7171 /// 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).
7172 ///
7173 /// Sets the *request id* query property to the given value.
7174 pub fn request_id(
7175 mut self,
7176 new_value: &str,
7177 ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7178 self._request_id = Some(new_value.to_string());
7179 self
7180 }
7181 /// Optional. If set to true, updating a `CustomTargetType` that does not exist will result in the creation of a new `CustomTargetType`.
7182 ///
7183 /// Sets the *allow missing* query property to the given value.
7184 pub fn allow_missing(
7185 mut self,
7186 new_value: bool,
7187 ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7188 self._allow_missing = Some(new_value);
7189 self
7190 }
7191 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7192 /// while executing the actual API request.
7193 ///
7194 /// ````text
7195 /// It should be used to handle progress information, and to implement a certain level of resilience.
7196 /// ````
7197 ///
7198 /// Sets the *delegate* property to the given value.
7199 pub fn delegate(
7200 mut self,
7201 new_value: &'a mut dyn common::Delegate,
7202 ) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7203 self._delegate = Some(new_value);
7204 self
7205 }
7206
7207 /// Set any additional parameter of the query string used in the request.
7208 /// It should be used to set parameters which are not yet available through their own
7209 /// setters.
7210 ///
7211 /// Please note that this method must not be used to set any of the known parameters
7212 /// which have their own setter method. If done anyway, the request will fail.
7213 ///
7214 /// # Additional Parameters
7215 ///
7216 /// * *$.xgafv* (query-string) - V1 error format.
7217 /// * *access_token* (query-string) - OAuth access token.
7218 /// * *alt* (query-string) - Data format for response.
7219 /// * *callback* (query-string) - JSONP
7220 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7221 /// * *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.
7222 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7223 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7224 /// * *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.
7225 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7226 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7227 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationCustomTargetTypePatchCall<'a, C>
7228 where
7229 T: AsRef<str>,
7230 {
7231 self._additional_params
7232 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7233 self
7234 }
7235
7236 /// Identifies the authorization scope for the method you are building.
7237 ///
7238 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7239 /// [`Scope::CloudPlatform`].
7240 ///
7241 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7242 /// tokens for more than one scope.
7243 ///
7244 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7245 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7246 /// sufficient, a read-write scope will do as well.
7247 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationCustomTargetTypePatchCall<'a, C>
7248 where
7249 St: AsRef<str>,
7250 {
7251 self._scopes.insert(String::from(scope.as_ref()));
7252 self
7253 }
7254 /// Identifies the authorization scope(s) for the method you are building.
7255 ///
7256 /// See [`Self::add_scope()`] for details.
7257 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationCustomTargetTypePatchCall<'a, C>
7258 where
7259 I: IntoIterator<Item = St>,
7260 St: AsRef<str>,
7261 {
7262 self._scopes
7263 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7264 self
7265 }
7266
7267 /// Removes all scopes, and no default scope will be used either.
7268 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7269 /// for details).
7270 pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypePatchCall<'a, C> {
7271 self._scopes.clear();
7272 self
7273 }
7274}
7275
7276/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
7277///
7278/// A builder for the *locations.customTargetTypes.setIamPolicy* method supported by a *project* resource.
7279/// It is not used directly, but through a [`ProjectMethods`] instance.
7280///
7281/// # Example
7282///
7283/// Instantiate a resource method builder
7284///
7285/// ```test_harness,no_run
7286/// # extern crate hyper;
7287/// # extern crate hyper_rustls;
7288/// # extern crate google_clouddeploy1 as clouddeploy1;
7289/// use clouddeploy1::api::SetIamPolicyRequest;
7290/// # async fn dox() {
7291/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7292///
7293/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7294/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7295/// # .with_native_roots()
7296/// # .unwrap()
7297/// # .https_only()
7298/// # .enable_http2()
7299/// # .build();
7300///
7301/// # let executor = hyper_util::rt::TokioExecutor::new();
7302/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7303/// # secret,
7304/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7305/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7306/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7307/// # ),
7308/// # ).build().await.unwrap();
7309///
7310/// # let client = hyper_util::client::legacy::Client::builder(
7311/// # hyper_util::rt::TokioExecutor::new()
7312/// # )
7313/// # .build(
7314/// # hyper_rustls::HttpsConnectorBuilder::new()
7315/// # .with_native_roots()
7316/// # .unwrap()
7317/// # .https_or_http()
7318/// # .enable_http2()
7319/// # .build()
7320/// # );
7321/// # let mut hub = CloudDeploy::new(client, auth);
7322/// // As the method needs a request, you would usually fill it with the desired information
7323/// // into the respective structure. Some of the parts shown here might not be applicable !
7324/// // Values shown here are possibly random and not representative !
7325/// let mut req = SetIamPolicyRequest::default();
7326///
7327/// // You can configure optional parameters by calling the respective setters at will, and
7328/// // execute the final call using `doit()`.
7329/// // Values shown here are possibly random and not representative !
7330/// let result = hub.projects().locations_custom_target_types_set_iam_policy(req, "resource")
7331/// .doit().await;
7332/// # }
7333/// ```
7334pub struct ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
7335where
7336 C: 'a,
7337{
7338 hub: &'a CloudDeploy<C>,
7339 _request: SetIamPolicyRequest,
7340 _resource: String,
7341 _delegate: Option<&'a mut dyn common::Delegate>,
7342 _additional_params: HashMap<String, String>,
7343 _scopes: BTreeSet<String>,
7344}
7345
7346impl<'a, C> common::CallBuilder for ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {}
7347
7348impl<'a, C> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
7349where
7350 C: common::Connector,
7351{
7352 /// Perform the operation you have build so far.
7353 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
7354 use std::borrow::Cow;
7355 use std::io::{Read, Seek};
7356
7357 use common::{url::Params, ToParts};
7358 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7359
7360 let mut dd = common::DefaultDelegate;
7361 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7362 dlg.begin(common::MethodInfo {
7363 id: "clouddeploy.projects.locations.customTargetTypes.setIamPolicy",
7364 http_method: hyper::Method::POST,
7365 });
7366
7367 for &field in ["alt", "resource"].iter() {
7368 if self._additional_params.contains_key(field) {
7369 dlg.finished(false);
7370 return Err(common::Error::FieldClash(field));
7371 }
7372 }
7373
7374 let mut params = Params::with_capacity(4 + self._additional_params.len());
7375 params.push("resource", self._resource);
7376
7377 params.extend(self._additional_params.iter());
7378
7379 params.push("alt", "json");
7380 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
7381 if self._scopes.is_empty() {
7382 self._scopes
7383 .insert(Scope::CloudPlatform.as_ref().to_string());
7384 }
7385
7386 #[allow(clippy::single_element_loop)]
7387 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
7388 url = params.uri_replacement(url, param_name, find_this, true);
7389 }
7390 {
7391 let to_remove = ["resource"];
7392 params.remove_params(&to_remove);
7393 }
7394
7395 let url = params.parse_with_url(&url);
7396
7397 let mut json_mime_type = mime::APPLICATION_JSON;
7398 let mut request_value_reader = {
7399 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7400 common::remove_json_null_values(&mut value);
7401 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7402 serde_json::to_writer(&mut dst, &value).unwrap();
7403 dst
7404 };
7405 let request_size = request_value_reader
7406 .seek(std::io::SeekFrom::End(0))
7407 .unwrap();
7408 request_value_reader
7409 .seek(std::io::SeekFrom::Start(0))
7410 .unwrap();
7411
7412 loop {
7413 let token = match self
7414 .hub
7415 .auth
7416 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7417 .await
7418 {
7419 Ok(token) => token,
7420 Err(e) => match dlg.token(e) {
7421 Ok(token) => token,
7422 Err(e) => {
7423 dlg.finished(false);
7424 return Err(common::Error::MissingToken(e));
7425 }
7426 },
7427 };
7428 request_value_reader
7429 .seek(std::io::SeekFrom::Start(0))
7430 .unwrap();
7431 let mut req_result = {
7432 let client = &self.hub.client;
7433 dlg.pre_request();
7434 let mut req_builder = hyper::Request::builder()
7435 .method(hyper::Method::POST)
7436 .uri(url.as_str())
7437 .header(USER_AGENT, self.hub._user_agent.clone());
7438
7439 if let Some(token) = token.as_ref() {
7440 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7441 }
7442
7443 let request = req_builder
7444 .header(CONTENT_TYPE, json_mime_type.to_string())
7445 .header(CONTENT_LENGTH, request_size as u64)
7446 .body(common::to_body(
7447 request_value_reader.get_ref().clone().into(),
7448 ));
7449
7450 client.request(request.unwrap()).await
7451 };
7452
7453 match req_result {
7454 Err(err) => {
7455 if let common::Retry::After(d) = dlg.http_error(&err) {
7456 sleep(d).await;
7457 continue;
7458 }
7459 dlg.finished(false);
7460 return Err(common::Error::HttpError(err));
7461 }
7462 Ok(res) => {
7463 let (mut parts, body) = res.into_parts();
7464 let mut body = common::Body::new(body);
7465 if !parts.status.is_success() {
7466 let bytes = common::to_bytes(body).await.unwrap_or_default();
7467 let error = serde_json::from_str(&common::to_string(&bytes));
7468 let response = common::to_response(parts, bytes.into());
7469
7470 if let common::Retry::After(d) =
7471 dlg.http_failure(&response, error.as_ref().ok())
7472 {
7473 sleep(d).await;
7474 continue;
7475 }
7476
7477 dlg.finished(false);
7478
7479 return Err(match error {
7480 Ok(value) => common::Error::BadRequest(value),
7481 _ => common::Error::Failure(response),
7482 });
7483 }
7484 let response = {
7485 let bytes = common::to_bytes(body).await.unwrap_or_default();
7486 let encoded = common::to_string(&bytes);
7487 match serde_json::from_str(&encoded) {
7488 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7489 Err(error) => {
7490 dlg.response_json_decode_error(&encoded, &error);
7491 return Err(common::Error::JsonDecodeError(
7492 encoded.to_string(),
7493 error,
7494 ));
7495 }
7496 }
7497 };
7498
7499 dlg.finished(true);
7500 return Ok(response);
7501 }
7502 }
7503 }
7504 }
7505
7506 ///
7507 /// Sets the *request* property to the given value.
7508 ///
7509 /// Even though the property as already been set when instantiating this call,
7510 /// we provide this method for API completeness.
7511 pub fn request(
7512 mut self,
7513 new_value: SetIamPolicyRequest,
7514 ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
7515 self._request = new_value;
7516 self
7517 }
7518 /// 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.
7519 ///
7520 /// Sets the *resource* path property to the given value.
7521 ///
7522 /// Even though the property as already been set when instantiating this call,
7523 /// we provide this method for API completeness.
7524 pub fn resource(
7525 mut self,
7526 new_value: &str,
7527 ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
7528 self._resource = new_value.to_string();
7529 self
7530 }
7531 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7532 /// while executing the actual API request.
7533 ///
7534 /// ````text
7535 /// It should be used to handle progress information, and to implement a certain level of resilience.
7536 /// ````
7537 ///
7538 /// Sets the *delegate* property to the given value.
7539 pub fn delegate(
7540 mut self,
7541 new_value: &'a mut dyn common::Delegate,
7542 ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
7543 self._delegate = Some(new_value);
7544 self
7545 }
7546
7547 /// Set any additional parameter of the query string used in the request.
7548 /// It should be used to set parameters which are not yet available through their own
7549 /// setters.
7550 ///
7551 /// Please note that this method must not be used to set any of the known parameters
7552 /// which have their own setter method. If done anyway, the request will fail.
7553 ///
7554 /// # Additional Parameters
7555 ///
7556 /// * *$.xgafv* (query-string) - V1 error format.
7557 /// * *access_token* (query-string) - OAuth access token.
7558 /// * *alt* (query-string) - Data format for response.
7559 /// * *callback* (query-string) - JSONP
7560 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7561 /// * *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.
7562 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7563 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7564 /// * *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.
7565 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7566 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7567 pub fn param<T>(
7568 mut self,
7569 name: T,
7570 value: T,
7571 ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
7572 where
7573 T: AsRef<str>,
7574 {
7575 self._additional_params
7576 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7577 self
7578 }
7579
7580 /// Identifies the authorization scope for the method you are building.
7581 ///
7582 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7583 /// [`Scope::CloudPlatform`].
7584 ///
7585 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7586 /// tokens for more than one scope.
7587 ///
7588 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7589 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7590 /// sufficient, a read-write scope will do as well.
7591 pub fn add_scope<St>(
7592 mut self,
7593 scope: St,
7594 ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
7595 where
7596 St: AsRef<str>,
7597 {
7598 self._scopes.insert(String::from(scope.as_ref()));
7599 self
7600 }
7601 /// Identifies the authorization scope(s) for the method you are building.
7602 ///
7603 /// See [`Self::add_scope()`] for details.
7604 pub fn add_scopes<I, St>(
7605 mut self,
7606 scopes: I,
7607 ) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C>
7608 where
7609 I: IntoIterator<Item = St>,
7610 St: AsRef<str>,
7611 {
7612 self._scopes
7613 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7614 self
7615 }
7616
7617 /// Removes all scopes, and no default scope will be used either.
7618 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7619 /// for details).
7620 pub fn clear_scopes(mut self) -> ProjectLocationCustomTargetTypeSetIamPolicyCall<'a, C> {
7621 self._scopes.clear();
7622 self
7623 }
7624}
7625
7626/// 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.
7627///
7628/// A builder for the *locations.deliveryPipelines.automationRuns.cancel* method supported by a *project* resource.
7629/// It is not used directly, but through a [`ProjectMethods`] instance.
7630///
7631/// # Example
7632///
7633/// Instantiate a resource method builder
7634///
7635/// ```test_harness,no_run
7636/// # extern crate hyper;
7637/// # extern crate hyper_rustls;
7638/// # extern crate google_clouddeploy1 as clouddeploy1;
7639/// use clouddeploy1::api::CancelAutomationRunRequest;
7640/// # async fn dox() {
7641/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7642///
7643/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7644/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7645/// # .with_native_roots()
7646/// # .unwrap()
7647/// # .https_only()
7648/// # .enable_http2()
7649/// # .build();
7650///
7651/// # let executor = hyper_util::rt::TokioExecutor::new();
7652/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7653/// # secret,
7654/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7655/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7656/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7657/// # ),
7658/// # ).build().await.unwrap();
7659///
7660/// # let client = hyper_util::client::legacy::Client::builder(
7661/// # hyper_util::rt::TokioExecutor::new()
7662/// # )
7663/// # .build(
7664/// # hyper_rustls::HttpsConnectorBuilder::new()
7665/// # .with_native_roots()
7666/// # .unwrap()
7667/// # .https_or_http()
7668/// # .enable_http2()
7669/// # .build()
7670/// # );
7671/// # let mut hub = CloudDeploy::new(client, auth);
7672/// // As the method needs a request, you would usually fill it with the desired information
7673/// // into the respective structure. Some of the parts shown here might not be applicable !
7674/// // Values shown here are possibly random and not representative !
7675/// let mut req = CancelAutomationRunRequest::default();
7676///
7677/// // You can configure optional parameters by calling the respective setters at will, and
7678/// // execute the final call using `doit()`.
7679/// // Values shown here are possibly random and not representative !
7680/// let result = hub.projects().locations_delivery_pipelines_automation_runs_cancel(req, "name")
7681/// .doit().await;
7682/// # }
7683/// ```
7684pub struct ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7685where
7686 C: 'a,
7687{
7688 hub: &'a CloudDeploy<C>,
7689 _request: CancelAutomationRunRequest,
7690 _name: String,
7691 _delegate: Option<&'a mut dyn common::Delegate>,
7692 _additional_params: HashMap<String, String>,
7693 _scopes: BTreeSet<String>,
7694}
7695
7696impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {}
7697
7698impl<'a, C> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7699where
7700 C: common::Connector,
7701{
7702 /// Perform the operation you have build so far.
7703 pub async fn doit(mut self) -> common::Result<(common::Response, CancelAutomationRunResponse)> {
7704 use std::borrow::Cow;
7705 use std::io::{Read, Seek};
7706
7707 use common::{url::Params, ToParts};
7708 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7709
7710 let mut dd = common::DefaultDelegate;
7711 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7712 dlg.begin(common::MethodInfo {
7713 id: "clouddeploy.projects.locations.deliveryPipelines.automationRuns.cancel",
7714 http_method: hyper::Method::POST,
7715 });
7716
7717 for &field in ["alt", "name"].iter() {
7718 if self._additional_params.contains_key(field) {
7719 dlg.finished(false);
7720 return Err(common::Error::FieldClash(field));
7721 }
7722 }
7723
7724 let mut params = Params::with_capacity(4 + self._additional_params.len());
7725 params.push("name", self._name);
7726
7727 params.extend(self._additional_params.iter());
7728
7729 params.push("alt", "json");
7730 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
7731 if self._scopes.is_empty() {
7732 self._scopes
7733 .insert(Scope::CloudPlatform.as_ref().to_string());
7734 }
7735
7736 #[allow(clippy::single_element_loop)]
7737 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7738 url = params.uri_replacement(url, param_name, find_this, true);
7739 }
7740 {
7741 let to_remove = ["name"];
7742 params.remove_params(&to_remove);
7743 }
7744
7745 let url = params.parse_with_url(&url);
7746
7747 let mut json_mime_type = mime::APPLICATION_JSON;
7748 let mut request_value_reader = {
7749 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7750 common::remove_json_null_values(&mut value);
7751 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7752 serde_json::to_writer(&mut dst, &value).unwrap();
7753 dst
7754 };
7755 let request_size = request_value_reader
7756 .seek(std::io::SeekFrom::End(0))
7757 .unwrap();
7758 request_value_reader
7759 .seek(std::io::SeekFrom::Start(0))
7760 .unwrap();
7761
7762 loop {
7763 let token = match self
7764 .hub
7765 .auth
7766 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7767 .await
7768 {
7769 Ok(token) => token,
7770 Err(e) => match dlg.token(e) {
7771 Ok(token) => token,
7772 Err(e) => {
7773 dlg.finished(false);
7774 return Err(common::Error::MissingToken(e));
7775 }
7776 },
7777 };
7778 request_value_reader
7779 .seek(std::io::SeekFrom::Start(0))
7780 .unwrap();
7781 let mut req_result = {
7782 let client = &self.hub.client;
7783 dlg.pre_request();
7784 let mut req_builder = hyper::Request::builder()
7785 .method(hyper::Method::POST)
7786 .uri(url.as_str())
7787 .header(USER_AGENT, self.hub._user_agent.clone());
7788
7789 if let Some(token) = token.as_ref() {
7790 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7791 }
7792
7793 let request = req_builder
7794 .header(CONTENT_TYPE, json_mime_type.to_string())
7795 .header(CONTENT_LENGTH, request_size as u64)
7796 .body(common::to_body(
7797 request_value_reader.get_ref().clone().into(),
7798 ));
7799
7800 client.request(request.unwrap()).await
7801 };
7802
7803 match req_result {
7804 Err(err) => {
7805 if let common::Retry::After(d) = dlg.http_error(&err) {
7806 sleep(d).await;
7807 continue;
7808 }
7809 dlg.finished(false);
7810 return Err(common::Error::HttpError(err));
7811 }
7812 Ok(res) => {
7813 let (mut parts, body) = res.into_parts();
7814 let mut body = common::Body::new(body);
7815 if !parts.status.is_success() {
7816 let bytes = common::to_bytes(body).await.unwrap_or_default();
7817 let error = serde_json::from_str(&common::to_string(&bytes));
7818 let response = common::to_response(parts, bytes.into());
7819
7820 if let common::Retry::After(d) =
7821 dlg.http_failure(&response, error.as_ref().ok())
7822 {
7823 sleep(d).await;
7824 continue;
7825 }
7826
7827 dlg.finished(false);
7828
7829 return Err(match error {
7830 Ok(value) => common::Error::BadRequest(value),
7831 _ => common::Error::Failure(response),
7832 });
7833 }
7834 let response = {
7835 let bytes = common::to_bytes(body).await.unwrap_or_default();
7836 let encoded = common::to_string(&bytes);
7837 match serde_json::from_str(&encoded) {
7838 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7839 Err(error) => {
7840 dlg.response_json_decode_error(&encoded, &error);
7841 return Err(common::Error::JsonDecodeError(
7842 encoded.to_string(),
7843 error,
7844 ));
7845 }
7846 }
7847 };
7848
7849 dlg.finished(true);
7850 return Ok(response);
7851 }
7852 }
7853 }
7854 }
7855
7856 ///
7857 /// Sets the *request* property to the given value.
7858 ///
7859 /// Even though the property as already been set when instantiating this call,
7860 /// we provide this method for API completeness.
7861 pub fn request(
7862 mut self,
7863 new_value: CancelAutomationRunRequest,
7864 ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7865 self._request = new_value;
7866 self
7867 }
7868 /// Required. Name of the `AutomationRun`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
7869 ///
7870 /// Sets the *name* path property to the given value.
7871 ///
7872 /// Even though the property as already been set when instantiating this call,
7873 /// we provide this method for API completeness.
7874 pub fn name(
7875 mut self,
7876 new_value: &str,
7877 ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7878 self._name = new_value.to_string();
7879 self
7880 }
7881 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7882 /// while executing the actual API request.
7883 ///
7884 /// ````text
7885 /// It should be used to handle progress information, and to implement a certain level of resilience.
7886 /// ````
7887 ///
7888 /// Sets the *delegate* property to the given value.
7889 pub fn delegate(
7890 mut self,
7891 new_value: &'a mut dyn common::Delegate,
7892 ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7893 self._delegate = Some(new_value);
7894 self
7895 }
7896
7897 /// Set any additional parameter of the query string used in the request.
7898 /// It should be used to set parameters which are not yet available through their own
7899 /// setters.
7900 ///
7901 /// Please note that this method must not be used to set any of the known parameters
7902 /// which have their own setter method. If done anyway, the request will fail.
7903 ///
7904 /// # Additional Parameters
7905 ///
7906 /// * *$.xgafv* (query-string) - V1 error format.
7907 /// * *access_token* (query-string) - OAuth access token.
7908 /// * *alt* (query-string) - Data format for response.
7909 /// * *callback* (query-string) - JSONP
7910 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7911 /// * *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.
7912 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7913 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7914 /// * *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.
7915 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7916 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7917 pub fn param<T>(
7918 mut self,
7919 name: T,
7920 value: T,
7921 ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7922 where
7923 T: AsRef<str>,
7924 {
7925 self._additional_params
7926 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7927 self
7928 }
7929
7930 /// Identifies the authorization scope for the method you are building.
7931 ///
7932 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7933 /// [`Scope::CloudPlatform`].
7934 ///
7935 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7936 /// tokens for more than one scope.
7937 ///
7938 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7939 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7940 /// sufficient, a read-write scope will do as well.
7941 pub fn add_scope<St>(
7942 mut self,
7943 scope: St,
7944 ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7945 where
7946 St: AsRef<str>,
7947 {
7948 self._scopes.insert(String::from(scope.as_ref()));
7949 self
7950 }
7951 /// Identifies the authorization scope(s) for the method you are building.
7952 ///
7953 /// See [`Self::add_scope()`] for details.
7954 pub fn add_scopes<I, St>(
7955 mut self,
7956 scopes: I,
7957 ) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C>
7958 where
7959 I: IntoIterator<Item = St>,
7960 St: AsRef<str>,
7961 {
7962 self._scopes
7963 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7964 self
7965 }
7966
7967 /// Removes all scopes, and no default scope will be used either.
7968 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7969 /// for details).
7970 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationRunCancelCall<'a, C> {
7971 self._scopes.clear();
7972 self
7973 }
7974}
7975
7976/// Gets details of a single AutomationRun.
7977///
7978/// A builder for the *locations.deliveryPipelines.automationRuns.get* method supported by a *project* resource.
7979/// It is not used directly, but through a [`ProjectMethods`] instance.
7980///
7981/// # Example
7982///
7983/// Instantiate a resource method builder
7984///
7985/// ```test_harness,no_run
7986/// # extern crate hyper;
7987/// # extern crate hyper_rustls;
7988/// # extern crate google_clouddeploy1 as clouddeploy1;
7989/// # async fn dox() {
7990/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7991///
7992/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7993/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7994/// # .with_native_roots()
7995/// # .unwrap()
7996/// # .https_only()
7997/// # .enable_http2()
7998/// # .build();
7999///
8000/// # let executor = hyper_util::rt::TokioExecutor::new();
8001/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8002/// # secret,
8003/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8004/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8005/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8006/// # ),
8007/// # ).build().await.unwrap();
8008///
8009/// # let client = hyper_util::client::legacy::Client::builder(
8010/// # hyper_util::rt::TokioExecutor::new()
8011/// # )
8012/// # .build(
8013/// # hyper_rustls::HttpsConnectorBuilder::new()
8014/// # .with_native_roots()
8015/// # .unwrap()
8016/// # .https_or_http()
8017/// # .enable_http2()
8018/// # .build()
8019/// # );
8020/// # let mut hub = CloudDeploy::new(client, auth);
8021/// // You can configure optional parameters by calling the respective setters at will, and
8022/// // execute the final call using `doit()`.
8023/// // Values shown here are possibly random and not representative !
8024/// let result = hub.projects().locations_delivery_pipelines_automation_runs_get("name")
8025/// .doit().await;
8026/// # }
8027/// ```
8028pub struct ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
8029where
8030 C: 'a,
8031{
8032 hub: &'a CloudDeploy<C>,
8033 _name: String,
8034 _delegate: Option<&'a mut dyn common::Delegate>,
8035 _additional_params: HashMap<String, String>,
8036 _scopes: BTreeSet<String>,
8037}
8038
8039impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {}
8040
8041impl<'a, C> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
8042where
8043 C: common::Connector,
8044{
8045 /// Perform the operation you have build so far.
8046 pub async fn doit(mut self) -> common::Result<(common::Response, AutomationRun)> {
8047 use std::borrow::Cow;
8048 use std::io::{Read, Seek};
8049
8050 use common::{url::Params, ToParts};
8051 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8052
8053 let mut dd = common::DefaultDelegate;
8054 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8055 dlg.begin(common::MethodInfo {
8056 id: "clouddeploy.projects.locations.deliveryPipelines.automationRuns.get",
8057 http_method: hyper::Method::GET,
8058 });
8059
8060 for &field in ["alt", "name"].iter() {
8061 if self._additional_params.contains_key(field) {
8062 dlg.finished(false);
8063 return Err(common::Error::FieldClash(field));
8064 }
8065 }
8066
8067 let mut params = Params::with_capacity(3 + self._additional_params.len());
8068 params.push("name", self._name);
8069
8070 params.extend(self._additional_params.iter());
8071
8072 params.push("alt", "json");
8073 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8074 if self._scopes.is_empty() {
8075 self._scopes
8076 .insert(Scope::CloudPlatform.as_ref().to_string());
8077 }
8078
8079 #[allow(clippy::single_element_loop)]
8080 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8081 url = params.uri_replacement(url, param_name, find_this, true);
8082 }
8083 {
8084 let to_remove = ["name"];
8085 params.remove_params(&to_remove);
8086 }
8087
8088 let url = params.parse_with_url(&url);
8089
8090 loop {
8091 let token = match self
8092 .hub
8093 .auth
8094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8095 .await
8096 {
8097 Ok(token) => token,
8098 Err(e) => match dlg.token(e) {
8099 Ok(token) => token,
8100 Err(e) => {
8101 dlg.finished(false);
8102 return Err(common::Error::MissingToken(e));
8103 }
8104 },
8105 };
8106 let mut req_result = {
8107 let client = &self.hub.client;
8108 dlg.pre_request();
8109 let mut req_builder = hyper::Request::builder()
8110 .method(hyper::Method::GET)
8111 .uri(url.as_str())
8112 .header(USER_AGENT, self.hub._user_agent.clone());
8113
8114 if let Some(token) = token.as_ref() {
8115 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8116 }
8117
8118 let request = req_builder
8119 .header(CONTENT_LENGTH, 0_u64)
8120 .body(common::to_body::<String>(None));
8121
8122 client.request(request.unwrap()).await
8123 };
8124
8125 match req_result {
8126 Err(err) => {
8127 if let common::Retry::After(d) = dlg.http_error(&err) {
8128 sleep(d).await;
8129 continue;
8130 }
8131 dlg.finished(false);
8132 return Err(common::Error::HttpError(err));
8133 }
8134 Ok(res) => {
8135 let (mut parts, body) = res.into_parts();
8136 let mut body = common::Body::new(body);
8137 if !parts.status.is_success() {
8138 let bytes = common::to_bytes(body).await.unwrap_or_default();
8139 let error = serde_json::from_str(&common::to_string(&bytes));
8140 let response = common::to_response(parts, bytes.into());
8141
8142 if let common::Retry::After(d) =
8143 dlg.http_failure(&response, error.as_ref().ok())
8144 {
8145 sleep(d).await;
8146 continue;
8147 }
8148
8149 dlg.finished(false);
8150
8151 return Err(match error {
8152 Ok(value) => common::Error::BadRequest(value),
8153 _ => common::Error::Failure(response),
8154 });
8155 }
8156 let response = {
8157 let bytes = common::to_bytes(body).await.unwrap_or_default();
8158 let encoded = common::to_string(&bytes);
8159 match serde_json::from_str(&encoded) {
8160 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8161 Err(error) => {
8162 dlg.response_json_decode_error(&encoded, &error);
8163 return Err(common::Error::JsonDecodeError(
8164 encoded.to_string(),
8165 error,
8166 ));
8167 }
8168 }
8169 };
8170
8171 dlg.finished(true);
8172 return Ok(response);
8173 }
8174 }
8175 }
8176 }
8177
8178 /// Required. Name of the `AutomationRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automationRuns/{automation_run}`.
8179 ///
8180 /// Sets the *name* path property to the given value.
8181 ///
8182 /// Even though the property as already been set when instantiating this call,
8183 /// we provide this method for API completeness.
8184 pub fn name(
8185 mut self,
8186 new_value: &str,
8187 ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
8188 self._name = new_value.to_string();
8189 self
8190 }
8191 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8192 /// while executing the actual API request.
8193 ///
8194 /// ````text
8195 /// It should be used to handle progress information, and to implement a certain level of resilience.
8196 /// ````
8197 ///
8198 /// Sets the *delegate* property to the given value.
8199 pub fn delegate(
8200 mut self,
8201 new_value: &'a mut dyn common::Delegate,
8202 ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
8203 self._delegate = Some(new_value);
8204 self
8205 }
8206
8207 /// Set any additional parameter of the query string used in the request.
8208 /// It should be used to set parameters which are not yet available through their own
8209 /// setters.
8210 ///
8211 /// Please note that this method must not be used to set any of the known parameters
8212 /// which have their own setter method. If done anyway, the request will fail.
8213 ///
8214 /// # Additional Parameters
8215 ///
8216 /// * *$.xgafv* (query-string) - V1 error format.
8217 /// * *access_token* (query-string) - OAuth access token.
8218 /// * *alt* (query-string) - Data format for response.
8219 /// * *callback* (query-string) - JSONP
8220 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8221 /// * *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.
8222 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8223 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8224 /// * *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.
8225 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8226 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8227 pub fn param<T>(
8228 mut self,
8229 name: T,
8230 value: T,
8231 ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
8232 where
8233 T: AsRef<str>,
8234 {
8235 self._additional_params
8236 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8237 self
8238 }
8239
8240 /// Identifies the authorization scope for the method you are building.
8241 ///
8242 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8243 /// [`Scope::CloudPlatform`].
8244 ///
8245 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8246 /// tokens for more than one scope.
8247 ///
8248 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8249 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8250 /// sufficient, a read-write scope will do as well.
8251 pub fn add_scope<St>(
8252 mut self,
8253 scope: St,
8254 ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
8255 where
8256 St: AsRef<str>,
8257 {
8258 self._scopes.insert(String::from(scope.as_ref()));
8259 self
8260 }
8261 /// Identifies the authorization scope(s) for the method you are building.
8262 ///
8263 /// See [`Self::add_scope()`] for details.
8264 pub fn add_scopes<I, St>(
8265 mut self,
8266 scopes: I,
8267 ) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C>
8268 where
8269 I: IntoIterator<Item = St>,
8270 St: AsRef<str>,
8271 {
8272 self._scopes
8273 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8274 self
8275 }
8276
8277 /// Removes all scopes, and no default scope will be used either.
8278 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8279 /// for details).
8280 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationRunGetCall<'a, C> {
8281 self._scopes.clear();
8282 self
8283 }
8284}
8285
8286/// Lists AutomationRuns in a given project and location.
8287///
8288/// A builder for the *locations.deliveryPipelines.automationRuns.list* method supported by a *project* resource.
8289/// It is not used directly, but through a [`ProjectMethods`] instance.
8290///
8291/// # Example
8292///
8293/// Instantiate a resource method builder
8294///
8295/// ```test_harness,no_run
8296/// # extern crate hyper;
8297/// # extern crate hyper_rustls;
8298/// # extern crate google_clouddeploy1 as clouddeploy1;
8299/// # async fn dox() {
8300/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8301///
8302/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8303/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8304/// # .with_native_roots()
8305/// # .unwrap()
8306/// # .https_only()
8307/// # .enable_http2()
8308/// # .build();
8309///
8310/// # let executor = hyper_util::rt::TokioExecutor::new();
8311/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8312/// # secret,
8313/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8314/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8315/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8316/// # ),
8317/// # ).build().await.unwrap();
8318///
8319/// # let client = hyper_util::client::legacy::Client::builder(
8320/// # hyper_util::rt::TokioExecutor::new()
8321/// # )
8322/// # .build(
8323/// # hyper_rustls::HttpsConnectorBuilder::new()
8324/// # .with_native_roots()
8325/// # .unwrap()
8326/// # .https_or_http()
8327/// # .enable_http2()
8328/// # .build()
8329/// # );
8330/// # let mut hub = CloudDeploy::new(client, auth);
8331/// // You can configure optional parameters by calling the respective setters at will, and
8332/// // execute the final call using `doit()`.
8333/// // Values shown here are possibly random and not representative !
8334/// let result = hub.projects().locations_delivery_pipelines_automation_runs_list("parent")
8335/// .page_token("dolore")
8336/// .page_size(-22)
8337/// .order_by("voluptua.")
8338/// .filter("amet.")
8339/// .doit().await;
8340/// # }
8341/// ```
8342pub struct ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
8343where
8344 C: 'a,
8345{
8346 hub: &'a CloudDeploy<C>,
8347 _parent: String,
8348 _page_token: Option<String>,
8349 _page_size: Option<i32>,
8350 _order_by: Option<String>,
8351 _filter: Option<String>,
8352 _delegate: Option<&'a mut dyn common::Delegate>,
8353 _additional_params: HashMap<String, String>,
8354 _scopes: BTreeSet<String>,
8355}
8356
8357impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {}
8358
8359impl<'a, C> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
8360where
8361 C: common::Connector,
8362{
8363 /// Perform the operation you have build so far.
8364 pub async fn doit(mut self) -> common::Result<(common::Response, ListAutomationRunsResponse)> {
8365 use std::borrow::Cow;
8366 use std::io::{Read, Seek};
8367
8368 use common::{url::Params, ToParts};
8369 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8370
8371 let mut dd = common::DefaultDelegate;
8372 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8373 dlg.begin(common::MethodInfo {
8374 id: "clouddeploy.projects.locations.deliveryPipelines.automationRuns.list",
8375 http_method: hyper::Method::GET,
8376 });
8377
8378 for &field in [
8379 "alt",
8380 "parent",
8381 "pageToken",
8382 "pageSize",
8383 "orderBy",
8384 "filter",
8385 ]
8386 .iter()
8387 {
8388 if self._additional_params.contains_key(field) {
8389 dlg.finished(false);
8390 return Err(common::Error::FieldClash(field));
8391 }
8392 }
8393
8394 let mut params = Params::with_capacity(7 + self._additional_params.len());
8395 params.push("parent", self._parent);
8396 if let Some(value) = self._page_token.as_ref() {
8397 params.push("pageToken", value);
8398 }
8399 if let Some(value) = self._page_size.as_ref() {
8400 params.push("pageSize", value.to_string());
8401 }
8402 if let Some(value) = self._order_by.as_ref() {
8403 params.push("orderBy", value);
8404 }
8405 if let Some(value) = self._filter.as_ref() {
8406 params.push("filter", value);
8407 }
8408
8409 params.extend(self._additional_params.iter());
8410
8411 params.push("alt", "json");
8412 let mut url = self.hub._base_url.clone() + "v1/{+parent}/automationRuns";
8413 if self._scopes.is_empty() {
8414 self._scopes
8415 .insert(Scope::CloudPlatform.as_ref().to_string());
8416 }
8417
8418 #[allow(clippy::single_element_loop)]
8419 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8420 url = params.uri_replacement(url, param_name, find_this, true);
8421 }
8422 {
8423 let to_remove = ["parent"];
8424 params.remove_params(&to_remove);
8425 }
8426
8427 let url = params.parse_with_url(&url);
8428
8429 loop {
8430 let token = match self
8431 .hub
8432 .auth
8433 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8434 .await
8435 {
8436 Ok(token) => token,
8437 Err(e) => match dlg.token(e) {
8438 Ok(token) => token,
8439 Err(e) => {
8440 dlg.finished(false);
8441 return Err(common::Error::MissingToken(e));
8442 }
8443 },
8444 };
8445 let mut req_result = {
8446 let client = &self.hub.client;
8447 dlg.pre_request();
8448 let mut req_builder = hyper::Request::builder()
8449 .method(hyper::Method::GET)
8450 .uri(url.as_str())
8451 .header(USER_AGENT, self.hub._user_agent.clone());
8452
8453 if let Some(token) = token.as_ref() {
8454 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8455 }
8456
8457 let request = req_builder
8458 .header(CONTENT_LENGTH, 0_u64)
8459 .body(common::to_body::<String>(None));
8460
8461 client.request(request.unwrap()).await
8462 };
8463
8464 match req_result {
8465 Err(err) => {
8466 if let common::Retry::After(d) = dlg.http_error(&err) {
8467 sleep(d).await;
8468 continue;
8469 }
8470 dlg.finished(false);
8471 return Err(common::Error::HttpError(err));
8472 }
8473 Ok(res) => {
8474 let (mut parts, body) = res.into_parts();
8475 let mut body = common::Body::new(body);
8476 if !parts.status.is_success() {
8477 let bytes = common::to_bytes(body).await.unwrap_or_default();
8478 let error = serde_json::from_str(&common::to_string(&bytes));
8479 let response = common::to_response(parts, bytes.into());
8480
8481 if let common::Retry::After(d) =
8482 dlg.http_failure(&response, error.as_ref().ok())
8483 {
8484 sleep(d).await;
8485 continue;
8486 }
8487
8488 dlg.finished(false);
8489
8490 return Err(match error {
8491 Ok(value) => common::Error::BadRequest(value),
8492 _ => common::Error::Failure(response),
8493 });
8494 }
8495 let response = {
8496 let bytes = common::to_bytes(body).await.unwrap_or_default();
8497 let encoded = common::to_string(&bytes);
8498 match serde_json::from_str(&encoded) {
8499 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8500 Err(error) => {
8501 dlg.response_json_decode_error(&encoded, &error);
8502 return Err(common::Error::JsonDecodeError(
8503 encoded.to_string(),
8504 error,
8505 ));
8506 }
8507 }
8508 };
8509
8510 dlg.finished(true);
8511 return Ok(response);
8512 }
8513 }
8514 }
8515 }
8516
8517 /// Required. The parent `Delivery Pipeline`, which owns this collection of automationRuns. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}`.
8518 ///
8519 /// Sets the *parent* path property to the given value.
8520 ///
8521 /// Even though the property as already been set when instantiating this call,
8522 /// we provide this method for API completeness.
8523 pub fn parent(
8524 mut self,
8525 new_value: &str,
8526 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
8527 self._parent = new_value.to_string();
8528 self
8529 }
8530 /// 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.
8531 ///
8532 /// Sets the *page token* query property to the given value.
8533 pub fn page_token(
8534 mut self,
8535 new_value: &str,
8536 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
8537 self._page_token = Some(new_value.to_string());
8538 self
8539 }
8540 /// 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.
8541 ///
8542 /// Sets the *page size* query property to the given value.
8543 pub fn page_size(
8544 mut self,
8545 new_value: i32,
8546 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
8547 self._page_size = Some(new_value);
8548 self
8549 }
8550 /// Field to sort by.
8551 ///
8552 /// Sets the *order by* query property to the given value.
8553 pub fn order_by(
8554 mut self,
8555 new_value: &str,
8556 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
8557 self._order_by = Some(new_value.to_string());
8558 self
8559 }
8560 /// Filter automationRuns to be returned. All fields can be used in the filter.
8561 ///
8562 /// Sets the *filter* query property to the given value.
8563 pub fn filter(
8564 mut self,
8565 new_value: &str,
8566 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
8567 self._filter = Some(new_value.to_string());
8568 self
8569 }
8570 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8571 /// while executing the actual API request.
8572 ///
8573 /// ````text
8574 /// It should be used to handle progress information, and to implement a certain level of resilience.
8575 /// ````
8576 ///
8577 /// Sets the *delegate* property to the given value.
8578 pub fn delegate(
8579 mut self,
8580 new_value: &'a mut dyn common::Delegate,
8581 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
8582 self._delegate = Some(new_value);
8583 self
8584 }
8585
8586 /// Set any additional parameter of the query string used in the request.
8587 /// It should be used to set parameters which are not yet available through their own
8588 /// setters.
8589 ///
8590 /// Please note that this method must not be used to set any of the known parameters
8591 /// which have their own setter method. If done anyway, the request will fail.
8592 ///
8593 /// # Additional Parameters
8594 ///
8595 /// * *$.xgafv* (query-string) - V1 error format.
8596 /// * *access_token* (query-string) - OAuth access token.
8597 /// * *alt* (query-string) - Data format for response.
8598 /// * *callback* (query-string) - JSONP
8599 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8600 /// * *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.
8601 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8602 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8603 /// * *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.
8604 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8605 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8606 pub fn param<T>(
8607 mut self,
8608 name: T,
8609 value: T,
8610 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
8611 where
8612 T: AsRef<str>,
8613 {
8614 self._additional_params
8615 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8616 self
8617 }
8618
8619 /// Identifies the authorization scope for the method you are building.
8620 ///
8621 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8622 /// [`Scope::CloudPlatform`].
8623 ///
8624 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8625 /// tokens for more than one scope.
8626 ///
8627 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8628 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8629 /// sufficient, a read-write scope will do as well.
8630 pub fn add_scope<St>(
8631 mut self,
8632 scope: St,
8633 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
8634 where
8635 St: AsRef<str>,
8636 {
8637 self._scopes.insert(String::from(scope.as_ref()));
8638 self
8639 }
8640 /// Identifies the authorization scope(s) for the method you are building.
8641 ///
8642 /// See [`Self::add_scope()`] for details.
8643 pub fn add_scopes<I, St>(
8644 mut self,
8645 scopes: I,
8646 ) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C>
8647 where
8648 I: IntoIterator<Item = St>,
8649 St: AsRef<str>,
8650 {
8651 self._scopes
8652 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8653 self
8654 }
8655
8656 /// Removes all scopes, and no default scope will be used either.
8657 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8658 /// for details).
8659 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationRunListCall<'a, C> {
8660 self._scopes.clear();
8661 self
8662 }
8663}
8664
8665/// Creates a new Automation in a given project and location.
8666///
8667/// A builder for the *locations.deliveryPipelines.automations.create* method supported by a *project* resource.
8668/// It is not used directly, but through a [`ProjectMethods`] instance.
8669///
8670/// # Example
8671///
8672/// Instantiate a resource method builder
8673///
8674/// ```test_harness,no_run
8675/// # extern crate hyper;
8676/// # extern crate hyper_rustls;
8677/// # extern crate google_clouddeploy1 as clouddeploy1;
8678/// use clouddeploy1::api::Automation;
8679/// # async fn dox() {
8680/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8681///
8682/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8683/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8684/// # .with_native_roots()
8685/// # .unwrap()
8686/// # .https_only()
8687/// # .enable_http2()
8688/// # .build();
8689///
8690/// # let executor = hyper_util::rt::TokioExecutor::new();
8691/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8692/// # secret,
8693/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8694/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8695/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8696/// # ),
8697/// # ).build().await.unwrap();
8698///
8699/// # let client = hyper_util::client::legacy::Client::builder(
8700/// # hyper_util::rt::TokioExecutor::new()
8701/// # )
8702/// # .build(
8703/// # hyper_rustls::HttpsConnectorBuilder::new()
8704/// # .with_native_roots()
8705/// # .unwrap()
8706/// # .https_or_http()
8707/// # .enable_http2()
8708/// # .build()
8709/// # );
8710/// # let mut hub = CloudDeploy::new(client, auth);
8711/// // As the method needs a request, you would usually fill it with the desired information
8712/// // into the respective structure. Some of the parts shown here might not be applicable !
8713/// // Values shown here are possibly random and not representative !
8714/// let mut req = Automation::default();
8715///
8716/// // You can configure optional parameters by calling the respective setters at will, and
8717/// // execute the final call using `doit()`.
8718/// // Values shown here are possibly random and not representative !
8719/// let result = hub.projects().locations_delivery_pipelines_automations_create(req, "parent")
8720/// .validate_only(false)
8721/// .request_id("dolor")
8722/// .automation_id("et")
8723/// .doit().await;
8724/// # }
8725/// ```
8726pub struct ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
8727where
8728 C: 'a,
8729{
8730 hub: &'a CloudDeploy<C>,
8731 _request: Automation,
8732 _parent: String,
8733 _validate_only: Option<bool>,
8734 _request_id: Option<String>,
8735 _automation_id: Option<String>,
8736 _delegate: Option<&'a mut dyn common::Delegate>,
8737 _additional_params: HashMap<String, String>,
8738 _scopes: BTreeSet<String>,
8739}
8740
8741impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {}
8742
8743impl<'a, C> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
8744where
8745 C: common::Connector,
8746{
8747 /// Perform the operation you have build so far.
8748 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8749 use std::borrow::Cow;
8750 use std::io::{Read, Seek};
8751
8752 use common::{url::Params, ToParts};
8753 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8754
8755 let mut dd = common::DefaultDelegate;
8756 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8757 dlg.begin(common::MethodInfo {
8758 id: "clouddeploy.projects.locations.deliveryPipelines.automations.create",
8759 http_method: hyper::Method::POST,
8760 });
8761
8762 for &field in ["alt", "parent", "validateOnly", "requestId", "automationId"].iter() {
8763 if self._additional_params.contains_key(field) {
8764 dlg.finished(false);
8765 return Err(common::Error::FieldClash(field));
8766 }
8767 }
8768
8769 let mut params = Params::with_capacity(7 + self._additional_params.len());
8770 params.push("parent", self._parent);
8771 if let Some(value) = self._validate_only.as_ref() {
8772 params.push("validateOnly", value.to_string());
8773 }
8774 if let Some(value) = self._request_id.as_ref() {
8775 params.push("requestId", value);
8776 }
8777 if let Some(value) = self._automation_id.as_ref() {
8778 params.push("automationId", value);
8779 }
8780
8781 params.extend(self._additional_params.iter());
8782
8783 params.push("alt", "json");
8784 let mut url = self.hub._base_url.clone() + "v1/{+parent}/automations";
8785 if self._scopes.is_empty() {
8786 self._scopes
8787 .insert(Scope::CloudPlatform.as_ref().to_string());
8788 }
8789
8790 #[allow(clippy::single_element_loop)]
8791 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8792 url = params.uri_replacement(url, param_name, find_this, true);
8793 }
8794 {
8795 let to_remove = ["parent"];
8796 params.remove_params(&to_remove);
8797 }
8798
8799 let url = params.parse_with_url(&url);
8800
8801 let mut json_mime_type = mime::APPLICATION_JSON;
8802 let mut request_value_reader = {
8803 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8804 common::remove_json_null_values(&mut value);
8805 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8806 serde_json::to_writer(&mut dst, &value).unwrap();
8807 dst
8808 };
8809 let request_size = request_value_reader
8810 .seek(std::io::SeekFrom::End(0))
8811 .unwrap();
8812 request_value_reader
8813 .seek(std::io::SeekFrom::Start(0))
8814 .unwrap();
8815
8816 loop {
8817 let token = match self
8818 .hub
8819 .auth
8820 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8821 .await
8822 {
8823 Ok(token) => token,
8824 Err(e) => match dlg.token(e) {
8825 Ok(token) => token,
8826 Err(e) => {
8827 dlg.finished(false);
8828 return Err(common::Error::MissingToken(e));
8829 }
8830 },
8831 };
8832 request_value_reader
8833 .seek(std::io::SeekFrom::Start(0))
8834 .unwrap();
8835 let mut req_result = {
8836 let client = &self.hub.client;
8837 dlg.pre_request();
8838 let mut req_builder = hyper::Request::builder()
8839 .method(hyper::Method::POST)
8840 .uri(url.as_str())
8841 .header(USER_AGENT, self.hub._user_agent.clone());
8842
8843 if let Some(token) = token.as_ref() {
8844 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8845 }
8846
8847 let request = req_builder
8848 .header(CONTENT_TYPE, json_mime_type.to_string())
8849 .header(CONTENT_LENGTH, request_size as u64)
8850 .body(common::to_body(
8851 request_value_reader.get_ref().clone().into(),
8852 ));
8853
8854 client.request(request.unwrap()).await
8855 };
8856
8857 match req_result {
8858 Err(err) => {
8859 if let common::Retry::After(d) = dlg.http_error(&err) {
8860 sleep(d).await;
8861 continue;
8862 }
8863 dlg.finished(false);
8864 return Err(common::Error::HttpError(err));
8865 }
8866 Ok(res) => {
8867 let (mut parts, body) = res.into_parts();
8868 let mut body = common::Body::new(body);
8869 if !parts.status.is_success() {
8870 let bytes = common::to_bytes(body).await.unwrap_or_default();
8871 let error = serde_json::from_str(&common::to_string(&bytes));
8872 let response = common::to_response(parts, bytes.into());
8873
8874 if let common::Retry::After(d) =
8875 dlg.http_failure(&response, error.as_ref().ok())
8876 {
8877 sleep(d).await;
8878 continue;
8879 }
8880
8881 dlg.finished(false);
8882
8883 return Err(match error {
8884 Ok(value) => common::Error::BadRequest(value),
8885 _ => common::Error::Failure(response),
8886 });
8887 }
8888 let response = {
8889 let bytes = common::to_bytes(body).await.unwrap_or_default();
8890 let encoded = common::to_string(&bytes);
8891 match serde_json::from_str(&encoded) {
8892 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8893 Err(error) => {
8894 dlg.response_json_decode_error(&encoded, &error);
8895 return Err(common::Error::JsonDecodeError(
8896 encoded.to_string(),
8897 error,
8898 ));
8899 }
8900 }
8901 };
8902
8903 dlg.finished(true);
8904 return Ok(response);
8905 }
8906 }
8907 }
8908 }
8909
8910 ///
8911 /// Sets the *request* property to the given value.
8912 ///
8913 /// Even though the property as already been set when instantiating this call,
8914 /// we provide this method for API completeness.
8915 pub fn request(
8916 mut self,
8917 new_value: Automation,
8918 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8919 self._request = new_value;
8920 self
8921 }
8922 /// Required. The parent collection in which the `Automation` must be created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
8923 ///
8924 /// Sets the *parent* path property to the given value.
8925 ///
8926 /// Even though the property as already been set when instantiating this call,
8927 /// we provide this method for API completeness.
8928 pub fn parent(
8929 mut self,
8930 new_value: &str,
8931 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8932 self._parent = new_value.to_string();
8933 self
8934 }
8935 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
8936 ///
8937 /// Sets the *validate only* query property to the given value.
8938 pub fn validate_only(
8939 mut self,
8940 new_value: bool,
8941 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8942 self._validate_only = Some(new_value);
8943 self
8944 }
8945 /// 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).
8946 ///
8947 /// Sets the *request id* query property to the given value.
8948 pub fn request_id(
8949 mut self,
8950 new_value: &str,
8951 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8952 self._request_id = Some(new_value.to_string());
8953 self
8954 }
8955 /// Required. ID of the `Automation`.
8956 ///
8957 /// Sets the *automation id* query property to the given value.
8958 pub fn automation_id(
8959 mut self,
8960 new_value: &str,
8961 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8962 self._automation_id = Some(new_value.to_string());
8963 self
8964 }
8965 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8966 /// while executing the actual API request.
8967 ///
8968 /// ````text
8969 /// It should be used to handle progress information, and to implement a certain level of resilience.
8970 /// ````
8971 ///
8972 /// Sets the *delegate* property to the given value.
8973 pub fn delegate(
8974 mut self,
8975 new_value: &'a mut dyn common::Delegate,
8976 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
8977 self._delegate = Some(new_value);
8978 self
8979 }
8980
8981 /// Set any additional parameter of the query string used in the request.
8982 /// It should be used to set parameters which are not yet available through their own
8983 /// setters.
8984 ///
8985 /// Please note that this method must not be used to set any of the known parameters
8986 /// which have their own setter method. If done anyway, the request will fail.
8987 ///
8988 /// # Additional Parameters
8989 ///
8990 /// * *$.xgafv* (query-string) - V1 error format.
8991 /// * *access_token* (query-string) - OAuth access token.
8992 /// * *alt* (query-string) - Data format for response.
8993 /// * *callback* (query-string) - JSONP
8994 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8995 /// * *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.
8996 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8997 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8998 /// * *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.
8999 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9000 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9001 pub fn param<T>(
9002 mut self,
9003 name: T,
9004 value: T,
9005 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
9006 where
9007 T: AsRef<str>,
9008 {
9009 self._additional_params
9010 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9011 self
9012 }
9013
9014 /// Identifies the authorization scope for the method you are building.
9015 ///
9016 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9017 /// [`Scope::CloudPlatform`].
9018 ///
9019 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9020 /// tokens for more than one scope.
9021 ///
9022 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9023 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9024 /// sufficient, a read-write scope will do as well.
9025 pub fn add_scope<St>(
9026 mut self,
9027 scope: St,
9028 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
9029 where
9030 St: AsRef<str>,
9031 {
9032 self._scopes.insert(String::from(scope.as_ref()));
9033 self
9034 }
9035 /// Identifies the authorization scope(s) for the method you are building.
9036 ///
9037 /// See [`Self::add_scope()`] for details.
9038 pub fn add_scopes<I, St>(
9039 mut self,
9040 scopes: I,
9041 ) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C>
9042 where
9043 I: IntoIterator<Item = St>,
9044 St: AsRef<str>,
9045 {
9046 self._scopes
9047 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9048 self
9049 }
9050
9051 /// Removes all scopes, and no default scope will be used either.
9052 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9053 /// for details).
9054 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationCreateCall<'a, C> {
9055 self._scopes.clear();
9056 self
9057 }
9058}
9059
9060/// Deletes a single Automation resource.
9061///
9062/// A builder for the *locations.deliveryPipelines.automations.delete* method supported by a *project* resource.
9063/// It is not used directly, but through a [`ProjectMethods`] instance.
9064///
9065/// # Example
9066///
9067/// Instantiate a resource method builder
9068///
9069/// ```test_harness,no_run
9070/// # extern crate hyper;
9071/// # extern crate hyper_rustls;
9072/// # extern crate google_clouddeploy1 as clouddeploy1;
9073/// # async fn dox() {
9074/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9075///
9076/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9077/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9078/// # .with_native_roots()
9079/// # .unwrap()
9080/// # .https_only()
9081/// # .enable_http2()
9082/// # .build();
9083///
9084/// # let executor = hyper_util::rt::TokioExecutor::new();
9085/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9086/// # secret,
9087/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9088/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9089/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9090/// # ),
9091/// # ).build().await.unwrap();
9092///
9093/// # let client = hyper_util::client::legacy::Client::builder(
9094/// # hyper_util::rt::TokioExecutor::new()
9095/// # )
9096/// # .build(
9097/// # hyper_rustls::HttpsConnectorBuilder::new()
9098/// # .with_native_roots()
9099/// # .unwrap()
9100/// # .https_or_http()
9101/// # .enable_http2()
9102/// # .build()
9103/// # );
9104/// # let mut hub = CloudDeploy::new(client, auth);
9105/// // You can configure optional parameters by calling the respective setters at will, and
9106/// // execute the final call using `doit()`.
9107/// // Values shown here are possibly random and not representative !
9108/// let result = hub.projects().locations_delivery_pipelines_automations_delete("name")
9109/// .validate_only(false)
9110/// .request_id("Stet")
9111/// .etag("dolor")
9112/// .allow_missing(false)
9113/// .doit().await;
9114/// # }
9115/// ```
9116pub struct ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
9117where
9118 C: 'a,
9119{
9120 hub: &'a CloudDeploy<C>,
9121 _name: String,
9122 _validate_only: Option<bool>,
9123 _request_id: Option<String>,
9124 _etag: Option<String>,
9125 _allow_missing: Option<bool>,
9126 _delegate: Option<&'a mut dyn common::Delegate>,
9127 _additional_params: HashMap<String, String>,
9128 _scopes: BTreeSet<String>,
9129}
9130
9131impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {}
9132
9133impl<'a, C> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
9134where
9135 C: common::Connector,
9136{
9137 /// Perform the operation you have build so far.
9138 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9139 use std::borrow::Cow;
9140 use std::io::{Read, Seek};
9141
9142 use common::{url::Params, ToParts};
9143 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9144
9145 let mut dd = common::DefaultDelegate;
9146 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9147 dlg.begin(common::MethodInfo {
9148 id: "clouddeploy.projects.locations.deliveryPipelines.automations.delete",
9149 http_method: hyper::Method::DELETE,
9150 });
9151
9152 for &field in [
9153 "alt",
9154 "name",
9155 "validateOnly",
9156 "requestId",
9157 "etag",
9158 "allowMissing",
9159 ]
9160 .iter()
9161 {
9162 if self._additional_params.contains_key(field) {
9163 dlg.finished(false);
9164 return Err(common::Error::FieldClash(field));
9165 }
9166 }
9167
9168 let mut params = Params::with_capacity(7 + self._additional_params.len());
9169 params.push("name", self._name);
9170 if let Some(value) = self._validate_only.as_ref() {
9171 params.push("validateOnly", value.to_string());
9172 }
9173 if let Some(value) = self._request_id.as_ref() {
9174 params.push("requestId", value);
9175 }
9176 if let Some(value) = self._etag.as_ref() {
9177 params.push("etag", value);
9178 }
9179 if let Some(value) = self._allow_missing.as_ref() {
9180 params.push("allowMissing", value.to_string());
9181 }
9182
9183 params.extend(self._additional_params.iter());
9184
9185 params.push("alt", "json");
9186 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9187 if self._scopes.is_empty() {
9188 self._scopes
9189 .insert(Scope::CloudPlatform.as_ref().to_string());
9190 }
9191
9192 #[allow(clippy::single_element_loop)]
9193 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9194 url = params.uri_replacement(url, param_name, find_this, true);
9195 }
9196 {
9197 let to_remove = ["name"];
9198 params.remove_params(&to_remove);
9199 }
9200
9201 let url = params.parse_with_url(&url);
9202
9203 loop {
9204 let token = match self
9205 .hub
9206 .auth
9207 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9208 .await
9209 {
9210 Ok(token) => token,
9211 Err(e) => match dlg.token(e) {
9212 Ok(token) => token,
9213 Err(e) => {
9214 dlg.finished(false);
9215 return Err(common::Error::MissingToken(e));
9216 }
9217 },
9218 };
9219 let mut req_result = {
9220 let client = &self.hub.client;
9221 dlg.pre_request();
9222 let mut req_builder = hyper::Request::builder()
9223 .method(hyper::Method::DELETE)
9224 .uri(url.as_str())
9225 .header(USER_AGENT, self.hub._user_agent.clone());
9226
9227 if let Some(token) = token.as_ref() {
9228 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9229 }
9230
9231 let request = req_builder
9232 .header(CONTENT_LENGTH, 0_u64)
9233 .body(common::to_body::<String>(None));
9234
9235 client.request(request.unwrap()).await
9236 };
9237
9238 match req_result {
9239 Err(err) => {
9240 if let common::Retry::After(d) = dlg.http_error(&err) {
9241 sleep(d).await;
9242 continue;
9243 }
9244 dlg.finished(false);
9245 return Err(common::Error::HttpError(err));
9246 }
9247 Ok(res) => {
9248 let (mut parts, body) = res.into_parts();
9249 let mut body = common::Body::new(body);
9250 if !parts.status.is_success() {
9251 let bytes = common::to_bytes(body).await.unwrap_or_default();
9252 let error = serde_json::from_str(&common::to_string(&bytes));
9253 let response = common::to_response(parts, bytes.into());
9254
9255 if let common::Retry::After(d) =
9256 dlg.http_failure(&response, error.as_ref().ok())
9257 {
9258 sleep(d).await;
9259 continue;
9260 }
9261
9262 dlg.finished(false);
9263
9264 return Err(match error {
9265 Ok(value) => common::Error::BadRequest(value),
9266 _ => common::Error::Failure(response),
9267 });
9268 }
9269 let response = {
9270 let bytes = common::to_bytes(body).await.unwrap_or_default();
9271 let encoded = common::to_string(&bytes);
9272 match serde_json::from_str(&encoded) {
9273 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9274 Err(error) => {
9275 dlg.response_json_decode_error(&encoded, &error);
9276 return Err(common::Error::JsonDecodeError(
9277 encoded.to_string(),
9278 error,
9279 ));
9280 }
9281 }
9282 };
9283
9284 dlg.finished(true);
9285 return Ok(response);
9286 }
9287 }
9288 }
9289 }
9290
9291 /// Required. The name of the `Automation` to delete. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
9292 ///
9293 /// Sets the *name* path property to the given value.
9294 ///
9295 /// Even though the property as already been set when instantiating this call,
9296 /// we provide this method for API completeness.
9297 pub fn name(
9298 mut self,
9299 new_value: &str,
9300 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
9301 self._name = new_value.to_string();
9302 self
9303 }
9304 /// Optional. If set, validate the request and verify whether the resource exists, but do not actually post it.
9305 ///
9306 /// Sets the *validate only* query property to the given value.
9307 pub fn validate_only(
9308 mut self,
9309 new_value: bool,
9310 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
9311 self._validate_only = Some(new_value);
9312 self
9313 }
9314 /// 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).
9315 ///
9316 /// Sets the *request id* query property to the given value.
9317 pub fn request_id(
9318 mut self,
9319 new_value: &str,
9320 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
9321 self._request_id = Some(new_value.to_string());
9322 self
9323 }
9324 /// 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.
9325 ///
9326 /// Sets the *etag* query property to the given value.
9327 pub fn etag(
9328 mut self,
9329 new_value: &str,
9330 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
9331 self._etag = Some(new_value.to_string());
9332 self
9333 }
9334 /// Optional. If set to true, then deleting an already deleted or non-existing `Automation` will succeed.
9335 ///
9336 /// Sets the *allow missing* query property to the given value.
9337 pub fn allow_missing(
9338 mut self,
9339 new_value: bool,
9340 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
9341 self._allow_missing = Some(new_value);
9342 self
9343 }
9344 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9345 /// while executing the actual API request.
9346 ///
9347 /// ````text
9348 /// It should be used to handle progress information, and to implement a certain level of resilience.
9349 /// ````
9350 ///
9351 /// Sets the *delegate* property to the given value.
9352 pub fn delegate(
9353 mut self,
9354 new_value: &'a mut dyn common::Delegate,
9355 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
9356 self._delegate = Some(new_value);
9357 self
9358 }
9359
9360 /// Set any additional parameter of the query string used in the request.
9361 /// It should be used to set parameters which are not yet available through their own
9362 /// setters.
9363 ///
9364 /// Please note that this method must not be used to set any of the known parameters
9365 /// which have their own setter method. If done anyway, the request will fail.
9366 ///
9367 /// # Additional Parameters
9368 ///
9369 /// * *$.xgafv* (query-string) - V1 error format.
9370 /// * *access_token* (query-string) - OAuth access token.
9371 /// * *alt* (query-string) - Data format for response.
9372 /// * *callback* (query-string) - JSONP
9373 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9374 /// * *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.
9375 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9376 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9377 /// * *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.
9378 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9379 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9380 pub fn param<T>(
9381 mut self,
9382 name: T,
9383 value: T,
9384 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
9385 where
9386 T: AsRef<str>,
9387 {
9388 self._additional_params
9389 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9390 self
9391 }
9392
9393 /// Identifies the authorization scope for the method you are building.
9394 ///
9395 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9396 /// [`Scope::CloudPlatform`].
9397 ///
9398 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9399 /// tokens for more than one scope.
9400 ///
9401 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9402 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9403 /// sufficient, a read-write scope will do as well.
9404 pub fn add_scope<St>(
9405 mut self,
9406 scope: St,
9407 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
9408 where
9409 St: AsRef<str>,
9410 {
9411 self._scopes.insert(String::from(scope.as_ref()));
9412 self
9413 }
9414 /// Identifies the authorization scope(s) for the method you are building.
9415 ///
9416 /// See [`Self::add_scope()`] for details.
9417 pub fn add_scopes<I, St>(
9418 mut self,
9419 scopes: I,
9420 ) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C>
9421 where
9422 I: IntoIterator<Item = St>,
9423 St: AsRef<str>,
9424 {
9425 self._scopes
9426 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9427 self
9428 }
9429
9430 /// Removes all scopes, and no default scope will be used either.
9431 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9432 /// for details).
9433 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationDeleteCall<'a, C> {
9434 self._scopes.clear();
9435 self
9436 }
9437}
9438
9439/// Gets details of a single Automation.
9440///
9441/// A builder for the *locations.deliveryPipelines.automations.get* method supported by a *project* resource.
9442/// It is not used directly, but through a [`ProjectMethods`] instance.
9443///
9444/// # Example
9445///
9446/// Instantiate a resource method builder
9447///
9448/// ```test_harness,no_run
9449/// # extern crate hyper;
9450/// # extern crate hyper_rustls;
9451/// # extern crate google_clouddeploy1 as clouddeploy1;
9452/// # async fn dox() {
9453/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9454///
9455/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9456/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9457/// # .with_native_roots()
9458/// # .unwrap()
9459/// # .https_only()
9460/// # .enable_http2()
9461/// # .build();
9462///
9463/// # let executor = hyper_util::rt::TokioExecutor::new();
9464/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9465/// # secret,
9466/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9467/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9468/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9469/// # ),
9470/// # ).build().await.unwrap();
9471///
9472/// # let client = hyper_util::client::legacy::Client::builder(
9473/// # hyper_util::rt::TokioExecutor::new()
9474/// # )
9475/// # .build(
9476/// # hyper_rustls::HttpsConnectorBuilder::new()
9477/// # .with_native_roots()
9478/// # .unwrap()
9479/// # .https_or_http()
9480/// # .enable_http2()
9481/// # .build()
9482/// # );
9483/// # let mut hub = CloudDeploy::new(client, auth);
9484/// // You can configure optional parameters by calling the respective setters at will, and
9485/// // execute the final call using `doit()`.
9486/// // Values shown here are possibly random and not representative !
9487/// let result = hub.projects().locations_delivery_pipelines_automations_get("name")
9488/// .doit().await;
9489/// # }
9490/// ```
9491pub struct ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
9492where
9493 C: 'a,
9494{
9495 hub: &'a CloudDeploy<C>,
9496 _name: String,
9497 _delegate: Option<&'a mut dyn common::Delegate>,
9498 _additional_params: HashMap<String, String>,
9499 _scopes: BTreeSet<String>,
9500}
9501
9502impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {}
9503
9504impl<'a, C> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
9505where
9506 C: common::Connector,
9507{
9508 /// Perform the operation you have build so far.
9509 pub async fn doit(mut self) -> common::Result<(common::Response, Automation)> {
9510 use std::borrow::Cow;
9511 use std::io::{Read, Seek};
9512
9513 use common::{url::Params, ToParts};
9514 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9515
9516 let mut dd = common::DefaultDelegate;
9517 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9518 dlg.begin(common::MethodInfo {
9519 id: "clouddeploy.projects.locations.deliveryPipelines.automations.get",
9520 http_method: hyper::Method::GET,
9521 });
9522
9523 for &field in ["alt", "name"].iter() {
9524 if self._additional_params.contains_key(field) {
9525 dlg.finished(false);
9526 return Err(common::Error::FieldClash(field));
9527 }
9528 }
9529
9530 let mut params = Params::with_capacity(3 + self._additional_params.len());
9531 params.push("name", self._name);
9532
9533 params.extend(self._additional_params.iter());
9534
9535 params.push("alt", "json");
9536 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9537 if self._scopes.is_empty() {
9538 self._scopes
9539 .insert(Scope::CloudPlatform.as_ref().to_string());
9540 }
9541
9542 #[allow(clippy::single_element_loop)]
9543 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9544 url = params.uri_replacement(url, param_name, find_this, true);
9545 }
9546 {
9547 let to_remove = ["name"];
9548 params.remove_params(&to_remove);
9549 }
9550
9551 let url = params.parse_with_url(&url);
9552
9553 loop {
9554 let token = match self
9555 .hub
9556 .auth
9557 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9558 .await
9559 {
9560 Ok(token) => token,
9561 Err(e) => match dlg.token(e) {
9562 Ok(token) => token,
9563 Err(e) => {
9564 dlg.finished(false);
9565 return Err(common::Error::MissingToken(e));
9566 }
9567 },
9568 };
9569 let mut req_result = {
9570 let client = &self.hub.client;
9571 dlg.pre_request();
9572 let mut req_builder = hyper::Request::builder()
9573 .method(hyper::Method::GET)
9574 .uri(url.as_str())
9575 .header(USER_AGENT, self.hub._user_agent.clone());
9576
9577 if let Some(token) = token.as_ref() {
9578 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9579 }
9580
9581 let request = req_builder
9582 .header(CONTENT_LENGTH, 0_u64)
9583 .body(common::to_body::<String>(None));
9584
9585 client.request(request.unwrap()).await
9586 };
9587
9588 match req_result {
9589 Err(err) => {
9590 if let common::Retry::After(d) = dlg.http_error(&err) {
9591 sleep(d).await;
9592 continue;
9593 }
9594 dlg.finished(false);
9595 return Err(common::Error::HttpError(err));
9596 }
9597 Ok(res) => {
9598 let (mut parts, body) = res.into_parts();
9599 let mut body = common::Body::new(body);
9600 if !parts.status.is_success() {
9601 let bytes = common::to_bytes(body).await.unwrap_or_default();
9602 let error = serde_json::from_str(&common::to_string(&bytes));
9603 let response = common::to_response(parts, bytes.into());
9604
9605 if let common::Retry::After(d) =
9606 dlg.http_failure(&response, error.as_ref().ok())
9607 {
9608 sleep(d).await;
9609 continue;
9610 }
9611
9612 dlg.finished(false);
9613
9614 return Err(match error {
9615 Ok(value) => common::Error::BadRequest(value),
9616 _ => common::Error::Failure(response),
9617 });
9618 }
9619 let response = {
9620 let bytes = common::to_bytes(body).await.unwrap_or_default();
9621 let encoded = common::to_string(&bytes);
9622 match serde_json::from_str(&encoded) {
9623 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9624 Err(error) => {
9625 dlg.response_json_decode_error(&encoded, &error);
9626 return Err(common::Error::JsonDecodeError(
9627 encoded.to_string(),
9628 error,
9629 ));
9630 }
9631 }
9632 };
9633
9634 dlg.finished(true);
9635 return Ok(response);
9636 }
9637 }
9638 }
9639 }
9640
9641 /// Required. Name of the `Automation`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/automations/{automation_name}`.
9642 ///
9643 /// Sets the *name* path property to the given value.
9644 ///
9645 /// Even though the property as already been set when instantiating this call,
9646 /// we provide this method for API completeness.
9647 pub fn name(
9648 mut self,
9649 new_value: &str,
9650 ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
9651 self._name = new_value.to_string();
9652 self
9653 }
9654 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9655 /// while executing the actual API request.
9656 ///
9657 /// ````text
9658 /// It should be used to handle progress information, and to implement a certain level of resilience.
9659 /// ````
9660 ///
9661 /// Sets the *delegate* property to the given value.
9662 pub fn delegate(
9663 mut self,
9664 new_value: &'a mut dyn common::Delegate,
9665 ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
9666 self._delegate = Some(new_value);
9667 self
9668 }
9669
9670 /// Set any additional parameter of the query string used in the request.
9671 /// It should be used to set parameters which are not yet available through their own
9672 /// setters.
9673 ///
9674 /// Please note that this method must not be used to set any of the known parameters
9675 /// which have their own setter method. If done anyway, the request will fail.
9676 ///
9677 /// # Additional Parameters
9678 ///
9679 /// * *$.xgafv* (query-string) - V1 error format.
9680 /// * *access_token* (query-string) - OAuth access token.
9681 /// * *alt* (query-string) - Data format for response.
9682 /// * *callback* (query-string) - JSONP
9683 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9684 /// * *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.
9685 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9686 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9687 /// * *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.
9688 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9689 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9690 pub fn param<T>(
9691 mut self,
9692 name: T,
9693 value: T,
9694 ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
9695 where
9696 T: AsRef<str>,
9697 {
9698 self._additional_params
9699 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9700 self
9701 }
9702
9703 /// Identifies the authorization scope for the method you are building.
9704 ///
9705 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9706 /// [`Scope::CloudPlatform`].
9707 ///
9708 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9709 /// tokens for more than one scope.
9710 ///
9711 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9712 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9713 /// sufficient, a read-write scope will do as well.
9714 pub fn add_scope<St>(
9715 mut self,
9716 scope: St,
9717 ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
9718 where
9719 St: AsRef<str>,
9720 {
9721 self._scopes.insert(String::from(scope.as_ref()));
9722 self
9723 }
9724 /// Identifies the authorization scope(s) for the method you are building.
9725 ///
9726 /// See [`Self::add_scope()`] for details.
9727 pub fn add_scopes<I, St>(
9728 mut self,
9729 scopes: I,
9730 ) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C>
9731 where
9732 I: IntoIterator<Item = St>,
9733 St: AsRef<str>,
9734 {
9735 self._scopes
9736 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9737 self
9738 }
9739
9740 /// Removes all scopes, and no default scope will be used either.
9741 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9742 /// for details).
9743 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationGetCall<'a, C> {
9744 self._scopes.clear();
9745 self
9746 }
9747}
9748
9749/// Lists Automations in a given project and location.
9750///
9751/// A builder for the *locations.deliveryPipelines.automations.list* method supported by a *project* resource.
9752/// It is not used directly, but through a [`ProjectMethods`] instance.
9753///
9754/// # Example
9755///
9756/// Instantiate a resource method builder
9757///
9758/// ```test_harness,no_run
9759/// # extern crate hyper;
9760/// # extern crate hyper_rustls;
9761/// # extern crate google_clouddeploy1 as clouddeploy1;
9762/// # async fn dox() {
9763/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9764///
9765/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9766/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9767/// # .with_native_roots()
9768/// # .unwrap()
9769/// # .https_only()
9770/// # .enable_http2()
9771/// # .build();
9772///
9773/// # let executor = hyper_util::rt::TokioExecutor::new();
9774/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9775/// # secret,
9776/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9777/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9778/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9779/// # ),
9780/// # ).build().await.unwrap();
9781///
9782/// # let client = hyper_util::client::legacy::Client::builder(
9783/// # hyper_util::rt::TokioExecutor::new()
9784/// # )
9785/// # .build(
9786/// # hyper_rustls::HttpsConnectorBuilder::new()
9787/// # .with_native_roots()
9788/// # .unwrap()
9789/// # .https_or_http()
9790/// # .enable_http2()
9791/// # .build()
9792/// # );
9793/// # let mut hub = CloudDeploy::new(client, auth);
9794/// // You can configure optional parameters by calling the respective setters at will, and
9795/// // execute the final call using `doit()`.
9796/// // Values shown here are possibly random and not representative !
9797/// let result = hub.projects().locations_delivery_pipelines_automations_list("parent")
9798/// .page_token("Stet")
9799/// .page_size(-76)
9800/// .order_by("elitr")
9801/// .filter("Lorem")
9802/// .doit().await;
9803/// # }
9804/// ```
9805pub struct ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
9806where
9807 C: 'a,
9808{
9809 hub: &'a CloudDeploy<C>,
9810 _parent: String,
9811 _page_token: Option<String>,
9812 _page_size: Option<i32>,
9813 _order_by: Option<String>,
9814 _filter: Option<String>,
9815 _delegate: Option<&'a mut dyn common::Delegate>,
9816 _additional_params: HashMap<String, String>,
9817 _scopes: BTreeSet<String>,
9818}
9819
9820impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {}
9821
9822impl<'a, C> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
9823where
9824 C: common::Connector,
9825{
9826 /// Perform the operation you have build so far.
9827 pub async fn doit(mut self) -> common::Result<(common::Response, ListAutomationsResponse)> {
9828 use std::borrow::Cow;
9829 use std::io::{Read, Seek};
9830
9831 use common::{url::Params, ToParts};
9832 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9833
9834 let mut dd = common::DefaultDelegate;
9835 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9836 dlg.begin(common::MethodInfo {
9837 id: "clouddeploy.projects.locations.deliveryPipelines.automations.list",
9838 http_method: hyper::Method::GET,
9839 });
9840
9841 for &field in [
9842 "alt",
9843 "parent",
9844 "pageToken",
9845 "pageSize",
9846 "orderBy",
9847 "filter",
9848 ]
9849 .iter()
9850 {
9851 if self._additional_params.contains_key(field) {
9852 dlg.finished(false);
9853 return Err(common::Error::FieldClash(field));
9854 }
9855 }
9856
9857 let mut params = Params::with_capacity(7 + self._additional_params.len());
9858 params.push("parent", self._parent);
9859 if let Some(value) = self._page_token.as_ref() {
9860 params.push("pageToken", value);
9861 }
9862 if let Some(value) = self._page_size.as_ref() {
9863 params.push("pageSize", value.to_string());
9864 }
9865 if let Some(value) = self._order_by.as_ref() {
9866 params.push("orderBy", value);
9867 }
9868 if let Some(value) = self._filter.as_ref() {
9869 params.push("filter", value);
9870 }
9871
9872 params.extend(self._additional_params.iter());
9873
9874 params.push("alt", "json");
9875 let mut url = self.hub._base_url.clone() + "v1/{+parent}/automations";
9876 if self._scopes.is_empty() {
9877 self._scopes
9878 .insert(Scope::CloudPlatform.as_ref().to_string());
9879 }
9880
9881 #[allow(clippy::single_element_loop)]
9882 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9883 url = params.uri_replacement(url, param_name, find_this, true);
9884 }
9885 {
9886 let to_remove = ["parent"];
9887 params.remove_params(&to_remove);
9888 }
9889
9890 let url = params.parse_with_url(&url);
9891
9892 loop {
9893 let token = match self
9894 .hub
9895 .auth
9896 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9897 .await
9898 {
9899 Ok(token) => token,
9900 Err(e) => match dlg.token(e) {
9901 Ok(token) => token,
9902 Err(e) => {
9903 dlg.finished(false);
9904 return Err(common::Error::MissingToken(e));
9905 }
9906 },
9907 };
9908 let mut req_result = {
9909 let client = &self.hub.client;
9910 dlg.pre_request();
9911 let mut req_builder = hyper::Request::builder()
9912 .method(hyper::Method::GET)
9913 .uri(url.as_str())
9914 .header(USER_AGENT, self.hub._user_agent.clone());
9915
9916 if let Some(token) = token.as_ref() {
9917 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9918 }
9919
9920 let request = req_builder
9921 .header(CONTENT_LENGTH, 0_u64)
9922 .body(common::to_body::<String>(None));
9923
9924 client.request(request.unwrap()).await
9925 };
9926
9927 match req_result {
9928 Err(err) => {
9929 if let common::Retry::After(d) = dlg.http_error(&err) {
9930 sleep(d).await;
9931 continue;
9932 }
9933 dlg.finished(false);
9934 return Err(common::Error::HttpError(err));
9935 }
9936 Ok(res) => {
9937 let (mut parts, body) = res.into_parts();
9938 let mut body = common::Body::new(body);
9939 if !parts.status.is_success() {
9940 let bytes = common::to_bytes(body).await.unwrap_or_default();
9941 let error = serde_json::from_str(&common::to_string(&bytes));
9942 let response = common::to_response(parts, bytes.into());
9943
9944 if let common::Retry::After(d) =
9945 dlg.http_failure(&response, error.as_ref().ok())
9946 {
9947 sleep(d).await;
9948 continue;
9949 }
9950
9951 dlg.finished(false);
9952
9953 return Err(match error {
9954 Ok(value) => common::Error::BadRequest(value),
9955 _ => common::Error::Failure(response),
9956 });
9957 }
9958 let response = {
9959 let bytes = common::to_bytes(body).await.unwrap_or_default();
9960 let encoded = common::to_string(&bytes);
9961 match serde_json::from_str(&encoded) {
9962 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9963 Err(error) => {
9964 dlg.response_json_decode_error(&encoded, &error);
9965 return Err(common::Error::JsonDecodeError(
9966 encoded.to_string(),
9967 error,
9968 ));
9969 }
9970 }
9971 };
9972
9973 dlg.finished(true);
9974 return Ok(response);
9975 }
9976 }
9977 }
9978 }
9979
9980 /// Required. The parent `Delivery Pipeline`, which owns this collection of automations. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
9981 ///
9982 /// Sets the *parent* path property to the given value.
9983 ///
9984 /// Even though the property as already been set when instantiating this call,
9985 /// we provide this method for API completeness.
9986 pub fn parent(
9987 mut self,
9988 new_value: &str,
9989 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
9990 self._parent = new_value.to_string();
9991 self
9992 }
9993 /// 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.
9994 ///
9995 /// Sets the *page token* query property to the given value.
9996 pub fn page_token(
9997 mut self,
9998 new_value: &str,
9999 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
10000 self._page_token = Some(new_value.to_string());
10001 self
10002 }
10003 /// 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.
10004 ///
10005 /// Sets the *page size* query property to the given value.
10006 pub fn page_size(
10007 mut self,
10008 new_value: i32,
10009 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
10010 self._page_size = Some(new_value);
10011 self
10012 }
10013 /// Field to sort by.
10014 ///
10015 /// Sets the *order by* query property to the given value.
10016 pub fn order_by(
10017 mut self,
10018 new_value: &str,
10019 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
10020 self._order_by = Some(new_value.to_string());
10021 self
10022 }
10023 /// Filter automations to be returned. All fields can be used in the filter.
10024 ///
10025 /// Sets the *filter* query property to the given value.
10026 pub fn filter(
10027 mut self,
10028 new_value: &str,
10029 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
10030 self._filter = Some(new_value.to_string());
10031 self
10032 }
10033 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10034 /// while executing the actual API request.
10035 ///
10036 /// ````text
10037 /// It should be used to handle progress information, and to implement a certain level of resilience.
10038 /// ````
10039 ///
10040 /// Sets the *delegate* property to the given value.
10041 pub fn delegate(
10042 mut self,
10043 new_value: &'a mut dyn common::Delegate,
10044 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
10045 self._delegate = Some(new_value);
10046 self
10047 }
10048
10049 /// Set any additional parameter of the query string used in the request.
10050 /// It should be used to set parameters which are not yet available through their own
10051 /// setters.
10052 ///
10053 /// Please note that this method must not be used to set any of the known parameters
10054 /// which have their own setter method. If done anyway, the request will fail.
10055 ///
10056 /// # Additional Parameters
10057 ///
10058 /// * *$.xgafv* (query-string) - V1 error format.
10059 /// * *access_token* (query-string) - OAuth access token.
10060 /// * *alt* (query-string) - Data format for response.
10061 /// * *callback* (query-string) - JSONP
10062 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10063 /// * *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.
10064 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10065 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10066 /// * *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.
10067 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10068 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10069 pub fn param<T>(
10070 mut self,
10071 name: T,
10072 value: T,
10073 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
10074 where
10075 T: AsRef<str>,
10076 {
10077 self._additional_params
10078 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10079 self
10080 }
10081
10082 /// Identifies the authorization scope for the method you are building.
10083 ///
10084 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10085 /// [`Scope::CloudPlatform`].
10086 ///
10087 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10088 /// tokens for more than one scope.
10089 ///
10090 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10091 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10092 /// sufficient, a read-write scope will do as well.
10093 pub fn add_scope<St>(
10094 mut self,
10095 scope: St,
10096 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
10097 where
10098 St: AsRef<str>,
10099 {
10100 self._scopes.insert(String::from(scope.as_ref()));
10101 self
10102 }
10103 /// Identifies the authorization scope(s) for the method you are building.
10104 ///
10105 /// See [`Self::add_scope()`] for details.
10106 pub fn add_scopes<I, St>(
10107 mut self,
10108 scopes: I,
10109 ) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C>
10110 where
10111 I: IntoIterator<Item = St>,
10112 St: AsRef<str>,
10113 {
10114 self._scopes
10115 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10116 self
10117 }
10118
10119 /// Removes all scopes, and no default scope will be used either.
10120 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10121 /// for details).
10122 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationListCall<'a, C> {
10123 self._scopes.clear();
10124 self
10125 }
10126}
10127
10128/// Updates the parameters of a single Automation resource.
10129///
10130/// A builder for the *locations.deliveryPipelines.automations.patch* method supported by a *project* resource.
10131/// It is not used directly, but through a [`ProjectMethods`] instance.
10132///
10133/// # Example
10134///
10135/// Instantiate a resource method builder
10136///
10137/// ```test_harness,no_run
10138/// # extern crate hyper;
10139/// # extern crate hyper_rustls;
10140/// # extern crate google_clouddeploy1 as clouddeploy1;
10141/// use clouddeploy1::api::Automation;
10142/// # async fn dox() {
10143/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10144///
10145/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10146/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10147/// # .with_native_roots()
10148/// # .unwrap()
10149/// # .https_only()
10150/// # .enable_http2()
10151/// # .build();
10152///
10153/// # let executor = hyper_util::rt::TokioExecutor::new();
10154/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10155/// # secret,
10156/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10157/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10158/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10159/// # ),
10160/// # ).build().await.unwrap();
10161///
10162/// # let client = hyper_util::client::legacy::Client::builder(
10163/// # hyper_util::rt::TokioExecutor::new()
10164/// # )
10165/// # .build(
10166/// # hyper_rustls::HttpsConnectorBuilder::new()
10167/// # .with_native_roots()
10168/// # .unwrap()
10169/// # .https_or_http()
10170/// # .enable_http2()
10171/// # .build()
10172/// # );
10173/// # let mut hub = CloudDeploy::new(client, auth);
10174/// // As the method needs a request, you would usually fill it with the desired information
10175/// // into the respective structure. Some of the parts shown here might not be applicable !
10176/// // Values shown here are possibly random and not representative !
10177/// let mut req = Automation::default();
10178///
10179/// // You can configure optional parameters by calling the respective setters at will, and
10180/// // execute the final call using `doit()`.
10181/// // Values shown here are possibly random and not representative !
10182/// let result = hub.projects().locations_delivery_pipelines_automations_patch(req, "name")
10183/// .validate_only(true)
10184/// .update_mask(FieldMask::new::<&str>(&[]))
10185/// .request_id("ipsum")
10186/// .allow_missing(true)
10187/// .doit().await;
10188/// # }
10189/// ```
10190pub struct ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
10191where
10192 C: 'a,
10193{
10194 hub: &'a CloudDeploy<C>,
10195 _request: Automation,
10196 _name: String,
10197 _validate_only: Option<bool>,
10198 _update_mask: Option<common::FieldMask>,
10199 _request_id: Option<String>,
10200 _allow_missing: Option<bool>,
10201 _delegate: Option<&'a mut dyn common::Delegate>,
10202 _additional_params: HashMap<String, String>,
10203 _scopes: BTreeSet<String>,
10204}
10205
10206impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {}
10207
10208impl<'a, C> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
10209where
10210 C: common::Connector,
10211{
10212 /// Perform the operation you have build so far.
10213 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10214 use std::borrow::Cow;
10215 use std::io::{Read, Seek};
10216
10217 use common::{url::Params, ToParts};
10218 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10219
10220 let mut dd = common::DefaultDelegate;
10221 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10222 dlg.begin(common::MethodInfo {
10223 id: "clouddeploy.projects.locations.deliveryPipelines.automations.patch",
10224 http_method: hyper::Method::PATCH,
10225 });
10226
10227 for &field in [
10228 "alt",
10229 "name",
10230 "validateOnly",
10231 "updateMask",
10232 "requestId",
10233 "allowMissing",
10234 ]
10235 .iter()
10236 {
10237 if self._additional_params.contains_key(field) {
10238 dlg.finished(false);
10239 return Err(common::Error::FieldClash(field));
10240 }
10241 }
10242
10243 let mut params = Params::with_capacity(8 + self._additional_params.len());
10244 params.push("name", self._name);
10245 if let Some(value) = self._validate_only.as_ref() {
10246 params.push("validateOnly", value.to_string());
10247 }
10248 if let Some(value) = self._update_mask.as_ref() {
10249 params.push("updateMask", value.to_string());
10250 }
10251 if let Some(value) = self._request_id.as_ref() {
10252 params.push("requestId", value);
10253 }
10254 if let Some(value) = self._allow_missing.as_ref() {
10255 params.push("allowMissing", value.to_string());
10256 }
10257
10258 params.extend(self._additional_params.iter());
10259
10260 params.push("alt", "json");
10261 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10262 if self._scopes.is_empty() {
10263 self._scopes
10264 .insert(Scope::CloudPlatform.as_ref().to_string());
10265 }
10266
10267 #[allow(clippy::single_element_loop)]
10268 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10269 url = params.uri_replacement(url, param_name, find_this, true);
10270 }
10271 {
10272 let to_remove = ["name"];
10273 params.remove_params(&to_remove);
10274 }
10275
10276 let url = params.parse_with_url(&url);
10277
10278 let mut json_mime_type = mime::APPLICATION_JSON;
10279 let mut request_value_reader = {
10280 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10281 common::remove_json_null_values(&mut value);
10282 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10283 serde_json::to_writer(&mut dst, &value).unwrap();
10284 dst
10285 };
10286 let request_size = request_value_reader
10287 .seek(std::io::SeekFrom::End(0))
10288 .unwrap();
10289 request_value_reader
10290 .seek(std::io::SeekFrom::Start(0))
10291 .unwrap();
10292
10293 loop {
10294 let token = match self
10295 .hub
10296 .auth
10297 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10298 .await
10299 {
10300 Ok(token) => token,
10301 Err(e) => match dlg.token(e) {
10302 Ok(token) => token,
10303 Err(e) => {
10304 dlg.finished(false);
10305 return Err(common::Error::MissingToken(e));
10306 }
10307 },
10308 };
10309 request_value_reader
10310 .seek(std::io::SeekFrom::Start(0))
10311 .unwrap();
10312 let mut req_result = {
10313 let client = &self.hub.client;
10314 dlg.pre_request();
10315 let mut req_builder = hyper::Request::builder()
10316 .method(hyper::Method::PATCH)
10317 .uri(url.as_str())
10318 .header(USER_AGENT, self.hub._user_agent.clone());
10319
10320 if let Some(token) = token.as_ref() {
10321 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10322 }
10323
10324 let request = req_builder
10325 .header(CONTENT_TYPE, json_mime_type.to_string())
10326 .header(CONTENT_LENGTH, request_size as u64)
10327 .body(common::to_body(
10328 request_value_reader.get_ref().clone().into(),
10329 ));
10330
10331 client.request(request.unwrap()).await
10332 };
10333
10334 match req_result {
10335 Err(err) => {
10336 if let common::Retry::After(d) = dlg.http_error(&err) {
10337 sleep(d).await;
10338 continue;
10339 }
10340 dlg.finished(false);
10341 return Err(common::Error::HttpError(err));
10342 }
10343 Ok(res) => {
10344 let (mut parts, body) = res.into_parts();
10345 let mut body = common::Body::new(body);
10346 if !parts.status.is_success() {
10347 let bytes = common::to_bytes(body).await.unwrap_or_default();
10348 let error = serde_json::from_str(&common::to_string(&bytes));
10349 let response = common::to_response(parts, bytes.into());
10350
10351 if let common::Retry::After(d) =
10352 dlg.http_failure(&response, error.as_ref().ok())
10353 {
10354 sleep(d).await;
10355 continue;
10356 }
10357
10358 dlg.finished(false);
10359
10360 return Err(match error {
10361 Ok(value) => common::Error::BadRequest(value),
10362 _ => common::Error::Failure(response),
10363 });
10364 }
10365 let response = {
10366 let bytes = common::to_bytes(body).await.unwrap_or_default();
10367 let encoded = common::to_string(&bytes);
10368 match serde_json::from_str(&encoded) {
10369 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10370 Err(error) => {
10371 dlg.response_json_decode_error(&encoded, &error);
10372 return Err(common::Error::JsonDecodeError(
10373 encoded.to_string(),
10374 error,
10375 ));
10376 }
10377 }
10378 };
10379
10380 dlg.finished(true);
10381 return Ok(response);
10382 }
10383 }
10384 }
10385 }
10386
10387 ///
10388 /// Sets the *request* property to the given value.
10389 ///
10390 /// Even though the property as already been set when instantiating this call,
10391 /// we provide this method for API completeness.
10392 pub fn request(
10393 mut self,
10394 new_value: Automation,
10395 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10396 self._request = new_value;
10397 self
10398 }
10399 /// Output only. Name of the `Automation`. Format is `projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/automations/{automation}`.
10400 ///
10401 /// Sets the *name* path property to the given value.
10402 ///
10403 /// Even though the property as already been set when instantiating this call,
10404 /// we provide this method for API completeness.
10405 pub fn name(
10406 mut self,
10407 new_value: &str,
10408 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10409 self._name = new_value.to_string();
10410 self
10411 }
10412 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
10413 ///
10414 /// Sets the *validate only* query property to the given value.
10415 pub fn validate_only(
10416 mut self,
10417 new_value: bool,
10418 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10419 self._validate_only = Some(new_value);
10420 self
10421 }
10422 /// Required. Field mask is used to specify the fields to be overwritten by the update in the `Automation` resource. 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.
10423 ///
10424 /// Sets the *update mask* query property to the given value.
10425 pub fn update_mask(
10426 mut self,
10427 new_value: common::FieldMask,
10428 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10429 self._update_mask = Some(new_value);
10430 self
10431 }
10432 /// 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).
10433 ///
10434 /// Sets the *request id* query property to the given value.
10435 pub fn request_id(
10436 mut self,
10437 new_value: &str,
10438 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10439 self._request_id = Some(new_value.to_string());
10440 self
10441 }
10442 /// Optional. If set to true, updating a `Automation` that does not exist will result in the creation of a new `Automation`.
10443 ///
10444 /// Sets the *allow missing* query property to the given value.
10445 pub fn allow_missing(
10446 mut self,
10447 new_value: bool,
10448 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10449 self._allow_missing = Some(new_value);
10450 self
10451 }
10452 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10453 /// while executing the actual API request.
10454 ///
10455 /// ````text
10456 /// It should be used to handle progress information, and to implement a certain level of resilience.
10457 /// ````
10458 ///
10459 /// Sets the *delegate* property to the given value.
10460 pub fn delegate(
10461 mut self,
10462 new_value: &'a mut dyn common::Delegate,
10463 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10464 self._delegate = Some(new_value);
10465 self
10466 }
10467
10468 /// Set any additional parameter of the query string used in the request.
10469 /// It should be used to set parameters which are not yet available through their own
10470 /// setters.
10471 ///
10472 /// Please note that this method must not be used to set any of the known parameters
10473 /// which have their own setter method. If done anyway, the request will fail.
10474 ///
10475 /// # Additional Parameters
10476 ///
10477 /// * *$.xgafv* (query-string) - V1 error format.
10478 /// * *access_token* (query-string) - OAuth access token.
10479 /// * *alt* (query-string) - Data format for response.
10480 /// * *callback* (query-string) - JSONP
10481 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10482 /// * *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.
10483 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10484 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10485 /// * *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.
10486 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10487 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10488 pub fn param<T>(
10489 mut self,
10490 name: T,
10491 value: T,
10492 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
10493 where
10494 T: AsRef<str>,
10495 {
10496 self._additional_params
10497 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10498 self
10499 }
10500
10501 /// Identifies the authorization scope for the method you are building.
10502 ///
10503 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10504 /// [`Scope::CloudPlatform`].
10505 ///
10506 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10507 /// tokens for more than one scope.
10508 ///
10509 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10510 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10511 /// sufficient, a read-write scope will do as well.
10512 pub fn add_scope<St>(
10513 mut self,
10514 scope: St,
10515 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
10516 where
10517 St: AsRef<str>,
10518 {
10519 self._scopes.insert(String::from(scope.as_ref()));
10520 self
10521 }
10522 /// Identifies the authorization scope(s) for the method you are building.
10523 ///
10524 /// See [`Self::add_scope()`] for details.
10525 pub fn add_scopes<I, St>(
10526 mut self,
10527 scopes: I,
10528 ) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C>
10529 where
10530 I: IntoIterator<Item = St>,
10531 St: AsRef<str>,
10532 {
10533 self._scopes
10534 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10535 self
10536 }
10537
10538 /// Removes all scopes, and no default scope will be used either.
10539 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10540 /// for details).
10541 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineAutomationPatchCall<'a, C> {
10542 self._scopes.clear();
10543 self
10544 }
10545}
10546
10547/// Gets details of a single JobRun.
10548///
10549/// A builder for the *locations.deliveryPipelines.releases.rollouts.jobRuns.get* method supported by a *project* resource.
10550/// It is not used directly, but through a [`ProjectMethods`] instance.
10551///
10552/// # Example
10553///
10554/// Instantiate a resource method builder
10555///
10556/// ```test_harness,no_run
10557/// # extern crate hyper;
10558/// # extern crate hyper_rustls;
10559/// # extern crate google_clouddeploy1 as clouddeploy1;
10560/// # async fn dox() {
10561/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10562///
10563/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10564/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10565/// # .with_native_roots()
10566/// # .unwrap()
10567/// # .https_only()
10568/// # .enable_http2()
10569/// # .build();
10570///
10571/// # let executor = hyper_util::rt::TokioExecutor::new();
10572/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10573/// # secret,
10574/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10575/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10576/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10577/// # ),
10578/// # ).build().await.unwrap();
10579///
10580/// # let client = hyper_util::client::legacy::Client::builder(
10581/// # hyper_util::rt::TokioExecutor::new()
10582/// # )
10583/// # .build(
10584/// # hyper_rustls::HttpsConnectorBuilder::new()
10585/// # .with_native_roots()
10586/// # .unwrap()
10587/// # .https_or_http()
10588/// # .enable_http2()
10589/// # .build()
10590/// # );
10591/// # let mut hub = CloudDeploy::new(client, auth);
10592/// // You can configure optional parameters by calling the respective setters at will, and
10593/// // execute the final call using `doit()`.
10594/// // Values shown here are possibly random and not representative !
10595/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_job_runs_get("name")
10596/// .doit().await;
10597/// # }
10598/// ```
10599pub struct ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
10600where
10601 C: 'a,
10602{
10603 hub: &'a CloudDeploy<C>,
10604 _name: String,
10605 _delegate: Option<&'a mut dyn common::Delegate>,
10606 _additional_params: HashMap<String, String>,
10607 _scopes: BTreeSet<String>,
10608}
10609
10610impl<'a, C> common::CallBuilder
10611 for ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
10612{
10613}
10614
10615impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
10616where
10617 C: common::Connector,
10618{
10619 /// Perform the operation you have build so far.
10620 pub async fn doit(mut self) -> common::Result<(common::Response, JobRun)> {
10621 use std::borrow::Cow;
10622 use std::io::{Read, Seek};
10623
10624 use common::{url::Params, ToParts};
10625 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10626
10627 let mut dd = common::DefaultDelegate;
10628 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10629 dlg.begin(common::MethodInfo {
10630 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.jobRuns.get",
10631 http_method: hyper::Method::GET,
10632 });
10633
10634 for &field in ["alt", "name"].iter() {
10635 if self._additional_params.contains_key(field) {
10636 dlg.finished(false);
10637 return Err(common::Error::FieldClash(field));
10638 }
10639 }
10640
10641 let mut params = Params::with_capacity(3 + self._additional_params.len());
10642 params.push("name", self._name);
10643
10644 params.extend(self._additional_params.iter());
10645
10646 params.push("alt", "json");
10647 let mut url = self.hub._base_url.clone() + "v1/{+name}";
10648 if self._scopes.is_empty() {
10649 self._scopes
10650 .insert(Scope::CloudPlatform.as_ref().to_string());
10651 }
10652
10653 #[allow(clippy::single_element_loop)]
10654 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10655 url = params.uri_replacement(url, param_name, find_this, true);
10656 }
10657 {
10658 let to_remove = ["name"];
10659 params.remove_params(&to_remove);
10660 }
10661
10662 let url = params.parse_with_url(&url);
10663
10664 loop {
10665 let token = match self
10666 .hub
10667 .auth
10668 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10669 .await
10670 {
10671 Ok(token) => token,
10672 Err(e) => match dlg.token(e) {
10673 Ok(token) => token,
10674 Err(e) => {
10675 dlg.finished(false);
10676 return Err(common::Error::MissingToken(e));
10677 }
10678 },
10679 };
10680 let mut req_result = {
10681 let client = &self.hub.client;
10682 dlg.pre_request();
10683 let mut req_builder = hyper::Request::builder()
10684 .method(hyper::Method::GET)
10685 .uri(url.as_str())
10686 .header(USER_AGENT, self.hub._user_agent.clone());
10687
10688 if let Some(token) = token.as_ref() {
10689 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10690 }
10691
10692 let request = req_builder
10693 .header(CONTENT_LENGTH, 0_u64)
10694 .body(common::to_body::<String>(None));
10695
10696 client.request(request.unwrap()).await
10697 };
10698
10699 match req_result {
10700 Err(err) => {
10701 if let common::Retry::After(d) = dlg.http_error(&err) {
10702 sleep(d).await;
10703 continue;
10704 }
10705 dlg.finished(false);
10706 return Err(common::Error::HttpError(err));
10707 }
10708 Ok(res) => {
10709 let (mut parts, body) = res.into_parts();
10710 let mut body = common::Body::new(body);
10711 if !parts.status.is_success() {
10712 let bytes = common::to_bytes(body).await.unwrap_or_default();
10713 let error = serde_json::from_str(&common::to_string(&bytes));
10714 let response = common::to_response(parts, bytes.into());
10715
10716 if let common::Retry::After(d) =
10717 dlg.http_failure(&response, error.as_ref().ok())
10718 {
10719 sleep(d).await;
10720 continue;
10721 }
10722
10723 dlg.finished(false);
10724
10725 return Err(match error {
10726 Ok(value) => common::Error::BadRequest(value),
10727 _ => common::Error::Failure(response),
10728 });
10729 }
10730 let response = {
10731 let bytes = common::to_bytes(body).await.unwrap_or_default();
10732 let encoded = common::to_string(&bytes);
10733 match serde_json::from_str(&encoded) {
10734 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10735 Err(error) => {
10736 dlg.response_json_decode_error(&encoded, &error);
10737 return Err(common::Error::JsonDecodeError(
10738 encoded.to_string(),
10739 error,
10740 ));
10741 }
10742 }
10743 };
10744
10745 dlg.finished(true);
10746 return Ok(response);
10747 }
10748 }
10749 }
10750 }
10751
10752 /// 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}`.
10753 ///
10754 /// Sets the *name* path property to the given value.
10755 ///
10756 /// Even though the property as already been set when instantiating this call,
10757 /// we provide this method for API completeness.
10758 pub fn name(
10759 mut self,
10760 new_value: &str,
10761 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
10762 self._name = new_value.to_string();
10763 self
10764 }
10765 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10766 /// while executing the actual API request.
10767 ///
10768 /// ````text
10769 /// It should be used to handle progress information, and to implement a certain level of resilience.
10770 /// ````
10771 ///
10772 /// Sets the *delegate* property to the given value.
10773 pub fn delegate(
10774 mut self,
10775 new_value: &'a mut dyn common::Delegate,
10776 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
10777 self._delegate = Some(new_value);
10778 self
10779 }
10780
10781 /// Set any additional parameter of the query string used in the request.
10782 /// It should be used to set parameters which are not yet available through their own
10783 /// setters.
10784 ///
10785 /// Please note that this method must not be used to set any of the known parameters
10786 /// which have their own setter method. If done anyway, the request will fail.
10787 ///
10788 /// # Additional Parameters
10789 ///
10790 /// * *$.xgafv* (query-string) - V1 error format.
10791 /// * *access_token* (query-string) - OAuth access token.
10792 /// * *alt* (query-string) - Data format for response.
10793 /// * *callback* (query-string) - JSONP
10794 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10795 /// * *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.
10796 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10797 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10798 /// * *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.
10799 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10800 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10801 pub fn param<T>(
10802 mut self,
10803 name: T,
10804 value: T,
10805 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
10806 where
10807 T: AsRef<str>,
10808 {
10809 self._additional_params
10810 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10811 self
10812 }
10813
10814 /// Identifies the authorization scope for the method you are building.
10815 ///
10816 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10817 /// [`Scope::CloudPlatform`].
10818 ///
10819 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10820 /// tokens for more than one scope.
10821 ///
10822 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10823 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10824 /// sufficient, a read-write scope will do as well.
10825 pub fn add_scope<St>(
10826 mut self,
10827 scope: St,
10828 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
10829 where
10830 St: AsRef<str>,
10831 {
10832 self._scopes.insert(String::from(scope.as_ref()));
10833 self
10834 }
10835 /// Identifies the authorization scope(s) for the method you are building.
10836 ///
10837 /// See [`Self::add_scope()`] for details.
10838 pub fn add_scopes<I, St>(
10839 mut self,
10840 scopes: I,
10841 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C>
10842 where
10843 I: IntoIterator<Item = St>,
10844 St: AsRef<str>,
10845 {
10846 self._scopes
10847 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10848 self
10849 }
10850
10851 /// Removes all scopes, and no default scope will be used either.
10852 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10853 /// for details).
10854 pub fn clear_scopes(
10855 mut self,
10856 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunGetCall<'a, C> {
10857 self._scopes.clear();
10858 self
10859 }
10860}
10861
10862/// Lists JobRuns in a given project and location.
10863///
10864/// A builder for the *locations.deliveryPipelines.releases.rollouts.jobRuns.list* method supported by a *project* resource.
10865/// It is not used directly, but through a [`ProjectMethods`] instance.
10866///
10867/// # Example
10868///
10869/// Instantiate a resource method builder
10870///
10871/// ```test_harness,no_run
10872/// # extern crate hyper;
10873/// # extern crate hyper_rustls;
10874/// # extern crate google_clouddeploy1 as clouddeploy1;
10875/// # async fn dox() {
10876/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10877///
10878/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10879/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10880/// # .with_native_roots()
10881/// # .unwrap()
10882/// # .https_only()
10883/// # .enable_http2()
10884/// # .build();
10885///
10886/// # let executor = hyper_util::rt::TokioExecutor::new();
10887/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10888/// # secret,
10889/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10890/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10891/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10892/// # ),
10893/// # ).build().await.unwrap();
10894///
10895/// # let client = hyper_util::client::legacy::Client::builder(
10896/// # hyper_util::rt::TokioExecutor::new()
10897/// # )
10898/// # .build(
10899/// # hyper_rustls::HttpsConnectorBuilder::new()
10900/// # .with_native_roots()
10901/// # .unwrap()
10902/// # .https_or_http()
10903/// # .enable_http2()
10904/// # .build()
10905/// # );
10906/// # let mut hub = CloudDeploy::new(client, auth);
10907/// // You can configure optional parameters by calling the respective setters at will, and
10908/// // execute the final call using `doit()`.
10909/// // Values shown here are possibly random and not representative !
10910/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_job_runs_list("parent")
10911/// .page_token("et")
10912/// .page_size(-31)
10913/// .order_by("consetetur")
10914/// .filter("amet.")
10915/// .doit().await;
10916/// # }
10917/// ```
10918pub struct ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
10919where
10920 C: 'a,
10921{
10922 hub: &'a CloudDeploy<C>,
10923 _parent: String,
10924 _page_token: Option<String>,
10925 _page_size: Option<i32>,
10926 _order_by: Option<String>,
10927 _filter: Option<String>,
10928 _delegate: Option<&'a mut dyn common::Delegate>,
10929 _additional_params: HashMap<String, String>,
10930 _scopes: BTreeSet<String>,
10931}
10932
10933impl<'a, C> common::CallBuilder
10934 for ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
10935{
10936}
10937
10938impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
10939where
10940 C: common::Connector,
10941{
10942 /// Perform the operation you have build so far.
10943 pub async fn doit(mut self) -> common::Result<(common::Response, ListJobRunsResponse)> {
10944 use std::borrow::Cow;
10945 use std::io::{Read, Seek};
10946
10947 use common::{url::Params, ToParts};
10948 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10949
10950 let mut dd = common::DefaultDelegate;
10951 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10952 dlg.begin(common::MethodInfo {
10953 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.jobRuns.list",
10954 http_method: hyper::Method::GET,
10955 });
10956
10957 for &field in [
10958 "alt",
10959 "parent",
10960 "pageToken",
10961 "pageSize",
10962 "orderBy",
10963 "filter",
10964 ]
10965 .iter()
10966 {
10967 if self._additional_params.contains_key(field) {
10968 dlg.finished(false);
10969 return Err(common::Error::FieldClash(field));
10970 }
10971 }
10972
10973 let mut params = Params::with_capacity(7 + self._additional_params.len());
10974 params.push("parent", self._parent);
10975 if let Some(value) = self._page_token.as_ref() {
10976 params.push("pageToken", value);
10977 }
10978 if let Some(value) = self._page_size.as_ref() {
10979 params.push("pageSize", value.to_string());
10980 }
10981 if let Some(value) = self._order_by.as_ref() {
10982 params.push("orderBy", value);
10983 }
10984 if let Some(value) = self._filter.as_ref() {
10985 params.push("filter", value);
10986 }
10987
10988 params.extend(self._additional_params.iter());
10989
10990 params.push("alt", "json");
10991 let mut url = self.hub._base_url.clone() + "v1/{+parent}/jobRuns";
10992 if self._scopes.is_empty() {
10993 self._scopes
10994 .insert(Scope::CloudPlatform.as_ref().to_string());
10995 }
10996
10997 #[allow(clippy::single_element_loop)]
10998 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10999 url = params.uri_replacement(url, param_name, find_this, true);
11000 }
11001 {
11002 let to_remove = ["parent"];
11003 params.remove_params(&to_remove);
11004 }
11005
11006 let url = params.parse_with_url(&url);
11007
11008 loop {
11009 let token = match self
11010 .hub
11011 .auth
11012 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11013 .await
11014 {
11015 Ok(token) => token,
11016 Err(e) => match dlg.token(e) {
11017 Ok(token) => token,
11018 Err(e) => {
11019 dlg.finished(false);
11020 return Err(common::Error::MissingToken(e));
11021 }
11022 },
11023 };
11024 let mut req_result = {
11025 let client = &self.hub.client;
11026 dlg.pre_request();
11027 let mut req_builder = hyper::Request::builder()
11028 .method(hyper::Method::GET)
11029 .uri(url.as_str())
11030 .header(USER_AGENT, self.hub._user_agent.clone());
11031
11032 if let Some(token) = token.as_ref() {
11033 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11034 }
11035
11036 let request = req_builder
11037 .header(CONTENT_LENGTH, 0_u64)
11038 .body(common::to_body::<String>(None));
11039
11040 client.request(request.unwrap()).await
11041 };
11042
11043 match req_result {
11044 Err(err) => {
11045 if let common::Retry::After(d) = dlg.http_error(&err) {
11046 sleep(d).await;
11047 continue;
11048 }
11049 dlg.finished(false);
11050 return Err(common::Error::HttpError(err));
11051 }
11052 Ok(res) => {
11053 let (mut parts, body) = res.into_parts();
11054 let mut body = common::Body::new(body);
11055 if !parts.status.is_success() {
11056 let bytes = common::to_bytes(body).await.unwrap_or_default();
11057 let error = serde_json::from_str(&common::to_string(&bytes));
11058 let response = common::to_response(parts, bytes.into());
11059
11060 if let common::Retry::After(d) =
11061 dlg.http_failure(&response, error.as_ref().ok())
11062 {
11063 sleep(d).await;
11064 continue;
11065 }
11066
11067 dlg.finished(false);
11068
11069 return Err(match error {
11070 Ok(value) => common::Error::BadRequest(value),
11071 _ => common::Error::Failure(response),
11072 });
11073 }
11074 let response = {
11075 let bytes = common::to_bytes(body).await.unwrap_or_default();
11076 let encoded = common::to_string(&bytes);
11077 match serde_json::from_str(&encoded) {
11078 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11079 Err(error) => {
11080 dlg.response_json_decode_error(&encoded, &error);
11081 return Err(common::Error::JsonDecodeError(
11082 encoded.to_string(),
11083 error,
11084 ));
11085 }
11086 }
11087 };
11088
11089 dlg.finished(true);
11090 return Ok(response);
11091 }
11092 }
11093 }
11094 }
11095
11096 /// Required. The `Rollout` which owns this collection of `JobRun` objects.
11097 ///
11098 /// Sets the *parent* path property to the given value.
11099 ///
11100 /// Even though the property as already been set when instantiating this call,
11101 /// we provide this method for API completeness.
11102 pub fn parent(
11103 mut self,
11104 new_value: &str,
11105 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
11106 self._parent = new_value.to_string();
11107 self
11108 }
11109 /// 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.
11110 ///
11111 /// Sets the *page token* query property to the given value.
11112 pub fn page_token(
11113 mut self,
11114 new_value: &str,
11115 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
11116 self._page_token = Some(new_value.to_string());
11117 self
11118 }
11119 /// 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.
11120 ///
11121 /// Sets the *page size* query property to the given value.
11122 pub fn page_size(
11123 mut self,
11124 new_value: i32,
11125 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
11126 self._page_size = Some(new_value);
11127 self
11128 }
11129 /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
11130 ///
11131 /// Sets the *order by* query property to the given value.
11132 pub fn order_by(
11133 mut self,
11134 new_value: &str,
11135 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
11136 self._order_by = Some(new_value.to_string());
11137 self
11138 }
11139 /// Optional. Filter results to be returned. See https://google.aip.dev/160 for more details.
11140 ///
11141 /// Sets the *filter* query property to the given value.
11142 pub fn filter(
11143 mut self,
11144 new_value: &str,
11145 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
11146 self._filter = Some(new_value.to_string());
11147 self
11148 }
11149 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11150 /// while executing the actual API request.
11151 ///
11152 /// ````text
11153 /// It should be used to handle progress information, and to implement a certain level of resilience.
11154 /// ````
11155 ///
11156 /// Sets the *delegate* property to the given value.
11157 pub fn delegate(
11158 mut self,
11159 new_value: &'a mut dyn common::Delegate,
11160 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
11161 self._delegate = Some(new_value);
11162 self
11163 }
11164
11165 /// Set any additional parameter of the query string used in the request.
11166 /// It should be used to set parameters which are not yet available through their own
11167 /// setters.
11168 ///
11169 /// Please note that this method must not be used to set any of the known parameters
11170 /// which have their own setter method. If done anyway, the request will fail.
11171 ///
11172 /// # Additional Parameters
11173 ///
11174 /// * *$.xgafv* (query-string) - V1 error format.
11175 /// * *access_token* (query-string) - OAuth access token.
11176 /// * *alt* (query-string) - Data format for response.
11177 /// * *callback* (query-string) - JSONP
11178 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11179 /// * *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.
11180 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11181 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11182 /// * *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.
11183 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11184 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11185 pub fn param<T>(
11186 mut self,
11187 name: T,
11188 value: T,
11189 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
11190 where
11191 T: AsRef<str>,
11192 {
11193 self._additional_params
11194 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11195 self
11196 }
11197
11198 /// Identifies the authorization scope for the method you are building.
11199 ///
11200 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11201 /// [`Scope::CloudPlatform`].
11202 ///
11203 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11204 /// tokens for more than one scope.
11205 ///
11206 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11207 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11208 /// sufficient, a read-write scope will do as well.
11209 pub fn add_scope<St>(
11210 mut self,
11211 scope: St,
11212 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
11213 where
11214 St: AsRef<str>,
11215 {
11216 self._scopes.insert(String::from(scope.as_ref()));
11217 self
11218 }
11219 /// Identifies the authorization scope(s) for the method you are building.
11220 ///
11221 /// See [`Self::add_scope()`] for details.
11222 pub fn add_scopes<I, St>(
11223 mut self,
11224 scopes: I,
11225 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C>
11226 where
11227 I: IntoIterator<Item = St>,
11228 St: AsRef<str>,
11229 {
11230 self._scopes
11231 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11232 self
11233 }
11234
11235 /// Removes all scopes, and no default scope will be used either.
11236 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11237 /// for details).
11238 pub fn clear_scopes(
11239 mut self,
11240 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunListCall<'a, C> {
11241 self._scopes.clear();
11242 self
11243 }
11244}
11245
11246/// Terminates a Job Run in a given project and location.
11247///
11248/// A builder for the *locations.deliveryPipelines.releases.rollouts.jobRuns.terminate* method supported by a *project* resource.
11249/// It is not used directly, but through a [`ProjectMethods`] instance.
11250///
11251/// # Example
11252///
11253/// Instantiate a resource method builder
11254///
11255/// ```test_harness,no_run
11256/// # extern crate hyper;
11257/// # extern crate hyper_rustls;
11258/// # extern crate google_clouddeploy1 as clouddeploy1;
11259/// use clouddeploy1::api::TerminateJobRunRequest;
11260/// # async fn dox() {
11261/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11262///
11263/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11264/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11265/// # .with_native_roots()
11266/// # .unwrap()
11267/// # .https_only()
11268/// # .enable_http2()
11269/// # .build();
11270///
11271/// # let executor = hyper_util::rt::TokioExecutor::new();
11272/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11273/// # secret,
11274/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11275/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11276/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11277/// # ),
11278/// # ).build().await.unwrap();
11279///
11280/// # let client = hyper_util::client::legacy::Client::builder(
11281/// # hyper_util::rt::TokioExecutor::new()
11282/// # )
11283/// # .build(
11284/// # hyper_rustls::HttpsConnectorBuilder::new()
11285/// # .with_native_roots()
11286/// # .unwrap()
11287/// # .https_or_http()
11288/// # .enable_http2()
11289/// # .build()
11290/// # );
11291/// # let mut hub = CloudDeploy::new(client, auth);
11292/// // As the method needs a request, you would usually fill it with the desired information
11293/// // into the respective structure. Some of the parts shown here might not be applicable !
11294/// // Values shown here are possibly random and not representative !
11295/// let mut req = TerminateJobRunRequest::default();
11296///
11297/// // You can configure optional parameters by calling the respective setters at will, and
11298/// // execute the final call using `doit()`.
11299/// // Values shown here are possibly random and not representative !
11300/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_job_runs_terminate(req, "name")
11301/// .doit().await;
11302/// # }
11303/// ```
11304pub struct ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
11305where
11306 C: 'a,
11307{
11308 hub: &'a CloudDeploy<C>,
11309 _request: TerminateJobRunRequest,
11310 _name: String,
11311 _delegate: Option<&'a mut dyn common::Delegate>,
11312 _additional_params: HashMap<String, String>,
11313 _scopes: BTreeSet<String>,
11314}
11315
11316impl<'a, C> common::CallBuilder
11317 for ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
11318{
11319}
11320
11321impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
11322where
11323 C: common::Connector,
11324{
11325 /// Perform the operation you have build so far.
11326 pub async fn doit(mut self) -> common::Result<(common::Response, TerminateJobRunResponse)> {
11327 use std::borrow::Cow;
11328 use std::io::{Read, Seek};
11329
11330 use common::{url::Params, ToParts};
11331 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11332
11333 let mut dd = common::DefaultDelegate;
11334 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11335 dlg.begin(common::MethodInfo { id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.jobRuns.terminate",
11336 http_method: hyper::Method::POST });
11337
11338 for &field in ["alt", "name"].iter() {
11339 if self._additional_params.contains_key(field) {
11340 dlg.finished(false);
11341 return Err(common::Error::FieldClash(field));
11342 }
11343 }
11344
11345 let mut params = Params::with_capacity(4 + self._additional_params.len());
11346 params.push("name", self._name);
11347
11348 params.extend(self._additional_params.iter());
11349
11350 params.push("alt", "json");
11351 let mut url = self.hub._base_url.clone() + "v1/{+name}:terminate";
11352 if self._scopes.is_empty() {
11353 self._scopes
11354 .insert(Scope::CloudPlatform.as_ref().to_string());
11355 }
11356
11357 #[allow(clippy::single_element_loop)]
11358 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11359 url = params.uri_replacement(url, param_name, find_this, true);
11360 }
11361 {
11362 let to_remove = ["name"];
11363 params.remove_params(&to_remove);
11364 }
11365
11366 let url = params.parse_with_url(&url);
11367
11368 let mut json_mime_type = mime::APPLICATION_JSON;
11369 let mut request_value_reader = {
11370 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11371 common::remove_json_null_values(&mut value);
11372 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11373 serde_json::to_writer(&mut dst, &value).unwrap();
11374 dst
11375 };
11376 let request_size = request_value_reader
11377 .seek(std::io::SeekFrom::End(0))
11378 .unwrap();
11379 request_value_reader
11380 .seek(std::io::SeekFrom::Start(0))
11381 .unwrap();
11382
11383 loop {
11384 let token = match self
11385 .hub
11386 .auth
11387 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11388 .await
11389 {
11390 Ok(token) => token,
11391 Err(e) => match dlg.token(e) {
11392 Ok(token) => token,
11393 Err(e) => {
11394 dlg.finished(false);
11395 return Err(common::Error::MissingToken(e));
11396 }
11397 },
11398 };
11399 request_value_reader
11400 .seek(std::io::SeekFrom::Start(0))
11401 .unwrap();
11402 let mut req_result = {
11403 let client = &self.hub.client;
11404 dlg.pre_request();
11405 let mut req_builder = hyper::Request::builder()
11406 .method(hyper::Method::POST)
11407 .uri(url.as_str())
11408 .header(USER_AGENT, self.hub._user_agent.clone());
11409
11410 if let Some(token) = token.as_ref() {
11411 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11412 }
11413
11414 let request = req_builder
11415 .header(CONTENT_TYPE, json_mime_type.to_string())
11416 .header(CONTENT_LENGTH, request_size as u64)
11417 .body(common::to_body(
11418 request_value_reader.get_ref().clone().into(),
11419 ));
11420
11421 client.request(request.unwrap()).await
11422 };
11423
11424 match req_result {
11425 Err(err) => {
11426 if let common::Retry::After(d) = dlg.http_error(&err) {
11427 sleep(d).await;
11428 continue;
11429 }
11430 dlg.finished(false);
11431 return Err(common::Error::HttpError(err));
11432 }
11433 Ok(res) => {
11434 let (mut parts, body) = res.into_parts();
11435 let mut body = common::Body::new(body);
11436 if !parts.status.is_success() {
11437 let bytes = common::to_bytes(body).await.unwrap_or_default();
11438 let error = serde_json::from_str(&common::to_string(&bytes));
11439 let response = common::to_response(parts, bytes.into());
11440
11441 if let common::Retry::After(d) =
11442 dlg.http_failure(&response, error.as_ref().ok())
11443 {
11444 sleep(d).await;
11445 continue;
11446 }
11447
11448 dlg.finished(false);
11449
11450 return Err(match error {
11451 Ok(value) => common::Error::BadRequest(value),
11452 _ => common::Error::Failure(response),
11453 });
11454 }
11455 let response = {
11456 let bytes = common::to_bytes(body).await.unwrap_or_default();
11457 let encoded = common::to_string(&bytes);
11458 match serde_json::from_str(&encoded) {
11459 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11460 Err(error) => {
11461 dlg.response_json_decode_error(&encoded, &error);
11462 return Err(common::Error::JsonDecodeError(
11463 encoded.to_string(),
11464 error,
11465 ));
11466 }
11467 }
11468 };
11469
11470 dlg.finished(true);
11471 return Ok(response);
11472 }
11473 }
11474 }
11475 }
11476
11477 ///
11478 /// Sets the *request* property to the given value.
11479 ///
11480 /// Even though the property as already been set when instantiating this call,
11481 /// we provide this method for API completeness.
11482 pub fn request(
11483 mut self,
11484 new_value: TerminateJobRunRequest,
11485 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
11486 self._request = new_value;
11487 self
11488 }
11489 /// Required. Name of the `JobRun`. Format must be `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}/jobRuns/{jobRun}`.
11490 ///
11491 /// Sets the *name* path property to the given value.
11492 ///
11493 /// Even though the property as already been set when instantiating this call,
11494 /// we provide this method for API completeness.
11495 pub fn name(
11496 mut self,
11497 new_value: &str,
11498 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
11499 self._name = new_value.to_string();
11500 self
11501 }
11502 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11503 /// while executing the actual API request.
11504 ///
11505 /// ````text
11506 /// It should be used to handle progress information, and to implement a certain level of resilience.
11507 /// ````
11508 ///
11509 /// Sets the *delegate* property to the given value.
11510 pub fn delegate(
11511 mut self,
11512 new_value: &'a mut dyn common::Delegate,
11513 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
11514 self._delegate = Some(new_value);
11515 self
11516 }
11517
11518 /// Set any additional parameter of the query string used in the request.
11519 /// It should be used to set parameters which are not yet available through their own
11520 /// setters.
11521 ///
11522 /// Please note that this method must not be used to set any of the known parameters
11523 /// which have their own setter method. If done anyway, the request will fail.
11524 ///
11525 /// # Additional Parameters
11526 ///
11527 /// * *$.xgafv* (query-string) - V1 error format.
11528 /// * *access_token* (query-string) - OAuth access token.
11529 /// * *alt* (query-string) - Data format for response.
11530 /// * *callback* (query-string) - JSONP
11531 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11532 /// * *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.
11533 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11534 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11535 /// * *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.
11536 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11537 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11538 pub fn param<T>(
11539 mut self,
11540 name: T,
11541 value: T,
11542 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
11543 where
11544 T: AsRef<str>,
11545 {
11546 self._additional_params
11547 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11548 self
11549 }
11550
11551 /// Identifies the authorization scope for the method you are building.
11552 ///
11553 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11554 /// [`Scope::CloudPlatform`].
11555 ///
11556 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11557 /// tokens for more than one scope.
11558 ///
11559 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11560 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11561 /// sufficient, a read-write scope will do as well.
11562 pub fn add_scope<St>(
11563 mut self,
11564 scope: St,
11565 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
11566 where
11567 St: AsRef<str>,
11568 {
11569 self._scopes.insert(String::from(scope.as_ref()));
11570 self
11571 }
11572 /// Identifies the authorization scope(s) for the method you are building.
11573 ///
11574 /// See [`Self::add_scope()`] for details.
11575 pub fn add_scopes<I, St>(
11576 mut self,
11577 scopes: I,
11578 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C>
11579 where
11580 I: IntoIterator<Item = St>,
11581 St: AsRef<str>,
11582 {
11583 self._scopes
11584 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11585 self
11586 }
11587
11588 /// Removes all scopes, and no default scope will be used either.
11589 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11590 /// for details).
11591 pub fn clear_scopes(
11592 mut self,
11593 ) -> ProjectLocationDeliveryPipelineReleaseRolloutJobRunTerminateCall<'a, C> {
11594 self._scopes.clear();
11595 self
11596 }
11597}
11598
11599/// Advances a Rollout in a given project and location.
11600///
11601/// A builder for the *locations.deliveryPipelines.releases.rollouts.advance* method supported by a *project* resource.
11602/// It is not used directly, but through a [`ProjectMethods`] instance.
11603///
11604/// # Example
11605///
11606/// Instantiate a resource method builder
11607///
11608/// ```test_harness,no_run
11609/// # extern crate hyper;
11610/// # extern crate hyper_rustls;
11611/// # extern crate google_clouddeploy1 as clouddeploy1;
11612/// use clouddeploy1::api::AdvanceRolloutRequest;
11613/// # async fn dox() {
11614/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11615///
11616/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11617/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11618/// # .with_native_roots()
11619/// # .unwrap()
11620/// # .https_only()
11621/// # .enable_http2()
11622/// # .build();
11623///
11624/// # let executor = hyper_util::rt::TokioExecutor::new();
11625/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11626/// # secret,
11627/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11628/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11629/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11630/// # ),
11631/// # ).build().await.unwrap();
11632///
11633/// # let client = hyper_util::client::legacy::Client::builder(
11634/// # hyper_util::rt::TokioExecutor::new()
11635/// # )
11636/// # .build(
11637/// # hyper_rustls::HttpsConnectorBuilder::new()
11638/// # .with_native_roots()
11639/// # .unwrap()
11640/// # .https_or_http()
11641/// # .enable_http2()
11642/// # .build()
11643/// # );
11644/// # let mut hub = CloudDeploy::new(client, auth);
11645/// // As the method needs a request, you would usually fill it with the desired information
11646/// // into the respective structure. Some of the parts shown here might not be applicable !
11647/// // Values shown here are possibly random and not representative !
11648/// let mut req = AdvanceRolloutRequest::default();
11649///
11650/// // You can configure optional parameters by calling the respective setters at will, and
11651/// // execute the final call using `doit()`.
11652/// // Values shown here are possibly random and not representative !
11653/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_advance(req, "name")
11654/// .doit().await;
11655/// # }
11656/// ```
11657pub struct ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
11658where
11659 C: 'a,
11660{
11661 hub: &'a CloudDeploy<C>,
11662 _request: AdvanceRolloutRequest,
11663 _name: String,
11664 _delegate: Option<&'a mut dyn common::Delegate>,
11665 _additional_params: HashMap<String, String>,
11666 _scopes: BTreeSet<String>,
11667}
11668
11669impl<'a, C> common::CallBuilder
11670 for ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
11671{
11672}
11673
11674impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
11675where
11676 C: common::Connector,
11677{
11678 /// Perform the operation you have build so far.
11679 pub async fn doit(mut self) -> common::Result<(common::Response, AdvanceRolloutResponse)> {
11680 use std::borrow::Cow;
11681 use std::io::{Read, Seek};
11682
11683 use common::{url::Params, ToParts};
11684 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11685
11686 let mut dd = common::DefaultDelegate;
11687 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11688 dlg.begin(common::MethodInfo {
11689 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.advance",
11690 http_method: hyper::Method::POST,
11691 });
11692
11693 for &field in ["alt", "name"].iter() {
11694 if self._additional_params.contains_key(field) {
11695 dlg.finished(false);
11696 return Err(common::Error::FieldClash(field));
11697 }
11698 }
11699
11700 let mut params = Params::with_capacity(4 + self._additional_params.len());
11701 params.push("name", self._name);
11702
11703 params.extend(self._additional_params.iter());
11704
11705 params.push("alt", "json");
11706 let mut url = self.hub._base_url.clone() + "v1/{+name}:advance";
11707 if self._scopes.is_empty() {
11708 self._scopes
11709 .insert(Scope::CloudPlatform.as_ref().to_string());
11710 }
11711
11712 #[allow(clippy::single_element_loop)]
11713 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11714 url = params.uri_replacement(url, param_name, find_this, true);
11715 }
11716 {
11717 let to_remove = ["name"];
11718 params.remove_params(&to_remove);
11719 }
11720
11721 let url = params.parse_with_url(&url);
11722
11723 let mut json_mime_type = mime::APPLICATION_JSON;
11724 let mut request_value_reader = {
11725 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11726 common::remove_json_null_values(&mut value);
11727 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11728 serde_json::to_writer(&mut dst, &value).unwrap();
11729 dst
11730 };
11731 let request_size = request_value_reader
11732 .seek(std::io::SeekFrom::End(0))
11733 .unwrap();
11734 request_value_reader
11735 .seek(std::io::SeekFrom::Start(0))
11736 .unwrap();
11737
11738 loop {
11739 let token = match self
11740 .hub
11741 .auth
11742 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11743 .await
11744 {
11745 Ok(token) => token,
11746 Err(e) => match dlg.token(e) {
11747 Ok(token) => token,
11748 Err(e) => {
11749 dlg.finished(false);
11750 return Err(common::Error::MissingToken(e));
11751 }
11752 },
11753 };
11754 request_value_reader
11755 .seek(std::io::SeekFrom::Start(0))
11756 .unwrap();
11757 let mut req_result = {
11758 let client = &self.hub.client;
11759 dlg.pre_request();
11760 let mut req_builder = hyper::Request::builder()
11761 .method(hyper::Method::POST)
11762 .uri(url.as_str())
11763 .header(USER_AGENT, self.hub._user_agent.clone());
11764
11765 if let Some(token) = token.as_ref() {
11766 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11767 }
11768
11769 let request = req_builder
11770 .header(CONTENT_TYPE, json_mime_type.to_string())
11771 .header(CONTENT_LENGTH, request_size as u64)
11772 .body(common::to_body(
11773 request_value_reader.get_ref().clone().into(),
11774 ));
11775
11776 client.request(request.unwrap()).await
11777 };
11778
11779 match req_result {
11780 Err(err) => {
11781 if let common::Retry::After(d) = dlg.http_error(&err) {
11782 sleep(d).await;
11783 continue;
11784 }
11785 dlg.finished(false);
11786 return Err(common::Error::HttpError(err));
11787 }
11788 Ok(res) => {
11789 let (mut parts, body) = res.into_parts();
11790 let mut body = common::Body::new(body);
11791 if !parts.status.is_success() {
11792 let bytes = common::to_bytes(body).await.unwrap_or_default();
11793 let error = serde_json::from_str(&common::to_string(&bytes));
11794 let response = common::to_response(parts, bytes.into());
11795
11796 if let common::Retry::After(d) =
11797 dlg.http_failure(&response, error.as_ref().ok())
11798 {
11799 sleep(d).await;
11800 continue;
11801 }
11802
11803 dlg.finished(false);
11804
11805 return Err(match error {
11806 Ok(value) => common::Error::BadRequest(value),
11807 _ => common::Error::Failure(response),
11808 });
11809 }
11810 let response = {
11811 let bytes = common::to_bytes(body).await.unwrap_or_default();
11812 let encoded = common::to_string(&bytes);
11813 match serde_json::from_str(&encoded) {
11814 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11815 Err(error) => {
11816 dlg.response_json_decode_error(&encoded, &error);
11817 return Err(common::Error::JsonDecodeError(
11818 encoded.to_string(),
11819 error,
11820 ));
11821 }
11822 }
11823 };
11824
11825 dlg.finished(true);
11826 return Ok(response);
11827 }
11828 }
11829 }
11830 }
11831
11832 ///
11833 /// Sets the *request* property to the given value.
11834 ///
11835 /// Even though the property as already been set when instantiating this call,
11836 /// we provide this method for API completeness.
11837 pub fn request(
11838 mut self,
11839 new_value: AdvanceRolloutRequest,
11840 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
11841 self._request = new_value;
11842 self
11843 }
11844 /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
11845 ///
11846 /// Sets the *name* path property to the given value.
11847 ///
11848 /// Even though the property as already been set when instantiating this call,
11849 /// we provide this method for API completeness.
11850 pub fn name(
11851 mut self,
11852 new_value: &str,
11853 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
11854 self._name = new_value.to_string();
11855 self
11856 }
11857 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11858 /// while executing the actual API request.
11859 ///
11860 /// ````text
11861 /// It should be used to handle progress information, and to implement a certain level of resilience.
11862 /// ````
11863 ///
11864 /// Sets the *delegate* property to the given value.
11865 pub fn delegate(
11866 mut self,
11867 new_value: &'a mut dyn common::Delegate,
11868 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
11869 self._delegate = Some(new_value);
11870 self
11871 }
11872
11873 /// Set any additional parameter of the query string used in the request.
11874 /// It should be used to set parameters which are not yet available through their own
11875 /// setters.
11876 ///
11877 /// Please note that this method must not be used to set any of the known parameters
11878 /// which have their own setter method. If done anyway, the request will fail.
11879 ///
11880 /// # Additional Parameters
11881 ///
11882 /// * *$.xgafv* (query-string) - V1 error format.
11883 /// * *access_token* (query-string) - OAuth access token.
11884 /// * *alt* (query-string) - Data format for response.
11885 /// * *callback* (query-string) - JSONP
11886 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11887 /// * *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.
11888 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11889 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11890 /// * *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.
11891 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11892 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11893 pub fn param<T>(
11894 mut self,
11895 name: T,
11896 value: T,
11897 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
11898 where
11899 T: AsRef<str>,
11900 {
11901 self._additional_params
11902 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11903 self
11904 }
11905
11906 /// Identifies the authorization scope for the method you are building.
11907 ///
11908 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11909 /// [`Scope::CloudPlatform`].
11910 ///
11911 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11912 /// tokens for more than one scope.
11913 ///
11914 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11915 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11916 /// sufficient, a read-write scope will do as well.
11917 pub fn add_scope<St>(
11918 mut self,
11919 scope: St,
11920 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
11921 where
11922 St: AsRef<str>,
11923 {
11924 self._scopes.insert(String::from(scope.as_ref()));
11925 self
11926 }
11927 /// Identifies the authorization scope(s) for the method you are building.
11928 ///
11929 /// See [`Self::add_scope()`] for details.
11930 pub fn add_scopes<I, St>(
11931 mut self,
11932 scopes: I,
11933 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C>
11934 where
11935 I: IntoIterator<Item = St>,
11936 St: AsRef<str>,
11937 {
11938 self._scopes
11939 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11940 self
11941 }
11942
11943 /// Removes all scopes, and no default scope will be used either.
11944 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11945 /// for details).
11946 pub fn clear_scopes(
11947 mut self,
11948 ) -> ProjectLocationDeliveryPipelineReleaseRolloutAdvanceCall<'a, C> {
11949 self._scopes.clear();
11950 self
11951 }
11952}
11953
11954/// Approves a Rollout.
11955///
11956/// A builder for the *locations.deliveryPipelines.releases.rollouts.approve* method supported by a *project* resource.
11957/// It is not used directly, but through a [`ProjectMethods`] instance.
11958///
11959/// # Example
11960///
11961/// Instantiate a resource method builder
11962///
11963/// ```test_harness,no_run
11964/// # extern crate hyper;
11965/// # extern crate hyper_rustls;
11966/// # extern crate google_clouddeploy1 as clouddeploy1;
11967/// use clouddeploy1::api::ApproveRolloutRequest;
11968/// # async fn dox() {
11969/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11970///
11971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11972/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11973/// # .with_native_roots()
11974/// # .unwrap()
11975/// # .https_only()
11976/// # .enable_http2()
11977/// # .build();
11978///
11979/// # let executor = hyper_util::rt::TokioExecutor::new();
11980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11981/// # secret,
11982/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11983/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11984/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11985/// # ),
11986/// # ).build().await.unwrap();
11987///
11988/// # let client = hyper_util::client::legacy::Client::builder(
11989/// # hyper_util::rt::TokioExecutor::new()
11990/// # )
11991/// # .build(
11992/// # hyper_rustls::HttpsConnectorBuilder::new()
11993/// # .with_native_roots()
11994/// # .unwrap()
11995/// # .https_or_http()
11996/// # .enable_http2()
11997/// # .build()
11998/// # );
11999/// # let mut hub = CloudDeploy::new(client, auth);
12000/// // As the method needs a request, you would usually fill it with the desired information
12001/// // into the respective structure. Some of the parts shown here might not be applicable !
12002/// // Values shown here are possibly random and not representative !
12003/// let mut req = ApproveRolloutRequest::default();
12004///
12005/// // You can configure optional parameters by calling the respective setters at will, and
12006/// // execute the final call using `doit()`.
12007/// // Values shown here are possibly random and not representative !
12008/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_approve(req, "name")
12009/// .doit().await;
12010/// # }
12011/// ```
12012pub struct ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
12013where
12014 C: 'a,
12015{
12016 hub: &'a CloudDeploy<C>,
12017 _request: ApproveRolloutRequest,
12018 _name: String,
12019 _delegate: Option<&'a mut dyn common::Delegate>,
12020 _additional_params: HashMap<String, String>,
12021 _scopes: BTreeSet<String>,
12022}
12023
12024impl<'a, C> common::CallBuilder
12025 for ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
12026{
12027}
12028
12029impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
12030where
12031 C: common::Connector,
12032{
12033 /// Perform the operation you have build so far.
12034 pub async fn doit(mut self) -> common::Result<(common::Response, ApproveRolloutResponse)> {
12035 use std::borrow::Cow;
12036 use std::io::{Read, Seek};
12037
12038 use common::{url::Params, ToParts};
12039 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12040
12041 let mut dd = common::DefaultDelegate;
12042 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12043 dlg.begin(common::MethodInfo {
12044 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.approve",
12045 http_method: hyper::Method::POST,
12046 });
12047
12048 for &field in ["alt", "name"].iter() {
12049 if self._additional_params.contains_key(field) {
12050 dlg.finished(false);
12051 return Err(common::Error::FieldClash(field));
12052 }
12053 }
12054
12055 let mut params = Params::with_capacity(4 + self._additional_params.len());
12056 params.push("name", self._name);
12057
12058 params.extend(self._additional_params.iter());
12059
12060 params.push("alt", "json");
12061 let mut url = self.hub._base_url.clone() + "v1/{+name}:approve";
12062 if self._scopes.is_empty() {
12063 self._scopes
12064 .insert(Scope::CloudPlatform.as_ref().to_string());
12065 }
12066
12067 #[allow(clippy::single_element_loop)]
12068 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12069 url = params.uri_replacement(url, param_name, find_this, true);
12070 }
12071 {
12072 let to_remove = ["name"];
12073 params.remove_params(&to_remove);
12074 }
12075
12076 let url = params.parse_with_url(&url);
12077
12078 let mut json_mime_type = mime::APPLICATION_JSON;
12079 let mut request_value_reader = {
12080 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12081 common::remove_json_null_values(&mut value);
12082 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12083 serde_json::to_writer(&mut dst, &value).unwrap();
12084 dst
12085 };
12086 let request_size = request_value_reader
12087 .seek(std::io::SeekFrom::End(0))
12088 .unwrap();
12089 request_value_reader
12090 .seek(std::io::SeekFrom::Start(0))
12091 .unwrap();
12092
12093 loop {
12094 let token = match self
12095 .hub
12096 .auth
12097 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12098 .await
12099 {
12100 Ok(token) => token,
12101 Err(e) => match dlg.token(e) {
12102 Ok(token) => token,
12103 Err(e) => {
12104 dlg.finished(false);
12105 return Err(common::Error::MissingToken(e));
12106 }
12107 },
12108 };
12109 request_value_reader
12110 .seek(std::io::SeekFrom::Start(0))
12111 .unwrap();
12112 let mut req_result = {
12113 let client = &self.hub.client;
12114 dlg.pre_request();
12115 let mut req_builder = hyper::Request::builder()
12116 .method(hyper::Method::POST)
12117 .uri(url.as_str())
12118 .header(USER_AGENT, self.hub._user_agent.clone());
12119
12120 if let Some(token) = token.as_ref() {
12121 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12122 }
12123
12124 let request = req_builder
12125 .header(CONTENT_TYPE, json_mime_type.to_string())
12126 .header(CONTENT_LENGTH, request_size as u64)
12127 .body(common::to_body(
12128 request_value_reader.get_ref().clone().into(),
12129 ));
12130
12131 client.request(request.unwrap()).await
12132 };
12133
12134 match req_result {
12135 Err(err) => {
12136 if let common::Retry::After(d) = dlg.http_error(&err) {
12137 sleep(d).await;
12138 continue;
12139 }
12140 dlg.finished(false);
12141 return Err(common::Error::HttpError(err));
12142 }
12143 Ok(res) => {
12144 let (mut parts, body) = res.into_parts();
12145 let mut body = common::Body::new(body);
12146 if !parts.status.is_success() {
12147 let bytes = common::to_bytes(body).await.unwrap_or_default();
12148 let error = serde_json::from_str(&common::to_string(&bytes));
12149 let response = common::to_response(parts, bytes.into());
12150
12151 if let common::Retry::After(d) =
12152 dlg.http_failure(&response, error.as_ref().ok())
12153 {
12154 sleep(d).await;
12155 continue;
12156 }
12157
12158 dlg.finished(false);
12159
12160 return Err(match error {
12161 Ok(value) => common::Error::BadRequest(value),
12162 _ => common::Error::Failure(response),
12163 });
12164 }
12165 let response = {
12166 let bytes = common::to_bytes(body).await.unwrap_or_default();
12167 let encoded = common::to_string(&bytes);
12168 match serde_json::from_str(&encoded) {
12169 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12170 Err(error) => {
12171 dlg.response_json_decode_error(&encoded, &error);
12172 return Err(common::Error::JsonDecodeError(
12173 encoded.to_string(),
12174 error,
12175 ));
12176 }
12177 }
12178 };
12179
12180 dlg.finished(true);
12181 return Ok(response);
12182 }
12183 }
12184 }
12185 }
12186
12187 ///
12188 /// Sets the *request* property to the given value.
12189 ///
12190 /// Even though the property as already been set when instantiating this call,
12191 /// we provide this method for API completeness.
12192 pub fn request(
12193 mut self,
12194 new_value: ApproveRolloutRequest,
12195 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
12196 self._request = new_value;
12197 self
12198 }
12199 /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
12200 ///
12201 /// Sets the *name* path property to the given value.
12202 ///
12203 /// Even though the property as already been set when instantiating this call,
12204 /// we provide this method for API completeness.
12205 pub fn name(
12206 mut self,
12207 new_value: &str,
12208 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
12209 self._name = new_value.to_string();
12210 self
12211 }
12212 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12213 /// while executing the actual API request.
12214 ///
12215 /// ````text
12216 /// It should be used to handle progress information, and to implement a certain level of resilience.
12217 /// ````
12218 ///
12219 /// Sets the *delegate* property to the given value.
12220 pub fn delegate(
12221 mut self,
12222 new_value: &'a mut dyn common::Delegate,
12223 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
12224 self._delegate = Some(new_value);
12225 self
12226 }
12227
12228 /// Set any additional parameter of the query string used in the request.
12229 /// It should be used to set parameters which are not yet available through their own
12230 /// setters.
12231 ///
12232 /// Please note that this method must not be used to set any of the known parameters
12233 /// which have their own setter method. If done anyway, the request will fail.
12234 ///
12235 /// # Additional Parameters
12236 ///
12237 /// * *$.xgafv* (query-string) - V1 error format.
12238 /// * *access_token* (query-string) - OAuth access token.
12239 /// * *alt* (query-string) - Data format for response.
12240 /// * *callback* (query-string) - JSONP
12241 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12242 /// * *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.
12243 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12244 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12245 /// * *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.
12246 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12247 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12248 pub fn param<T>(
12249 mut self,
12250 name: T,
12251 value: T,
12252 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
12253 where
12254 T: AsRef<str>,
12255 {
12256 self._additional_params
12257 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12258 self
12259 }
12260
12261 /// Identifies the authorization scope for the method you are building.
12262 ///
12263 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12264 /// [`Scope::CloudPlatform`].
12265 ///
12266 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12267 /// tokens for more than one scope.
12268 ///
12269 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12270 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12271 /// sufficient, a read-write scope will do as well.
12272 pub fn add_scope<St>(
12273 mut self,
12274 scope: St,
12275 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
12276 where
12277 St: AsRef<str>,
12278 {
12279 self._scopes.insert(String::from(scope.as_ref()));
12280 self
12281 }
12282 /// Identifies the authorization scope(s) for the method you are building.
12283 ///
12284 /// See [`Self::add_scope()`] for details.
12285 pub fn add_scopes<I, St>(
12286 mut self,
12287 scopes: I,
12288 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C>
12289 where
12290 I: IntoIterator<Item = St>,
12291 St: AsRef<str>,
12292 {
12293 self._scopes
12294 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12295 self
12296 }
12297
12298 /// Removes all scopes, and no default scope will be used either.
12299 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12300 /// for details).
12301 pub fn clear_scopes(
12302 mut self,
12303 ) -> ProjectLocationDeliveryPipelineReleaseRolloutApproveCall<'a, C> {
12304 self._scopes.clear();
12305 self
12306 }
12307}
12308
12309/// Cancels a Rollout in a given project and location.
12310///
12311/// A builder for the *locations.deliveryPipelines.releases.rollouts.cancel* method supported by a *project* resource.
12312/// It is not used directly, but through a [`ProjectMethods`] instance.
12313///
12314/// # Example
12315///
12316/// Instantiate a resource method builder
12317///
12318/// ```test_harness,no_run
12319/// # extern crate hyper;
12320/// # extern crate hyper_rustls;
12321/// # extern crate google_clouddeploy1 as clouddeploy1;
12322/// use clouddeploy1::api::CancelRolloutRequest;
12323/// # async fn dox() {
12324/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12325///
12326/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12327/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12328/// # .with_native_roots()
12329/// # .unwrap()
12330/// # .https_only()
12331/// # .enable_http2()
12332/// # .build();
12333///
12334/// # let executor = hyper_util::rt::TokioExecutor::new();
12335/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12336/// # secret,
12337/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12338/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12339/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12340/// # ),
12341/// # ).build().await.unwrap();
12342///
12343/// # let client = hyper_util::client::legacy::Client::builder(
12344/// # hyper_util::rt::TokioExecutor::new()
12345/// # )
12346/// # .build(
12347/// # hyper_rustls::HttpsConnectorBuilder::new()
12348/// # .with_native_roots()
12349/// # .unwrap()
12350/// # .https_or_http()
12351/// # .enable_http2()
12352/// # .build()
12353/// # );
12354/// # let mut hub = CloudDeploy::new(client, auth);
12355/// // As the method needs a request, you would usually fill it with the desired information
12356/// // into the respective structure. Some of the parts shown here might not be applicable !
12357/// // Values shown here are possibly random and not representative !
12358/// let mut req = CancelRolloutRequest::default();
12359///
12360/// // You can configure optional parameters by calling the respective setters at will, and
12361/// // execute the final call using `doit()`.
12362/// // Values shown here are possibly random and not representative !
12363/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_cancel(req, "name")
12364/// .doit().await;
12365/// # }
12366/// ```
12367pub struct ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
12368where
12369 C: 'a,
12370{
12371 hub: &'a CloudDeploy<C>,
12372 _request: CancelRolloutRequest,
12373 _name: String,
12374 _delegate: Option<&'a mut dyn common::Delegate>,
12375 _additional_params: HashMap<String, String>,
12376 _scopes: BTreeSet<String>,
12377}
12378
12379impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {}
12380
12381impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
12382where
12383 C: common::Connector,
12384{
12385 /// Perform the operation you have build so far.
12386 pub async fn doit(mut self) -> common::Result<(common::Response, CancelRolloutResponse)> {
12387 use std::borrow::Cow;
12388 use std::io::{Read, Seek};
12389
12390 use common::{url::Params, ToParts};
12391 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12392
12393 let mut dd = common::DefaultDelegate;
12394 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12395 dlg.begin(common::MethodInfo {
12396 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.cancel",
12397 http_method: hyper::Method::POST,
12398 });
12399
12400 for &field in ["alt", "name"].iter() {
12401 if self._additional_params.contains_key(field) {
12402 dlg.finished(false);
12403 return Err(common::Error::FieldClash(field));
12404 }
12405 }
12406
12407 let mut params = Params::with_capacity(4 + self._additional_params.len());
12408 params.push("name", self._name);
12409
12410 params.extend(self._additional_params.iter());
12411
12412 params.push("alt", "json");
12413 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
12414 if self._scopes.is_empty() {
12415 self._scopes
12416 .insert(Scope::CloudPlatform.as_ref().to_string());
12417 }
12418
12419 #[allow(clippy::single_element_loop)]
12420 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12421 url = params.uri_replacement(url, param_name, find_this, true);
12422 }
12423 {
12424 let to_remove = ["name"];
12425 params.remove_params(&to_remove);
12426 }
12427
12428 let url = params.parse_with_url(&url);
12429
12430 let mut json_mime_type = mime::APPLICATION_JSON;
12431 let mut request_value_reader = {
12432 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12433 common::remove_json_null_values(&mut value);
12434 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12435 serde_json::to_writer(&mut dst, &value).unwrap();
12436 dst
12437 };
12438 let request_size = request_value_reader
12439 .seek(std::io::SeekFrom::End(0))
12440 .unwrap();
12441 request_value_reader
12442 .seek(std::io::SeekFrom::Start(0))
12443 .unwrap();
12444
12445 loop {
12446 let token = match self
12447 .hub
12448 .auth
12449 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12450 .await
12451 {
12452 Ok(token) => token,
12453 Err(e) => match dlg.token(e) {
12454 Ok(token) => token,
12455 Err(e) => {
12456 dlg.finished(false);
12457 return Err(common::Error::MissingToken(e));
12458 }
12459 },
12460 };
12461 request_value_reader
12462 .seek(std::io::SeekFrom::Start(0))
12463 .unwrap();
12464 let mut req_result = {
12465 let client = &self.hub.client;
12466 dlg.pre_request();
12467 let mut req_builder = hyper::Request::builder()
12468 .method(hyper::Method::POST)
12469 .uri(url.as_str())
12470 .header(USER_AGENT, self.hub._user_agent.clone());
12471
12472 if let Some(token) = token.as_ref() {
12473 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12474 }
12475
12476 let request = req_builder
12477 .header(CONTENT_TYPE, json_mime_type.to_string())
12478 .header(CONTENT_LENGTH, request_size as u64)
12479 .body(common::to_body(
12480 request_value_reader.get_ref().clone().into(),
12481 ));
12482
12483 client.request(request.unwrap()).await
12484 };
12485
12486 match req_result {
12487 Err(err) => {
12488 if let common::Retry::After(d) = dlg.http_error(&err) {
12489 sleep(d).await;
12490 continue;
12491 }
12492 dlg.finished(false);
12493 return Err(common::Error::HttpError(err));
12494 }
12495 Ok(res) => {
12496 let (mut parts, body) = res.into_parts();
12497 let mut body = common::Body::new(body);
12498 if !parts.status.is_success() {
12499 let bytes = common::to_bytes(body).await.unwrap_or_default();
12500 let error = serde_json::from_str(&common::to_string(&bytes));
12501 let response = common::to_response(parts, bytes.into());
12502
12503 if let common::Retry::After(d) =
12504 dlg.http_failure(&response, error.as_ref().ok())
12505 {
12506 sleep(d).await;
12507 continue;
12508 }
12509
12510 dlg.finished(false);
12511
12512 return Err(match error {
12513 Ok(value) => common::Error::BadRequest(value),
12514 _ => common::Error::Failure(response),
12515 });
12516 }
12517 let response = {
12518 let bytes = common::to_bytes(body).await.unwrap_or_default();
12519 let encoded = common::to_string(&bytes);
12520 match serde_json::from_str(&encoded) {
12521 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12522 Err(error) => {
12523 dlg.response_json_decode_error(&encoded, &error);
12524 return Err(common::Error::JsonDecodeError(
12525 encoded.to_string(),
12526 error,
12527 ));
12528 }
12529 }
12530 };
12531
12532 dlg.finished(true);
12533 return Ok(response);
12534 }
12535 }
12536 }
12537 }
12538
12539 ///
12540 /// Sets the *request* property to the given value.
12541 ///
12542 /// Even though the property as already been set when instantiating this call,
12543 /// we provide this method for API completeness.
12544 pub fn request(
12545 mut self,
12546 new_value: CancelRolloutRequest,
12547 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
12548 self._request = new_value;
12549 self
12550 }
12551 /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
12552 ///
12553 /// Sets the *name* path property to the given value.
12554 ///
12555 /// Even though the property as already been set when instantiating this call,
12556 /// we provide this method for API completeness.
12557 pub fn name(
12558 mut self,
12559 new_value: &str,
12560 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
12561 self._name = new_value.to_string();
12562 self
12563 }
12564 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12565 /// while executing the actual API request.
12566 ///
12567 /// ````text
12568 /// It should be used to handle progress information, and to implement a certain level of resilience.
12569 /// ````
12570 ///
12571 /// Sets the *delegate* property to the given value.
12572 pub fn delegate(
12573 mut self,
12574 new_value: &'a mut dyn common::Delegate,
12575 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
12576 self._delegate = Some(new_value);
12577 self
12578 }
12579
12580 /// Set any additional parameter of the query string used in the request.
12581 /// It should be used to set parameters which are not yet available through their own
12582 /// setters.
12583 ///
12584 /// Please note that this method must not be used to set any of the known parameters
12585 /// which have their own setter method. If done anyway, the request will fail.
12586 ///
12587 /// # Additional Parameters
12588 ///
12589 /// * *$.xgafv* (query-string) - V1 error format.
12590 /// * *access_token* (query-string) - OAuth access token.
12591 /// * *alt* (query-string) - Data format for response.
12592 /// * *callback* (query-string) - JSONP
12593 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12594 /// * *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.
12595 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12596 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12597 /// * *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.
12598 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12599 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12600 pub fn param<T>(
12601 mut self,
12602 name: T,
12603 value: T,
12604 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
12605 where
12606 T: AsRef<str>,
12607 {
12608 self._additional_params
12609 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12610 self
12611 }
12612
12613 /// Identifies the authorization scope for the method you are building.
12614 ///
12615 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12616 /// [`Scope::CloudPlatform`].
12617 ///
12618 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12619 /// tokens for more than one scope.
12620 ///
12621 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12622 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12623 /// sufficient, a read-write scope will do as well.
12624 pub fn add_scope<St>(
12625 mut self,
12626 scope: St,
12627 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
12628 where
12629 St: AsRef<str>,
12630 {
12631 self._scopes.insert(String::from(scope.as_ref()));
12632 self
12633 }
12634 /// Identifies the authorization scope(s) for the method you are building.
12635 ///
12636 /// See [`Self::add_scope()`] for details.
12637 pub fn add_scopes<I, St>(
12638 mut self,
12639 scopes: I,
12640 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C>
12641 where
12642 I: IntoIterator<Item = St>,
12643 St: AsRef<str>,
12644 {
12645 self._scopes
12646 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12647 self
12648 }
12649
12650 /// Removes all scopes, and no default scope will be used either.
12651 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12652 /// for details).
12653 pub fn clear_scopes(
12654 mut self,
12655 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCancelCall<'a, C> {
12656 self._scopes.clear();
12657 self
12658 }
12659}
12660
12661/// Creates a new Rollout in a given project and location.
12662///
12663/// A builder for the *locations.deliveryPipelines.releases.rollouts.create* method supported by a *project* resource.
12664/// It is not used directly, but through a [`ProjectMethods`] instance.
12665///
12666/// # Example
12667///
12668/// Instantiate a resource method builder
12669///
12670/// ```test_harness,no_run
12671/// # extern crate hyper;
12672/// # extern crate hyper_rustls;
12673/// # extern crate google_clouddeploy1 as clouddeploy1;
12674/// use clouddeploy1::api::Rollout;
12675/// # async fn dox() {
12676/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12677///
12678/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12679/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12680/// # .with_native_roots()
12681/// # .unwrap()
12682/// # .https_only()
12683/// # .enable_http2()
12684/// # .build();
12685///
12686/// # let executor = hyper_util::rt::TokioExecutor::new();
12687/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12688/// # secret,
12689/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12690/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12691/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12692/// # ),
12693/// # ).build().await.unwrap();
12694///
12695/// # let client = hyper_util::client::legacy::Client::builder(
12696/// # hyper_util::rt::TokioExecutor::new()
12697/// # )
12698/// # .build(
12699/// # hyper_rustls::HttpsConnectorBuilder::new()
12700/// # .with_native_roots()
12701/// # .unwrap()
12702/// # .https_or_http()
12703/// # .enable_http2()
12704/// # .build()
12705/// # );
12706/// # let mut hub = CloudDeploy::new(client, auth);
12707/// // As the method needs a request, you would usually fill it with the desired information
12708/// // into the respective structure. Some of the parts shown here might not be applicable !
12709/// // Values shown here are possibly random and not representative !
12710/// let mut req = Rollout::default();
12711///
12712/// // You can configure optional parameters by calling the respective setters at will, and
12713/// // execute the final call using `doit()`.
12714/// // Values shown here are possibly random and not representative !
12715/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_create(req, "parent")
12716/// .validate_only(false)
12717/// .starting_phase_id("dolore")
12718/// .rollout_id("dolore")
12719/// .request_id("dolore")
12720/// .add_override_deploy_policy("voluptua.")
12721/// .doit().await;
12722/// # }
12723/// ```
12724pub struct ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
12725where
12726 C: 'a,
12727{
12728 hub: &'a CloudDeploy<C>,
12729 _request: Rollout,
12730 _parent: String,
12731 _validate_only: Option<bool>,
12732 _starting_phase_id: Option<String>,
12733 _rollout_id: Option<String>,
12734 _request_id: Option<String>,
12735 _override_deploy_policy: Vec<String>,
12736 _delegate: Option<&'a mut dyn common::Delegate>,
12737 _additional_params: HashMap<String, String>,
12738 _scopes: BTreeSet<String>,
12739}
12740
12741impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {}
12742
12743impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
12744where
12745 C: common::Connector,
12746{
12747 /// Perform the operation you have build so far.
12748 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12749 use std::borrow::Cow;
12750 use std::io::{Read, Seek};
12751
12752 use common::{url::Params, ToParts};
12753 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12754
12755 let mut dd = common::DefaultDelegate;
12756 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12757 dlg.begin(common::MethodInfo {
12758 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.create",
12759 http_method: hyper::Method::POST,
12760 });
12761
12762 for &field in [
12763 "alt",
12764 "parent",
12765 "validateOnly",
12766 "startingPhaseId",
12767 "rolloutId",
12768 "requestId",
12769 "overrideDeployPolicy",
12770 ]
12771 .iter()
12772 {
12773 if self._additional_params.contains_key(field) {
12774 dlg.finished(false);
12775 return Err(common::Error::FieldClash(field));
12776 }
12777 }
12778
12779 let mut params = Params::with_capacity(9 + self._additional_params.len());
12780 params.push("parent", self._parent);
12781 if let Some(value) = self._validate_only.as_ref() {
12782 params.push("validateOnly", value.to_string());
12783 }
12784 if let Some(value) = self._starting_phase_id.as_ref() {
12785 params.push("startingPhaseId", value);
12786 }
12787 if let Some(value) = self._rollout_id.as_ref() {
12788 params.push("rolloutId", value);
12789 }
12790 if let Some(value) = self._request_id.as_ref() {
12791 params.push("requestId", value);
12792 }
12793 if !self._override_deploy_policy.is_empty() {
12794 for f in self._override_deploy_policy.iter() {
12795 params.push("overrideDeployPolicy", f);
12796 }
12797 }
12798
12799 params.extend(self._additional_params.iter());
12800
12801 params.push("alt", "json");
12802 let mut url = self.hub._base_url.clone() + "v1/{+parent}/rollouts";
12803 if self._scopes.is_empty() {
12804 self._scopes
12805 .insert(Scope::CloudPlatform.as_ref().to_string());
12806 }
12807
12808 #[allow(clippy::single_element_loop)]
12809 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12810 url = params.uri_replacement(url, param_name, find_this, true);
12811 }
12812 {
12813 let to_remove = ["parent"];
12814 params.remove_params(&to_remove);
12815 }
12816
12817 let url = params.parse_with_url(&url);
12818
12819 let mut json_mime_type = mime::APPLICATION_JSON;
12820 let mut request_value_reader = {
12821 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12822 common::remove_json_null_values(&mut value);
12823 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12824 serde_json::to_writer(&mut dst, &value).unwrap();
12825 dst
12826 };
12827 let request_size = request_value_reader
12828 .seek(std::io::SeekFrom::End(0))
12829 .unwrap();
12830 request_value_reader
12831 .seek(std::io::SeekFrom::Start(0))
12832 .unwrap();
12833
12834 loop {
12835 let token = match self
12836 .hub
12837 .auth
12838 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12839 .await
12840 {
12841 Ok(token) => token,
12842 Err(e) => match dlg.token(e) {
12843 Ok(token) => token,
12844 Err(e) => {
12845 dlg.finished(false);
12846 return Err(common::Error::MissingToken(e));
12847 }
12848 },
12849 };
12850 request_value_reader
12851 .seek(std::io::SeekFrom::Start(0))
12852 .unwrap();
12853 let mut req_result = {
12854 let client = &self.hub.client;
12855 dlg.pre_request();
12856 let mut req_builder = hyper::Request::builder()
12857 .method(hyper::Method::POST)
12858 .uri(url.as_str())
12859 .header(USER_AGENT, self.hub._user_agent.clone());
12860
12861 if let Some(token) = token.as_ref() {
12862 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12863 }
12864
12865 let request = req_builder
12866 .header(CONTENT_TYPE, json_mime_type.to_string())
12867 .header(CONTENT_LENGTH, request_size as u64)
12868 .body(common::to_body(
12869 request_value_reader.get_ref().clone().into(),
12870 ));
12871
12872 client.request(request.unwrap()).await
12873 };
12874
12875 match req_result {
12876 Err(err) => {
12877 if let common::Retry::After(d) = dlg.http_error(&err) {
12878 sleep(d).await;
12879 continue;
12880 }
12881 dlg.finished(false);
12882 return Err(common::Error::HttpError(err));
12883 }
12884 Ok(res) => {
12885 let (mut parts, body) = res.into_parts();
12886 let mut body = common::Body::new(body);
12887 if !parts.status.is_success() {
12888 let bytes = common::to_bytes(body).await.unwrap_or_default();
12889 let error = serde_json::from_str(&common::to_string(&bytes));
12890 let response = common::to_response(parts, bytes.into());
12891
12892 if let common::Retry::After(d) =
12893 dlg.http_failure(&response, error.as_ref().ok())
12894 {
12895 sleep(d).await;
12896 continue;
12897 }
12898
12899 dlg.finished(false);
12900
12901 return Err(match error {
12902 Ok(value) => common::Error::BadRequest(value),
12903 _ => common::Error::Failure(response),
12904 });
12905 }
12906 let response = {
12907 let bytes = common::to_bytes(body).await.unwrap_or_default();
12908 let encoded = common::to_string(&bytes);
12909 match serde_json::from_str(&encoded) {
12910 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12911 Err(error) => {
12912 dlg.response_json_decode_error(&encoded, &error);
12913 return Err(common::Error::JsonDecodeError(
12914 encoded.to_string(),
12915 error,
12916 ));
12917 }
12918 }
12919 };
12920
12921 dlg.finished(true);
12922 return Ok(response);
12923 }
12924 }
12925 }
12926 }
12927
12928 ///
12929 /// Sets the *request* property to the given value.
12930 ///
12931 /// Even though the property as already been set when instantiating this call,
12932 /// we provide this method for API completeness.
12933 pub fn request(
12934 mut self,
12935 new_value: Rollout,
12936 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
12937 self._request = new_value;
12938 self
12939 }
12940 /// Required. The parent collection in which the `Rollout` must be created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
12941 ///
12942 /// Sets the *parent* path property to the given value.
12943 ///
12944 /// Even though the property as already been set when instantiating this call,
12945 /// we provide this method for API completeness.
12946 pub fn parent(
12947 mut self,
12948 new_value: &str,
12949 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
12950 self._parent = new_value.to_string();
12951 self
12952 }
12953 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
12954 ///
12955 /// Sets the *validate only* query property to the given value.
12956 pub fn validate_only(
12957 mut self,
12958 new_value: bool,
12959 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
12960 self._validate_only = Some(new_value);
12961 self
12962 }
12963 /// Optional. The starting phase ID for the `Rollout`. If empty the `Rollout` will start at the first phase.
12964 ///
12965 /// Sets the *starting phase id* query property to the given value.
12966 pub fn starting_phase_id(
12967 mut self,
12968 new_value: &str,
12969 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
12970 self._starting_phase_id = Some(new_value.to_string());
12971 self
12972 }
12973 /// Required. ID of the `Rollout`.
12974 ///
12975 /// Sets the *rollout id* query property to the given value.
12976 pub fn rollout_id(
12977 mut self,
12978 new_value: &str,
12979 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
12980 self._rollout_id = Some(new_value.to_string());
12981 self
12982 }
12983 /// 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).
12984 ///
12985 /// Sets the *request id* query property to the given value.
12986 pub fn request_id(
12987 mut self,
12988 new_value: &str,
12989 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
12990 self._request_id = Some(new_value.to_string());
12991 self
12992 }
12993 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
12994 ///
12995 /// Append the given value to the *override deploy policy* query property.
12996 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
12997 pub fn add_override_deploy_policy(
12998 mut self,
12999 new_value: &str,
13000 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
13001 self._override_deploy_policy.push(new_value.to_string());
13002 self
13003 }
13004 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13005 /// while executing the actual API request.
13006 ///
13007 /// ````text
13008 /// It should be used to handle progress information, and to implement a certain level of resilience.
13009 /// ````
13010 ///
13011 /// Sets the *delegate* property to the given value.
13012 pub fn delegate(
13013 mut self,
13014 new_value: &'a mut dyn common::Delegate,
13015 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
13016 self._delegate = Some(new_value);
13017 self
13018 }
13019
13020 /// Set any additional parameter of the query string used in the request.
13021 /// It should be used to set parameters which are not yet available through their own
13022 /// setters.
13023 ///
13024 /// Please note that this method must not be used to set any of the known parameters
13025 /// which have their own setter method. If done anyway, the request will fail.
13026 ///
13027 /// # Additional Parameters
13028 ///
13029 /// * *$.xgafv* (query-string) - V1 error format.
13030 /// * *access_token* (query-string) - OAuth access token.
13031 /// * *alt* (query-string) - Data format for response.
13032 /// * *callback* (query-string) - JSONP
13033 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13034 /// * *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.
13035 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13036 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13037 /// * *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.
13038 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13039 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13040 pub fn param<T>(
13041 mut self,
13042 name: T,
13043 value: T,
13044 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
13045 where
13046 T: AsRef<str>,
13047 {
13048 self._additional_params
13049 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13050 self
13051 }
13052
13053 /// Identifies the authorization scope for the method you are building.
13054 ///
13055 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13056 /// [`Scope::CloudPlatform`].
13057 ///
13058 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13059 /// tokens for more than one scope.
13060 ///
13061 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13062 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13063 /// sufficient, a read-write scope will do as well.
13064 pub fn add_scope<St>(
13065 mut self,
13066 scope: St,
13067 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
13068 where
13069 St: AsRef<str>,
13070 {
13071 self._scopes.insert(String::from(scope.as_ref()));
13072 self
13073 }
13074 /// Identifies the authorization scope(s) for the method you are building.
13075 ///
13076 /// See [`Self::add_scope()`] for details.
13077 pub fn add_scopes<I, St>(
13078 mut self,
13079 scopes: I,
13080 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C>
13081 where
13082 I: IntoIterator<Item = St>,
13083 St: AsRef<str>,
13084 {
13085 self._scopes
13086 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13087 self
13088 }
13089
13090 /// Removes all scopes, and no default scope will be used either.
13091 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13092 /// for details).
13093 pub fn clear_scopes(
13094 mut self,
13095 ) -> ProjectLocationDeliveryPipelineReleaseRolloutCreateCall<'a, C> {
13096 self._scopes.clear();
13097 self
13098 }
13099}
13100
13101/// Gets details of a single Rollout.
13102///
13103/// A builder for the *locations.deliveryPipelines.releases.rollouts.get* method supported by a *project* resource.
13104/// It is not used directly, but through a [`ProjectMethods`] instance.
13105///
13106/// # Example
13107///
13108/// Instantiate a resource method builder
13109///
13110/// ```test_harness,no_run
13111/// # extern crate hyper;
13112/// # extern crate hyper_rustls;
13113/// # extern crate google_clouddeploy1 as clouddeploy1;
13114/// # async fn dox() {
13115/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13116///
13117/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13118/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13119/// # .with_native_roots()
13120/// # .unwrap()
13121/// # .https_only()
13122/// # .enable_http2()
13123/// # .build();
13124///
13125/// # let executor = hyper_util::rt::TokioExecutor::new();
13126/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13127/// # secret,
13128/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13129/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13130/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13131/// # ),
13132/// # ).build().await.unwrap();
13133///
13134/// # let client = hyper_util::client::legacy::Client::builder(
13135/// # hyper_util::rt::TokioExecutor::new()
13136/// # )
13137/// # .build(
13138/// # hyper_rustls::HttpsConnectorBuilder::new()
13139/// # .with_native_roots()
13140/// # .unwrap()
13141/// # .https_or_http()
13142/// # .enable_http2()
13143/// # .build()
13144/// # );
13145/// # let mut hub = CloudDeploy::new(client, auth);
13146/// // You can configure optional parameters by calling the respective setters at will, and
13147/// // execute the final call using `doit()`.
13148/// // Values shown here are possibly random and not representative !
13149/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_get("name")
13150/// .doit().await;
13151/// # }
13152/// ```
13153pub struct ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
13154where
13155 C: 'a,
13156{
13157 hub: &'a CloudDeploy<C>,
13158 _name: String,
13159 _delegate: Option<&'a mut dyn common::Delegate>,
13160 _additional_params: HashMap<String, String>,
13161 _scopes: BTreeSet<String>,
13162}
13163
13164impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {}
13165
13166impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
13167where
13168 C: common::Connector,
13169{
13170 /// Perform the operation you have build so far.
13171 pub async fn doit(mut self) -> common::Result<(common::Response, Rollout)> {
13172 use std::borrow::Cow;
13173 use std::io::{Read, Seek};
13174
13175 use common::{url::Params, ToParts};
13176 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13177
13178 let mut dd = common::DefaultDelegate;
13179 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13180 dlg.begin(common::MethodInfo {
13181 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.get",
13182 http_method: hyper::Method::GET,
13183 });
13184
13185 for &field in ["alt", "name"].iter() {
13186 if self._additional_params.contains_key(field) {
13187 dlg.finished(false);
13188 return Err(common::Error::FieldClash(field));
13189 }
13190 }
13191
13192 let mut params = Params::with_capacity(3 + self._additional_params.len());
13193 params.push("name", self._name);
13194
13195 params.extend(self._additional_params.iter());
13196
13197 params.push("alt", "json");
13198 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13199 if self._scopes.is_empty() {
13200 self._scopes
13201 .insert(Scope::CloudPlatform.as_ref().to_string());
13202 }
13203
13204 #[allow(clippy::single_element_loop)]
13205 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13206 url = params.uri_replacement(url, param_name, find_this, true);
13207 }
13208 {
13209 let to_remove = ["name"];
13210 params.remove_params(&to_remove);
13211 }
13212
13213 let url = params.parse_with_url(&url);
13214
13215 loop {
13216 let token = match self
13217 .hub
13218 .auth
13219 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13220 .await
13221 {
13222 Ok(token) => token,
13223 Err(e) => match dlg.token(e) {
13224 Ok(token) => token,
13225 Err(e) => {
13226 dlg.finished(false);
13227 return Err(common::Error::MissingToken(e));
13228 }
13229 },
13230 };
13231 let mut req_result = {
13232 let client = &self.hub.client;
13233 dlg.pre_request();
13234 let mut req_builder = hyper::Request::builder()
13235 .method(hyper::Method::GET)
13236 .uri(url.as_str())
13237 .header(USER_AGENT, self.hub._user_agent.clone());
13238
13239 if let Some(token) = token.as_ref() {
13240 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13241 }
13242
13243 let request = req_builder
13244 .header(CONTENT_LENGTH, 0_u64)
13245 .body(common::to_body::<String>(None));
13246
13247 client.request(request.unwrap()).await
13248 };
13249
13250 match req_result {
13251 Err(err) => {
13252 if let common::Retry::After(d) = dlg.http_error(&err) {
13253 sleep(d).await;
13254 continue;
13255 }
13256 dlg.finished(false);
13257 return Err(common::Error::HttpError(err));
13258 }
13259 Ok(res) => {
13260 let (mut parts, body) = res.into_parts();
13261 let mut body = common::Body::new(body);
13262 if !parts.status.is_success() {
13263 let bytes = common::to_bytes(body).await.unwrap_or_default();
13264 let error = serde_json::from_str(&common::to_string(&bytes));
13265 let response = common::to_response(parts, bytes.into());
13266
13267 if let common::Retry::After(d) =
13268 dlg.http_failure(&response, error.as_ref().ok())
13269 {
13270 sleep(d).await;
13271 continue;
13272 }
13273
13274 dlg.finished(false);
13275
13276 return Err(match error {
13277 Ok(value) => common::Error::BadRequest(value),
13278 _ => common::Error::Failure(response),
13279 });
13280 }
13281 let response = {
13282 let bytes = common::to_bytes(body).await.unwrap_or_default();
13283 let encoded = common::to_string(&bytes);
13284 match serde_json::from_str(&encoded) {
13285 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13286 Err(error) => {
13287 dlg.response_json_decode_error(&encoded, &error);
13288 return Err(common::Error::JsonDecodeError(
13289 encoded.to_string(),
13290 error,
13291 ));
13292 }
13293 }
13294 };
13295
13296 dlg.finished(true);
13297 return Ok(response);
13298 }
13299 }
13300 }
13301 }
13302
13303 /// Required. Name of the `Rollout`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}/rollouts/{rollout_name}`.
13304 ///
13305 /// Sets the *name* path property to the given value.
13306 ///
13307 /// Even though the property as already been set when instantiating this call,
13308 /// we provide this method for API completeness.
13309 pub fn name(
13310 mut self,
13311 new_value: &str,
13312 ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
13313 self._name = new_value.to_string();
13314 self
13315 }
13316 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13317 /// while executing the actual API request.
13318 ///
13319 /// ````text
13320 /// It should be used to handle progress information, and to implement a certain level of resilience.
13321 /// ````
13322 ///
13323 /// Sets the *delegate* property to the given value.
13324 pub fn delegate(
13325 mut self,
13326 new_value: &'a mut dyn common::Delegate,
13327 ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
13328 self._delegate = Some(new_value);
13329 self
13330 }
13331
13332 /// Set any additional parameter of the query string used in the request.
13333 /// It should be used to set parameters which are not yet available through their own
13334 /// setters.
13335 ///
13336 /// Please note that this method must not be used to set any of the known parameters
13337 /// which have their own setter method. If done anyway, the request will fail.
13338 ///
13339 /// # Additional Parameters
13340 ///
13341 /// * *$.xgafv* (query-string) - V1 error format.
13342 /// * *access_token* (query-string) - OAuth access token.
13343 /// * *alt* (query-string) - Data format for response.
13344 /// * *callback* (query-string) - JSONP
13345 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13346 /// * *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.
13347 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13348 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13349 /// * *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.
13350 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13351 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13352 pub fn param<T>(
13353 mut self,
13354 name: T,
13355 value: T,
13356 ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
13357 where
13358 T: AsRef<str>,
13359 {
13360 self._additional_params
13361 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13362 self
13363 }
13364
13365 /// Identifies the authorization scope for the method you are building.
13366 ///
13367 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13368 /// [`Scope::CloudPlatform`].
13369 ///
13370 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13371 /// tokens for more than one scope.
13372 ///
13373 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13374 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13375 /// sufficient, a read-write scope will do as well.
13376 pub fn add_scope<St>(
13377 mut self,
13378 scope: St,
13379 ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
13380 where
13381 St: AsRef<str>,
13382 {
13383 self._scopes.insert(String::from(scope.as_ref()));
13384 self
13385 }
13386 /// Identifies the authorization scope(s) for the method you are building.
13387 ///
13388 /// See [`Self::add_scope()`] for details.
13389 pub fn add_scopes<I, St>(
13390 mut self,
13391 scopes: I,
13392 ) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C>
13393 where
13394 I: IntoIterator<Item = St>,
13395 St: AsRef<str>,
13396 {
13397 self._scopes
13398 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13399 self
13400 }
13401
13402 /// Removes all scopes, and no default scope will be used either.
13403 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13404 /// for details).
13405 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseRolloutGetCall<'a, C> {
13406 self._scopes.clear();
13407 self
13408 }
13409}
13410
13411/// Ignores the specified Job in a Rollout.
13412///
13413/// A builder for the *locations.deliveryPipelines.releases.rollouts.ignoreJob* method supported by a *project* resource.
13414/// It is not used directly, but through a [`ProjectMethods`] instance.
13415///
13416/// # Example
13417///
13418/// Instantiate a resource method builder
13419///
13420/// ```test_harness,no_run
13421/// # extern crate hyper;
13422/// # extern crate hyper_rustls;
13423/// # extern crate google_clouddeploy1 as clouddeploy1;
13424/// use clouddeploy1::api::IgnoreJobRequest;
13425/// # async fn dox() {
13426/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13427///
13428/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13429/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13430/// # .with_native_roots()
13431/// # .unwrap()
13432/// # .https_only()
13433/// # .enable_http2()
13434/// # .build();
13435///
13436/// # let executor = hyper_util::rt::TokioExecutor::new();
13437/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13438/// # secret,
13439/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13440/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13441/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13442/// # ),
13443/// # ).build().await.unwrap();
13444///
13445/// # let client = hyper_util::client::legacy::Client::builder(
13446/// # hyper_util::rt::TokioExecutor::new()
13447/// # )
13448/// # .build(
13449/// # hyper_rustls::HttpsConnectorBuilder::new()
13450/// # .with_native_roots()
13451/// # .unwrap()
13452/// # .https_or_http()
13453/// # .enable_http2()
13454/// # .build()
13455/// # );
13456/// # let mut hub = CloudDeploy::new(client, auth);
13457/// // As the method needs a request, you would usually fill it with the desired information
13458/// // into the respective structure. Some of the parts shown here might not be applicable !
13459/// // Values shown here are possibly random and not representative !
13460/// let mut req = IgnoreJobRequest::default();
13461///
13462/// // You can configure optional parameters by calling the respective setters at will, and
13463/// // execute the final call using `doit()`.
13464/// // Values shown here are possibly random and not representative !
13465/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_ignore_job(req, "rollout")
13466/// .doit().await;
13467/// # }
13468/// ```
13469pub struct ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
13470where
13471 C: 'a,
13472{
13473 hub: &'a CloudDeploy<C>,
13474 _request: IgnoreJobRequest,
13475 _rollout: String,
13476 _delegate: Option<&'a mut dyn common::Delegate>,
13477 _additional_params: HashMap<String, String>,
13478 _scopes: BTreeSet<String>,
13479}
13480
13481impl<'a, C> common::CallBuilder
13482 for ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
13483{
13484}
13485
13486impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
13487where
13488 C: common::Connector,
13489{
13490 /// Perform the operation you have build so far.
13491 pub async fn doit(mut self) -> common::Result<(common::Response, IgnoreJobResponse)> {
13492 use std::borrow::Cow;
13493 use std::io::{Read, Seek};
13494
13495 use common::{url::Params, ToParts};
13496 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13497
13498 let mut dd = common::DefaultDelegate;
13499 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13500 dlg.begin(common::MethodInfo {
13501 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.ignoreJob",
13502 http_method: hyper::Method::POST,
13503 });
13504
13505 for &field in ["alt", "rollout"].iter() {
13506 if self._additional_params.contains_key(field) {
13507 dlg.finished(false);
13508 return Err(common::Error::FieldClash(field));
13509 }
13510 }
13511
13512 let mut params = Params::with_capacity(4 + self._additional_params.len());
13513 params.push("rollout", self._rollout);
13514
13515 params.extend(self._additional_params.iter());
13516
13517 params.push("alt", "json");
13518 let mut url = self.hub._base_url.clone() + "v1/{+rollout}:ignoreJob";
13519 if self._scopes.is_empty() {
13520 self._scopes
13521 .insert(Scope::CloudPlatform.as_ref().to_string());
13522 }
13523
13524 #[allow(clippy::single_element_loop)]
13525 for &(find_this, param_name) in [("{+rollout}", "rollout")].iter() {
13526 url = params.uri_replacement(url, param_name, find_this, true);
13527 }
13528 {
13529 let to_remove = ["rollout"];
13530 params.remove_params(&to_remove);
13531 }
13532
13533 let url = params.parse_with_url(&url);
13534
13535 let mut json_mime_type = mime::APPLICATION_JSON;
13536 let mut request_value_reader = {
13537 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13538 common::remove_json_null_values(&mut value);
13539 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13540 serde_json::to_writer(&mut dst, &value).unwrap();
13541 dst
13542 };
13543 let request_size = request_value_reader
13544 .seek(std::io::SeekFrom::End(0))
13545 .unwrap();
13546 request_value_reader
13547 .seek(std::io::SeekFrom::Start(0))
13548 .unwrap();
13549
13550 loop {
13551 let token = match self
13552 .hub
13553 .auth
13554 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13555 .await
13556 {
13557 Ok(token) => token,
13558 Err(e) => match dlg.token(e) {
13559 Ok(token) => token,
13560 Err(e) => {
13561 dlg.finished(false);
13562 return Err(common::Error::MissingToken(e));
13563 }
13564 },
13565 };
13566 request_value_reader
13567 .seek(std::io::SeekFrom::Start(0))
13568 .unwrap();
13569 let mut req_result = {
13570 let client = &self.hub.client;
13571 dlg.pre_request();
13572 let mut req_builder = hyper::Request::builder()
13573 .method(hyper::Method::POST)
13574 .uri(url.as_str())
13575 .header(USER_AGENT, self.hub._user_agent.clone());
13576
13577 if let Some(token) = token.as_ref() {
13578 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13579 }
13580
13581 let request = req_builder
13582 .header(CONTENT_TYPE, json_mime_type.to_string())
13583 .header(CONTENT_LENGTH, request_size as u64)
13584 .body(common::to_body(
13585 request_value_reader.get_ref().clone().into(),
13586 ));
13587
13588 client.request(request.unwrap()).await
13589 };
13590
13591 match req_result {
13592 Err(err) => {
13593 if let common::Retry::After(d) = dlg.http_error(&err) {
13594 sleep(d).await;
13595 continue;
13596 }
13597 dlg.finished(false);
13598 return Err(common::Error::HttpError(err));
13599 }
13600 Ok(res) => {
13601 let (mut parts, body) = res.into_parts();
13602 let mut body = common::Body::new(body);
13603 if !parts.status.is_success() {
13604 let bytes = common::to_bytes(body).await.unwrap_or_default();
13605 let error = serde_json::from_str(&common::to_string(&bytes));
13606 let response = common::to_response(parts, bytes.into());
13607
13608 if let common::Retry::After(d) =
13609 dlg.http_failure(&response, error.as_ref().ok())
13610 {
13611 sleep(d).await;
13612 continue;
13613 }
13614
13615 dlg.finished(false);
13616
13617 return Err(match error {
13618 Ok(value) => common::Error::BadRequest(value),
13619 _ => common::Error::Failure(response),
13620 });
13621 }
13622 let response = {
13623 let bytes = common::to_bytes(body).await.unwrap_or_default();
13624 let encoded = common::to_string(&bytes);
13625 match serde_json::from_str(&encoded) {
13626 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13627 Err(error) => {
13628 dlg.response_json_decode_error(&encoded, &error);
13629 return Err(common::Error::JsonDecodeError(
13630 encoded.to_string(),
13631 error,
13632 ));
13633 }
13634 }
13635 };
13636
13637 dlg.finished(true);
13638 return Ok(response);
13639 }
13640 }
13641 }
13642 }
13643
13644 ///
13645 /// Sets the *request* property to the given value.
13646 ///
13647 /// Even though the property as already been set when instantiating this call,
13648 /// we provide this method for API completeness.
13649 pub fn request(
13650 mut self,
13651 new_value: IgnoreJobRequest,
13652 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
13653 self._request = new_value;
13654 self
13655 }
13656 /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
13657 ///
13658 /// Sets the *rollout* path property to the given value.
13659 ///
13660 /// Even though the property as already been set when instantiating this call,
13661 /// we provide this method for API completeness.
13662 pub fn rollout(
13663 mut self,
13664 new_value: &str,
13665 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
13666 self._rollout = new_value.to_string();
13667 self
13668 }
13669 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13670 /// while executing the actual API request.
13671 ///
13672 /// ````text
13673 /// It should be used to handle progress information, and to implement a certain level of resilience.
13674 /// ````
13675 ///
13676 /// Sets the *delegate* property to the given value.
13677 pub fn delegate(
13678 mut self,
13679 new_value: &'a mut dyn common::Delegate,
13680 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
13681 self._delegate = Some(new_value);
13682 self
13683 }
13684
13685 /// Set any additional parameter of the query string used in the request.
13686 /// It should be used to set parameters which are not yet available through their own
13687 /// setters.
13688 ///
13689 /// Please note that this method must not be used to set any of the known parameters
13690 /// which have their own setter method. If done anyway, the request will fail.
13691 ///
13692 /// # Additional Parameters
13693 ///
13694 /// * *$.xgafv* (query-string) - V1 error format.
13695 /// * *access_token* (query-string) - OAuth access token.
13696 /// * *alt* (query-string) - Data format for response.
13697 /// * *callback* (query-string) - JSONP
13698 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13699 /// * *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.
13700 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13701 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13702 /// * *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.
13703 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13704 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13705 pub fn param<T>(
13706 mut self,
13707 name: T,
13708 value: T,
13709 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
13710 where
13711 T: AsRef<str>,
13712 {
13713 self._additional_params
13714 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13715 self
13716 }
13717
13718 /// Identifies the authorization scope for the method you are building.
13719 ///
13720 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13721 /// [`Scope::CloudPlatform`].
13722 ///
13723 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13724 /// tokens for more than one scope.
13725 ///
13726 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13727 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13728 /// sufficient, a read-write scope will do as well.
13729 pub fn add_scope<St>(
13730 mut self,
13731 scope: St,
13732 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
13733 where
13734 St: AsRef<str>,
13735 {
13736 self._scopes.insert(String::from(scope.as_ref()));
13737 self
13738 }
13739 /// Identifies the authorization scope(s) for the method you are building.
13740 ///
13741 /// See [`Self::add_scope()`] for details.
13742 pub fn add_scopes<I, St>(
13743 mut self,
13744 scopes: I,
13745 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C>
13746 where
13747 I: IntoIterator<Item = St>,
13748 St: AsRef<str>,
13749 {
13750 self._scopes
13751 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13752 self
13753 }
13754
13755 /// Removes all scopes, and no default scope will be used either.
13756 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13757 /// for details).
13758 pub fn clear_scopes(
13759 mut self,
13760 ) -> ProjectLocationDeliveryPipelineReleaseRolloutIgnoreJobCall<'a, C> {
13761 self._scopes.clear();
13762 self
13763 }
13764}
13765
13766/// Lists Rollouts in a given project and location.
13767///
13768/// A builder for the *locations.deliveryPipelines.releases.rollouts.list* method supported by a *project* resource.
13769/// It is not used directly, but through a [`ProjectMethods`] instance.
13770///
13771/// # Example
13772///
13773/// Instantiate a resource method builder
13774///
13775/// ```test_harness,no_run
13776/// # extern crate hyper;
13777/// # extern crate hyper_rustls;
13778/// # extern crate google_clouddeploy1 as clouddeploy1;
13779/// # async fn dox() {
13780/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13781///
13782/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13783/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13784/// # .with_native_roots()
13785/// # .unwrap()
13786/// # .https_only()
13787/// # .enable_http2()
13788/// # .build();
13789///
13790/// # let executor = hyper_util::rt::TokioExecutor::new();
13791/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13792/// # secret,
13793/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13794/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13795/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13796/// # ),
13797/// # ).build().await.unwrap();
13798///
13799/// # let client = hyper_util::client::legacy::Client::builder(
13800/// # hyper_util::rt::TokioExecutor::new()
13801/// # )
13802/// # .build(
13803/// # hyper_rustls::HttpsConnectorBuilder::new()
13804/// # .with_native_roots()
13805/// # .unwrap()
13806/// # .https_or_http()
13807/// # .enable_http2()
13808/// # .build()
13809/// # );
13810/// # let mut hub = CloudDeploy::new(client, auth);
13811/// // You can configure optional parameters by calling the respective setters at will, and
13812/// // execute the final call using `doit()`.
13813/// // Values shown here are possibly random and not representative !
13814/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_list("parent")
13815/// .page_token("Lorem")
13816/// .page_size(-38)
13817/// .order_by("no")
13818/// .filter("est")
13819/// .doit().await;
13820/// # }
13821/// ```
13822pub struct ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
13823where
13824 C: 'a,
13825{
13826 hub: &'a CloudDeploy<C>,
13827 _parent: String,
13828 _page_token: Option<String>,
13829 _page_size: Option<i32>,
13830 _order_by: Option<String>,
13831 _filter: 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 ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {}
13838
13839impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'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, ListRolloutsResponse)> {
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.rollouts.list",
13855 http_method: hyper::Method::GET,
13856 });
13857
13858 for &field in [
13859 "alt",
13860 "parent",
13861 "pageToken",
13862 "pageSize",
13863 "orderBy",
13864 "filter",
13865 ]
13866 .iter()
13867 {
13868 if self._additional_params.contains_key(field) {
13869 dlg.finished(false);
13870 return Err(common::Error::FieldClash(field));
13871 }
13872 }
13873
13874 let mut params = Params::with_capacity(7 + self._additional_params.len());
13875 params.push("parent", self._parent);
13876 if let Some(value) = self._page_token.as_ref() {
13877 params.push("pageToken", value);
13878 }
13879 if let Some(value) = self._page_size.as_ref() {
13880 params.push("pageSize", value.to_string());
13881 }
13882 if let Some(value) = self._order_by.as_ref() {
13883 params.push("orderBy", value);
13884 }
13885 if let Some(value) = self._filter.as_ref() {
13886 params.push("filter", value);
13887 }
13888
13889 params.extend(self._additional_params.iter());
13890
13891 params.push("alt", "json");
13892 let mut url = self.hub._base_url.clone() + "v1/{+parent}/rollouts";
13893 if self._scopes.is_empty() {
13894 self._scopes
13895 .insert(Scope::CloudPlatform.as_ref().to_string());
13896 }
13897
13898 #[allow(clippy::single_element_loop)]
13899 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13900 url = params.uri_replacement(url, param_name, find_this, true);
13901 }
13902 {
13903 let to_remove = ["parent"];
13904 params.remove_params(&to_remove);
13905 }
13906
13907 let url = params.parse_with_url(&url);
13908
13909 loop {
13910 let token = match self
13911 .hub
13912 .auth
13913 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13914 .await
13915 {
13916 Ok(token) => token,
13917 Err(e) => match dlg.token(e) {
13918 Ok(token) => token,
13919 Err(e) => {
13920 dlg.finished(false);
13921 return Err(common::Error::MissingToken(e));
13922 }
13923 },
13924 };
13925 let mut req_result = {
13926 let client = &self.hub.client;
13927 dlg.pre_request();
13928 let mut req_builder = hyper::Request::builder()
13929 .method(hyper::Method::GET)
13930 .uri(url.as_str())
13931 .header(USER_AGENT, self.hub._user_agent.clone());
13932
13933 if let Some(token) = token.as_ref() {
13934 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13935 }
13936
13937 let request = req_builder
13938 .header(CONTENT_LENGTH, 0_u64)
13939 .body(common::to_body::<String>(None));
13940
13941 client.request(request.unwrap()).await
13942 };
13943
13944 match req_result {
13945 Err(err) => {
13946 if let common::Retry::After(d) = dlg.http_error(&err) {
13947 sleep(d).await;
13948 continue;
13949 }
13950 dlg.finished(false);
13951 return Err(common::Error::HttpError(err));
13952 }
13953 Ok(res) => {
13954 let (mut parts, body) = res.into_parts();
13955 let mut body = common::Body::new(body);
13956 if !parts.status.is_success() {
13957 let bytes = common::to_bytes(body).await.unwrap_or_default();
13958 let error = serde_json::from_str(&common::to_string(&bytes));
13959 let response = common::to_response(parts, bytes.into());
13960
13961 if let common::Retry::After(d) =
13962 dlg.http_failure(&response, error.as_ref().ok())
13963 {
13964 sleep(d).await;
13965 continue;
13966 }
13967
13968 dlg.finished(false);
13969
13970 return Err(match error {
13971 Ok(value) => common::Error::BadRequest(value),
13972 _ => common::Error::Failure(response),
13973 });
13974 }
13975 let response = {
13976 let bytes = common::to_bytes(body).await.unwrap_or_default();
13977 let encoded = common::to_string(&bytes);
13978 match serde_json::from_str(&encoded) {
13979 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13980 Err(error) => {
13981 dlg.response_json_decode_error(&encoded, &error);
13982 return Err(common::Error::JsonDecodeError(
13983 encoded.to_string(),
13984 error,
13985 ));
13986 }
13987 }
13988 };
13989
13990 dlg.finished(true);
13991 return Ok(response);
13992 }
13993 }
13994 }
13995 }
13996
13997 /// Required. The `Release` which owns this collection of `Rollout` objects.
13998 ///
13999 /// Sets the *parent* path property to the given value.
14000 ///
14001 /// Even though the property as already been set when instantiating this call,
14002 /// we provide this method for API completeness.
14003 pub fn parent(
14004 mut self,
14005 new_value: &str,
14006 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
14007 self._parent = new_value.to_string();
14008 self
14009 }
14010 /// 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.
14011 ///
14012 /// Sets the *page token* query property to the given value.
14013 pub fn page_token(
14014 mut self,
14015 new_value: &str,
14016 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
14017 self._page_token = Some(new_value.to_string());
14018 self
14019 }
14020 /// 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.
14021 ///
14022 /// Sets the *page size* query property to the given value.
14023 pub fn page_size(
14024 mut self,
14025 new_value: i32,
14026 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
14027 self._page_size = Some(new_value);
14028 self
14029 }
14030 /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
14031 ///
14032 /// Sets the *order by* query property to the given value.
14033 pub fn order_by(
14034 mut self,
14035 new_value: &str,
14036 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
14037 self._order_by = Some(new_value.to_string());
14038 self
14039 }
14040 /// Optional. Filter rollouts to be returned. See https://google.aip.dev/160 for more details.
14041 ///
14042 /// Sets the *filter* query property to the given value.
14043 pub fn filter(
14044 mut self,
14045 new_value: &str,
14046 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
14047 self._filter = Some(new_value.to_string());
14048 self
14049 }
14050 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14051 /// while executing the actual API request.
14052 ///
14053 /// ````text
14054 /// It should be used to handle progress information, and to implement a certain level of resilience.
14055 /// ````
14056 ///
14057 /// Sets the *delegate* property to the given value.
14058 pub fn delegate(
14059 mut self,
14060 new_value: &'a mut dyn common::Delegate,
14061 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
14062 self._delegate = Some(new_value);
14063 self
14064 }
14065
14066 /// Set any additional parameter of the query string used in the request.
14067 /// It should be used to set parameters which are not yet available through their own
14068 /// setters.
14069 ///
14070 /// Please note that this method must not be used to set any of the known parameters
14071 /// which have their own setter method. If done anyway, the request will fail.
14072 ///
14073 /// # Additional Parameters
14074 ///
14075 /// * *$.xgafv* (query-string) - V1 error format.
14076 /// * *access_token* (query-string) - OAuth access token.
14077 /// * *alt* (query-string) - Data format for response.
14078 /// * *callback* (query-string) - JSONP
14079 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14080 /// * *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.
14081 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14082 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14083 /// * *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.
14084 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14085 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14086 pub fn param<T>(
14087 mut self,
14088 name: T,
14089 value: T,
14090 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
14091 where
14092 T: AsRef<str>,
14093 {
14094 self._additional_params
14095 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14096 self
14097 }
14098
14099 /// Identifies the authorization scope for the method you are building.
14100 ///
14101 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14102 /// [`Scope::CloudPlatform`].
14103 ///
14104 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14105 /// tokens for more than one scope.
14106 ///
14107 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14108 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14109 /// sufficient, a read-write scope will do as well.
14110 pub fn add_scope<St>(
14111 mut self,
14112 scope: St,
14113 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
14114 where
14115 St: AsRef<str>,
14116 {
14117 self._scopes.insert(String::from(scope.as_ref()));
14118 self
14119 }
14120 /// Identifies the authorization scope(s) for the method you are building.
14121 ///
14122 /// See [`Self::add_scope()`] for details.
14123 pub fn add_scopes<I, St>(
14124 mut self,
14125 scopes: I,
14126 ) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C>
14127 where
14128 I: IntoIterator<Item = St>,
14129 St: AsRef<str>,
14130 {
14131 self._scopes
14132 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14133 self
14134 }
14135
14136 /// Removes all scopes, and no default scope will be used either.
14137 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14138 /// for details).
14139 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseRolloutListCall<'a, C> {
14140 self._scopes.clear();
14141 self
14142 }
14143}
14144
14145/// Retries the specified Job in a Rollout.
14146///
14147/// A builder for the *locations.deliveryPipelines.releases.rollouts.retryJob* method supported by a *project* resource.
14148/// It is not used directly, but through a [`ProjectMethods`] instance.
14149///
14150/// # Example
14151///
14152/// Instantiate a resource method builder
14153///
14154/// ```test_harness,no_run
14155/// # extern crate hyper;
14156/// # extern crate hyper_rustls;
14157/// # extern crate google_clouddeploy1 as clouddeploy1;
14158/// use clouddeploy1::api::RetryJobRequest;
14159/// # async fn dox() {
14160/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14161///
14162/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14163/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14164/// # .with_native_roots()
14165/// # .unwrap()
14166/// # .https_only()
14167/// # .enable_http2()
14168/// # .build();
14169///
14170/// # let executor = hyper_util::rt::TokioExecutor::new();
14171/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14172/// # secret,
14173/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14174/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14175/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14176/// # ),
14177/// # ).build().await.unwrap();
14178///
14179/// # let client = hyper_util::client::legacy::Client::builder(
14180/// # hyper_util::rt::TokioExecutor::new()
14181/// # )
14182/// # .build(
14183/// # hyper_rustls::HttpsConnectorBuilder::new()
14184/// # .with_native_roots()
14185/// # .unwrap()
14186/// # .https_or_http()
14187/// # .enable_http2()
14188/// # .build()
14189/// # );
14190/// # let mut hub = CloudDeploy::new(client, auth);
14191/// // As the method needs a request, you would usually fill it with the desired information
14192/// // into the respective structure. Some of the parts shown here might not be applicable !
14193/// // Values shown here are possibly random and not representative !
14194/// let mut req = RetryJobRequest::default();
14195///
14196/// // You can configure optional parameters by calling the respective setters at will, and
14197/// // execute the final call using `doit()`.
14198/// // Values shown here are possibly random and not representative !
14199/// let result = hub.projects().locations_delivery_pipelines_releases_rollouts_retry_job(req, "rollout")
14200/// .doit().await;
14201/// # }
14202/// ```
14203pub struct ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
14204where
14205 C: 'a,
14206{
14207 hub: &'a CloudDeploy<C>,
14208 _request: RetryJobRequest,
14209 _rollout: String,
14210 _delegate: Option<&'a mut dyn common::Delegate>,
14211 _additional_params: HashMap<String, String>,
14212 _scopes: BTreeSet<String>,
14213}
14214
14215impl<'a, C> common::CallBuilder
14216 for ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
14217{
14218}
14219
14220impl<'a, C> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
14221where
14222 C: common::Connector,
14223{
14224 /// Perform the operation you have build so far.
14225 pub async fn doit(mut self) -> common::Result<(common::Response, RetryJobResponse)> {
14226 use std::borrow::Cow;
14227 use std::io::{Read, Seek};
14228
14229 use common::{url::Params, ToParts};
14230 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14231
14232 let mut dd = common::DefaultDelegate;
14233 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14234 dlg.begin(common::MethodInfo {
14235 id: "clouddeploy.projects.locations.deliveryPipelines.releases.rollouts.retryJob",
14236 http_method: hyper::Method::POST,
14237 });
14238
14239 for &field in ["alt", "rollout"].iter() {
14240 if self._additional_params.contains_key(field) {
14241 dlg.finished(false);
14242 return Err(common::Error::FieldClash(field));
14243 }
14244 }
14245
14246 let mut params = Params::with_capacity(4 + self._additional_params.len());
14247 params.push("rollout", self._rollout);
14248
14249 params.extend(self._additional_params.iter());
14250
14251 params.push("alt", "json");
14252 let mut url = self.hub._base_url.clone() + "v1/{+rollout}:retryJob";
14253 if self._scopes.is_empty() {
14254 self._scopes
14255 .insert(Scope::CloudPlatform.as_ref().to_string());
14256 }
14257
14258 #[allow(clippy::single_element_loop)]
14259 for &(find_this, param_name) in [("{+rollout}", "rollout")].iter() {
14260 url = params.uri_replacement(url, param_name, find_this, true);
14261 }
14262 {
14263 let to_remove = ["rollout"];
14264 params.remove_params(&to_remove);
14265 }
14266
14267 let url = params.parse_with_url(&url);
14268
14269 let mut json_mime_type = mime::APPLICATION_JSON;
14270 let mut request_value_reader = {
14271 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14272 common::remove_json_null_values(&mut value);
14273 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14274 serde_json::to_writer(&mut dst, &value).unwrap();
14275 dst
14276 };
14277 let request_size = request_value_reader
14278 .seek(std::io::SeekFrom::End(0))
14279 .unwrap();
14280 request_value_reader
14281 .seek(std::io::SeekFrom::Start(0))
14282 .unwrap();
14283
14284 loop {
14285 let token = match self
14286 .hub
14287 .auth
14288 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14289 .await
14290 {
14291 Ok(token) => token,
14292 Err(e) => match dlg.token(e) {
14293 Ok(token) => token,
14294 Err(e) => {
14295 dlg.finished(false);
14296 return Err(common::Error::MissingToken(e));
14297 }
14298 },
14299 };
14300 request_value_reader
14301 .seek(std::io::SeekFrom::Start(0))
14302 .unwrap();
14303 let mut req_result = {
14304 let client = &self.hub.client;
14305 dlg.pre_request();
14306 let mut req_builder = hyper::Request::builder()
14307 .method(hyper::Method::POST)
14308 .uri(url.as_str())
14309 .header(USER_AGENT, self.hub._user_agent.clone());
14310
14311 if let Some(token) = token.as_ref() {
14312 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14313 }
14314
14315 let request = req_builder
14316 .header(CONTENT_TYPE, json_mime_type.to_string())
14317 .header(CONTENT_LENGTH, request_size as u64)
14318 .body(common::to_body(
14319 request_value_reader.get_ref().clone().into(),
14320 ));
14321
14322 client.request(request.unwrap()).await
14323 };
14324
14325 match req_result {
14326 Err(err) => {
14327 if let common::Retry::After(d) = dlg.http_error(&err) {
14328 sleep(d).await;
14329 continue;
14330 }
14331 dlg.finished(false);
14332 return Err(common::Error::HttpError(err));
14333 }
14334 Ok(res) => {
14335 let (mut parts, body) = res.into_parts();
14336 let mut body = common::Body::new(body);
14337 if !parts.status.is_success() {
14338 let bytes = common::to_bytes(body).await.unwrap_or_default();
14339 let error = serde_json::from_str(&common::to_string(&bytes));
14340 let response = common::to_response(parts, bytes.into());
14341
14342 if let common::Retry::After(d) =
14343 dlg.http_failure(&response, error.as_ref().ok())
14344 {
14345 sleep(d).await;
14346 continue;
14347 }
14348
14349 dlg.finished(false);
14350
14351 return Err(match error {
14352 Ok(value) => common::Error::BadRequest(value),
14353 _ => common::Error::Failure(response),
14354 });
14355 }
14356 let response = {
14357 let bytes = common::to_bytes(body).await.unwrap_or_default();
14358 let encoded = common::to_string(&bytes);
14359 match serde_json::from_str(&encoded) {
14360 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14361 Err(error) => {
14362 dlg.response_json_decode_error(&encoded, &error);
14363 return Err(common::Error::JsonDecodeError(
14364 encoded.to_string(),
14365 error,
14366 ));
14367 }
14368 }
14369 };
14370
14371 dlg.finished(true);
14372 return Ok(response);
14373 }
14374 }
14375 }
14376 }
14377
14378 ///
14379 /// Sets the *request* property to the given value.
14380 ///
14381 /// Even though the property as already been set when instantiating this call,
14382 /// we provide this method for API completeness.
14383 pub fn request(
14384 mut self,
14385 new_value: RetryJobRequest,
14386 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
14387 self._request = new_value;
14388 self
14389 }
14390 /// Required. Name of the Rollout. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}/rollouts/{rollout}`.
14391 ///
14392 /// Sets the *rollout* path property to the given value.
14393 ///
14394 /// Even though the property as already been set when instantiating this call,
14395 /// we provide this method for API completeness.
14396 pub fn rollout(
14397 mut self,
14398 new_value: &str,
14399 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
14400 self._rollout = new_value.to_string();
14401 self
14402 }
14403 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14404 /// while executing the actual API request.
14405 ///
14406 /// ````text
14407 /// It should be used to handle progress information, and to implement a certain level of resilience.
14408 /// ````
14409 ///
14410 /// Sets the *delegate* property to the given value.
14411 pub fn delegate(
14412 mut self,
14413 new_value: &'a mut dyn common::Delegate,
14414 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
14415 self._delegate = Some(new_value);
14416 self
14417 }
14418
14419 /// Set any additional parameter of the query string used in the request.
14420 /// It should be used to set parameters which are not yet available through their own
14421 /// setters.
14422 ///
14423 /// Please note that this method must not be used to set any of the known parameters
14424 /// which have their own setter method. If done anyway, the request will fail.
14425 ///
14426 /// # Additional Parameters
14427 ///
14428 /// * *$.xgafv* (query-string) - V1 error format.
14429 /// * *access_token* (query-string) - OAuth access token.
14430 /// * *alt* (query-string) - Data format for response.
14431 /// * *callback* (query-string) - JSONP
14432 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14433 /// * *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.
14434 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14435 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14436 /// * *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.
14437 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14438 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14439 pub fn param<T>(
14440 mut self,
14441 name: T,
14442 value: T,
14443 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
14444 where
14445 T: AsRef<str>,
14446 {
14447 self._additional_params
14448 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14449 self
14450 }
14451
14452 /// Identifies the authorization scope for the method you are building.
14453 ///
14454 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14455 /// [`Scope::CloudPlatform`].
14456 ///
14457 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14458 /// tokens for more than one scope.
14459 ///
14460 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14461 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14462 /// sufficient, a read-write scope will do as well.
14463 pub fn add_scope<St>(
14464 mut self,
14465 scope: St,
14466 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
14467 where
14468 St: AsRef<str>,
14469 {
14470 self._scopes.insert(String::from(scope.as_ref()));
14471 self
14472 }
14473 /// Identifies the authorization scope(s) for the method you are building.
14474 ///
14475 /// See [`Self::add_scope()`] for details.
14476 pub fn add_scopes<I, St>(
14477 mut self,
14478 scopes: I,
14479 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C>
14480 where
14481 I: IntoIterator<Item = St>,
14482 St: AsRef<str>,
14483 {
14484 self._scopes
14485 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14486 self
14487 }
14488
14489 /// Removes all scopes, and no default scope will be used either.
14490 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14491 /// for details).
14492 pub fn clear_scopes(
14493 mut self,
14494 ) -> ProjectLocationDeliveryPipelineReleaseRolloutRetryJobCall<'a, C> {
14495 self._scopes.clear();
14496 self
14497 }
14498}
14499
14500/// Abandons a Release in the Delivery Pipeline.
14501///
14502/// A builder for the *locations.deliveryPipelines.releases.abandon* method supported by a *project* resource.
14503/// It is not used directly, but through a [`ProjectMethods`] instance.
14504///
14505/// # Example
14506///
14507/// Instantiate a resource method builder
14508///
14509/// ```test_harness,no_run
14510/// # extern crate hyper;
14511/// # extern crate hyper_rustls;
14512/// # extern crate google_clouddeploy1 as clouddeploy1;
14513/// use clouddeploy1::api::AbandonReleaseRequest;
14514/// # async fn dox() {
14515/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14516///
14517/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14518/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14519/// # .with_native_roots()
14520/// # .unwrap()
14521/// # .https_only()
14522/// # .enable_http2()
14523/// # .build();
14524///
14525/// # let executor = hyper_util::rt::TokioExecutor::new();
14526/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14527/// # secret,
14528/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14529/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14530/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14531/// # ),
14532/// # ).build().await.unwrap();
14533///
14534/// # let client = hyper_util::client::legacy::Client::builder(
14535/// # hyper_util::rt::TokioExecutor::new()
14536/// # )
14537/// # .build(
14538/// # hyper_rustls::HttpsConnectorBuilder::new()
14539/// # .with_native_roots()
14540/// # .unwrap()
14541/// # .https_or_http()
14542/// # .enable_http2()
14543/// # .build()
14544/// # );
14545/// # let mut hub = CloudDeploy::new(client, auth);
14546/// // As the method needs a request, you would usually fill it with the desired information
14547/// // into the respective structure. Some of the parts shown here might not be applicable !
14548/// // Values shown here are possibly random and not representative !
14549/// let mut req = AbandonReleaseRequest::default();
14550///
14551/// // You can configure optional parameters by calling the respective setters at will, and
14552/// // execute the final call using `doit()`.
14553/// // Values shown here are possibly random and not representative !
14554/// let result = hub.projects().locations_delivery_pipelines_releases_abandon(req, "name")
14555/// .doit().await;
14556/// # }
14557/// ```
14558pub struct ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
14559where
14560 C: 'a,
14561{
14562 hub: &'a CloudDeploy<C>,
14563 _request: AbandonReleaseRequest,
14564 _name: String,
14565 _delegate: Option<&'a mut dyn common::Delegate>,
14566 _additional_params: HashMap<String, String>,
14567 _scopes: BTreeSet<String>,
14568}
14569
14570impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {}
14571
14572impl<'a, C> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
14573where
14574 C: common::Connector,
14575{
14576 /// Perform the operation you have build so far.
14577 pub async fn doit(mut self) -> common::Result<(common::Response, AbandonReleaseResponse)> {
14578 use std::borrow::Cow;
14579 use std::io::{Read, Seek};
14580
14581 use common::{url::Params, ToParts};
14582 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14583
14584 let mut dd = common::DefaultDelegate;
14585 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14586 dlg.begin(common::MethodInfo {
14587 id: "clouddeploy.projects.locations.deliveryPipelines.releases.abandon",
14588 http_method: hyper::Method::POST,
14589 });
14590
14591 for &field in ["alt", "name"].iter() {
14592 if self._additional_params.contains_key(field) {
14593 dlg.finished(false);
14594 return Err(common::Error::FieldClash(field));
14595 }
14596 }
14597
14598 let mut params = Params::with_capacity(4 + self._additional_params.len());
14599 params.push("name", self._name);
14600
14601 params.extend(self._additional_params.iter());
14602
14603 params.push("alt", "json");
14604 let mut url = self.hub._base_url.clone() + "v1/{+name}:abandon";
14605 if self._scopes.is_empty() {
14606 self._scopes
14607 .insert(Scope::CloudPlatform.as_ref().to_string());
14608 }
14609
14610 #[allow(clippy::single_element_loop)]
14611 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14612 url = params.uri_replacement(url, param_name, find_this, true);
14613 }
14614 {
14615 let to_remove = ["name"];
14616 params.remove_params(&to_remove);
14617 }
14618
14619 let url = params.parse_with_url(&url);
14620
14621 let mut json_mime_type = mime::APPLICATION_JSON;
14622 let mut request_value_reader = {
14623 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14624 common::remove_json_null_values(&mut value);
14625 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14626 serde_json::to_writer(&mut dst, &value).unwrap();
14627 dst
14628 };
14629 let request_size = request_value_reader
14630 .seek(std::io::SeekFrom::End(0))
14631 .unwrap();
14632 request_value_reader
14633 .seek(std::io::SeekFrom::Start(0))
14634 .unwrap();
14635
14636 loop {
14637 let token = match self
14638 .hub
14639 .auth
14640 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14641 .await
14642 {
14643 Ok(token) => token,
14644 Err(e) => match dlg.token(e) {
14645 Ok(token) => token,
14646 Err(e) => {
14647 dlg.finished(false);
14648 return Err(common::Error::MissingToken(e));
14649 }
14650 },
14651 };
14652 request_value_reader
14653 .seek(std::io::SeekFrom::Start(0))
14654 .unwrap();
14655 let mut req_result = {
14656 let client = &self.hub.client;
14657 dlg.pre_request();
14658 let mut req_builder = hyper::Request::builder()
14659 .method(hyper::Method::POST)
14660 .uri(url.as_str())
14661 .header(USER_AGENT, self.hub._user_agent.clone());
14662
14663 if let Some(token) = token.as_ref() {
14664 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14665 }
14666
14667 let request = req_builder
14668 .header(CONTENT_TYPE, json_mime_type.to_string())
14669 .header(CONTENT_LENGTH, request_size as u64)
14670 .body(common::to_body(
14671 request_value_reader.get_ref().clone().into(),
14672 ));
14673
14674 client.request(request.unwrap()).await
14675 };
14676
14677 match req_result {
14678 Err(err) => {
14679 if let common::Retry::After(d) = dlg.http_error(&err) {
14680 sleep(d).await;
14681 continue;
14682 }
14683 dlg.finished(false);
14684 return Err(common::Error::HttpError(err));
14685 }
14686 Ok(res) => {
14687 let (mut parts, body) = res.into_parts();
14688 let mut body = common::Body::new(body);
14689 if !parts.status.is_success() {
14690 let bytes = common::to_bytes(body).await.unwrap_or_default();
14691 let error = serde_json::from_str(&common::to_string(&bytes));
14692 let response = common::to_response(parts, bytes.into());
14693
14694 if let common::Retry::After(d) =
14695 dlg.http_failure(&response, error.as_ref().ok())
14696 {
14697 sleep(d).await;
14698 continue;
14699 }
14700
14701 dlg.finished(false);
14702
14703 return Err(match error {
14704 Ok(value) => common::Error::BadRequest(value),
14705 _ => common::Error::Failure(response),
14706 });
14707 }
14708 let response = {
14709 let bytes = common::to_bytes(body).await.unwrap_or_default();
14710 let encoded = common::to_string(&bytes);
14711 match serde_json::from_str(&encoded) {
14712 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14713 Err(error) => {
14714 dlg.response_json_decode_error(&encoded, &error);
14715 return Err(common::Error::JsonDecodeError(
14716 encoded.to_string(),
14717 error,
14718 ));
14719 }
14720 }
14721 };
14722
14723 dlg.finished(true);
14724 return Ok(response);
14725 }
14726 }
14727 }
14728 }
14729
14730 ///
14731 /// Sets the *request* property to the given value.
14732 ///
14733 /// Even though the property as already been set when instantiating this call,
14734 /// we provide this method for API completeness.
14735 pub fn request(
14736 mut self,
14737 new_value: AbandonReleaseRequest,
14738 ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
14739 self._request = new_value;
14740 self
14741 }
14742 /// Required. Name of the Release. Format is `projects/{project}/locations/{location}/deliveryPipelines/{deliveryPipeline}/releases/{release}`.
14743 ///
14744 /// Sets the *name* path property to the given value.
14745 ///
14746 /// Even though the property as already been set when instantiating this call,
14747 /// we provide this method for API completeness.
14748 pub fn name(
14749 mut self,
14750 new_value: &str,
14751 ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
14752 self._name = new_value.to_string();
14753 self
14754 }
14755 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14756 /// while executing the actual API request.
14757 ///
14758 /// ````text
14759 /// It should be used to handle progress information, and to implement a certain level of resilience.
14760 /// ````
14761 ///
14762 /// Sets the *delegate* property to the given value.
14763 pub fn delegate(
14764 mut self,
14765 new_value: &'a mut dyn common::Delegate,
14766 ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
14767 self._delegate = Some(new_value);
14768 self
14769 }
14770
14771 /// Set any additional parameter of the query string used in the request.
14772 /// It should be used to set parameters which are not yet available through their own
14773 /// setters.
14774 ///
14775 /// Please note that this method must not be used to set any of the known parameters
14776 /// which have their own setter method. If done anyway, the request will fail.
14777 ///
14778 /// # Additional Parameters
14779 ///
14780 /// * *$.xgafv* (query-string) - V1 error format.
14781 /// * *access_token* (query-string) - OAuth access token.
14782 /// * *alt* (query-string) - Data format for response.
14783 /// * *callback* (query-string) - JSONP
14784 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14785 /// * *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.
14786 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14787 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14788 /// * *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.
14789 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14790 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14791 pub fn param<T>(
14792 mut self,
14793 name: T,
14794 value: T,
14795 ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
14796 where
14797 T: AsRef<str>,
14798 {
14799 self._additional_params
14800 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14801 self
14802 }
14803
14804 /// Identifies the authorization scope for the method you are building.
14805 ///
14806 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14807 /// [`Scope::CloudPlatform`].
14808 ///
14809 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14810 /// tokens for more than one scope.
14811 ///
14812 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14813 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14814 /// sufficient, a read-write scope will do as well.
14815 pub fn add_scope<St>(
14816 mut self,
14817 scope: St,
14818 ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
14819 where
14820 St: AsRef<str>,
14821 {
14822 self._scopes.insert(String::from(scope.as_ref()));
14823 self
14824 }
14825 /// Identifies the authorization scope(s) for the method you are building.
14826 ///
14827 /// See [`Self::add_scope()`] for details.
14828 pub fn add_scopes<I, St>(
14829 mut self,
14830 scopes: I,
14831 ) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C>
14832 where
14833 I: IntoIterator<Item = St>,
14834 St: AsRef<str>,
14835 {
14836 self._scopes
14837 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14838 self
14839 }
14840
14841 /// Removes all scopes, and no default scope will be used either.
14842 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14843 /// for details).
14844 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseAbandonCall<'a, C> {
14845 self._scopes.clear();
14846 self
14847 }
14848}
14849
14850/// Creates a new Release in a given project and location.
14851///
14852/// A builder for the *locations.deliveryPipelines.releases.create* method supported by a *project* resource.
14853/// It is not used directly, but through a [`ProjectMethods`] instance.
14854///
14855/// # Example
14856///
14857/// Instantiate a resource method builder
14858///
14859/// ```test_harness,no_run
14860/// # extern crate hyper;
14861/// # extern crate hyper_rustls;
14862/// # extern crate google_clouddeploy1 as clouddeploy1;
14863/// use clouddeploy1::api::Release;
14864/// # async fn dox() {
14865/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14866///
14867/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14868/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14869/// # .with_native_roots()
14870/// # .unwrap()
14871/// # .https_only()
14872/// # .enable_http2()
14873/// # .build();
14874///
14875/// # let executor = hyper_util::rt::TokioExecutor::new();
14876/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14877/// # secret,
14878/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14879/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14880/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14881/// # ),
14882/// # ).build().await.unwrap();
14883///
14884/// # let client = hyper_util::client::legacy::Client::builder(
14885/// # hyper_util::rt::TokioExecutor::new()
14886/// # )
14887/// # .build(
14888/// # hyper_rustls::HttpsConnectorBuilder::new()
14889/// # .with_native_roots()
14890/// # .unwrap()
14891/// # .https_or_http()
14892/// # .enable_http2()
14893/// # .build()
14894/// # );
14895/// # let mut hub = CloudDeploy::new(client, auth);
14896/// // As the method needs a request, you would usually fill it with the desired information
14897/// // into the respective structure. Some of the parts shown here might not be applicable !
14898/// // Values shown here are possibly random and not representative !
14899/// let mut req = Release::default();
14900///
14901/// // You can configure optional parameters by calling the respective setters at will, and
14902/// // execute the final call using `doit()`.
14903/// // Values shown here are possibly random and not representative !
14904/// let result = hub.projects().locations_delivery_pipelines_releases_create(req, "parent")
14905/// .validate_only(true)
14906/// .request_id("aliquyam")
14907/// .release_id("ipsum")
14908/// .add_override_deploy_policy("et")
14909/// .doit().await;
14910/// # }
14911/// ```
14912pub struct ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
14913where
14914 C: 'a,
14915{
14916 hub: &'a CloudDeploy<C>,
14917 _request: Release,
14918 _parent: String,
14919 _validate_only: Option<bool>,
14920 _request_id: Option<String>,
14921 _release_id: Option<String>,
14922 _override_deploy_policy: Vec<String>,
14923 _delegate: Option<&'a mut dyn common::Delegate>,
14924 _additional_params: HashMap<String, String>,
14925 _scopes: BTreeSet<String>,
14926}
14927
14928impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {}
14929
14930impl<'a, C> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
14931where
14932 C: common::Connector,
14933{
14934 /// Perform the operation you have build so far.
14935 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14936 use std::borrow::Cow;
14937 use std::io::{Read, Seek};
14938
14939 use common::{url::Params, ToParts};
14940 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14941
14942 let mut dd = common::DefaultDelegate;
14943 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14944 dlg.begin(common::MethodInfo {
14945 id: "clouddeploy.projects.locations.deliveryPipelines.releases.create",
14946 http_method: hyper::Method::POST,
14947 });
14948
14949 for &field in [
14950 "alt",
14951 "parent",
14952 "validateOnly",
14953 "requestId",
14954 "releaseId",
14955 "overrideDeployPolicy",
14956 ]
14957 .iter()
14958 {
14959 if self._additional_params.contains_key(field) {
14960 dlg.finished(false);
14961 return Err(common::Error::FieldClash(field));
14962 }
14963 }
14964
14965 let mut params = Params::with_capacity(8 + self._additional_params.len());
14966 params.push("parent", self._parent);
14967 if let Some(value) = self._validate_only.as_ref() {
14968 params.push("validateOnly", value.to_string());
14969 }
14970 if let Some(value) = self._request_id.as_ref() {
14971 params.push("requestId", value);
14972 }
14973 if let Some(value) = self._release_id.as_ref() {
14974 params.push("releaseId", value);
14975 }
14976 if !self._override_deploy_policy.is_empty() {
14977 for f in self._override_deploy_policy.iter() {
14978 params.push("overrideDeployPolicy", f);
14979 }
14980 }
14981
14982 params.extend(self._additional_params.iter());
14983
14984 params.push("alt", "json");
14985 let mut url = self.hub._base_url.clone() + "v1/{+parent}/releases";
14986 if self._scopes.is_empty() {
14987 self._scopes
14988 .insert(Scope::CloudPlatform.as_ref().to_string());
14989 }
14990
14991 #[allow(clippy::single_element_loop)]
14992 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
14993 url = params.uri_replacement(url, param_name, find_this, true);
14994 }
14995 {
14996 let to_remove = ["parent"];
14997 params.remove_params(&to_remove);
14998 }
14999
15000 let url = params.parse_with_url(&url);
15001
15002 let mut json_mime_type = mime::APPLICATION_JSON;
15003 let mut request_value_reader = {
15004 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15005 common::remove_json_null_values(&mut value);
15006 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15007 serde_json::to_writer(&mut dst, &value).unwrap();
15008 dst
15009 };
15010 let request_size = request_value_reader
15011 .seek(std::io::SeekFrom::End(0))
15012 .unwrap();
15013 request_value_reader
15014 .seek(std::io::SeekFrom::Start(0))
15015 .unwrap();
15016
15017 loop {
15018 let token = match self
15019 .hub
15020 .auth
15021 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15022 .await
15023 {
15024 Ok(token) => token,
15025 Err(e) => match dlg.token(e) {
15026 Ok(token) => token,
15027 Err(e) => {
15028 dlg.finished(false);
15029 return Err(common::Error::MissingToken(e));
15030 }
15031 },
15032 };
15033 request_value_reader
15034 .seek(std::io::SeekFrom::Start(0))
15035 .unwrap();
15036 let mut req_result = {
15037 let client = &self.hub.client;
15038 dlg.pre_request();
15039 let mut req_builder = hyper::Request::builder()
15040 .method(hyper::Method::POST)
15041 .uri(url.as_str())
15042 .header(USER_AGENT, self.hub._user_agent.clone());
15043
15044 if let Some(token) = token.as_ref() {
15045 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15046 }
15047
15048 let request = req_builder
15049 .header(CONTENT_TYPE, json_mime_type.to_string())
15050 .header(CONTENT_LENGTH, request_size as u64)
15051 .body(common::to_body(
15052 request_value_reader.get_ref().clone().into(),
15053 ));
15054
15055 client.request(request.unwrap()).await
15056 };
15057
15058 match req_result {
15059 Err(err) => {
15060 if let common::Retry::After(d) = dlg.http_error(&err) {
15061 sleep(d).await;
15062 continue;
15063 }
15064 dlg.finished(false);
15065 return Err(common::Error::HttpError(err));
15066 }
15067 Ok(res) => {
15068 let (mut parts, body) = res.into_parts();
15069 let mut body = common::Body::new(body);
15070 if !parts.status.is_success() {
15071 let bytes = common::to_bytes(body).await.unwrap_or_default();
15072 let error = serde_json::from_str(&common::to_string(&bytes));
15073 let response = common::to_response(parts, bytes.into());
15074
15075 if let common::Retry::After(d) =
15076 dlg.http_failure(&response, error.as_ref().ok())
15077 {
15078 sleep(d).await;
15079 continue;
15080 }
15081
15082 dlg.finished(false);
15083
15084 return Err(match error {
15085 Ok(value) => common::Error::BadRequest(value),
15086 _ => common::Error::Failure(response),
15087 });
15088 }
15089 let response = {
15090 let bytes = common::to_bytes(body).await.unwrap_or_default();
15091 let encoded = common::to_string(&bytes);
15092 match serde_json::from_str(&encoded) {
15093 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15094 Err(error) => {
15095 dlg.response_json_decode_error(&encoded, &error);
15096 return Err(common::Error::JsonDecodeError(
15097 encoded.to_string(),
15098 error,
15099 ));
15100 }
15101 }
15102 };
15103
15104 dlg.finished(true);
15105 return Ok(response);
15106 }
15107 }
15108 }
15109 }
15110
15111 ///
15112 /// Sets the *request* property to the given value.
15113 ///
15114 /// Even though the property as already been set when instantiating this call,
15115 /// we provide this method for API completeness.
15116 pub fn request(
15117 mut self,
15118 new_value: Release,
15119 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15120 self._request = new_value;
15121 self
15122 }
15123 /// Required. The parent collection in which the `Release` is created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
15124 ///
15125 /// Sets the *parent* path property to the given value.
15126 ///
15127 /// Even though the property as already been set when instantiating this call,
15128 /// we provide this method for API completeness.
15129 pub fn parent(
15130 mut self,
15131 new_value: &str,
15132 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15133 self._parent = new_value.to_string();
15134 self
15135 }
15136 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
15137 ///
15138 /// Sets the *validate only* query property to the given value.
15139 pub fn validate_only(
15140 mut self,
15141 new_value: bool,
15142 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15143 self._validate_only = Some(new_value);
15144 self
15145 }
15146 /// 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).
15147 ///
15148 /// Sets the *request id* query property to the given value.
15149 pub fn request_id(
15150 mut self,
15151 new_value: &str,
15152 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15153 self._request_id = Some(new_value.to_string());
15154 self
15155 }
15156 /// Required. ID of the `Release`.
15157 ///
15158 /// Sets the *release id* query property to the given value.
15159 pub fn release_id(
15160 mut self,
15161 new_value: &str,
15162 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15163 self._release_id = Some(new_value.to_string());
15164 self
15165 }
15166 /// Optional. Deploy policies to override. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`.
15167 ///
15168 /// Append the given value to the *override deploy policy* query property.
15169 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
15170 pub fn add_override_deploy_policy(
15171 mut self,
15172 new_value: &str,
15173 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15174 self._override_deploy_policy.push(new_value.to_string());
15175 self
15176 }
15177 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15178 /// while executing the actual API request.
15179 ///
15180 /// ````text
15181 /// It should be used to handle progress information, and to implement a certain level of resilience.
15182 /// ````
15183 ///
15184 /// Sets the *delegate* property to the given value.
15185 pub fn delegate(
15186 mut self,
15187 new_value: &'a mut dyn common::Delegate,
15188 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15189 self._delegate = Some(new_value);
15190 self
15191 }
15192
15193 /// Set any additional parameter of the query string used in the request.
15194 /// It should be used to set parameters which are not yet available through their own
15195 /// setters.
15196 ///
15197 /// Please note that this method must not be used to set any of the known parameters
15198 /// which have their own setter method. If done anyway, the request will fail.
15199 ///
15200 /// # Additional Parameters
15201 ///
15202 /// * *$.xgafv* (query-string) - V1 error format.
15203 /// * *access_token* (query-string) - OAuth access token.
15204 /// * *alt* (query-string) - Data format for response.
15205 /// * *callback* (query-string) - JSONP
15206 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15207 /// * *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.
15208 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15209 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15210 /// * *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.
15211 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15212 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15213 pub fn param<T>(
15214 mut self,
15215 name: T,
15216 value: T,
15217 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
15218 where
15219 T: AsRef<str>,
15220 {
15221 self._additional_params
15222 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15223 self
15224 }
15225
15226 /// Identifies the authorization scope for the method you are building.
15227 ///
15228 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15229 /// [`Scope::CloudPlatform`].
15230 ///
15231 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15232 /// tokens for more than one scope.
15233 ///
15234 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15235 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15236 /// sufficient, a read-write scope will do as well.
15237 pub fn add_scope<St>(
15238 mut self,
15239 scope: St,
15240 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
15241 where
15242 St: AsRef<str>,
15243 {
15244 self._scopes.insert(String::from(scope.as_ref()));
15245 self
15246 }
15247 /// Identifies the authorization scope(s) for the method you are building.
15248 ///
15249 /// See [`Self::add_scope()`] for details.
15250 pub fn add_scopes<I, St>(
15251 mut self,
15252 scopes: I,
15253 ) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C>
15254 where
15255 I: IntoIterator<Item = St>,
15256 St: AsRef<str>,
15257 {
15258 self._scopes
15259 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15260 self
15261 }
15262
15263 /// Removes all scopes, and no default scope will be used either.
15264 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15265 /// for details).
15266 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseCreateCall<'a, C> {
15267 self._scopes.clear();
15268 self
15269 }
15270}
15271
15272/// Gets details of a single Release.
15273///
15274/// A builder for the *locations.deliveryPipelines.releases.get* method supported by a *project* resource.
15275/// It is not used directly, but through a [`ProjectMethods`] instance.
15276///
15277/// # Example
15278///
15279/// Instantiate a resource method builder
15280///
15281/// ```test_harness,no_run
15282/// # extern crate hyper;
15283/// # extern crate hyper_rustls;
15284/// # extern crate google_clouddeploy1 as clouddeploy1;
15285/// # async fn dox() {
15286/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15287///
15288/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15289/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15290/// # .with_native_roots()
15291/// # .unwrap()
15292/// # .https_only()
15293/// # .enable_http2()
15294/// # .build();
15295///
15296/// # let executor = hyper_util::rt::TokioExecutor::new();
15297/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15298/// # secret,
15299/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15300/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15301/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15302/// # ),
15303/// # ).build().await.unwrap();
15304///
15305/// # let client = hyper_util::client::legacy::Client::builder(
15306/// # hyper_util::rt::TokioExecutor::new()
15307/// # )
15308/// # .build(
15309/// # hyper_rustls::HttpsConnectorBuilder::new()
15310/// # .with_native_roots()
15311/// # .unwrap()
15312/// # .https_or_http()
15313/// # .enable_http2()
15314/// # .build()
15315/// # );
15316/// # let mut hub = CloudDeploy::new(client, auth);
15317/// // You can configure optional parameters by calling the respective setters at will, and
15318/// // execute the final call using `doit()`.
15319/// // Values shown here are possibly random and not representative !
15320/// let result = hub.projects().locations_delivery_pipelines_releases_get("name")
15321/// .doit().await;
15322/// # }
15323/// ```
15324pub struct ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
15325where
15326 C: 'a,
15327{
15328 hub: &'a CloudDeploy<C>,
15329 _name: String,
15330 _delegate: Option<&'a mut dyn common::Delegate>,
15331 _additional_params: HashMap<String, String>,
15332 _scopes: BTreeSet<String>,
15333}
15334
15335impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {}
15336
15337impl<'a, C> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
15338where
15339 C: common::Connector,
15340{
15341 /// Perform the operation you have build so far.
15342 pub async fn doit(mut self) -> common::Result<(common::Response, Release)> {
15343 use std::borrow::Cow;
15344 use std::io::{Read, Seek};
15345
15346 use common::{url::Params, ToParts};
15347 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15348
15349 let mut dd = common::DefaultDelegate;
15350 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15351 dlg.begin(common::MethodInfo {
15352 id: "clouddeploy.projects.locations.deliveryPipelines.releases.get",
15353 http_method: hyper::Method::GET,
15354 });
15355
15356 for &field in ["alt", "name"].iter() {
15357 if self._additional_params.contains_key(field) {
15358 dlg.finished(false);
15359 return Err(common::Error::FieldClash(field));
15360 }
15361 }
15362
15363 let mut params = Params::with_capacity(3 + self._additional_params.len());
15364 params.push("name", self._name);
15365
15366 params.extend(self._additional_params.iter());
15367
15368 params.push("alt", "json");
15369 let mut url = self.hub._base_url.clone() + "v1/{+name}";
15370 if self._scopes.is_empty() {
15371 self._scopes
15372 .insert(Scope::CloudPlatform.as_ref().to_string());
15373 }
15374
15375 #[allow(clippy::single_element_loop)]
15376 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15377 url = params.uri_replacement(url, param_name, find_this, true);
15378 }
15379 {
15380 let to_remove = ["name"];
15381 params.remove_params(&to_remove);
15382 }
15383
15384 let url = params.parse_with_url(&url);
15385
15386 loop {
15387 let token = match self
15388 .hub
15389 .auth
15390 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15391 .await
15392 {
15393 Ok(token) => token,
15394 Err(e) => match dlg.token(e) {
15395 Ok(token) => token,
15396 Err(e) => {
15397 dlg.finished(false);
15398 return Err(common::Error::MissingToken(e));
15399 }
15400 },
15401 };
15402 let mut req_result = {
15403 let client = &self.hub.client;
15404 dlg.pre_request();
15405 let mut req_builder = hyper::Request::builder()
15406 .method(hyper::Method::GET)
15407 .uri(url.as_str())
15408 .header(USER_AGENT, self.hub._user_agent.clone());
15409
15410 if let Some(token) = token.as_ref() {
15411 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15412 }
15413
15414 let request = req_builder
15415 .header(CONTENT_LENGTH, 0_u64)
15416 .body(common::to_body::<String>(None));
15417
15418 client.request(request.unwrap()).await
15419 };
15420
15421 match req_result {
15422 Err(err) => {
15423 if let common::Retry::After(d) = dlg.http_error(&err) {
15424 sleep(d).await;
15425 continue;
15426 }
15427 dlg.finished(false);
15428 return Err(common::Error::HttpError(err));
15429 }
15430 Ok(res) => {
15431 let (mut parts, body) = res.into_parts();
15432 let mut body = common::Body::new(body);
15433 if !parts.status.is_success() {
15434 let bytes = common::to_bytes(body).await.unwrap_or_default();
15435 let error = serde_json::from_str(&common::to_string(&bytes));
15436 let response = common::to_response(parts, bytes.into());
15437
15438 if let common::Retry::After(d) =
15439 dlg.http_failure(&response, error.as_ref().ok())
15440 {
15441 sleep(d).await;
15442 continue;
15443 }
15444
15445 dlg.finished(false);
15446
15447 return Err(match error {
15448 Ok(value) => common::Error::BadRequest(value),
15449 _ => common::Error::Failure(response),
15450 });
15451 }
15452 let response = {
15453 let bytes = common::to_bytes(body).await.unwrap_or_default();
15454 let encoded = common::to_string(&bytes);
15455 match serde_json::from_str(&encoded) {
15456 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15457 Err(error) => {
15458 dlg.response_json_decode_error(&encoded, &error);
15459 return Err(common::Error::JsonDecodeError(
15460 encoded.to_string(),
15461 error,
15462 ));
15463 }
15464 }
15465 };
15466
15467 dlg.finished(true);
15468 return Ok(response);
15469 }
15470 }
15471 }
15472 }
15473
15474 /// Required. Name of the `Release`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}/releases/{release_name}`.
15475 ///
15476 /// Sets the *name* path property to the given value.
15477 ///
15478 /// Even though the property as already been set when instantiating this call,
15479 /// we provide this method for API completeness.
15480 pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
15481 self._name = new_value.to_string();
15482 self
15483 }
15484 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15485 /// while executing the actual API request.
15486 ///
15487 /// ````text
15488 /// It should be used to handle progress information, and to implement a certain level of resilience.
15489 /// ````
15490 ///
15491 /// Sets the *delegate* property to the given value.
15492 pub fn delegate(
15493 mut self,
15494 new_value: &'a mut dyn common::Delegate,
15495 ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
15496 self._delegate = Some(new_value);
15497 self
15498 }
15499
15500 /// Set any additional parameter of the query string used in the request.
15501 /// It should be used to set parameters which are not yet available through their own
15502 /// setters.
15503 ///
15504 /// Please note that this method must not be used to set any of the known parameters
15505 /// which have their own setter method. If done anyway, the request will fail.
15506 ///
15507 /// # Additional Parameters
15508 ///
15509 /// * *$.xgafv* (query-string) - V1 error format.
15510 /// * *access_token* (query-string) - OAuth access token.
15511 /// * *alt* (query-string) - Data format for response.
15512 /// * *callback* (query-string) - JSONP
15513 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15514 /// * *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.
15515 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15516 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15517 /// * *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.
15518 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15519 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15520 pub fn param<T>(
15521 mut self,
15522 name: T,
15523 value: T,
15524 ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
15525 where
15526 T: AsRef<str>,
15527 {
15528 self._additional_params
15529 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15530 self
15531 }
15532
15533 /// Identifies the authorization scope for the method you are building.
15534 ///
15535 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15536 /// [`Scope::CloudPlatform`].
15537 ///
15538 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15539 /// tokens for more than one scope.
15540 ///
15541 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15542 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15543 /// sufficient, a read-write scope will do as well.
15544 pub fn add_scope<St>(
15545 mut self,
15546 scope: St,
15547 ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
15548 where
15549 St: AsRef<str>,
15550 {
15551 self._scopes.insert(String::from(scope.as_ref()));
15552 self
15553 }
15554 /// Identifies the authorization scope(s) for the method you are building.
15555 ///
15556 /// See [`Self::add_scope()`] for details.
15557 pub fn add_scopes<I, St>(
15558 mut self,
15559 scopes: I,
15560 ) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C>
15561 where
15562 I: IntoIterator<Item = St>,
15563 St: AsRef<str>,
15564 {
15565 self._scopes
15566 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15567 self
15568 }
15569
15570 /// Removes all scopes, and no default scope will be used either.
15571 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15572 /// for details).
15573 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseGetCall<'a, C> {
15574 self._scopes.clear();
15575 self
15576 }
15577}
15578
15579/// Lists Releases in a given project and location.
15580///
15581/// A builder for the *locations.deliveryPipelines.releases.list* method supported by a *project* resource.
15582/// It is not used directly, but through a [`ProjectMethods`] instance.
15583///
15584/// # Example
15585///
15586/// Instantiate a resource method builder
15587///
15588/// ```test_harness,no_run
15589/// # extern crate hyper;
15590/// # extern crate hyper_rustls;
15591/// # extern crate google_clouddeploy1 as clouddeploy1;
15592/// # async fn dox() {
15593/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15594///
15595/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15596/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15597/// # .with_native_roots()
15598/// # .unwrap()
15599/// # .https_only()
15600/// # .enable_http2()
15601/// # .build();
15602///
15603/// # let executor = hyper_util::rt::TokioExecutor::new();
15604/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15605/// # secret,
15606/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15607/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15608/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15609/// # ),
15610/// # ).build().await.unwrap();
15611///
15612/// # let client = hyper_util::client::legacy::Client::builder(
15613/// # hyper_util::rt::TokioExecutor::new()
15614/// # )
15615/// # .build(
15616/// # hyper_rustls::HttpsConnectorBuilder::new()
15617/// # .with_native_roots()
15618/// # .unwrap()
15619/// # .https_or_http()
15620/// # .enable_http2()
15621/// # .build()
15622/// # );
15623/// # let mut hub = CloudDeploy::new(client, auth);
15624/// // You can configure optional parameters by calling the respective setters at will, and
15625/// // execute the final call using `doit()`.
15626/// // Values shown here are possibly random and not representative !
15627/// let result = hub.projects().locations_delivery_pipelines_releases_list("parent")
15628/// .page_token("est")
15629/// .page_size(-30)
15630/// .order_by("diam")
15631/// .filter("dolores")
15632/// .doit().await;
15633/// # }
15634/// ```
15635pub struct ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
15636where
15637 C: 'a,
15638{
15639 hub: &'a CloudDeploy<C>,
15640 _parent: String,
15641 _page_token: Option<String>,
15642 _page_size: Option<i32>,
15643 _order_by: Option<String>,
15644 _filter: Option<String>,
15645 _delegate: Option<&'a mut dyn common::Delegate>,
15646 _additional_params: HashMap<String, String>,
15647 _scopes: BTreeSet<String>,
15648}
15649
15650impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {}
15651
15652impl<'a, C> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
15653where
15654 C: common::Connector,
15655{
15656 /// Perform the operation you have build so far.
15657 pub async fn doit(mut self) -> common::Result<(common::Response, ListReleasesResponse)> {
15658 use std::borrow::Cow;
15659 use std::io::{Read, Seek};
15660
15661 use common::{url::Params, ToParts};
15662 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15663
15664 let mut dd = common::DefaultDelegate;
15665 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15666 dlg.begin(common::MethodInfo {
15667 id: "clouddeploy.projects.locations.deliveryPipelines.releases.list",
15668 http_method: hyper::Method::GET,
15669 });
15670
15671 for &field in [
15672 "alt",
15673 "parent",
15674 "pageToken",
15675 "pageSize",
15676 "orderBy",
15677 "filter",
15678 ]
15679 .iter()
15680 {
15681 if self._additional_params.contains_key(field) {
15682 dlg.finished(false);
15683 return Err(common::Error::FieldClash(field));
15684 }
15685 }
15686
15687 let mut params = Params::with_capacity(7 + self._additional_params.len());
15688 params.push("parent", self._parent);
15689 if let Some(value) = self._page_token.as_ref() {
15690 params.push("pageToken", value);
15691 }
15692 if let Some(value) = self._page_size.as_ref() {
15693 params.push("pageSize", value.to_string());
15694 }
15695 if let Some(value) = self._order_by.as_ref() {
15696 params.push("orderBy", value);
15697 }
15698 if let Some(value) = self._filter.as_ref() {
15699 params.push("filter", value);
15700 }
15701
15702 params.extend(self._additional_params.iter());
15703
15704 params.push("alt", "json");
15705 let mut url = self.hub._base_url.clone() + "v1/{+parent}/releases";
15706 if self._scopes.is_empty() {
15707 self._scopes
15708 .insert(Scope::CloudPlatform.as_ref().to_string());
15709 }
15710
15711 #[allow(clippy::single_element_loop)]
15712 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
15713 url = params.uri_replacement(url, param_name, find_this, true);
15714 }
15715 {
15716 let to_remove = ["parent"];
15717 params.remove_params(&to_remove);
15718 }
15719
15720 let url = params.parse_with_url(&url);
15721
15722 loop {
15723 let token = match self
15724 .hub
15725 .auth
15726 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15727 .await
15728 {
15729 Ok(token) => token,
15730 Err(e) => match dlg.token(e) {
15731 Ok(token) => token,
15732 Err(e) => {
15733 dlg.finished(false);
15734 return Err(common::Error::MissingToken(e));
15735 }
15736 },
15737 };
15738 let mut req_result = {
15739 let client = &self.hub.client;
15740 dlg.pre_request();
15741 let mut req_builder = hyper::Request::builder()
15742 .method(hyper::Method::GET)
15743 .uri(url.as_str())
15744 .header(USER_AGENT, self.hub._user_agent.clone());
15745
15746 if let Some(token) = token.as_ref() {
15747 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15748 }
15749
15750 let request = req_builder
15751 .header(CONTENT_LENGTH, 0_u64)
15752 .body(common::to_body::<String>(None));
15753
15754 client.request(request.unwrap()).await
15755 };
15756
15757 match req_result {
15758 Err(err) => {
15759 if let common::Retry::After(d) = dlg.http_error(&err) {
15760 sleep(d).await;
15761 continue;
15762 }
15763 dlg.finished(false);
15764 return Err(common::Error::HttpError(err));
15765 }
15766 Ok(res) => {
15767 let (mut parts, body) = res.into_parts();
15768 let mut body = common::Body::new(body);
15769 if !parts.status.is_success() {
15770 let bytes = common::to_bytes(body).await.unwrap_or_default();
15771 let error = serde_json::from_str(&common::to_string(&bytes));
15772 let response = common::to_response(parts, bytes.into());
15773
15774 if let common::Retry::After(d) =
15775 dlg.http_failure(&response, error.as_ref().ok())
15776 {
15777 sleep(d).await;
15778 continue;
15779 }
15780
15781 dlg.finished(false);
15782
15783 return Err(match error {
15784 Ok(value) => common::Error::BadRequest(value),
15785 _ => common::Error::Failure(response),
15786 });
15787 }
15788 let response = {
15789 let bytes = common::to_bytes(body).await.unwrap_or_default();
15790 let encoded = common::to_string(&bytes);
15791 match serde_json::from_str(&encoded) {
15792 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15793 Err(error) => {
15794 dlg.response_json_decode_error(&encoded, &error);
15795 return Err(common::Error::JsonDecodeError(
15796 encoded.to_string(),
15797 error,
15798 ));
15799 }
15800 }
15801 };
15802
15803 dlg.finished(true);
15804 return Ok(response);
15805 }
15806 }
15807 }
15808 }
15809
15810 /// Required. The `DeliveryPipeline` which owns this collection of `Release` objects.
15811 ///
15812 /// Sets the *parent* path property to the given value.
15813 ///
15814 /// Even though the property as already been set when instantiating this call,
15815 /// we provide this method for API completeness.
15816 pub fn parent(
15817 mut self,
15818 new_value: &str,
15819 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
15820 self._parent = new_value.to_string();
15821 self
15822 }
15823 /// 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.
15824 ///
15825 /// Sets the *page token* query property to the given value.
15826 pub fn page_token(
15827 mut self,
15828 new_value: &str,
15829 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
15830 self._page_token = Some(new_value.to_string());
15831 self
15832 }
15833 /// 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.
15834 ///
15835 /// Sets the *page size* query property to the given value.
15836 pub fn page_size(
15837 mut self,
15838 new_value: i32,
15839 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
15840 self._page_size = Some(new_value);
15841 self
15842 }
15843 /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
15844 ///
15845 /// Sets the *order by* query property to the given value.
15846 pub fn order_by(
15847 mut self,
15848 new_value: &str,
15849 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
15850 self._order_by = Some(new_value.to_string());
15851 self
15852 }
15853 /// Optional. Filter releases to be returned. See https://google.aip.dev/160 for more details.
15854 ///
15855 /// Sets the *filter* query property to the given value.
15856 pub fn filter(
15857 mut self,
15858 new_value: &str,
15859 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
15860 self._filter = Some(new_value.to_string());
15861 self
15862 }
15863 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15864 /// while executing the actual API request.
15865 ///
15866 /// ````text
15867 /// It should be used to handle progress information, and to implement a certain level of resilience.
15868 /// ````
15869 ///
15870 /// Sets the *delegate* property to the given value.
15871 pub fn delegate(
15872 mut self,
15873 new_value: &'a mut dyn common::Delegate,
15874 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
15875 self._delegate = Some(new_value);
15876 self
15877 }
15878
15879 /// Set any additional parameter of the query string used in the request.
15880 /// It should be used to set parameters which are not yet available through their own
15881 /// setters.
15882 ///
15883 /// Please note that this method must not be used to set any of the known parameters
15884 /// which have their own setter method. If done anyway, the request will fail.
15885 ///
15886 /// # Additional Parameters
15887 ///
15888 /// * *$.xgafv* (query-string) - V1 error format.
15889 /// * *access_token* (query-string) - OAuth access token.
15890 /// * *alt* (query-string) - Data format for response.
15891 /// * *callback* (query-string) - JSONP
15892 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15893 /// * *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.
15894 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15895 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15896 /// * *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.
15897 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15898 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15899 pub fn param<T>(
15900 mut self,
15901 name: T,
15902 value: T,
15903 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
15904 where
15905 T: AsRef<str>,
15906 {
15907 self._additional_params
15908 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15909 self
15910 }
15911
15912 /// Identifies the authorization scope for the method you are building.
15913 ///
15914 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15915 /// [`Scope::CloudPlatform`].
15916 ///
15917 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15918 /// tokens for more than one scope.
15919 ///
15920 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15921 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15922 /// sufficient, a read-write scope will do as well.
15923 pub fn add_scope<St>(
15924 mut self,
15925 scope: St,
15926 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
15927 where
15928 St: AsRef<str>,
15929 {
15930 self._scopes.insert(String::from(scope.as_ref()));
15931 self
15932 }
15933 /// Identifies the authorization scope(s) for the method you are building.
15934 ///
15935 /// See [`Self::add_scope()`] for details.
15936 pub fn add_scopes<I, St>(
15937 mut self,
15938 scopes: I,
15939 ) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C>
15940 where
15941 I: IntoIterator<Item = St>,
15942 St: AsRef<str>,
15943 {
15944 self._scopes
15945 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15946 self
15947 }
15948
15949 /// Removes all scopes, and no default scope will be used either.
15950 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15951 /// for details).
15952 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineReleaseListCall<'a, C> {
15953 self._scopes.clear();
15954 self
15955 }
15956}
15957
15958/// Creates a new DeliveryPipeline in a given project and location.
15959///
15960/// A builder for the *locations.deliveryPipelines.create* method supported by a *project* resource.
15961/// It is not used directly, but through a [`ProjectMethods`] instance.
15962///
15963/// # Example
15964///
15965/// Instantiate a resource method builder
15966///
15967/// ```test_harness,no_run
15968/// # extern crate hyper;
15969/// # extern crate hyper_rustls;
15970/// # extern crate google_clouddeploy1 as clouddeploy1;
15971/// use clouddeploy1::api::DeliveryPipeline;
15972/// # async fn dox() {
15973/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15974///
15975/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15976/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15977/// # .with_native_roots()
15978/// # .unwrap()
15979/// # .https_only()
15980/// # .enable_http2()
15981/// # .build();
15982///
15983/// # let executor = hyper_util::rt::TokioExecutor::new();
15984/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15985/// # secret,
15986/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15987/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15988/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15989/// # ),
15990/// # ).build().await.unwrap();
15991///
15992/// # let client = hyper_util::client::legacy::Client::builder(
15993/// # hyper_util::rt::TokioExecutor::new()
15994/// # )
15995/// # .build(
15996/// # hyper_rustls::HttpsConnectorBuilder::new()
15997/// # .with_native_roots()
15998/// # .unwrap()
15999/// # .https_or_http()
16000/// # .enable_http2()
16001/// # .build()
16002/// # );
16003/// # let mut hub = CloudDeploy::new(client, auth);
16004/// // As the method needs a request, you would usually fill it with the desired information
16005/// // into the respective structure. Some of the parts shown here might not be applicable !
16006/// // Values shown here are possibly random and not representative !
16007/// let mut req = DeliveryPipeline::default();
16008///
16009/// // You can configure optional parameters by calling the respective setters at will, and
16010/// // execute the final call using `doit()`.
16011/// // Values shown here are possibly random and not representative !
16012/// let result = hub.projects().locations_delivery_pipelines_create(req, "parent")
16013/// .validate_only(true)
16014/// .request_id("sed")
16015/// .delivery_pipeline_id("no")
16016/// .doit().await;
16017/// # }
16018/// ```
16019pub struct ProjectLocationDeliveryPipelineCreateCall<'a, C>
16020where
16021 C: 'a,
16022{
16023 hub: &'a CloudDeploy<C>,
16024 _request: DeliveryPipeline,
16025 _parent: String,
16026 _validate_only: Option<bool>,
16027 _request_id: Option<String>,
16028 _delivery_pipeline_id: Option<String>,
16029 _delegate: Option<&'a mut dyn common::Delegate>,
16030 _additional_params: HashMap<String, String>,
16031 _scopes: BTreeSet<String>,
16032}
16033
16034impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineCreateCall<'a, C> {}
16035
16036impl<'a, C> ProjectLocationDeliveryPipelineCreateCall<'a, C>
16037where
16038 C: common::Connector,
16039{
16040 /// Perform the operation you have build so far.
16041 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16042 use std::borrow::Cow;
16043 use std::io::{Read, Seek};
16044
16045 use common::{url::Params, ToParts};
16046 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16047
16048 let mut dd = common::DefaultDelegate;
16049 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16050 dlg.begin(common::MethodInfo {
16051 id: "clouddeploy.projects.locations.deliveryPipelines.create",
16052 http_method: hyper::Method::POST,
16053 });
16054
16055 for &field in [
16056 "alt",
16057 "parent",
16058 "validateOnly",
16059 "requestId",
16060 "deliveryPipelineId",
16061 ]
16062 .iter()
16063 {
16064 if self._additional_params.contains_key(field) {
16065 dlg.finished(false);
16066 return Err(common::Error::FieldClash(field));
16067 }
16068 }
16069
16070 let mut params = Params::with_capacity(7 + self._additional_params.len());
16071 params.push("parent", self._parent);
16072 if let Some(value) = self._validate_only.as_ref() {
16073 params.push("validateOnly", value.to_string());
16074 }
16075 if let Some(value) = self._request_id.as_ref() {
16076 params.push("requestId", value);
16077 }
16078 if let Some(value) = self._delivery_pipeline_id.as_ref() {
16079 params.push("deliveryPipelineId", value);
16080 }
16081
16082 params.extend(self._additional_params.iter());
16083
16084 params.push("alt", "json");
16085 let mut url = self.hub._base_url.clone() + "v1/{+parent}/deliveryPipelines";
16086 if self._scopes.is_empty() {
16087 self._scopes
16088 .insert(Scope::CloudPlatform.as_ref().to_string());
16089 }
16090
16091 #[allow(clippy::single_element_loop)]
16092 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16093 url = params.uri_replacement(url, param_name, find_this, true);
16094 }
16095 {
16096 let to_remove = ["parent"];
16097 params.remove_params(&to_remove);
16098 }
16099
16100 let url = params.parse_with_url(&url);
16101
16102 let mut json_mime_type = mime::APPLICATION_JSON;
16103 let mut request_value_reader = {
16104 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16105 common::remove_json_null_values(&mut value);
16106 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16107 serde_json::to_writer(&mut dst, &value).unwrap();
16108 dst
16109 };
16110 let request_size = request_value_reader
16111 .seek(std::io::SeekFrom::End(0))
16112 .unwrap();
16113 request_value_reader
16114 .seek(std::io::SeekFrom::Start(0))
16115 .unwrap();
16116
16117 loop {
16118 let token = match self
16119 .hub
16120 .auth
16121 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16122 .await
16123 {
16124 Ok(token) => token,
16125 Err(e) => match dlg.token(e) {
16126 Ok(token) => token,
16127 Err(e) => {
16128 dlg.finished(false);
16129 return Err(common::Error::MissingToken(e));
16130 }
16131 },
16132 };
16133 request_value_reader
16134 .seek(std::io::SeekFrom::Start(0))
16135 .unwrap();
16136 let mut req_result = {
16137 let client = &self.hub.client;
16138 dlg.pre_request();
16139 let mut req_builder = hyper::Request::builder()
16140 .method(hyper::Method::POST)
16141 .uri(url.as_str())
16142 .header(USER_AGENT, self.hub._user_agent.clone());
16143
16144 if let Some(token) = token.as_ref() {
16145 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16146 }
16147
16148 let request = req_builder
16149 .header(CONTENT_TYPE, json_mime_type.to_string())
16150 .header(CONTENT_LENGTH, request_size as u64)
16151 .body(common::to_body(
16152 request_value_reader.get_ref().clone().into(),
16153 ));
16154
16155 client.request(request.unwrap()).await
16156 };
16157
16158 match req_result {
16159 Err(err) => {
16160 if let common::Retry::After(d) = dlg.http_error(&err) {
16161 sleep(d).await;
16162 continue;
16163 }
16164 dlg.finished(false);
16165 return Err(common::Error::HttpError(err));
16166 }
16167 Ok(res) => {
16168 let (mut parts, body) = res.into_parts();
16169 let mut body = common::Body::new(body);
16170 if !parts.status.is_success() {
16171 let bytes = common::to_bytes(body).await.unwrap_or_default();
16172 let error = serde_json::from_str(&common::to_string(&bytes));
16173 let response = common::to_response(parts, bytes.into());
16174
16175 if let common::Retry::After(d) =
16176 dlg.http_failure(&response, error.as_ref().ok())
16177 {
16178 sleep(d).await;
16179 continue;
16180 }
16181
16182 dlg.finished(false);
16183
16184 return Err(match error {
16185 Ok(value) => common::Error::BadRequest(value),
16186 _ => common::Error::Failure(response),
16187 });
16188 }
16189 let response = {
16190 let bytes = common::to_bytes(body).await.unwrap_or_default();
16191 let encoded = common::to_string(&bytes);
16192 match serde_json::from_str(&encoded) {
16193 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16194 Err(error) => {
16195 dlg.response_json_decode_error(&encoded, &error);
16196 return Err(common::Error::JsonDecodeError(
16197 encoded.to_string(),
16198 error,
16199 ));
16200 }
16201 }
16202 };
16203
16204 dlg.finished(true);
16205 return Ok(response);
16206 }
16207 }
16208 }
16209 }
16210
16211 ///
16212 /// Sets the *request* property to the given value.
16213 ///
16214 /// Even though the property as already been set when instantiating this call,
16215 /// we provide this method for API completeness.
16216 pub fn request(
16217 mut self,
16218 new_value: DeliveryPipeline,
16219 ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
16220 self._request = new_value;
16221 self
16222 }
16223 /// Required. The parent collection in which the `DeliveryPipeline` must be created. The format is `projects/{project_id}/locations/{location_name}`.
16224 ///
16225 /// Sets the *parent* path property to the given value.
16226 ///
16227 /// Even though the property as already been set when instantiating this call,
16228 /// we provide this method for API completeness.
16229 pub fn parent(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
16230 self._parent = new_value.to_string();
16231 self
16232 }
16233 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
16234 ///
16235 /// Sets the *validate only* query property to the given value.
16236 pub fn validate_only(
16237 mut self,
16238 new_value: bool,
16239 ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
16240 self._validate_only = Some(new_value);
16241 self
16242 }
16243 /// 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).
16244 ///
16245 /// Sets the *request id* query property to the given value.
16246 pub fn request_id(
16247 mut self,
16248 new_value: &str,
16249 ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
16250 self._request_id = Some(new_value.to_string());
16251 self
16252 }
16253 /// Required. ID of the `DeliveryPipeline`.
16254 ///
16255 /// Sets the *delivery pipeline id* query property to the given value.
16256 pub fn delivery_pipeline_id(
16257 mut self,
16258 new_value: &str,
16259 ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
16260 self._delivery_pipeline_id = Some(new_value.to_string());
16261 self
16262 }
16263 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16264 /// while executing the actual API request.
16265 ///
16266 /// ````text
16267 /// It should be used to handle progress information, and to implement a certain level of resilience.
16268 /// ````
16269 ///
16270 /// Sets the *delegate* property to the given value.
16271 pub fn delegate(
16272 mut self,
16273 new_value: &'a mut dyn common::Delegate,
16274 ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
16275 self._delegate = Some(new_value);
16276 self
16277 }
16278
16279 /// Set any additional parameter of the query string used in the request.
16280 /// It should be used to set parameters which are not yet available through their own
16281 /// setters.
16282 ///
16283 /// Please note that this method must not be used to set any of the known parameters
16284 /// which have their own setter method. If done anyway, the request will fail.
16285 ///
16286 /// # Additional Parameters
16287 ///
16288 /// * *$.xgafv* (query-string) - V1 error format.
16289 /// * *access_token* (query-string) - OAuth access token.
16290 /// * *alt* (query-string) - Data format for response.
16291 /// * *callback* (query-string) - JSONP
16292 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16293 /// * *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.
16294 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16295 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16296 /// * *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.
16297 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16298 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16299 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineCreateCall<'a, C>
16300 where
16301 T: AsRef<str>,
16302 {
16303 self._additional_params
16304 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16305 self
16306 }
16307
16308 /// Identifies the authorization scope for the method you are building.
16309 ///
16310 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16311 /// [`Scope::CloudPlatform`].
16312 ///
16313 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16314 /// tokens for more than one scope.
16315 ///
16316 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16317 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16318 /// sufficient, a read-write scope will do as well.
16319 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineCreateCall<'a, C>
16320 where
16321 St: AsRef<str>,
16322 {
16323 self._scopes.insert(String::from(scope.as_ref()));
16324 self
16325 }
16326 /// Identifies the authorization scope(s) for the method you are building.
16327 ///
16328 /// See [`Self::add_scope()`] for details.
16329 pub fn add_scopes<I, St>(
16330 mut self,
16331 scopes: I,
16332 ) -> ProjectLocationDeliveryPipelineCreateCall<'a, C>
16333 where
16334 I: IntoIterator<Item = St>,
16335 St: AsRef<str>,
16336 {
16337 self._scopes
16338 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16339 self
16340 }
16341
16342 /// Removes all scopes, and no default scope will be used either.
16343 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16344 /// for details).
16345 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineCreateCall<'a, C> {
16346 self._scopes.clear();
16347 self
16348 }
16349}
16350
16351/// Deletes a single DeliveryPipeline.
16352///
16353/// A builder for the *locations.deliveryPipelines.delete* method supported by a *project* resource.
16354/// It is not used directly, but through a [`ProjectMethods`] instance.
16355///
16356/// # Example
16357///
16358/// Instantiate a resource method builder
16359///
16360/// ```test_harness,no_run
16361/// # extern crate hyper;
16362/// # extern crate hyper_rustls;
16363/// # extern crate google_clouddeploy1 as clouddeploy1;
16364/// # async fn dox() {
16365/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16366///
16367/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16368/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16369/// # .with_native_roots()
16370/// # .unwrap()
16371/// # .https_only()
16372/// # .enable_http2()
16373/// # .build();
16374///
16375/// # let executor = hyper_util::rt::TokioExecutor::new();
16376/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16377/// # secret,
16378/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16379/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16380/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16381/// # ),
16382/// # ).build().await.unwrap();
16383///
16384/// # let client = hyper_util::client::legacy::Client::builder(
16385/// # hyper_util::rt::TokioExecutor::new()
16386/// # )
16387/// # .build(
16388/// # hyper_rustls::HttpsConnectorBuilder::new()
16389/// # .with_native_roots()
16390/// # .unwrap()
16391/// # .https_or_http()
16392/// # .enable_http2()
16393/// # .build()
16394/// # );
16395/// # let mut hub = CloudDeploy::new(client, auth);
16396/// // You can configure optional parameters by calling the respective setters at will, and
16397/// // execute the final call using `doit()`.
16398/// // Values shown here are possibly random and not representative !
16399/// let result = hub.projects().locations_delivery_pipelines_delete("name")
16400/// .validate_only(false)
16401/// .request_id("sed")
16402/// .force(true)
16403/// .etag("nonumy")
16404/// .allow_missing(false)
16405/// .doit().await;
16406/// # }
16407/// ```
16408pub struct ProjectLocationDeliveryPipelineDeleteCall<'a, C>
16409where
16410 C: 'a,
16411{
16412 hub: &'a CloudDeploy<C>,
16413 _name: String,
16414 _validate_only: Option<bool>,
16415 _request_id: Option<String>,
16416 _force: Option<bool>,
16417 _etag: Option<String>,
16418 _allow_missing: Option<bool>,
16419 _delegate: Option<&'a mut dyn common::Delegate>,
16420 _additional_params: HashMap<String, String>,
16421 _scopes: BTreeSet<String>,
16422}
16423
16424impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineDeleteCall<'a, C> {}
16425
16426impl<'a, C> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
16427where
16428 C: common::Connector,
16429{
16430 /// Perform the operation you have build so far.
16431 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16432 use std::borrow::Cow;
16433 use std::io::{Read, Seek};
16434
16435 use common::{url::Params, ToParts};
16436 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16437
16438 let mut dd = common::DefaultDelegate;
16439 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16440 dlg.begin(common::MethodInfo {
16441 id: "clouddeploy.projects.locations.deliveryPipelines.delete",
16442 http_method: hyper::Method::DELETE,
16443 });
16444
16445 for &field in [
16446 "alt",
16447 "name",
16448 "validateOnly",
16449 "requestId",
16450 "force",
16451 "etag",
16452 "allowMissing",
16453 ]
16454 .iter()
16455 {
16456 if self._additional_params.contains_key(field) {
16457 dlg.finished(false);
16458 return Err(common::Error::FieldClash(field));
16459 }
16460 }
16461
16462 let mut params = Params::with_capacity(8 + self._additional_params.len());
16463 params.push("name", self._name);
16464 if let Some(value) = self._validate_only.as_ref() {
16465 params.push("validateOnly", value.to_string());
16466 }
16467 if let Some(value) = self._request_id.as_ref() {
16468 params.push("requestId", value);
16469 }
16470 if let Some(value) = self._force.as_ref() {
16471 params.push("force", value.to_string());
16472 }
16473 if let Some(value) = self._etag.as_ref() {
16474 params.push("etag", value);
16475 }
16476 if let Some(value) = self._allow_missing.as_ref() {
16477 params.push("allowMissing", value.to_string());
16478 }
16479
16480 params.extend(self._additional_params.iter());
16481
16482 params.push("alt", "json");
16483 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16484 if self._scopes.is_empty() {
16485 self._scopes
16486 .insert(Scope::CloudPlatform.as_ref().to_string());
16487 }
16488
16489 #[allow(clippy::single_element_loop)]
16490 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16491 url = params.uri_replacement(url, param_name, find_this, true);
16492 }
16493 {
16494 let to_remove = ["name"];
16495 params.remove_params(&to_remove);
16496 }
16497
16498 let url = params.parse_with_url(&url);
16499
16500 loop {
16501 let token = match self
16502 .hub
16503 .auth
16504 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16505 .await
16506 {
16507 Ok(token) => token,
16508 Err(e) => match dlg.token(e) {
16509 Ok(token) => token,
16510 Err(e) => {
16511 dlg.finished(false);
16512 return Err(common::Error::MissingToken(e));
16513 }
16514 },
16515 };
16516 let mut req_result = {
16517 let client = &self.hub.client;
16518 dlg.pre_request();
16519 let mut req_builder = hyper::Request::builder()
16520 .method(hyper::Method::DELETE)
16521 .uri(url.as_str())
16522 .header(USER_AGENT, self.hub._user_agent.clone());
16523
16524 if let Some(token) = token.as_ref() {
16525 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16526 }
16527
16528 let request = req_builder
16529 .header(CONTENT_LENGTH, 0_u64)
16530 .body(common::to_body::<String>(None));
16531
16532 client.request(request.unwrap()).await
16533 };
16534
16535 match req_result {
16536 Err(err) => {
16537 if let common::Retry::After(d) = dlg.http_error(&err) {
16538 sleep(d).await;
16539 continue;
16540 }
16541 dlg.finished(false);
16542 return Err(common::Error::HttpError(err));
16543 }
16544 Ok(res) => {
16545 let (mut parts, body) = res.into_parts();
16546 let mut body = common::Body::new(body);
16547 if !parts.status.is_success() {
16548 let bytes = common::to_bytes(body).await.unwrap_or_default();
16549 let error = serde_json::from_str(&common::to_string(&bytes));
16550 let response = common::to_response(parts, bytes.into());
16551
16552 if let common::Retry::After(d) =
16553 dlg.http_failure(&response, error.as_ref().ok())
16554 {
16555 sleep(d).await;
16556 continue;
16557 }
16558
16559 dlg.finished(false);
16560
16561 return Err(match error {
16562 Ok(value) => common::Error::BadRequest(value),
16563 _ => common::Error::Failure(response),
16564 });
16565 }
16566 let response = {
16567 let bytes = common::to_bytes(body).await.unwrap_or_default();
16568 let encoded = common::to_string(&bytes);
16569 match serde_json::from_str(&encoded) {
16570 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16571 Err(error) => {
16572 dlg.response_json_decode_error(&encoded, &error);
16573 return Err(common::Error::JsonDecodeError(
16574 encoded.to_string(),
16575 error,
16576 ));
16577 }
16578 }
16579 };
16580
16581 dlg.finished(true);
16582 return Ok(response);
16583 }
16584 }
16585 }
16586 }
16587
16588 /// Required. The name of the `DeliveryPipeline` to delete. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
16589 ///
16590 /// Sets the *name* path property to the given value.
16591 ///
16592 /// Even though the property as already been set when instantiating this call,
16593 /// we provide this method for API completeness.
16594 pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16595 self._name = new_value.to_string();
16596 self
16597 }
16598 /// Optional. If set, validate the request and preview the review, but do not actually post it.
16599 ///
16600 /// Sets the *validate only* query property to the given value.
16601 pub fn validate_only(
16602 mut self,
16603 new_value: bool,
16604 ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16605 self._validate_only = Some(new_value);
16606 self
16607 }
16608 /// 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).
16609 ///
16610 /// Sets the *request id* query property to the given value.
16611 pub fn request_id(
16612 mut self,
16613 new_value: &str,
16614 ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16615 self._request_id = Some(new_value.to_string());
16616 self
16617 }
16618 /// 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.
16619 ///
16620 /// Sets the *force* query property to the given value.
16621 pub fn force(mut self, new_value: bool) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16622 self._force = Some(new_value);
16623 self
16624 }
16625 /// 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.
16626 ///
16627 /// Sets the *etag* query property to the given value.
16628 pub fn etag(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16629 self._etag = Some(new_value.to_string());
16630 self
16631 }
16632 /// Optional. If set to true, then deleting an already deleted or non-existing `DeliveryPipeline` will succeed.
16633 ///
16634 /// Sets the *allow missing* query property to the given value.
16635 pub fn allow_missing(
16636 mut self,
16637 new_value: bool,
16638 ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16639 self._allow_missing = Some(new_value);
16640 self
16641 }
16642 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16643 /// while executing the actual API request.
16644 ///
16645 /// ````text
16646 /// It should be used to handle progress information, and to implement a certain level of resilience.
16647 /// ````
16648 ///
16649 /// Sets the *delegate* property to the given value.
16650 pub fn delegate(
16651 mut self,
16652 new_value: &'a mut dyn common::Delegate,
16653 ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16654 self._delegate = Some(new_value);
16655 self
16656 }
16657
16658 /// Set any additional parameter of the query string used in the request.
16659 /// It should be used to set parameters which are not yet available through their own
16660 /// setters.
16661 ///
16662 /// Please note that this method must not be used to set any of the known parameters
16663 /// which have their own setter method. If done anyway, the request will fail.
16664 ///
16665 /// # Additional Parameters
16666 ///
16667 /// * *$.xgafv* (query-string) - V1 error format.
16668 /// * *access_token* (query-string) - OAuth access token.
16669 /// * *alt* (query-string) - Data format for response.
16670 /// * *callback* (query-string) - JSONP
16671 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16672 /// * *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.
16673 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16674 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16675 /// * *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.
16676 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16677 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16678 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
16679 where
16680 T: AsRef<str>,
16681 {
16682 self._additional_params
16683 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16684 self
16685 }
16686
16687 /// Identifies the authorization scope for the method you are building.
16688 ///
16689 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16690 /// [`Scope::CloudPlatform`].
16691 ///
16692 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16693 /// tokens for more than one scope.
16694 ///
16695 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16696 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16697 /// sufficient, a read-write scope will do as well.
16698 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
16699 where
16700 St: AsRef<str>,
16701 {
16702 self._scopes.insert(String::from(scope.as_ref()));
16703 self
16704 }
16705 /// Identifies the authorization scope(s) for the method you are building.
16706 ///
16707 /// See [`Self::add_scope()`] for details.
16708 pub fn add_scopes<I, St>(
16709 mut self,
16710 scopes: I,
16711 ) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C>
16712 where
16713 I: IntoIterator<Item = St>,
16714 St: AsRef<str>,
16715 {
16716 self._scopes
16717 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16718 self
16719 }
16720
16721 /// Removes all scopes, and no default scope will be used either.
16722 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16723 /// for details).
16724 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineDeleteCall<'a, C> {
16725 self._scopes.clear();
16726 self
16727 }
16728}
16729
16730/// Gets details of a single DeliveryPipeline.
16731///
16732/// A builder for the *locations.deliveryPipelines.get* method supported by a *project* resource.
16733/// It is not used directly, but through a [`ProjectMethods`] instance.
16734///
16735/// # Example
16736///
16737/// Instantiate a resource method builder
16738///
16739/// ```test_harness,no_run
16740/// # extern crate hyper;
16741/// # extern crate hyper_rustls;
16742/// # extern crate google_clouddeploy1 as clouddeploy1;
16743/// # async fn dox() {
16744/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16745///
16746/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16747/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16748/// # .with_native_roots()
16749/// # .unwrap()
16750/// # .https_only()
16751/// # .enable_http2()
16752/// # .build();
16753///
16754/// # let executor = hyper_util::rt::TokioExecutor::new();
16755/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16756/// # secret,
16757/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16758/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16759/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16760/// # ),
16761/// # ).build().await.unwrap();
16762///
16763/// # let client = hyper_util::client::legacy::Client::builder(
16764/// # hyper_util::rt::TokioExecutor::new()
16765/// # )
16766/// # .build(
16767/// # hyper_rustls::HttpsConnectorBuilder::new()
16768/// # .with_native_roots()
16769/// # .unwrap()
16770/// # .https_or_http()
16771/// # .enable_http2()
16772/// # .build()
16773/// # );
16774/// # let mut hub = CloudDeploy::new(client, auth);
16775/// // You can configure optional parameters by calling the respective setters at will, and
16776/// // execute the final call using `doit()`.
16777/// // Values shown here are possibly random and not representative !
16778/// let result = hub.projects().locations_delivery_pipelines_get("name")
16779/// .doit().await;
16780/// # }
16781/// ```
16782pub struct ProjectLocationDeliveryPipelineGetCall<'a, C>
16783where
16784 C: 'a,
16785{
16786 hub: &'a CloudDeploy<C>,
16787 _name: String,
16788 _delegate: Option<&'a mut dyn common::Delegate>,
16789 _additional_params: HashMap<String, String>,
16790 _scopes: BTreeSet<String>,
16791}
16792
16793impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineGetCall<'a, C> {}
16794
16795impl<'a, C> ProjectLocationDeliveryPipelineGetCall<'a, C>
16796where
16797 C: common::Connector,
16798{
16799 /// Perform the operation you have build so far.
16800 pub async fn doit(mut self) -> common::Result<(common::Response, DeliveryPipeline)> {
16801 use std::borrow::Cow;
16802 use std::io::{Read, Seek};
16803
16804 use common::{url::Params, ToParts};
16805 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16806
16807 let mut dd = common::DefaultDelegate;
16808 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16809 dlg.begin(common::MethodInfo {
16810 id: "clouddeploy.projects.locations.deliveryPipelines.get",
16811 http_method: hyper::Method::GET,
16812 });
16813
16814 for &field in ["alt", "name"].iter() {
16815 if self._additional_params.contains_key(field) {
16816 dlg.finished(false);
16817 return Err(common::Error::FieldClash(field));
16818 }
16819 }
16820
16821 let mut params = Params::with_capacity(3 + self._additional_params.len());
16822 params.push("name", self._name);
16823
16824 params.extend(self._additional_params.iter());
16825
16826 params.push("alt", "json");
16827 let mut url = self.hub._base_url.clone() + "v1/{+name}";
16828 if self._scopes.is_empty() {
16829 self._scopes
16830 .insert(Scope::CloudPlatform.as_ref().to_string());
16831 }
16832
16833 #[allow(clippy::single_element_loop)]
16834 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16835 url = params.uri_replacement(url, param_name, find_this, true);
16836 }
16837 {
16838 let to_remove = ["name"];
16839 params.remove_params(&to_remove);
16840 }
16841
16842 let url = params.parse_with_url(&url);
16843
16844 loop {
16845 let token = match self
16846 .hub
16847 .auth
16848 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16849 .await
16850 {
16851 Ok(token) => token,
16852 Err(e) => match dlg.token(e) {
16853 Ok(token) => token,
16854 Err(e) => {
16855 dlg.finished(false);
16856 return Err(common::Error::MissingToken(e));
16857 }
16858 },
16859 };
16860 let mut req_result = {
16861 let client = &self.hub.client;
16862 dlg.pre_request();
16863 let mut req_builder = hyper::Request::builder()
16864 .method(hyper::Method::GET)
16865 .uri(url.as_str())
16866 .header(USER_AGENT, self.hub._user_agent.clone());
16867
16868 if let Some(token) = token.as_ref() {
16869 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16870 }
16871
16872 let request = req_builder
16873 .header(CONTENT_LENGTH, 0_u64)
16874 .body(common::to_body::<String>(None));
16875
16876 client.request(request.unwrap()).await
16877 };
16878
16879 match req_result {
16880 Err(err) => {
16881 if let common::Retry::After(d) = dlg.http_error(&err) {
16882 sleep(d).await;
16883 continue;
16884 }
16885 dlg.finished(false);
16886 return Err(common::Error::HttpError(err));
16887 }
16888 Ok(res) => {
16889 let (mut parts, body) = res.into_parts();
16890 let mut body = common::Body::new(body);
16891 if !parts.status.is_success() {
16892 let bytes = common::to_bytes(body).await.unwrap_or_default();
16893 let error = serde_json::from_str(&common::to_string(&bytes));
16894 let response = common::to_response(parts, bytes.into());
16895
16896 if let common::Retry::After(d) =
16897 dlg.http_failure(&response, error.as_ref().ok())
16898 {
16899 sleep(d).await;
16900 continue;
16901 }
16902
16903 dlg.finished(false);
16904
16905 return Err(match error {
16906 Ok(value) => common::Error::BadRequest(value),
16907 _ => common::Error::Failure(response),
16908 });
16909 }
16910 let response = {
16911 let bytes = common::to_bytes(body).await.unwrap_or_default();
16912 let encoded = common::to_string(&bytes);
16913 match serde_json::from_str(&encoded) {
16914 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16915 Err(error) => {
16916 dlg.response_json_decode_error(&encoded, &error);
16917 return Err(common::Error::JsonDecodeError(
16918 encoded.to_string(),
16919 error,
16920 ));
16921 }
16922 }
16923 };
16924
16925 dlg.finished(true);
16926 return Ok(response);
16927 }
16928 }
16929 }
16930 }
16931
16932 /// Required. Name of the `DeliveryPipeline`. Format must be `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
16933 ///
16934 /// Sets the *name* path property to the given value.
16935 ///
16936 /// Even though the property as already been set when instantiating this call,
16937 /// we provide this method for API completeness.
16938 pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
16939 self._name = new_value.to_string();
16940 self
16941 }
16942 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16943 /// while executing the actual API request.
16944 ///
16945 /// ````text
16946 /// It should be used to handle progress information, and to implement a certain level of resilience.
16947 /// ````
16948 ///
16949 /// Sets the *delegate* property to the given value.
16950 pub fn delegate(
16951 mut self,
16952 new_value: &'a mut dyn common::Delegate,
16953 ) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
16954 self._delegate = Some(new_value);
16955 self
16956 }
16957
16958 /// Set any additional parameter of the query string used in the request.
16959 /// It should be used to set parameters which are not yet available through their own
16960 /// setters.
16961 ///
16962 /// Please note that this method must not be used to set any of the known parameters
16963 /// which have their own setter method. If done anyway, the request will fail.
16964 ///
16965 /// # Additional Parameters
16966 ///
16967 /// * *$.xgafv* (query-string) - V1 error format.
16968 /// * *access_token* (query-string) - OAuth access token.
16969 /// * *alt* (query-string) - Data format for response.
16970 /// * *callback* (query-string) - JSONP
16971 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16972 /// * *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.
16973 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16974 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16975 /// * *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.
16976 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16977 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16978 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineGetCall<'a, C>
16979 where
16980 T: AsRef<str>,
16981 {
16982 self._additional_params
16983 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16984 self
16985 }
16986
16987 /// Identifies the authorization scope for the method you are building.
16988 ///
16989 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16990 /// [`Scope::CloudPlatform`].
16991 ///
16992 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16993 /// tokens for more than one scope.
16994 ///
16995 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16996 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16997 /// sufficient, a read-write scope will do as well.
16998 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineGetCall<'a, C>
16999 where
17000 St: AsRef<str>,
17001 {
17002 self._scopes.insert(String::from(scope.as_ref()));
17003 self
17004 }
17005 /// Identifies the authorization scope(s) for the method you are building.
17006 ///
17007 /// See [`Self::add_scope()`] for details.
17008 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeliveryPipelineGetCall<'a, C>
17009 where
17010 I: IntoIterator<Item = St>,
17011 St: AsRef<str>,
17012 {
17013 self._scopes
17014 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17015 self
17016 }
17017
17018 /// Removes all scopes, and no default scope will be used either.
17019 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17020 /// for details).
17021 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineGetCall<'a, C> {
17022 self._scopes.clear();
17023 self
17024 }
17025}
17026
17027/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
17028///
17029/// A builder for the *locations.deliveryPipelines.getIamPolicy* method supported by a *project* resource.
17030/// It is not used directly, but through a [`ProjectMethods`] instance.
17031///
17032/// # Example
17033///
17034/// Instantiate a resource method builder
17035///
17036/// ```test_harness,no_run
17037/// # extern crate hyper;
17038/// # extern crate hyper_rustls;
17039/// # extern crate google_clouddeploy1 as clouddeploy1;
17040/// # async fn dox() {
17041/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17042///
17043/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17044/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17045/// # .with_native_roots()
17046/// # .unwrap()
17047/// # .https_only()
17048/// # .enable_http2()
17049/// # .build();
17050///
17051/// # let executor = hyper_util::rt::TokioExecutor::new();
17052/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17053/// # secret,
17054/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17055/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17056/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17057/// # ),
17058/// # ).build().await.unwrap();
17059///
17060/// # let client = hyper_util::client::legacy::Client::builder(
17061/// # hyper_util::rt::TokioExecutor::new()
17062/// # )
17063/// # .build(
17064/// # hyper_rustls::HttpsConnectorBuilder::new()
17065/// # .with_native_roots()
17066/// # .unwrap()
17067/// # .https_or_http()
17068/// # .enable_http2()
17069/// # .build()
17070/// # );
17071/// # let mut hub = CloudDeploy::new(client, auth);
17072/// // You can configure optional parameters by calling the respective setters at will, and
17073/// // execute the final call using `doit()`.
17074/// // Values shown here are possibly random and not representative !
17075/// let result = hub.projects().locations_delivery_pipelines_get_iam_policy("resource")
17076/// .options_requested_policy_version(-69)
17077/// .doit().await;
17078/// # }
17079/// ```
17080pub struct ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
17081where
17082 C: 'a,
17083{
17084 hub: &'a CloudDeploy<C>,
17085 _resource: String,
17086 _options_requested_policy_version: Option<i32>,
17087 _delegate: Option<&'a mut dyn common::Delegate>,
17088 _additional_params: HashMap<String, String>,
17089 _scopes: BTreeSet<String>,
17090}
17091
17092impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {}
17093
17094impl<'a, C> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
17095where
17096 C: common::Connector,
17097{
17098 /// Perform the operation you have build so far.
17099 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
17100 use std::borrow::Cow;
17101 use std::io::{Read, Seek};
17102
17103 use common::{url::Params, ToParts};
17104 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17105
17106 let mut dd = common::DefaultDelegate;
17107 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17108 dlg.begin(common::MethodInfo {
17109 id: "clouddeploy.projects.locations.deliveryPipelines.getIamPolicy",
17110 http_method: hyper::Method::GET,
17111 });
17112
17113 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
17114 if self._additional_params.contains_key(field) {
17115 dlg.finished(false);
17116 return Err(common::Error::FieldClash(field));
17117 }
17118 }
17119
17120 let mut params = Params::with_capacity(4 + self._additional_params.len());
17121 params.push("resource", self._resource);
17122 if let Some(value) = self._options_requested_policy_version.as_ref() {
17123 params.push("options.requestedPolicyVersion", value.to_string());
17124 }
17125
17126 params.extend(self._additional_params.iter());
17127
17128 params.push("alt", "json");
17129 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
17130 if self._scopes.is_empty() {
17131 self._scopes
17132 .insert(Scope::CloudPlatform.as_ref().to_string());
17133 }
17134
17135 #[allow(clippy::single_element_loop)]
17136 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
17137 url = params.uri_replacement(url, param_name, find_this, true);
17138 }
17139 {
17140 let to_remove = ["resource"];
17141 params.remove_params(&to_remove);
17142 }
17143
17144 let url = params.parse_with_url(&url);
17145
17146 loop {
17147 let token = match self
17148 .hub
17149 .auth
17150 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17151 .await
17152 {
17153 Ok(token) => token,
17154 Err(e) => match dlg.token(e) {
17155 Ok(token) => token,
17156 Err(e) => {
17157 dlg.finished(false);
17158 return Err(common::Error::MissingToken(e));
17159 }
17160 },
17161 };
17162 let mut req_result = {
17163 let client = &self.hub.client;
17164 dlg.pre_request();
17165 let mut req_builder = hyper::Request::builder()
17166 .method(hyper::Method::GET)
17167 .uri(url.as_str())
17168 .header(USER_AGENT, self.hub._user_agent.clone());
17169
17170 if let Some(token) = token.as_ref() {
17171 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17172 }
17173
17174 let request = req_builder
17175 .header(CONTENT_LENGTH, 0_u64)
17176 .body(common::to_body::<String>(None));
17177
17178 client.request(request.unwrap()).await
17179 };
17180
17181 match req_result {
17182 Err(err) => {
17183 if let common::Retry::After(d) = dlg.http_error(&err) {
17184 sleep(d).await;
17185 continue;
17186 }
17187 dlg.finished(false);
17188 return Err(common::Error::HttpError(err));
17189 }
17190 Ok(res) => {
17191 let (mut parts, body) = res.into_parts();
17192 let mut body = common::Body::new(body);
17193 if !parts.status.is_success() {
17194 let bytes = common::to_bytes(body).await.unwrap_or_default();
17195 let error = serde_json::from_str(&common::to_string(&bytes));
17196 let response = common::to_response(parts, bytes.into());
17197
17198 if let common::Retry::After(d) =
17199 dlg.http_failure(&response, error.as_ref().ok())
17200 {
17201 sleep(d).await;
17202 continue;
17203 }
17204
17205 dlg.finished(false);
17206
17207 return Err(match error {
17208 Ok(value) => common::Error::BadRequest(value),
17209 _ => common::Error::Failure(response),
17210 });
17211 }
17212 let response = {
17213 let bytes = common::to_bytes(body).await.unwrap_or_default();
17214 let encoded = common::to_string(&bytes);
17215 match serde_json::from_str(&encoded) {
17216 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17217 Err(error) => {
17218 dlg.response_json_decode_error(&encoded, &error);
17219 return Err(common::Error::JsonDecodeError(
17220 encoded.to_string(),
17221 error,
17222 ));
17223 }
17224 }
17225 };
17226
17227 dlg.finished(true);
17228 return Ok(response);
17229 }
17230 }
17231 }
17232 }
17233
17234 /// 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.
17235 ///
17236 /// Sets the *resource* path property to the given value.
17237 ///
17238 /// Even though the property as already been set when instantiating this call,
17239 /// we provide this method for API completeness.
17240 pub fn resource(
17241 mut self,
17242 new_value: &str,
17243 ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
17244 self._resource = new_value.to_string();
17245 self
17246 }
17247 /// 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).
17248 ///
17249 /// Sets the *options.requested policy version* query property to the given value.
17250 pub fn options_requested_policy_version(
17251 mut self,
17252 new_value: i32,
17253 ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
17254 self._options_requested_policy_version = Some(new_value);
17255 self
17256 }
17257 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17258 /// while executing the actual API request.
17259 ///
17260 /// ````text
17261 /// It should be used to handle progress information, and to implement a certain level of resilience.
17262 /// ````
17263 ///
17264 /// Sets the *delegate* property to the given value.
17265 pub fn delegate(
17266 mut self,
17267 new_value: &'a mut dyn common::Delegate,
17268 ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
17269 self._delegate = Some(new_value);
17270 self
17271 }
17272
17273 /// Set any additional parameter of the query string used in the request.
17274 /// It should be used to set parameters which are not yet available through their own
17275 /// setters.
17276 ///
17277 /// Please note that this method must not be used to set any of the known parameters
17278 /// which have their own setter method. If done anyway, the request will fail.
17279 ///
17280 /// # Additional Parameters
17281 ///
17282 /// * *$.xgafv* (query-string) - V1 error format.
17283 /// * *access_token* (query-string) - OAuth access token.
17284 /// * *alt* (query-string) - Data format for response.
17285 /// * *callback* (query-string) - JSONP
17286 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17287 /// * *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.
17288 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17289 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17290 /// * *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.
17291 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17292 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17293 pub fn param<T>(
17294 mut self,
17295 name: T,
17296 value: T,
17297 ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
17298 where
17299 T: AsRef<str>,
17300 {
17301 self._additional_params
17302 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17303 self
17304 }
17305
17306 /// Identifies the authorization scope for the method you are building.
17307 ///
17308 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17309 /// [`Scope::CloudPlatform`].
17310 ///
17311 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17312 /// tokens for more than one scope.
17313 ///
17314 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17315 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17316 /// sufficient, a read-write scope will do as well.
17317 pub fn add_scope<St>(
17318 mut self,
17319 scope: St,
17320 ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
17321 where
17322 St: AsRef<str>,
17323 {
17324 self._scopes.insert(String::from(scope.as_ref()));
17325 self
17326 }
17327 /// Identifies the authorization scope(s) for the method you are building.
17328 ///
17329 /// See [`Self::add_scope()`] for details.
17330 pub fn add_scopes<I, St>(
17331 mut self,
17332 scopes: I,
17333 ) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C>
17334 where
17335 I: IntoIterator<Item = St>,
17336 St: AsRef<str>,
17337 {
17338 self._scopes
17339 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17340 self
17341 }
17342
17343 /// Removes all scopes, and no default scope will be used either.
17344 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17345 /// for details).
17346 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineGetIamPolicyCall<'a, C> {
17347 self._scopes.clear();
17348 self
17349 }
17350}
17351
17352/// Lists DeliveryPipelines in a given project and location.
17353///
17354/// A builder for the *locations.deliveryPipelines.list* method supported by a *project* resource.
17355/// It is not used directly, but through a [`ProjectMethods`] instance.
17356///
17357/// # Example
17358///
17359/// Instantiate a resource method builder
17360///
17361/// ```test_harness,no_run
17362/// # extern crate hyper;
17363/// # extern crate hyper_rustls;
17364/// # extern crate google_clouddeploy1 as clouddeploy1;
17365/// # async fn dox() {
17366/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17367///
17368/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17369/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17370/// # .with_native_roots()
17371/// # .unwrap()
17372/// # .https_only()
17373/// # .enable_http2()
17374/// # .build();
17375///
17376/// # let executor = hyper_util::rt::TokioExecutor::new();
17377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17378/// # secret,
17379/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17380/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17381/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17382/// # ),
17383/// # ).build().await.unwrap();
17384///
17385/// # let client = hyper_util::client::legacy::Client::builder(
17386/// # hyper_util::rt::TokioExecutor::new()
17387/// # )
17388/// # .build(
17389/// # hyper_rustls::HttpsConnectorBuilder::new()
17390/// # .with_native_roots()
17391/// # .unwrap()
17392/// # .https_or_http()
17393/// # .enable_http2()
17394/// # .build()
17395/// # );
17396/// # let mut hub = CloudDeploy::new(client, auth);
17397/// // You can configure optional parameters by calling the respective setters at will, and
17398/// // execute the final call using `doit()`.
17399/// // Values shown here are possibly random and not representative !
17400/// let result = hub.projects().locations_delivery_pipelines_list("parent")
17401/// .page_token("erat")
17402/// .page_size(-82)
17403/// .order_by("amet")
17404/// .filter("est")
17405/// .doit().await;
17406/// # }
17407/// ```
17408pub struct ProjectLocationDeliveryPipelineListCall<'a, C>
17409where
17410 C: 'a,
17411{
17412 hub: &'a CloudDeploy<C>,
17413 _parent: String,
17414 _page_token: Option<String>,
17415 _page_size: Option<i32>,
17416 _order_by: Option<String>,
17417 _filter: Option<String>,
17418 _delegate: Option<&'a mut dyn common::Delegate>,
17419 _additional_params: HashMap<String, String>,
17420 _scopes: BTreeSet<String>,
17421}
17422
17423impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineListCall<'a, C> {}
17424
17425impl<'a, C> ProjectLocationDeliveryPipelineListCall<'a, C>
17426where
17427 C: common::Connector,
17428{
17429 /// Perform the operation you have build so far.
17430 pub async fn doit(
17431 mut self,
17432 ) -> common::Result<(common::Response, ListDeliveryPipelinesResponse)> {
17433 use std::borrow::Cow;
17434 use std::io::{Read, Seek};
17435
17436 use common::{url::Params, ToParts};
17437 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17438
17439 let mut dd = common::DefaultDelegate;
17440 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17441 dlg.begin(common::MethodInfo {
17442 id: "clouddeploy.projects.locations.deliveryPipelines.list",
17443 http_method: hyper::Method::GET,
17444 });
17445
17446 for &field in [
17447 "alt",
17448 "parent",
17449 "pageToken",
17450 "pageSize",
17451 "orderBy",
17452 "filter",
17453 ]
17454 .iter()
17455 {
17456 if self._additional_params.contains_key(field) {
17457 dlg.finished(false);
17458 return Err(common::Error::FieldClash(field));
17459 }
17460 }
17461
17462 let mut params = Params::with_capacity(7 + self._additional_params.len());
17463 params.push("parent", self._parent);
17464 if let Some(value) = self._page_token.as_ref() {
17465 params.push("pageToken", value);
17466 }
17467 if let Some(value) = self._page_size.as_ref() {
17468 params.push("pageSize", value.to_string());
17469 }
17470 if let Some(value) = self._order_by.as_ref() {
17471 params.push("orderBy", value);
17472 }
17473 if let Some(value) = self._filter.as_ref() {
17474 params.push("filter", value);
17475 }
17476
17477 params.extend(self._additional_params.iter());
17478
17479 params.push("alt", "json");
17480 let mut url = self.hub._base_url.clone() + "v1/{+parent}/deliveryPipelines";
17481 if self._scopes.is_empty() {
17482 self._scopes
17483 .insert(Scope::CloudPlatform.as_ref().to_string());
17484 }
17485
17486 #[allow(clippy::single_element_loop)]
17487 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
17488 url = params.uri_replacement(url, param_name, find_this, true);
17489 }
17490 {
17491 let to_remove = ["parent"];
17492 params.remove_params(&to_remove);
17493 }
17494
17495 let url = params.parse_with_url(&url);
17496
17497 loop {
17498 let token = match self
17499 .hub
17500 .auth
17501 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17502 .await
17503 {
17504 Ok(token) => token,
17505 Err(e) => match dlg.token(e) {
17506 Ok(token) => token,
17507 Err(e) => {
17508 dlg.finished(false);
17509 return Err(common::Error::MissingToken(e));
17510 }
17511 },
17512 };
17513 let mut req_result = {
17514 let client = &self.hub.client;
17515 dlg.pre_request();
17516 let mut req_builder = hyper::Request::builder()
17517 .method(hyper::Method::GET)
17518 .uri(url.as_str())
17519 .header(USER_AGENT, self.hub._user_agent.clone());
17520
17521 if let Some(token) = token.as_ref() {
17522 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17523 }
17524
17525 let request = req_builder
17526 .header(CONTENT_LENGTH, 0_u64)
17527 .body(common::to_body::<String>(None));
17528
17529 client.request(request.unwrap()).await
17530 };
17531
17532 match req_result {
17533 Err(err) => {
17534 if let common::Retry::After(d) = dlg.http_error(&err) {
17535 sleep(d).await;
17536 continue;
17537 }
17538 dlg.finished(false);
17539 return Err(common::Error::HttpError(err));
17540 }
17541 Ok(res) => {
17542 let (mut parts, body) = res.into_parts();
17543 let mut body = common::Body::new(body);
17544 if !parts.status.is_success() {
17545 let bytes = common::to_bytes(body).await.unwrap_or_default();
17546 let error = serde_json::from_str(&common::to_string(&bytes));
17547 let response = common::to_response(parts, bytes.into());
17548
17549 if let common::Retry::After(d) =
17550 dlg.http_failure(&response, error.as_ref().ok())
17551 {
17552 sleep(d).await;
17553 continue;
17554 }
17555
17556 dlg.finished(false);
17557
17558 return Err(match error {
17559 Ok(value) => common::Error::BadRequest(value),
17560 _ => common::Error::Failure(response),
17561 });
17562 }
17563 let response = {
17564 let bytes = common::to_bytes(body).await.unwrap_or_default();
17565 let encoded = common::to_string(&bytes);
17566 match serde_json::from_str(&encoded) {
17567 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17568 Err(error) => {
17569 dlg.response_json_decode_error(&encoded, &error);
17570 return Err(common::Error::JsonDecodeError(
17571 encoded.to_string(),
17572 error,
17573 ));
17574 }
17575 }
17576 };
17577
17578 dlg.finished(true);
17579 return Ok(response);
17580 }
17581 }
17582 }
17583 }
17584
17585 /// Required. The parent, which owns this collection of pipelines. Format must be `projects/{project_id}/locations/{location_name}`.
17586 ///
17587 /// Sets the *parent* path property to the given value.
17588 ///
17589 /// Even though the property as already been set when instantiating this call,
17590 /// we provide this method for API completeness.
17591 pub fn parent(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
17592 self._parent = new_value.to_string();
17593 self
17594 }
17595 /// 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.
17596 ///
17597 /// Sets the *page token* query property to the given value.
17598 pub fn page_token(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
17599 self._page_token = Some(new_value.to_string());
17600 self
17601 }
17602 /// 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.
17603 ///
17604 /// Sets the *page size* query property to the given value.
17605 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
17606 self._page_size = Some(new_value);
17607 self
17608 }
17609 /// Field to sort by. See https://google.aip.dev/132#ordering for more details.
17610 ///
17611 /// Sets the *order by* query property to the given value.
17612 pub fn order_by(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
17613 self._order_by = Some(new_value.to_string());
17614 self
17615 }
17616 /// Filter pipelines to be returned. See https://google.aip.dev/160 for more details.
17617 ///
17618 /// Sets the *filter* query property to the given value.
17619 pub fn filter(mut self, new_value: &str) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
17620 self._filter = Some(new_value.to_string());
17621 self
17622 }
17623 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17624 /// while executing the actual API request.
17625 ///
17626 /// ````text
17627 /// It should be used to handle progress information, and to implement a certain level of resilience.
17628 /// ````
17629 ///
17630 /// Sets the *delegate* property to the given value.
17631 pub fn delegate(
17632 mut self,
17633 new_value: &'a mut dyn common::Delegate,
17634 ) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
17635 self._delegate = Some(new_value);
17636 self
17637 }
17638
17639 /// Set any additional parameter of the query string used in the request.
17640 /// It should be used to set parameters which are not yet available through their own
17641 /// setters.
17642 ///
17643 /// Please note that this method must not be used to set any of the known parameters
17644 /// which have their own setter method. If done anyway, the request will fail.
17645 ///
17646 /// # Additional Parameters
17647 ///
17648 /// * *$.xgafv* (query-string) - V1 error format.
17649 /// * *access_token* (query-string) - OAuth access token.
17650 /// * *alt* (query-string) - Data format for response.
17651 /// * *callback* (query-string) - JSONP
17652 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17653 /// * *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.
17654 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17655 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17656 /// * *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.
17657 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17658 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17659 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelineListCall<'a, C>
17660 where
17661 T: AsRef<str>,
17662 {
17663 self._additional_params
17664 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17665 self
17666 }
17667
17668 /// Identifies the authorization scope for the method you are building.
17669 ///
17670 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17671 /// [`Scope::CloudPlatform`].
17672 ///
17673 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17674 /// tokens for more than one scope.
17675 ///
17676 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17677 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17678 /// sufficient, a read-write scope will do as well.
17679 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelineListCall<'a, C>
17680 where
17681 St: AsRef<str>,
17682 {
17683 self._scopes.insert(String::from(scope.as_ref()));
17684 self
17685 }
17686 /// Identifies the authorization scope(s) for the method you are building.
17687 ///
17688 /// See [`Self::add_scope()`] for details.
17689 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeliveryPipelineListCall<'a, C>
17690 where
17691 I: IntoIterator<Item = St>,
17692 St: AsRef<str>,
17693 {
17694 self._scopes
17695 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17696 self
17697 }
17698
17699 /// Removes all scopes, and no default scope will be used either.
17700 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17701 /// for details).
17702 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineListCall<'a, C> {
17703 self._scopes.clear();
17704 self
17705 }
17706}
17707
17708/// Updates the parameters of a single DeliveryPipeline.
17709///
17710/// A builder for the *locations.deliveryPipelines.patch* method supported by a *project* resource.
17711/// It is not used directly, but through a [`ProjectMethods`] instance.
17712///
17713/// # Example
17714///
17715/// Instantiate a resource method builder
17716///
17717/// ```test_harness,no_run
17718/// # extern crate hyper;
17719/// # extern crate hyper_rustls;
17720/// # extern crate google_clouddeploy1 as clouddeploy1;
17721/// use clouddeploy1::api::DeliveryPipeline;
17722/// # async fn dox() {
17723/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17724///
17725/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17726/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17727/// # .with_native_roots()
17728/// # .unwrap()
17729/// # .https_only()
17730/// # .enable_http2()
17731/// # .build();
17732///
17733/// # let executor = hyper_util::rt::TokioExecutor::new();
17734/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17735/// # secret,
17736/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17737/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17738/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17739/// # ),
17740/// # ).build().await.unwrap();
17741///
17742/// # let client = hyper_util::client::legacy::Client::builder(
17743/// # hyper_util::rt::TokioExecutor::new()
17744/// # )
17745/// # .build(
17746/// # hyper_rustls::HttpsConnectorBuilder::new()
17747/// # .with_native_roots()
17748/// # .unwrap()
17749/// # .https_or_http()
17750/// # .enable_http2()
17751/// # .build()
17752/// # );
17753/// # let mut hub = CloudDeploy::new(client, auth);
17754/// // As the method needs a request, you would usually fill it with the desired information
17755/// // into the respective structure. Some of the parts shown here might not be applicable !
17756/// // Values shown here are possibly random and not representative !
17757/// let mut req = DeliveryPipeline::default();
17758///
17759/// // You can configure optional parameters by calling the respective setters at will, and
17760/// // execute the final call using `doit()`.
17761/// // Values shown here are possibly random and not representative !
17762/// let result = hub.projects().locations_delivery_pipelines_patch(req, "name")
17763/// .validate_only(false)
17764/// .update_mask(FieldMask::new::<&str>(&[]))
17765/// .request_id("consetetur")
17766/// .allow_missing(true)
17767/// .doit().await;
17768/// # }
17769/// ```
17770pub struct ProjectLocationDeliveryPipelinePatchCall<'a, C>
17771where
17772 C: 'a,
17773{
17774 hub: &'a CloudDeploy<C>,
17775 _request: DeliveryPipeline,
17776 _name: String,
17777 _validate_only: Option<bool>,
17778 _update_mask: Option<common::FieldMask>,
17779 _request_id: Option<String>,
17780 _allow_missing: Option<bool>,
17781 _delegate: Option<&'a mut dyn common::Delegate>,
17782 _additional_params: HashMap<String, String>,
17783 _scopes: BTreeSet<String>,
17784}
17785
17786impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelinePatchCall<'a, C> {}
17787
17788impl<'a, C> ProjectLocationDeliveryPipelinePatchCall<'a, C>
17789where
17790 C: common::Connector,
17791{
17792 /// Perform the operation you have build so far.
17793 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17794 use std::borrow::Cow;
17795 use std::io::{Read, Seek};
17796
17797 use common::{url::Params, ToParts};
17798 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17799
17800 let mut dd = common::DefaultDelegate;
17801 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17802 dlg.begin(common::MethodInfo {
17803 id: "clouddeploy.projects.locations.deliveryPipelines.patch",
17804 http_method: hyper::Method::PATCH,
17805 });
17806
17807 for &field in [
17808 "alt",
17809 "name",
17810 "validateOnly",
17811 "updateMask",
17812 "requestId",
17813 "allowMissing",
17814 ]
17815 .iter()
17816 {
17817 if self._additional_params.contains_key(field) {
17818 dlg.finished(false);
17819 return Err(common::Error::FieldClash(field));
17820 }
17821 }
17822
17823 let mut params = Params::with_capacity(8 + self._additional_params.len());
17824 params.push("name", self._name);
17825 if let Some(value) = self._validate_only.as_ref() {
17826 params.push("validateOnly", value.to_string());
17827 }
17828 if let Some(value) = self._update_mask.as_ref() {
17829 params.push("updateMask", value.to_string());
17830 }
17831 if let Some(value) = self._request_id.as_ref() {
17832 params.push("requestId", value);
17833 }
17834 if let Some(value) = self._allow_missing.as_ref() {
17835 params.push("allowMissing", value.to_string());
17836 }
17837
17838 params.extend(self._additional_params.iter());
17839
17840 params.push("alt", "json");
17841 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17842 if self._scopes.is_empty() {
17843 self._scopes
17844 .insert(Scope::CloudPlatform.as_ref().to_string());
17845 }
17846
17847 #[allow(clippy::single_element_loop)]
17848 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17849 url = params.uri_replacement(url, param_name, find_this, true);
17850 }
17851 {
17852 let to_remove = ["name"];
17853 params.remove_params(&to_remove);
17854 }
17855
17856 let url = params.parse_with_url(&url);
17857
17858 let mut json_mime_type = mime::APPLICATION_JSON;
17859 let mut request_value_reader = {
17860 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17861 common::remove_json_null_values(&mut value);
17862 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17863 serde_json::to_writer(&mut dst, &value).unwrap();
17864 dst
17865 };
17866 let request_size = request_value_reader
17867 .seek(std::io::SeekFrom::End(0))
17868 .unwrap();
17869 request_value_reader
17870 .seek(std::io::SeekFrom::Start(0))
17871 .unwrap();
17872
17873 loop {
17874 let token = match self
17875 .hub
17876 .auth
17877 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17878 .await
17879 {
17880 Ok(token) => token,
17881 Err(e) => match dlg.token(e) {
17882 Ok(token) => token,
17883 Err(e) => {
17884 dlg.finished(false);
17885 return Err(common::Error::MissingToken(e));
17886 }
17887 },
17888 };
17889 request_value_reader
17890 .seek(std::io::SeekFrom::Start(0))
17891 .unwrap();
17892 let mut req_result = {
17893 let client = &self.hub.client;
17894 dlg.pre_request();
17895 let mut req_builder = hyper::Request::builder()
17896 .method(hyper::Method::PATCH)
17897 .uri(url.as_str())
17898 .header(USER_AGENT, self.hub._user_agent.clone());
17899
17900 if let Some(token) = token.as_ref() {
17901 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17902 }
17903
17904 let request = req_builder
17905 .header(CONTENT_TYPE, json_mime_type.to_string())
17906 .header(CONTENT_LENGTH, request_size as u64)
17907 .body(common::to_body(
17908 request_value_reader.get_ref().clone().into(),
17909 ));
17910
17911 client.request(request.unwrap()).await
17912 };
17913
17914 match req_result {
17915 Err(err) => {
17916 if let common::Retry::After(d) = dlg.http_error(&err) {
17917 sleep(d).await;
17918 continue;
17919 }
17920 dlg.finished(false);
17921 return Err(common::Error::HttpError(err));
17922 }
17923 Ok(res) => {
17924 let (mut parts, body) = res.into_parts();
17925 let mut body = common::Body::new(body);
17926 if !parts.status.is_success() {
17927 let bytes = common::to_bytes(body).await.unwrap_or_default();
17928 let error = serde_json::from_str(&common::to_string(&bytes));
17929 let response = common::to_response(parts, bytes.into());
17930
17931 if let common::Retry::After(d) =
17932 dlg.http_failure(&response, error.as_ref().ok())
17933 {
17934 sleep(d).await;
17935 continue;
17936 }
17937
17938 dlg.finished(false);
17939
17940 return Err(match error {
17941 Ok(value) => common::Error::BadRequest(value),
17942 _ => common::Error::Failure(response),
17943 });
17944 }
17945 let response = {
17946 let bytes = common::to_bytes(body).await.unwrap_or_default();
17947 let encoded = common::to_string(&bytes);
17948 match serde_json::from_str(&encoded) {
17949 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17950 Err(error) => {
17951 dlg.response_json_decode_error(&encoded, &error);
17952 return Err(common::Error::JsonDecodeError(
17953 encoded.to_string(),
17954 error,
17955 ));
17956 }
17957 }
17958 };
17959
17960 dlg.finished(true);
17961 return Ok(response);
17962 }
17963 }
17964 }
17965 }
17966
17967 ///
17968 /// Sets the *request* property to the given value.
17969 ///
17970 /// Even though the property as already been set when instantiating this call,
17971 /// we provide this method for API completeness.
17972 pub fn request(
17973 mut self,
17974 new_value: DeliveryPipeline,
17975 ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
17976 self._request = new_value;
17977 self
17978 }
17979 /// Identifier. 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])?`
17980 ///
17981 /// Sets the *name* path property to the given value.
17982 ///
17983 /// Even though the property as already been set when instantiating this call,
17984 /// we provide this method for API completeness.
17985 pub fn name(mut self, new_value: &str) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
17986 self._name = new_value.to_string();
17987 self
17988 }
17989 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
17990 ///
17991 /// Sets the *validate only* query property to the given value.
17992 pub fn validate_only(
17993 mut self,
17994 new_value: bool,
17995 ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
17996 self._validate_only = Some(new_value);
17997 self
17998 }
17999 /// Required. Field mask is used to specify the fields to be overwritten by the update in the `DeliveryPipeline` resource. 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.
18000 ///
18001 /// Sets the *update mask* query property to the given value.
18002 pub fn update_mask(
18003 mut self,
18004 new_value: common::FieldMask,
18005 ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
18006 self._update_mask = Some(new_value);
18007 self
18008 }
18009 /// 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).
18010 ///
18011 /// Sets the *request id* query property to the given value.
18012 pub fn request_id(
18013 mut self,
18014 new_value: &str,
18015 ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
18016 self._request_id = Some(new_value.to_string());
18017 self
18018 }
18019 /// Optional. If set to true, updating a `DeliveryPipeline` that does not exist will result in the creation of a new `DeliveryPipeline`.
18020 ///
18021 /// Sets the *allow missing* query property to the given value.
18022 pub fn allow_missing(
18023 mut self,
18024 new_value: bool,
18025 ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
18026 self._allow_missing = Some(new_value);
18027 self
18028 }
18029 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18030 /// while executing the actual API request.
18031 ///
18032 /// ````text
18033 /// It should be used to handle progress information, and to implement a certain level of resilience.
18034 /// ````
18035 ///
18036 /// Sets the *delegate* property to the given value.
18037 pub fn delegate(
18038 mut self,
18039 new_value: &'a mut dyn common::Delegate,
18040 ) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
18041 self._delegate = Some(new_value);
18042 self
18043 }
18044
18045 /// Set any additional parameter of the query string used in the request.
18046 /// It should be used to set parameters which are not yet available through their own
18047 /// setters.
18048 ///
18049 /// Please note that this method must not be used to set any of the known parameters
18050 /// which have their own setter method. If done anyway, the request will fail.
18051 ///
18052 /// # Additional Parameters
18053 ///
18054 /// * *$.xgafv* (query-string) - V1 error format.
18055 /// * *access_token* (query-string) - OAuth access token.
18056 /// * *alt* (query-string) - Data format for response.
18057 /// * *callback* (query-string) - JSONP
18058 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18059 /// * *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.
18060 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18061 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18062 /// * *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.
18063 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18064 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18065 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeliveryPipelinePatchCall<'a, C>
18066 where
18067 T: AsRef<str>,
18068 {
18069 self._additional_params
18070 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18071 self
18072 }
18073
18074 /// Identifies the authorization scope for the method you are building.
18075 ///
18076 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18077 /// [`Scope::CloudPlatform`].
18078 ///
18079 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18080 /// tokens for more than one scope.
18081 ///
18082 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18083 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18084 /// sufficient, a read-write scope will do as well.
18085 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeliveryPipelinePatchCall<'a, C>
18086 where
18087 St: AsRef<str>,
18088 {
18089 self._scopes.insert(String::from(scope.as_ref()));
18090 self
18091 }
18092 /// Identifies the authorization scope(s) for the method you are building.
18093 ///
18094 /// See [`Self::add_scope()`] for details.
18095 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeliveryPipelinePatchCall<'a, C>
18096 where
18097 I: IntoIterator<Item = St>,
18098 St: AsRef<str>,
18099 {
18100 self._scopes
18101 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18102 self
18103 }
18104
18105 /// Removes all scopes, and no default scope will be used either.
18106 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18107 /// for details).
18108 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelinePatchCall<'a, C> {
18109 self._scopes.clear();
18110 self
18111 }
18112}
18113
18114/// Creates a `Rollout` to roll back the specified target.
18115///
18116/// A builder for the *locations.deliveryPipelines.rollbackTarget* method supported by a *project* resource.
18117/// It is not used directly, but through a [`ProjectMethods`] instance.
18118///
18119/// # Example
18120///
18121/// Instantiate a resource method builder
18122///
18123/// ```test_harness,no_run
18124/// # extern crate hyper;
18125/// # extern crate hyper_rustls;
18126/// # extern crate google_clouddeploy1 as clouddeploy1;
18127/// use clouddeploy1::api::RollbackTargetRequest;
18128/// # async fn dox() {
18129/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18130///
18131/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18132/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18133/// # .with_native_roots()
18134/// # .unwrap()
18135/// # .https_only()
18136/// # .enable_http2()
18137/// # .build();
18138///
18139/// # let executor = hyper_util::rt::TokioExecutor::new();
18140/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18141/// # secret,
18142/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18143/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18144/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18145/// # ),
18146/// # ).build().await.unwrap();
18147///
18148/// # let client = hyper_util::client::legacy::Client::builder(
18149/// # hyper_util::rt::TokioExecutor::new()
18150/// # )
18151/// # .build(
18152/// # hyper_rustls::HttpsConnectorBuilder::new()
18153/// # .with_native_roots()
18154/// # .unwrap()
18155/// # .https_or_http()
18156/// # .enable_http2()
18157/// # .build()
18158/// # );
18159/// # let mut hub = CloudDeploy::new(client, auth);
18160/// // As the method needs a request, you would usually fill it with the desired information
18161/// // into the respective structure. Some of the parts shown here might not be applicable !
18162/// // Values shown here are possibly random and not representative !
18163/// let mut req = RollbackTargetRequest::default();
18164///
18165/// // You can configure optional parameters by calling the respective setters at will, and
18166/// // execute the final call using `doit()`.
18167/// // Values shown here are possibly random and not representative !
18168/// let result = hub.projects().locations_delivery_pipelines_rollback_target(req, "name")
18169/// .doit().await;
18170/// # }
18171/// ```
18172pub struct ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
18173where
18174 C: 'a,
18175{
18176 hub: &'a CloudDeploy<C>,
18177 _request: RollbackTargetRequest,
18178 _name: String,
18179 _delegate: Option<&'a mut dyn common::Delegate>,
18180 _additional_params: HashMap<String, String>,
18181 _scopes: BTreeSet<String>,
18182}
18183
18184impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {}
18185
18186impl<'a, C> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
18187where
18188 C: common::Connector,
18189{
18190 /// Perform the operation you have build so far.
18191 pub async fn doit(mut self) -> common::Result<(common::Response, RollbackTargetResponse)> {
18192 use std::borrow::Cow;
18193 use std::io::{Read, Seek};
18194
18195 use common::{url::Params, ToParts};
18196 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18197
18198 let mut dd = common::DefaultDelegate;
18199 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18200 dlg.begin(common::MethodInfo {
18201 id: "clouddeploy.projects.locations.deliveryPipelines.rollbackTarget",
18202 http_method: hyper::Method::POST,
18203 });
18204
18205 for &field in ["alt", "name"].iter() {
18206 if self._additional_params.contains_key(field) {
18207 dlg.finished(false);
18208 return Err(common::Error::FieldClash(field));
18209 }
18210 }
18211
18212 let mut params = Params::with_capacity(4 + self._additional_params.len());
18213 params.push("name", self._name);
18214
18215 params.extend(self._additional_params.iter());
18216
18217 params.push("alt", "json");
18218 let mut url = self.hub._base_url.clone() + "v1/{+name}:rollbackTarget";
18219 if self._scopes.is_empty() {
18220 self._scopes
18221 .insert(Scope::CloudPlatform.as_ref().to_string());
18222 }
18223
18224 #[allow(clippy::single_element_loop)]
18225 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18226 url = params.uri_replacement(url, param_name, find_this, true);
18227 }
18228 {
18229 let to_remove = ["name"];
18230 params.remove_params(&to_remove);
18231 }
18232
18233 let url = params.parse_with_url(&url);
18234
18235 let mut json_mime_type = mime::APPLICATION_JSON;
18236 let mut request_value_reader = {
18237 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18238 common::remove_json_null_values(&mut value);
18239 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18240 serde_json::to_writer(&mut dst, &value).unwrap();
18241 dst
18242 };
18243 let request_size = request_value_reader
18244 .seek(std::io::SeekFrom::End(0))
18245 .unwrap();
18246 request_value_reader
18247 .seek(std::io::SeekFrom::Start(0))
18248 .unwrap();
18249
18250 loop {
18251 let token = match self
18252 .hub
18253 .auth
18254 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18255 .await
18256 {
18257 Ok(token) => token,
18258 Err(e) => match dlg.token(e) {
18259 Ok(token) => token,
18260 Err(e) => {
18261 dlg.finished(false);
18262 return Err(common::Error::MissingToken(e));
18263 }
18264 },
18265 };
18266 request_value_reader
18267 .seek(std::io::SeekFrom::Start(0))
18268 .unwrap();
18269 let mut req_result = {
18270 let client = &self.hub.client;
18271 dlg.pre_request();
18272 let mut req_builder = hyper::Request::builder()
18273 .method(hyper::Method::POST)
18274 .uri(url.as_str())
18275 .header(USER_AGENT, self.hub._user_agent.clone());
18276
18277 if let Some(token) = token.as_ref() {
18278 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18279 }
18280
18281 let request = req_builder
18282 .header(CONTENT_TYPE, json_mime_type.to_string())
18283 .header(CONTENT_LENGTH, request_size as u64)
18284 .body(common::to_body(
18285 request_value_reader.get_ref().clone().into(),
18286 ));
18287
18288 client.request(request.unwrap()).await
18289 };
18290
18291 match req_result {
18292 Err(err) => {
18293 if let common::Retry::After(d) = dlg.http_error(&err) {
18294 sleep(d).await;
18295 continue;
18296 }
18297 dlg.finished(false);
18298 return Err(common::Error::HttpError(err));
18299 }
18300 Ok(res) => {
18301 let (mut parts, body) = res.into_parts();
18302 let mut body = common::Body::new(body);
18303 if !parts.status.is_success() {
18304 let bytes = common::to_bytes(body).await.unwrap_or_default();
18305 let error = serde_json::from_str(&common::to_string(&bytes));
18306 let response = common::to_response(parts, bytes.into());
18307
18308 if let common::Retry::After(d) =
18309 dlg.http_failure(&response, error.as_ref().ok())
18310 {
18311 sleep(d).await;
18312 continue;
18313 }
18314
18315 dlg.finished(false);
18316
18317 return Err(match error {
18318 Ok(value) => common::Error::BadRequest(value),
18319 _ => common::Error::Failure(response),
18320 });
18321 }
18322 let response = {
18323 let bytes = common::to_bytes(body).await.unwrap_or_default();
18324 let encoded = common::to_string(&bytes);
18325 match serde_json::from_str(&encoded) {
18326 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18327 Err(error) => {
18328 dlg.response_json_decode_error(&encoded, &error);
18329 return Err(common::Error::JsonDecodeError(
18330 encoded.to_string(),
18331 error,
18332 ));
18333 }
18334 }
18335 };
18336
18337 dlg.finished(true);
18338 return Ok(response);
18339 }
18340 }
18341 }
18342 }
18343
18344 ///
18345 /// Sets the *request* property to the given value.
18346 ///
18347 /// Even though the property as already been set when instantiating this call,
18348 /// we provide this method for API completeness.
18349 pub fn request(
18350 mut self,
18351 new_value: RollbackTargetRequest,
18352 ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
18353 self._request = new_value;
18354 self
18355 }
18356 /// Required. The `DeliveryPipeline` for which the rollback `Rollout` must be created. The format is `projects/{project_id}/locations/{location_name}/deliveryPipelines/{pipeline_name}`.
18357 ///
18358 /// Sets the *name* path property to the given value.
18359 ///
18360 /// Even though the property as already been set when instantiating this call,
18361 /// we provide this method for API completeness.
18362 pub fn name(
18363 mut self,
18364 new_value: &str,
18365 ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
18366 self._name = new_value.to_string();
18367 self
18368 }
18369 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18370 /// while executing the actual API request.
18371 ///
18372 /// ````text
18373 /// It should be used to handle progress information, and to implement a certain level of resilience.
18374 /// ````
18375 ///
18376 /// Sets the *delegate* property to the given value.
18377 pub fn delegate(
18378 mut self,
18379 new_value: &'a mut dyn common::Delegate,
18380 ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
18381 self._delegate = Some(new_value);
18382 self
18383 }
18384
18385 /// Set any additional parameter of the query string used in the request.
18386 /// It should be used to set parameters which are not yet available through their own
18387 /// setters.
18388 ///
18389 /// Please note that this method must not be used to set any of the known parameters
18390 /// which have their own setter method. If done anyway, the request will fail.
18391 ///
18392 /// # Additional Parameters
18393 ///
18394 /// * *$.xgafv* (query-string) - V1 error format.
18395 /// * *access_token* (query-string) - OAuth access token.
18396 /// * *alt* (query-string) - Data format for response.
18397 /// * *callback* (query-string) - JSONP
18398 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18399 /// * *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.
18400 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18401 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18402 /// * *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.
18403 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18404 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18405 pub fn param<T>(
18406 mut self,
18407 name: T,
18408 value: T,
18409 ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
18410 where
18411 T: AsRef<str>,
18412 {
18413 self._additional_params
18414 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18415 self
18416 }
18417
18418 /// Identifies the authorization scope for the method you are building.
18419 ///
18420 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18421 /// [`Scope::CloudPlatform`].
18422 ///
18423 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18424 /// tokens for more than one scope.
18425 ///
18426 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18427 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18428 /// sufficient, a read-write scope will do as well.
18429 pub fn add_scope<St>(
18430 mut self,
18431 scope: St,
18432 ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
18433 where
18434 St: AsRef<str>,
18435 {
18436 self._scopes.insert(String::from(scope.as_ref()));
18437 self
18438 }
18439 /// Identifies the authorization scope(s) for the method you are building.
18440 ///
18441 /// See [`Self::add_scope()`] for details.
18442 pub fn add_scopes<I, St>(
18443 mut self,
18444 scopes: I,
18445 ) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C>
18446 where
18447 I: IntoIterator<Item = St>,
18448 St: AsRef<str>,
18449 {
18450 self._scopes
18451 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18452 self
18453 }
18454
18455 /// Removes all scopes, and no default scope will be used either.
18456 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18457 /// for details).
18458 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineRollbackTargetCall<'a, C> {
18459 self._scopes.clear();
18460 self
18461 }
18462}
18463
18464/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
18465///
18466/// A builder for the *locations.deliveryPipelines.setIamPolicy* method supported by a *project* resource.
18467/// It is not used directly, but through a [`ProjectMethods`] instance.
18468///
18469/// # Example
18470///
18471/// Instantiate a resource method builder
18472///
18473/// ```test_harness,no_run
18474/// # extern crate hyper;
18475/// # extern crate hyper_rustls;
18476/// # extern crate google_clouddeploy1 as clouddeploy1;
18477/// use clouddeploy1::api::SetIamPolicyRequest;
18478/// # async fn dox() {
18479/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18480///
18481/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18482/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18483/// # .with_native_roots()
18484/// # .unwrap()
18485/// # .https_only()
18486/// # .enable_http2()
18487/// # .build();
18488///
18489/// # let executor = hyper_util::rt::TokioExecutor::new();
18490/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18491/// # secret,
18492/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18493/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18494/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18495/// # ),
18496/// # ).build().await.unwrap();
18497///
18498/// # let client = hyper_util::client::legacy::Client::builder(
18499/// # hyper_util::rt::TokioExecutor::new()
18500/// # )
18501/// # .build(
18502/// # hyper_rustls::HttpsConnectorBuilder::new()
18503/// # .with_native_roots()
18504/// # .unwrap()
18505/// # .https_or_http()
18506/// # .enable_http2()
18507/// # .build()
18508/// # );
18509/// # let mut hub = CloudDeploy::new(client, auth);
18510/// // As the method needs a request, you would usually fill it with the desired information
18511/// // into the respective structure. Some of the parts shown here might not be applicable !
18512/// // Values shown here are possibly random and not representative !
18513/// let mut req = SetIamPolicyRequest::default();
18514///
18515/// // You can configure optional parameters by calling the respective setters at will, and
18516/// // execute the final call using `doit()`.
18517/// // Values shown here are possibly random and not representative !
18518/// let result = hub.projects().locations_delivery_pipelines_set_iam_policy(req, "resource")
18519/// .doit().await;
18520/// # }
18521/// ```
18522pub struct ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
18523where
18524 C: 'a,
18525{
18526 hub: &'a CloudDeploy<C>,
18527 _request: SetIamPolicyRequest,
18528 _resource: String,
18529 _delegate: Option<&'a mut dyn common::Delegate>,
18530 _additional_params: HashMap<String, String>,
18531 _scopes: BTreeSet<String>,
18532}
18533
18534impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {}
18535
18536impl<'a, C> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
18537where
18538 C: common::Connector,
18539{
18540 /// Perform the operation you have build so far.
18541 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
18542 use std::borrow::Cow;
18543 use std::io::{Read, Seek};
18544
18545 use common::{url::Params, ToParts};
18546 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18547
18548 let mut dd = common::DefaultDelegate;
18549 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18550 dlg.begin(common::MethodInfo {
18551 id: "clouddeploy.projects.locations.deliveryPipelines.setIamPolicy",
18552 http_method: hyper::Method::POST,
18553 });
18554
18555 for &field in ["alt", "resource"].iter() {
18556 if self._additional_params.contains_key(field) {
18557 dlg.finished(false);
18558 return Err(common::Error::FieldClash(field));
18559 }
18560 }
18561
18562 let mut params = Params::with_capacity(4 + self._additional_params.len());
18563 params.push("resource", self._resource);
18564
18565 params.extend(self._additional_params.iter());
18566
18567 params.push("alt", "json");
18568 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
18569 if self._scopes.is_empty() {
18570 self._scopes
18571 .insert(Scope::CloudPlatform.as_ref().to_string());
18572 }
18573
18574 #[allow(clippy::single_element_loop)]
18575 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18576 url = params.uri_replacement(url, param_name, find_this, true);
18577 }
18578 {
18579 let to_remove = ["resource"];
18580 params.remove_params(&to_remove);
18581 }
18582
18583 let url = params.parse_with_url(&url);
18584
18585 let mut json_mime_type = mime::APPLICATION_JSON;
18586 let mut request_value_reader = {
18587 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18588 common::remove_json_null_values(&mut value);
18589 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18590 serde_json::to_writer(&mut dst, &value).unwrap();
18591 dst
18592 };
18593 let request_size = request_value_reader
18594 .seek(std::io::SeekFrom::End(0))
18595 .unwrap();
18596 request_value_reader
18597 .seek(std::io::SeekFrom::Start(0))
18598 .unwrap();
18599
18600 loop {
18601 let token = match self
18602 .hub
18603 .auth
18604 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18605 .await
18606 {
18607 Ok(token) => token,
18608 Err(e) => match dlg.token(e) {
18609 Ok(token) => token,
18610 Err(e) => {
18611 dlg.finished(false);
18612 return Err(common::Error::MissingToken(e));
18613 }
18614 },
18615 };
18616 request_value_reader
18617 .seek(std::io::SeekFrom::Start(0))
18618 .unwrap();
18619 let mut req_result = {
18620 let client = &self.hub.client;
18621 dlg.pre_request();
18622 let mut req_builder = hyper::Request::builder()
18623 .method(hyper::Method::POST)
18624 .uri(url.as_str())
18625 .header(USER_AGENT, self.hub._user_agent.clone());
18626
18627 if let Some(token) = token.as_ref() {
18628 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18629 }
18630
18631 let request = req_builder
18632 .header(CONTENT_TYPE, json_mime_type.to_string())
18633 .header(CONTENT_LENGTH, request_size as u64)
18634 .body(common::to_body(
18635 request_value_reader.get_ref().clone().into(),
18636 ));
18637
18638 client.request(request.unwrap()).await
18639 };
18640
18641 match req_result {
18642 Err(err) => {
18643 if let common::Retry::After(d) = dlg.http_error(&err) {
18644 sleep(d).await;
18645 continue;
18646 }
18647 dlg.finished(false);
18648 return Err(common::Error::HttpError(err));
18649 }
18650 Ok(res) => {
18651 let (mut parts, body) = res.into_parts();
18652 let mut body = common::Body::new(body);
18653 if !parts.status.is_success() {
18654 let bytes = common::to_bytes(body).await.unwrap_or_default();
18655 let error = serde_json::from_str(&common::to_string(&bytes));
18656 let response = common::to_response(parts, bytes.into());
18657
18658 if let common::Retry::After(d) =
18659 dlg.http_failure(&response, error.as_ref().ok())
18660 {
18661 sleep(d).await;
18662 continue;
18663 }
18664
18665 dlg.finished(false);
18666
18667 return Err(match error {
18668 Ok(value) => common::Error::BadRequest(value),
18669 _ => common::Error::Failure(response),
18670 });
18671 }
18672 let response = {
18673 let bytes = common::to_bytes(body).await.unwrap_or_default();
18674 let encoded = common::to_string(&bytes);
18675 match serde_json::from_str(&encoded) {
18676 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18677 Err(error) => {
18678 dlg.response_json_decode_error(&encoded, &error);
18679 return Err(common::Error::JsonDecodeError(
18680 encoded.to_string(),
18681 error,
18682 ));
18683 }
18684 }
18685 };
18686
18687 dlg.finished(true);
18688 return Ok(response);
18689 }
18690 }
18691 }
18692 }
18693
18694 ///
18695 /// Sets the *request* property to the given value.
18696 ///
18697 /// Even though the property as already been set when instantiating this call,
18698 /// we provide this method for API completeness.
18699 pub fn request(
18700 mut self,
18701 new_value: SetIamPolicyRequest,
18702 ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
18703 self._request = new_value;
18704 self
18705 }
18706 /// 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.
18707 ///
18708 /// Sets the *resource* path property to the given value.
18709 ///
18710 /// Even though the property as already been set when instantiating this call,
18711 /// we provide this method for API completeness.
18712 pub fn resource(
18713 mut self,
18714 new_value: &str,
18715 ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
18716 self._resource = new_value.to_string();
18717 self
18718 }
18719 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18720 /// while executing the actual API request.
18721 ///
18722 /// ````text
18723 /// It should be used to handle progress information, and to implement a certain level of resilience.
18724 /// ````
18725 ///
18726 /// Sets the *delegate* property to the given value.
18727 pub fn delegate(
18728 mut self,
18729 new_value: &'a mut dyn common::Delegate,
18730 ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
18731 self._delegate = Some(new_value);
18732 self
18733 }
18734
18735 /// Set any additional parameter of the query string used in the request.
18736 /// It should be used to set parameters which are not yet available through their own
18737 /// setters.
18738 ///
18739 /// Please note that this method must not be used to set any of the known parameters
18740 /// which have their own setter method. If done anyway, the request will fail.
18741 ///
18742 /// # Additional Parameters
18743 ///
18744 /// * *$.xgafv* (query-string) - V1 error format.
18745 /// * *access_token* (query-string) - OAuth access token.
18746 /// * *alt* (query-string) - Data format for response.
18747 /// * *callback* (query-string) - JSONP
18748 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18749 /// * *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.
18750 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18751 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18752 /// * *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.
18753 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18754 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18755 pub fn param<T>(
18756 mut self,
18757 name: T,
18758 value: T,
18759 ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
18760 where
18761 T: AsRef<str>,
18762 {
18763 self._additional_params
18764 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18765 self
18766 }
18767
18768 /// Identifies the authorization scope for the method you are building.
18769 ///
18770 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18771 /// [`Scope::CloudPlatform`].
18772 ///
18773 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18774 /// tokens for more than one scope.
18775 ///
18776 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18777 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18778 /// sufficient, a read-write scope will do as well.
18779 pub fn add_scope<St>(
18780 mut self,
18781 scope: St,
18782 ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
18783 where
18784 St: AsRef<str>,
18785 {
18786 self._scopes.insert(String::from(scope.as_ref()));
18787 self
18788 }
18789 /// Identifies the authorization scope(s) for the method you are building.
18790 ///
18791 /// See [`Self::add_scope()`] for details.
18792 pub fn add_scopes<I, St>(
18793 mut self,
18794 scopes: I,
18795 ) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C>
18796 where
18797 I: IntoIterator<Item = St>,
18798 St: AsRef<str>,
18799 {
18800 self._scopes
18801 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18802 self
18803 }
18804
18805 /// Removes all scopes, and no default scope will be used either.
18806 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18807 /// for details).
18808 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineSetIamPolicyCall<'a, C> {
18809 self._scopes.clear();
18810 self
18811 }
18812}
18813
18814/// 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.
18815///
18816/// A builder for the *locations.deliveryPipelines.testIamPermissions* method supported by a *project* resource.
18817/// It is not used directly, but through a [`ProjectMethods`] instance.
18818///
18819/// # Example
18820///
18821/// Instantiate a resource method builder
18822///
18823/// ```test_harness,no_run
18824/// # extern crate hyper;
18825/// # extern crate hyper_rustls;
18826/// # extern crate google_clouddeploy1 as clouddeploy1;
18827/// use clouddeploy1::api::TestIamPermissionsRequest;
18828/// # async fn dox() {
18829/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18830///
18831/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18832/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18833/// # .with_native_roots()
18834/// # .unwrap()
18835/// # .https_only()
18836/// # .enable_http2()
18837/// # .build();
18838///
18839/// # let executor = hyper_util::rt::TokioExecutor::new();
18840/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18841/// # secret,
18842/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18843/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18844/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18845/// # ),
18846/// # ).build().await.unwrap();
18847///
18848/// # let client = hyper_util::client::legacy::Client::builder(
18849/// # hyper_util::rt::TokioExecutor::new()
18850/// # )
18851/// # .build(
18852/// # hyper_rustls::HttpsConnectorBuilder::new()
18853/// # .with_native_roots()
18854/// # .unwrap()
18855/// # .https_or_http()
18856/// # .enable_http2()
18857/// # .build()
18858/// # );
18859/// # let mut hub = CloudDeploy::new(client, auth);
18860/// // As the method needs a request, you would usually fill it with the desired information
18861/// // into the respective structure. Some of the parts shown here might not be applicable !
18862/// // Values shown here are possibly random and not representative !
18863/// let mut req = TestIamPermissionsRequest::default();
18864///
18865/// // You can configure optional parameters by calling the respective setters at will, and
18866/// // execute the final call using `doit()`.
18867/// // Values shown here are possibly random and not representative !
18868/// let result = hub.projects().locations_delivery_pipelines_test_iam_permissions(req, "resource")
18869/// .doit().await;
18870/// # }
18871/// ```
18872pub struct ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
18873where
18874 C: 'a,
18875{
18876 hub: &'a CloudDeploy<C>,
18877 _request: TestIamPermissionsRequest,
18878 _resource: String,
18879 _delegate: Option<&'a mut dyn common::Delegate>,
18880 _additional_params: HashMap<String, String>,
18881 _scopes: BTreeSet<String>,
18882}
18883
18884impl<'a, C> common::CallBuilder for ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {}
18885
18886impl<'a, C> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
18887where
18888 C: common::Connector,
18889{
18890 /// Perform the operation you have build so far.
18891 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
18892 use std::borrow::Cow;
18893 use std::io::{Read, Seek};
18894
18895 use common::{url::Params, ToParts};
18896 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18897
18898 let mut dd = common::DefaultDelegate;
18899 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18900 dlg.begin(common::MethodInfo {
18901 id: "clouddeploy.projects.locations.deliveryPipelines.testIamPermissions",
18902 http_method: hyper::Method::POST,
18903 });
18904
18905 for &field in ["alt", "resource"].iter() {
18906 if self._additional_params.contains_key(field) {
18907 dlg.finished(false);
18908 return Err(common::Error::FieldClash(field));
18909 }
18910 }
18911
18912 let mut params = Params::with_capacity(4 + self._additional_params.len());
18913 params.push("resource", self._resource);
18914
18915 params.extend(self._additional_params.iter());
18916
18917 params.push("alt", "json");
18918 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
18919 if self._scopes.is_empty() {
18920 self._scopes
18921 .insert(Scope::CloudPlatform.as_ref().to_string());
18922 }
18923
18924 #[allow(clippy::single_element_loop)]
18925 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
18926 url = params.uri_replacement(url, param_name, find_this, true);
18927 }
18928 {
18929 let to_remove = ["resource"];
18930 params.remove_params(&to_remove);
18931 }
18932
18933 let url = params.parse_with_url(&url);
18934
18935 let mut json_mime_type = mime::APPLICATION_JSON;
18936 let mut request_value_reader = {
18937 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18938 common::remove_json_null_values(&mut value);
18939 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18940 serde_json::to_writer(&mut dst, &value).unwrap();
18941 dst
18942 };
18943 let request_size = request_value_reader
18944 .seek(std::io::SeekFrom::End(0))
18945 .unwrap();
18946 request_value_reader
18947 .seek(std::io::SeekFrom::Start(0))
18948 .unwrap();
18949
18950 loop {
18951 let token = match self
18952 .hub
18953 .auth
18954 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18955 .await
18956 {
18957 Ok(token) => token,
18958 Err(e) => match dlg.token(e) {
18959 Ok(token) => token,
18960 Err(e) => {
18961 dlg.finished(false);
18962 return Err(common::Error::MissingToken(e));
18963 }
18964 },
18965 };
18966 request_value_reader
18967 .seek(std::io::SeekFrom::Start(0))
18968 .unwrap();
18969 let mut req_result = {
18970 let client = &self.hub.client;
18971 dlg.pre_request();
18972 let mut req_builder = hyper::Request::builder()
18973 .method(hyper::Method::POST)
18974 .uri(url.as_str())
18975 .header(USER_AGENT, self.hub._user_agent.clone());
18976
18977 if let Some(token) = token.as_ref() {
18978 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18979 }
18980
18981 let request = req_builder
18982 .header(CONTENT_TYPE, json_mime_type.to_string())
18983 .header(CONTENT_LENGTH, request_size as u64)
18984 .body(common::to_body(
18985 request_value_reader.get_ref().clone().into(),
18986 ));
18987
18988 client.request(request.unwrap()).await
18989 };
18990
18991 match req_result {
18992 Err(err) => {
18993 if let common::Retry::After(d) = dlg.http_error(&err) {
18994 sleep(d).await;
18995 continue;
18996 }
18997 dlg.finished(false);
18998 return Err(common::Error::HttpError(err));
18999 }
19000 Ok(res) => {
19001 let (mut parts, body) = res.into_parts();
19002 let mut body = common::Body::new(body);
19003 if !parts.status.is_success() {
19004 let bytes = common::to_bytes(body).await.unwrap_or_default();
19005 let error = serde_json::from_str(&common::to_string(&bytes));
19006 let response = common::to_response(parts, bytes.into());
19007
19008 if let common::Retry::After(d) =
19009 dlg.http_failure(&response, error.as_ref().ok())
19010 {
19011 sleep(d).await;
19012 continue;
19013 }
19014
19015 dlg.finished(false);
19016
19017 return Err(match error {
19018 Ok(value) => common::Error::BadRequest(value),
19019 _ => common::Error::Failure(response),
19020 });
19021 }
19022 let response = {
19023 let bytes = common::to_bytes(body).await.unwrap_or_default();
19024 let encoded = common::to_string(&bytes);
19025 match serde_json::from_str(&encoded) {
19026 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19027 Err(error) => {
19028 dlg.response_json_decode_error(&encoded, &error);
19029 return Err(common::Error::JsonDecodeError(
19030 encoded.to_string(),
19031 error,
19032 ));
19033 }
19034 }
19035 };
19036
19037 dlg.finished(true);
19038 return Ok(response);
19039 }
19040 }
19041 }
19042 }
19043
19044 ///
19045 /// Sets the *request* property to the given value.
19046 ///
19047 /// Even though the property as already been set when instantiating this call,
19048 /// we provide this method for API completeness.
19049 pub fn request(
19050 mut self,
19051 new_value: TestIamPermissionsRequest,
19052 ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
19053 self._request = new_value;
19054 self
19055 }
19056 /// 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.
19057 ///
19058 /// Sets the *resource* path property to the given value.
19059 ///
19060 /// Even though the property as already been set when instantiating this call,
19061 /// we provide this method for API completeness.
19062 pub fn resource(
19063 mut self,
19064 new_value: &str,
19065 ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
19066 self._resource = new_value.to_string();
19067 self
19068 }
19069 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19070 /// while executing the actual API request.
19071 ///
19072 /// ````text
19073 /// It should be used to handle progress information, and to implement a certain level of resilience.
19074 /// ````
19075 ///
19076 /// Sets the *delegate* property to the given value.
19077 pub fn delegate(
19078 mut self,
19079 new_value: &'a mut dyn common::Delegate,
19080 ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
19081 self._delegate = Some(new_value);
19082 self
19083 }
19084
19085 /// Set any additional parameter of the query string used in the request.
19086 /// It should be used to set parameters which are not yet available through their own
19087 /// setters.
19088 ///
19089 /// Please note that this method must not be used to set any of the known parameters
19090 /// which have their own setter method. If done anyway, the request will fail.
19091 ///
19092 /// # Additional Parameters
19093 ///
19094 /// * *$.xgafv* (query-string) - V1 error format.
19095 /// * *access_token* (query-string) - OAuth access token.
19096 /// * *alt* (query-string) - Data format for response.
19097 /// * *callback* (query-string) - JSONP
19098 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19099 /// * *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.
19100 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19101 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19102 /// * *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.
19103 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19104 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19105 pub fn param<T>(
19106 mut self,
19107 name: T,
19108 value: T,
19109 ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
19110 where
19111 T: AsRef<str>,
19112 {
19113 self._additional_params
19114 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19115 self
19116 }
19117
19118 /// Identifies the authorization scope for the method you are building.
19119 ///
19120 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19121 /// [`Scope::CloudPlatform`].
19122 ///
19123 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19124 /// tokens for more than one scope.
19125 ///
19126 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19127 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19128 /// sufficient, a read-write scope will do as well.
19129 pub fn add_scope<St>(
19130 mut self,
19131 scope: St,
19132 ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
19133 where
19134 St: AsRef<str>,
19135 {
19136 self._scopes.insert(String::from(scope.as_ref()));
19137 self
19138 }
19139 /// Identifies the authorization scope(s) for the method you are building.
19140 ///
19141 /// See [`Self::add_scope()`] for details.
19142 pub fn add_scopes<I, St>(
19143 mut self,
19144 scopes: I,
19145 ) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C>
19146 where
19147 I: IntoIterator<Item = St>,
19148 St: AsRef<str>,
19149 {
19150 self._scopes
19151 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19152 self
19153 }
19154
19155 /// Removes all scopes, and no default scope will be used either.
19156 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19157 /// for details).
19158 pub fn clear_scopes(mut self) -> ProjectLocationDeliveryPipelineTestIamPermissionCall<'a, C> {
19159 self._scopes.clear();
19160 self
19161 }
19162}
19163
19164/// Creates a new DeployPolicy in a given project and location.
19165///
19166/// A builder for the *locations.deployPolicies.create* method supported by a *project* resource.
19167/// It is not used directly, but through a [`ProjectMethods`] instance.
19168///
19169/// # Example
19170///
19171/// Instantiate a resource method builder
19172///
19173/// ```test_harness,no_run
19174/// # extern crate hyper;
19175/// # extern crate hyper_rustls;
19176/// # extern crate google_clouddeploy1 as clouddeploy1;
19177/// use clouddeploy1::api::DeployPolicy;
19178/// # async fn dox() {
19179/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19180///
19181/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19182/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19183/// # .with_native_roots()
19184/// # .unwrap()
19185/// # .https_only()
19186/// # .enable_http2()
19187/// # .build();
19188///
19189/// # let executor = hyper_util::rt::TokioExecutor::new();
19190/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19191/// # secret,
19192/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19193/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19194/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19195/// # ),
19196/// # ).build().await.unwrap();
19197///
19198/// # let client = hyper_util::client::legacy::Client::builder(
19199/// # hyper_util::rt::TokioExecutor::new()
19200/// # )
19201/// # .build(
19202/// # hyper_rustls::HttpsConnectorBuilder::new()
19203/// # .with_native_roots()
19204/// # .unwrap()
19205/// # .https_or_http()
19206/// # .enable_http2()
19207/// # .build()
19208/// # );
19209/// # let mut hub = CloudDeploy::new(client, auth);
19210/// // As the method needs a request, you would usually fill it with the desired information
19211/// // into the respective structure. Some of the parts shown here might not be applicable !
19212/// // Values shown here are possibly random and not representative !
19213/// let mut req = DeployPolicy::default();
19214///
19215/// // You can configure optional parameters by calling the respective setters at will, and
19216/// // execute the final call using `doit()`.
19217/// // Values shown here are possibly random and not representative !
19218/// let result = hub.projects().locations_deploy_policies_create(req, "parent")
19219/// .validate_only(true)
19220/// .request_id("est")
19221/// .deploy_policy_id("sit")
19222/// .doit().await;
19223/// # }
19224/// ```
19225pub struct ProjectLocationDeployPolicyCreateCall<'a, C>
19226where
19227 C: 'a,
19228{
19229 hub: &'a CloudDeploy<C>,
19230 _request: DeployPolicy,
19231 _parent: String,
19232 _validate_only: Option<bool>,
19233 _request_id: Option<String>,
19234 _deploy_policy_id: Option<String>,
19235 _delegate: Option<&'a mut dyn common::Delegate>,
19236 _additional_params: HashMap<String, String>,
19237 _scopes: BTreeSet<String>,
19238}
19239
19240impl<'a, C> common::CallBuilder for ProjectLocationDeployPolicyCreateCall<'a, C> {}
19241
19242impl<'a, C> ProjectLocationDeployPolicyCreateCall<'a, C>
19243where
19244 C: common::Connector,
19245{
19246 /// Perform the operation you have build so far.
19247 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19248 use std::borrow::Cow;
19249 use std::io::{Read, Seek};
19250
19251 use common::{url::Params, ToParts};
19252 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19253
19254 let mut dd = common::DefaultDelegate;
19255 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19256 dlg.begin(common::MethodInfo {
19257 id: "clouddeploy.projects.locations.deployPolicies.create",
19258 http_method: hyper::Method::POST,
19259 });
19260
19261 for &field in [
19262 "alt",
19263 "parent",
19264 "validateOnly",
19265 "requestId",
19266 "deployPolicyId",
19267 ]
19268 .iter()
19269 {
19270 if self._additional_params.contains_key(field) {
19271 dlg.finished(false);
19272 return Err(common::Error::FieldClash(field));
19273 }
19274 }
19275
19276 let mut params = Params::with_capacity(7 + self._additional_params.len());
19277 params.push("parent", self._parent);
19278 if let Some(value) = self._validate_only.as_ref() {
19279 params.push("validateOnly", value.to_string());
19280 }
19281 if let Some(value) = self._request_id.as_ref() {
19282 params.push("requestId", value);
19283 }
19284 if let Some(value) = self._deploy_policy_id.as_ref() {
19285 params.push("deployPolicyId", value);
19286 }
19287
19288 params.extend(self._additional_params.iter());
19289
19290 params.push("alt", "json");
19291 let mut url = self.hub._base_url.clone() + "v1/{+parent}/deployPolicies";
19292 if self._scopes.is_empty() {
19293 self._scopes
19294 .insert(Scope::CloudPlatform.as_ref().to_string());
19295 }
19296
19297 #[allow(clippy::single_element_loop)]
19298 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19299 url = params.uri_replacement(url, param_name, find_this, true);
19300 }
19301 {
19302 let to_remove = ["parent"];
19303 params.remove_params(&to_remove);
19304 }
19305
19306 let url = params.parse_with_url(&url);
19307
19308 let mut json_mime_type = mime::APPLICATION_JSON;
19309 let mut request_value_reader = {
19310 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19311 common::remove_json_null_values(&mut value);
19312 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19313 serde_json::to_writer(&mut dst, &value).unwrap();
19314 dst
19315 };
19316 let request_size = request_value_reader
19317 .seek(std::io::SeekFrom::End(0))
19318 .unwrap();
19319 request_value_reader
19320 .seek(std::io::SeekFrom::Start(0))
19321 .unwrap();
19322
19323 loop {
19324 let token = match self
19325 .hub
19326 .auth
19327 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19328 .await
19329 {
19330 Ok(token) => token,
19331 Err(e) => match dlg.token(e) {
19332 Ok(token) => token,
19333 Err(e) => {
19334 dlg.finished(false);
19335 return Err(common::Error::MissingToken(e));
19336 }
19337 },
19338 };
19339 request_value_reader
19340 .seek(std::io::SeekFrom::Start(0))
19341 .unwrap();
19342 let mut req_result = {
19343 let client = &self.hub.client;
19344 dlg.pre_request();
19345 let mut req_builder = hyper::Request::builder()
19346 .method(hyper::Method::POST)
19347 .uri(url.as_str())
19348 .header(USER_AGENT, self.hub._user_agent.clone());
19349
19350 if let Some(token) = token.as_ref() {
19351 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19352 }
19353
19354 let request = req_builder
19355 .header(CONTENT_TYPE, json_mime_type.to_string())
19356 .header(CONTENT_LENGTH, request_size as u64)
19357 .body(common::to_body(
19358 request_value_reader.get_ref().clone().into(),
19359 ));
19360
19361 client.request(request.unwrap()).await
19362 };
19363
19364 match req_result {
19365 Err(err) => {
19366 if let common::Retry::After(d) = dlg.http_error(&err) {
19367 sleep(d).await;
19368 continue;
19369 }
19370 dlg.finished(false);
19371 return Err(common::Error::HttpError(err));
19372 }
19373 Ok(res) => {
19374 let (mut parts, body) = res.into_parts();
19375 let mut body = common::Body::new(body);
19376 if !parts.status.is_success() {
19377 let bytes = common::to_bytes(body).await.unwrap_or_default();
19378 let error = serde_json::from_str(&common::to_string(&bytes));
19379 let response = common::to_response(parts, bytes.into());
19380
19381 if let common::Retry::After(d) =
19382 dlg.http_failure(&response, error.as_ref().ok())
19383 {
19384 sleep(d).await;
19385 continue;
19386 }
19387
19388 dlg.finished(false);
19389
19390 return Err(match error {
19391 Ok(value) => common::Error::BadRequest(value),
19392 _ => common::Error::Failure(response),
19393 });
19394 }
19395 let response = {
19396 let bytes = common::to_bytes(body).await.unwrap_or_default();
19397 let encoded = common::to_string(&bytes);
19398 match serde_json::from_str(&encoded) {
19399 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19400 Err(error) => {
19401 dlg.response_json_decode_error(&encoded, &error);
19402 return Err(common::Error::JsonDecodeError(
19403 encoded.to_string(),
19404 error,
19405 ));
19406 }
19407 }
19408 };
19409
19410 dlg.finished(true);
19411 return Ok(response);
19412 }
19413 }
19414 }
19415 }
19416
19417 ///
19418 /// Sets the *request* property to the given value.
19419 ///
19420 /// Even though the property as already been set when instantiating this call,
19421 /// we provide this method for API completeness.
19422 pub fn request(
19423 mut self,
19424 new_value: DeployPolicy,
19425 ) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
19426 self._request = new_value;
19427 self
19428 }
19429 /// Required. The parent collection in which the `DeployPolicy` must be created. The format is `projects/{project_id}/locations/{location_name}`.
19430 ///
19431 /// Sets the *parent* path property to the given value.
19432 ///
19433 /// Even though the property as already been set when instantiating this call,
19434 /// we provide this method for API completeness.
19435 pub fn parent(mut self, new_value: &str) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
19436 self._parent = new_value.to_string();
19437 self
19438 }
19439 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
19440 ///
19441 /// Sets the *validate only* query property to the given value.
19442 pub fn validate_only(
19443 mut self,
19444 new_value: bool,
19445 ) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
19446 self._validate_only = Some(new_value);
19447 self
19448 }
19449 /// 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).
19450 ///
19451 /// Sets the *request id* query property to the given value.
19452 pub fn request_id(mut self, new_value: &str) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
19453 self._request_id = Some(new_value.to_string());
19454 self
19455 }
19456 /// Required. ID of the `DeployPolicy`.
19457 ///
19458 /// Sets the *deploy policy id* query property to the given value.
19459 pub fn deploy_policy_id(
19460 mut self,
19461 new_value: &str,
19462 ) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
19463 self._deploy_policy_id = Some(new_value.to_string());
19464 self
19465 }
19466 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19467 /// while executing the actual API request.
19468 ///
19469 /// ````text
19470 /// It should be used to handle progress information, and to implement a certain level of resilience.
19471 /// ````
19472 ///
19473 /// Sets the *delegate* property to the given value.
19474 pub fn delegate(
19475 mut self,
19476 new_value: &'a mut dyn common::Delegate,
19477 ) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
19478 self._delegate = Some(new_value);
19479 self
19480 }
19481
19482 /// Set any additional parameter of the query string used in the request.
19483 /// It should be used to set parameters which are not yet available through their own
19484 /// setters.
19485 ///
19486 /// Please note that this method must not be used to set any of the known parameters
19487 /// which have their own setter method. If done anyway, the request will fail.
19488 ///
19489 /// # Additional Parameters
19490 ///
19491 /// * *$.xgafv* (query-string) - V1 error format.
19492 /// * *access_token* (query-string) - OAuth access token.
19493 /// * *alt* (query-string) - Data format for response.
19494 /// * *callback* (query-string) - JSONP
19495 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19496 /// * *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.
19497 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19498 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19499 /// * *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.
19500 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19501 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19502 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeployPolicyCreateCall<'a, C>
19503 where
19504 T: AsRef<str>,
19505 {
19506 self._additional_params
19507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19508 self
19509 }
19510
19511 /// Identifies the authorization scope for the method you are building.
19512 ///
19513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19514 /// [`Scope::CloudPlatform`].
19515 ///
19516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19517 /// tokens for more than one scope.
19518 ///
19519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19521 /// sufficient, a read-write scope will do as well.
19522 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeployPolicyCreateCall<'a, C>
19523 where
19524 St: AsRef<str>,
19525 {
19526 self._scopes.insert(String::from(scope.as_ref()));
19527 self
19528 }
19529 /// Identifies the authorization scope(s) for the method you are building.
19530 ///
19531 /// See [`Self::add_scope()`] for details.
19532 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeployPolicyCreateCall<'a, C>
19533 where
19534 I: IntoIterator<Item = St>,
19535 St: AsRef<str>,
19536 {
19537 self._scopes
19538 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19539 self
19540 }
19541
19542 /// Removes all scopes, and no default scope will be used either.
19543 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19544 /// for details).
19545 pub fn clear_scopes(mut self) -> ProjectLocationDeployPolicyCreateCall<'a, C> {
19546 self._scopes.clear();
19547 self
19548 }
19549}
19550
19551/// Deletes a single DeployPolicy.
19552///
19553/// A builder for the *locations.deployPolicies.delete* method supported by a *project* resource.
19554/// It is not used directly, but through a [`ProjectMethods`] instance.
19555///
19556/// # Example
19557///
19558/// Instantiate a resource method builder
19559///
19560/// ```test_harness,no_run
19561/// # extern crate hyper;
19562/// # extern crate hyper_rustls;
19563/// # extern crate google_clouddeploy1 as clouddeploy1;
19564/// # async fn dox() {
19565/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19566///
19567/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19568/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19569/// # .with_native_roots()
19570/// # .unwrap()
19571/// # .https_only()
19572/// # .enable_http2()
19573/// # .build();
19574///
19575/// # let executor = hyper_util::rt::TokioExecutor::new();
19576/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19577/// # secret,
19578/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19579/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19580/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19581/// # ),
19582/// # ).build().await.unwrap();
19583///
19584/// # let client = hyper_util::client::legacy::Client::builder(
19585/// # hyper_util::rt::TokioExecutor::new()
19586/// # )
19587/// # .build(
19588/// # hyper_rustls::HttpsConnectorBuilder::new()
19589/// # .with_native_roots()
19590/// # .unwrap()
19591/// # .https_or_http()
19592/// # .enable_http2()
19593/// # .build()
19594/// # );
19595/// # let mut hub = CloudDeploy::new(client, auth);
19596/// // You can configure optional parameters by calling the respective setters at will, and
19597/// // execute the final call using `doit()`.
19598/// // Values shown here are possibly random and not representative !
19599/// let result = hub.projects().locations_deploy_policies_delete("name")
19600/// .validate_only(false)
19601/// .request_id("Lorem")
19602/// .etag("ea")
19603/// .allow_missing(true)
19604/// .doit().await;
19605/// # }
19606/// ```
19607pub struct ProjectLocationDeployPolicyDeleteCall<'a, C>
19608where
19609 C: 'a,
19610{
19611 hub: &'a CloudDeploy<C>,
19612 _name: String,
19613 _validate_only: Option<bool>,
19614 _request_id: Option<String>,
19615 _etag: Option<String>,
19616 _allow_missing: Option<bool>,
19617 _delegate: Option<&'a mut dyn common::Delegate>,
19618 _additional_params: HashMap<String, String>,
19619 _scopes: BTreeSet<String>,
19620}
19621
19622impl<'a, C> common::CallBuilder for ProjectLocationDeployPolicyDeleteCall<'a, C> {}
19623
19624impl<'a, C> ProjectLocationDeployPolicyDeleteCall<'a, C>
19625where
19626 C: common::Connector,
19627{
19628 /// Perform the operation you have build so far.
19629 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19630 use std::borrow::Cow;
19631 use std::io::{Read, Seek};
19632
19633 use common::{url::Params, ToParts};
19634 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19635
19636 let mut dd = common::DefaultDelegate;
19637 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19638 dlg.begin(common::MethodInfo {
19639 id: "clouddeploy.projects.locations.deployPolicies.delete",
19640 http_method: hyper::Method::DELETE,
19641 });
19642
19643 for &field in [
19644 "alt",
19645 "name",
19646 "validateOnly",
19647 "requestId",
19648 "etag",
19649 "allowMissing",
19650 ]
19651 .iter()
19652 {
19653 if self._additional_params.contains_key(field) {
19654 dlg.finished(false);
19655 return Err(common::Error::FieldClash(field));
19656 }
19657 }
19658
19659 let mut params = Params::with_capacity(7 + self._additional_params.len());
19660 params.push("name", self._name);
19661 if let Some(value) = self._validate_only.as_ref() {
19662 params.push("validateOnly", value.to_string());
19663 }
19664 if let Some(value) = self._request_id.as_ref() {
19665 params.push("requestId", value);
19666 }
19667 if let Some(value) = self._etag.as_ref() {
19668 params.push("etag", value);
19669 }
19670 if let Some(value) = self._allow_missing.as_ref() {
19671 params.push("allowMissing", value.to_string());
19672 }
19673
19674 params.extend(self._additional_params.iter());
19675
19676 params.push("alt", "json");
19677 let mut url = self.hub._base_url.clone() + "v1/{+name}";
19678 if self._scopes.is_empty() {
19679 self._scopes
19680 .insert(Scope::CloudPlatform.as_ref().to_string());
19681 }
19682
19683 #[allow(clippy::single_element_loop)]
19684 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19685 url = params.uri_replacement(url, param_name, find_this, true);
19686 }
19687 {
19688 let to_remove = ["name"];
19689 params.remove_params(&to_remove);
19690 }
19691
19692 let url = params.parse_with_url(&url);
19693
19694 loop {
19695 let token = match self
19696 .hub
19697 .auth
19698 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19699 .await
19700 {
19701 Ok(token) => token,
19702 Err(e) => match dlg.token(e) {
19703 Ok(token) => token,
19704 Err(e) => {
19705 dlg.finished(false);
19706 return Err(common::Error::MissingToken(e));
19707 }
19708 },
19709 };
19710 let mut req_result = {
19711 let client = &self.hub.client;
19712 dlg.pre_request();
19713 let mut req_builder = hyper::Request::builder()
19714 .method(hyper::Method::DELETE)
19715 .uri(url.as_str())
19716 .header(USER_AGENT, self.hub._user_agent.clone());
19717
19718 if let Some(token) = token.as_ref() {
19719 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19720 }
19721
19722 let request = req_builder
19723 .header(CONTENT_LENGTH, 0_u64)
19724 .body(common::to_body::<String>(None));
19725
19726 client.request(request.unwrap()).await
19727 };
19728
19729 match req_result {
19730 Err(err) => {
19731 if let common::Retry::After(d) = dlg.http_error(&err) {
19732 sleep(d).await;
19733 continue;
19734 }
19735 dlg.finished(false);
19736 return Err(common::Error::HttpError(err));
19737 }
19738 Ok(res) => {
19739 let (mut parts, body) = res.into_parts();
19740 let mut body = common::Body::new(body);
19741 if !parts.status.is_success() {
19742 let bytes = common::to_bytes(body).await.unwrap_or_default();
19743 let error = serde_json::from_str(&common::to_string(&bytes));
19744 let response = common::to_response(parts, bytes.into());
19745
19746 if let common::Retry::After(d) =
19747 dlg.http_failure(&response, error.as_ref().ok())
19748 {
19749 sleep(d).await;
19750 continue;
19751 }
19752
19753 dlg.finished(false);
19754
19755 return Err(match error {
19756 Ok(value) => common::Error::BadRequest(value),
19757 _ => common::Error::Failure(response),
19758 });
19759 }
19760 let response = {
19761 let bytes = common::to_bytes(body).await.unwrap_or_default();
19762 let encoded = common::to_string(&bytes);
19763 match serde_json::from_str(&encoded) {
19764 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19765 Err(error) => {
19766 dlg.response_json_decode_error(&encoded, &error);
19767 return Err(common::Error::JsonDecodeError(
19768 encoded.to_string(),
19769 error,
19770 ));
19771 }
19772 }
19773 };
19774
19775 dlg.finished(true);
19776 return Ok(response);
19777 }
19778 }
19779 }
19780 }
19781
19782 /// Required. The name of the `DeployPolicy` to delete. The format is `projects/{project_id}/locations/{location_name}/deployPolicies/{deploy_policy_name}`.
19783 ///
19784 /// Sets the *name* path property to the given value.
19785 ///
19786 /// Even though the property as already been set when instantiating this call,
19787 /// we provide this method for API completeness.
19788 pub fn name(mut self, new_value: &str) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
19789 self._name = new_value.to_string();
19790 self
19791 }
19792 /// Optional. If set, validate the request and preview the review, but do not actually post it.
19793 ///
19794 /// Sets the *validate only* query property to the given value.
19795 pub fn validate_only(
19796 mut self,
19797 new_value: bool,
19798 ) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
19799 self._validate_only = Some(new_value);
19800 self
19801 }
19802 /// 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).
19803 ///
19804 /// Sets the *request id* query property to the given value.
19805 pub fn request_id(mut self, new_value: &str) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
19806 self._request_id = Some(new_value.to_string());
19807 self
19808 }
19809 /// 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.
19810 ///
19811 /// Sets the *etag* query property to the given value.
19812 pub fn etag(mut self, new_value: &str) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
19813 self._etag = Some(new_value.to_string());
19814 self
19815 }
19816 /// Optional. If set to true, then deleting an already deleted or non-existing `DeployPolicy` will succeed.
19817 ///
19818 /// Sets the *allow missing* query property to the given value.
19819 pub fn allow_missing(
19820 mut self,
19821 new_value: bool,
19822 ) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
19823 self._allow_missing = Some(new_value);
19824 self
19825 }
19826 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19827 /// while executing the actual API request.
19828 ///
19829 /// ````text
19830 /// It should be used to handle progress information, and to implement a certain level of resilience.
19831 /// ````
19832 ///
19833 /// Sets the *delegate* property to the given value.
19834 pub fn delegate(
19835 mut self,
19836 new_value: &'a mut dyn common::Delegate,
19837 ) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
19838 self._delegate = Some(new_value);
19839 self
19840 }
19841
19842 /// Set any additional parameter of the query string used in the request.
19843 /// It should be used to set parameters which are not yet available through their own
19844 /// setters.
19845 ///
19846 /// Please note that this method must not be used to set any of the known parameters
19847 /// which have their own setter method. If done anyway, the request will fail.
19848 ///
19849 /// # Additional Parameters
19850 ///
19851 /// * *$.xgafv* (query-string) - V1 error format.
19852 /// * *access_token* (query-string) - OAuth access token.
19853 /// * *alt* (query-string) - Data format for response.
19854 /// * *callback* (query-string) - JSONP
19855 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19856 /// * *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.
19857 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19858 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19859 /// * *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.
19860 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19861 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19862 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeployPolicyDeleteCall<'a, C>
19863 where
19864 T: AsRef<str>,
19865 {
19866 self._additional_params
19867 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19868 self
19869 }
19870
19871 /// Identifies the authorization scope for the method you are building.
19872 ///
19873 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19874 /// [`Scope::CloudPlatform`].
19875 ///
19876 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19877 /// tokens for more than one scope.
19878 ///
19879 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19880 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19881 /// sufficient, a read-write scope will do as well.
19882 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeployPolicyDeleteCall<'a, C>
19883 where
19884 St: AsRef<str>,
19885 {
19886 self._scopes.insert(String::from(scope.as_ref()));
19887 self
19888 }
19889 /// Identifies the authorization scope(s) for the method you are building.
19890 ///
19891 /// See [`Self::add_scope()`] for details.
19892 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeployPolicyDeleteCall<'a, C>
19893 where
19894 I: IntoIterator<Item = St>,
19895 St: AsRef<str>,
19896 {
19897 self._scopes
19898 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19899 self
19900 }
19901
19902 /// Removes all scopes, and no default scope will be used either.
19903 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19904 /// for details).
19905 pub fn clear_scopes(mut self) -> ProjectLocationDeployPolicyDeleteCall<'a, C> {
19906 self._scopes.clear();
19907 self
19908 }
19909}
19910
19911/// Gets details of a single DeployPolicy.
19912///
19913/// A builder for the *locations.deployPolicies.get* method supported by a *project* resource.
19914/// It is not used directly, but through a [`ProjectMethods`] instance.
19915///
19916/// # Example
19917///
19918/// Instantiate a resource method builder
19919///
19920/// ```test_harness,no_run
19921/// # extern crate hyper;
19922/// # extern crate hyper_rustls;
19923/// # extern crate google_clouddeploy1 as clouddeploy1;
19924/// # async fn dox() {
19925/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19926///
19927/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19928/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19929/// # .with_native_roots()
19930/// # .unwrap()
19931/// # .https_only()
19932/// # .enable_http2()
19933/// # .build();
19934///
19935/// # let executor = hyper_util::rt::TokioExecutor::new();
19936/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19937/// # secret,
19938/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19939/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19940/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19941/// # ),
19942/// # ).build().await.unwrap();
19943///
19944/// # let client = hyper_util::client::legacy::Client::builder(
19945/// # hyper_util::rt::TokioExecutor::new()
19946/// # )
19947/// # .build(
19948/// # hyper_rustls::HttpsConnectorBuilder::new()
19949/// # .with_native_roots()
19950/// # .unwrap()
19951/// # .https_or_http()
19952/// # .enable_http2()
19953/// # .build()
19954/// # );
19955/// # let mut hub = CloudDeploy::new(client, auth);
19956/// // You can configure optional parameters by calling the respective setters at will, and
19957/// // execute the final call using `doit()`.
19958/// // Values shown here are possibly random and not representative !
19959/// let result = hub.projects().locations_deploy_policies_get("name")
19960/// .doit().await;
19961/// # }
19962/// ```
19963pub struct ProjectLocationDeployPolicyGetCall<'a, C>
19964where
19965 C: 'a,
19966{
19967 hub: &'a CloudDeploy<C>,
19968 _name: String,
19969 _delegate: Option<&'a mut dyn common::Delegate>,
19970 _additional_params: HashMap<String, String>,
19971 _scopes: BTreeSet<String>,
19972}
19973
19974impl<'a, C> common::CallBuilder for ProjectLocationDeployPolicyGetCall<'a, C> {}
19975
19976impl<'a, C> ProjectLocationDeployPolicyGetCall<'a, C>
19977where
19978 C: common::Connector,
19979{
19980 /// Perform the operation you have build so far.
19981 pub async fn doit(mut self) -> common::Result<(common::Response, DeployPolicy)> {
19982 use std::borrow::Cow;
19983 use std::io::{Read, Seek};
19984
19985 use common::{url::Params, ToParts};
19986 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19987
19988 let mut dd = common::DefaultDelegate;
19989 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19990 dlg.begin(common::MethodInfo {
19991 id: "clouddeploy.projects.locations.deployPolicies.get",
19992 http_method: hyper::Method::GET,
19993 });
19994
19995 for &field in ["alt", "name"].iter() {
19996 if self._additional_params.contains_key(field) {
19997 dlg.finished(false);
19998 return Err(common::Error::FieldClash(field));
19999 }
20000 }
20001
20002 let mut params = Params::with_capacity(3 + self._additional_params.len());
20003 params.push("name", self._name);
20004
20005 params.extend(self._additional_params.iter());
20006
20007 params.push("alt", "json");
20008 let mut url = self.hub._base_url.clone() + "v1/{+name}";
20009 if self._scopes.is_empty() {
20010 self._scopes
20011 .insert(Scope::CloudPlatform.as_ref().to_string());
20012 }
20013
20014 #[allow(clippy::single_element_loop)]
20015 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20016 url = params.uri_replacement(url, param_name, find_this, true);
20017 }
20018 {
20019 let to_remove = ["name"];
20020 params.remove_params(&to_remove);
20021 }
20022
20023 let url = params.parse_with_url(&url);
20024
20025 loop {
20026 let token = match self
20027 .hub
20028 .auth
20029 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20030 .await
20031 {
20032 Ok(token) => token,
20033 Err(e) => match dlg.token(e) {
20034 Ok(token) => token,
20035 Err(e) => {
20036 dlg.finished(false);
20037 return Err(common::Error::MissingToken(e));
20038 }
20039 },
20040 };
20041 let mut req_result = {
20042 let client = &self.hub.client;
20043 dlg.pre_request();
20044 let mut req_builder = hyper::Request::builder()
20045 .method(hyper::Method::GET)
20046 .uri(url.as_str())
20047 .header(USER_AGENT, self.hub._user_agent.clone());
20048
20049 if let Some(token) = token.as_ref() {
20050 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20051 }
20052
20053 let request = req_builder
20054 .header(CONTENT_LENGTH, 0_u64)
20055 .body(common::to_body::<String>(None));
20056
20057 client.request(request.unwrap()).await
20058 };
20059
20060 match req_result {
20061 Err(err) => {
20062 if let common::Retry::After(d) = dlg.http_error(&err) {
20063 sleep(d).await;
20064 continue;
20065 }
20066 dlg.finished(false);
20067 return Err(common::Error::HttpError(err));
20068 }
20069 Ok(res) => {
20070 let (mut parts, body) = res.into_parts();
20071 let mut body = common::Body::new(body);
20072 if !parts.status.is_success() {
20073 let bytes = common::to_bytes(body).await.unwrap_or_default();
20074 let error = serde_json::from_str(&common::to_string(&bytes));
20075 let response = common::to_response(parts, bytes.into());
20076
20077 if let common::Retry::After(d) =
20078 dlg.http_failure(&response, error.as_ref().ok())
20079 {
20080 sleep(d).await;
20081 continue;
20082 }
20083
20084 dlg.finished(false);
20085
20086 return Err(match error {
20087 Ok(value) => common::Error::BadRequest(value),
20088 _ => common::Error::Failure(response),
20089 });
20090 }
20091 let response = {
20092 let bytes = common::to_bytes(body).await.unwrap_or_default();
20093 let encoded = common::to_string(&bytes);
20094 match serde_json::from_str(&encoded) {
20095 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20096 Err(error) => {
20097 dlg.response_json_decode_error(&encoded, &error);
20098 return Err(common::Error::JsonDecodeError(
20099 encoded.to_string(),
20100 error,
20101 ));
20102 }
20103 }
20104 };
20105
20106 dlg.finished(true);
20107 return Ok(response);
20108 }
20109 }
20110 }
20111 }
20112
20113 /// Required. Name of the `DeployPolicy`. Format must be `projects/{project_id}/locations/{location_name}/deployPolicies/{deploy_policy_name}`.
20114 ///
20115 /// Sets the *name* path property to the given value.
20116 ///
20117 /// Even though the property as already been set when instantiating this call,
20118 /// we provide this method for API completeness.
20119 pub fn name(mut self, new_value: &str) -> ProjectLocationDeployPolicyGetCall<'a, C> {
20120 self._name = new_value.to_string();
20121 self
20122 }
20123 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20124 /// while executing the actual API request.
20125 ///
20126 /// ````text
20127 /// It should be used to handle progress information, and to implement a certain level of resilience.
20128 /// ````
20129 ///
20130 /// Sets the *delegate* property to the given value.
20131 pub fn delegate(
20132 mut self,
20133 new_value: &'a mut dyn common::Delegate,
20134 ) -> ProjectLocationDeployPolicyGetCall<'a, C> {
20135 self._delegate = Some(new_value);
20136 self
20137 }
20138
20139 /// Set any additional parameter of the query string used in the request.
20140 /// It should be used to set parameters which are not yet available through their own
20141 /// setters.
20142 ///
20143 /// Please note that this method must not be used to set any of the known parameters
20144 /// which have their own setter method. If done anyway, the request will fail.
20145 ///
20146 /// # Additional Parameters
20147 ///
20148 /// * *$.xgafv* (query-string) - V1 error format.
20149 /// * *access_token* (query-string) - OAuth access token.
20150 /// * *alt* (query-string) - Data format for response.
20151 /// * *callback* (query-string) - JSONP
20152 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20153 /// * *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.
20154 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20155 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20156 /// * *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.
20157 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20158 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20159 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeployPolicyGetCall<'a, C>
20160 where
20161 T: AsRef<str>,
20162 {
20163 self._additional_params
20164 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20165 self
20166 }
20167
20168 /// Identifies the authorization scope for the method you are building.
20169 ///
20170 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20171 /// [`Scope::CloudPlatform`].
20172 ///
20173 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20174 /// tokens for more than one scope.
20175 ///
20176 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20177 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20178 /// sufficient, a read-write scope will do as well.
20179 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeployPolicyGetCall<'a, C>
20180 where
20181 St: AsRef<str>,
20182 {
20183 self._scopes.insert(String::from(scope.as_ref()));
20184 self
20185 }
20186 /// Identifies the authorization scope(s) for the method you are building.
20187 ///
20188 /// See [`Self::add_scope()`] for details.
20189 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeployPolicyGetCall<'a, C>
20190 where
20191 I: IntoIterator<Item = St>,
20192 St: AsRef<str>,
20193 {
20194 self._scopes
20195 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20196 self
20197 }
20198
20199 /// Removes all scopes, and no default scope will be used either.
20200 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20201 /// for details).
20202 pub fn clear_scopes(mut self) -> ProjectLocationDeployPolicyGetCall<'a, C> {
20203 self._scopes.clear();
20204 self
20205 }
20206}
20207
20208/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
20209///
20210/// A builder for the *locations.deployPolicies.getIamPolicy* method supported by a *project* resource.
20211/// It is not used directly, but through a [`ProjectMethods`] instance.
20212///
20213/// # Example
20214///
20215/// Instantiate a resource method builder
20216///
20217/// ```test_harness,no_run
20218/// # extern crate hyper;
20219/// # extern crate hyper_rustls;
20220/// # extern crate google_clouddeploy1 as clouddeploy1;
20221/// # async fn dox() {
20222/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20223///
20224/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20225/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20226/// # .with_native_roots()
20227/// # .unwrap()
20228/// # .https_only()
20229/// # .enable_http2()
20230/// # .build();
20231///
20232/// # let executor = hyper_util::rt::TokioExecutor::new();
20233/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20234/// # secret,
20235/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20236/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20237/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20238/// # ),
20239/// # ).build().await.unwrap();
20240///
20241/// # let client = hyper_util::client::legacy::Client::builder(
20242/// # hyper_util::rt::TokioExecutor::new()
20243/// # )
20244/// # .build(
20245/// # hyper_rustls::HttpsConnectorBuilder::new()
20246/// # .with_native_roots()
20247/// # .unwrap()
20248/// # .https_or_http()
20249/// # .enable_http2()
20250/// # .build()
20251/// # );
20252/// # let mut hub = CloudDeploy::new(client, auth);
20253/// // You can configure optional parameters by calling the respective setters at will, and
20254/// // execute the final call using `doit()`.
20255/// // Values shown here are possibly random and not representative !
20256/// let result = hub.projects().locations_deploy_policies_get_iam_policy("resource")
20257/// .options_requested_policy_version(-77)
20258/// .doit().await;
20259/// # }
20260/// ```
20261pub struct ProjectLocationDeployPolicyGetIamPolicyCall<'a, C>
20262where
20263 C: 'a,
20264{
20265 hub: &'a CloudDeploy<C>,
20266 _resource: String,
20267 _options_requested_policy_version: Option<i32>,
20268 _delegate: Option<&'a mut dyn common::Delegate>,
20269 _additional_params: HashMap<String, String>,
20270 _scopes: BTreeSet<String>,
20271}
20272
20273impl<'a, C> common::CallBuilder for ProjectLocationDeployPolicyGetIamPolicyCall<'a, C> {}
20274
20275impl<'a, C> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C>
20276where
20277 C: common::Connector,
20278{
20279 /// Perform the operation you have build so far.
20280 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
20281 use std::borrow::Cow;
20282 use std::io::{Read, Seek};
20283
20284 use common::{url::Params, ToParts};
20285 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20286
20287 let mut dd = common::DefaultDelegate;
20288 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20289 dlg.begin(common::MethodInfo {
20290 id: "clouddeploy.projects.locations.deployPolicies.getIamPolicy",
20291 http_method: hyper::Method::GET,
20292 });
20293
20294 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
20295 if self._additional_params.contains_key(field) {
20296 dlg.finished(false);
20297 return Err(common::Error::FieldClash(field));
20298 }
20299 }
20300
20301 let mut params = Params::with_capacity(4 + self._additional_params.len());
20302 params.push("resource", self._resource);
20303 if let Some(value) = self._options_requested_policy_version.as_ref() {
20304 params.push("options.requestedPolicyVersion", value.to_string());
20305 }
20306
20307 params.extend(self._additional_params.iter());
20308
20309 params.push("alt", "json");
20310 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
20311 if self._scopes.is_empty() {
20312 self._scopes
20313 .insert(Scope::CloudPlatform.as_ref().to_string());
20314 }
20315
20316 #[allow(clippy::single_element_loop)]
20317 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
20318 url = params.uri_replacement(url, param_name, find_this, true);
20319 }
20320 {
20321 let to_remove = ["resource"];
20322 params.remove_params(&to_remove);
20323 }
20324
20325 let url = params.parse_with_url(&url);
20326
20327 loop {
20328 let token = match self
20329 .hub
20330 .auth
20331 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20332 .await
20333 {
20334 Ok(token) => token,
20335 Err(e) => match dlg.token(e) {
20336 Ok(token) => token,
20337 Err(e) => {
20338 dlg.finished(false);
20339 return Err(common::Error::MissingToken(e));
20340 }
20341 },
20342 };
20343 let mut req_result = {
20344 let client = &self.hub.client;
20345 dlg.pre_request();
20346 let mut req_builder = hyper::Request::builder()
20347 .method(hyper::Method::GET)
20348 .uri(url.as_str())
20349 .header(USER_AGENT, self.hub._user_agent.clone());
20350
20351 if let Some(token) = token.as_ref() {
20352 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20353 }
20354
20355 let request = req_builder
20356 .header(CONTENT_LENGTH, 0_u64)
20357 .body(common::to_body::<String>(None));
20358
20359 client.request(request.unwrap()).await
20360 };
20361
20362 match req_result {
20363 Err(err) => {
20364 if let common::Retry::After(d) = dlg.http_error(&err) {
20365 sleep(d).await;
20366 continue;
20367 }
20368 dlg.finished(false);
20369 return Err(common::Error::HttpError(err));
20370 }
20371 Ok(res) => {
20372 let (mut parts, body) = res.into_parts();
20373 let mut body = common::Body::new(body);
20374 if !parts.status.is_success() {
20375 let bytes = common::to_bytes(body).await.unwrap_or_default();
20376 let error = serde_json::from_str(&common::to_string(&bytes));
20377 let response = common::to_response(parts, bytes.into());
20378
20379 if let common::Retry::After(d) =
20380 dlg.http_failure(&response, error.as_ref().ok())
20381 {
20382 sleep(d).await;
20383 continue;
20384 }
20385
20386 dlg.finished(false);
20387
20388 return Err(match error {
20389 Ok(value) => common::Error::BadRequest(value),
20390 _ => common::Error::Failure(response),
20391 });
20392 }
20393 let response = {
20394 let bytes = common::to_bytes(body).await.unwrap_or_default();
20395 let encoded = common::to_string(&bytes);
20396 match serde_json::from_str(&encoded) {
20397 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20398 Err(error) => {
20399 dlg.response_json_decode_error(&encoded, &error);
20400 return Err(common::Error::JsonDecodeError(
20401 encoded.to_string(),
20402 error,
20403 ));
20404 }
20405 }
20406 };
20407
20408 dlg.finished(true);
20409 return Ok(response);
20410 }
20411 }
20412 }
20413 }
20414
20415 /// 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.
20416 ///
20417 /// Sets the *resource* path property to the given value.
20418 ///
20419 /// Even though the property as already been set when instantiating this call,
20420 /// we provide this method for API completeness.
20421 pub fn resource(
20422 mut self,
20423 new_value: &str,
20424 ) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C> {
20425 self._resource = new_value.to_string();
20426 self
20427 }
20428 /// 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).
20429 ///
20430 /// Sets the *options.requested policy version* query property to the given value.
20431 pub fn options_requested_policy_version(
20432 mut self,
20433 new_value: i32,
20434 ) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C> {
20435 self._options_requested_policy_version = Some(new_value);
20436 self
20437 }
20438 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20439 /// while executing the actual API request.
20440 ///
20441 /// ````text
20442 /// It should be used to handle progress information, and to implement a certain level of resilience.
20443 /// ````
20444 ///
20445 /// Sets the *delegate* property to the given value.
20446 pub fn delegate(
20447 mut self,
20448 new_value: &'a mut dyn common::Delegate,
20449 ) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C> {
20450 self._delegate = Some(new_value);
20451 self
20452 }
20453
20454 /// Set any additional parameter of the query string used in the request.
20455 /// It should be used to set parameters which are not yet available through their own
20456 /// setters.
20457 ///
20458 /// Please note that this method must not be used to set any of the known parameters
20459 /// which have their own setter method. If done anyway, the request will fail.
20460 ///
20461 /// # Additional Parameters
20462 ///
20463 /// * *$.xgafv* (query-string) - V1 error format.
20464 /// * *access_token* (query-string) - OAuth access token.
20465 /// * *alt* (query-string) - Data format for response.
20466 /// * *callback* (query-string) - JSONP
20467 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20468 /// * *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.
20469 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20470 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20471 /// * *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.
20472 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20473 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20474 pub fn param<T>(
20475 mut self,
20476 name: T,
20477 value: T,
20478 ) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C>
20479 where
20480 T: AsRef<str>,
20481 {
20482 self._additional_params
20483 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20484 self
20485 }
20486
20487 /// Identifies the authorization scope for the method you are building.
20488 ///
20489 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20490 /// [`Scope::CloudPlatform`].
20491 ///
20492 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20493 /// tokens for more than one scope.
20494 ///
20495 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20496 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20497 /// sufficient, a read-write scope will do as well.
20498 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C>
20499 where
20500 St: AsRef<str>,
20501 {
20502 self._scopes.insert(String::from(scope.as_ref()));
20503 self
20504 }
20505 /// Identifies the authorization scope(s) for the method you are building.
20506 ///
20507 /// See [`Self::add_scope()`] for details.
20508 pub fn add_scopes<I, St>(
20509 mut self,
20510 scopes: I,
20511 ) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C>
20512 where
20513 I: IntoIterator<Item = St>,
20514 St: AsRef<str>,
20515 {
20516 self._scopes
20517 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20518 self
20519 }
20520
20521 /// Removes all scopes, and no default scope will be used either.
20522 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20523 /// for details).
20524 pub fn clear_scopes(mut self) -> ProjectLocationDeployPolicyGetIamPolicyCall<'a, C> {
20525 self._scopes.clear();
20526 self
20527 }
20528}
20529
20530/// Lists DeployPolicies in a given project and location.
20531///
20532/// A builder for the *locations.deployPolicies.list* method supported by a *project* resource.
20533/// It is not used directly, but through a [`ProjectMethods`] instance.
20534///
20535/// # Example
20536///
20537/// Instantiate a resource method builder
20538///
20539/// ```test_harness,no_run
20540/// # extern crate hyper;
20541/// # extern crate hyper_rustls;
20542/// # extern crate google_clouddeploy1 as clouddeploy1;
20543/// # async fn dox() {
20544/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20545///
20546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20547/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20548/// # .with_native_roots()
20549/// # .unwrap()
20550/// # .https_only()
20551/// # .enable_http2()
20552/// # .build();
20553///
20554/// # let executor = hyper_util::rt::TokioExecutor::new();
20555/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20556/// # secret,
20557/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20558/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20559/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20560/// # ),
20561/// # ).build().await.unwrap();
20562///
20563/// # let client = hyper_util::client::legacy::Client::builder(
20564/// # hyper_util::rt::TokioExecutor::new()
20565/// # )
20566/// # .build(
20567/// # hyper_rustls::HttpsConnectorBuilder::new()
20568/// # .with_native_roots()
20569/// # .unwrap()
20570/// # .https_or_http()
20571/// # .enable_http2()
20572/// # .build()
20573/// # );
20574/// # let mut hub = CloudDeploy::new(client, auth);
20575/// // You can configure optional parameters by calling the respective setters at will, and
20576/// // execute the final call using `doit()`.
20577/// // Values shown here are possibly random and not representative !
20578/// let result = hub.projects().locations_deploy_policies_list("parent")
20579/// .page_token("eirmod")
20580/// .page_size(-51)
20581/// .order_by("accusam")
20582/// .filter("amet")
20583/// .doit().await;
20584/// # }
20585/// ```
20586pub struct ProjectLocationDeployPolicyListCall<'a, C>
20587where
20588 C: 'a,
20589{
20590 hub: &'a CloudDeploy<C>,
20591 _parent: String,
20592 _page_token: Option<String>,
20593 _page_size: Option<i32>,
20594 _order_by: Option<String>,
20595 _filter: Option<String>,
20596 _delegate: Option<&'a mut dyn common::Delegate>,
20597 _additional_params: HashMap<String, String>,
20598 _scopes: BTreeSet<String>,
20599}
20600
20601impl<'a, C> common::CallBuilder for ProjectLocationDeployPolicyListCall<'a, C> {}
20602
20603impl<'a, C> ProjectLocationDeployPolicyListCall<'a, C>
20604where
20605 C: common::Connector,
20606{
20607 /// Perform the operation you have build so far.
20608 pub async fn doit(mut self) -> common::Result<(common::Response, ListDeployPoliciesResponse)> {
20609 use std::borrow::Cow;
20610 use std::io::{Read, Seek};
20611
20612 use common::{url::Params, ToParts};
20613 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20614
20615 let mut dd = common::DefaultDelegate;
20616 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20617 dlg.begin(common::MethodInfo {
20618 id: "clouddeploy.projects.locations.deployPolicies.list",
20619 http_method: hyper::Method::GET,
20620 });
20621
20622 for &field in [
20623 "alt",
20624 "parent",
20625 "pageToken",
20626 "pageSize",
20627 "orderBy",
20628 "filter",
20629 ]
20630 .iter()
20631 {
20632 if self._additional_params.contains_key(field) {
20633 dlg.finished(false);
20634 return Err(common::Error::FieldClash(field));
20635 }
20636 }
20637
20638 let mut params = Params::with_capacity(7 + self._additional_params.len());
20639 params.push("parent", self._parent);
20640 if let Some(value) = self._page_token.as_ref() {
20641 params.push("pageToken", value);
20642 }
20643 if let Some(value) = self._page_size.as_ref() {
20644 params.push("pageSize", value.to_string());
20645 }
20646 if let Some(value) = self._order_by.as_ref() {
20647 params.push("orderBy", value);
20648 }
20649 if let Some(value) = self._filter.as_ref() {
20650 params.push("filter", value);
20651 }
20652
20653 params.extend(self._additional_params.iter());
20654
20655 params.push("alt", "json");
20656 let mut url = self.hub._base_url.clone() + "v1/{+parent}/deployPolicies";
20657 if self._scopes.is_empty() {
20658 self._scopes
20659 .insert(Scope::CloudPlatform.as_ref().to_string());
20660 }
20661
20662 #[allow(clippy::single_element_loop)]
20663 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
20664 url = params.uri_replacement(url, param_name, find_this, true);
20665 }
20666 {
20667 let to_remove = ["parent"];
20668 params.remove_params(&to_remove);
20669 }
20670
20671 let url = params.parse_with_url(&url);
20672
20673 loop {
20674 let token = match self
20675 .hub
20676 .auth
20677 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20678 .await
20679 {
20680 Ok(token) => token,
20681 Err(e) => match dlg.token(e) {
20682 Ok(token) => token,
20683 Err(e) => {
20684 dlg.finished(false);
20685 return Err(common::Error::MissingToken(e));
20686 }
20687 },
20688 };
20689 let mut req_result = {
20690 let client = &self.hub.client;
20691 dlg.pre_request();
20692 let mut req_builder = hyper::Request::builder()
20693 .method(hyper::Method::GET)
20694 .uri(url.as_str())
20695 .header(USER_AGENT, self.hub._user_agent.clone());
20696
20697 if let Some(token) = token.as_ref() {
20698 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20699 }
20700
20701 let request = req_builder
20702 .header(CONTENT_LENGTH, 0_u64)
20703 .body(common::to_body::<String>(None));
20704
20705 client.request(request.unwrap()).await
20706 };
20707
20708 match req_result {
20709 Err(err) => {
20710 if let common::Retry::After(d) = dlg.http_error(&err) {
20711 sleep(d).await;
20712 continue;
20713 }
20714 dlg.finished(false);
20715 return Err(common::Error::HttpError(err));
20716 }
20717 Ok(res) => {
20718 let (mut parts, body) = res.into_parts();
20719 let mut body = common::Body::new(body);
20720 if !parts.status.is_success() {
20721 let bytes = common::to_bytes(body).await.unwrap_or_default();
20722 let error = serde_json::from_str(&common::to_string(&bytes));
20723 let response = common::to_response(parts, bytes.into());
20724
20725 if let common::Retry::After(d) =
20726 dlg.http_failure(&response, error.as_ref().ok())
20727 {
20728 sleep(d).await;
20729 continue;
20730 }
20731
20732 dlg.finished(false);
20733
20734 return Err(match error {
20735 Ok(value) => common::Error::BadRequest(value),
20736 _ => common::Error::Failure(response),
20737 });
20738 }
20739 let response = {
20740 let bytes = common::to_bytes(body).await.unwrap_or_default();
20741 let encoded = common::to_string(&bytes);
20742 match serde_json::from_str(&encoded) {
20743 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20744 Err(error) => {
20745 dlg.response_json_decode_error(&encoded, &error);
20746 return Err(common::Error::JsonDecodeError(
20747 encoded.to_string(),
20748 error,
20749 ));
20750 }
20751 }
20752 };
20753
20754 dlg.finished(true);
20755 return Ok(response);
20756 }
20757 }
20758 }
20759 }
20760
20761 /// Required. The parent, which owns this collection of deploy policies. Format must be `projects/{project_id}/locations/{location_name}`.
20762 ///
20763 /// Sets the *parent* path property to the given value.
20764 ///
20765 /// Even though the property as already been set when instantiating this call,
20766 /// we provide this method for API completeness.
20767 pub fn parent(mut self, new_value: &str) -> ProjectLocationDeployPolicyListCall<'a, C> {
20768 self._parent = new_value.to_string();
20769 self
20770 }
20771 /// A page token, received from a previous `ListDeployPolicies` call. Provide this to retrieve the subsequent page. When paginating, all other provided parameters match the call that provided the page token.
20772 ///
20773 /// Sets the *page token* query property to the given value.
20774 pub fn page_token(mut self, new_value: &str) -> ProjectLocationDeployPolicyListCall<'a, C> {
20775 self._page_token = Some(new_value.to_string());
20776 self
20777 }
20778 /// The maximum number of deploy policies to return. The service may return fewer than this value. If unspecified, at most 50 deploy policies will be returned. The maximum value is 1000; values above 1000 will be set to 1000.
20779 ///
20780 /// Sets the *page size* query property to the given value.
20781 pub fn page_size(mut self, new_value: i32) -> ProjectLocationDeployPolicyListCall<'a, C> {
20782 self._page_size = Some(new_value);
20783 self
20784 }
20785 /// Field to sort by. See https://google.aip.dev/132#ordering for more details.
20786 ///
20787 /// Sets the *order by* query property to the given value.
20788 pub fn order_by(mut self, new_value: &str) -> ProjectLocationDeployPolicyListCall<'a, C> {
20789 self._order_by = Some(new_value.to_string());
20790 self
20791 }
20792 /// Filter deploy policies to be returned. See https://google.aip.dev/160 for more details. All fields can be used in the filter.
20793 ///
20794 /// Sets the *filter* query property to the given value.
20795 pub fn filter(mut self, new_value: &str) -> ProjectLocationDeployPolicyListCall<'a, C> {
20796 self._filter = Some(new_value.to_string());
20797 self
20798 }
20799 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20800 /// while executing the actual API request.
20801 ///
20802 /// ````text
20803 /// It should be used to handle progress information, and to implement a certain level of resilience.
20804 /// ````
20805 ///
20806 /// Sets the *delegate* property to the given value.
20807 pub fn delegate(
20808 mut self,
20809 new_value: &'a mut dyn common::Delegate,
20810 ) -> ProjectLocationDeployPolicyListCall<'a, C> {
20811 self._delegate = Some(new_value);
20812 self
20813 }
20814
20815 /// Set any additional parameter of the query string used in the request.
20816 /// It should be used to set parameters which are not yet available through their own
20817 /// setters.
20818 ///
20819 /// Please note that this method must not be used to set any of the known parameters
20820 /// which have their own setter method. If done anyway, the request will fail.
20821 ///
20822 /// # Additional Parameters
20823 ///
20824 /// * *$.xgafv* (query-string) - V1 error format.
20825 /// * *access_token* (query-string) - OAuth access token.
20826 /// * *alt* (query-string) - Data format for response.
20827 /// * *callback* (query-string) - JSONP
20828 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20829 /// * *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.
20830 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20831 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20832 /// * *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.
20833 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20834 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20835 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeployPolicyListCall<'a, C>
20836 where
20837 T: AsRef<str>,
20838 {
20839 self._additional_params
20840 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20841 self
20842 }
20843
20844 /// Identifies the authorization scope for the method you are building.
20845 ///
20846 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20847 /// [`Scope::CloudPlatform`].
20848 ///
20849 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20850 /// tokens for more than one scope.
20851 ///
20852 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20853 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20854 /// sufficient, a read-write scope will do as well.
20855 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeployPolicyListCall<'a, C>
20856 where
20857 St: AsRef<str>,
20858 {
20859 self._scopes.insert(String::from(scope.as_ref()));
20860 self
20861 }
20862 /// Identifies the authorization scope(s) for the method you are building.
20863 ///
20864 /// See [`Self::add_scope()`] for details.
20865 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeployPolicyListCall<'a, C>
20866 where
20867 I: IntoIterator<Item = St>,
20868 St: AsRef<str>,
20869 {
20870 self._scopes
20871 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20872 self
20873 }
20874
20875 /// Removes all scopes, and no default scope will be used either.
20876 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20877 /// for details).
20878 pub fn clear_scopes(mut self) -> ProjectLocationDeployPolicyListCall<'a, C> {
20879 self._scopes.clear();
20880 self
20881 }
20882}
20883
20884/// Updates the parameters of a single DeployPolicy.
20885///
20886/// A builder for the *locations.deployPolicies.patch* method supported by a *project* resource.
20887/// It is not used directly, but through a [`ProjectMethods`] instance.
20888///
20889/// # Example
20890///
20891/// Instantiate a resource method builder
20892///
20893/// ```test_harness,no_run
20894/// # extern crate hyper;
20895/// # extern crate hyper_rustls;
20896/// # extern crate google_clouddeploy1 as clouddeploy1;
20897/// use clouddeploy1::api::DeployPolicy;
20898/// # async fn dox() {
20899/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20900///
20901/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20902/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20903/// # .with_native_roots()
20904/// # .unwrap()
20905/// # .https_only()
20906/// # .enable_http2()
20907/// # .build();
20908///
20909/// # let executor = hyper_util::rt::TokioExecutor::new();
20910/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20911/// # secret,
20912/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20913/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20914/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20915/// # ),
20916/// # ).build().await.unwrap();
20917///
20918/// # let client = hyper_util::client::legacy::Client::builder(
20919/// # hyper_util::rt::TokioExecutor::new()
20920/// # )
20921/// # .build(
20922/// # hyper_rustls::HttpsConnectorBuilder::new()
20923/// # .with_native_roots()
20924/// # .unwrap()
20925/// # .https_or_http()
20926/// # .enable_http2()
20927/// # .build()
20928/// # );
20929/// # let mut hub = CloudDeploy::new(client, auth);
20930/// // As the method needs a request, you would usually fill it with the desired information
20931/// // into the respective structure. Some of the parts shown here might not be applicable !
20932/// // Values shown here are possibly random and not representative !
20933/// let mut req = DeployPolicy::default();
20934///
20935/// // You can configure optional parameters by calling the respective setters at will, and
20936/// // execute the final call using `doit()`.
20937/// // Values shown here are possibly random and not representative !
20938/// let result = hub.projects().locations_deploy_policies_patch(req, "name")
20939/// .validate_only(true)
20940/// .update_mask(FieldMask::new::<&str>(&[]))
20941/// .request_id("erat")
20942/// .allow_missing(false)
20943/// .doit().await;
20944/// # }
20945/// ```
20946pub struct ProjectLocationDeployPolicyPatchCall<'a, C>
20947where
20948 C: 'a,
20949{
20950 hub: &'a CloudDeploy<C>,
20951 _request: DeployPolicy,
20952 _name: String,
20953 _validate_only: Option<bool>,
20954 _update_mask: Option<common::FieldMask>,
20955 _request_id: Option<String>,
20956 _allow_missing: Option<bool>,
20957 _delegate: Option<&'a mut dyn common::Delegate>,
20958 _additional_params: HashMap<String, String>,
20959 _scopes: BTreeSet<String>,
20960}
20961
20962impl<'a, C> common::CallBuilder for ProjectLocationDeployPolicyPatchCall<'a, C> {}
20963
20964impl<'a, C> ProjectLocationDeployPolicyPatchCall<'a, C>
20965where
20966 C: common::Connector,
20967{
20968 /// Perform the operation you have build so far.
20969 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20970 use std::borrow::Cow;
20971 use std::io::{Read, Seek};
20972
20973 use common::{url::Params, ToParts};
20974 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20975
20976 let mut dd = common::DefaultDelegate;
20977 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20978 dlg.begin(common::MethodInfo {
20979 id: "clouddeploy.projects.locations.deployPolicies.patch",
20980 http_method: hyper::Method::PATCH,
20981 });
20982
20983 for &field in [
20984 "alt",
20985 "name",
20986 "validateOnly",
20987 "updateMask",
20988 "requestId",
20989 "allowMissing",
20990 ]
20991 .iter()
20992 {
20993 if self._additional_params.contains_key(field) {
20994 dlg.finished(false);
20995 return Err(common::Error::FieldClash(field));
20996 }
20997 }
20998
20999 let mut params = Params::with_capacity(8 + self._additional_params.len());
21000 params.push("name", self._name);
21001 if let Some(value) = self._validate_only.as_ref() {
21002 params.push("validateOnly", value.to_string());
21003 }
21004 if let Some(value) = self._update_mask.as_ref() {
21005 params.push("updateMask", value.to_string());
21006 }
21007 if let Some(value) = self._request_id.as_ref() {
21008 params.push("requestId", value);
21009 }
21010 if let Some(value) = self._allow_missing.as_ref() {
21011 params.push("allowMissing", value.to_string());
21012 }
21013
21014 params.extend(self._additional_params.iter());
21015
21016 params.push("alt", "json");
21017 let mut url = self.hub._base_url.clone() + "v1/{+name}";
21018 if self._scopes.is_empty() {
21019 self._scopes
21020 .insert(Scope::CloudPlatform.as_ref().to_string());
21021 }
21022
21023 #[allow(clippy::single_element_loop)]
21024 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21025 url = params.uri_replacement(url, param_name, find_this, true);
21026 }
21027 {
21028 let to_remove = ["name"];
21029 params.remove_params(&to_remove);
21030 }
21031
21032 let url = params.parse_with_url(&url);
21033
21034 let mut json_mime_type = mime::APPLICATION_JSON;
21035 let mut request_value_reader = {
21036 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21037 common::remove_json_null_values(&mut value);
21038 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21039 serde_json::to_writer(&mut dst, &value).unwrap();
21040 dst
21041 };
21042 let request_size = request_value_reader
21043 .seek(std::io::SeekFrom::End(0))
21044 .unwrap();
21045 request_value_reader
21046 .seek(std::io::SeekFrom::Start(0))
21047 .unwrap();
21048
21049 loop {
21050 let token = match self
21051 .hub
21052 .auth
21053 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21054 .await
21055 {
21056 Ok(token) => token,
21057 Err(e) => match dlg.token(e) {
21058 Ok(token) => token,
21059 Err(e) => {
21060 dlg.finished(false);
21061 return Err(common::Error::MissingToken(e));
21062 }
21063 },
21064 };
21065 request_value_reader
21066 .seek(std::io::SeekFrom::Start(0))
21067 .unwrap();
21068 let mut req_result = {
21069 let client = &self.hub.client;
21070 dlg.pre_request();
21071 let mut req_builder = hyper::Request::builder()
21072 .method(hyper::Method::PATCH)
21073 .uri(url.as_str())
21074 .header(USER_AGENT, self.hub._user_agent.clone());
21075
21076 if let Some(token) = token.as_ref() {
21077 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21078 }
21079
21080 let request = req_builder
21081 .header(CONTENT_TYPE, json_mime_type.to_string())
21082 .header(CONTENT_LENGTH, request_size as u64)
21083 .body(common::to_body(
21084 request_value_reader.get_ref().clone().into(),
21085 ));
21086
21087 client.request(request.unwrap()).await
21088 };
21089
21090 match req_result {
21091 Err(err) => {
21092 if let common::Retry::After(d) = dlg.http_error(&err) {
21093 sleep(d).await;
21094 continue;
21095 }
21096 dlg.finished(false);
21097 return Err(common::Error::HttpError(err));
21098 }
21099 Ok(res) => {
21100 let (mut parts, body) = res.into_parts();
21101 let mut body = common::Body::new(body);
21102 if !parts.status.is_success() {
21103 let bytes = common::to_bytes(body).await.unwrap_or_default();
21104 let error = serde_json::from_str(&common::to_string(&bytes));
21105 let response = common::to_response(parts, bytes.into());
21106
21107 if let common::Retry::After(d) =
21108 dlg.http_failure(&response, error.as_ref().ok())
21109 {
21110 sleep(d).await;
21111 continue;
21112 }
21113
21114 dlg.finished(false);
21115
21116 return Err(match error {
21117 Ok(value) => common::Error::BadRequest(value),
21118 _ => common::Error::Failure(response),
21119 });
21120 }
21121 let response = {
21122 let bytes = common::to_bytes(body).await.unwrap_or_default();
21123 let encoded = common::to_string(&bytes);
21124 match serde_json::from_str(&encoded) {
21125 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21126 Err(error) => {
21127 dlg.response_json_decode_error(&encoded, &error);
21128 return Err(common::Error::JsonDecodeError(
21129 encoded.to_string(),
21130 error,
21131 ));
21132 }
21133 }
21134 };
21135
21136 dlg.finished(true);
21137 return Ok(response);
21138 }
21139 }
21140 }
21141 }
21142
21143 ///
21144 /// Sets the *request* property to the given value.
21145 ///
21146 /// Even though the property as already been set when instantiating this call,
21147 /// we provide this method for API completeness.
21148 pub fn request(
21149 mut self,
21150 new_value: DeployPolicy,
21151 ) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21152 self._request = new_value;
21153 self
21154 }
21155 /// Output only. Name of the `DeployPolicy`. Format is `projects/{project}/locations/{location}/deployPolicies/{deployPolicy}`. The `deployPolicy` component must match `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`
21156 ///
21157 /// Sets the *name* path property to the given value.
21158 ///
21159 /// Even though the property as already been set when instantiating this call,
21160 /// we provide this method for API completeness.
21161 pub fn name(mut self, new_value: &str) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21162 self._name = new_value.to_string();
21163 self
21164 }
21165 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
21166 ///
21167 /// Sets the *validate only* query property to the given value.
21168 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21169 self._validate_only = Some(new_value);
21170 self
21171 }
21172 /// Required. Field mask is used to specify the fields to be overwritten by the update in the `DeployPolicy` resource. 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.
21173 ///
21174 /// Sets the *update mask* query property to the given value.
21175 pub fn update_mask(
21176 mut self,
21177 new_value: common::FieldMask,
21178 ) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21179 self._update_mask = Some(new_value);
21180 self
21181 }
21182 /// 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).
21183 ///
21184 /// Sets the *request id* query property to the given value.
21185 pub fn request_id(mut self, new_value: &str) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21186 self._request_id = Some(new_value.to_string());
21187 self
21188 }
21189 /// Optional. If set to true, updating a `DeployPolicy` that does not exist will result in the creation of a new `DeployPolicy`.
21190 ///
21191 /// Sets the *allow missing* query property to the given value.
21192 pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21193 self._allow_missing = Some(new_value);
21194 self
21195 }
21196 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21197 /// while executing the actual API request.
21198 ///
21199 /// ````text
21200 /// It should be used to handle progress information, and to implement a certain level of resilience.
21201 /// ````
21202 ///
21203 /// Sets the *delegate* property to the given value.
21204 pub fn delegate(
21205 mut self,
21206 new_value: &'a mut dyn common::Delegate,
21207 ) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21208 self._delegate = Some(new_value);
21209 self
21210 }
21211
21212 /// Set any additional parameter of the query string used in the request.
21213 /// It should be used to set parameters which are not yet available through their own
21214 /// setters.
21215 ///
21216 /// Please note that this method must not be used to set any of the known parameters
21217 /// which have their own setter method. If done anyway, the request will fail.
21218 ///
21219 /// # Additional Parameters
21220 ///
21221 /// * *$.xgafv* (query-string) - V1 error format.
21222 /// * *access_token* (query-string) - OAuth access token.
21223 /// * *alt* (query-string) - Data format for response.
21224 /// * *callback* (query-string) - JSONP
21225 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21226 /// * *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.
21227 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21228 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21229 /// * *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.
21230 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21231 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21232 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationDeployPolicyPatchCall<'a, C>
21233 where
21234 T: AsRef<str>,
21235 {
21236 self._additional_params
21237 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21238 self
21239 }
21240
21241 /// Identifies the authorization scope for the method you are building.
21242 ///
21243 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21244 /// [`Scope::CloudPlatform`].
21245 ///
21246 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21247 /// tokens for more than one scope.
21248 ///
21249 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21250 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21251 /// sufficient, a read-write scope will do as well.
21252 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeployPolicyPatchCall<'a, C>
21253 where
21254 St: AsRef<str>,
21255 {
21256 self._scopes.insert(String::from(scope.as_ref()));
21257 self
21258 }
21259 /// Identifies the authorization scope(s) for the method you are building.
21260 ///
21261 /// See [`Self::add_scope()`] for details.
21262 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationDeployPolicyPatchCall<'a, C>
21263 where
21264 I: IntoIterator<Item = St>,
21265 St: AsRef<str>,
21266 {
21267 self._scopes
21268 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21269 self
21270 }
21271
21272 /// Removes all scopes, and no default scope will be used either.
21273 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21274 /// for details).
21275 pub fn clear_scopes(mut self) -> ProjectLocationDeployPolicyPatchCall<'a, C> {
21276 self._scopes.clear();
21277 self
21278 }
21279}
21280
21281/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
21282///
21283/// A builder for the *locations.deployPolicies.setIamPolicy* method supported by a *project* resource.
21284/// It is not used directly, but through a [`ProjectMethods`] instance.
21285///
21286/// # Example
21287///
21288/// Instantiate a resource method builder
21289///
21290/// ```test_harness,no_run
21291/// # extern crate hyper;
21292/// # extern crate hyper_rustls;
21293/// # extern crate google_clouddeploy1 as clouddeploy1;
21294/// use clouddeploy1::api::SetIamPolicyRequest;
21295/// # async fn dox() {
21296/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21297///
21298/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21299/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21300/// # .with_native_roots()
21301/// # .unwrap()
21302/// # .https_only()
21303/// # .enable_http2()
21304/// # .build();
21305///
21306/// # let executor = hyper_util::rt::TokioExecutor::new();
21307/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21308/// # secret,
21309/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21310/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21311/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21312/// # ),
21313/// # ).build().await.unwrap();
21314///
21315/// # let client = hyper_util::client::legacy::Client::builder(
21316/// # hyper_util::rt::TokioExecutor::new()
21317/// # )
21318/// # .build(
21319/// # hyper_rustls::HttpsConnectorBuilder::new()
21320/// # .with_native_roots()
21321/// # .unwrap()
21322/// # .https_or_http()
21323/// # .enable_http2()
21324/// # .build()
21325/// # );
21326/// # let mut hub = CloudDeploy::new(client, auth);
21327/// // As the method needs a request, you would usually fill it with the desired information
21328/// // into the respective structure. Some of the parts shown here might not be applicable !
21329/// // Values shown here are possibly random and not representative !
21330/// let mut req = SetIamPolicyRequest::default();
21331///
21332/// // You can configure optional parameters by calling the respective setters at will, and
21333/// // execute the final call using `doit()`.
21334/// // Values shown here are possibly random and not representative !
21335/// let result = hub.projects().locations_deploy_policies_set_iam_policy(req, "resource")
21336/// .doit().await;
21337/// # }
21338/// ```
21339pub struct ProjectLocationDeployPolicySetIamPolicyCall<'a, C>
21340where
21341 C: 'a,
21342{
21343 hub: &'a CloudDeploy<C>,
21344 _request: SetIamPolicyRequest,
21345 _resource: String,
21346 _delegate: Option<&'a mut dyn common::Delegate>,
21347 _additional_params: HashMap<String, String>,
21348 _scopes: BTreeSet<String>,
21349}
21350
21351impl<'a, C> common::CallBuilder for ProjectLocationDeployPolicySetIamPolicyCall<'a, C> {}
21352
21353impl<'a, C> ProjectLocationDeployPolicySetIamPolicyCall<'a, C>
21354where
21355 C: common::Connector,
21356{
21357 /// Perform the operation you have build so far.
21358 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
21359 use std::borrow::Cow;
21360 use std::io::{Read, Seek};
21361
21362 use common::{url::Params, ToParts};
21363 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21364
21365 let mut dd = common::DefaultDelegate;
21366 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21367 dlg.begin(common::MethodInfo {
21368 id: "clouddeploy.projects.locations.deployPolicies.setIamPolicy",
21369 http_method: hyper::Method::POST,
21370 });
21371
21372 for &field in ["alt", "resource"].iter() {
21373 if self._additional_params.contains_key(field) {
21374 dlg.finished(false);
21375 return Err(common::Error::FieldClash(field));
21376 }
21377 }
21378
21379 let mut params = Params::with_capacity(4 + self._additional_params.len());
21380 params.push("resource", self._resource);
21381
21382 params.extend(self._additional_params.iter());
21383
21384 params.push("alt", "json");
21385 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
21386 if self._scopes.is_empty() {
21387 self._scopes
21388 .insert(Scope::CloudPlatform.as_ref().to_string());
21389 }
21390
21391 #[allow(clippy::single_element_loop)]
21392 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
21393 url = params.uri_replacement(url, param_name, find_this, true);
21394 }
21395 {
21396 let to_remove = ["resource"];
21397 params.remove_params(&to_remove);
21398 }
21399
21400 let url = params.parse_with_url(&url);
21401
21402 let mut json_mime_type = mime::APPLICATION_JSON;
21403 let mut request_value_reader = {
21404 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21405 common::remove_json_null_values(&mut value);
21406 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21407 serde_json::to_writer(&mut dst, &value).unwrap();
21408 dst
21409 };
21410 let request_size = request_value_reader
21411 .seek(std::io::SeekFrom::End(0))
21412 .unwrap();
21413 request_value_reader
21414 .seek(std::io::SeekFrom::Start(0))
21415 .unwrap();
21416
21417 loop {
21418 let token = match self
21419 .hub
21420 .auth
21421 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21422 .await
21423 {
21424 Ok(token) => token,
21425 Err(e) => match dlg.token(e) {
21426 Ok(token) => token,
21427 Err(e) => {
21428 dlg.finished(false);
21429 return Err(common::Error::MissingToken(e));
21430 }
21431 },
21432 };
21433 request_value_reader
21434 .seek(std::io::SeekFrom::Start(0))
21435 .unwrap();
21436 let mut req_result = {
21437 let client = &self.hub.client;
21438 dlg.pre_request();
21439 let mut req_builder = hyper::Request::builder()
21440 .method(hyper::Method::POST)
21441 .uri(url.as_str())
21442 .header(USER_AGENT, self.hub._user_agent.clone());
21443
21444 if let Some(token) = token.as_ref() {
21445 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21446 }
21447
21448 let request = req_builder
21449 .header(CONTENT_TYPE, json_mime_type.to_string())
21450 .header(CONTENT_LENGTH, request_size as u64)
21451 .body(common::to_body(
21452 request_value_reader.get_ref().clone().into(),
21453 ));
21454
21455 client.request(request.unwrap()).await
21456 };
21457
21458 match req_result {
21459 Err(err) => {
21460 if let common::Retry::After(d) = dlg.http_error(&err) {
21461 sleep(d).await;
21462 continue;
21463 }
21464 dlg.finished(false);
21465 return Err(common::Error::HttpError(err));
21466 }
21467 Ok(res) => {
21468 let (mut parts, body) = res.into_parts();
21469 let mut body = common::Body::new(body);
21470 if !parts.status.is_success() {
21471 let bytes = common::to_bytes(body).await.unwrap_or_default();
21472 let error = serde_json::from_str(&common::to_string(&bytes));
21473 let response = common::to_response(parts, bytes.into());
21474
21475 if let common::Retry::After(d) =
21476 dlg.http_failure(&response, error.as_ref().ok())
21477 {
21478 sleep(d).await;
21479 continue;
21480 }
21481
21482 dlg.finished(false);
21483
21484 return Err(match error {
21485 Ok(value) => common::Error::BadRequest(value),
21486 _ => common::Error::Failure(response),
21487 });
21488 }
21489 let response = {
21490 let bytes = common::to_bytes(body).await.unwrap_or_default();
21491 let encoded = common::to_string(&bytes);
21492 match serde_json::from_str(&encoded) {
21493 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21494 Err(error) => {
21495 dlg.response_json_decode_error(&encoded, &error);
21496 return Err(common::Error::JsonDecodeError(
21497 encoded.to_string(),
21498 error,
21499 ));
21500 }
21501 }
21502 };
21503
21504 dlg.finished(true);
21505 return Ok(response);
21506 }
21507 }
21508 }
21509 }
21510
21511 ///
21512 /// Sets the *request* property to the given value.
21513 ///
21514 /// Even though the property as already been set when instantiating this call,
21515 /// we provide this method for API completeness.
21516 pub fn request(
21517 mut self,
21518 new_value: SetIamPolicyRequest,
21519 ) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C> {
21520 self._request = new_value;
21521 self
21522 }
21523 /// 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.
21524 ///
21525 /// Sets the *resource* path property to the given value.
21526 ///
21527 /// Even though the property as already been set when instantiating this call,
21528 /// we provide this method for API completeness.
21529 pub fn resource(
21530 mut self,
21531 new_value: &str,
21532 ) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C> {
21533 self._resource = new_value.to_string();
21534 self
21535 }
21536 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21537 /// while executing the actual API request.
21538 ///
21539 /// ````text
21540 /// It should be used to handle progress information, and to implement a certain level of resilience.
21541 /// ````
21542 ///
21543 /// Sets the *delegate* property to the given value.
21544 pub fn delegate(
21545 mut self,
21546 new_value: &'a mut dyn common::Delegate,
21547 ) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C> {
21548 self._delegate = Some(new_value);
21549 self
21550 }
21551
21552 /// Set any additional parameter of the query string used in the request.
21553 /// It should be used to set parameters which are not yet available through their own
21554 /// setters.
21555 ///
21556 /// Please note that this method must not be used to set any of the known parameters
21557 /// which have their own setter method. If done anyway, the request will fail.
21558 ///
21559 /// # Additional Parameters
21560 ///
21561 /// * *$.xgafv* (query-string) - V1 error format.
21562 /// * *access_token* (query-string) - OAuth access token.
21563 /// * *alt* (query-string) - Data format for response.
21564 /// * *callback* (query-string) - JSONP
21565 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21566 /// * *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.
21567 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21568 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21569 /// * *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.
21570 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21571 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21572 pub fn param<T>(
21573 mut self,
21574 name: T,
21575 value: T,
21576 ) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C>
21577 where
21578 T: AsRef<str>,
21579 {
21580 self._additional_params
21581 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21582 self
21583 }
21584
21585 /// Identifies the authorization scope for the method you are building.
21586 ///
21587 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21588 /// [`Scope::CloudPlatform`].
21589 ///
21590 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21591 /// tokens for more than one scope.
21592 ///
21593 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21594 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21595 /// sufficient, a read-write scope will do as well.
21596 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C>
21597 where
21598 St: AsRef<str>,
21599 {
21600 self._scopes.insert(String::from(scope.as_ref()));
21601 self
21602 }
21603 /// Identifies the authorization scope(s) for the method you are building.
21604 ///
21605 /// See [`Self::add_scope()`] for details.
21606 pub fn add_scopes<I, St>(
21607 mut self,
21608 scopes: I,
21609 ) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C>
21610 where
21611 I: IntoIterator<Item = St>,
21612 St: AsRef<str>,
21613 {
21614 self._scopes
21615 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21616 self
21617 }
21618
21619 /// Removes all scopes, and no default scope will be used either.
21620 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21621 /// for details).
21622 pub fn clear_scopes(mut self) -> ProjectLocationDeployPolicySetIamPolicyCall<'a, C> {
21623 self._scopes.clear();
21624 self
21625 }
21626}
21627
21628/// 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`.
21629///
21630/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
21631/// It is not used directly, but through a [`ProjectMethods`] instance.
21632///
21633/// # Example
21634///
21635/// Instantiate a resource method builder
21636///
21637/// ```test_harness,no_run
21638/// # extern crate hyper;
21639/// # extern crate hyper_rustls;
21640/// # extern crate google_clouddeploy1 as clouddeploy1;
21641/// use clouddeploy1::api::CancelOperationRequest;
21642/// # async fn dox() {
21643/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21644///
21645/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21646/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21647/// # .with_native_roots()
21648/// # .unwrap()
21649/// # .https_only()
21650/// # .enable_http2()
21651/// # .build();
21652///
21653/// # let executor = hyper_util::rt::TokioExecutor::new();
21654/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21655/// # secret,
21656/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21657/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21658/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21659/// # ),
21660/// # ).build().await.unwrap();
21661///
21662/// # let client = hyper_util::client::legacy::Client::builder(
21663/// # hyper_util::rt::TokioExecutor::new()
21664/// # )
21665/// # .build(
21666/// # hyper_rustls::HttpsConnectorBuilder::new()
21667/// # .with_native_roots()
21668/// # .unwrap()
21669/// # .https_or_http()
21670/// # .enable_http2()
21671/// # .build()
21672/// # );
21673/// # let mut hub = CloudDeploy::new(client, auth);
21674/// // As the method needs a request, you would usually fill it with the desired information
21675/// // into the respective structure. Some of the parts shown here might not be applicable !
21676/// // Values shown here are possibly random and not representative !
21677/// let mut req = CancelOperationRequest::default();
21678///
21679/// // You can configure optional parameters by calling the respective setters at will, and
21680/// // execute the final call using `doit()`.
21681/// // Values shown here are possibly random and not representative !
21682/// let result = hub.projects().locations_operations_cancel(req, "name")
21683/// .doit().await;
21684/// # }
21685/// ```
21686pub struct ProjectLocationOperationCancelCall<'a, C>
21687where
21688 C: 'a,
21689{
21690 hub: &'a CloudDeploy<C>,
21691 _request: CancelOperationRequest,
21692 _name: String,
21693 _delegate: Option<&'a mut dyn common::Delegate>,
21694 _additional_params: HashMap<String, String>,
21695 _scopes: BTreeSet<String>,
21696}
21697
21698impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
21699
21700impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
21701where
21702 C: common::Connector,
21703{
21704 /// Perform the operation you have build so far.
21705 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
21706 use std::borrow::Cow;
21707 use std::io::{Read, Seek};
21708
21709 use common::{url::Params, ToParts};
21710 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21711
21712 let mut dd = common::DefaultDelegate;
21713 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21714 dlg.begin(common::MethodInfo {
21715 id: "clouddeploy.projects.locations.operations.cancel",
21716 http_method: hyper::Method::POST,
21717 });
21718
21719 for &field in ["alt", "name"].iter() {
21720 if self._additional_params.contains_key(field) {
21721 dlg.finished(false);
21722 return Err(common::Error::FieldClash(field));
21723 }
21724 }
21725
21726 let mut params = Params::with_capacity(4 + self._additional_params.len());
21727 params.push("name", self._name);
21728
21729 params.extend(self._additional_params.iter());
21730
21731 params.push("alt", "json");
21732 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
21733 if self._scopes.is_empty() {
21734 self._scopes
21735 .insert(Scope::CloudPlatform.as_ref().to_string());
21736 }
21737
21738 #[allow(clippy::single_element_loop)]
21739 for &(find_this, param_name) in [("{+name}", "name")].iter() {
21740 url = params.uri_replacement(url, param_name, find_this, true);
21741 }
21742 {
21743 let to_remove = ["name"];
21744 params.remove_params(&to_remove);
21745 }
21746
21747 let url = params.parse_with_url(&url);
21748
21749 let mut json_mime_type = mime::APPLICATION_JSON;
21750 let mut request_value_reader = {
21751 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21752 common::remove_json_null_values(&mut value);
21753 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21754 serde_json::to_writer(&mut dst, &value).unwrap();
21755 dst
21756 };
21757 let request_size = request_value_reader
21758 .seek(std::io::SeekFrom::End(0))
21759 .unwrap();
21760 request_value_reader
21761 .seek(std::io::SeekFrom::Start(0))
21762 .unwrap();
21763
21764 loop {
21765 let token = match self
21766 .hub
21767 .auth
21768 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21769 .await
21770 {
21771 Ok(token) => token,
21772 Err(e) => match dlg.token(e) {
21773 Ok(token) => token,
21774 Err(e) => {
21775 dlg.finished(false);
21776 return Err(common::Error::MissingToken(e));
21777 }
21778 },
21779 };
21780 request_value_reader
21781 .seek(std::io::SeekFrom::Start(0))
21782 .unwrap();
21783 let mut req_result = {
21784 let client = &self.hub.client;
21785 dlg.pre_request();
21786 let mut req_builder = hyper::Request::builder()
21787 .method(hyper::Method::POST)
21788 .uri(url.as_str())
21789 .header(USER_AGENT, self.hub._user_agent.clone());
21790
21791 if let Some(token) = token.as_ref() {
21792 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21793 }
21794
21795 let request = req_builder
21796 .header(CONTENT_TYPE, json_mime_type.to_string())
21797 .header(CONTENT_LENGTH, request_size as u64)
21798 .body(common::to_body(
21799 request_value_reader.get_ref().clone().into(),
21800 ));
21801
21802 client.request(request.unwrap()).await
21803 };
21804
21805 match req_result {
21806 Err(err) => {
21807 if let common::Retry::After(d) = dlg.http_error(&err) {
21808 sleep(d).await;
21809 continue;
21810 }
21811 dlg.finished(false);
21812 return Err(common::Error::HttpError(err));
21813 }
21814 Ok(res) => {
21815 let (mut parts, body) = res.into_parts();
21816 let mut body = common::Body::new(body);
21817 if !parts.status.is_success() {
21818 let bytes = common::to_bytes(body).await.unwrap_or_default();
21819 let error = serde_json::from_str(&common::to_string(&bytes));
21820 let response = common::to_response(parts, bytes.into());
21821
21822 if let common::Retry::After(d) =
21823 dlg.http_failure(&response, error.as_ref().ok())
21824 {
21825 sleep(d).await;
21826 continue;
21827 }
21828
21829 dlg.finished(false);
21830
21831 return Err(match error {
21832 Ok(value) => common::Error::BadRequest(value),
21833 _ => common::Error::Failure(response),
21834 });
21835 }
21836 let response = {
21837 let bytes = common::to_bytes(body).await.unwrap_or_default();
21838 let encoded = common::to_string(&bytes);
21839 match serde_json::from_str(&encoded) {
21840 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21841 Err(error) => {
21842 dlg.response_json_decode_error(&encoded, &error);
21843 return Err(common::Error::JsonDecodeError(
21844 encoded.to_string(),
21845 error,
21846 ));
21847 }
21848 }
21849 };
21850
21851 dlg.finished(true);
21852 return Ok(response);
21853 }
21854 }
21855 }
21856 }
21857
21858 ///
21859 /// Sets the *request* property to the given value.
21860 ///
21861 /// Even though the property as already been set when instantiating this call,
21862 /// we provide this method for API completeness.
21863 pub fn request(
21864 mut self,
21865 new_value: CancelOperationRequest,
21866 ) -> ProjectLocationOperationCancelCall<'a, C> {
21867 self._request = new_value;
21868 self
21869 }
21870 /// The name of the operation resource to be cancelled.
21871 ///
21872 /// Sets the *name* path property to the given value.
21873 ///
21874 /// Even though the property as already been set when instantiating this call,
21875 /// we provide this method for API completeness.
21876 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
21877 self._name = new_value.to_string();
21878 self
21879 }
21880 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21881 /// while executing the actual API request.
21882 ///
21883 /// ````text
21884 /// It should be used to handle progress information, and to implement a certain level of resilience.
21885 /// ````
21886 ///
21887 /// Sets the *delegate* property to the given value.
21888 pub fn delegate(
21889 mut self,
21890 new_value: &'a mut dyn common::Delegate,
21891 ) -> ProjectLocationOperationCancelCall<'a, C> {
21892 self._delegate = Some(new_value);
21893 self
21894 }
21895
21896 /// Set any additional parameter of the query string used in the request.
21897 /// It should be used to set parameters which are not yet available through their own
21898 /// setters.
21899 ///
21900 /// Please note that this method must not be used to set any of the known parameters
21901 /// which have their own setter method. If done anyway, the request will fail.
21902 ///
21903 /// # Additional Parameters
21904 ///
21905 /// * *$.xgafv* (query-string) - V1 error format.
21906 /// * *access_token* (query-string) - OAuth access token.
21907 /// * *alt* (query-string) - Data format for response.
21908 /// * *callback* (query-string) - JSONP
21909 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21910 /// * *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.
21911 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21912 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21913 /// * *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.
21914 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21915 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21916 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
21917 where
21918 T: AsRef<str>,
21919 {
21920 self._additional_params
21921 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21922 self
21923 }
21924
21925 /// Identifies the authorization scope for the method you are building.
21926 ///
21927 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21928 /// [`Scope::CloudPlatform`].
21929 ///
21930 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21931 /// tokens for more than one scope.
21932 ///
21933 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21934 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21935 /// sufficient, a read-write scope will do as well.
21936 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
21937 where
21938 St: AsRef<str>,
21939 {
21940 self._scopes.insert(String::from(scope.as_ref()));
21941 self
21942 }
21943 /// Identifies the authorization scope(s) for the method you are building.
21944 ///
21945 /// See [`Self::add_scope()`] for details.
21946 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
21947 where
21948 I: IntoIterator<Item = St>,
21949 St: AsRef<str>,
21950 {
21951 self._scopes
21952 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21953 self
21954 }
21955
21956 /// Removes all scopes, and no default scope will be used either.
21957 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21958 /// for details).
21959 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
21960 self._scopes.clear();
21961 self
21962 }
21963}
21964
21965/// 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`.
21966///
21967/// A builder for the *locations.operations.delete* method supported by a *project* resource.
21968/// It is not used directly, but through a [`ProjectMethods`] instance.
21969///
21970/// # Example
21971///
21972/// Instantiate a resource method builder
21973///
21974/// ```test_harness,no_run
21975/// # extern crate hyper;
21976/// # extern crate hyper_rustls;
21977/// # extern crate google_clouddeploy1 as clouddeploy1;
21978/// # async fn dox() {
21979/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21980///
21981/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21982/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21983/// # .with_native_roots()
21984/// # .unwrap()
21985/// # .https_only()
21986/// # .enable_http2()
21987/// # .build();
21988///
21989/// # let executor = hyper_util::rt::TokioExecutor::new();
21990/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21991/// # secret,
21992/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21993/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21994/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21995/// # ),
21996/// # ).build().await.unwrap();
21997///
21998/// # let client = hyper_util::client::legacy::Client::builder(
21999/// # hyper_util::rt::TokioExecutor::new()
22000/// # )
22001/// # .build(
22002/// # hyper_rustls::HttpsConnectorBuilder::new()
22003/// # .with_native_roots()
22004/// # .unwrap()
22005/// # .https_or_http()
22006/// # .enable_http2()
22007/// # .build()
22008/// # );
22009/// # let mut hub = CloudDeploy::new(client, auth);
22010/// // You can configure optional parameters by calling the respective setters at will, and
22011/// // execute the final call using `doit()`.
22012/// // Values shown here are possibly random and not representative !
22013/// let result = hub.projects().locations_operations_delete("name")
22014/// .doit().await;
22015/// # }
22016/// ```
22017pub struct ProjectLocationOperationDeleteCall<'a, C>
22018where
22019 C: 'a,
22020{
22021 hub: &'a CloudDeploy<C>,
22022 _name: String,
22023 _delegate: Option<&'a mut dyn common::Delegate>,
22024 _additional_params: HashMap<String, String>,
22025 _scopes: BTreeSet<String>,
22026}
22027
22028impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
22029
22030impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
22031where
22032 C: common::Connector,
22033{
22034 /// Perform the operation you have build so far.
22035 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
22036 use std::borrow::Cow;
22037 use std::io::{Read, Seek};
22038
22039 use common::{url::Params, ToParts};
22040 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22041
22042 let mut dd = common::DefaultDelegate;
22043 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22044 dlg.begin(common::MethodInfo {
22045 id: "clouddeploy.projects.locations.operations.delete",
22046 http_method: hyper::Method::DELETE,
22047 });
22048
22049 for &field in ["alt", "name"].iter() {
22050 if self._additional_params.contains_key(field) {
22051 dlg.finished(false);
22052 return Err(common::Error::FieldClash(field));
22053 }
22054 }
22055
22056 let mut params = Params::with_capacity(3 + self._additional_params.len());
22057 params.push("name", self._name);
22058
22059 params.extend(self._additional_params.iter());
22060
22061 params.push("alt", "json");
22062 let mut url = self.hub._base_url.clone() + "v1/{+name}";
22063 if self._scopes.is_empty() {
22064 self._scopes
22065 .insert(Scope::CloudPlatform.as_ref().to_string());
22066 }
22067
22068 #[allow(clippy::single_element_loop)]
22069 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22070 url = params.uri_replacement(url, param_name, find_this, true);
22071 }
22072 {
22073 let to_remove = ["name"];
22074 params.remove_params(&to_remove);
22075 }
22076
22077 let url = params.parse_with_url(&url);
22078
22079 loop {
22080 let token = match self
22081 .hub
22082 .auth
22083 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22084 .await
22085 {
22086 Ok(token) => token,
22087 Err(e) => match dlg.token(e) {
22088 Ok(token) => token,
22089 Err(e) => {
22090 dlg.finished(false);
22091 return Err(common::Error::MissingToken(e));
22092 }
22093 },
22094 };
22095 let mut req_result = {
22096 let client = &self.hub.client;
22097 dlg.pre_request();
22098 let mut req_builder = hyper::Request::builder()
22099 .method(hyper::Method::DELETE)
22100 .uri(url.as_str())
22101 .header(USER_AGENT, self.hub._user_agent.clone());
22102
22103 if let Some(token) = token.as_ref() {
22104 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22105 }
22106
22107 let request = req_builder
22108 .header(CONTENT_LENGTH, 0_u64)
22109 .body(common::to_body::<String>(None));
22110
22111 client.request(request.unwrap()).await
22112 };
22113
22114 match req_result {
22115 Err(err) => {
22116 if let common::Retry::After(d) = dlg.http_error(&err) {
22117 sleep(d).await;
22118 continue;
22119 }
22120 dlg.finished(false);
22121 return Err(common::Error::HttpError(err));
22122 }
22123 Ok(res) => {
22124 let (mut parts, body) = res.into_parts();
22125 let mut body = common::Body::new(body);
22126 if !parts.status.is_success() {
22127 let bytes = common::to_bytes(body).await.unwrap_or_default();
22128 let error = serde_json::from_str(&common::to_string(&bytes));
22129 let response = common::to_response(parts, bytes.into());
22130
22131 if let common::Retry::After(d) =
22132 dlg.http_failure(&response, error.as_ref().ok())
22133 {
22134 sleep(d).await;
22135 continue;
22136 }
22137
22138 dlg.finished(false);
22139
22140 return Err(match error {
22141 Ok(value) => common::Error::BadRequest(value),
22142 _ => common::Error::Failure(response),
22143 });
22144 }
22145 let response = {
22146 let bytes = common::to_bytes(body).await.unwrap_or_default();
22147 let encoded = common::to_string(&bytes);
22148 match serde_json::from_str(&encoded) {
22149 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22150 Err(error) => {
22151 dlg.response_json_decode_error(&encoded, &error);
22152 return Err(common::Error::JsonDecodeError(
22153 encoded.to_string(),
22154 error,
22155 ));
22156 }
22157 }
22158 };
22159
22160 dlg.finished(true);
22161 return Ok(response);
22162 }
22163 }
22164 }
22165 }
22166
22167 /// The name of the operation resource to be deleted.
22168 ///
22169 /// Sets the *name* path property to the given value.
22170 ///
22171 /// Even though the property as already been set when instantiating this call,
22172 /// we provide this method for API completeness.
22173 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
22174 self._name = new_value.to_string();
22175 self
22176 }
22177 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22178 /// while executing the actual API request.
22179 ///
22180 /// ````text
22181 /// It should be used to handle progress information, and to implement a certain level of resilience.
22182 /// ````
22183 ///
22184 /// Sets the *delegate* property to the given value.
22185 pub fn delegate(
22186 mut self,
22187 new_value: &'a mut dyn common::Delegate,
22188 ) -> ProjectLocationOperationDeleteCall<'a, C> {
22189 self._delegate = Some(new_value);
22190 self
22191 }
22192
22193 /// Set any additional parameter of the query string used in the request.
22194 /// It should be used to set parameters which are not yet available through their own
22195 /// setters.
22196 ///
22197 /// Please note that this method must not be used to set any of the known parameters
22198 /// which have their own setter method. If done anyway, the request will fail.
22199 ///
22200 /// # Additional Parameters
22201 ///
22202 /// * *$.xgafv* (query-string) - V1 error format.
22203 /// * *access_token* (query-string) - OAuth access token.
22204 /// * *alt* (query-string) - Data format for response.
22205 /// * *callback* (query-string) - JSONP
22206 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22207 /// * *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.
22208 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22209 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22210 /// * *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.
22211 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22212 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22213 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
22214 where
22215 T: AsRef<str>,
22216 {
22217 self._additional_params
22218 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22219 self
22220 }
22221
22222 /// Identifies the authorization scope for the method you are building.
22223 ///
22224 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22225 /// [`Scope::CloudPlatform`].
22226 ///
22227 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22228 /// tokens for more than one scope.
22229 ///
22230 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22231 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22232 /// sufficient, a read-write scope will do as well.
22233 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
22234 where
22235 St: AsRef<str>,
22236 {
22237 self._scopes.insert(String::from(scope.as_ref()));
22238 self
22239 }
22240 /// Identifies the authorization scope(s) for the method you are building.
22241 ///
22242 /// See [`Self::add_scope()`] for details.
22243 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
22244 where
22245 I: IntoIterator<Item = St>,
22246 St: AsRef<str>,
22247 {
22248 self._scopes
22249 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22250 self
22251 }
22252
22253 /// Removes all scopes, and no default scope will be used either.
22254 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22255 /// for details).
22256 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
22257 self._scopes.clear();
22258 self
22259 }
22260}
22261
22262/// 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.
22263///
22264/// A builder for the *locations.operations.get* method supported by a *project* resource.
22265/// It is not used directly, but through a [`ProjectMethods`] instance.
22266///
22267/// # Example
22268///
22269/// Instantiate a resource method builder
22270///
22271/// ```test_harness,no_run
22272/// # extern crate hyper;
22273/// # extern crate hyper_rustls;
22274/// # extern crate google_clouddeploy1 as clouddeploy1;
22275/// # async fn dox() {
22276/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22277///
22278/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22279/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22280/// # .with_native_roots()
22281/// # .unwrap()
22282/// # .https_only()
22283/// # .enable_http2()
22284/// # .build();
22285///
22286/// # let executor = hyper_util::rt::TokioExecutor::new();
22287/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22288/// # secret,
22289/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22290/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22291/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22292/// # ),
22293/// # ).build().await.unwrap();
22294///
22295/// # let client = hyper_util::client::legacy::Client::builder(
22296/// # hyper_util::rt::TokioExecutor::new()
22297/// # )
22298/// # .build(
22299/// # hyper_rustls::HttpsConnectorBuilder::new()
22300/// # .with_native_roots()
22301/// # .unwrap()
22302/// # .https_or_http()
22303/// # .enable_http2()
22304/// # .build()
22305/// # );
22306/// # let mut hub = CloudDeploy::new(client, auth);
22307/// // You can configure optional parameters by calling the respective setters at will, and
22308/// // execute the final call using `doit()`.
22309/// // Values shown here are possibly random and not representative !
22310/// let result = hub.projects().locations_operations_get("name")
22311/// .doit().await;
22312/// # }
22313/// ```
22314pub struct ProjectLocationOperationGetCall<'a, C>
22315where
22316 C: 'a,
22317{
22318 hub: &'a CloudDeploy<C>,
22319 _name: String,
22320 _delegate: Option<&'a mut dyn common::Delegate>,
22321 _additional_params: HashMap<String, String>,
22322 _scopes: BTreeSet<String>,
22323}
22324
22325impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
22326
22327impl<'a, C> ProjectLocationOperationGetCall<'a, C>
22328where
22329 C: common::Connector,
22330{
22331 /// Perform the operation you have build so far.
22332 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22333 use std::borrow::Cow;
22334 use std::io::{Read, Seek};
22335
22336 use common::{url::Params, ToParts};
22337 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22338
22339 let mut dd = common::DefaultDelegate;
22340 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22341 dlg.begin(common::MethodInfo {
22342 id: "clouddeploy.projects.locations.operations.get",
22343 http_method: hyper::Method::GET,
22344 });
22345
22346 for &field in ["alt", "name"].iter() {
22347 if self._additional_params.contains_key(field) {
22348 dlg.finished(false);
22349 return Err(common::Error::FieldClash(field));
22350 }
22351 }
22352
22353 let mut params = Params::with_capacity(3 + self._additional_params.len());
22354 params.push("name", self._name);
22355
22356 params.extend(self._additional_params.iter());
22357
22358 params.push("alt", "json");
22359 let mut url = self.hub._base_url.clone() + "v1/{+name}";
22360 if self._scopes.is_empty() {
22361 self._scopes
22362 .insert(Scope::CloudPlatform.as_ref().to_string());
22363 }
22364
22365 #[allow(clippy::single_element_loop)]
22366 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22367 url = params.uri_replacement(url, param_name, find_this, true);
22368 }
22369 {
22370 let to_remove = ["name"];
22371 params.remove_params(&to_remove);
22372 }
22373
22374 let url = params.parse_with_url(&url);
22375
22376 loop {
22377 let token = match self
22378 .hub
22379 .auth
22380 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22381 .await
22382 {
22383 Ok(token) => token,
22384 Err(e) => match dlg.token(e) {
22385 Ok(token) => token,
22386 Err(e) => {
22387 dlg.finished(false);
22388 return Err(common::Error::MissingToken(e));
22389 }
22390 },
22391 };
22392 let mut req_result = {
22393 let client = &self.hub.client;
22394 dlg.pre_request();
22395 let mut req_builder = hyper::Request::builder()
22396 .method(hyper::Method::GET)
22397 .uri(url.as_str())
22398 .header(USER_AGENT, self.hub._user_agent.clone());
22399
22400 if let Some(token) = token.as_ref() {
22401 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22402 }
22403
22404 let request = req_builder
22405 .header(CONTENT_LENGTH, 0_u64)
22406 .body(common::to_body::<String>(None));
22407
22408 client.request(request.unwrap()).await
22409 };
22410
22411 match req_result {
22412 Err(err) => {
22413 if let common::Retry::After(d) = dlg.http_error(&err) {
22414 sleep(d).await;
22415 continue;
22416 }
22417 dlg.finished(false);
22418 return Err(common::Error::HttpError(err));
22419 }
22420 Ok(res) => {
22421 let (mut parts, body) = res.into_parts();
22422 let mut body = common::Body::new(body);
22423 if !parts.status.is_success() {
22424 let bytes = common::to_bytes(body).await.unwrap_or_default();
22425 let error = serde_json::from_str(&common::to_string(&bytes));
22426 let response = common::to_response(parts, bytes.into());
22427
22428 if let common::Retry::After(d) =
22429 dlg.http_failure(&response, error.as_ref().ok())
22430 {
22431 sleep(d).await;
22432 continue;
22433 }
22434
22435 dlg.finished(false);
22436
22437 return Err(match error {
22438 Ok(value) => common::Error::BadRequest(value),
22439 _ => common::Error::Failure(response),
22440 });
22441 }
22442 let response = {
22443 let bytes = common::to_bytes(body).await.unwrap_or_default();
22444 let encoded = common::to_string(&bytes);
22445 match serde_json::from_str(&encoded) {
22446 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22447 Err(error) => {
22448 dlg.response_json_decode_error(&encoded, &error);
22449 return Err(common::Error::JsonDecodeError(
22450 encoded.to_string(),
22451 error,
22452 ));
22453 }
22454 }
22455 };
22456
22457 dlg.finished(true);
22458 return Ok(response);
22459 }
22460 }
22461 }
22462 }
22463
22464 /// The name of the operation resource.
22465 ///
22466 /// Sets the *name* path property to the given value.
22467 ///
22468 /// Even though the property as already been set when instantiating this call,
22469 /// we provide this method for API completeness.
22470 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
22471 self._name = new_value.to_string();
22472 self
22473 }
22474 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22475 /// while executing the actual API request.
22476 ///
22477 /// ````text
22478 /// It should be used to handle progress information, and to implement a certain level of resilience.
22479 /// ````
22480 ///
22481 /// Sets the *delegate* property to the given value.
22482 pub fn delegate(
22483 mut self,
22484 new_value: &'a mut dyn common::Delegate,
22485 ) -> ProjectLocationOperationGetCall<'a, C> {
22486 self._delegate = Some(new_value);
22487 self
22488 }
22489
22490 /// Set any additional parameter of the query string used in the request.
22491 /// It should be used to set parameters which are not yet available through their own
22492 /// setters.
22493 ///
22494 /// Please note that this method must not be used to set any of the known parameters
22495 /// which have their own setter method. If done anyway, the request will fail.
22496 ///
22497 /// # Additional Parameters
22498 ///
22499 /// * *$.xgafv* (query-string) - V1 error format.
22500 /// * *access_token* (query-string) - OAuth access token.
22501 /// * *alt* (query-string) - Data format for response.
22502 /// * *callback* (query-string) - JSONP
22503 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22504 /// * *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.
22505 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22506 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22507 /// * *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.
22508 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22509 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22510 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
22511 where
22512 T: AsRef<str>,
22513 {
22514 self._additional_params
22515 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22516 self
22517 }
22518
22519 /// Identifies the authorization scope for the method you are building.
22520 ///
22521 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22522 /// [`Scope::CloudPlatform`].
22523 ///
22524 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22525 /// tokens for more than one scope.
22526 ///
22527 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22528 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22529 /// sufficient, a read-write scope will do as well.
22530 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
22531 where
22532 St: AsRef<str>,
22533 {
22534 self._scopes.insert(String::from(scope.as_ref()));
22535 self
22536 }
22537 /// Identifies the authorization scope(s) for the method you are building.
22538 ///
22539 /// See [`Self::add_scope()`] for details.
22540 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
22541 where
22542 I: IntoIterator<Item = St>,
22543 St: AsRef<str>,
22544 {
22545 self._scopes
22546 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22547 self
22548 }
22549
22550 /// Removes all scopes, and no default scope will be used either.
22551 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22552 /// for details).
22553 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
22554 self._scopes.clear();
22555 self
22556 }
22557}
22558
22559/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
22560///
22561/// A builder for the *locations.operations.list* method supported by a *project* resource.
22562/// It is not used directly, but through a [`ProjectMethods`] instance.
22563///
22564/// # Example
22565///
22566/// Instantiate a resource method builder
22567///
22568/// ```test_harness,no_run
22569/// # extern crate hyper;
22570/// # extern crate hyper_rustls;
22571/// # extern crate google_clouddeploy1 as clouddeploy1;
22572/// # async fn dox() {
22573/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22574///
22575/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22576/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22577/// # .with_native_roots()
22578/// # .unwrap()
22579/// # .https_only()
22580/// # .enable_http2()
22581/// # .build();
22582///
22583/// # let executor = hyper_util::rt::TokioExecutor::new();
22584/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22585/// # secret,
22586/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22587/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22588/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22589/// # ),
22590/// # ).build().await.unwrap();
22591///
22592/// # let client = hyper_util::client::legacy::Client::builder(
22593/// # hyper_util::rt::TokioExecutor::new()
22594/// # )
22595/// # .build(
22596/// # hyper_rustls::HttpsConnectorBuilder::new()
22597/// # .with_native_roots()
22598/// # .unwrap()
22599/// # .https_or_http()
22600/// # .enable_http2()
22601/// # .build()
22602/// # );
22603/// # let mut hub = CloudDeploy::new(client, auth);
22604/// // You can configure optional parameters by calling the respective setters at will, and
22605/// // execute the final call using `doit()`.
22606/// // Values shown here are possibly random and not representative !
22607/// let result = hub.projects().locations_operations_list("name")
22608/// .return_partial_success(true)
22609/// .page_token("erat")
22610/// .page_size(-10)
22611/// .filter("nonumy")
22612/// .doit().await;
22613/// # }
22614/// ```
22615pub struct ProjectLocationOperationListCall<'a, C>
22616where
22617 C: 'a,
22618{
22619 hub: &'a CloudDeploy<C>,
22620 _name: String,
22621 _return_partial_success: Option<bool>,
22622 _page_token: Option<String>,
22623 _page_size: Option<i32>,
22624 _filter: Option<String>,
22625 _delegate: Option<&'a mut dyn common::Delegate>,
22626 _additional_params: HashMap<String, String>,
22627 _scopes: BTreeSet<String>,
22628}
22629
22630impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
22631
22632impl<'a, C> ProjectLocationOperationListCall<'a, C>
22633where
22634 C: common::Connector,
22635{
22636 /// Perform the operation you have build so far.
22637 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
22638 use std::borrow::Cow;
22639 use std::io::{Read, Seek};
22640
22641 use common::{url::Params, ToParts};
22642 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22643
22644 let mut dd = common::DefaultDelegate;
22645 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22646 dlg.begin(common::MethodInfo {
22647 id: "clouddeploy.projects.locations.operations.list",
22648 http_method: hyper::Method::GET,
22649 });
22650
22651 for &field in [
22652 "alt",
22653 "name",
22654 "returnPartialSuccess",
22655 "pageToken",
22656 "pageSize",
22657 "filter",
22658 ]
22659 .iter()
22660 {
22661 if self._additional_params.contains_key(field) {
22662 dlg.finished(false);
22663 return Err(common::Error::FieldClash(field));
22664 }
22665 }
22666
22667 let mut params = Params::with_capacity(7 + self._additional_params.len());
22668 params.push("name", self._name);
22669 if let Some(value) = self._return_partial_success.as_ref() {
22670 params.push("returnPartialSuccess", value.to_string());
22671 }
22672 if let Some(value) = self._page_token.as_ref() {
22673 params.push("pageToken", value);
22674 }
22675 if let Some(value) = self._page_size.as_ref() {
22676 params.push("pageSize", value.to_string());
22677 }
22678 if let Some(value) = self._filter.as_ref() {
22679 params.push("filter", value);
22680 }
22681
22682 params.extend(self._additional_params.iter());
22683
22684 params.push("alt", "json");
22685 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
22686 if self._scopes.is_empty() {
22687 self._scopes
22688 .insert(Scope::CloudPlatform.as_ref().to_string());
22689 }
22690
22691 #[allow(clippy::single_element_loop)]
22692 for &(find_this, param_name) in [("{+name}", "name")].iter() {
22693 url = params.uri_replacement(url, param_name, find_this, true);
22694 }
22695 {
22696 let to_remove = ["name"];
22697 params.remove_params(&to_remove);
22698 }
22699
22700 let url = params.parse_with_url(&url);
22701
22702 loop {
22703 let token = match self
22704 .hub
22705 .auth
22706 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22707 .await
22708 {
22709 Ok(token) => token,
22710 Err(e) => match dlg.token(e) {
22711 Ok(token) => token,
22712 Err(e) => {
22713 dlg.finished(false);
22714 return Err(common::Error::MissingToken(e));
22715 }
22716 },
22717 };
22718 let mut req_result = {
22719 let client = &self.hub.client;
22720 dlg.pre_request();
22721 let mut req_builder = hyper::Request::builder()
22722 .method(hyper::Method::GET)
22723 .uri(url.as_str())
22724 .header(USER_AGENT, self.hub._user_agent.clone());
22725
22726 if let Some(token) = token.as_ref() {
22727 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22728 }
22729
22730 let request = req_builder
22731 .header(CONTENT_LENGTH, 0_u64)
22732 .body(common::to_body::<String>(None));
22733
22734 client.request(request.unwrap()).await
22735 };
22736
22737 match req_result {
22738 Err(err) => {
22739 if let common::Retry::After(d) = dlg.http_error(&err) {
22740 sleep(d).await;
22741 continue;
22742 }
22743 dlg.finished(false);
22744 return Err(common::Error::HttpError(err));
22745 }
22746 Ok(res) => {
22747 let (mut parts, body) = res.into_parts();
22748 let mut body = common::Body::new(body);
22749 if !parts.status.is_success() {
22750 let bytes = common::to_bytes(body).await.unwrap_or_default();
22751 let error = serde_json::from_str(&common::to_string(&bytes));
22752 let response = common::to_response(parts, bytes.into());
22753
22754 if let common::Retry::After(d) =
22755 dlg.http_failure(&response, error.as_ref().ok())
22756 {
22757 sleep(d).await;
22758 continue;
22759 }
22760
22761 dlg.finished(false);
22762
22763 return Err(match error {
22764 Ok(value) => common::Error::BadRequest(value),
22765 _ => common::Error::Failure(response),
22766 });
22767 }
22768 let response = {
22769 let bytes = common::to_bytes(body).await.unwrap_or_default();
22770 let encoded = common::to_string(&bytes);
22771 match serde_json::from_str(&encoded) {
22772 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22773 Err(error) => {
22774 dlg.response_json_decode_error(&encoded, &error);
22775 return Err(common::Error::JsonDecodeError(
22776 encoded.to_string(),
22777 error,
22778 ));
22779 }
22780 }
22781 };
22782
22783 dlg.finished(true);
22784 return Ok(response);
22785 }
22786 }
22787 }
22788 }
22789
22790 /// The name of the operation's parent resource.
22791 ///
22792 /// Sets the *name* path property to the given value.
22793 ///
22794 /// Even though the property as already been set when instantiating this call,
22795 /// we provide this method for API completeness.
22796 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
22797 self._name = new_value.to_string();
22798 self
22799 }
22800 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
22801 ///
22802 /// Sets the *return partial success* query property to the given value.
22803 pub fn return_partial_success(
22804 mut self,
22805 new_value: bool,
22806 ) -> ProjectLocationOperationListCall<'a, C> {
22807 self._return_partial_success = Some(new_value);
22808 self
22809 }
22810 /// The standard list page token.
22811 ///
22812 /// Sets the *page token* query property to the given value.
22813 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
22814 self._page_token = Some(new_value.to_string());
22815 self
22816 }
22817 /// The standard list page size.
22818 ///
22819 /// Sets the *page size* query property to the given value.
22820 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
22821 self._page_size = Some(new_value);
22822 self
22823 }
22824 /// The standard list filter.
22825 ///
22826 /// Sets the *filter* query property to the given value.
22827 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
22828 self._filter = Some(new_value.to_string());
22829 self
22830 }
22831 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22832 /// while executing the actual API request.
22833 ///
22834 /// ````text
22835 /// It should be used to handle progress information, and to implement a certain level of resilience.
22836 /// ````
22837 ///
22838 /// Sets the *delegate* property to the given value.
22839 pub fn delegate(
22840 mut self,
22841 new_value: &'a mut dyn common::Delegate,
22842 ) -> ProjectLocationOperationListCall<'a, C> {
22843 self._delegate = Some(new_value);
22844 self
22845 }
22846
22847 /// Set any additional parameter of the query string used in the request.
22848 /// It should be used to set parameters which are not yet available through their own
22849 /// setters.
22850 ///
22851 /// Please note that this method must not be used to set any of the known parameters
22852 /// which have their own setter method. If done anyway, the request will fail.
22853 ///
22854 /// # Additional Parameters
22855 ///
22856 /// * *$.xgafv* (query-string) - V1 error format.
22857 /// * *access_token* (query-string) - OAuth access token.
22858 /// * *alt* (query-string) - Data format for response.
22859 /// * *callback* (query-string) - JSONP
22860 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22861 /// * *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.
22862 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22863 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22864 /// * *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.
22865 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22866 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22867 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
22868 where
22869 T: AsRef<str>,
22870 {
22871 self._additional_params
22872 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22873 self
22874 }
22875
22876 /// Identifies the authorization scope for the method you are building.
22877 ///
22878 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22879 /// [`Scope::CloudPlatform`].
22880 ///
22881 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22882 /// tokens for more than one scope.
22883 ///
22884 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22885 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22886 /// sufficient, a read-write scope will do as well.
22887 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
22888 where
22889 St: AsRef<str>,
22890 {
22891 self._scopes.insert(String::from(scope.as_ref()));
22892 self
22893 }
22894 /// Identifies the authorization scope(s) for the method you are building.
22895 ///
22896 /// See [`Self::add_scope()`] for details.
22897 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
22898 where
22899 I: IntoIterator<Item = St>,
22900 St: AsRef<str>,
22901 {
22902 self._scopes
22903 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22904 self
22905 }
22906
22907 /// Removes all scopes, and no default scope will be used either.
22908 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22909 /// for details).
22910 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
22911 self._scopes.clear();
22912 self
22913 }
22914}
22915
22916/// Creates a new Target in a given project and location.
22917///
22918/// A builder for the *locations.targets.create* method supported by a *project* resource.
22919/// It is not used directly, but through a [`ProjectMethods`] instance.
22920///
22921/// # Example
22922///
22923/// Instantiate a resource method builder
22924///
22925/// ```test_harness,no_run
22926/// # extern crate hyper;
22927/// # extern crate hyper_rustls;
22928/// # extern crate google_clouddeploy1 as clouddeploy1;
22929/// use clouddeploy1::api::Target;
22930/// # async fn dox() {
22931/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22932///
22933/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22934/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22935/// # .with_native_roots()
22936/// # .unwrap()
22937/// # .https_only()
22938/// # .enable_http2()
22939/// # .build();
22940///
22941/// # let executor = hyper_util::rt::TokioExecutor::new();
22942/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22943/// # secret,
22944/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22945/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22946/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22947/// # ),
22948/// # ).build().await.unwrap();
22949///
22950/// # let client = hyper_util::client::legacy::Client::builder(
22951/// # hyper_util::rt::TokioExecutor::new()
22952/// # )
22953/// # .build(
22954/// # hyper_rustls::HttpsConnectorBuilder::new()
22955/// # .with_native_roots()
22956/// # .unwrap()
22957/// # .https_or_http()
22958/// # .enable_http2()
22959/// # .build()
22960/// # );
22961/// # let mut hub = CloudDeploy::new(client, auth);
22962/// // As the method needs a request, you would usually fill it with the desired information
22963/// // into the respective structure. Some of the parts shown here might not be applicable !
22964/// // Values shown here are possibly random and not representative !
22965/// let mut req = Target::default();
22966///
22967/// // You can configure optional parameters by calling the respective setters at will, and
22968/// // execute the final call using `doit()`.
22969/// // Values shown here are possibly random and not representative !
22970/// let result = hub.projects().locations_targets_create(req, "parent")
22971/// .validate_only(true)
22972/// .target_id("consetetur")
22973/// .request_id("sit")
22974/// .doit().await;
22975/// # }
22976/// ```
22977pub struct ProjectLocationTargetCreateCall<'a, C>
22978where
22979 C: 'a,
22980{
22981 hub: &'a CloudDeploy<C>,
22982 _request: Target,
22983 _parent: String,
22984 _validate_only: Option<bool>,
22985 _target_id: Option<String>,
22986 _request_id: Option<String>,
22987 _delegate: Option<&'a mut dyn common::Delegate>,
22988 _additional_params: HashMap<String, String>,
22989 _scopes: BTreeSet<String>,
22990}
22991
22992impl<'a, C> common::CallBuilder for ProjectLocationTargetCreateCall<'a, C> {}
22993
22994impl<'a, C> ProjectLocationTargetCreateCall<'a, C>
22995where
22996 C: common::Connector,
22997{
22998 /// Perform the operation you have build so far.
22999 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23000 use std::borrow::Cow;
23001 use std::io::{Read, Seek};
23002
23003 use common::{url::Params, ToParts};
23004 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23005
23006 let mut dd = common::DefaultDelegate;
23007 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23008 dlg.begin(common::MethodInfo {
23009 id: "clouddeploy.projects.locations.targets.create",
23010 http_method: hyper::Method::POST,
23011 });
23012
23013 for &field in ["alt", "parent", "validateOnly", "targetId", "requestId"].iter() {
23014 if self._additional_params.contains_key(field) {
23015 dlg.finished(false);
23016 return Err(common::Error::FieldClash(field));
23017 }
23018 }
23019
23020 let mut params = Params::with_capacity(7 + self._additional_params.len());
23021 params.push("parent", self._parent);
23022 if let Some(value) = self._validate_only.as_ref() {
23023 params.push("validateOnly", value.to_string());
23024 }
23025 if let Some(value) = self._target_id.as_ref() {
23026 params.push("targetId", value);
23027 }
23028 if let Some(value) = self._request_id.as_ref() {
23029 params.push("requestId", value);
23030 }
23031
23032 params.extend(self._additional_params.iter());
23033
23034 params.push("alt", "json");
23035 let mut url = self.hub._base_url.clone() + "v1/{+parent}/targets";
23036 if self._scopes.is_empty() {
23037 self._scopes
23038 .insert(Scope::CloudPlatform.as_ref().to_string());
23039 }
23040
23041 #[allow(clippy::single_element_loop)]
23042 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
23043 url = params.uri_replacement(url, param_name, find_this, true);
23044 }
23045 {
23046 let to_remove = ["parent"];
23047 params.remove_params(&to_remove);
23048 }
23049
23050 let url = params.parse_with_url(&url);
23051
23052 let mut json_mime_type = mime::APPLICATION_JSON;
23053 let mut request_value_reader = {
23054 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23055 common::remove_json_null_values(&mut value);
23056 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23057 serde_json::to_writer(&mut dst, &value).unwrap();
23058 dst
23059 };
23060 let request_size = request_value_reader
23061 .seek(std::io::SeekFrom::End(0))
23062 .unwrap();
23063 request_value_reader
23064 .seek(std::io::SeekFrom::Start(0))
23065 .unwrap();
23066
23067 loop {
23068 let token = match self
23069 .hub
23070 .auth
23071 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23072 .await
23073 {
23074 Ok(token) => token,
23075 Err(e) => match dlg.token(e) {
23076 Ok(token) => token,
23077 Err(e) => {
23078 dlg.finished(false);
23079 return Err(common::Error::MissingToken(e));
23080 }
23081 },
23082 };
23083 request_value_reader
23084 .seek(std::io::SeekFrom::Start(0))
23085 .unwrap();
23086 let mut req_result = {
23087 let client = &self.hub.client;
23088 dlg.pre_request();
23089 let mut req_builder = hyper::Request::builder()
23090 .method(hyper::Method::POST)
23091 .uri(url.as_str())
23092 .header(USER_AGENT, self.hub._user_agent.clone());
23093
23094 if let Some(token) = token.as_ref() {
23095 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23096 }
23097
23098 let request = req_builder
23099 .header(CONTENT_TYPE, json_mime_type.to_string())
23100 .header(CONTENT_LENGTH, request_size as u64)
23101 .body(common::to_body(
23102 request_value_reader.get_ref().clone().into(),
23103 ));
23104
23105 client.request(request.unwrap()).await
23106 };
23107
23108 match req_result {
23109 Err(err) => {
23110 if let common::Retry::After(d) = dlg.http_error(&err) {
23111 sleep(d).await;
23112 continue;
23113 }
23114 dlg.finished(false);
23115 return Err(common::Error::HttpError(err));
23116 }
23117 Ok(res) => {
23118 let (mut parts, body) = res.into_parts();
23119 let mut body = common::Body::new(body);
23120 if !parts.status.is_success() {
23121 let bytes = common::to_bytes(body).await.unwrap_or_default();
23122 let error = serde_json::from_str(&common::to_string(&bytes));
23123 let response = common::to_response(parts, bytes.into());
23124
23125 if let common::Retry::After(d) =
23126 dlg.http_failure(&response, error.as_ref().ok())
23127 {
23128 sleep(d).await;
23129 continue;
23130 }
23131
23132 dlg.finished(false);
23133
23134 return Err(match error {
23135 Ok(value) => common::Error::BadRequest(value),
23136 _ => common::Error::Failure(response),
23137 });
23138 }
23139 let response = {
23140 let bytes = common::to_bytes(body).await.unwrap_or_default();
23141 let encoded = common::to_string(&bytes);
23142 match serde_json::from_str(&encoded) {
23143 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23144 Err(error) => {
23145 dlg.response_json_decode_error(&encoded, &error);
23146 return Err(common::Error::JsonDecodeError(
23147 encoded.to_string(),
23148 error,
23149 ));
23150 }
23151 }
23152 };
23153
23154 dlg.finished(true);
23155 return Ok(response);
23156 }
23157 }
23158 }
23159 }
23160
23161 ///
23162 /// Sets the *request* property to the given value.
23163 ///
23164 /// Even though the property as already been set when instantiating this call,
23165 /// we provide this method for API completeness.
23166 pub fn request(mut self, new_value: Target) -> ProjectLocationTargetCreateCall<'a, C> {
23167 self._request = new_value;
23168 self
23169 }
23170 /// Required. The parent collection in which the `Target` must be created. The format is `projects/{project_id}/locations/{location_name}`.
23171 ///
23172 /// Sets the *parent* path property to the given value.
23173 ///
23174 /// Even though the property as already been set when instantiating this call,
23175 /// we provide this method for API completeness.
23176 pub fn parent(mut self, new_value: &str) -> ProjectLocationTargetCreateCall<'a, C> {
23177 self._parent = new_value.to_string();
23178 self
23179 }
23180 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
23181 ///
23182 /// Sets the *validate only* query property to the given value.
23183 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTargetCreateCall<'a, C> {
23184 self._validate_only = Some(new_value);
23185 self
23186 }
23187 /// Required. ID of the `Target`.
23188 ///
23189 /// Sets the *target id* query property to the given value.
23190 pub fn target_id(mut self, new_value: &str) -> ProjectLocationTargetCreateCall<'a, C> {
23191 self._target_id = Some(new_value.to_string());
23192 self
23193 }
23194 /// 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).
23195 ///
23196 /// Sets the *request id* query property to the given value.
23197 pub fn request_id(mut self, new_value: &str) -> ProjectLocationTargetCreateCall<'a, C> {
23198 self._request_id = Some(new_value.to_string());
23199 self
23200 }
23201 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23202 /// while executing the actual API request.
23203 ///
23204 /// ````text
23205 /// It should be used to handle progress information, and to implement a certain level of resilience.
23206 /// ````
23207 ///
23208 /// Sets the *delegate* property to the given value.
23209 pub fn delegate(
23210 mut self,
23211 new_value: &'a mut dyn common::Delegate,
23212 ) -> ProjectLocationTargetCreateCall<'a, C> {
23213 self._delegate = Some(new_value);
23214 self
23215 }
23216
23217 /// Set any additional parameter of the query string used in the request.
23218 /// It should be used to set parameters which are not yet available through their own
23219 /// setters.
23220 ///
23221 /// Please note that this method must not be used to set any of the known parameters
23222 /// which have their own setter method. If done anyway, the request will fail.
23223 ///
23224 /// # Additional Parameters
23225 ///
23226 /// * *$.xgafv* (query-string) - V1 error format.
23227 /// * *access_token* (query-string) - OAuth access token.
23228 /// * *alt* (query-string) - Data format for response.
23229 /// * *callback* (query-string) - JSONP
23230 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23231 /// * *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.
23232 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23233 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23234 /// * *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.
23235 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23236 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23237 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetCreateCall<'a, C>
23238 where
23239 T: AsRef<str>,
23240 {
23241 self._additional_params
23242 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23243 self
23244 }
23245
23246 /// Identifies the authorization scope for the method you are building.
23247 ///
23248 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23249 /// [`Scope::CloudPlatform`].
23250 ///
23251 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23252 /// tokens for more than one scope.
23253 ///
23254 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23255 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23256 /// sufficient, a read-write scope will do as well.
23257 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetCreateCall<'a, C>
23258 where
23259 St: AsRef<str>,
23260 {
23261 self._scopes.insert(String::from(scope.as_ref()));
23262 self
23263 }
23264 /// Identifies the authorization scope(s) for the method you are building.
23265 ///
23266 /// See [`Self::add_scope()`] for details.
23267 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetCreateCall<'a, C>
23268 where
23269 I: IntoIterator<Item = St>,
23270 St: AsRef<str>,
23271 {
23272 self._scopes
23273 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23274 self
23275 }
23276
23277 /// Removes all scopes, and no default scope will be used either.
23278 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23279 /// for details).
23280 pub fn clear_scopes(mut self) -> ProjectLocationTargetCreateCall<'a, C> {
23281 self._scopes.clear();
23282 self
23283 }
23284}
23285
23286/// Deletes a single Target.
23287///
23288/// A builder for the *locations.targets.delete* method supported by a *project* resource.
23289/// It is not used directly, but through a [`ProjectMethods`] instance.
23290///
23291/// # Example
23292///
23293/// Instantiate a resource method builder
23294///
23295/// ```test_harness,no_run
23296/// # extern crate hyper;
23297/// # extern crate hyper_rustls;
23298/// # extern crate google_clouddeploy1 as clouddeploy1;
23299/// # async fn dox() {
23300/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23301///
23302/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23303/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23304/// # .with_native_roots()
23305/// # .unwrap()
23306/// # .https_only()
23307/// # .enable_http2()
23308/// # .build();
23309///
23310/// # let executor = hyper_util::rt::TokioExecutor::new();
23311/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23312/// # secret,
23313/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23314/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23315/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23316/// # ),
23317/// # ).build().await.unwrap();
23318///
23319/// # let client = hyper_util::client::legacy::Client::builder(
23320/// # hyper_util::rt::TokioExecutor::new()
23321/// # )
23322/// # .build(
23323/// # hyper_rustls::HttpsConnectorBuilder::new()
23324/// # .with_native_roots()
23325/// # .unwrap()
23326/// # .https_or_http()
23327/// # .enable_http2()
23328/// # .build()
23329/// # );
23330/// # let mut hub = CloudDeploy::new(client, auth);
23331/// // You can configure optional parameters by calling the respective setters at will, and
23332/// // execute the final call using `doit()`.
23333/// // Values shown here are possibly random and not representative !
23334/// let result = hub.projects().locations_targets_delete("name")
23335/// .validate_only(false)
23336/// .request_id("dolores")
23337/// .etag("consetetur")
23338/// .allow_missing(true)
23339/// .doit().await;
23340/// # }
23341/// ```
23342pub struct ProjectLocationTargetDeleteCall<'a, C>
23343where
23344 C: 'a,
23345{
23346 hub: &'a CloudDeploy<C>,
23347 _name: String,
23348 _validate_only: Option<bool>,
23349 _request_id: Option<String>,
23350 _etag: Option<String>,
23351 _allow_missing: Option<bool>,
23352 _delegate: Option<&'a mut dyn common::Delegate>,
23353 _additional_params: HashMap<String, String>,
23354 _scopes: BTreeSet<String>,
23355}
23356
23357impl<'a, C> common::CallBuilder for ProjectLocationTargetDeleteCall<'a, C> {}
23358
23359impl<'a, C> ProjectLocationTargetDeleteCall<'a, C>
23360where
23361 C: common::Connector,
23362{
23363 /// Perform the operation you have build so far.
23364 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23365 use std::borrow::Cow;
23366 use std::io::{Read, Seek};
23367
23368 use common::{url::Params, ToParts};
23369 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23370
23371 let mut dd = common::DefaultDelegate;
23372 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23373 dlg.begin(common::MethodInfo {
23374 id: "clouddeploy.projects.locations.targets.delete",
23375 http_method: hyper::Method::DELETE,
23376 });
23377
23378 for &field in [
23379 "alt",
23380 "name",
23381 "validateOnly",
23382 "requestId",
23383 "etag",
23384 "allowMissing",
23385 ]
23386 .iter()
23387 {
23388 if self._additional_params.contains_key(field) {
23389 dlg.finished(false);
23390 return Err(common::Error::FieldClash(field));
23391 }
23392 }
23393
23394 let mut params = Params::with_capacity(7 + self._additional_params.len());
23395 params.push("name", self._name);
23396 if let Some(value) = self._validate_only.as_ref() {
23397 params.push("validateOnly", value.to_string());
23398 }
23399 if let Some(value) = self._request_id.as_ref() {
23400 params.push("requestId", value);
23401 }
23402 if let Some(value) = self._etag.as_ref() {
23403 params.push("etag", value);
23404 }
23405 if let Some(value) = self._allow_missing.as_ref() {
23406 params.push("allowMissing", value.to_string());
23407 }
23408
23409 params.extend(self._additional_params.iter());
23410
23411 params.push("alt", "json");
23412 let mut url = self.hub._base_url.clone() + "v1/{+name}";
23413 if self._scopes.is_empty() {
23414 self._scopes
23415 .insert(Scope::CloudPlatform.as_ref().to_string());
23416 }
23417
23418 #[allow(clippy::single_element_loop)]
23419 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23420 url = params.uri_replacement(url, param_name, find_this, true);
23421 }
23422 {
23423 let to_remove = ["name"];
23424 params.remove_params(&to_remove);
23425 }
23426
23427 let url = params.parse_with_url(&url);
23428
23429 loop {
23430 let token = match self
23431 .hub
23432 .auth
23433 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23434 .await
23435 {
23436 Ok(token) => token,
23437 Err(e) => match dlg.token(e) {
23438 Ok(token) => token,
23439 Err(e) => {
23440 dlg.finished(false);
23441 return Err(common::Error::MissingToken(e));
23442 }
23443 },
23444 };
23445 let mut req_result = {
23446 let client = &self.hub.client;
23447 dlg.pre_request();
23448 let mut req_builder = hyper::Request::builder()
23449 .method(hyper::Method::DELETE)
23450 .uri(url.as_str())
23451 .header(USER_AGENT, self.hub._user_agent.clone());
23452
23453 if let Some(token) = token.as_ref() {
23454 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23455 }
23456
23457 let request = req_builder
23458 .header(CONTENT_LENGTH, 0_u64)
23459 .body(common::to_body::<String>(None));
23460
23461 client.request(request.unwrap()).await
23462 };
23463
23464 match req_result {
23465 Err(err) => {
23466 if let common::Retry::After(d) = dlg.http_error(&err) {
23467 sleep(d).await;
23468 continue;
23469 }
23470 dlg.finished(false);
23471 return Err(common::Error::HttpError(err));
23472 }
23473 Ok(res) => {
23474 let (mut parts, body) = res.into_parts();
23475 let mut body = common::Body::new(body);
23476 if !parts.status.is_success() {
23477 let bytes = common::to_bytes(body).await.unwrap_or_default();
23478 let error = serde_json::from_str(&common::to_string(&bytes));
23479 let response = common::to_response(parts, bytes.into());
23480
23481 if let common::Retry::After(d) =
23482 dlg.http_failure(&response, error.as_ref().ok())
23483 {
23484 sleep(d).await;
23485 continue;
23486 }
23487
23488 dlg.finished(false);
23489
23490 return Err(match error {
23491 Ok(value) => common::Error::BadRequest(value),
23492 _ => common::Error::Failure(response),
23493 });
23494 }
23495 let response = {
23496 let bytes = common::to_bytes(body).await.unwrap_or_default();
23497 let encoded = common::to_string(&bytes);
23498 match serde_json::from_str(&encoded) {
23499 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23500 Err(error) => {
23501 dlg.response_json_decode_error(&encoded, &error);
23502 return Err(common::Error::JsonDecodeError(
23503 encoded.to_string(),
23504 error,
23505 ));
23506 }
23507 }
23508 };
23509
23510 dlg.finished(true);
23511 return Ok(response);
23512 }
23513 }
23514 }
23515 }
23516
23517 /// Required. The name of the `Target` to delete. The format is `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
23518 ///
23519 /// Sets the *name* path property to the given value.
23520 ///
23521 /// Even though the property as already been set when instantiating this call,
23522 /// we provide this method for API completeness.
23523 pub fn name(mut self, new_value: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
23524 self._name = new_value.to_string();
23525 self
23526 }
23527 /// Optional. If set, validate the request and preview the review, but do not actually post it.
23528 ///
23529 /// Sets the *validate only* query property to the given value.
23530 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTargetDeleteCall<'a, C> {
23531 self._validate_only = Some(new_value);
23532 self
23533 }
23534 /// 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).
23535 ///
23536 /// Sets the *request id* query property to the given value.
23537 pub fn request_id(mut self, new_value: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
23538 self._request_id = Some(new_value.to_string());
23539 self
23540 }
23541 /// 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.
23542 ///
23543 /// Sets the *etag* query property to the given value.
23544 pub fn etag(mut self, new_value: &str) -> ProjectLocationTargetDeleteCall<'a, C> {
23545 self._etag = Some(new_value.to_string());
23546 self
23547 }
23548 /// Optional. If set to true, then deleting an already deleted or non-existing `Target` will succeed.
23549 ///
23550 /// Sets the *allow missing* query property to the given value.
23551 pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationTargetDeleteCall<'a, C> {
23552 self._allow_missing = Some(new_value);
23553 self
23554 }
23555 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23556 /// while executing the actual API request.
23557 ///
23558 /// ````text
23559 /// It should be used to handle progress information, and to implement a certain level of resilience.
23560 /// ````
23561 ///
23562 /// Sets the *delegate* property to the given value.
23563 pub fn delegate(
23564 mut self,
23565 new_value: &'a mut dyn common::Delegate,
23566 ) -> ProjectLocationTargetDeleteCall<'a, C> {
23567 self._delegate = Some(new_value);
23568 self
23569 }
23570
23571 /// Set any additional parameter of the query string used in the request.
23572 /// It should be used to set parameters which are not yet available through their own
23573 /// setters.
23574 ///
23575 /// Please note that this method must not be used to set any of the known parameters
23576 /// which have their own setter method. If done anyway, the request will fail.
23577 ///
23578 /// # Additional Parameters
23579 ///
23580 /// * *$.xgafv* (query-string) - V1 error format.
23581 /// * *access_token* (query-string) - OAuth access token.
23582 /// * *alt* (query-string) - Data format for response.
23583 /// * *callback* (query-string) - JSONP
23584 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23585 /// * *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.
23586 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23587 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23588 /// * *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.
23589 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23590 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23591 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetDeleteCall<'a, C>
23592 where
23593 T: AsRef<str>,
23594 {
23595 self._additional_params
23596 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23597 self
23598 }
23599
23600 /// Identifies the authorization scope for the method you are building.
23601 ///
23602 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23603 /// [`Scope::CloudPlatform`].
23604 ///
23605 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23606 /// tokens for more than one scope.
23607 ///
23608 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23609 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23610 /// sufficient, a read-write scope will do as well.
23611 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetDeleteCall<'a, C>
23612 where
23613 St: AsRef<str>,
23614 {
23615 self._scopes.insert(String::from(scope.as_ref()));
23616 self
23617 }
23618 /// Identifies the authorization scope(s) for the method you are building.
23619 ///
23620 /// See [`Self::add_scope()`] for details.
23621 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetDeleteCall<'a, C>
23622 where
23623 I: IntoIterator<Item = St>,
23624 St: AsRef<str>,
23625 {
23626 self._scopes
23627 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23628 self
23629 }
23630
23631 /// Removes all scopes, and no default scope will be used either.
23632 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23633 /// for details).
23634 pub fn clear_scopes(mut self) -> ProjectLocationTargetDeleteCall<'a, C> {
23635 self._scopes.clear();
23636 self
23637 }
23638}
23639
23640/// Gets details of a single Target.
23641///
23642/// A builder for the *locations.targets.get* method supported by a *project* resource.
23643/// It is not used directly, but through a [`ProjectMethods`] instance.
23644///
23645/// # Example
23646///
23647/// Instantiate a resource method builder
23648///
23649/// ```test_harness,no_run
23650/// # extern crate hyper;
23651/// # extern crate hyper_rustls;
23652/// # extern crate google_clouddeploy1 as clouddeploy1;
23653/// # async fn dox() {
23654/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23655///
23656/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23657/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23658/// # .with_native_roots()
23659/// # .unwrap()
23660/// # .https_only()
23661/// # .enable_http2()
23662/// # .build();
23663///
23664/// # let executor = hyper_util::rt::TokioExecutor::new();
23665/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23666/// # secret,
23667/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23668/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23669/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23670/// # ),
23671/// # ).build().await.unwrap();
23672///
23673/// # let client = hyper_util::client::legacy::Client::builder(
23674/// # hyper_util::rt::TokioExecutor::new()
23675/// # )
23676/// # .build(
23677/// # hyper_rustls::HttpsConnectorBuilder::new()
23678/// # .with_native_roots()
23679/// # .unwrap()
23680/// # .https_or_http()
23681/// # .enable_http2()
23682/// # .build()
23683/// # );
23684/// # let mut hub = CloudDeploy::new(client, auth);
23685/// // You can configure optional parameters by calling the respective setters at will, and
23686/// // execute the final call using `doit()`.
23687/// // Values shown here are possibly random and not representative !
23688/// let result = hub.projects().locations_targets_get("name")
23689/// .doit().await;
23690/// # }
23691/// ```
23692pub struct ProjectLocationTargetGetCall<'a, C>
23693where
23694 C: 'a,
23695{
23696 hub: &'a CloudDeploy<C>,
23697 _name: String,
23698 _delegate: Option<&'a mut dyn common::Delegate>,
23699 _additional_params: HashMap<String, String>,
23700 _scopes: BTreeSet<String>,
23701}
23702
23703impl<'a, C> common::CallBuilder for ProjectLocationTargetGetCall<'a, C> {}
23704
23705impl<'a, C> ProjectLocationTargetGetCall<'a, C>
23706where
23707 C: common::Connector,
23708{
23709 /// Perform the operation you have build so far.
23710 pub async fn doit(mut self) -> common::Result<(common::Response, Target)> {
23711 use std::borrow::Cow;
23712 use std::io::{Read, Seek};
23713
23714 use common::{url::Params, ToParts};
23715 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23716
23717 let mut dd = common::DefaultDelegate;
23718 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23719 dlg.begin(common::MethodInfo {
23720 id: "clouddeploy.projects.locations.targets.get",
23721 http_method: hyper::Method::GET,
23722 });
23723
23724 for &field in ["alt", "name"].iter() {
23725 if self._additional_params.contains_key(field) {
23726 dlg.finished(false);
23727 return Err(common::Error::FieldClash(field));
23728 }
23729 }
23730
23731 let mut params = Params::with_capacity(3 + self._additional_params.len());
23732 params.push("name", self._name);
23733
23734 params.extend(self._additional_params.iter());
23735
23736 params.push("alt", "json");
23737 let mut url = self.hub._base_url.clone() + "v1/{+name}";
23738 if self._scopes.is_empty() {
23739 self._scopes
23740 .insert(Scope::CloudPlatform.as_ref().to_string());
23741 }
23742
23743 #[allow(clippy::single_element_loop)]
23744 for &(find_this, param_name) in [("{+name}", "name")].iter() {
23745 url = params.uri_replacement(url, param_name, find_this, true);
23746 }
23747 {
23748 let to_remove = ["name"];
23749 params.remove_params(&to_remove);
23750 }
23751
23752 let url = params.parse_with_url(&url);
23753
23754 loop {
23755 let token = match self
23756 .hub
23757 .auth
23758 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23759 .await
23760 {
23761 Ok(token) => token,
23762 Err(e) => match dlg.token(e) {
23763 Ok(token) => token,
23764 Err(e) => {
23765 dlg.finished(false);
23766 return Err(common::Error::MissingToken(e));
23767 }
23768 },
23769 };
23770 let mut req_result = {
23771 let client = &self.hub.client;
23772 dlg.pre_request();
23773 let mut req_builder = hyper::Request::builder()
23774 .method(hyper::Method::GET)
23775 .uri(url.as_str())
23776 .header(USER_AGENT, self.hub._user_agent.clone());
23777
23778 if let Some(token) = token.as_ref() {
23779 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23780 }
23781
23782 let request = req_builder
23783 .header(CONTENT_LENGTH, 0_u64)
23784 .body(common::to_body::<String>(None));
23785
23786 client.request(request.unwrap()).await
23787 };
23788
23789 match req_result {
23790 Err(err) => {
23791 if let common::Retry::After(d) = dlg.http_error(&err) {
23792 sleep(d).await;
23793 continue;
23794 }
23795 dlg.finished(false);
23796 return Err(common::Error::HttpError(err));
23797 }
23798 Ok(res) => {
23799 let (mut parts, body) = res.into_parts();
23800 let mut body = common::Body::new(body);
23801 if !parts.status.is_success() {
23802 let bytes = common::to_bytes(body).await.unwrap_or_default();
23803 let error = serde_json::from_str(&common::to_string(&bytes));
23804 let response = common::to_response(parts, bytes.into());
23805
23806 if let common::Retry::After(d) =
23807 dlg.http_failure(&response, error.as_ref().ok())
23808 {
23809 sleep(d).await;
23810 continue;
23811 }
23812
23813 dlg.finished(false);
23814
23815 return Err(match error {
23816 Ok(value) => common::Error::BadRequest(value),
23817 _ => common::Error::Failure(response),
23818 });
23819 }
23820 let response = {
23821 let bytes = common::to_bytes(body).await.unwrap_or_default();
23822 let encoded = common::to_string(&bytes);
23823 match serde_json::from_str(&encoded) {
23824 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23825 Err(error) => {
23826 dlg.response_json_decode_error(&encoded, &error);
23827 return Err(common::Error::JsonDecodeError(
23828 encoded.to_string(),
23829 error,
23830 ));
23831 }
23832 }
23833 };
23834
23835 dlg.finished(true);
23836 return Ok(response);
23837 }
23838 }
23839 }
23840 }
23841
23842 /// Required. Name of the `Target`. Format must be `projects/{project_id}/locations/{location_name}/targets/{target_name}`.
23843 ///
23844 /// Sets the *name* path property to the given value.
23845 ///
23846 /// Even though the property as already been set when instantiating this call,
23847 /// we provide this method for API completeness.
23848 pub fn name(mut self, new_value: &str) -> ProjectLocationTargetGetCall<'a, C> {
23849 self._name = new_value.to_string();
23850 self
23851 }
23852 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23853 /// while executing the actual API request.
23854 ///
23855 /// ````text
23856 /// It should be used to handle progress information, and to implement a certain level of resilience.
23857 /// ````
23858 ///
23859 /// Sets the *delegate* property to the given value.
23860 pub fn delegate(
23861 mut self,
23862 new_value: &'a mut dyn common::Delegate,
23863 ) -> ProjectLocationTargetGetCall<'a, C> {
23864 self._delegate = Some(new_value);
23865 self
23866 }
23867
23868 /// Set any additional parameter of the query string used in the request.
23869 /// It should be used to set parameters which are not yet available through their own
23870 /// setters.
23871 ///
23872 /// Please note that this method must not be used to set any of the known parameters
23873 /// which have their own setter method. If done anyway, the request will fail.
23874 ///
23875 /// # Additional Parameters
23876 ///
23877 /// * *$.xgafv* (query-string) - V1 error format.
23878 /// * *access_token* (query-string) - OAuth access token.
23879 /// * *alt* (query-string) - Data format for response.
23880 /// * *callback* (query-string) - JSONP
23881 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23882 /// * *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.
23883 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23884 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23885 /// * *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.
23886 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23887 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23888 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetGetCall<'a, C>
23889 where
23890 T: AsRef<str>,
23891 {
23892 self._additional_params
23893 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23894 self
23895 }
23896
23897 /// Identifies the authorization scope for the method you are building.
23898 ///
23899 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23900 /// [`Scope::CloudPlatform`].
23901 ///
23902 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23903 /// tokens for more than one scope.
23904 ///
23905 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23906 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23907 /// sufficient, a read-write scope will do as well.
23908 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetGetCall<'a, C>
23909 where
23910 St: AsRef<str>,
23911 {
23912 self._scopes.insert(String::from(scope.as_ref()));
23913 self
23914 }
23915 /// Identifies the authorization scope(s) for the method you are building.
23916 ///
23917 /// See [`Self::add_scope()`] for details.
23918 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetGetCall<'a, C>
23919 where
23920 I: IntoIterator<Item = St>,
23921 St: AsRef<str>,
23922 {
23923 self._scopes
23924 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23925 self
23926 }
23927
23928 /// Removes all scopes, and no default scope will be used either.
23929 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23930 /// for details).
23931 pub fn clear_scopes(mut self) -> ProjectLocationTargetGetCall<'a, C> {
23932 self._scopes.clear();
23933 self
23934 }
23935}
23936
23937/// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
23938///
23939/// A builder for the *locations.targets.getIamPolicy* method supported by a *project* resource.
23940/// It is not used directly, but through a [`ProjectMethods`] instance.
23941///
23942/// # Example
23943///
23944/// Instantiate a resource method builder
23945///
23946/// ```test_harness,no_run
23947/// # extern crate hyper;
23948/// # extern crate hyper_rustls;
23949/// # extern crate google_clouddeploy1 as clouddeploy1;
23950/// # async fn dox() {
23951/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23952///
23953/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23954/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23955/// # .with_native_roots()
23956/// # .unwrap()
23957/// # .https_only()
23958/// # .enable_http2()
23959/// # .build();
23960///
23961/// # let executor = hyper_util::rt::TokioExecutor::new();
23962/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23963/// # secret,
23964/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23965/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23966/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23967/// # ),
23968/// # ).build().await.unwrap();
23969///
23970/// # let client = hyper_util::client::legacy::Client::builder(
23971/// # hyper_util::rt::TokioExecutor::new()
23972/// # )
23973/// # .build(
23974/// # hyper_rustls::HttpsConnectorBuilder::new()
23975/// # .with_native_roots()
23976/// # .unwrap()
23977/// # .https_or_http()
23978/// # .enable_http2()
23979/// # .build()
23980/// # );
23981/// # let mut hub = CloudDeploy::new(client, auth);
23982/// // You can configure optional parameters by calling the respective setters at will, and
23983/// // execute the final call using `doit()`.
23984/// // Values shown here are possibly random and not representative !
23985/// let result = hub.projects().locations_targets_get_iam_policy("resource")
23986/// .options_requested_policy_version(-61)
23987/// .doit().await;
23988/// # }
23989/// ```
23990pub struct ProjectLocationTargetGetIamPolicyCall<'a, C>
23991where
23992 C: 'a,
23993{
23994 hub: &'a CloudDeploy<C>,
23995 _resource: String,
23996 _options_requested_policy_version: Option<i32>,
23997 _delegate: Option<&'a mut dyn common::Delegate>,
23998 _additional_params: HashMap<String, String>,
23999 _scopes: BTreeSet<String>,
24000}
24001
24002impl<'a, C> common::CallBuilder for ProjectLocationTargetGetIamPolicyCall<'a, C> {}
24003
24004impl<'a, C> ProjectLocationTargetGetIamPolicyCall<'a, C>
24005where
24006 C: common::Connector,
24007{
24008 /// Perform the operation you have build so far.
24009 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
24010 use std::borrow::Cow;
24011 use std::io::{Read, Seek};
24012
24013 use common::{url::Params, ToParts};
24014 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24015
24016 let mut dd = common::DefaultDelegate;
24017 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24018 dlg.begin(common::MethodInfo {
24019 id: "clouddeploy.projects.locations.targets.getIamPolicy",
24020 http_method: hyper::Method::GET,
24021 });
24022
24023 for &field in ["alt", "resource", "options.requestedPolicyVersion"].iter() {
24024 if self._additional_params.contains_key(field) {
24025 dlg.finished(false);
24026 return Err(common::Error::FieldClash(field));
24027 }
24028 }
24029
24030 let mut params = Params::with_capacity(4 + self._additional_params.len());
24031 params.push("resource", self._resource);
24032 if let Some(value) = self._options_requested_policy_version.as_ref() {
24033 params.push("options.requestedPolicyVersion", value.to_string());
24034 }
24035
24036 params.extend(self._additional_params.iter());
24037
24038 params.push("alt", "json");
24039 let mut url = self.hub._base_url.clone() + "v1/{+resource}:getIamPolicy";
24040 if self._scopes.is_empty() {
24041 self._scopes
24042 .insert(Scope::CloudPlatform.as_ref().to_string());
24043 }
24044
24045 #[allow(clippy::single_element_loop)]
24046 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
24047 url = params.uri_replacement(url, param_name, find_this, true);
24048 }
24049 {
24050 let to_remove = ["resource"];
24051 params.remove_params(&to_remove);
24052 }
24053
24054 let url = params.parse_with_url(&url);
24055
24056 loop {
24057 let token = match self
24058 .hub
24059 .auth
24060 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24061 .await
24062 {
24063 Ok(token) => token,
24064 Err(e) => match dlg.token(e) {
24065 Ok(token) => token,
24066 Err(e) => {
24067 dlg.finished(false);
24068 return Err(common::Error::MissingToken(e));
24069 }
24070 },
24071 };
24072 let mut req_result = {
24073 let client = &self.hub.client;
24074 dlg.pre_request();
24075 let mut req_builder = hyper::Request::builder()
24076 .method(hyper::Method::GET)
24077 .uri(url.as_str())
24078 .header(USER_AGENT, self.hub._user_agent.clone());
24079
24080 if let Some(token) = token.as_ref() {
24081 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24082 }
24083
24084 let request = req_builder
24085 .header(CONTENT_LENGTH, 0_u64)
24086 .body(common::to_body::<String>(None));
24087
24088 client.request(request.unwrap()).await
24089 };
24090
24091 match req_result {
24092 Err(err) => {
24093 if let common::Retry::After(d) = dlg.http_error(&err) {
24094 sleep(d).await;
24095 continue;
24096 }
24097 dlg.finished(false);
24098 return Err(common::Error::HttpError(err));
24099 }
24100 Ok(res) => {
24101 let (mut parts, body) = res.into_parts();
24102 let mut body = common::Body::new(body);
24103 if !parts.status.is_success() {
24104 let bytes = common::to_bytes(body).await.unwrap_or_default();
24105 let error = serde_json::from_str(&common::to_string(&bytes));
24106 let response = common::to_response(parts, bytes.into());
24107
24108 if let common::Retry::After(d) =
24109 dlg.http_failure(&response, error.as_ref().ok())
24110 {
24111 sleep(d).await;
24112 continue;
24113 }
24114
24115 dlg.finished(false);
24116
24117 return Err(match error {
24118 Ok(value) => common::Error::BadRequest(value),
24119 _ => common::Error::Failure(response),
24120 });
24121 }
24122 let response = {
24123 let bytes = common::to_bytes(body).await.unwrap_or_default();
24124 let encoded = common::to_string(&bytes);
24125 match serde_json::from_str(&encoded) {
24126 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24127 Err(error) => {
24128 dlg.response_json_decode_error(&encoded, &error);
24129 return Err(common::Error::JsonDecodeError(
24130 encoded.to_string(),
24131 error,
24132 ));
24133 }
24134 }
24135 };
24136
24137 dlg.finished(true);
24138 return Ok(response);
24139 }
24140 }
24141 }
24142 }
24143
24144 /// 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.
24145 ///
24146 /// Sets the *resource* path property to the given value.
24147 ///
24148 /// Even though the property as already been set when instantiating this call,
24149 /// we provide this method for API completeness.
24150 pub fn resource(mut self, new_value: &str) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
24151 self._resource = new_value.to_string();
24152 self
24153 }
24154 /// 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).
24155 ///
24156 /// Sets the *options.requested policy version* query property to the given value.
24157 pub fn options_requested_policy_version(
24158 mut self,
24159 new_value: i32,
24160 ) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
24161 self._options_requested_policy_version = Some(new_value);
24162 self
24163 }
24164 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24165 /// while executing the actual API request.
24166 ///
24167 /// ````text
24168 /// It should be used to handle progress information, and to implement a certain level of resilience.
24169 /// ````
24170 ///
24171 /// Sets the *delegate* property to the given value.
24172 pub fn delegate(
24173 mut self,
24174 new_value: &'a mut dyn common::Delegate,
24175 ) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
24176 self._delegate = Some(new_value);
24177 self
24178 }
24179
24180 /// Set any additional parameter of the query string used in the request.
24181 /// It should be used to set parameters which are not yet available through their own
24182 /// setters.
24183 ///
24184 /// Please note that this method must not be used to set any of the known parameters
24185 /// which have their own setter method. If done anyway, the request will fail.
24186 ///
24187 /// # Additional Parameters
24188 ///
24189 /// * *$.xgafv* (query-string) - V1 error format.
24190 /// * *access_token* (query-string) - OAuth access token.
24191 /// * *alt* (query-string) - Data format for response.
24192 /// * *callback* (query-string) - JSONP
24193 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24194 /// * *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.
24195 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24196 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24197 /// * *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.
24198 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24199 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24200 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetGetIamPolicyCall<'a, C>
24201 where
24202 T: AsRef<str>,
24203 {
24204 self._additional_params
24205 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24206 self
24207 }
24208
24209 /// Identifies the authorization scope for the method you are building.
24210 ///
24211 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24212 /// [`Scope::CloudPlatform`].
24213 ///
24214 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24215 /// tokens for more than one scope.
24216 ///
24217 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24218 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24219 /// sufficient, a read-write scope will do as well.
24220 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetGetIamPolicyCall<'a, C>
24221 where
24222 St: AsRef<str>,
24223 {
24224 self._scopes.insert(String::from(scope.as_ref()));
24225 self
24226 }
24227 /// Identifies the authorization scope(s) for the method you are building.
24228 ///
24229 /// See [`Self::add_scope()`] for details.
24230 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetGetIamPolicyCall<'a, C>
24231 where
24232 I: IntoIterator<Item = St>,
24233 St: AsRef<str>,
24234 {
24235 self._scopes
24236 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24237 self
24238 }
24239
24240 /// Removes all scopes, and no default scope will be used either.
24241 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24242 /// for details).
24243 pub fn clear_scopes(mut self) -> ProjectLocationTargetGetIamPolicyCall<'a, C> {
24244 self._scopes.clear();
24245 self
24246 }
24247}
24248
24249/// Lists Targets in a given project and location.
24250///
24251/// A builder for the *locations.targets.list* method supported by a *project* resource.
24252/// It is not used directly, but through a [`ProjectMethods`] instance.
24253///
24254/// # Example
24255///
24256/// Instantiate a resource method builder
24257///
24258/// ```test_harness,no_run
24259/// # extern crate hyper;
24260/// # extern crate hyper_rustls;
24261/// # extern crate google_clouddeploy1 as clouddeploy1;
24262/// # async fn dox() {
24263/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24264///
24265/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24266/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24267/// # .with_native_roots()
24268/// # .unwrap()
24269/// # .https_only()
24270/// # .enable_http2()
24271/// # .build();
24272///
24273/// # let executor = hyper_util::rt::TokioExecutor::new();
24274/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24275/// # secret,
24276/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24277/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24278/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24279/// # ),
24280/// # ).build().await.unwrap();
24281///
24282/// # let client = hyper_util::client::legacy::Client::builder(
24283/// # hyper_util::rt::TokioExecutor::new()
24284/// # )
24285/// # .build(
24286/// # hyper_rustls::HttpsConnectorBuilder::new()
24287/// # .with_native_roots()
24288/// # .unwrap()
24289/// # .https_or_http()
24290/// # .enable_http2()
24291/// # .build()
24292/// # );
24293/// # let mut hub = CloudDeploy::new(client, auth);
24294/// // You can configure optional parameters by calling the respective setters at will, and
24295/// // execute the final call using `doit()`.
24296/// // Values shown here are possibly random and not representative !
24297/// let result = hub.projects().locations_targets_list("parent")
24298/// .page_token("ipsum")
24299/// .page_size(-56)
24300/// .order_by("accusam")
24301/// .filter("gubergren")
24302/// .doit().await;
24303/// # }
24304/// ```
24305pub struct ProjectLocationTargetListCall<'a, C>
24306where
24307 C: 'a,
24308{
24309 hub: &'a CloudDeploy<C>,
24310 _parent: String,
24311 _page_token: Option<String>,
24312 _page_size: Option<i32>,
24313 _order_by: Option<String>,
24314 _filter: Option<String>,
24315 _delegate: Option<&'a mut dyn common::Delegate>,
24316 _additional_params: HashMap<String, String>,
24317 _scopes: BTreeSet<String>,
24318}
24319
24320impl<'a, C> common::CallBuilder for ProjectLocationTargetListCall<'a, C> {}
24321
24322impl<'a, C> ProjectLocationTargetListCall<'a, C>
24323where
24324 C: common::Connector,
24325{
24326 /// Perform the operation you have build so far.
24327 pub async fn doit(mut self) -> common::Result<(common::Response, ListTargetsResponse)> {
24328 use std::borrow::Cow;
24329 use std::io::{Read, Seek};
24330
24331 use common::{url::Params, ToParts};
24332 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24333
24334 let mut dd = common::DefaultDelegate;
24335 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24336 dlg.begin(common::MethodInfo {
24337 id: "clouddeploy.projects.locations.targets.list",
24338 http_method: hyper::Method::GET,
24339 });
24340
24341 for &field in [
24342 "alt",
24343 "parent",
24344 "pageToken",
24345 "pageSize",
24346 "orderBy",
24347 "filter",
24348 ]
24349 .iter()
24350 {
24351 if self._additional_params.contains_key(field) {
24352 dlg.finished(false);
24353 return Err(common::Error::FieldClash(field));
24354 }
24355 }
24356
24357 let mut params = Params::with_capacity(7 + self._additional_params.len());
24358 params.push("parent", self._parent);
24359 if let Some(value) = self._page_token.as_ref() {
24360 params.push("pageToken", value);
24361 }
24362 if let Some(value) = self._page_size.as_ref() {
24363 params.push("pageSize", value.to_string());
24364 }
24365 if let Some(value) = self._order_by.as_ref() {
24366 params.push("orderBy", value);
24367 }
24368 if let Some(value) = self._filter.as_ref() {
24369 params.push("filter", value);
24370 }
24371
24372 params.extend(self._additional_params.iter());
24373
24374 params.push("alt", "json");
24375 let mut url = self.hub._base_url.clone() + "v1/{+parent}/targets";
24376 if self._scopes.is_empty() {
24377 self._scopes
24378 .insert(Scope::CloudPlatform.as_ref().to_string());
24379 }
24380
24381 #[allow(clippy::single_element_loop)]
24382 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
24383 url = params.uri_replacement(url, param_name, find_this, true);
24384 }
24385 {
24386 let to_remove = ["parent"];
24387 params.remove_params(&to_remove);
24388 }
24389
24390 let url = params.parse_with_url(&url);
24391
24392 loop {
24393 let token = match self
24394 .hub
24395 .auth
24396 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24397 .await
24398 {
24399 Ok(token) => token,
24400 Err(e) => match dlg.token(e) {
24401 Ok(token) => token,
24402 Err(e) => {
24403 dlg.finished(false);
24404 return Err(common::Error::MissingToken(e));
24405 }
24406 },
24407 };
24408 let mut req_result = {
24409 let client = &self.hub.client;
24410 dlg.pre_request();
24411 let mut req_builder = hyper::Request::builder()
24412 .method(hyper::Method::GET)
24413 .uri(url.as_str())
24414 .header(USER_AGENT, self.hub._user_agent.clone());
24415
24416 if let Some(token) = token.as_ref() {
24417 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24418 }
24419
24420 let request = req_builder
24421 .header(CONTENT_LENGTH, 0_u64)
24422 .body(common::to_body::<String>(None));
24423
24424 client.request(request.unwrap()).await
24425 };
24426
24427 match req_result {
24428 Err(err) => {
24429 if let common::Retry::After(d) = dlg.http_error(&err) {
24430 sleep(d).await;
24431 continue;
24432 }
24433 dlg.finished(false);
24434 return Err(common::Error::HttpError(err));
24435 }
24436 Ok(res) => {
24437 let (mut parts, body) = res.into_parts();
24438 let mut body = common::Body::new(body);
24439 if !parts.status.is_success() {
24440 let bytes = common::to_bytes(body).await.unwrap_or_default();
24441 let error = serde_json::from_str(&common::to_string(&bytes));
24442 let response = common::to_response(parts, bytes.into());
24443
24444 if let common::Retry::After(d) =
24445 dlg.http_failure(&response, error.as_ref().ok())
24446 {
24447 sleep(d).await;
24448 continue;
24449 }
24450
24451 dlg.finished(false);
24452
24453 return Err(match error {
24454 Ok(value) => common::Error::BadRequest(value),
24455 _ => common::Error::Failure(response),
24456 });
24457 }
24458 let response = {
24459 let bytes = common::to_bytes(body).await.unwrap_or_default();
24460 let encoded = common::to_string(&bytes);
24461 match serde_json::from_str(&encoded) {
24462 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24463 Err(error) => {
24464 dlg.response_json_decode_error(&encoded, &error);
24465 return Err(common::Error::JsonDecodeError(
24466 encoded.to_string(),
24467 error,
24468 ));
24469 }
24470 }
24471 };
24472
24473 dlg.finished(true);
24474 return Ok(response);
24475 }
24476 }
24477 }
24478 }
24479
24480 /// Required. The parent, which owns this collection of targets. Format must be `projects/{project_id}/locations/{location_name}`.
24481 ///
24482 /// Sets the *parent* path property to the given value.
24483 ///
24484 /// Even though the property as already been set when instantiating this call,
24485 /// we provide this method for API completeness.
24486 pub fn parent(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
24487 self._parent = new_value.to_string();
24488 self
24489 }
24490 /// 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.
24491 ///
24492 /// Sets the *page token* query property to the given value.
24493 pub fn page_token(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
24494 self._page_token = Some(new_value.to_string());
24495 self
24496 }
24497 /// 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.
24498 ///
24499 /// Sets the *page size* query property to the given value.
24500 pub fn page_size(mut self, new_value: i32) -> ProjectLocationTargetListCall<'a, C> {
24501 self._page_size = Some(new_value);
24502 self
24503 }
24504 /// Optional. Field to sort by. See https://google.aip.dev/132#ordering for more details.
24505 ///
24506 /// Sets the *order by* query property to the given value.
24507 pub fn order_by(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
24508 self._order_by = Some(new_value.to_string());
24509 self
24510 }
24511 /// Optional. Filter targets to be returned. See https://google.aip.dev/160 for more details.
24512 ///
24513 /// Sets the *filter* query property to the given value.
24514 pub fn filter(mut self, new_value: &str) -> ProjectLocationTargetListCall<'a, C> {
24515 self._filter = Some(new_value.to_string());
24516 self
24517 }
24518 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24519 /// while executing the actual API request.
24520 ///
24521 /// ````text
24522 /// It should be used to handle progress information, and to implement a certain level of resilience.
24523 /// ````
24524 ///
24525 /// Sets the *delegate* property to the given value.
24526 pub fn delegate(
24527 mut self,
24528 new_value: &'a mut dyn common::Delegate,
24529 ) -> ProjectLocationTargetListCall<'a, C> {
24530 self._delegate = Some(new_value);
24531 self
24532 }
24533
24534 /// Set any additional parameter of the query string used in the request.
24535 /// It should be used to set parameters which are not yet available through their own
24536 /// setters.
24537 ///
24538 /// Please note that this method must not be used to set any of the known parameters
24539 /// which have their own setter method. If done anyway, the request will fail.
24540 ///
24541 /// # Additional Parameters
24542 ///
24543 /// * *$.xgafv* (query-string) - V1 error format.
24544 /// * *access_token* (query-string) - OAuth access token.
24545 /// * *alt* (query-string) - Data format for response.
24546 /// * *callback* (query-string) - JSONP
24547 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24548 /// * *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.
24549 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24550 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24551 /// * *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.
24552 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24553 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24554 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetListCall<'a, C>
24555 where
24556 T: AsRef<str>,
24557 {
24558 self._additional_params
24559 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24560 self
24561 }
24562
24563 /// Identifies the authorization scope for the method you are building.
24564 ///
24565 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24566 /// [`Scope::CloudPlatform`].
24567 ///
24568 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24569 /// tokens for more than one scope.
24570 ///
24571 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24572 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24573 /// sufficient, a read-write scope will do as well.
24574 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetListCall<'a, C>
24575 where
24576 St: AsRef<str>,
24577 {
24578 self._scopes.insert(String::from(scope.as_ref()));
24579 self
24580 }
24581 /// Identifies the authorization scope(s) for the method you are building.
24582 ///
24583 /// See [`Self::add_scope()`] for details.
24584 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetListCall<'a, C>
24585 where
24586 I: IntoIterator<Item = St>,
24587 St: AsRef<str>,
24588 {
24589 self._scopes
24590 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24591 self
24592 }
24593
24594 /// Removes all scopes, and no default scope will be used either.
24595 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24596 /// for details).
24597 pub fn clear_scopes(mut self) -> ProjectLocationTargetListCall<'a, C> {
24598 self._scopes.clear();
24599 self
24600 }
24601}
24602
24603/// Updates the parameters of a single Target.
24604///
24605/// A builder for the *locations.targets.patch* method supported by a *project* resource.
24606/// It is not used directly, but through a [`ProjectMethods`] instance.
24607///
24608/// # Example
24609///
24610/// Instantiate a resource method builder
24611///
24612/// ```test_harness,no_run
24613/// # extern crate hyper;
24614/// # extern crate hyper_rustls;
24615/// # extern crate google_clouddeploy1 as clouddeploy1;
24616/// use clouddeploy1::api::Target;
24617/// # async fn dox() {
24618/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24619///
24620/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24621/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24622/// # .with_native_roots()
24623/// # .unwrap()
24624/// # .https_only()
24625/// # .enable_http2()
24626/// # .build();
24627///
24628/// # let executor = hyper_util::rt::TokioExecutor::new();
24629/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24630/// # secret,
24631/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24632/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24633/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24634/// # ),
24635/// # ).build().await.unwrap();
24636///
24637/// # let client = hyper_util::client::legacy::Client::builder(
24638/// # hyper_util::rt::TokioExecutor::new()
24639/// # )
24640/// # .build(
24641/// # hyper_rustls::HttpsConnectorBuilder::new()
24642/// # .with_native_roots()
24643/// # .unwrap()
24644/// # .https_or_http()
24645/// # .enable_http2()
24646/// # .build()
24647/// # );
24648/// # let mut hub = CloudDeploy::new(client, auth);
24649/// // As the method needs a request, you would usually fill it with the desired information
24650/// // into the respective structure. Some of the parts shown here might not be applicable !
24651/// // Values shown here are possibly random and not representative !
24652/// let mut req = Target::default();
24653///
24654/// // You can configure optional parameters by calling the respective setters at will, and
24655/// // execute the final call using `doit()`.
24656/// // Values shown here are possibly random and not representative !
24657/// let result = hub.projects().locations_targets_patch(req, "name")
24658/// .validate_only(true)
24659/// .update_mask(FieldMask::new::<&str>(&[]))
24660/// .request_id("duo")
24661/// .allow_missing(true)
24662/// .doit().await;
24663/// # }
24664/// ```
24665pub struct ProjectLocationTargetPatchCall<'a, C>
24666where
24667 C: 'a,
24668{
24669 hub: &'a CloudDeploy<C>,
24670 _request: Target,
24671 _name: String,
24672 _validate_only: Option<bool>,
24673 _update_mask: Option<common::FieldMask>,
24674 _request_id: Option<String>,
24675 _allow_missing: Option<bool>,
24676 _delegate: Option<&'a mut dyn common::Delegate>,
24677 _additional_params: HashMap<String, String>,
24678 _scopes: BTreeSet<String>,
24679}
24680
24681impl<'a, C> common::CallBuilder for ProjectLocationTargetPatchCall<'a, C> {}
24682
24683impl<'a, C> ProjectLocationTargetPatchCall<'a, C>
24684where
24685 C: common::Connector,
24686{
24687 /// Perform the operation you have build so far.
24688 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24689 use std::borrow::Cow;
24690 use std::io::{Read, Seek};
24691
24692 use common::{url::Params, ToParts};
24693 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24694
24695 let mut dd = common::DefaultDelegate;
24696 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24697 dlg.begin(common::MethodInfo {
24698 id: "clouddeploy.projects.locations.targets.patch",
24699 http_method: hyper::Method::PATCH,
24700 });
24701
24702 for &field in [
24703 "alt",
24704 "name",
24705 "validateOnly",
24706 "updateMask",
24707 "requestId",
24708 "allowMissing",
24709 ]
24710 .iter()
24711 {
24712 if self._additional_params.contains_key(field) {
24713 dlg.finished(false);
24714 return Err(common::Error::FieldClash(field));
24715 }
24716 }
24717
24718 let mut params = Params::with_capacity(8 + self._additional_params.len());
24719 params.push("name", self._name);
24720 if let Some(value) = self._validate_only.as_ref() {
24721 params.push("validateOnly", value.to_string());
24722 }
24723 if let Some(value) = self._update_mask.as_ref() {
24724 params.push("updateMask", value.to_string());
24725 }
24726 if let Some(value) = self._request_id.as_ref() {
24727 params.push("requestId", value);
24728 }
24729 if let Some(value) = self._allow_missing.as_ref() {
24730 params.push("allowMissing", value.to_string());
24731 }
24732
24733 params.extend(self._additional_params.iter());
24734
24735 params.push("alt", "json");
24736 let mut url = self.hub._base_url.clone() + "v1/{+name}";
24737 if self._scopes.is_empty() {
24738 self._scopes
24739 .insert(Scope::CloudPlatform.as_ref().to_string());
24740 }
24741
24742 #[allow(clippy::single_element_loop)]
24743 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24744 url = params.uri_replacement(url, param_name, find_this, true);
24745 }
24746 {
24747 let to_remove = ["name"];
24748 params.remove_params(&to_remove);
24749 }
24750
24751 let url = params.parse_with_url(&url);
24752
24753 let mut json_mime_type = mime::APPLICATION_JSON;
24754 let mut request_value_reader = {
24755 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24756 common::remove_json_null_values(&mut value);
24757 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24758 serde_json::to_writer(&mut dst, &value).unwrap();
24759 dst
24760 };
24761 let request_size = request_value_reader
24762 .seek(std::io::SeekFrom::End(0))
24763 .unwrap();
24764 request_value_reader
24765 .seek(std::io::SeekFrom::Start(0))
24766 .unwrap();
24767
24768 loop {
24769 let token = match self
24770 .hub
24771 .auth
24772 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24773 .await
24774 {
24775 Ok(token) => token,
24776 Err(e) => match dlg.token(e) {
24777 Ok(token) => token,
24778 Err(e) => {
24779 dlg.finished(false);
24780 return Err(common::Error::MissingToken(e));
24781 }
24782 },
24783 };
24784 request_value_reader
24785 .seek(std::io::SeekFrom::Start(0))
24786 .unwrap();
24787 let mut req_result = {
24788 let client = &self.hub.client;
24789 dlg.pre_request();
24790 let mut req_builder = hyper::Request::builder()
24791 .method(hyper::Method::PATCH)
24792 .uri(url.as_str())
24793 .header(USER_AGENT, self.hub._user_agent.clone());
24794
24795 if let Some(token) = token.as_ref() {
24796 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24797 }
24798
24799 let request = req_builder
24800 .header(CONTENT_TYPE, json_mime_type.to_string())
24801 .header(CONTENT_LENGTH, request_size as u64)
24802 .body(common::to_body(
24803 request_value_reader.get_ref().clone().into(),
24804 ));
24805
24806 client.request(request.unwrap()).await
24807 };
24808
24809 match req_result {
24810 Err(err) => {
24811 if let common::Retry::After(d) = dlg.http_error(&err) {
24812 sleep(d).await;
24813 continue;
24814 }
24815 dlg.finished(false);
24816 return Err(common::Error::HttpError(err));
24817 }
24818 Ok(res) => {
24819 let (mut parts, body) = res.into_parts();
24820 let mut body = common::Body::new(body);
24821 if !parts.status.is_success() {
24822 let bytes = common::to_bytes(body).await.unwrap_or_default();
24823 let error = serde_json::from_str(&common::to_string(&bytes));
24824 let response = common::to_response(parts, bytes.into());
24825
24826 if let common::Retry::After(d) =
24827 dlg.http_failure(&response, error.as_ref().ok())
24828 {
24829 sleep(d).await;
24830 continue;
24831 }
24832
24833 dlg.finished(false);
24834
24835 return Err(match error {
24836 Ok(value) => common::Error::BadRequest(value),
24837 _ => common::Error::Failure(response),
24838 });
24839 }
24840 let response = {
24841 let bytes = common::to_bytes(body).await.unwrap_or_default();
24842 let encoded = common::to_string(&bytes);
24843 match serde_json::from_str(&encoded) {
24844 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24845 Err(error) => {
24846 dlg.response_json_decode_error(&encoded, &error);
24847 return Err(common::Error::JsonDecodeError(
24848 encoded.to_string(),
24849 error,
24850 ));
24851 }
24852 }
24853 };
24854
24855 dlg.finished(true);
24856 return Ok(response);
24857 }
24858 }
24859 }
24860 }
24861
24862 ///
24863 /// Sets the *request* property to the given value.
24864 ///
24865 /// Even though the property as already been set when instantiating this call,
24866 /// we provide this method for API completeness.
24867 pub fn request(mut self, new_value: Target) -> ProjectLocationTargetPatchCall<'a, C> {
24868 self._request = new_value;
24869 self
24870 }
24871 /// Identifier. 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])?`
24872 ///
24873 /// Sets the *name* path property to the given value.
24874 ///
24875 /// Even though the property as already been set when instantiating this call,
24876 /// we provide this method for API completeness.
24877 pub fn name(mut self, new_value: &str) -> ProjectLocationTargetPatchCall<'a, C> {
24878 self._name = new_value.to_string();
24879 self
24880 }
24881 /// Optional. If set to true, the request is validated and the user is provided with an expected result, but no actual change is made.
24882 ///
24883 /// Sets the *validate only* query property to the given value.
24884 pub fn validate_only(mut self, new_value: bool) -> ProjectLocationTargetPatchCall<'a, C> {
24885 self._validate_only = Some(new_value);
24886 self
24887 }
24888 /// Required. Field mask is used to specify the fields to be overwritten by the update in the `Target` resource. 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.
24889 ///
24890 /// Sets the *update mask* query property to the given value.
24891 pub fn update_mask(
24892 mut self,
24893 new_value: common::FieldMask,
24894 ) -> ProjectLocationTargetPatchCall<'a, C> {
24895 self._update_mask = Some(new_value);
24896 self
24897 }
24898 /// 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).
24899 ///
24900 /// Sets the *request id* query property to the given value.
24901 pub fn request_id(mut self, new_value: &str) -> ProjectLocationTargetPatchCall<'a, C> {
24902 self._request_id = Some(new_value.to_string());
24903 self
24904 }
24905 /// Optional. If set to true, updating a `Target` that does not exist will result in the creation of a new `Target`.
24906 ///
24907 /// Sets the *allow missing* query property to the given value.
24908 pub fn allow_missing(mut self, new_value: bool) -> ProjectLocationTargetPatchCall<'a, C> {
24909 self._allow_missing = Some(new_value);
24910 self
24911 }
24912 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24913 /// while executing the actual API request.
24914 ///
24915 /// ````text
24916 /// It should be used to handle progress information, and to implement a certain level of resilience.
24917 /// ````
24918 ///
24919 /// Sets the *delegate* property to the given value.
24920 pub fn delegate(
24921 mut self,
24922 new_value: &'a mut dyn common::Delegate,
24923 ) -> ProjectLocationTargetPatchCall<'a, C> {
24924 self._delegate = Some(new_value);
24925 self
24926 }
24927
24928 /// Set any additional parameter of the query string used in the request.
24929 /// It should be used to set parameters which are not yet available through their own
24930 /// setters.
24931 ///
24932 /// Please note that this method must not be used to set any of the known parameters
24933 /// which have their own setter method. If done anyway, the request will fail.
24934 ///
24935 /// # Additional Parameters
24936 ///
24937 /// * *$.xgafv* (query-string) - V1 error format.
24938 /// * *access_token* (query-string) - OAuth access token.
24939 /// * *alt* (query-string) - Data format for response.
24940 /// * *callback* (query-string) - JSONP
24941 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24942 /// * *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.
24943 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24944 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24945 /// * *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.
24946 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24947 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24948 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetPatchCall<'a, C>
24949 where
24950 T: AsRef<str>,
24951 {
24952 self._additional_params
24953 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24954 self
24955 }
24956
24957 /// Identifies the authorization scope for the method you are building.
24958 ///
24959 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24960 /// [`Scope::CloudPlatform`].
24961 ///
24962 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24963 /// tokens for more than one scope.
24964 ///
24965 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24966 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24967 /// sufficient, a read-write scope will do as well.
24968 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetPatchCall<'a, C>
24969 where
24970 St: AsRef<str>,
24971 {
24972 self._scopes.insert(String::from(scope.as_ref()));
24973 self
24974 }
24975 /// Identifies the authorization scope(s) for the method you are building.
24976 ///
24977 /// See [`Self::add_scope()`] for details.
24978 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetPatchCall<'a, C>
24979 where
24980 I: IntoIterator<Item = St>,
24981 St: AsRef<str>,
24982 {
24983 self._scopes
24984 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24985 self
24986 }
24987
24988 /// Removes all scopes, and no default scope will be used either.
24989 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24990 /// for details).
24991 pub fn clear_scopes(mut self) -> ProjectLocationTargetPatchCall<'a, C> {
24992 self._scopes.clear();
24993 self
24994 }
24995}
24996
24997/// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
24998///
24999/// A builder for the *locations.targets.setIamPolicy* method supported by a *project* resource.
25000/// It is not used directly, but through a [`ProjectMethods`] instance.
25001///
25002/// # Example
25003///
25004/// Instantiate a resource method builder
25005///
25006/// ```test_harness,no_run
25007/// # extern crate hyper;
25008/// # extern crate hyper_rustls;
25009/// # extern crate google_clouddeploy1 as clouddeploy1;
25010/// use clouddeploy1::api::SetIamPolicyRequest;
25011/// # async fn dox() {
25012/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25013///
25014/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25015/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25016/// # .with_native_roots()
25017/// # .unwrap()
25018/// # .https_only()
25019/// # .enable_http2()
25020/// # .build();
25021///
25022/// # let executor = hyper_util::rt::TokioExecutor::new();
25023/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25024/// # secret,
25025/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25026/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25027/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25028/// # ),
25029/// # ).build().await.unwrap();
25030///
25031/// # let client = hyper_util::client::legacy::Client::builder(
25032/// # hyper_util::rt::TokioExecutor::new()
25033/// # )
25034/// # .build(
25035/// # hyper_rustls::HttpsConnectorBuilder::new()
25036/// # .with_native_roots()
25037/// # .unwrap()
25038/// # .https_or_http()
25039/// # .enable_http2()
25040/// # .build()
25041/// # );
25042/// # let mut hub = CloudDeploy::new(client, auth);
25043/// // As the method needs a request, you would usually fill it with the desired information
25044/// // into the respective structure. Some of the parts shown here might not be applicable !
25045/// // Values shown here are possibly random and not representative !
25046/// let mut req = SetIamPolicyRequest::default();
25047///
25048/// // You can configure optional parameters by calling the respective setters at will, and
25049/// // execute the final call using `doit()`.
25050/// // Values shown here are possibly random and not representative !
25051/// let result = hub.projects().locations_targets_set_iam_policy(req, "resource")
25052/// .doit().await;
25053/// # }
25054/// ```
25055pub struct ProjectLocationTargetSetIamPolicyCall<'a, C>
25056where
25057 C: 'a,
25058{
25059 hub: &'a CloudDeploy<C>,
25060 _request: SetIamPolicyRequest,
25061 _resource: String,
25062 _delegate: Option<&'a mut dyn common::Delegate>,
25063 _additional_params: HashMap<String, String>,
25064 _scopes: BTreeSet<String>,
25065}
25066
25067impl<'a, C> common::CallBuilder for ProjectLocationTargetSetIamPolicyCall<'a, C> {}
25068
25069impl<'a, C> ProjectLocationTargetSetIamPolicyCall<'a, C>
25070where
25071 C: common::Connector,
25072{
25073 /// Perform the operation you have build so far.
25074 pub async fn doit(mut self) -> common::Result<(common::Response, Policy)> {
25075 use std::borrow::Cow;
25076 use std::io::{Read, Seek};
25077
25078 use common::{url::Params, ToParts};
25079 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25080
25081 let mut dd = common::DefaultDelegate;
25082 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25083 dlg.begin(common::MethodInfo {
25084 id: "clouddeploy.projects.locations.targets.setIamPolicy",
25085 http_method: hyper::Method::POST,
25086 });
25087
25088 for &field in ["alt", "resource"].iter() {
25089 if self._additional_params.contains_key(field) {
25090 dlg.finished(false);
25091 return Err(common::Error::FieldClash(field));
25092 }
25093 }
25094
25095 let mut params = Params::with_capacity(4 + self._additional_params.len());
25096 params.push("resource", self._resource);
25097
25098 params.extend(self._additional_params.iter());
25099
25100 params.push("alt", "json");
25101 let mut url = self.hub._base_url.clone() + "v1/{+resource}:setIamPolicy";
25102 if self._scopes.is_empty() {
25103 self._scopes
25104 .insert(Scope::CloudPlatform.as_ref().to_string());
25105 }
25106
25107 #[allow(clippy::single_element_loop)]
25108 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25109 url = params.uri_replacement(url, param_name, find_this, true);
25110 }
25111 {
25112 let to_remove = ["resource"];
25113 params.remove_params(&to_remove);
25114 }
25115
25116 let url = params.parse_with_url(&url);
25117
25118 let mut json_mime_type = mime::APPLICATION_JSON;
25119 let mut request_value_reader = {
25120 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25121 common::remove_json_null_values(&mut value);
25122 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25123 serde_json::to_writer(&mut dst, &value).unwrap();
25124 dst
25125 };
25126 let request_size = request_value_reader
25127 .seek(std::io::SeekFrom::End(0))
25128 .unwrap();
25129 request_value_reader
25130 .seek(std::io::SeekFrom::Start(0))
25131 .unwrap();
25132
25133 loop {
25134 let token = match self
25135 .hub
25136 .auth
25137 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25138 .await
25139 {
25140 Ok(token) => token,
25141 Err(e) => match dlg.token(e) {
25142 Ok(token) => token,
25143 Err(e) => {
25144 dlg.finished(false);
25145 return Err(common::Error::MissingToken(e));
25146 }
25147 },
25148 };
25149 request_value_reader
25150 .seek(std::io::SeekFrom::Start(0))
25151 .unwrap();
25152 let mut req_result = {
25153 let client = &self.hub.client;
25154 dlg.pre_request();
25155 let mut req_builder = hyper::Request::builder()
25156 .method(hyper::Method::POST)
25157 .uri(url.as_str())
25158 .header(USER_AGENT, self.hub._user_agent.clone());
25159
25160 if let Some(token) = token.as_ref() {
25161 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25162 }
25163
25164 let request = req_builder
25165 .header(CONTENT_TYPE, json_mime_type.to_string())
25166 .header(CONTENT_LENGTH, request_size as u64)
25167 .body(common::to_body(
25168 request_value_reader.get_ref().clone().into(),
25169 ));
25170
25171 client.request(request.unwrap()).await
25172 };
25173
25174 match req_result {
25175 Err(err) => {
25176 if let common::Retry::After(d) = dlg.http_error(&err) {
25177 sleep(d).await;
25178 continue;
25179 }
25180 dlg.finished(false);
25181 return Err(common::Error::HttpError(err));
25182 }
25183 Ok(res) => {
25184 let (mut parts, body) = res.into_parts();
25185 let mut body = common::Body::new(body);
25186 if !parts.status.is_success() {
25187 let bytes = common::to_bytes(body).await.unwrap_or_default();
25188 let error = serde_json::from_str(&common::to_string(&bytes));
25189 let response = common::to_response(parts, bytes.into());
25190
25191 if let common::Retry::After(d) =
25192 dlg.http_failure(&response, error.as_ref().ok())
25193 {
25194 sleep(d).await;
25195 continue;
25196 }
25197
25198 dlg.finished(false);
25199
25200 return Err(match error {
25201 Ok(value) => common::Error::BadRequest(value),
25202 _ => common::Error::Failure(response),
25203 });
25204 }
25205 let response = {
25206 let bytes = common::to_bytes(body).await.unwrap_or_default();
25207 let encoded = common::to_string(&bytes);
25208 match serde_json::from_str(&encoded) {
25209 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25210 Err(error) => {
25211 dlg.response_json_decode_error(&encoded, &error);
25212 return Err(common::Error::JsonDecodeError(
25213 encoded.to_string(),
25214 error,
25215 ));
25216 }
25217 }
25218 };
25219
25220 dlg.finished(true);
25221 return Ok(response);
25222 }
25223 }
25224 }
25225 }
25226
25227 ///
25228 /// Sets the *request* property to the given value.
25229 ///
25230 /// Even though the property as already been set when instantiating this call,
25231 /// we provide this method for API completeness.
25232 pub fn request(
25233 mut self,
25234 new_value: SetIamPolicyRequest,
25235 ) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
25236 self._request = new_value;
25237 self
25238 }
25239 /// 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.
25240 ///
25241 /// Sets the *resource* path property to the given value.
25242 ///
25243 /// Even though the property as already been set when instantiating this call,
25244 /// we provide this method for API completeness.
25245 pub fn resource(mut self, new_value: &str) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
25246 self._resource = new_value.to_string();
25247 self
25248 }
25249 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25250 /// while executing the actual API request.
25251 ///
25252 /// ````text
25253 /// It should be used to handle progress information, and to implement a certain level of resilience.
25254 /// ````
25255 ///
25256 /// Sets the *delegate* property to the given value.
25257 pub fn delegate(
25258 mut self,
25259 new_value: &'a mut dyn common::Delegate,
25260 ) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
25261 self._delegate = Some(new_value);
25262 self
25263 }
25264
25265 /// Set any additional parameter of the query string used in the request.
25266 /// It should be used to set parameters which are not yet available through their own
25267 /// setters.
25268 ///
25269 /// Please note that this method must not be used to set any of the known parameters
25270 /// which have their own setter method. If done anyway, the request will fail.
25271 ///
25272 /// # Additional Parameters
25273 ///
25274 /// * *$.xgafv* (query-string) - V1 error format.
25275 /// * *access_token* (query-string) - OAuth access token.
25276 /// * *alt* (query-string) - Data format for response.
25277 /// * *callback* (query-string) - JSONP
25278 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25279 /// * *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.
25280 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25281 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25282 /// * *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.
25283 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25284 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25285 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationTargetSetIamPolicyCall<'a, C>
25286 where
25287 T: AsRef<str>,
25288 {
25289 self._additional_params
25290 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25291 self
25292 }
25293
25294 /// Identifies the authorization scope for the method you are building.
25295 ///
25296 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25297 /// [`Scope::CloudPlatform`].
25298 ///
25299 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25300 /// tokens for more than one scope.
25301 ///
25302 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25303 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25304 /// sufficient, a read-write scope will do as well.
25305 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetSetIamPolicyCall<'a, C>
25306 where
25307 St: AsRef<str>,
25308 {
25309 self._scopes.insert(String::from(scope.as_ref()));
25310 self
25311 }
25312 /// Identifies the authorization scope(s) for the method you are building.
25313 ///
25314 /// See [`Self::add_scope()`] for details.
25315 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationTargetSetIamPolicyCall<'a, C>
25316 where
25317 I: IntoIterator<Item = St>,
25318 St: AsRef<str>,
25319 {
25320 self._scopes
25321 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25322 self
25323 }
25324
25325 /// Removes all scopes, and no default scope will be used either.
25326 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25327 /// for details).
25328 pub fn clear_scopes(mut self) -> ProjectLocationTargetSetIamPolicyCall<'a, C> {
25329 self._scopes.clear();
25330 self
25331 }
25332}
25333
25334/// 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.
25335///
25336/// A builder for the *locations.targets.testIamPermissions* method supported by a *project* resource.
25337/// It is not used directly, but through a [`ProjectMethods`] instance.
25338///
25339/// # Example
25340///
25341/// Instantiate a resource method builder
25342///
25343/// ```test_harness,no_run
25344/// # extern crate hyper;
25345/// # extern crate hyper_rustls;
25346/// # extern crate google_clouddeploy1 as clouddeploy1;
25347/// use clouddeploy1::api::TestIamPermissionsRequest;
25348/// # async fn dox() {
25349/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25350///
25351/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25352/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25353/// # .with_native_roots()
25354/// # .unwrap()
25355/// # .https_only()
25356/// # .enable_http2()
25357/// # .build();
25358///
25359/// # let executor = hyper_util::rt::TokioExecutor::new();
25360/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25361/// # secret,
25362/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25363/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25364/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25365/// # ),
25366/// # ).build().await.unwrap();
25367///
25368/// # let client = hyper_util::client::legacy::Client::builder(
25369/// # hyper_util::rt::TokioExecutor::new()
25370/// # )
25371/// # .build(
25372/// # hyper_rustls::HttpsConnectorBuilder::new()
25373/// # .with_native_roots()
25374/// # .unwrap()
25375/// # .https_or_http()
25376/// # .enable_http2()
25377/// # .build()
25378/// # );
25379/// # let mut hub = CloudDeploy::new(client, auth);
25380/// // As the method needs a request, you would usually fill it with the desired information
25381/// // into the respective structure. Some of the parts shown here might not be applicable !
25382/// // Values shown here are possibly random and not representative !
25383/// let mut req = TestIamPermissionsRequest::default();
25384///
25385/// // You can configure optional parameters by calling the respective setters at will, and
25386/// // execute the final call using `doit()`.
25387/// // Values shown here are possibly random and not representative !
25388/// let result = hub.projects().locations_targets_test_iam_permissions(req, "resource")
25389/// .doit().await;
25390/// # }
25391/// ```
25392pub struct ProjectLocationTargetTestIamPermissionCall<'a, C>
25393where
25394 C: 'a,
25395{
25396 hub: &'a CloudDeploy<C>,
25397 _request: TestIamPermissionsRequest,
25398 _resource: String,
25399 _delegate: Option<&'a mut dyn common::Delegate>,
25400 _additional_params: HashMap<String, String>,
25401 _scopes: BTreeSet<String>,
25402}
25403
25404impl<'a, C> common::CallBuilder for ProjectLocationTargetTestIamPermissionCall<'a, C> {}
25405
25406impl<'a, C> ProjectLocationTargetTestIamPermissionCall<'a, C>
25407where
25408 C: common::Connector,
25409{
25410 /// Perform the operation you have build so far.
25411 pub async fn doit(mut self) -> common::Result<(common::Response, TestIamPermissionsResponse)> {
25412 use std::borrow::Cow;
25413 use std::io::{Read, Seek};
25414
25415 use common::{url::Params, ToParts};
25416 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25417
25418 let mut dd = common::DefaultDelegate;
25419 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25420 dlg.begin(common::MethodInfo {
25421 id: "clouddeploy.projects.locations.targets.testIamPermissions",
25422 http_method: hyper::Method::POST,
25423 });
25424
25425 for &field in ["alt", "resource"].iter() {
25426 if self._additional_params.contains_key(field) {
25427 dlg.finished(false);
25428 return Err(common::Error::FieldClash(field));
25429 }
25430 }
25431
25432 let mut params = Params::with_capacity(4 + self._additional_params.len());
25433 params.push("resource", self._resource);
25434
25435 params.extend(self._additional_params.iter());
25436
25437 params.push("alt", "json");
25438 let mut url = self.hub._base_url.clone() + "v1/{+resource}:testIamPermissions";
25439 if self._scopes.is_empty() {
25440 self._scopes
25441 .insert(Scope::CloudPlatform.as_ref().to_string());
25442 }
25443
25444 #[allow(clippy::single_element_loop)]
25445 for &(find_this, param_name) in [("{+resource}", "resource")].iter() {
25446 url = params.uri_replacement(url, param_name, find_this, true);
25447 }
25448 {
25449 let to_remove = ["resource"];
25450 params.remove_params(&to_remove);
25451 }
25452
25453 let url = params.parse_with_url(&url);
25454
25455 let mut json_mime_type = mime::APPLICATION_JSON;
25456 let mut request_value_reader = {
25457 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25458 common::remove_json_null_values(&mut value);
25459 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25460 serde_json::to_writer(&mut dst, &value).unwrap();
25461 dst
25462 };
25463 let request_size = request_value_reader
25464 .seek(std::io::SeekFrom::End(0))
25465 .unwrap();
25466 request_value_reader
25467 .seek(std::io::SeekFrom::Start(0))
25468 .unwrap();
25469
25470 loop {
25471 let token = match self
25472 .hub
25473 .auth
25474 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25475 .await
25476 {
25477 Ok(token) => token,
25478 Err(e) => match dlg.token(e) {
25479 Ok(token) => token,
25480 Err(e) => {
25481 dlg.finished(false);
25482 return Err(common::Error::MissingToken(e));
25483 }
25484 },
25485 };
25486 request_value_reader
25487 .seek(std::io::SeekFrom::Start(0))
25488 .unwrap();
25489 let mut req_result = {
25490 let client = &self.hub.client;
25491 dlg.pre_request();
25492 let mut req_builder = hyper::Request::builder()
25493 .method(hyper::Method::POST)
25494 .uri(url.as_str())
25495 .header(USER_AGENT, self.hub._user_agent.clone());
25496
25497 if let Some(token) = token.as_ref() {
25498 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25499 }
25500
25501 let request = req_builder
25502 .header(CONTENT_TYPE, json_mime_type.to_string())
25503 .header(CONTENT_LENGTH, request_size as u64)
25504 .body(common::to_body(
25505 request_value_reader.get_ref().clone().into(),
25506 ));
25507
25508 client.request(request.unwrap()).await
25509 };
25510
25511 match req_result {
25512 Err(err) => {
25513 if let common::Retry::After(d) = dlg.http_error(&err) {
25514 sleep(d).await;
25515 continue;
25516 }
25517 dlg.finished(false);
25518 return Err(common::Error::HttpError(err));
25519 }
25520 Ok(res) => {
25521 let (mut parts, body) = res.into_parts();
25522 let mut body = common::Body::new(body);
25523 if !parts.status.is_success() {
25524 let bytes = common::to_bytes(body).await.unwrap_or_default();
25525 let error = serde_json::from_str(&common::to_string(&bytes));
25526 let response = common::to_response(parts, bytes.into());
25527
25528 if let common::Retry::After(d) =
25529 dlg.http_failure(&response, error.as_ref().ok())
25530 {
25531 sleep(d).await;
25532 continue;
25533 }
25534
25535 dlg.finished(false);
25536
25537 return Err(match error {
25538 Ok(value) => common::Error::BadRequest(value),
25539 _ => common::Error::Failure(response),
25540 });
25541 }
25542 let response = {
25543 let bytes = common::to_bytes(body).await.unwrap_or_default();
25544 let encoded = common::to_string(&bytes);
25545 match serde_json::from_str(&encoded) {
25546 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25547 Err(error) => {
25548 dlg.response_json_decode_error(&encoded, &error);
25549 return Err(common::Error::JsonDecodeError(
25550 encoded.to_string(),
25551 error,
25552 ));
25553 }
25554 }
25555 };
25556
25557 dlg.finished(true);
25558 return Ok(response);
25559 }
25560 }
25561 }
25562 }
25563
25564 ///
25565 /// Sets the *request* property to the given value.
25566 ///
25567 /// Even though the property as already been set when instantiating this call,
25568 /// we provide this method for API completeness.
25569 pub fn request(
25570 mut self,
25571 new_value: TestIamPermissionsRequest,
25572 ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
25573 self._request = new_value;
25574 self
25575 }
25576 /// 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.
25577 ///
25578 /// Sets the *resource* path property to the given value.
25579 ///
25580 /// Even though the property as already been set when instantiating this call,
25581 /// we provide this method for API completeness.
25582 pub fn resource(
25583 mut self,
25584 new_value: &str,
25585 ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
25586 self._resource = new_value.to_string();
25587 self
25588 }
25589 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25590 /// while executing the actual API request.
25591 ///
25592 /// ````text
25593 /// It should be used to handle progress information, and to implement a certain level of resilience.
25594 /// ````
25595 ///
25596 /// Sets the *delegate* property to the given value.
25597 pub fn delegate(
25598 mut self,
25599 new_value: &'a mut dyn common::Delegate,
25600 ) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
25601 self._delegate = Some(new_value);
25602 self
25603 }
25604
25605 /// Set any additional parameter of the query string used in the request.
25606 /// It should be used to set parameters which are not yet available through their own
25607 /// setters.
25608 ///
25609 /// Please note that this method must not be used to set any of the known parameters
25610 /// which have their own setter method. If done anyway, the request will fail.
25611 ///
25612 /// # Additional Parameters
25613 ///
25614 /// * *$.xgafv* (query-string) - V1 error format.
25615 /// * *access_token* (query-string) - OAuth access token.
25616 /// * *alt* (query-string) - Data format for response.
25617 /// * *callback* (query-string) - JSONP
25618 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25619 /// * *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.
25620 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25621 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25622 /// * *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.
25623 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25624 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25625 pub fn param<T>(
25626 mut self,
25627 name: T,
25628 value: T,
25629 ) -> ProjectLocationTargetTestIamPermissionCall<'a, C>
25630 where
25631 T: AsRef<str>,
25632 {
25633 self._additional_params
25634 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25635 self
25636 }
25637
25638 /// Identifies the authorization scope for the method you are building.
25639 ///
25640 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25641 /// [`Scope::CloudPlatform`].
25642 ///
25643 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25644 /// tokens for more than one scope.
25645 ///
25646 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25647 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25648 /// sufficient, a read-write scope will do as well.
25649 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationTargetTestIamPermissionCall<'a, C>
25650 where
25651 St: AsRef<str>,
25652 {
25653 self._scopes.insert(String::from(scope.as_ref()));
25654 self
25655 }
25656 /// Identifies the authorization scope(s) for the method you are building.
25657 ///
25658 /// See [`Self::add_scope()`] for details.
25659 pub fn add_scopes<I, St>(
25660 mut self,
25661 scopes: I,
25662 ) -> ProjectLocationTargetTestIamPermissionCall<'a, C>
25663 where
25664 I: IntoIterator<Item = St>,
25665 St: AsRef<str>,
25666 {
25667 self._scopes
25668 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25669 self
25670 }
25671
25672 /// Removes all scopes, and no default scope will be used either.
25673 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25674 /// for details).
25675 pub fn clear_scopes(mut self) -> ProjectLocationTargetTestIamPermissionCall<'a, C> {
25676 self._scopes.clear();
25677 self
25678 }
25679}
25680
25681/// Gets information about a location.
25682///
25683/// A builder for the *locations.get* method supported by a *project* resource.
25684/// It is not used directly, but through a [`ProjectMethods`] instance.
25685///
25686/// # Example
25687///
25688/// Instantiate a resource method builder
25689///
25690/// ```test_harness,no_run
25691/// # extern crate hyper;
25692/// # extern crate hyper_rustls;
25693/// # extern crate google_clouddeploy1 as clouddeploy1;
25694/// # async fn dox() {
25695/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25696///
25697/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25698/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25699/// # .with_native_roots()
25700/// # .unwrap()
25701/// # .https_only()
25702/// # .enable_http2()
25703/// # .build();
25704///
25705/// # let executor = hyper_util::rt::TokioExecutor::new();
25706/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25707/// # secret,
25708/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25709/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25710/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25711/// # ),
25712/// # ).build().await.unwrap();
25713///
25714/// # let client = hyper_util::client::legacy::Client::builder(
25715/// # hyper_util::rt::TokioExecutor::new()
25716/// # )
25717/// # .build(
25718/// # hyper_rustls::HttpsConnectorBuilder::new()
25719/// # .with_native_roots()
25720/// # .unwrap()
25721/// # .https_or_http()
25722/// # .enable_http2()
25723/// # .build()
25724/// # );
25725/// # let mut hub = CloudDeploy::new(client, auth);
25726/// // You can configure optional parameters by calling the respective setters at will, and
25727/// // execute the final call using `doit()`.
25728/// // Values shown here are possibly random and not representative !
25729/// let result = hub.projects().locations_get("name")
25730/// .doit().await;
25731/// # }
25732/// ```
25733pub struct ProjectLocationGetCall<'a, C>
25734where
25735 C: 'a,
25736{
25737 hub: &'a CloudDeploy<C>,
25738 _name: String,
25739 _delegate: Option<&'a mut dyn common::Delegate>,
25740 _additional_params: HashMap<String, String>,
25741 _scopes: BTreeSet<String>,
25742}
25743
25744impl<'a, C> common::CallBuilder for ProjectLocationGetCall<'a, C> {}
25745
25746impl<'a, C> ProjectLocationGetCall<'a, C>
25747where
25748 C: common::Connector,
25749{
25750 /// Perform the operation you have build so far.
25751 pub async fn doit(mut self) -> common::Result<(common::Response, Location)> {
25752 use std::borrow::Cow;
25753 use std::io::{Read, Seek};
25754
25755 use common::{url::Params, ToParts};
25756 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25757
25758 let mut dd = common::DefaultDelegate;
25759 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25760 dlg.begin(common::MethodInfo {
25761 id: "clouddeploy.projects.locations.get",
25762 http_method: hyper::Method::GET,
25763 });
25764
25765 for &field in ["alt", "name"].iter() {
25766 if self._additional_params.contains_key(field) {
25767 dlg.finished(false);
25768 return Err(common::Error::FieldClash(field));
25769 }
25770 }
25771
25772 let mut params = Params::with_capacity(3 + self._additional_params.len());
25773 params.push("name", self._name);
25774
25775 params.extend(self._additional_params.iter());
25776
25777 params.push("alt", "json");
25778 let mut url = self.hub._base_url.clone() + "v1/{+name}";
25779 if self._scopes.is_empty() {
25780 self._scopes
25781 .insert(Scope::CloudPlatform.as_ref().to_string());
25782 }
25783
25784 #[allow(clippy::single_element_loop)]
25785 for &(find_this, param_name) in [("{+name}", "name")].iter() {
25786 url = params.uri_replacement(url, param_name, find_this, true);
25787 }
25788 {
25789 let to_remove = ["name"];
25790 params.remove_params(&to_remove);
25791 }
25792
25793 let url = params.parse_with_url(&url);
25794
25795 loop {
25796 let token = match self
25797 .hub
25798 .auth
25799 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25800 .await
25801 {
25802 Ok(token) => token,
25803 Err(e) => match dlg.token(e) {
25804 Ok(token) => token,
25805 Err(e) => {
25806 dlg.finished(false);
25807 return Err(common::Error::MissingToken(e));
25808 }
25809 },
25810 };
25811 let mut req_result = {
25812 let client = &self.hub.client;
25813 dlg.pre_request();
25814 let mut req_builder = hyper::Request::builder()
25815 .method(hyper::Method::GET)
25816 .uri(url.as_str())
25817 .header(USER_AGENT, self.hub._user_agent.clone());
25818
25819 if let Some(token) = token.as_ref() {
25820 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25821 }
25822
25823 let request = req_builder
25824 .header(CONTENT_LENGTH, 0_u64)
25825 .body(common::to_body::<String>(None));
25826
25827 client.request(request.unwrap()).await
25828 };
25829
25830 match req_result {
25831 Err(err) => {
25832 if let common::Retry::After(d) = dlg.http_error(&err) {
25833 sleep(d).await;
25834 continue;
25835 }
25836 dlg.finished(false);
25837 return Err(common::Error::HttpError(err));
25838 }
25839 Ok(res) => {
25840 let (mut parts, body) = res.into_parts();
25841 let mut body = common::Body::new(body);
25842 if !parts.status.is_success() {
25843 let bytes = common::to_bytes(body).await.unwrap_or_default();
25844 let error = serde_json::from_str(&common::to_string(&bytes));
25845 let response = common::to_response(parts, bytes.into());
25846
25847 if let common::Retry::After(d) =
25848 dlg.http_failure(&response, error.as_ref().ok())
25849 {
25850 sleep(d).await;
25851 continue;
25852 }
25853
25854 dlg.finished(false);
25855
25856 return Err(match error {
25857 Ok(value) => common::Error::BadRequest(value),
25858 _ => common::Error::Failure(response),
25859 });
25860 }
25861 let response = {
25862 let bytes = common::to_bytes(body).await.unwrap_or_default();
25863 let encoded = common::to_string(&bytes);
25864 match serde_json::from_str(&encoded) {
25865 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25866 Err(error) => {
25867 dlg.response_json_decode_error(&encoded, &error);
25868 return Err(common::Error::JsonDecodeError(
25869 encoded.to_string(),
25870 error,
25871 ));
25872 }
25873 }
25874 };
25875
25876 dlg.finished(true);
25877 return Ok(response);
25878 }
25879 }
25880 }
25881 }
25882
25883 /// Resource name for the location.
25884 ///
25885 /// Sets the *name* path property to the given value.
25886 ///
25887 /// Even though the property as already been set when instantiating this call,
25888 /// we provide this method for API completeness.
25889 pub fn name(mut self, new_value: &str) -> ProjectLocationGetCall<'a, C> {
25890 self._name = new_value.to_string();
25891 self
25892 }
25893 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25894 /// while executing the actual API request.
25895 ///
25896 /// ````text
25897 /// It should be used to handle progress information, and to implement a certain level of resilience.
25898 /// ````
25899 ///
25900 /// Sets the *delegate* property to the given value.
25901 pub fn delegate(
25902 mut self,
25903 new_value: &'a mut dyn common::Delegate,
25904 ) -> ProjectLocationGetCall<'a, C> {
25905 self._delegate = Some(new_value);
25906 self
25907 }
25908
25909 /// Set any additional parameter of the query string used in the request.
25910 /// It should be used to set parameters which are not yet available through their own
25911 /// setters.
25912 ///
25913 /// Please note that this method must not be used to set any of the known parameters
25914 /// which have their own setter method. If done anyway, the request will fail.
25915 ///
25916 /// # Additional Parameters
25917 ///
25918 /// * *$.xgafv* (query-string) - V1 error format.
25919 /// * *access_token* (query-string) - OAuth access token.
25920 /// * *alt* (query-string) - Data format for response.
25921 /// * *callback* (query-string) - JSONP
25922 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25923 /// * *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.
25924 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25925 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25926 /// * *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.
25927 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25928 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25929 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetCall<'a, C>
25930 where
25931 T: AsRef<str>,
25932 {
25933 self._additional_params
25934 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25935 self
25936 }
25937
25938 /// Identifies the authorization scope for the method you are building.
25939 ///
25940 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25941 /// [`Scope::CloudPlatform`].
25942 ///
25943 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25944 /// tokens for more than one scope.
25945 ///
25946 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25947 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25948 /// sufficient, a read-write scope will do as well.
25949 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetCall<'a, C>
25950 where
25951 St: AsRef<str>,
25952 {
25953 self._scopes.insert(String::from(scope.as_ref()));
25954 self
25955 }
25956 /// Identifies the authorization scope(s) for the method you are building.
25957 ///
25958 /// See [`Self::add_scope()`] for details.
25959 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetCall<'a, C>
25960 where
25961 I: IntoIterator<Item = St>,
25962 St: AsRef<str>,
25963 {
25964 self._scopes
25965 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25966 self
25967 }
25968
25969 /// Removes all scopes, and no default scope will be used either.
25970 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25971 /// for details).
25972 pub fn clear_scopes(mut self) -> ProjectLocationGetCall<'a, C> {
25973 self._scopes.clear();
25974 self
25975 }
25976}
25977
25978/// Gets the configuration for a location.
25979///
25980/// A builder for the *locations.getConfig* method supported by a *project* resource.
25981/// It is not used directly, but through a [`ProjectMethods`] instance.
25982///
25983/// # Example
25984///
25985/// Instantiate a resource method builder
25986///
25987/// ```test_harness,no_run
25988/// # extern crate hyper;
25989/// # extern crate hyper_rustls;
25990/// # extern crate google_clouddeploy1 as clouddeploy1;
25991/// # async fn dox() {
25992/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25993///
25994/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25995/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25996/// # .with_native_roots()
25997/// # .unwrap()
25998/// # .https_only()
25999/// # .enable_http2()
26000/// # .build();
26001///
26002/// # let executor = hyper_util::rt::TokioExecutor::new();
26003/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26004/// # secret,
26005/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26006/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26007/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26008/// # ),
26009/// # ).build().await.unwrap();
26010///
26011/// # let client = hyper_util::client::legacy::Client::builder(
26012/// # hyper_util::rt::TokioExecutor::new()
26013/// # )
26014/// # .build(
26015/// # hyper_rustls::HttpsConnectorBuilder::new()
26016/// # .with_native_roots()
26017/// # .unwrap()
26018/// # .https_or_http()
26019/// # .enable_http2()
26020/// # .build()
26021/// # );
26022/// # let mut hub = CloudDeploy::new(client, auth);
26023/// // You can configure optional parameters by calling the respective setters at will, and
26024/// // execute the final call using `doit()`.
26025/// // Values shown here are possibly random and not representative !
26026/// let result = hub.projects().locations_get_config("name")
26027/// .doit().await;
26028/// # }
26029/// ```
26030pub struct ProjectLocationGetConfigCall<'a, C>
26031where
26032 C: 'a,
26033{
26034 hub: &'a CloudDeploy<C>,
26035 _name: String,
26036 _delegate: Option<&'a mut dyn common::Delegate>,
26037 _additional_params: HashMap<String, String>,
26038 _scopes: BTreeSet<String>,
26039}
26040
26041impl<'a, C> common::CallBuilder for ProjectLocationGetConfigCall<'a, C> {}
26042
26043impl<'a, C> ProjectLocationGetConfigCall<'a, C>
26044where
26045 C: common::Connector,
26046{
26047 /// Perform the operation you have build so far.
26048 pub async fn doit(mut self) -> common::Result<(common::Response, Config)> {
26049 use std::borrow::Cow;
26050 use std::io::{Read, Seek};
26051
26052 use common::{url::Params, ToParts};
26053 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26054
26055 let mut dd = common::DefaultDelegate;
26056 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26057 dlg.begin(common::MethodInfo {
26058 id: "clouddeploy.projects.locations.getConfig",
26059 http_method: hyper::Method::GET,
26060 });
26061
26062 for &field in ["alt", "name"].iter() {
26063 if self._additional_params.contains_key(field) {
26064 dlg.finished(false);
26065 return Err(common::Error::FieldClash(field));
26066 }
26067 }
26068
26069 let mut params = Params::with_capacity(3 + self._additional_params.len());
26070 params.push("name", self._name);
26071
26072 params.extend(self._additional_params.iter());
26073
26074 params.push("alt", "json");
26075 let mut url = self.hub._base_url.clone() + "v1/{+name}";
26076 if self._scopes.is_empty() {
26077 self._scopes
26078 .insert(Scope::CloudPlatform.as_ref().to_string());
26079 }
26080
26081 #[allow(clippy::single_element_loop)]
26082 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26083 url = params.uri_replacement(url, param_name, find_this, true);
26084 }
26085 {
26086 let to_remove = ["name"];
26087 params.remove_params(&to_remove);
26088 }
26089
26090 let url = params.parse_with_url(&url);
26091
26092 loop {
26093 let token = match self
26094 .hub
26095 .auth
26096 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26097 .await
26098 {
26099 Ok(token) => token,
26100 Err(e) => match dlg.token(e) {
26101 Ok(token) => token,
26102 Err(e) => {
26103 dlg.finished(false);
26104 return Err(common::Error::MissingToken(e));
26105 }
26106 },
26107 };
26108 let mut req_result = {
26109 let client = &self.hub.client;
26110 dlg.pre_request();
26111 let mut req_builder = hyper::Request::builder()
26112 .method(hyper::Method::GET)
26113 .uri(url.as_str())
26114 .header(USER_AGENT, self.hub._user_agent.clone());
26115
26116 if let Some(token) = token.as_ref() {
26117 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26118 }
26119
26120 let request = req_builder
26121 .header(CONTENT_LENGTH, 0_u64)
26122 .body(common::to_body::<String>(None));
26123
26124 client.request(request.unwrap()).await
26125 };
26126
26127 match req_result {
26128 Err(err) => {
26129 if let common::Retry::After(d) = dlg.http_error(&err) {
26130 sleep(d).await;
26131 continue;
26132 }
26133 dlg.finished(false);
26134 return Err(common::Error::HttpError(err));
26135 }
26136 Ok(res) => {
26137 let (mut parts, body) = res.into_parts();
26138 let mut body = common::Body::new(body);
26139 if !parts.status.is_success() {
26140 let bytes = common::to_bytes(body).await.unwrap_or_default();
26141 let error = serde_json::from_str(&common::to_string(&bytes));
26142 let response = common::to_response(parts, bytes.into());
26143
26144 if let common::Retry::After(d) =
26145 dlg.http_failure(&response, error.as_ref().ok())
26146 {
26147 sleep(d).await;
26148 continue;
26149 }
26150
26151 dlg.finished(false);
26152
26153 return Err(match error {
26154 Ok(value) => common::Error::BadRequest(value),
26155 _ => common::Error::Failure(response),
26156 });
26157 }
26158 let response = {
26159 let bytes = common::to_bytes(body).await.unwrap_or_default();
26160 let encoded = common::to_string(&bytes);
26161 match serde_json::from_str(&encoded) {
26162 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26163 Err(error) => {
26164 dlg.response_json_decode_error(&encoded, &error);
26165 return Err(common::Error::JsonDecodeError(
26166 encoded.to_string(),
26167 error,
26168 ));
26169 }
26170 }
26171 };
26172
26173 dlg.finished(true);
26174 return Ok(response);
26175 }
26176 }
26177 }
26178 }
26179
26180 /// Required. Name of requested configuration.
26181 ///
26182 /// Sets the *name* path property to the given value.
26183 ///
26184 /// Even though the property as already been set when instantiating this call,
26185 /// we provide this method for API completeness.
26186 pub fn name(mut self, new_value: &str) -> ProjectLocationGetConfigCall<'a, C> {
26187 self._name = new_value.to_string();
26188 self
26189 }
26190 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26191 /// while executing the actual API request.
26192 ///
26193 /// ````text
26194 /// It should be used to handle progress information, and to implement a certain level of resilience.
26195 /// ````
26196 ///
26197 /// Sets the *delegate* property to the given value.
26198 pub fn delegate(
26199 mut self,
26200 new_value: &'a mut dyn common::Delegate,
26201 ) -> ProjectLocationGetConfigCall<'a, C> {
26202 self._delegate = Some(new_value);
26203 self
26204 }
26205
26206 /// Set any additional parameter of the query string used in the request.
26207 /// It should be used to set parameters which are not yet available through their own
26208 /// setters.
26209 ///
26210 /// Please note that this method must not be used to set any of the known parameters
26211 /// which have their own setter method. If done anyway, the request will fail.
26212 ///
26213 /// # Additional Parameters
26214 ///
26215 /// * *$.xgafv* (query-string) - V1 error format.
26216 /// * *access_token* (query-string) - OAuth access token.
26217 /// * *alt* (query-string) - Data format for response.
26218 /// * *callback* (query-string) - JSONP
26219 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26220 /// * *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.
26221 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26222 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26223 /// * *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.
26224 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26225 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26226 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetConfigCall<'a, C>
26227 where
26228 T: AsRef<str>,
26229 {
26230 self._additional_params
26231 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26232 self
26233 }
26234
26235 /// Identifies the authorization scope for the method you are building.
26236 ///
26237 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26238 /// [`Scope::CloudPlatform`].
26239 ///
26240 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26241 /// tokens for more than one scope.
26242 ///
26243 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26244 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26245 /// sufficient, a read-write scope will do as well.
26246 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetConfigCall<'a, C>
26247 where
26248 St: AsRef<str>,
26249 {
26250 self._scopes.insert(String::from(scope.as_ref()));
26251 self
26252 }
26253 /// Identifies the authorization scope(s) for the method you are building.
26254 ///
26255 /// See [`Self::add_scope()`] for details.
26256 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetConfigCall<'a, C>
26257 where
26258 I: IntoIterator<Item = St>,
26259 St: AsRef<str>,
26260 {
26261 self._scopes
26262 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26263 self
26264 }
26265
26266 /// Removes all scopes, and no default scope will be used either.
26267 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26268 /// for details).
26269 pub fn clear_scopes(mut self) -> ProjectLocationGetConfigCall<'a, C> {
26270 self._scopes.clear();
26271 self
26272 }
26273}
26274
26275/// Lists information about the supported locations for this service.
26276///
26277/// A builder for the *locations.list* method supported by a *project* resource.
26278/// It is not used directly, but through a [`ProjectMethods`] instance.
26279///
26280/// # Example
26281///
26282/// Instantiate a resource method builder
26283///
26284/// ```test_harness,no_run
26285/// # extern crate hyper;
26286/// # extern crate hyper_rustls;
26287/// # extern crate google_clouddeploy1 as clouddeploy1;
26288/// # async fn dox() {
26289/// # use clouddeploy1::{CloudDeploy, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26290///
26291/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26292/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26293/// # .with_native_roots()
26294/// # .unwrap()
26295/// # .https_only()
26296/// # .enable_http2()
26297/// # .build();
26298///
26299/// # let executor = hyper_util::rt::TokioExecutor::new();
26300/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26301/// # secret,
26302/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26303/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26304/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26305/// # ),
26306/// # ).build().await.unwrap();
26307///
26308/// # let client = hyper_util::client::legacy::Client::builder(
26309/// # hyper_util::rt::TokioExecutor::new()
26310/// # )
26311/// # .build(
26312/// # hyper_rustls::HttpsConnectorBuilder::new()
26313/// # .with_native_roots()
26314/// # .unwrap()
26315/// # .https_or_http()
26316/// # .enable_http2()
26317/// # .build()
26318/// # );
26319/// # let mut hub = CloudDeploy::new(client, auth);
26320/// // You can configure optional parameters by calling the respective setters at will, and
26321/// // execute the final call using `doit()`.
26322/// // Values shown here are possibly random and not representative !
26323/// let result = hub.projects().locations_list("name")
26324/// .page_token("justo")
26325/// .page_size(-52)
26326/// .filter("no")
26327/// .add_extra_location_types("nonumy")
26328/// .doit().await;
26329/// # }
26330/// ```
26331pub struct ProjectLocationListCall<'a, C>
26332where
26333 C: 'a,
26334{
26335 hub: &'a CloudDeploy<C>,
26336 _name: String,
26337 _page_token: Option<String>,
26338 _page_size: Option<i32>,
26339 _filter: Option<String>,
26340 _extra_location_types: Vec<String>,
26341 _delegate: Option<&'a mut dyn common::Delegate>,
26342 _additional_params: HashMap<String, String>,
26343 _scopes: BTreeSet<String>,
26344}
26345
26346impl<'a, C> common::CallBuilder for ProjectLocationListCall<'a, C> {}
26347
26348impl<'a, C> ProjectLocationListCall<'a, C>
26349where
26350 C: common::Connector,
26351{
26352 /// Perform the operation you have build so far.
26353 pub async fn doit(mut self) -> common::Result<(common::Response, ListLocationsResponse)> {
26354 use std::borrow::Cow;
26355 use std::io::{Read, Seek};
26356
26357 use common::{url::Params, ToParts};
26358 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26359
26360 let mut dd = common::DefaultDelegate;
26361 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26362 dlg.begin(common::MethodInfo {
26363 id: "clouddeploy.projects.locations.list",
26364 http_method: hyper::Method::GET,
26365 });
26366
26367 for &field in [
26368 "alt",
26369 "name",
26370 "pageToken",
26371 "pageSize",
26372 "filter",
26373 "extraLocationTypes",
26374 ]
26375 .iter()
26376 {
26377 if self._additional_params.contains_key(field) {
26378 dlg.finished(false);
26379 return Err(common::Error::FieldClash(field));
26380 }
26381 }
26382
26383 let mut params = Params::with_capacity(7 + self._additional_params.len());
26384 params.push("name", self._name);
26385 if let Some(value) = self._page_token.as_ref() {
26386 params.push("pageToken", value);
26387 }
26388 if let Some(value) = self._page_size.as_ref() {
26389 params.push("pageSize", value.to_string());
26390 }
26391 if let Some(value) = self._filter.as_ref() {
26392 params.push("filter", value);
26393 }
26394 if !self._extra_location_types.is_empty() {
26395 for f in self._extra_location_types.iter() {
26396 params.push("extraLocationTypes", f);
26397 }
26398 }
26399
26400 params.extend(self._additional_params.iter());
26401
26402 params.push("alt", "json");
26403 let mut url = self.hub._base_url.clone() + "v1/{+name}/locations";
26404 if self._scopes.is_empty() {
26405 self._scopes
26406 .insert(Scope::CloudPlatform.as_ref().to_string());
26407 }
26408
26409 #[allow(clippy::single_element_loop)]
26410 for &(find_this, param_name) in [("{+name}", "name")].iter() {
26411 url = params.uri_replacement(url, param_name, find_this, true);
26412 }
26413 {
26414 let to_remove = ["name"];
26415 params.remove_params(&to_remove);
26416 }
26417
26418 let url = params.parse_with_url(&url);
26419
26420 loop {
26421 let token = match self
26422 .hub
26423 .auth
26424 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26425 .await
26426 {
26427 Ok(token) => token,
26428 Err(e) => match dlg.token(e) {
26429 Ok(token) => token,
26430 Err(e) => {
26431 dlg.finished(false);
26432 return Err(common::Error::MissingToken(e));
26433 }
26434 },
26435 };
26436 let mut req_result = {
26437 let client = &self.hub.client;
26438 dlg.pre_request();
26439 let mut req_builder = hyper::Request::builder()
26440 .method(hyper::Method::GET)
26441 .uri(url.as_str())
26442 .header(USER_AGENT, self.hub._user_agent.clone());
26443
26444 if let Some(token) = token.as_ref() {
26445 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26446 }
26447
26448 let request = req_builder
26449 .header(CONTENT_LENGTH, 0_u64)
26450 .body(common::to_body::<String>(None));
26451
26452 client.request(request.unwrap()).await
26453 };
26454
26455 match req_result {
26456 Err(err) => {
26457 if let common::Retry::After(d) = dlg.http_error(&err) {
26458 sleep(d).await;
26459 continue;
26460 }
26461 dlg.finished(false);
26462 return Err(common::Error::HttpError(err));
26463 }
26464 Ok(res) => {
26465 let (mut parts, body) = res.into_parts();
26466 let mut body = common::Body::new(body);
26467 if !parts.status.is_success() {
26468 let bytes = common::to_bytes(body).await.unwrap_or_default();
26469 let error = serde_json::from_str(&common::to_string(&bytes));
26470 let response = common::to_response(parts, bytes.into());
26471
26472 if let common::Retry::After(d) =
26473 dlg.http_failure(&response, error.as_ref().ok())
26474 {
26475 sleep(d).await;
26476 continue;
26477 }
26478
26479 dlg.finished(false);
26480
26481 return Err(match error {
26482 Ok(value) => common::Error::BadRequest(value),
26483 _ => common::Error::Failure(response),
26484 });
26485 }
26486 let response = {
26487 let bytes = common::to_bytes(body).await.unwrap_or_default();
26488 let encoded = common::to_string(&bytes);
26489 match serde_json::from_str(&encoded) {
26490 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26491 Err(error) => {
26492 dlg.response_json_decode_error(&encoded, &error);
26493 return Err(common::Error::JsonDecodeError(
26494 encoded.to_string(),
26495 error,
26496 ));
26497 }
26498 }
26499 };
26500
26501 dlg.finished(true);
26502 return Ok(response);
26503 }
26504 }
26505 }
26506 }
26507
26508 /// The resource that owns the locations collection, if applicable.
26509 ///
26510 /// Sets the *name* path property to the given value.
26511 ///
26512 /// Even though the property as already been set when instantiating this call,
26513 /// we provide this method for API completeness.
26514 pub fn name(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26515 self._name = new_value.to_string();
26516 self
26517 }
26518 /// A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
26519 ///
26520 /// Sets the *page token* query property to the given value.
26521 pub fn page_token(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26522 self._page_token = Some(new_value.to_string());
26523 self
26524 }
26525 /// The maximum number of results to return. If not set, the service selects a default.
26526 ///
26527 /// Sets the *page size* query property to the given value.
26528 pub fn page_size(mut self, new_value: i32) -> ProjectLocationListCall<'a, C> {
26529 self._page_size = Some(new_value);
26530 self
26531 }
26532 /// 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).
26533 ///
26534 /// Sets the *filter* query property to the given value.
26535 pub fn filter(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26536 self._filter = Some(new_value.to_string());
26537 self
26538 }
26539 /// Optional. Do not use this field. It is unsupported and is ignored unless explicitly documented otherwise. This is primarily for internal usage.
26540 ///
26541 /// Append the given value to the *extra location types* query property.
26542 /// Each appended value will retain its original ordering and be '/'-separated in the URL's parameters.
26543 pub fn add_extra_location_types(mut self, new_value: &str) -> ProjectLocationListCall<'a, C> {
26544 self._extra_location_types.push(new_value.to_string());
26545 self
26546 }
26547 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26548 /// while executing the actual API request.
26549 ///
26550 /// ````text
26551 /// It should be used to handle progress information, and to implement a certain level of resilience.
26552 /// ````
26553 ///
26554 /// Sets the *delegate* property to the given value.
26555 pub fn delegate(
26556 mut self,
26557 new_value: &'a mut dyn common::Delegate,
26558 ) -> ProjectLocationListCall<'a, C> {
26559 self._delegate = Some(new_value);
26560 self
26561 }
26562
26563 /// Set any additional parameter of the query string used in the request.
26564 /// It should be used to set parameters which are not yet available through their own
26565 /// setters.
26566 ///
26567 /// Please note that this method must not be used to set any of the known parameters
26568 /// which have their own setter method. If done anyway, the request will fail.
26569 ///
26570 /// # Additional Parameters
26571 ///
26572 /// * *$.xgafv* (query-string) - V1 error format.
26573 /// * *access_token* (query-string) - OAuth access token.
26574 /// * *alt* (query-string) - Data format for response.
26575 /// * *callback* (query-string) - JSONP
26576 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26577 /// * *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.
26578 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26579 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26580 /// * *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.
26581 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26582 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26583 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationListCall<'a, C>
26584 where
26585 T: AsRef<str>,
26586 {
26587 self._additional_params
26588 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26589 self
26590 }
26591
26592 /// Identifies the authorization scope for the method you are building.
26593 ///
26594 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26595 /// [`Scope::CloudPlatform`].
26596 ///
26597 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26598 /// tokens for more than one scope.
26599 ///
26600 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26601 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26602 /// sufficient, a read-write scope will do as well.
26603 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationListCall<'a, C>
26604 where
26605 St: AsRef<str>,
26606 {
26607 self._scopes.insert(String::from(scope.as_ref()));
26608 self
26609 }
26610 /// Identifies the authorization scope(s) for the method you are building.
26611 ///
26612 /// See [`Self::add_scope()`] for details.
26613 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationListCall<'a, C>
26614 where
26615 I: IntoIterator<Item = St>,
26616 St: AsRef<str>,
26617 {
26618 self._scopes
26619 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26620 self
26621 }
26622
26623 /// Removes all scopes, and no default scope will be used either.
26624 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26625 /// for details).
26626 pub fn clear_scopes(mut self) -> ProjectLocationListCall<'a, C> {
26627 self._scopes.clear();
26628 self
26629 }
26630}