google_composer1/
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 CloudComposer 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_composer1 as composer1;
49/// use composer1::api::Environment;
50/// use composer1::{Result, Error};
51/// # async fn dox() {
52/// use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
53///
54/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
55/// // `client_secret`, among other things.
56/// let secret: yup_oauth2::ApplicationSecret = Default::default();
57/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
58/// // unless you replace  `None` with the desired Flow.
59/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
60/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
61/// // retrieve them from storage.
62/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
63///     secret,
64///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
65/// ).build().await.unwrap();
66///
67/// let client = hyper_util::client::legacy::Client::builder(
68///     hyper_util::rt::TokioExecutor::new()
69/// )
70/// .build(
71///     hyper_rustls::HttpsConnectorBuilder::new()
72///         .with_native_roots()
73///         .unwrap()
74///         .https_or_http()
75///         .enable_http1()
76///         .build()
77/// );
78/// let mut hub = CloudComposer::new(client, auth);
79/// // As the method needs a request, you would usually fill it with the desired information
80/// // into the respective structure. Some of the parts shown here might not be applicable !
81/// // Values shown here are possibly random and not representative !
82/// let mut req = Environment::default();
83///
84/// // You can configure optional parameters by calling the respective setters at will, and
85/// // execute the final call using `doit()`.
86/// // Values shown here are possibly random and not representative !
87/// let result = hub.projects().locations_environments_patch(req, "name")
88///              .update_mask(FieldMask::new::<&str>(&[]))
89///              .doit().await;
90///
91/// match result {
92///     Err(e) => match e {
93///         // The Error enum provides details about what exactly happened.
94///         // You can also just use its `Debug`, `Display` or `Error` traits
95///          Error::HttpError(_)
96///         |Error::Io(_)
97///         |Error::MissingAPIKey
98///         |Error::MissingToken(_)
99///         |Error::Cancelled
100///         |Error::UploadSizeLimitExceeded(_, _)
101///         |Error::Failure(_)
102///         |Error::BadRequest(_)
103///         |Error::FieldClash(_)
104///         |Error::JsonDecodeError(_, _) => println!("{}", e),
105///     },
106///     Ok(res) => println!("Success: {:?}", res),
107/// }
108/// # }
109/// ```
110#[derive(Clone)]
111pub struct CloudComposer<C> {
112    pub client: common::Client<C>,
113    pub auth: Box<dyn common::GetToken>,
114    _user_agent: String,
115    _base_url: String,
116    _root_url: String,
117}
118
119impl<C> common::Hub for CloudComposer<C> {}
120
121impl<'a, C> CloudComposer<C> {
122    pub fn new<A: 'static + common::GetToken>(
123        client: common::Client<C>,
124        auth: A,
125    ) -> CloudComposer<C> {
126        CloudComposer {
127            client,
128            auth: Box::new(auth),
129            _user_agent: "google-api-rust-client/6.0.0".to_string(),
130            _base_url: "https://composer.googleapis.com/".to_string(),
131            _root_url: "https://composer.googleapis.com/".to_string(),
132        }
133    }
134
135    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
136        ProjectMethods { hub: self }
137    }
138
139    /// Set the user-agent header field to use in all requests to the server.
140    /// It defaults to `google-api-rust-client/6.0.0`.
141    ///
142    /// Returns the previously set user-agent.
143    pub fn user_agent(&mut self, agent_name: String) -> String {
144        std::mem::replace(&mut self._user_agent, agent_name)
145    }
146
147    /// Set the base url to use in all requests to the server.
148    /// It defaults to `https://composer.googleapis.com/`.
149    ///
150    /// Returns the previously set base url.
151    pub fn base_url(&mut self, new_base_url: String) -> String {
152        std::mem::replace(&mut self._base_url, new_base_url)
153    }
154
155    /// Set the root url to use in all requests to the server.
156    /// It defaults to `https://composer.googleapis.com/`.
157    ///
158    /// Returns the previously set root url.
159    pub fn root_url(&mut self, new_root_url: String) -> String {
160        std::mem::replace(&mut self._root_url, new_root_url)
161    }
162}
163
164// ############
165// SCHEMAS ###
166// ##########
167/// The policy for airflow metadata database retention.
168///
169/// This type is not used in any activity, and only used as *part* of another schema.
170///
171#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
172#[serde_with::serde_as]
173#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
174pub struct AirflowMetadataRetentionPolicyConfig {
175    /// Optional. How many days data should be retained for.
176    #[serde(rename = "retentionDays")]
177    pub retention_days: Option<i32>,
178    /// Optional. Retention can be either enabled or disabled.
179    #[serde(rename = "retentionMode")]
180    pub retention_mode: Option<String>,
181}
182
183impl common::Part for AirflowMetadataRetentionPolicyConfig {}
184
185/// Allowed IP range with user-provided description.
186///
187/// This type is not used in any activity, and only used as *part* of another schema.
188///
189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
190#[serde_with::serde_as]
191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
192pub struct AllowedIpRange {
193    /// Optional. User-provided description. It must contain at most 300 characters.
194    pub description: Option<String>,
195    /// IP address or range, defined using CIDR notation, of requests that this rule applies to. Examples: `192.168.1.1` or `192.168.0.0/16` or `2001:db8::/32` or `2001:0db8:0000:0042:0000:8a2e:0370:7334`. IP range prefixes should be properly truncated. For example, `1.2.3.4/24` should be truncated to `1.2.3.0/24`. Similarly, for IPv6, `2001:db8::1/32` should be truncated to `2001:db8::/32`.
196    pub value: Option<String>,
197}
198
199impl common::Part for AllowedIpRange {}
200
201/// Request to check whether image upgrade will succeed.
202///
203/// # Activities
204///
205/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
206/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
207///
208/// * [locations environments check upgrade projects](ProjectLocationEnvironmentCheckUpgradeCall) (request)
209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
210#[serde_with::serde_as]
211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
212pub struct CheckUpgradeRequest {
213    /// Optional. The version of the software running in the environment. This encapsulates both the version of Cloud Composer functionality and the version of Apache Airflow. It must match the regular expression `composer-([0-9]+(\.[0-9]+\.[0-9]+(-preview\.[0-9]+)?)?|latest)-airflow-([0-9]+(\.[0-9]+(\.[0-9]+)?)?)`. When used as input, the server also checks if the provided version is supported and denies the request for an unsupported version. The Cloud Composer portion of the image version is a full [semantic version](https://semver.org), or an alias in the form of major version number or `latest`. When an alias is provided, the server replaces it with the current Cloud Composer version that satisfies the alias. The Apache Airflow portion of the image version is a full semantic version that points to one of the supported Apache Airflow versions, or an alias in the form of only major or major.minor versions specified. When an alias is provided, the server replaces it with the latest Apache Airflow version that satisfies the alias and is supported in the given Cloud Composer version. In all cases, the resolved image version is stored in the same field. See also [version list](https://cloud.google.com/composer/docs/concepts/versioning/composer-versions) and [versioning overview](https://cloud.google.com/composer/docs/concepts/versioning/composer-versioning-overview).
214    #[serde(rename = "imageVersion")]
215    pub image_version: Option<String>,
216}
217
218impl common::RequestValue for CheckUpgradeRequest {}
219
220/// CIDR block with an optional name.
221///
222/// This type is not used in any activity, and only used as *part* of another schema.
223///
224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
225#[serde_with::serde_as]
226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
227pub struct CidrBlock {
228    /// CIDR block that must be specified in CIDR notation.
229    #[serde(rename = "cidrBlock")]
230    pub cidr_block: Option<String>,
231    /// User-defined name that identifies the CIDR block.
232    #[serde(rename = "displayName")]
233    pub display_name: Option<String>,
234}
235
236impl common::Part for CidrBlock {}
237
238/// Configuration for Cloud Data Lineage integration.
239///
240/// This type is not used in any activity, and only used as *part* of another schema.
241///
242#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
243#[serde_with::serde_as]
244#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
245pub struct CloudDataLineageIntegration {
246    /// Optional. Whether or not Cloud Data Lineage integration is enabled.
247    pub enabled: Option<bool>,
248}
249
250impl common::Part for CloudDataLineageIntegration {}
251
252/// Information about a single workload.
253///
254/// This type is not used in any activity, and only used as *part* of another schema.
255///
256#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
257#[serde_with::serde_as]
258#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
259pub struct ComposerWorkload {
260    /// Name of a workload.
261    pub name: Option<String>,
262    /// Output only. Status of a workload.
263    pub status: Option<ComposerWorkloadStatus>,
264    /// Type of a workload.
265    #[serde(rename = "type")]
266    pub type_: Option<String>,
267}
268
269impl common::Part for ComposerWorkload {}
270
271/// Workload status.
272///
273/// This type is not used in any activity, and only used as *part* of another schema.
274///
275#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
276#[serde_with::serde_as]
277#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
278pub struct ComposerWorkloadStatus {
279    /// Output only. Detailed message of the status.
280    #[serde(rename = "detailedStatusMessage")]
281    pub detailed_status_message: Option<String>,
282    /// Output only. Workload state.
283    pub state: Option<String>,
284    /// Output only. Text to provide more descriptive status.
285    #[serde(rename = "statusMessage")]
286    pub status_message: Option<String>,
287}
288
289impl common::Part for ComposerWorkloadStatus {}
290
291/// Configuration for resources used by Airflow DAG processors. This field is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
292///
293/// This type is not used in any activity, and only used as *part* of another schema.
294///
295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
296#[serde_with::serde_as]
297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
298pub struct DagProcessorResource {
299    /// Optional. The number of DAG processors. If not provided or set to 0, a single DAG processor instance will be created.
300    pub count: Option<i32>,
301    /// Optional. CPU request and limit for a single Airflow DAG processor replica.
302    pub cpu: Option<f32>,
303    /// Optional. Memory (GB) request and limit for a single Airflow DAG processor replica.
304    #[serde(rename = "memoryGb")]
305    pub memory_gb: Option<f32>,
306    /// Optional. Storage (GB) request and limit for a single Airflow DAG processor replica.
307    #[serde(rename = "storageGb")]
308    pub storage_gb: Option<f32>,
309}
310
311impl common::Part for DagProcessorResource {}
312
313/// The configuration setting for Airflow database data retention mechanism.
314///
315/// This type is not used in any activity, and only used as *part* of another schema.
316///
317#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
318#[serde_with::serde_as]
319#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
320pub struct DataRetentionConfig {
321    /// Optional. The retention policy for airflow metadata database.
322    #[serde(rename = "airflowMetadataRetentionConfig")]
323    pub airflow_metadata_retention_config: Option<AirflowMetadataRetentionPolicyConfig>,
324    /// Optional. The configuration settings for task logs retention
325    #[serde(rename = "taskLogsRetentionConfig")]
326    pub task_logs_retention_config: Option<TaskLogsRetentionConfig>,
327}
328
329impl common::Part for DataRetentionConfig {}
330
331/// The configuration of Cloud SQL instance that is used by the Apache Airflow software.
332///
333/// This type is not used in any activity, and only used as *part* of another schema.
334///
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct DatabaseConfig {
339    /// Optional. Cloud SQL machine type used by Airflow database. It has to be one of: db-n1-standard-2, db-n1-standard-4, db-n1-standard-8 or db-n1-standard-16. If not specified, db-n1-standard-2 will be used. Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
340    #[serde(rename = "machineType")]
341    pub machine_type: Option<String>,
342    /// Optional. The Compute Engine zone where the Airflow database is created. If zone is provided, it must be in the region selected for the environment. If zone is not provided, a zone is automatically selected. The zone can only be set during environment creation. Supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.*.
343    pub zone: Option<String>,
344}
345
346impl common::Part for DatabaseConfig {}
347
348/// Request to trigger database failover (only for highly resilient environments).
349///
350/// # Activities
351///
352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
354///
355/// * [locations environments database failover projects](ProjectLocationEnvironmentDatabaseFailoverCall) (request)
356#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
357#[serde_with::serde_as]
358#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
359pub struct DatabaseFailoverRequest {
360    _never_set: Option<bool>,
361}
362
363impl common::RequestValue for DatabaseFailoverRequest {}
364
365/// 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
366///
367/// This type is not used in any activity, and only used as *part* of another schema.
368///
369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
370#[serde_with::serde_as]
371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
372pub struct Date {
373    /// 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.
374    pub day: Option<i32>,
375    /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
376    pub month: Option<i32>,
377    /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
378    pub year: Option<i32>,
379}
380
381impl common::Part for Date {}
382
383/// 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); }
384///
385/// # Activities
386///
387/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
388/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
389///
390/// * [locations environments user workloads config maps delete projects](ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall) (response)
391/// * [locations environments user workloads secrets delete projects](ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall) (response)
392/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
393#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
394#[serde_with::serde_as]
395#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
396pub struct Empty {
397    _never_set: Option<bool>,
398}
399
400impl common::ResponseResult for Empty {}
401
402/// The encryption options for the Cloud Composer environment and its dependencies.Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
403///
404/// This type is not used in any activity, and only used as *part* of another schema.
405///
406#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
407#[serde_with::serde_as]
408#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
409pub struct EncryptionConfig {
410    /// Optional. Customer-managed Encryption Key available through Google's Key Management Service. Cannot be updated. If not specified, Google-managed key will be used.
411    #[serde(rename = "kmsKeyName")]
412    pub kms_key_name: Option<String>,
413}
414
415impl common::Part for EncryptionConfig {}
416
417/// An environment for running orchestration tasks.
418///
419/// # Activities
420///
421/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
422/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
423///
424/// * [locations environments create projects](ProjectLocationEnvironmentCreateCall) (request)
425/// * [locations environments get projects](ProjectLocationEnvironmentGetCall) (response)
426/// * [locations environments patch projects](ProjectLocationEnvironmentPatchCall) (request)
427#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
428#[serde_with::serde_as]
429#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
430pub struct Environment {
431    /// Configuration parameters for this environment.
432    pub config: Option<EnvironmentConfig>,
433    /// Output only. The time at which this environment was created.
434    #[serde(rename = "createTime")]
435    pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
436    /// Optional. User-defined labels for this environment. The labels map can contain no more than 64 entries. Entries of the labels map are UTF8 strings that comply with the following restrictions: * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62} * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} * Both keys and values are additionally constrained to be <= 128 bytes in size.
437    pub labels: Option<HashMap<String, String>>,
438    /// The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" EnvironmentId must start with a lowercase letter followed by up to 63 lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
439    pub name: Option<String>,
440    /// Output only. Reserved for future use.
441    #[serde(rename = "satisfiesPzs")]
442    pub satisfies_pzs: Option<bool>,
443    /// The current state of the environment.
444    pub state: Option<String>,
445    /// Optional. Storage configuration for this environment.
446    #[serde(rename = "storageConfig")]
447    pub storage_config: Option<StorageConfig>,
448    /// Output only. The time at which this environment was last modified.
449    #[serde(rename = "updateTime")]
450    pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
451    /// Output only. The UUID (Universally Unique IDentifier) associated with this environment. This value is generated when the environment is created.
452    pub uuid: Option<String>,
453}
454
455impl common::RequestValue for Environment {}
456impl common::ResponseResult for Environment {}
457
458/// Configuration information for an environment.
459///
460/// This type is not used in any activity, and only used as *part* of another schema.
461///
462#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
463#[serde_with::serde_as]
464#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
465pub struct EnvironmentConfig {
466    /// Output only. The ‘bring your own identity’ variant of the URI of the Apache Airflow Web UI hosted within this environment, to be accessed with external identities using workforce identity federation (see [Access environments with workforce identity federation](https://cloud.google.com/composer/docs/composer-2/access-environments-with-workforce-identity-federation)).
467    #[serde(rename = "airflowByoidUri")]
468    pub airflow_byoid_uri: Option<String>,
469    /// Output only. The URI of the Apache Airflow Web UI hosted within this environment (see [Airflow web interface](https://cloud.google.com/composer/docs/how-to/accessing/airflow-web-interface)).
470    #[serde(rename = "airflowUri")]
471    pub airflow_uri: Option<String>,
472    /// Output only. The Cloud Storage prefix of the DAGs for this environment. Although Cloud Storage objects reside in a flat namespace, a hierarchical file tree can be simulated using "/"-delimited object name prefixes. DAG objects for this environment reside in a simulated directory with the given prefix.
473    #[serde(rename = "dagGcsPrefix")]
474    pub dag_gcs_prefix: Option<String>,
475    /// Optional. The configuration setting for Airflow database data retention mechanism.
476    #[serde(rename = "dataRetentionConfig")]
477    pub data_retention_config: Option<DataRetentionConfig>,
478    /// Optional. The configuration settings for Cloud SQL instance used internally by Apache Airflow software.
479    #[serde(rename = "databaseConfig")]
480    pub database_config: Option<DatabaseConfig>,
481    /// Optional. The encryption options for the Cloud Composer environment and its dependencies. Cannot be updated.
482    #[serde(rename = "encryptionConfig")]
483    pub encryption_config: Option<EncryptionConfig>,
484    /// Optional. The size of the Cloud Composer environment. This field is supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
485    #[serde(rename = "environmentSize")]
486    pub environment_size: Option<String>,
487    /// Output only. The Kubernetes Engine cluster used to run this environment.
488    #[serde(rename = "gkeCluster")]
489    pub gke_cluster: Option<String>,
490    /// Optional. The maintenance window is the period when Cloud Composer components may undergo maintenance. It is defined so that maintenance is not executed during peak hours or critical time periods. The system will not be under maintenance for every occurrence of this window, but when maintenance is planned, it will be scheduled during the window. The maintenance window period must encompass at least 12 hours per week. This may be split into multiple chunks, each with a size of at least 4 hours. If this value is omitted, the default value for maintenance window is applied. By default, maintenance windows are from 00:00:00 to 04:00:00 (GMT) on Friday, Saturday, and Sunday every week.
491    #[serde(rename = "maintenanceWindow")]
492    pub maintenance_window: Option<MaintenanceWindow>,
493    /// Optional. The configuration options for GKE cluster master authorized networks. By default master authorized networks feature is: - in case of private environment: enabled with no external networks allowlisted. - in case of public environment: disabled.
494    #[serde(rename = "masterAuthorizedNetworksConfig")]
495    pub master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
496    /// The configuration used for the Kubernetes Engine cluster.
497    #[serde(rename = "nodeConfig")]
498    pub node_config: Option<NodeConfig>,
499    /// The number of nodes in the Kubernetes Engine cluster that will be used to run this environment. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
500    #[serde(rename = "nodeCount")]
501    pub node_count: Option<i32>,
502    /// The configuration used for the Private IP Cloud Composer environment.
503    #[serde(rename = "privateEnvironmentConfig")]
504    pub private_environment_config: Option<PrivateEnvironmentConfig>,
505    /// Optional. The Recovery settings configuration of an environment. This field is supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
506    #[serde(rename = "recoveryConfig")]
507    pub recovery_config: Option<RecoveryConfig>,
508    /// Optional. Resilience mode of the Cloud Composer Environment. This field is supported for Cloud Composer environments in versions composer-2.2.0-airflow-*.*.* and newer.
509    #[serde(rename = "resilienceMode")]
510    pub resilience_mode: Option<String>,
511    /// The configuration settings for software inside the environment.
512    #[serde(rename = "softwareConfig")]
513    pub software_config: Option<SoftwareConfig>,
514    /// Optional. The configuration settings for the Airflow web server App Engine instance.
515    #[serde(rename = "webServerConfig")]
516    pub web_server_config: Option<WebServerConfig>,
517    /// Optional. The network-level access control policy for the Airflow web server. If unspecified, no network-level access restrictions will be applied.
518    #[serde(rename = "webServerNetworkAccessControl")]
519    pub web_server_network_access_control: Option<WebServerNetworkAccessControl>,
520    /// Optional. The workloads configuration settings for the GKE cluster associated with the Cloud Composer environment. The GKE cluster runs Airflow scheduler, web server and workers workloads. This field is supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
521    #[serde(rename = "workloadsConfig")]
522    pub workloads_config: Option<WorkloadsConfig>,
523}
524
525impl common::Part for EnvironmentConfig {}
526
527/// Execute Airflow Command request.
528///
529/// # Activities
530///
531/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
532/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
533///
534/// * [locations environments execute airflow command projects](ProjectLocationEnvironmentExecuteAirflowCommandCall) (request)
535#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
536#[serde_with::serde_as]
537#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
538pub struct ExecuteAirflowCommandRequest {
539    /// Airflow command.
540    pub command: Option<String>,
541    /// Parameters for the Airflow command/subcommand as an array of arguments. It may contain positional arguments like `["my-dag-id"]`, key-value parameters like `["--foo=bar"]` or `["--foo","bar"]`, or other flags like `["-f"]`.
542    pub parameters: Option<Vec<String>>,
543    /// Airflow subcommand.
544    pub subcommand: Option<String>,
545}
546
547impl common::RequestValue for ExecuteAirflowCommandRequest {}
548
549/// Response to ExecuteAirflowCommandRequest.
550///
551/// # Activities
552///
553/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
554/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
555///
556/// * [locations environments execute airflow command projects](ProjectLocationEnvironmentExecuteAirflowCommandCall) (response)
557#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
558#[serde_with::serde_as]
559#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
560pub struct ExecuteAirflowCommandResponse {
561    /// Error message. Empty if there was no error.
562    pub error: Option<String>,
563    /// The unique ID of the command execution for polling.
564    #[serde(rename = "executionId")]
565    pub execution_id: Option<String>,
566    /// The name of the pod where the command is executed.
567    pub pod: Option<String>,
568    /// The namespace of the pod where the command is executed.
569    #[serde(rename = "podNamespace")]
570    pub pod_namespace: Option<String>,
571}
572
573impl common::ResponseResult for ExecuteAirflowCommandResponse {}
574
575/// Information about how a command ended.
576///
577/// This type is not used in any activity, and only used as *part* of another schema.
578///
579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
580#[serde_with::serde_as]
581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
582pub struct ExitInfo {
583    /// Error message. Empty if there was no error.
584    pub error: Option<String>,
585    /// The exit code from the command execution.
586    #[serde(rename = "exitCode")]
587    pub exit_code: Option<i32>,
588}
589
590impl common::Part for ExitInfo {}
591
592/// Response for FetchDatabasePropertiesRequest.
593///
594/// # Activities
595///
596/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
597/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
598///
599/// * [locations environments fetch database properties projects](ProjectLocationEnvironmentFetchDatabasePropertyCall) (response)
600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
601#[serde_with::serde_as]
602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
603pub struct FetchDatabasePropertiesResponse {
604    /// The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The primary instance can only fail over to the failover replica when the status is true.
605    #[serde(rename = "isFailoverReplicaAvailable")]
606    pub is_failover_replica_available: Option<bool>,
607    /// The Compute Engine zone that the instance is currently serving from.
608    #[serde(rename = "primaryGceZone")]
609    pub primary_gce_zone: Option<String>,
610    /// The Compute Engine zone that the failover instance is currently serving from for a regional Cloud SQL instance.
611    #[serde(rename = "secondaryGceZone")]
612    pub secondary_gce_zone: Option<String>,
613}
614
615impl common::ResponseResult for FetchDatabasePropertiesResponse {}
616
617/// Configuration for controlling how IPs are allocated in the GKE cluster running the Apache Airflow software.
618///
619/// This type is not used in any activity, and only used as *part* of another schema.
620///
621#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
622#[serde_with::serde_as]
623#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
624pub struct IPAllocationPolicy {
625    /// Optional. The IP address range used to allocate IP addresses to pods in the GKE cluster. For Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*, this field is applicable only when `use_ip_aliases` is true. Set to blank to have GKE choose a range with the default size. Set to /netmask (e.g. `/14`) to have GKE choose a range with a specific netmask. Set to a [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range to use.
626    #[serde(rename = "clusterIpv4CidrBlock")]
627    pub cluster_ipv4_cidr_block: Option<String>,
628    /// Optional. The name of the GKE cluster's secondary range used to allocate IP addresses to pods. For Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*, this field is applicable only when `use_ip_aliases` is true.
629    #[serde(rename = "clusterSecondaryRangeName")]
630    pub cluster_secondary_range_name: Option<String>,
631    /// Optional. The IP address range of the services IP addresses in this GKE cluster. For Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*, this field is applicable only when `use_ip_aliases` is true. Set to blank to have GKE choose a range with the default size. Set to /netmask (e.g. `/14`) to have GKE choose a range with a specific netmask. Set to a [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`) from the RFC-1918 private networks (e.g. `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) to pick a specific range to use.
632    #[serde(rename = "servicesIpv4CidrBlock")]
633    pub services_ipv4_cidr_block: Option<String>,
634    /// Optional. The name of the services' secondary range used to allocate IP addresses to the GKE cluster. For Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*, this field is applicable only when `use_ip_aliases` is true.
635    #[serde(rename = "servicesSecondaryRangeName")]
636    pub services_secondary_range_name: Option<String>,
637    /// Optional. Whether or not to enable Alias IPs in the GKE cluster. If `true`, a VPC-native cluster is created. This field is only supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*. Environments in newer versions always use VPC-native GKE clusters.
638    #[serde(rename = "useIpAliases")]
639    pub use_ip_aliases: Option<bool>,
640}
641
642impl common::Part for IPAllocationPolicy {}
643
644/// ImageVersion information
645///
646/// This type is not used in any activity, and only used as *part* of another schema.
647///
648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
649#[serde_with::serde_as]
650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
651pub struct ImageVersion {
652    /// Whether it is impossible to create an environment with the image version.
653    #[serde(rename = "creationDisabled")]
654    pub creation_disabled: Option<bool>,
655    /// The string identifier of the ImageVersion, in the form: "composer-x.y.z-airflow-a.b.c"
656    #[serde(rename = "imageVersionId")]
657    pub image_version_id: Option<String>,
658    /// Whether this is the default ImageVersion used by Composer during environment creation if no input ImageVersion is specified.
659    #[serde(rename = "isDefault")]
660    pub is_default: Option<bool>,
661    /// The date of the version release.
662    #[serde(rename = "releaseDate")]
663    pub release_date: Option<Date>,
664    /// supported python versions
665    #[serde(rename = "supportedPythonVersions")]
666    pub supported_python_versions: Option<Vec<String>>,
667    /// Whether it is impossible to upgrade an environment running with the image version.
668    #[serde(rename = "upgradeDisabled")]
669    pub upgrade_disabled: Option<bool>,
670}
671
672impl common::Part for ImageVersion {}
673
674/// Contains information about a single line from logs.
675///
676/// This type is not used in any activity, and only used as *part* of another schema.
677///
678#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
679#[serde_with::serde_as]
680#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
681pub struct Line {
682    /// Text content of the log line.
683    pub content: Option<String>,
684    /// Number of the line.
685    #[serde(rename = "lineNumber")]
686    pub line_number: Option<i32>,
687}
688
689impl common::Part for Line {}
690
691/// The environments in a project and location.
692///
693/// # Activities
694///
695/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
696/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
697///
698/// * [locations environments list projects](ProjectLocationEnvironmentListCall) (response)
699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
700#[serde_with::serde_as]
701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
702pub struct ListEnvironmentsResponse {
703    /// The list of environments returned by a ListEnvironmentsRequest.
704    pub environments: Option<Vec<Environment>>,
705    /// The page token used to query for the next page if one exists.
706    #[serde(rename = "nextPageToken")]
707    pub next_page_token: Option<String>,
708}
709
710impl common::ResponseResult for ListEnvironmentsResponse {}
711
712/// The ImageVersions in a project and location.
713///
714/// # Activities
715///
716/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
717/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
718///
719/// * [locations image versions list projects](ProjectLocationImageVersionListCall) (response)
720#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
721#[serde_with::serde_as]
722#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
723pub struct ListImageVersionsResponse {
724    /// The list of supported ImageVersions in a location.
725    #[serde(rename = "imageVersions")]
726    pub image_versions: Option<Vec<ImageVersion>>,
727    /// The page token used to query for the next page if one exists.
728    #[serde(rename = "nextPageToken")]
729    pub next_page_token: Option<String>,
730}
731
732impl common::ResponseResult for ListImageVersionsResponse {}
733
734/// The response message for Operations.ListOperations.
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 list projects](ProjectLocationOperationListCall) (response)
742#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
743#[serde_with::serde_as]
744#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
745pub struct ListOperationsResponse {
746    /// The standard List next-page token.
747    #[serde(rename = "nextPageToken")]
748    pub next_page_token: Option<String>,
749    /// A list of operations that matches the specified filter in the request.
750    pub operations: Option<Vec<Operation>>,
751}
752
753impl common::ResponseResult for ListOperationsResponse {}
754
755/// The user workloads ConfigMaps for a given environment.
756///
757/// # Activities
758///
759/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
760/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
761///
762/// * [locations environments user workloads config maps list projects](ProjectLocationEnvironmentUserWorkloadsConfigMapListCall) (response)
763#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
764#[serde_with::serde_as]
765#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
766pub struct ListUserWorkloadsConfigMapsResponse {
767    /// The page token used to query for the next page if one exists.
768    #[serde(rename = "nextPageToken")]
769    pub next_page_token: Option<String>,
770    /// The list of ConfigMaps returned by a ListUserWorkloadsConfigMapsRequest.
771    #[serde(rename = "userWorkloadsConfigMaps")]
772    pub user_workloads_config_maps: Option<Vec<UserWorkloadsConfigMap>>,
773}
774
775impl common::ResponseResult for ListUserWorkloadsConfigMapsResponse {}
776
777/// The user workloads Secrets for a given environment.
778///
779/// # Activities
780///
781/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
782/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
783///
784/// * [locations environments user workloads secrets list projects](ProjectLocationEnvironmentUserWorkloadsSecretListCall) (response)
785#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
786#[serde_with::serde_as]
787#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
788pub struct ListUserWorkloadsSecretsResponse {
789    /// The page token used to query for the next page if one exists.
790    #[serde(rename = "nextPageToken")]
791    pub next_page_token: Option<String>,
792    /// The list of Secrets returned by a ListUserWorkloadsSecretsRequest.
793    #[serde(rename = "userWorkloadsSecrets")]
794    pub user_workloads_secrets: Option<Vec<UserWorkloadsSecret>>,
795}
796
797impl common::ResponseResult for ListUserWorkloadsSecretsResponse {}
798
799/// Response to ListWorkloadsRequest.
800///
801/// # Activities
802///
803/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
804/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
805///
806/// * [locations environments workloads list projects](ProjectLocationEnvironmentWorkloadListCall) (response)
807#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
808#[serde_with::serde_as]
809#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
810pub struct ListWorkloadsResponse {
811    /// The page token used to query for the next page if one exists.
812    #[serde(rename = "nextPageToken")]
813    pub next_page_token: Option<String>,
814    /// The list of environment workloads.
815    pub workloads: Option<Vec<ComposerWorkload>>,
816}
817
818impl common::ResponseResult for ListWorkloadsResponse {}
819
820/// Request to load a snapshot into a Cloud Composer environment.
821///
822/// # Activities
823///
824/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
825/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
826///
827/// * [locations environments load snapshot projects](ProjectLocationEnvironmentLoadSnapshotCall) (request)
828#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
829#[serde_with::serde_as]
830#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
831pub struct LoadSnapshotRequest {
832    /// Whether or not to skip setting Airflow overrides when loading the environment's state.
833    #[serde(rename = "skipAirflowOverridesSetting")]
834    pub skip_airflow_overrides_setting: Option<bool>,
835    /// Whether or not to skip setting environment variables when loading the environment's state.
836    #[serde(rename = "skipEnvironmentVariablesSetting")]
837    pub skip_environment_variables_setting: Option<bool>,
838    /// Whether or not to skip copying Cloud Storage data when loading the environment's state.
839    #[serde(rename = "skipGcsDataCopying")]
840    pub skip_gcs_data_copying: Option<bool>,
841    /// Whether or not to skip installing Pypi packages when loading the environment's state.
842    #[serde(rename = "skipPypiPackagesInstallation")]
843    pub skip_pypi_packages_installation: Option<bool>,
844    /// A Cloud Storage path to a snapshot to load, e.g.: "gs://my-bucket/snapshots/project_location_environment_timestamp".
845    #[serde(rename = "snapshotPath")]
846    pub snapshot_path: Option<String>,
847}
848
849impl common::RequestValue for LoadSnapshotRequest {}
850
851/// The configuration settings for Cloud Composer maintenance window. The following example: ``` { "startTime":"2019-08-01T01:00:00Z" "endTime":"2019-08-01T07:00:00Z" "recurrence":"FREQ=WEEKLY;BYDAY=TU,WE" } ``` would define a maintenance window between 01 and 07 hours UTC during each Tuesday and Wednesday.
852///
853/// This type is not used in any activity, and only used as *part* of another schema.
854///
855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
856#[serde_with::serde_as]
857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
858pub struct MaintenanceWindow {
859    /// Required. Maintenance window end time. It is used only to calculate the duration of the maintenance window. The value for end-time must be in the future, relative to `start_time`.
860    #[serde(rename = "endTime")]
861    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
862    /// Required. Maintenance window recurrence. Format is a subset of [RFC-5545](https://tools.ietf.org/html/rfc5545) `RRULE`. The only allowed values for `FREQ` field are `FREQ=DAILY` and `FREQ=WEEKLY;BYDAY=...` Example values: `FREQ=WEEKLY;BYDAY=TU,WE`, `FREQ=DAILY`.
863    pub recurrence: Option<String>,
864    /// Required. Start time of the first recurrence of the maintenance window.
865    #[serde(rename = "startTime")]
866    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
867}
868
869impl common::Part for MaintenanceWindow {}
870
871/// Configuration options for the master authorized networks feature. Enabled master authorized networks will disallow all external traffic to access Kubernetes master through HTTPS except traffic from the given CIDR blocks, Google Compute Engine Public IPs and Google Prod IPs.
872///
873/// This type is not used in any activity, and only used as *part* of another schema.
874///
875#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
876#[serde_with::serde_as]
877#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
878pub struct MasterAuthorizedNetworksConfig {
879    /// Up to 50 external networks that could access Kubernetes master through HTTPS.
880    #[serde(rename = "cidrBlocks")]
881    pub cidr_blocks: Option<Vec<CidrBlock>>,
882    /// Whether or not master authorized networks feature is enabled.
883    pub enabled: Option<bool>,
884}
885
886impl common::Part for MasterAuthorizedNetworksConfig {}
887
888/// Configuration options for networking connections in the Composer 2 environment.
889///
890/// This type is not used in any activity, and only used as *part* of another schema.
891///
892#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
893#[serde_with::serde_as]
894#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
895pub struct NetworkingConfig {
896    /// Optional. Indicates the user requested specifc connection type between Tenant and Customer projects. You cannot set networking connection type in public IP environment.
897    #[serde(rename = "connectionType")]
898    pub connection_type: Option<String>,
899}
900
901impl common::Part for NetworkingConfig {}
902
903/// The configuration information for the Kubernetes Engine nodes running the Apache Airflow software.
904///
905/// This type is not used in any activity, and only used as *part* of another schema.
906///
907#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
908#[serde_with::serde_as]
909#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
910pub struct NodeConfig {
911    /// Optional. The IP range in CIDR notation to use internally by Cloud Composer. IP addresses are not reserved - and the same range can be used by multiple Cloud Composer environments. In case of overlap, IPs from this range will not be accessible in the user's VPC network. Cannot be updated. If not specified, the default value of '100.64.128.0/20' is used. This field is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
912    #[serde(rename = "composerInternalIpv4CidrBlock")]
913    pub composer_internal_ipv4_cidr_block: Option<String>,
914    /// Optional. Network Attachment that Cloud Composer environment is connected to, which provides connectivity with a user's VPC network. Takes precedence over network and subnetwork settings. If not provided, but network and subnetwork are defined during environment, it will be provisioned. If not provided and network and subnetwork are also empty, then connectivity to user's VPC network is disabled. Network attachment must be provided in format projects/{project}/regions/{region}/networkAttachments/{networkAttachment}. This field is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
915    #[serde(rename = "composerNetworkAttachment")]
916    pub composer_network_attachment: Option<String>,
917    /// Optional. The disk size in GB used for node VMs. Minimum size is 30GB. If unspecified, defaults to 100GB. Cannot be updated. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
918    #[serde(rename = "diskSizeGb")]
919    pub disk_size_gb: Option<i32>,
920    /// Optional. Deploys 'ip-masq-agent' daemon set in the GKE cluster and defines nonMasqueradeCIDRs equals to pod IP range so IP masquerading is used for all destination addresses, except between pods traffic. See: https://cloud.google.com/kubernetes-engine/docs/how-to/ip-masquerade-agent
921    #[serde(rename = "enableIpMasqAgent")]
922    pub enable_ip_masq_agent: Option<bool>,
923    /// Optional. The configuration for controlling how IPs are allocated in the GKE cluster.
924    #[serde(rename = "ipAllocationPolicy")]
925    pub ip_allocation_policy: Option<IPAllocationPolicy>,
926    /// Optional. The Compute Engine [zone](https://cloud.google.com/compute/docs/regions-zones) in which to deploy the VMs used to run the Apache Airflow software, specified as a [relative resource name](https://cloud.google.com/apis/design/resource_names#relative_resource_name). For example: “projects/{projectId}/zones/{zoneId}”. This `location` must belong to the enclosing environment’s project and location. If both this field and `nodeConfig.machineType` are specified, `nodeConfig.machineType` must belong to this `location`; if both are unspecified, the service will pick a zone in the Compute Engine region corresponding to the Cloud Composer location, and propagate that choice to both fields. If only one field (`location` or `nodeConfig.machineType`) is specified, the location information from the specified field will be propagated to the unspecified field. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.\*.
927    pub location: Option<String>,
928    /// Optional. The Compute Engine [machine type](https://cloud.google.com/compute/docs/machine-types) used for cluster instances, specified as a [relative resource name](https://cloud.google.com/apis/design/resource_names#relative_resource_name). For example: “projects/{projectId}/zones/{zoneId}/machineTypes/{machineTypeId}”. The `machineType` must belong to the enclosing environment’s project and location. If both this field and `nodeConfig.location` are specified, this `machineType` must belong to the `nodeConfig.location`; if both are unspecified, the service will pick a zone in the Compute Engine region corresponding to the Cloud Composer location, and propagate that choice to both fields. If exactly one of this field and `nodeConfig.location` is specified, the location information from the specified field will be propagated to the unspecified field. The `machineTypeId` must not be a [shared-core machine type](https://cloud.google.com/compute/docs/machine-types#sharedcore). If this field is unspecified, the `machineTypeId` defaults to “n1-standard-1”. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.\*.
929    #[serde(rename = "machineType")]
930    pub machine_type: Option<String>,
931    /// Optional. The Compute Engine network to be used for machine communications, specified as a [relative resource name](https://cloud.google.com/apis/design/resource_names#relative_resource_name). For example: “projects/{projectId}/global/networks/{networkId}”. If unspecified, the “default” network ID in the environment’s project is used. If a [Custom Subnet Network](https://cloud.google.com/vpc/docs/vpc#vpc_networks_and_subnets) is provided, `nodeConfig.subnetwork` must also be provided. For [Shared VPC](https://cloud.google.com/vpc/docs/shared-vpc) subnetwork requirements, see `nodeConfig.subnetwork`.
932    pub network: Option<String>,
933    /// Optional. The set of Google API scopes to be made available on all node VMs. If `oauth_scopes` is empty, defaults to ["https://www.googleapis.com/auth/cloud-platform"]. Cannot be updated. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
934    #[serde(rename = "oauthScopes")]
935    pub oauth_scopes: Option<Vec<String>>,
936    /// Optional. The Google Cloud Platform Service Account to be used by the node VMs. If a service account is not specified, the "default" Compute Engine service account is used. Cannot be updated.
937    #[serde(rename = "serviceAccount")]
938    pub service_account: Option<String>,
939    /// Optional. The Compute Engine subnetwork to be used for machine communications, specified as a [relative resource name](https://cloud.google.com/apis/design/resource_names#relative_resource_name). For example: “projects/{projectId}/regions/{regionId}/subnetworks/{subnetworkId}” If a subnetwork is provided, `nodeConfig.network` must also be provided, and the subnetwork must belong to the enclosing environment’s project and location.
940    pub subnetwork: Option<String>,
941    /// Optional. The list of instance tags applied to all node VMs. Tags are used to identify valid sources or targets for network firewalls. Each tag within the list must comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Cannot be updated.
942    pub tags: Option<Vec<String>>,
943}
944
945impl common::Part for NodeConfig {}
946
947/// This resource represents a long-running operation that is the result of a network API call.
948///
949/// # Activities
950///
951/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
952/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
953///
954/// * [locations environments check upgrade projects](ProjectLocationEnvironmentCheckUpgradeCall) (response)
955/// * [locations environments create projects](ProjectLocationEnvironmentCreateCall) (response)
956/// * [locations environments database failover projects](ProjectLocationEnvironmentDatabaseFailoverCall) (response)
957/// * [locations environments delete projects](ProjectLocationEnvironmentDeleteCall) (response)
958/// * [locations environments load snapshot projects](ProjectLocationEnvironmentLoadSnapshotCall) (response)
959/// * [locations environments patch projects](ProjectLocationEnvironmentPatchCall) (response)
960/// * [locations environments save snapshot projects](ProjectLocationEnvironmentSaveSnapshotCall) (response)
961/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
962#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
963#[serde_with::serde_as]
964#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
965pub struct Operation {
966    /// 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.
967    pub done: Option<bool>,
968    /// The error result of the operation in case of failure or cancellation.
969    pub error: Option<Status>,
970    /// 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.
971    pub metadata: Option<HashMap<String, serde_json::Value>>,
972    /// 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}`.
973    pub name: Option<String>,
974    /// 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`.
975    pub response: Option<HashMap<String, serde_json::Value>>,
976}
977
978impl common::ResponseResult for Operation {}
979
980/// Poll Airflow Command request.
981///
982/// # Activities
983///
984/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
985/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
986///
987/// * [locations environments poll airflow command projects](ProjectLocationEnvironmentPollAirflowCommandCall) (request)
988#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
989#[serde_with::serde_as]
990#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
991pub struct PollAirflowCommandRequest {
992    /// The unique ID of the command execution.
993    #[serde(rename = "executionId")]
994    pub execution_id: Option<String>,
995    /// Line number from which new logs should be fetched.
996    #[serde(rename = "nextLineNumber")]
997    pub next_line_number: Option<i32>,
998    /// The name of the pod where the command is executed.
999    pub pod: Option<String>,
1000    /// The namespace of the pod where the command is executed.
1001    #[serde(rename = "podNamespace")]
1002    pub pod_namespace: Option<String>,
1003}
1004
1005impl common::RequestValue for PollAirflowCommandRequest {}
1006
1007/// Response to PollAirflowCommandRequest.
1008///
1009/// # Activities
1010///
1011/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1012/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1013///
1014/// * [locations environments poll airflow command projects](ProjectLocationEnvironmentPollAirflowCommandCall) (response)
1015#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1016#[serde_with::serde_as]
1017#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1018pub struct PollAirflowCommandResponse {
1019    /// The result exit status of the command.
1020    #[serde(rename = "exitInfo")]
1021    pub exit_info: Option<ExitInfo>,
1022    /// Output from the command execution. It may not contain the full output and the caller may need to poll for more lines.
1023    pub output: Option<Vec<Line>>,
1024    /// Whether the command execution has finished and there is no more output.
1025    #[serde(rename = "outputEnd")]
1026    pub output_end: Option<bool>,
1027}
1028
1029impl common::ResponseResult for PollAirflowCommandResponse {}
1030
1031/// Configuration options for the private GKE cluster in a Cloud Composer environment.
1032///
1033/// This type is not used in any activity, and only used as *part* of another schema.
1034///
1035#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1036#[serde_with::serde_as]
1037#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1038pub struct PrivateClusterConfig {
1039    /// Optional. If `true`, access to the public endpoint of the GKE cluster is denied.
1040    #[serde(rename = "enablePrivateEndpoint")]
1041    pub enable_private_endpoint: Option<bool>,
1042    /// Optional. The CIDR block from which IPv4 range for GKE master will be reserved. If left blank, the default value of '172.16.0.0/23' is used.
1043    #[serde(rename = "masterIpv4CidrBlock")]
1044    pub master_ipv4_cidr_block: Option<String>,
1045    /// Output only. The IP range in CIDR notation to use for the hosted master network. This range is used for assigning internal IP addresses to the GKE cluster master or set of masters and to the internal load balancer virtual IP. This range must not overlap with any other ranges in use within the cluster's network.
1046    #[serde(rename = "masterIpv4ReservedRange")]
1047    pub master_ipv4_reserved_range: Option<String>,
1048}
1049
1050impl common::Part for PrivateClusterConfig {}
1051
1052/// The configuration information for configuring a Private IP Cloud Composer environment.
1053///
1054/// This type is not used in any activity, and only used as *part* of another schema.
1055///
1056#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1057#[serde_with::serde_as]
1058#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1059pub struct PrivateEnvironmentConfig {
1060    /// Optional. When specified, the environment will use Private Service Connect instead of VPC peerings to connect to Cloud SQL in the Tenant Project, and the PSC endpoint in the Customer Project will use an IP address from this subnetwork.
1061    #[serde(rename = "cloudComposerConnectionSubnetwork")]
1062    pub cloud_composer_connection_subnetwork: Option<String>,
1063    /// Optional. The CIDR block from which IP range for Cloud Composer Network in tenant project will be reserved. Needs to be disjoint from private_cluster_config.master_ipv4_cidr_block and cloud_sql_ipv4_cidr_block. This field is supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
1064    #[serde(rename = "cloudComposerNetworkIpv4CidrBlock")]
1065    pub cloud_composer_network_ipv4_cidr_block: Option<String>,
1066    /// Output only. The IP range reserved for the tenant project's Cloud Composer network. This field is supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
1067    #[serde(rename = "cloudComposerNetworkIpv4ReservedRange")]
1068    pub cloud_composer_network_ipv4_reserved_range: Option<String>,
1069    /// Optional. The CIDR block from which IP range in tenant project will be reserved for Cloud SQL. Needs to be disjoint from `web_server_ipv4_cidr_block`.
1070    #[serde(rename = "cloudSqlIpv4CidrBlock")]
1071    pub cloud_sql_ipv4_cidr_block: Option<String>,
1072    /// Optional. If `true`, builds performed during operations that install Python packages have only private connectivity to Google services (including Artifact Registry) and VPC network (if either `NodeConfig.network` and `NodeConfig.subnetwork` fields or `NodeConfig.composer_network_attachment` field are specified). If `false`, the builds also have access to the internet. This field is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1073    #[serde(rename = "enablePrivateBuildsOnly")]
1074    pub enable_private_builds_only: Option<bool>,
1075    /// Optional. If `true`, a Private IP Cloud Composer environment is created. If this field is set to true, `IPAllocationPolicy.use_ip_aliases` must be set to true for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
1076    #[serde(rename = "enablePrivateEnvironment")]
1077    pub enable_private_environment: Option<bool>,
1078    /// Optional. When enabled, IPs from public (non-RFC1918) ranges can be used for `IPAllocationPolicy.cluster_ipv4_cidr_block` and `IPAllocationPolicy.service_ipv4_cidr_block`.
1079    #[serde(rename = "enablePrivatelyUsedPublicIps")]
1080    pub enable_privately_used_public_ips: Option<bool>,
1081    /// Optional. Configuration for the network connections configuration in the environment.
1082    #[serde(rename = "networkingConfig")]
1083    pub networking_config: Option<NetworkingConfig>,
1084    /// Optional. Configuration for the private GKE cluster for a Private IP Cloud Composer environment.
1085    #[serde(rename = "privateClusterConfig")]
1086    pub private_cluster_config: Option<PrivateClusterConfig>,
1087    /// Optional. The CIDR block from which IP range for web server will be reserved. Needs to be disjoint from `private_cluster_config.master_ipv4_cidr_block` and `cloud_sql_ipv4_cidr_block`. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
1088    #[serde(rename = "webServerIpv4CidrBlock")]
1089    pub web_server_ipv4_cidr_block: Option<String>,
1090    /// Output only. The IP range reserved for the tenant project's App Engine VMs. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
1091    #[serde(rename = "webServerIpv4ReservedRange")]
1092    pub web_server_ipv4_reserved_range: Option<String>,
1093}
1094
1095impl common::Part for PrivateEnvironmentConfig {}
1096
1097/// The Recovery settings of an environment.
1098///
1099/// This type is not used in any activity, and only used as *part* of another schema.
1100///
1101#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1102#[serde_with::serde_as]
1103#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1104pub struct RecoveryConfig {
1105    /// Optional. The configuration for scheduled snapshot creation mechanism.
1106    #[serde(rename = "scheduledSnapshotsConfig")]
1107    pub scheduled_snapshots_config: Option<ScheduledSnapshotsConfig>,
1108}
1109
1110impl common::Part for RecoveryConfig {}
1111
1112/// Request to create a snapshot of a Cloud Composer environment.
1113///
1114/// # Activities
1115///
1116/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1117/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1118///
1119/// * [locations environments save snapshot projects](ProjectLocationEnvironmentSaveSnapshotCall) (request)
1120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1121#[serde_with::serde_as]
1122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1123pub struct SaveSnapshotRequest {
1124    /// Location in a Cloud Storage where the snapshot is going to be stored, e.g.: "gs://my-bucket/snapshots".
1125    #[serde(rename = "snapshotLocation")]
1126    pub snapshot_location: Option<String>,
1127}
1128
1129impl common::RequestValue for SaveSnapshotRequest {}
1130
1131/// The configuration for scheduled snapshot creation mechanism.
1132///
1133/// This type is not used in any activity, and only used as *part* of another schema.
1134///
1135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1136#[serde_with::serde_as]
1137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1138pub struct ScheduledSnapshotsConfig {
1139    /// Optional. Whether scheduled snapshots creation is enabled.
1140    pub enabled: Option<bool>,
1141    /// Optional. The cron expression representing the time when snapshots creation mechanism runs. This field is subject to additional validation around frequency of execution.
1142    #[serde(rename = "snapshotCreationSchedule")]
1143    pub snapshot_creation_schedule: Option<String>,
1144    /// Optional. The Cloud Storage location for storing automatically created snapshots.
1145    #[serde(rename = "snapshotLocation")]
1146    pub snapshot_location: Option<String>,
1147    /// Optional. Time zone that sets the context to interpret snapshot_creation_schedule.
1148    #[serde(rename = "timeZone")]
1149    pub time_zone: Option<String>,
1150}
1151
1152impl common::Part for ScheduledSnapshotsConfig {}
1153
1154/// Configuration for resources used by Airflow schedulers.
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 SchedulerResource {
1162    /// Optional. The number of schedulers.
1163    pub count: Option<i32>,
1164    /// Optional. CPU request and limit for a single Airflow scheduler replica.
1165    pub cpu: Option<f32>,
1166    /// Optional. Memory (GB) request and limit for a single Airflow scheduler replica.
1167    #[serde(rename = "memoryGb")]
1168    pub memory_gb: Option<f32>,
1169    /// Optional. Storage (GB) request and limit for a single Airflow scheduler replica.
1170    #[serde(rename = "storageGb")]
1171    pub storage_gb: Option<f32>,
1172}
1173
1174impl common::Part for SchedulerResource {}
1175
1176/// Specifies the selection and configuration of software inside the environment.
1177///
1178/// This type is not used in any activity, and only used as *part* of another schema.
1179///
1180#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1181#[serde_with::serde_as]
1182#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1183pub struct SoftwareConfig {
1184    /// Optional. Apache Airflow configuration properties to override. Property keys contain the section and property names, separated by a hyphen, for example “core-dags_are_paused_at_creation”. Section names must not contain hyphens (“-”), opening square brackets (“\[”), or closing square brackets (“\]”). The property name must not be empty and must not contain an equals sign (“=”) or semicolon (“;”). Section and property names must not contain a period (“.”). Apache Airflow configuration property names must be written in [snake_case](https://en.wikipedia.org/wiki/Snake_case). Property values can contain any character, and can be written in any lower/upper case format. Certain Apache Airflow configuration property values are [blocked](https://cloud.google.com/composer/docs/concepts/airflow-configurations), and cannot be overridden.
1185    #[serde(rename = "airflowConfigOverrides")]
1186    pub airflow_config_overrides: Option<HashMap<String, String>>,
1187    /// Optional. The configuration for Cloud Data Lineage integration.
1188    #[serde(rename = "cloudDataLineageIntegration")]
1189    pub cloud_data_lineage_integration: Option<CloudDataLineageIntegration>,
1190    /// Optional. Additional environment variables to provide to the Apache Airflow scheduler, worker, and webserver processes. Environment variable names must match the regular expression `a-zA-Z_*`. They cannot specify Apache Airflow software configuration overrides (they cannot match the regular expression `AIRFLOW__[A-Z0-9_]+__[A-Z0-9_]+`), and they cannot match any of the following reserved names: * `AIRFLOW_HOME` * `C_FORCE_ROOT` * `CONTAINER_NAME` * `DAGS_FOLDER` * `GCP_PROJECT` * `GCS_BUCKET` * `GKE_CLUSTER_NAME` * `SQL_DATABASE` * `SQL_INSTANCE` * `SQL_PASSWORD` * `SQL_PROJECT` * `SQL_REGION` * `SQL_USER`
1191    #[serde(rename = "envVariables")]
1192    pub env_variables: Option<HashMap<String, String>>,
1193    /// The version of the software running in the environment. This encapsulates both the version of Cloud Composer functionality and the version of Apache Airflow. It must match the regular expression `composer-([0-9]+(\.[0-9]+\.[0-9]+(-preview\.[0-9]+)?)?|latest)-airflow-([0-9]+(\.[0-9]+(\.[0-9]+)?)?)`. When used as input, the server also checks if the provided version is supported and denies the request for an unsupported version. The Cloud Composer portion of the image version is a full [semantic version](https://semver.org), or an alias in the form of major version number or `latest`. When an alias is provided, the server replaces it with the current Cloud Composer version that satisfies the alias. The Apache Airflow portion of the image version is a full semantic version that points to one of the supported Apache Airflow versions, or an alias in the form of only major or major.minor versions specified. When an alias is provided, the server replaces it with the latest Apache Airflow version that satisfies the alias and is supported in the given Cloud Composer version. In all cases, the resolved image version is stored in the same field. See also [version list](https://cloud.google.com/composer/docs/concepts/versioning/composer-versions) and [versioning overview](https://cloud.google.com/composer/docs/concepts/versioning/composer-versioning-overview).
1194    #[serde(rename = "imageVersion")]
1195    pub image_version: Option<String>,
1196    /// Optional. Custom Python Package Index (PyPI) packages to be installed in the environment. Keys refer to the lowercase package name such as "numpy" and values are the lowercase extras and version specifier such as "==1.12.0", "[devel,gcp_api]", or "[devel]>=1.8.2, <1.9.2". To specify a package without pinning it to a version specifier, use the empty string as the value.
1197    #[serde(rename = "pypiPackages")]
1198    pub pypi_packages: Option<HashMap<String, String>>,
1199    /// Optional. The major version of Python used to run the Apache Airflow scheduler, worker, and webserver processes. Can be set to '2' or '3'. If not specified, the default is '3'. Cannot be updated. This field is only supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*. Environments in newer versions always use Python major version 3.
1200    #[serde(rename = "pythonVersion")]
1201    pub python_version: Option<String>,
1202    /// Optional. The number of schedulers for Airflow. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-2.*.*.
1203    #[serde(rename = "schedulerCount")]
1204    pub scheduler_count: Option<i32>,
1205    /// Optional. Whether or not the web server uses custom plugins. If unspecified, the field defaults to `PLUGINS_ENABLED`. This field is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1206    #[serde(rename = "webServerPluginsMode")]
1207    pub web_server_plugins_mode: Option<String>,
1208}
1209
1210impl common::Part for SoftwareConfig {}
1211
1212/// 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).
1213///
1214/// This type is not used in any activity, and only used as *part* of another schema.
1215///
1216#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1217#[serde_with::serde_as]
1218#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1219pub struct Status {
1220    /// The status code, which should be an enum value of google.rpc.Code.
1221    pub code: Option<i32>,
1222    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1223    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1224    /// 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.
1225    pub message: Option<String>,
1226}
1227
1228impl common::Part for Status {}
1229
1230/// Stop Airflow Command request.
1231///
1232/// # Activities
1233///
1234/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1235/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1236///
1237/// * [locations environments stop airflow command projects](ProjectLocationEnvironmentStopAirflowCommandCall) (request)
1238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1239#[serde_with::serde_as]
1240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1241pub struct StopAirflowCommandRequest {
1242    /// The unique ID of the command execution.
1243    #[serde(rename = "executionId")]
1244    pub execution_id: Option<String>,
1245    /// If true, the execution is terminated forcefully (SIGKILL). If false, the execution is stopped gracefully, giving it time for cleanup.
1246    pub force: Option<bool>,
1247    /// The name of the pod where the command is executed.
1248    pub pod: Option<String>,
1249    /// The namespace of the pod where the command is executed.
1250    #[serde(rename = "podNamespace")]
1251    pub pod_namespace: Option<String>,
1252}
1253
1254impl common::RequestValue for StopAirflowCommandRequest {}
1255
1256/// Response to StopAirflowCommandRequest.
1257///
1258/// # Activities
1259///
1260/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1261/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1262///
1263/// * [locations environments stop airflow command projects](ProjectLocationEnvironmentStopAirflowCommandCall) (response)
1264#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1265#[serde_with::serde_as]
1266#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1267pub struct StopAirflowCommandResponse {
1268    /// Whether the execution is still running.
1269    #[serde(rename = "isDone")]
1270    pub is_done: Option<bool>,
1271    /// Output message from stopping execution request.
1272    pub output: Option<Vec<String>>,
1273}
1274
1275impl common::ResponseResult for StopAirflowCommandResponse {}
1276
1277/// The configuration for data storage in the environment.
1278///
1279/// This type is not used in any activity, and only used as *part* of another schema.
1280///
1281#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1282#[serde_with::serde_as]
1283#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1284pub struct StorageConfig {
1285    /// Optional. The name of the Cloud Storage bucket used by the environment. No `gs://` prefix.
1286    pub bucket: Option<String>,
1287}
1288
1289impl common::Part for StorageConfig {}
1290
1291/// The configuration setting for Task Logs.
1292///
1293/// This type is not used in any activity, and only used as *part* of another schema.
1294///
1295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1296#[serde_with::serde_as]
1297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1298pub struct TaskLogsRetentionConfig {
1299    /// Optional. The mode of storage for Airflow workers task logs.
1300    #[serde(rename = "storageMode")]
1301    pub storage_mode: Option<String>,
1302}
1303
1304impl common::Part for TaskLogsRetentionConfig {}
1305
1306/// Configuration for resources used by Airflow triggerers.
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 TriggererResource {
1314    /// Optional. The number of triggerers.
1315    pub count: Option<i32>,
1316    /// Optional. CPU request and limit for a single Airflow triggerer replica.
1317    pub cpu: Option<f32>,
1318    /// Optional. Memory (GB) request and limit for a single Airflow triggerer replica.
1319    #[serde(rename = "memoryGb")]
1320    pub memory_gb: Option<f32>,
1321}
1322
1323impl common::Part for TriggererResource {}
1324
1325/// User workloads ConfigMap used by Airflow tasks that run with Kubernetes executor or KubernetesPodOperator.
1326///
1327/// # Activities
1328///
1329/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1330/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1331///
1332/// * [locations environments user workloads config maps create projects](ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall) (request|response)
1333/// * [locations environments user workloads config maps get projects](ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall) (response)
1334/// * [locations environments user workloads config maps update projects](ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall) (request|response)
1335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1336#[serde_with::serde_as]
1337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1338pub struct UserWorkloadsConfigMap {
1339    /// Optional. The "data" field of Kubernetes ConfigMap, organized in key-value pairs. For details see: https://kubernetes.io/docs/concepts/configuration/configmap/
1340    pub data: Option<HashMap<String, String>>,
1341    /// Identifier. The resource name of the ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1342    pub name: Option<String>,
1343}
1344
1345impl common::RequestValue for UserWorkloadsConfigMap {}
1346impl common::ResponseResult for UserWorkloadsConfigMap {}
1347
1348/// User workloads Secret used by Airflow tasks that run with Kubernetes executor or KubernetesPodOperator.
1349///
1350/// # Activities
1351///
1352/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1353/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1354///
1355/// * [locations environments user workloads secrets create projects](ProjectLocationEnvironmentUserWorkloadsSecretCreateCall) (request|response)
1356/// * [locations environments user workloads secrets get projects](ProjectLocationEnvironmentUserWorkloadsSecretGetCall) (response)
1357/// * [locations environments user workloads secrets update projects](ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall) (request|response)
1358#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1359#[serde_with::serde_as]
1360#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1361pub struct UserWorkloadsSecret {
1362    /// Optional. The "data" field of Kubernetes Secret, organized in key-value pairs, which can contain sensitive values such as a password, a token, or a key. The values for all keys have to be base64-encoded strings. For details see: https://kubernetes.io/docs/concepts/configuration/secret/
1363    pub data: Option<HashMap<String, String>>,
1364    /// Identifier. The resource name of the Secret, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1365    pub name: Option<String>,
1366}
1367
1368impl common::RequestValue for UserWorkloadsSecret {}
1369impl common::ResponseResult for UserWorkloadsSecret {}
1370
1371/// The configuration settings for the Airflow web server App Engine instance. Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*
1372///
1373/// This type is not used in any activity, and only used as *part* of another schema.
1374///
1375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1376#[serde_with::serde_as]
1377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1378pub struct WebServerConfig {
1379    /// Optional. Machine type on which Airflow web server is running. It has to be one of: composer-n1-webserver-2, composer-n1-webserver-4 or composer-n1-webserver-8. If not specified, composer-n1-webserver-2 will be used. Value custom is returned only in response, if Airflow web server parameters were manually changed to a non-standard values.
1380    #[serde(rename = "machineType")]
1381    pub machine_type: Option<String>,
1382}
1383
1384impl common::Part for WebServerConfig {}
1385
1386/// Network-level access control policy for the Airflow web server.
1387///
1388/// This type is not used in any activity, and only used as *part* of another schema.
1389///
1390#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1391#[serde_with::serde_as]
1392#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1393pub struct WebServerNetworkAccessControl {
1394    /// A collection of allowed IP ranges with descriptions.
1395    #[serde(rename = "allowedIpRanges")]
1396    pub allowed_ip_ranges: Option<Vec<AllowedIpRange>>,
1397}
1398
1399impl common::Part for WebServerNetworkAccessControl {}
1400
1401/// Configuration for resources used by Airflow web server.
1402///
1403/// This type is not used in any activity, and only used as *part* of another schema.
1404///
1405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1406#[serde_with::serde_as]
1407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1408pub struct WebServerResource {
1409    /// Optional. CPU request and limit for Airflow web server.
1410    pub cpu: Option<f32>,
1411    /// Optional. Memory (GB) request and limit for Airflow web server.
1412    #[serde(rename = "memoryGb")]
1413    pub memory_gb: Option<f32>,
1414    /// Optional. Storage (GB) request and limit for Airflow web server.
1415    #[serde(rename = "storageGb")]
1416    pub storage_gb: Option<f32>,
1417}
1418
1419impl common::Part for WebServerResource {}
1420
1421/// Configuration for resources used by Airflow workers.
1422///
1423/// This type is not used in any activity, and only used as *part* of another schema.
1424///
1425#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1426#[serde_with::serde_as]
1427#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1428pub struct WorkerResource {
1429    /// Optional. CPU request and limit for a single Airflow worker replica.
1430    pub cpu: Option<f32>,
1431    /// Optional. Maximum number of workers for autoscaling.
1432    #[serde(rename = "maxCount")]
1433    pub max_count: Option<i32>,
1434    /// Optional. Memory (GB) request and limit for a single Airflow worker replica.
1435    #[serde(rename = "memoryGb")]
1436    pub memory_gb: Option<f32>,
1437    /// Optional. Minimum number of workers for autoscaling.
1438    #[serde(rename = "minCount")]
1439    pub min_count: Option<i32>,
1440    /// Optional. Storage (GB) request and limit for a single Airflow worker replica.
1441    #[serde(rename = "storageGb")]
1442    pub storage_gb: Option<f32>,
1443}
1444
1445impl common::Part for WorkerResource {}
1446
1447/// The Kubernetes workloads configuration for GKE cluster associated with the Cloud Composer environment. Supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
1448///
1449/// This type is not used in any activity, and only used as *part* of another schema.
1450///
1451#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1452#[serde_with::serde_as]
1453#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1454pub struct WorkloadsConfig {
1455    /// Optional. Resources used by Airflow DAG processors. This field is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1456    #[serde(rename = "dagProcessor")]
1457    pub dag_processor: Option<DagProcessorResource>,
1458    /// Optional. Resources used by Airflow schedulers.
1459    pub scheduler: Option<SchedulerResource>,
1460    /// Optional. Resources used by Airflow triggerers.
1461    pub triggerer: Option<TriggererResource>,
1462    /// Optional. Resources used by Airflow web server.
1463    #[serde(rename = "webServer")]
1464    pub web_server: Option<WebServerResource>,
1465    /// Optional. Resources used by Airflow workers.
1466    pub worker: Option<WorkerResource>,
1467}
1468
1469impl common::Part for WorkloadsConfig {}
1470
1471// ###################
1472// MethodBuilders ###
1473// #################
1474
1475/// A builder providing access to all methods supported on *project* resources.
1476/// It is not used directly, but through the [`CloudComposer`] hub.
1477///
1478/// # Example
1479///
1480/// Instantiate a resource builder
1481///
1482/// ```test_harness,no_run
1483/// extern crate hyper;
1484/// extern crate hyper_rustls;
1485/// extern crate google_composer1 as composer1;
1486///
1487/// # async fn dox() {
1488/// use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1489///
1490/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1491/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
1492///     secret,
1493///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1494/// ).build().await.unwrap();
1495///
1496/// let client = hyper_util::client::legacy::Client::builder(
1497///     hyper_util::rt::TokioExecutor::new()
1498/// )
1499/// .build(
1500///     hyper_rustls::HttpsConnectorBuilder::new()
1501///         .with_native_roots()
1502///         .unwrap()
1503///         .https_or_http()
1504///         .enable_http1()
1505///         .build()
1506/// );
1507/// let mut hub = CloudComposer::new(client, auth);
1508/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1509/// // like `locations_environments_check_upgrade(...)`, `locations_environments_create(...)`, `locations_environments_database_failover(...)`, `locations_environments_delete(...)`, `locations_environments_execute_airflow_command(...)`, `locations_environments_fetch_database_properties(...)`, `locations_environments_get(...)`, `locations_environments_list(...)`, `locations_environments_load_snapshot(...)`, `locations_environments_patch(...)`, `locations_environments_poll_airflow_command(...)`, `locations_environments_save_snapshot(...)`, `locations_environments_stop_airflow_command(...)`, `locations_environments_user_workloads_config_maps_create(...)`, `locations_environments_user_workloads_config_maps_delete(...)`, `locations_environments_user_workloads_config_maps_get(...)`, `locations_environments_user_workloads_config_maps_list(...)`, `locations_environments_user_workloads_config_maps_update(...)`, `locations_environments_user_workloads_secrets_create(...)`, `locations_environments_user_workloads_secrets_delete(...)`, `locations_environments_user_workloads_secrets_get(...)`, `locations_environments_user_workloads_secrets_list(...)`, `locations_environments_user_workloads_secrets_update(...)`, `locations_environments_workloads_list(...)`, `locations_image_versions_list(...)`, `locations_operations_delete(...)`, `locations_operations_get(...)` and `locations_operations_list(...)`
1510/// // to build up your call.
1511/// let rb = hub.projects();
1512/// # }
1513/// ```
1514pub struct ProjectMethods<'a, C>
1515where
1516    C: 'a,
1517{
1518    hub: &'a CloudComposer<C>,
1519}
1520
1521impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1522
1523impl<'a, C> ProjectMethods<'a, C> {
1524    /// Create a builder to help you perform the following task:
1525    ///
1526    /// Creates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1527    ///
1528    /// # Arguments
1529    ///
1530    /// * `request` - No description provided.
1531    /// * `parent` - Required. The environment name to create a ConfigMap for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1532    pub fn locations_environments_user_workloads_config_maps_create(
1533        &self,
1534        request: UserWorkloadsConfigMap,
1535        parent: &str,
1536    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
1537        ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall {
1538            hub: self.hub,
1539            _request: request,
1540            _parent: parent.to_string(),
1541            _delegate: Default::default(),
1542            _additional_params: Default::default(),
1543            _scopes: Default::default(),
1544        }
1545    }
1546
1547    /// Create a builder to help you perform the following task:
1548    ///
1549    /// Deletes a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1550    ///
1551    /// # Arguments
1552    ///
1553    /// * `name` - Required. The ConfigMap to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1554    pub fn locations_environments_user_workloads_config_maps_delete(
1555        &self,
1556        name: &str,
1557    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
1558        ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall {
1559            hub: self.hub,
1560            _name: name.to_string(),
1561            _delegate: Default::default(),
1562            _additional_params: Default::default(),
1563            _scopes: Default::default(),
1564        }
1565    }
1566
1567    /// Create a builder to help you perform the following task:
1568    ///
1569    /// Gets an existing user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1570    ///
1571    /// # Arguments
1572    ///
1573    /// * `name` - Required. The resource name of the ConfigMap to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1574    pub fn locations_environments_user_workloads_config_maps_get(
1575        &self,
1576        name: &str,
1577    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
1578        ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall {
1579            hub: self.hub,
1580            _name: name.to_string(),
1581            _delegate: Default::default(),
1582            _additional_params: Default::default(),
1583            _scopes: Default::default(),
1584        }
1585    }
1586
1587    /// Create a builder to help you perform the following task:
1588    ///
1589    /// Lists user workloads ConfigMaps. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1590    ///
1591    /// # Arguments
1592    ///
1593    /// * `parent` - Required. List ConfigMaps in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1594    pub fn locations_environments_user_workloads_config_maps_list(
1595        &self,
1596        parent: &str,
1597    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
1598        ProjectLocationEnvironmentUserWorkloadsConfigMapListCall {
1599            hub: self.hub,
1600            _parent: parent.to_string(),
1601            _page_token: Default::default(),
1602            _page_size: Default::default(),
1603            _delegate: Default::default(),
1604            _additional_params: Default::default(),
1605            _scopes: Default::default(),
1606        }
1607    }
1608
1609    /// Create a builder to help you perform the following task:
1610    ///
1611    /// Updates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1612    ///
1613    /// # Arguments
1614    ///
1615    /// * `request` - No description provided.
1616    /// * `name` - Identifier. The resource name of the ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1617    pub fn locations_environments_user_workloads_config_maps_update(
1618        &self,
1619        request: UserWorkloadsConfigMap,
1620        name: &str,
1621    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
1622        ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall {
1623            hub: self.hub,
1624            _request: request,
1625            _name: name.to_string(),
1626            _delegate: Default::default(),
1627            _additional_params: Default::default(),
1628            _scopes: Default::default(),
1629        }
1630    }
1631
1632    /// Create a builder to help you perform the following task:
1633    ///
1634    /// Creates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1635    ///
1636    /// # Arguments
1637    ///
1638    /// * `request` - No description provided.
1639    /// * `parent` - Required. The environment name to create a Secret for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1640    pub fn locations_environments_user_workloads_secrets_create(
1641        &self,
1642        request: UserWorkloadsSecret,
1643        parent: &str,
1644    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
1645        ProjectLocationEnvironmentUserWorkloadsSecretCreateCall {
1646            hub: self.hub,
1647            _request: request,
1648            _parent: parent.to_string(),
1649            _delegate: Default::default(),
1650            _additional_params: Default::default(),
1651            _scopes: Default::default(),
1652        }
1653    }
1654
1655    /// Create a builder to help you perform the following task:
1656    ///
1657    /// Deletes a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1658    ///
1659    /// # Arguments
1660    ///
1661    /// * `name` - Required. The Secret to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1662    pub fn locations_environments_user_workloads_secrets_delete(
1663        &self,
1664        name: &str,
1665    ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
1666        ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall {
1667            hub: self.hub,
1668            _name: name.to_string(),
1669            _delegate: Default::default(),
1670            _additional_params: Default::default(),
1671            _scopes: Default::default(),
1672        }
1673    }
1674
1675    /// Create a builder to help you perform the following task:
1676    ///
1677    /// Gets an existing user workloads Secret. Values of the "data" field in the response are cleared. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1678    ///
1679    /// # Arguments
1680    ///
1681    /// * `name` - Required. The resource name of the Secret to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1682    pub fn locations_environments_user_workloads_secrets_get(
1683        &self,
1684        name: &str,
1685    ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
1686        ProjectLocationEnvironmentUserWorkloadsSecretGetCall {
1687            hub: self.hub,
1688            _name: name.to_string(),
1689            _delegate: Default::default(),
1690            _additional_params: Default::default(),
1691            _scopes: Default::default(),
1692        }
1693    }
1694
1695    /// Create a builder to help you perform the following task:
1696    ///
1697    /// Lists user workloads Secrets. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1698    ///
1699    /// # Arguments
1700    ///
1701    /// * `parent` - Required. List Secrets in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1702    pub fn locations_environments_user_workloads_secrets_list(
1703        &self,
1704        parent: &str,
1705    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
1706        ProjectLocationEnvironmentUserWorkloadsSecretListCall {
1707            hub: self.hub,
1708            _parent: parent.to_string(),
1709            _page_token: Default::default(),
1710            _page_size: Default::default(),
1711            _delegate: Default::default(),
1712            _additional_params: Default::default(),
1713            _scopes: Default::default(),
1714        }
1715    }
1716
1717    /// Create a builder to help you perform the following task:
1718    ///
1719    /// Updates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1720    ///
1721    /// # Arguments
1722    ///
1723    /// * `request` - No description provided.
1724    /// * `name` - Identifier. The resource name of the Secret, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1725    pub fn locations_environments_user_workloads_secrets_update(
1726        &self,
1727        request: UserWorkloadsSecret,
1728        name: &str,
1729    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
1730        ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall {
1731            hub: self.hub,
1732            _request: request,
1733            _name: name.to_string(),
1734            _delegate: Default::default(),
1735            _additional_params: Default::default(),
1736            _scopes: Default::default(),
1737        }
1738    }
1739
1740    /// Create a builder to help you perform the following task:
1741    ///
1742    /// Lists workloads in a Cloud Composer environment. Workload is a unit that runs a single Composer component. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
1743    ///
1744    /// # Arguments
1745    ///
1746    /// * `parent` - Required. The environment name to get workloads for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1747    pub fn locations_environments_workloads_list(
1748        &self,
1749        parent: &str,
1750    ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
1751        ProjectLocationEnvironmentWorkloadListCall {
1752            hub: self.hub,
1753            _parent: parent.to_string(),
1754            _page_token: Default::default(),
1755            _page_size: Default::default(),
1756            _filter: Default::default(),
1757            _delegate: Default::default(),
1758            _additional_params: Default::default(),
1759            _scopes: Default::default(),
1760        }
1761    }
1762
1763    /// Create a builder to help you perform the following task:
1764    ///
1765    /// Check if an upgrade operation on the environment will succeed. In case of problems detailed info can be found in the returned Operation.
1766    ///
1767    /// # Arguments
1768    ///
1769    /// * `request` - No description provided.
1770    /// * `environment` - Required. The resource name of the environment to check upgrade for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1771    pub fn locations_environments_check_upgrade(
1772        &self,
1773        request: CheckUpgradeRequest,
1774        environment: &str,
1775    ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
1776        ProjectLocationEnvironmentCheckUpgradeCall {
1777            hub: self.hub,
1778            _request: request,
1779            _environment: environment.to_string(),
1780            _delegate: Default::default(),
1781            _additional_params: Default::default(),
1782            _scopes: Default::default(),
1783        }
1784    }
1785
1786    /// Create a builder to help you perform the following task:
1787    ///
1788    /// Create a new environment.
1789    ///
1790    /// # Arguments
1791    ///
1792    /// * `request` - No description provided.
1793    /// * `parent` - The parent must be of the form "projects/{projectId}/locations/{locationId}".
1794    pub fn locations_environments_create(
1795        &self,
1796        request: Environment,
1797        parent: &str,
1798    ) -> ProjectLocationEnvironmentCreateCall<'a, C> {
1799        ProjectLocationEnvironmentCreateCall {
1800            hub: self.hub,
1801            _request: request,
1802            _parent: parent.to_string(),
1803            _delegate: Default::default(),
1804            _additional_params: Default::default(),
1805            _scopes: Default::default(),
1806        }
1807    }
1808
1809    /// Create a builder to help you perform the following task:
1810    ///
1811    /// Triggers database failover (only for highly resilient environments).
1812    ///
1813    /// # Arguments
1814    ///
1815    /// * `request` - No description provided.
1816    /// * `environment` - Target environment: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1817    pub fn locations_environments_database_failover(
1818        &self,
1819        request: DatabaseFailoverRequest,
1820        environment: &str,
1821    ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
1822        ProjectLocationEnvironmentDatabaseFailoverCall {
1823            hub: self.hub,
1824            _request: request,
1825            _environment: environment.to_string(),
1826            _delegate: Default::default(),
1827            _additional_params: Default::default(),
1828            _scopes: Default::default(),
1829        }
1830    }
1831
1832    /// Create a builder to help you perform the following task:
1833    ///
1834    /// Delete an environment.
1835    ///
1836    /// # Arguments
1837    ///
1838    /// * `name` - The environment to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1839    pub fn locations_environments_delete(
1840        &self,
1841        name: &str,
1842    ) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
1843        ProjectLocationEnvironmentDeleteCall {
1844            hub: self.hub,
1845            _name: name.to_string(),
1846            _delegate: Default::default(),
1847            _additional_params: Default::default(),
1848            _scopes: Default::default(),
1849        }
1850    }
1851
1852    /// Create a builder to help you perform the following task:
1853    ///
1854    /// Executes Airflow CLI command.
1855    ///
1856    /// # Arguments
1857    ///
1858    /// * `request` - No description provided.
1859    /// * `environment` - The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
1860    pub fn locations_environments_execute_airflow_command(
1861        &self,
1862        request: ExecuteAirflowCommandRequest,
1863        environment: &str,
1864    ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
1865        ProjectLocationEnvironmentExecuteAirflowCommandCall {
1866            hub: self.hub,
1867            _request: request,
1868            _environment: environment.to_string(),
1869            _delegate: Default::default(),
1870            _additional_params: Default::default(),
1871            _scopes: Default::default(),
1872        }
1873    }
1874
1875    /// Create a builder to help you perform the following task:
1876    ///
1877    /// Fetches database properties.
1878    ///
1879    /// # Arguments
1880    ///
1881    /// * `environment` - Required. The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1882    pub fn locations_environments_fetch_database_properties(
1883        &self,
1884        environment: &str,
1885    ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
1886        ProjectLocationEnvironmentFetchDatabasePropertyCall {
1887            hub: self.hub,
1888            _environment: environment.to_string(),
1889            _delegate: Default::default(),
1890            _additional_params: Default::default(),
1891            _scopes: Default::default(),
1892        }
1893    }
1894
1895    /// Create a builder to help you perform the following task:
1896    ///
1897    /// Get an existing environment.
1898    ///
1899    /// # Arguments
1900    ///
1901    /// * `name` - The resource name of the environment to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1902    pub fn locations_environments_get(
1903        &self,
1904        name: &str,
1905    ) -> ProjectLocationEnvironmentGetCall<'a, C> {
1906        ProjectLocationEnvironmentGetCall {
1907            hub: self.hub,
1908            _name: name.to_string(),
1909            _delegate: Default::default(),
1910            _additional_params: Default::default(),
1911            _scopes: Default::default(),
1912        }
1913    }
1914
1915    /// Create a builder to help you perform the following task:
1916    ///
1917    /// List environments.
1918    ///
1919    /// # Arguments
1920    ///
1921    /// * `parent` - List environments in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
1922    pub fn locations_environments_list(
1923        &self,
1924        parent: &str,
1925    ) -> ProjectLocationEnvironmentListCall<'a, C> {
1926        ProjectLocationEnvironmentListCall {
1927            hub: self.hub,
1928            _parent: parent.to_string(),
1929            _page_token: Default::default(),
1930            _page_size: Default::default(),
1931            _delegate: Default::default(),
1932            _additional_params: Default::default(),
1933            _scopes: Default::default(),
1934        }
1935    }
1936
1937    /// Create a builder to help you perform the following task:
1938    ///
1939    /// Loads a snapshot of a Cloud Composer environment. As a result of this operation, a snapshot of environment's specified in LoadSnapshotRequest is loaded into the environment.
1940    ///
1941    /// # Arguments
1942    ///
1943    /// * `request` - No description provided.
1944    /// * `environment` - The resource name of the target environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1945    pub fn locations_environments_load_snapshot(
1946        &self,
1947        request: LoadSnapshotRequest,
1948        environment: &str,
1949    ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
1950        ProjectLocationEnvironmentLoadSnapshotCall {
1951            hub: self.hub,
1952            _request: request,
1953            _environment: environment.to_string(),
1954            _delegate: Default::default(),
1955            _additional_params: Default::default(),
1956            _scopes: Default::default(),
1957        }
1958    }
1959
1960    /// Create a builder to help you perform the following task:
1961    ///
1962    /// Update an environment.
1963    ///
1964    /// # Arguments
1965    ///
1966    /// * `request` - No description provided.
1967    /// * `name` - The relative resource name of the environment to update, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1968    pub fn locations_environments_patch(
1969        &self,
1970        request: Environment,
1971        name: &str,
1972    ) -> ProjectLocationEnvironmentPatchCall<'a, C> {
1973        ProjectLocationEnvironmentPatchCall {
1974            hub: self.hub,
1975            _request: request,
1976            _name: name.to_string(),
1977            _update_mask: Default::default(),
1978            _delegate: Default::default(),
1979            _additional_params: Default::default(),
1980            _scopes: Default::default(),
1981        }
1982    }
1983
1984    /// Create a builder to help you perform the following task:
1985    ///
1986    /// Polls Airflow CLI command execution and fetches logs.
1987    ///
1988    /// # Arguments
1989    ///
1990    /// * `request` - No description provided.
1991    /// * `environment` - The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1992    pub fn locations_environments_poll_airflow_command(
1993        &self,
1994        request: PollAirflowCommandRequest,
1995        environment: &str,
1996    ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
1997        ProjectLocationEnvironmentPollAirflowCommandCall {
1998            hub: self.hub,
1999            _request: request,
2000            _environment: environment.to_string(),
2001            _delegate: Default::default(),
2002            _additional_params: Default::default(),
2003            _scopes: Default::default(),
2004        }
2005    }
2006
2007    /// Create a builder to help you perform the following task:
2008    ///
2009    /// Creates a snapshots of a Cloud Composer environment. As a result of this operation, snapshot of environment's state is stored in a location specified in the SaveSnapshotRequest.
2010    ///
2011    /// # Arguments
2012    ///
2013    /// * `request` - No description provided.
2014    /// * `environment` - The resource name of the source environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
2015    pub fn locations_environments_save_snapshot(
2016        &self,
2017        request: SaveSnapshotRequest,
2018        environment: &str,
2019    ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
2020        ProjectLocationEnvironmentSaveSnapshotCall {
2021            hub: self.hub,
2022            _request: request,
2023            _environment: environment.to_string(),
2024            _delegate: Default::default(),
2025            _additional_params: Default::default(),
2026            _scopes: Default::default(),
2027        }
2028    }
2029
2030    /// Create a builder to help you perform the following task:
2031    ///
2032    /// Stops Airflow CLI command execution.
2033    ///
2034    /// # Arguments
2035    ///
2036    /// * `request` - No description provided.
2037    /// * `environment` - The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
2038    pub fn locations_environments_stop_airflow_command(
2039        &self,
2040        request: StopAirflowCommandRequest,
2041        environment: &str,
2042    ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
2043        ProjectLocationEnvironmentStopAirflowCommandCall {
2044            hub: self.hub,
2045            _request: request,
2046            _environment: environment.to_string(),
2047            _delegate: Default::default(),
2048            _additional_params: Default::default(),
2049            _scopes: Default::default(),
2050        }
2051    }
2052
2053    /// Create a builder to help you perform the following task:
2054    ///
2055    /// List ImageVersions for provided location.
2056    ///
2057    /// # Arguments
2058    ///
2059    /// * `parent` - List ImageVersions in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
2060    pub fn locations_image_versions_list(
2061        &self,
2062        parent: &str,
2063    ) -> ProjectLocationImageVersionListCall<'a, C> {
2064        ProjectLocationImageVersionListCall {
2065            hub: self.hub,
2066            _parent: parent.to_string(),
2067            _page_token: Default::default(),
2068            _page_size: Default::default(),
2069            _include_past_releases: Default::default(),
2070            _delegate: Default::default(),
2071            _additional_params: Default::default(),
2072            _scopes: Default::default(),
2073        }
2074    }
2075
2076    /// Create a builder to help you perform the following task:
2077    ///
2078    /// 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`.
2079    ///
2080    /// # Arguments
2081    ///
2082    /// * `name` - The name of the operation resource to be deleted.
2083    pub fn locations_operations_delete(
2084        &self,
2085        name: &str,
2086    ) -> ProjectLocationOperationDeleteCall<'a, C> {
2087        ProjectLocationOperationDeleteCall {
2088            hub: self.hub,
2089            _name: name.to_string(),
2090            _delegate: Default::default(),
2091            _additional_params: Default::default(),
2092            _scopes: Default::default(),
2093        }
2094    }
2095
2096    /// Create a builder to help you perform the following task:
2097    ///
2098    /// 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.
2099    ///
2100    /// # Arguments
2101    ///
2102    /// * `name` - The name of the operation resource.
2103    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2104        ProjectLocationOperationGetCall {
2105            hub: self.hub,
2106            _name: name.to_string(),
2107            _delegate: Default::default(),
2108            _additional_params: Default::default(),
2109            _scopes: Default::default(),
2110        }
2111    }
2112
2113    /// Create a builder to help you perform the following task:
2114    ///
2115    /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2116    ///
2117    /// # Arguments
2118    ///
2119    /// * `name` - The name of the operation's parent resource.
2120    pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2121        ProjectLocationOperationListCall {
2122            hub: self.hub,
2123            _name: name.to_string(),
2124            _page_token: Default::default(),
2125            _page_size: Default::default(),
2126            _filter: Default::default(),
2127            _delegate: Default::default(),
2128            _additional_params: Default::default(),
2129            _scopes: Default::default(),
2130        }
2131    }
2132}
2133
2134// ###################
2135// CallBuilders   ###
2136// #################
2137
2138/// Creates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
2139///
2140/// A builder for the *locations.environments.userWorkloadsConfigMaps.create* method supported by a *project* resource.
2141/// It is not used directly, but through a [`ProjectMethods`] instance.
2142///
2143/// # Example
2144///
2145/// Instantiate a resource method builder
2146///
2147/// ```test_harness,no_run
2148/// # extern crate hyper;
2149/// # extern crate hyper_rustls;
2150/// # extern crate google_composer1 as composer1;
2151/// use composer1::api::UserWorkloadsConfigMap;
2152/// # async fn dox() {
2153/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2154///
2155/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2156/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2157/// #     secret,
2158/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2159/// # ).build().await.unwrap();
2160///
2161/// # let client = hyper_util::client::legacy::Client::builder(
2162/// #     hyper_util::rt::TokioExecutor::new()
2163/// # )
2164/// # .build(
2165/// #     hyper_rustls::HttpsConnectorBuilder::new()
2166/// #         .with_native_roots()
2167/// #         .unwrap()
2168/// #         .https_or_http()
2169/// #         .enable_http1()
2170/// #         .build()
2171/// # );
2172/// # let mut hub = CloudComposer::new(client, auth);
2173/// // As the method needs a request, you would usually fill it with the desired information
2174/// // into the respective structure. Some of the parts shown here might not be applicable !
2175/// // Values shown here are possibly random and not representative !
2176/// let mut req = UserWorkloadsConfigMap::default();
2177///
2178/// // You can configure optional parameters by calling the respective setters at will, and
2179/// // execute the final call using `doit()`.
2180/// // Values shown here are possibly random and not representative !
2181/// let result = hub.projects().locations_environments_user_workloads_config_maps_create(req, "parent")
2182///              .doit().await;
2183/// # }
2184/// ```
2185pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2186where
2187    C: 'a,
2188{
2189    hub: &'a CloudComposer<C>,
2190    _request: UserWorkloadsConfigMap,
2191    _parent: String,
2192    _delegate: Option<&'a mut dyn common::Delegate>,
2193    _additional_params: HashMap<String, String>,
2194    _scopes: BTreeSet<String>,
2195}
2196
2197impl<'a, C> common::CallBuilder
2198    for ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2199{
2200}
2201
2202impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2203where
2204    C: common::Connector,
2205{
2206    /// Perform the operation you have build so far.
2207    pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsConfigMap)> {
2208        use std::borrow::Cow;
2209        use std::io::{Read, Seek};
2210
2211        use common::{url::Params, ToParts};
2212        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2213
2214        let mut dd = common::DefaultDelegate;
2215        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2216        dlg.begin(common::MethodInfo {
2217            id: "composer.projects.locations.environments.userWorkloadsConfigMaps.create",
2218            http_method: hyper::Method::POST,
2219        });
2220
2221        for &field in ["alt", "parent"].iter() {
2222            if self._additional_params.contains_key(field) {
2223                dlg.finished(false);
2224                return Err(common::Error::FieldClash(field));
2225            }
2226        }
2227
2228        let mut params = Params::with_capacity(4 + self._additional_params.len());
2229        params.push("parent", self._parent);
2230
2231        params.extend(self._additional_params.iter());
2232
2233        params.push("alt", "json");
2234        let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsConfigMaps";
2235        if self._scopes.is_empty() {
2236            self._scopes
2237                .insert(Scope::CloudPlatform.as_ref().to_string());
2238        }
2239
2240        #[allow(clippy::single_element_loop)]
2241        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2242            url = params.uri_replacement(url, param_name, find_this, true);
2243        }
2244        {
2245            let to_remove = ["parent"];
2246            params.remove_params(&to_remove);
2247        }
2248
2249        let url = params.parse_with_url(&url);
2250
2251        let mut json_mime_type = mime::APPLICATION_JSON;
2252        let mut request_value_reader = {
2253            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2254            common::remove_json_null_values(&mut value);
2255            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2256            serde_json::to_writer(&mut dst, &value).unwrap();
2257            dst
2258        };
2259        let request_size = request_value_reader
2260            .seek(std::io::SeekFrom::End(0))
2261            .unwrap();
2262        request_value_reader
2263            .seek(std::io::SeekFrom::Start(0))
2264            .unwrap();
2265
2266        loop {
2267            let token = match self
2268                .hub
2269                .auth
2270                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2271                .await
2272            {
2273                Ok(token) => token,
2274                Err(e) => match dlg.token(e) {
2275                    Ok(token) => token,
2276                    Err(e) => {
2277                        dlg.finished(false);
2278                        return Err(common::Error::MissingToken(e));
2279                    }
2280                },
2281            };
2282            request_value_reader
2283                .seek(std::io::SeekFrom::Start(0))
2284                .unwrap();
2285            let mut req_result = {
2286                let client = &self.hub.client;
2287                dlg.pre_request();
2288                let mut req_builder = hyper::Request::builder()
2289                    .method(hyper::Method::POST)
2290                    .uri(url.as_str())
2291                    .header(USER_AGENT, self.hub._user_agent.clone());
2292
2293                if let Some(token) = token.as_ref() {
2294                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2295                }
2296
2297                let request = req_builder
2298                    .header(CONTENT_TYPE, json_mime_type.to_string())
2299                    .header(CONTENT_LENGTH, request_size as u64)
2300                    .body(common::to_body(
2301                        request_value_reader.get_ref().clone().into(),
2302                    ));
2303
2304                client.request(request.unwrap()).await
2305            };
2306
2307            match req_result {
2308                Err(err) => {
2309                    if let common::Retry::After(d) = dlg.http_error(&err) {
2310                        sleep(d).await;
2311                        continue;
2312                    }
2313                    dlg.finished(false);
2314                    return Err(common::Error::HttpError(err));
2315                }
2316                Ok(res) => {
2317                    let (mut parts, body) = res.into_parts();
2318                    let mut body = common::Body::new(body);
2319                    if !parts.status.is_success() {
2320                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2321                        let error = serde_json::from_str(&common::to_string(&bytes));
2322                        let response = common::to_response(parts, bytes.into());
2323
2324                        if let common::Retry::After(d) =
2325                            dlg.http_failure(&response, error.as_ref().ok())
2326                        {
2327                            sleep(d).await;
2328                            continue;
2329                        }
2330
2331                        dlg.finished(false);
2332
2333                        return Err(match error {
2334                            Ok(value) => common::Error::BadRequest(value),
2335                            _ => common::Error::Failure(response),
2336                        });
2337                    }
2338                    let response = {
2339                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2340                        let encoded = common::to_string(&bytes);
2341                        match serde_json::from_str(&encoded) {
2342                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2343                            Err(error) => {
2344                                dlg.response_json_decode_error(&encoded, &error);
2345                                return Err(common::Error::JsonDecodeError(
2346                                    encoded.to_string(),
2347                                    error,
2348                                ));
2349                            }
2350                        }
2351                    };
2352
2353                    dlg.finished(true);
2354                    return Ok(response);
2355                }
2356            }
2357        }
2358    }
2359
2360    ///
2361    /// Sets the *request* property to the given value.
2362    ///
2363    /// Even though the property as already been set when instantiating this call,
2364    /// we provide this method for API completeness.
2365    pub fn request(
2366        mut self,
2367        new_value: UserWorkloadsConfigMap,
2368    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2369        self._request = new_value;
2370        self
2371    }
2372    /// Required. The environment name to create a ConfigMap for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
2373    ///
2374    /// Sets the *parent* path property to the given value.
2375    ///
2376    /// Even though the property as already been set when instantiating this call,
2377    /// we provide this method for API completeness.
2378    pub fn parent(
2379        mut self,
2380        new_value: &str,
2381    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2382        self._parent = new_value.to_string();
2383        self
2384    }
2385    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2386    /// while executing the actual API request.
2387    ///
2388    /// ````text
2389    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2390    /// ````
2391    ///
2392    /// Sets the *delegate* property to the given value.
2393    pub fn delegate(
2394        mut self,
2395        new_value: &'a mut dyn common::Delegate,
2396    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2397        self._delegate = Some(new_value);
2398        self
2399    }
2400
2401    /// Set any additional parameter of the query string used in the request.
2402    /// It should be used to set parameters which are not yet available through their own
2403    /// setters.
2404    ///
2405    /// Please note that this method must not be used to set any of the known parameters
2406    /// which have their own setter method. If done anyway, the request will fail.
2407    ///
2408    /// # Additional Parameters
2409    ///
2410    /// * *$.xgafv* (query-string) - V1 error format.
2411    /// * *access_token* (query-string) - OAuth access token.
2412    /// * *alt* (query-string) - Data format for response.
2413    /// * *callback* (query-string) - JSONP
2414    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2415    /// * *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.
2416    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2417    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2418    /// * *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.
2419    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2420    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2421    pub fn param<T>(
2422        mut self,
2423        name: T,
2424        value: T,
2425    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2426    where
2427        T: AsRef<str>,
2428    {
2429        self._additional_params
2430            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2431        self
2432    }
2433
2434    /// Identifies the authorization scope for the method you are building.
2435    ///
2436    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2437    /// [`Scope::CloudPlatform`].
2438    ///
2439    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2440    /// tokens for more than one scope.
2441    ///
2442    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2443    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2444    /// sufficient, a read-write scope will do as well.
2445    pub fn add_scope<St>(
2446        mut self,
2447        scope: St,
2448    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2449    where
2450        St: AsRef<str>,
2451    {
2452        self._scopes.insert(String::from(scope.as_ref()));
2453        self
2454    }
2455    /// Identifies the authorization scope(s) for the method you are building.
2456    ///
2457    /// See [`Self::add_scope()`] for details.
2458    pub fn add_scopes<I, St>(
2459        mut self,
2460        scopes: I,
2461    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2462    where
2463        I: IntoIterator<Item = St>,
2464        St: AsRef<str>,
2465    {
2466        self._scopes
2467            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2468        self
2469    }
2470
2471    /// Removes all scopes, and no default scope will be used either.
2472    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2473    /// for details).
2474    pub fn clear_scopes(
2475        mut self,
2476    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2477        self._scopes.clear();
2478        self
2479    }
2480}
2481
2482/// Deletes a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
2483///
2484/// A builder for the *locations.environments.userWorkloadsConfigMaps.delete* method supported by a *project* resource.
2485/// It is not used directly, but through a [`ProjectMethods`] instance.
2486///
2487/// # Example
2488///
2489/// Instantiate a resource method builder
2490///
2491/// ```test_harness,no_run
2492/// # extern crate hyper;
2493/// # extern crate hyper_rustls;
2494/// # extern crate google_composer1 as composer1;
2495/// # async fn dox() {
2496/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2497///
2498/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2499/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2500/// #     secret,
2501/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2502/// # ).build().await.unwrap();
2503///
2504/// # let client = hyper_util::client::legacy::Client::builder(
2505/// #     hyper_util::rt::TokioExecutor::new()
2506/// # )
2507/// # .build(
2508/// #     hyper_rustls::HttpsConnectorBuilder::new()
2509/// #         .with_native_roots()
2510/// #         .unwrap()
2511/// #         .https_or_http()
2512/// #         .enable_http1()
2513/// #         .build()
2514/// # );
2515/// # let mut hub = CloudComposer::new(client, auth);
2516/// // You can configure optional parameters by calling the respective setters at will, and
2517/// // execute the final call using `doit()`.
2518/// // Values shown here are possibly random and not representative !
2519/// let result = hub.projects().locations_environments_user_workloads_config_maps_delete("name")
2520///              .doit().await;
2521/// # }
2522/// ```
2523pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2524where
2525    C: 'a,
2526{
2527    hub: &'a CloudComposer<C>,
2528    _name: String,
2529    _delegate: Option<&'a mut dyn common::Delegate>,
2530    _additional_params: HashMap<String, String>,
2531    _scopes: BTreeSet<String>,
2532}
2533
2534impl<'a, C> common::CallBuilder
2535    for ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2536{
2537}
2538
2539impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2540where
2541    C: common::Connector,
2542{
2543    /// Perform the operation you have build so far.
2544    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2545        use std::borrow::Cow;
2546        use std::io::{Read, Seek};
2547
2548        use common::{url::Params, ToParts};
2549        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2550
2551        let mut dd = common::DefaultDelegate;
2552        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2553        dlg.begin(common::MethodInfo {
2554            id: "composer.projects.locations.environments.userWorkloadsConfigMaps.delete",
2555            http_method: hyper::Method::DELETE,
2556        });
2557
2558        for &field in ["alt", "name"].iter() {
2559            if self._additional_params.contains_key(field) {
2560                dlg.finished(false);
2561                return Err(common::Error::FieldClash(field));
2562            }
2563        }
2564
2565        let mut params = Params::with_capacity(3 + self._additional_params.len());
2566        params.push("name", self._name);
2567
2568        params.extend(self._additional_params.iter());
2569
2570        params.push("alt", "json");
2571        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2572        if self._scopes.is_empty() {
2573            self._scopes
2574                .insert(Scope::CloudPlatform.as_ref().to_string());
2575        }
2576
2577        #[allow(clippy::single_element_loop)]
2578        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2579            url = params.uri_replacement(url, param_name, find_this, true);
2580        }
2581        {
2582            let to_remove = ["name"];
2583            params.remove_params(&to_remove);
2584        }
2585
2586        let url = params.parse_with_url(&url);
2587
2588        loop {
2589            let token = match self
2590                .hub
2591                .auth
2592                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2593                .await
2594            {
2595                Ok(token) => token,
2596                Err(e) => match dlg.token(e) {
2597                    Ok(token) => token,
2598                    Err(e) => {
2599                        dlg.finished(false);
2600                        return Err(common::Error::MissingToken(e));
2601                    }
2602                },
2603            };
2604            let mut req_result = {
2605                let client = &self.hub.client;
2606                dlg.pre_request();
2607                let mut req_builder = hyper::Request::builder()
2608                    .method(hyper::Method::DELETE)
2609                    .uri(url.as_str())
2610                    .header(USER_AGENT, self.hub._user_agent.clone());
2611
2612                if let Some(token) = token.as_ref() {
2613                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2614                }
2615
2616                let request = req_builder
2617                    .header(CONTENT_LENGTH, 0_u64)
2618                    .body(common::to_body::<String>(None));
2619
2620                client.request(request.unwrap()).await
2621            };
2622
2623            match req_result {
2624                Err(err) => {
2625                    if let common::Retry::After(d) = dlg.http_error(&err) {
2626                        sleep(d).await;
2627                        continue;
2628                    }
2629                    dlg.finished(false);
2630                    return Err(common::Error::HttpError(err));
2631                }
2632                Ok(res) => {
2633                    let (mut parts, body) = res.into_parts();
2634                    let mut body = common::Body::new(body);
2635                    if !parts.status.is_success() {
2636                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2637                        let error = serde_json::from_str(&common::to_string(&bytes));
2638                        let response = common::to_response(parts, bytes.into());
2639
2640                        if let common::Retry::After(d) =
2641                            dlg.http_failure(&response, error.as_ref().ok())
2642                        {
2643                            sleep(d).await;
2644                            continue;
2645                        }
2646
2647                        dlg.finished(false);
2648
2649                        return Err(match error {
2650                            Ok(value) => common::Error::BadRequest(value),
2651                            _ => common::Error::Failure(response),
2652                        });
2653                    }
2654                    let response = {
2655                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2656                        let encoded = common::to_string(&bytes);
2657                        match serde_json::from_str(&encoded) {
2658                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2659                            Err(error) => {
2660                                dlg.response_json_decode_error(&encoded, &error);
2661                                return Err(common::Error::JsonDecodeError(
2662                                    encoded.to_string(),
2663                                    error,
2664                                ));
2665                            }
2666                        }
2667                    };
2668
2669                    dlg.finished(true);
2670                    return Ok(response);
2671                }
2672            }
2673        }
2674    }
2675
2676    /// Required. The ConfigMap to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
2677    ///
2678    /// Sets the *name* path property to the given value.
2679    ///
2680    /// Even though the property as already been set when instantiating this call,
2681    /// we provide this method for API completeness.
2682    pub fn name(
2683        mut self,
2684        new_value: &str,
2685    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
2686        self._name = new_value.to_string();
2687        self
2688    }
2689    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2690    /// while executing the actual API request.
2691    ///
2692    /// ````text
2693    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2694    /// ````
2695    ///
2696    /// Sets the *delegate* property to the given value.
2697    pub fn delegate(
2698        mut self,
2699        new_value: &'a mut dyn common::Delegate,
2700    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
2701        self._delegate = Some(new_value);
2702        self
2703    }
2704
2705    /// Set any additional parameter of the query string used in the request.
2706    /// It should be used to set parameters which are not yet available through their own
2707    /// setters.
2708    ///
2709    /// Please note that this method must not be used to set any of the known parameters
2710    /// which have their own setter method. If done anyway, the request will fail.
2711    ///
2712    /// # Additional Parameters
2713    ///
2714    /// * *$.xgafv* (query-string) - V1 error format.
2715    /// * *access_token* (query-string) - OAuth access token.
2716    /// * *alt* (query-string) - Data format for response.
2717    /// * *callback* (query-string) - JSONP
2718    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2719    /// * *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.
2720    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2721    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2722    /// * *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.
2723    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2724    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2725    pub fn param<T>(
2726        mut self,
2727        name: T,
2728        value: T,
2729    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2730    where
2731        T: AsRef<str>,
2732    {
2733        self._additional_params
2734            .insert(name.as_ref().to_string(), value.as_ref().to_string());
2735        self
2736    }
2737
2738    /// Identifies the authorization scope for the method you are building.
2739    ///
2740    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2741    /// [`Scope::CloudPlatform`].
2742    ///
2743    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2744    /// tokens for more than one scope.
2745    ///
2746    /// Usually there is more than one suitable scope to authorize an operation, some of which may
2747    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2748    /// sufficient, a read-write scope will do as well.
2749    pub fn add_scope<St>(
2750        mut self,
2751        scope: St,
2752    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2753    where
2754        St: AsRef<str>,
2755    {
2756        self._scopes.insert(String::from(scope.as_ref()));
2757        self
2758    }
2759    /// Identifies the authorization scope(s) for the method you are building.
2760    ///
2761    /// See [`Self::add_scope()`] for details.
2762    pub fn add_scopes<I, St>(
2763        mut self,
2764        scopes: I,
2765    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2766    where
2767        I: IntoIterator<Item = St>,
2768        St: AsRef<str>,
2769    {
2770        self._scopes
2771            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2772        self
2773    }
2774
2775    /// Removes all scopes, and no default scope will be used either.
2776    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2777    /// for details).
2778    pub fn clear_scopes(
2779        mut self,
2780    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
2781        self._scopes.clear();
2782        self
2783    }
2784}
2785
2786/// Gets an existing user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
2787///
2788/// A builder for the *locations.environments.userWorkloadsConfigMaps.get* method supported by a *project* resource.
2789/// It is not used directly, but through a [`ProjectMethods`] instance.
2790///
2791/// # Example
2792///
2793/// Instantiate a resource method builder
2794///
2795/// ```test_harness,no_run
2796/// # extern crate hyper;
2797/// # extern crate hyper_rustls;
2798/// # extern crate google_composer1 as composer1;
2799/// # async fn dox() {
2800/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2801///
2802/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2803/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
2804/// #     secret,
2805/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2806/// # ).build().await.unwrap();
2807///
2808/// # let client = hyper_util::client::legacy::Client::builder(
2809/// #     hyper_util::rt::TokioExecutor::new()
2810/// # )
2811/// # .build(
2812/// #     hyper_rustls::HttpsConnectorBuilder::new()
2813/// #         .with_native_roots()
2814/// #         .unwrap()
2815/// #         .https_or_http()
2816/// #         .enable_http1()
2817/// #         .build()
2818/// # );
2819/// # let mut hub = CloudComposer::new(client, auth);
2820/// // You can configure optional parameters by calling the respective setters at will, and
2821/// // execute the final call using `doit()`.
2822/// // Values shown here are possibly random and not representative !
2823/// let result = hub.projects().locations_environments_user_workloads_config_maps_get("name")
2824///              .doit().await;
2825/// # }
2826/// ```
2827pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
2828where
2829    C: 'a,
2830{
2831    hub: &'a CloudComposer<C>,
2832    _name: String,
2833    _delegate: Option<&'a mut dyn common::Delegate>,
2834    _additional_params: HashMap<String, String>,
2835    _scopes: BTreeSet<String>,
2836}
2837
2838impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {}
2839
2840impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
2841where
2842    C: common::Connector,
2843{
2844    /// Perform the operation you have build so far.
2845    pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsConfigMap)> {
2846        use std::borrow::Cow;
2847        use std::io::{Read, Seek};
2848
2849        use common::{url::Params, ToParts};
2850        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2851
2852        let mut dd = common::DefaultDelegate;
2853        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2854        dlg.begin(common::MethodInfo {
2855            id: "composer.projects.locations.environments.userWorkloadsConfigMaps.get",
2856            http_method: hyper::Method::GET,
2857        });
2858
2859        for &field in ["alt", "name"].iter() {
2860            if self._additional_params.contains_key(field) {
2861                dlg.finished(false);
2862                return Err(common::Error::FieldClash(field));
2863            }
2864        }
2865
2866        let mut params = Params::with_capacity(3 + self._additional_params.len());
2867        params.push("name", self._name);
2868
2869        params.extend(self._additional_params.iter());
2870
2871        params.push("alt", "json");
2872        let mut url = self.hub._base_url.clone() + "v1/{+name}";
2873        if self._scopes.is_empty() {
2874            self._scopes
2875                .insert(Scope::CloudPlatform.as_ref().to_string());
2876        }
2877
2878        #[allow(clippy::single_element_loop)]
2879        for &(find_this, param_name) in [("{+name}", "name")].iter() {
2880            url = params.uri_replacement(url, param_name, find_this, true);
2881        }
2882        {
2883            let to_remove = ["name"];
2884            params.remove_params(&to_remove);
2885        }
2886
2887        let url = params.parse_with_url(&url);
2888
2889        loop {
2890            let token = match self
2891                .hub
2892                .auth
2893                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2894                .await
2895            {
2896                Ok(token) => token,
2897                Err(e) => match dlg.token(e) {
2898                    Ok(token) => token,
2899                    Err(e) => {
2900                        dlg.finished(false);
2901                        return Err(common::Error::MissingToken(e));
2902                    }
2903                },
2904            };
2905            let mut req_result = {
2906                let client = &self.hub.client;
2907                dlg.pre_request();
2908                let mut req_builder = hyper::Request::builder()
2909                    .method(hyper::Method::GET)
2910                    .uri(url.as_str())
2911                    .header(USER_AGENT, self.hub._user_agent.clone());
2912
2913                if let Some(token) = token.as_ref() {
2914                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2915                }
2916
2917                let request = req_builder
2918                    .header(CONTENT_LENGTH, 0_u64)
2919                    .body(common::to_body::<String>(None));
2920
2921                client.request(request.unwrap()).await
2922            };
2923
2924            match req_result {
2925                Err(err) => {
2926                    if let common::Retry::After(d) = dlg.http_error(&err) {
2927                        sleep(d).await;
2928                        continue;
2929                    }
2930                    dlg.finished(false);
2931                    return Err(common::Error::HttpError(err));
2932                }
2933                Ok(res) => {
2934                    let (mut parts, body) = res.into_parts();
2935                    let mut body = common::Body::new(body);
2936                    if !parts.status.is_success() {
2937                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2938                        let error = serde_json::from_str(&common::to_string(&bytes));
2939                        let response = common::to_response(parts, bytes.into());
2940
2941                        if let common::Retry::After(d) =
2942                            dlg.http_failure(&response, error.as_ref().ok())
2943                        {
2944                            sleep(d).await;
2945                            continue;
2946                        }
2947
2948                        dlg.finished(false);
2949
2950                        return Err(match error {
2951                            Ok(value) => common::Error::BadRequest(value),
2952                            _ => common::Error::Failure(response),
2953                        });
2954                    }
2955                    let response = {
2956                        let bytes = common::to_bytes(body).await.unwrap_or_default();
2957                        let encoded = common::to_string(&bytes);
2958                        match serde_json::from_str(&encoded) {
2959                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2960                            Err(error) => {
2961                                dlg.response_json_decode_error(&encoded, &error);
2962                                return Err(common::Error::JsonDecodeError(
2963                                    encoded.to_string(),
2964                                    error,
2965                                ));
2966                            }
2967                        }
2968                    };
2969
2970                    dlg.finished(true);
2971                    return Ok(response);
2972                }
2973            }
2974        }
2975    }
2976
2977    /// Required. The resource name of the ConfigMap to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
2978    ///
2979    /// Sets the *name* path property to the given value.
2980    ///
2981    /// Even though the property as already been set when instantiating this call,
2982    /// we provide this method for API completeness.
2983    pub fn name(
2984        mut self,
2985        new_value: &str,
2986    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
2987        self._name = new_value.to_string();
2988        self
2989    }
2990    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2991    /// while executing the actual API request.
2992    ///
2993    /// ````text
2994    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
2995    /// ````
2996    ///
2997    /// Sets the *delegate* property to the given value.
2998    pub fn delegate(
2999        mut self,
3000        new_value: &'a mut dyn common::Delegate,
3001    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
3002        self._delegate = Some(new_value);
3003        self
3004    }
3005
3006    /// Set any additional parameter of the query string used in the request.
3007    /// It should be used to set parameters which are not yet available through their own
3008    /// setters.
3009    ///
3010    /// Please note that this method must not be used to set any of the known parameters
3011    /// which have their own setter method. If done anyway, the request will fail.
3012    ///
3013    /// # Additional Parameters
3014    ///
3015    /// * *$.xgafv* (query-string) - V1 error format.
3016    /// * *access_token* (query-string) - OAuth access token.
3017    /// * *alt* (query-string) - Data format for response.
3018    /// * *callback* (query-string) - JSONP
3019    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3020    /// * *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.
3021    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3022    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3023    /// * *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.
3024    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3025    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3026    pub fn param<T>(
3027        mut self,
3028        name: T,
3029        value: T,
3030    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
3031    where
3032        T: AsRef<str>,
3033    {
3034        self._additional_params
3035            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3036        self
3037    }
3038
3039    /// Identifies the authorization scope for the method you are building.
3040    ///
3041    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3042    /// [`Scope::CloudPlatform`].
3043    ///
3044    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3045    /// tokens for more than one scope.
3046    ///
3047    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3048    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3049    /// sufficient, a read-write scope will do as well.
3050    pub fn add_scope<St>(
3051        mut self,
3052        scope: St,
3053    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
3054    where
3055        St: AsRef<str>,
3056    {
3057        self._scopes.insert(String::from(scope.as_ref()));
3058        self
3059    }
3060    /// Identifies the authorization scope(s) for the method you are building.
3061    ///
3062    /// See [`Self::add_scope()`] for details.
3063    pub fn add_scopes<I, St>(
3064        mut self,
3065        scopes: I,
3066    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
3067    where
3068        I: IntoIterator<Item = St>,
3069        St: AsRef<str>,
3070    {
3071        self._scopes
3072            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3073        self
3074    }
3075
3076    /// Removes all scopes, and no default scope will be used either.
3077    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3078    /// for details).
3079    pub fn clear_scopes(
3080        mut self,
3081    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
3082        self._scopes.clear();
3083        self
3084    }
3085}
3086
3087/// Lists user workloads ConfigMaps. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
3088///
3089/// A builder for the *locations.environments.userWorkloadsConfigMaps.list* method supported by a *project* resource.
3090/// It is not used directly, but through a [`ProjectMethods`] instance.
3091///
3092/// # Example
3093///
3094/// Instantiate a resource method builder
3095///
3096/// ```test_harness,no_run
3097/// # extern crate hyper;
3098/// # extern crate hyper_rustls;
3099/// # extern crate google_composer1 as composer1;
3100/// # async fn dox() {
3101/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3102///
3103/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3104/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3105/// #     secret,
3106/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3107/// # ).build().await.unwrap();
3108///
3109/// # let client = hyper_util::client::legacy::Client::builder(
3110/// #     hyper_util::rt::TokioExecutor::new()
3111/// # )
3112/// # .build(
3113/// #     hyper_rustls::HttpsConnectorBuilder::new()
3114/// #         .with_native_roots()
3115/// #         .unwrap()
3116/// #         .https_or_http()
3117/// #         .enable_http1()
3118/// #         .build()
3119/// # );
3120/// # let mut hub = CloudComposer::new(client, auth);
3121/// // You can configure optional parameters by calling the respective setters at will, and
3122/// // execute the final call using `doit()`.
3123/// // Values shown here are possibly random and not representative !
3124/// let result = hub.projects().locations_environments_user_workloads_config_maps_list("parent")
3125///              .page_token("sed")
3126///              .page_size(-2)
3127///              .doit().await;
3128/// # }
3129/// ```
3130pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3131where
3132    C: 'a,
3133{
3134    hub: &'a CloudComposer<C>,
3135    _parent: String,
3136    _page_token: Option<String>,
3137    _page_size: Option<i32>,
3138    _delegate: Option<&'a mut dyn common::Delegate>,
3139    _additional_params: HashMap<String, String>,
3140    _scopes: BTreeSet<String>,
3141}
3142
3143impl<'a, C> common::CallBuilder
3144    for ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3145{
3146}
3147
3148impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3149where
3150    C: common::Connector,
3151{
3152    /// Perform the operation you have build so far.
3153    pub async fn doit(
3154        mut self,
3155    ) -> common::Result<(common::Response, ListUserWorkloadsConfigMapsResponse)> {
3156        use std::borrow::Cow;
3157        use std::io::{Read, Seek};
3158
3159        use common::{url::Params, ToParts};
3160        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3161
3162        let mut dd = common::DefaultDelegate;
3163        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3164        dlg.begin(common::MethodInfo {
3165            id: "composer.projects.locations.environments.userWorkloadsConfigMaps.list",
3166            http_method: hyper::Method::GET,
3167        });
3168
3169        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3170            if self._additional_params.contains_key(field) {
3171                dlg.finished(false);
3172                return Err(common::Error::FieldClash(field));
3173            }
3174        }
3175
3176        let mut params = Params::with_capacity(5 + self._additional_params.len());
3177        params.push("parent", self._parent);
3178        if let Some(value) = self._page_token.as_ref() {
3179            params.push("pageToken", value);
3180        }
3181        if let Some(value) = self._page_size.as_ref() {
3182            params.push("pageSize", value.to_string());
3183        }
3184
3185        params.extend(self._additional_params.iter());
3186
3187        params.push("alt", "json");
3188        let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsConfigMaps";
3189        if self._scopes.is_empty() {
3190            self._scopes
3191                .insert(Scope::CloudPlatform.as_ref().to_string());
3192        }
3193
3194        #[allow(clippy::single_element_loop)]
3195        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3196            url = params.uri_replacement(url, param_name, find_this, true);
3197        }
3198        {
3199            let to_remove = ["parent"];
3200            params.remove_params(&to_remove);
3201        }
3202
3203        let url = params.parse_with_url(&url);
3204
3205        loop {
3206            let token = match self
3207                .hub
3208                .auth
3209                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3210                .await
3211            {
3212                Ok(token) => token,
3213                Err(e) => match dlg.token(e) {
3214                    Ok(token) => token,
3215                    Err(e) => {
3216                        dlg.finished(false);
3217                        return Err(common::Error::MissingToken(e));
3218                    }
3219                },
3220            };
3221            let mut req_result = {
3222                let client = &self.hub.client;
3223                dlg.pre_request();
3224                let mut req_builder = hyper::Request::builder()
3225                    .method(hyper::Method::GET)
3226                    .uri(url.as_str())
3227                    .header(USER_AGENT, self.hub._user_agent.clone());
3228
3229                if let Some(token) = token.as_ref() {
3230                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3231                }
3232
3233                let request = req_builder
3234                    .header(CONTENT_LENGTH, 0_u64)
3235                    .body(common::to_body::<String>(None));
3236
3237                client.request(request.unwrap()).await
3238            };
3239
3240            match req_result {
3241                Err(err) => {
3242                    if let common::Retry::After(d) = dlg.http_error(&err) {
3243                        sleep(d).await;
3244                        continue;
3245                    }
3246                    dlg.finished(false);
3247                    return Err(common::Error::HttpError(err));
3248                }
3249                Ok(res) => {
3250                    let (mut parts, body) = res.into_parts();
3251                    let mut body = common::Body::new(body);
3252                    if !parts.status.is_success() {
3253                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3254                        let error = serde_json::from_str(&common::to_string(&bytes));
3255                        let response = common::to_response(parts, bytes.into());
3256
3257                        if let common::Retry::After(d) =
3258                            dlg.http_failure(&response, error.as_ref().ok())
3259                        {
3260                            sleep(d).await;
3261                            continue;
3262                        }
3263
3264                        dlg.finished(false);
3265
3266                        return Err(match error {
3267                            Ok(value) => common::Error::BadRequest(value),
3268                            _ => common::Error::Failure(response),
3269                        });
3270                    }
3271                    let response = {
3272                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3273                        let encoded = common::to_string(&bytes);
3274                        match serde_json::from_str(&encoded) {
3275                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3276                            Err(error) => {
3277                                dlg.response_json_decode_error(&encoded, &error);
3278                                return Err(common::Error::JsonDecodeError(
3279                                    encoded.to_string(),
3280                                    error,
3281                                ));
3282                            }
3283                        }
3284                    };
3285
3286                    dlg.finished(true);
3287                    return Ok(response);
3288                }
3289            }
3290        }
3291    }
3292
3293    /// Required. List ConfigMaps in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
3294    ///
3295    /// Sets the *parent* path property to the given value.
3296    ///
3297    /// Even though the property as already been set when instantiating this call,
3298    /// we provide this method for API completeness.
3299    pub fn parent(
3300        mut self,
3301        new_value: &str,
3302    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3303        self._parent = new_value.to_string();
3304        self
3305    }
3306    /// Optional. The next_page_token value returned from a previous List request, if any.
3307    ///
3308    /// Sets the *page token* query property to the given value.
3309    pub fn page_token(
3310        mut self,
3311        new_value: &str,
3312    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3313        self._page_token = Some(new_value.to_string());
3314        self
3315    }
3316    /// Optional. The maximum number of ConfigMaps to return.
3317    ///
3318    /// Sets the *page size* query property to the given value.
3319    pub fn page_size(
3320        mut self,
3321        new_value: i32,
3322    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3323        self._page_size = Some(new_value);
3324        self
3325    }
3326    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3327    /// while executing the actual API request.
3328    ///
3329    /// ````text
3330    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3331    /// ````
3332    ///
3333    /// Sets the *delegate* property to the given value.
3334    pub fn delegate(
3335        mut self,
3336        new_value: &'a mut dyn common::Delegate,
3337    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3338        self._delegate = Some(new_value);
3339        self
3340    }
3341
3342    /// Set any additional parameter of the query string used in the request.
3343    /// It should be used to set parameters which are not yet available through their own
3344    /// setters.
3345    ///
3346    /// Please note that this method must not be used to set any of the known parameters
3347    /// which have their own setter method. If done anyway, the request will fail.
3348    ///
3349    /// # Additional Parameters
3350    ///
3351    /// * *$.xgafv* (query-string) - V1 error format.
3352    /// * *access_token* (query-string) - OAuth access token.
3353    /// * *alt* (query-string) - Data format for response.
3354    /// * *callback* (query-string) - JSONP
3355    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3356    /// * *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.
3357    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3358    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3359    /// * *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.
3360    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3361    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3362    pub fn param<T>(
3363        mut self,
3364        name: T,
3365        value: T,
3366    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3367    where
3368        T: AsRef<str>,
3369    {
3370        self._additional_params
3371            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3372        self
3373    }
3374
3375    /// Identifies the authorization scope for the method you are building.
3376    ///
3377    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3378    /// [`Scope::CloudPlatform`].
3379    ///
3380    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3381    /// tokens for more than one scope.
3382    ///
3383    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3384    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3385    /// sufficient, a read-write scope will do as well.
3386    pub fn add_scope<St>(
3387        mut self,
3388        scope: St,
3389    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3390    where
3391        St: AsRef<str>,
3392    {
3393        self._scopes.insert(String::from(scope.as_ref()));
3394        self
3395    }
3396    /// Identifies the authorization scope(s) for the method you are building.
3397    ///
3398    /// See [`Self::add_scope()`] for details.
3399    pub fn add_scopes<I, St>(
3400        mut self,
3401        scopes: I,
3402    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3403    where
3404        I: IntoIterator<Item = St>,
3405        St: AsRef<str>,
3406    {
3407        self._scopes
3408            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3409        self
3410    }
3411
3412    /// Removes all scopes, and no default scope will be used either.
3413    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3414    /// for details).
3415    pub fn clear_scopes(
3416        mut self,
3417    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3418        self._scopes.clear();
3419        self
3420    }
3421}
3422
3423/// Updates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
3424///
3425/// A builder for the *locations.environments.userWorkloadsConfigMaps.update* method supported by a *project* resource.
3426/// It is not used directly, but through a [`ProjectMethods`] instance.
3427///
3428/// # Example
3429///
3430/// Instantiate a resource method builder
3431///
3432/// ```test_harness,no_run
3433/// # extern crate hyper;
3434/// # extern crate hyper_rustls;
3435/// # extern crate google_composer1 as composer1;
3436/// use composer1::api::UserWorkloadsConfigMap;
3437/// # async fn dox() {
3438/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3439///
3440/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3441/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3442/// #     secret,
3443/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3444/// # ).build().await.unwrap();
3445///
3446/// # let client = hyper_util::client::legacy::Client::builder(
3447/// #     hyper_util::rt::TokioExecutor::new()
3448/// # )
3449/// # .build(
3450/// #     hyper_rustls::HttpsConnectorBuilder::new()
3451/// #         .with_native_roots()
3452/// #         .unwrap()
3453/// #         .https_or_http()
3454/// #         .enable_http1()
3455/// #         .build()
3456/// # );
3457/// # let mut hub = CloudComposer::new(client, auth);
3458/// // As the method needs a request, you would usually fill it with the desired information
3459/// // into the respective structure. Some of the parts shown here might not be applicable !
3460/// // Values shown here are possibly random and not representative !
3461/// let mut req = UserWorkloadsConfigMap::default();
3462///
3463/// // You can configure optional parameters by calling the respective setters at will, and
3464/// // execute the final call using `doit()`.
3465/// // Values shown here are possibly random and not representative !
3466/// let result = hub.projects().locations_environments_user_workloads_config_maps_update(req, "name")
3467///              .doit().await;
3468/// # }
3469/// ```
3470pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3471where
3472    C: 'a,
3473{
3474    hub: &'a CloudComposer<C>,
3475    _request: UserWorkloadsConfigMap,
3476    _name: String,
3477    _delegate: Option<&'a mut dyn common::Delegate>,
3478    _additional_params: HashMap<String, String>,
3479    _scopes: BTreeSet<String>,
3480}
3481
3482impl<'a, C> common::CallBuilder
3483    for ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3484{
3485}
3486
3487impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3488where
3489    C: common::Connector,
3490{
3491    /// Perform the operation you have build so far.
3492    pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsConfigMap)> {
3493        use std::borrow::Cow;
3494        use std::io::{Read, Seek};
3495
3496        use common::{url::Params, ToParts};
3497        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3498
3499        let mut dd = common::DefaultDelegate;
3500        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3501        dlg.begin(common::MethodInfo {
3502            id: "composer.projects.locations.environments.userWorkloadsConfigMaps.update",
3503            http_method: hyper::Method::PUT,
3504        });
3505
3506        for &field in ["alt", "name"].iter() {
3507            if self._additional_params.contains_key(field) {
3508                dlg.finished(false);
3509                return Err(common::Error::FieldClash(field));
3510            }
3511        }
3512
3513        let mut params = Params::with_capacity(4 + self._additional_params.len());
3514        params.push("name", self._name);
3515
3516        params.extend(self._additional_params.iter());
3517
3518        params.push("alt", "json");
3519        let mut url = self.hub._base_url.clone() + "v1/{+name}";
3520        if self._scopes.is_empty() {
3521            self._scopes
3522                .insert(Scope::CloudPlatform.as_ref().to_string());
3523        }
3524
3525        #[allow(clippy::single_element_loop)]
3526        for &(find_this, param_name) in [("{+name}", "name")].iter() {
3527            url = params.uri_replacement(url, param_name, find_this, true);
3528        }
3529        {
3530            let to_remove = ["name"];
3531            params.remove_params(&to_remove);
3532        }
3533
3534        let url = params.parse_with_url(&url);
3535
3536        let mut json_mime_type = mime::APPLICATION_JSON;
3537        let mut request_value_reader = {
3538            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3539            common::remove_json_null_values(&mut value);
3540            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3541            serde_json::to_writer(&mut dst, &value).unwrap();
3542            dst
3543        };
3544        let request_size = request_value_reader
3545            .seek(std::io::SeekFrom::End(0))
3546            .unwrap();
3547        request_value_reader
3548            .seek(std::io::SeekFrom::Start(0))
3549            .unwrap();
3550
3551        loop {
3552            let token = match self
3553                .hub
3554                .auth
3555                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3556                .await
3557            {
3558                Ok(token) => token,
3559                Err(e) => match dlg.token(e) {
3560                    Ok(token) => token,
3561                    Err(e) => {
3562                        dlg.finished(false);
3563                        return Err(common::Error::MissingToken(e));
3564                    }
3565                },
3566            };
3567            request_value_reader
3568                .seek(std::io::SeekFrom::Start(0))
3569                .unwrap();
3570            let mut req_result = {
3571                let client = &self.hub.client;
3572                dlg.pre_request();
3573                let mut req_builder = hyper::Request::builder()
3574                    .method(hyper::Method::PUT)
3575                    .uri(url.as_str())
3576                    .header(USER_AGENT, self.hub._user_agent.clone());
3577
3578                if let Some(token) = token.as_ref() {
3579                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3580                }
3581
3582                let request = req_builder
3583                    .header(CONTENT_TYPE, json_mime_type.to_string())
3584                    .header(CONTENT_LENGTH, request_size as u64)
3585                    .body(common::to_body(
3586                        request_value_reader.get_ref().clone().into(),
3587                    ));
3588
3589                client.request(request.unwrap()).await
3590            };
3591
3592            match req_result {
3593                Err(err) => {
3594                    if let common::Retry::After(d) = dlg.http_error(&err) {
3595                        sleep(d).await;
3596                        continue;
3597                    }
3598                    dlg.finished(false);
3599                    return Err(common::Error::HttpError(err));
3600                }
3601                Ok(res) => {
3602                    let (mut parts, body) = res.into_parts();
3603                    let mut body = common::Body::new(body);
3604                    if !parts.status.is_success() {
3605                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3606                        let error = serde_json::from_str(&common::to_string(&bytes));
3607                        let response = common::to_response(parts, bytes.into());
3608
3609                        if let common::Retry::After(d) =
3610                            dlg.http_failure(&response, error.as_ref().ok())
3611                        {
3612                            sleep(d).await;
3613                            continue;
3614                        }
3615
3616                        dlg.finished(false);
3617
3618                        return Err(match error {
3619                            Ok(value) => common::Error::BadRequest(value),
3620                            _ => common::Error::Failure(response),
3621                        });
3622                    }
3623                    let response = {
3624                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3625                        let encoded = common::to_string(&bytes);
3626                        match serde_json::from_str(&encoded) {
3627                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3628                            Err(error) => {
3629                                dlg.response_json_decode_error(&encoded, &error);
3630                                return Err(common::Error::JsonDecodeError(
3631                                    encoded.to_string(),
3632                                    error,
3633                                ));
3634                            }
3635                        }
3636                    };
3637
3638                    dlg.finished(true);
3639                    return Ok(response);
3640                }
3641            }
3642        }
3643    }
3644
3645    ///
3646    /// Sets the *request* property to the given value.
3647    ///
3648    /// Even though the property as already been set when instantiating this call,
3649    /// we provide this method for API completeness.
3650    pub fn request(
3651        mut self,
3652        new_value: UserWorkloadsConfigMap,
3653    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3654        self._request = new_value;
3655        self
3656    }
3657    /// Identifier. The resource name of the ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
3658    ///
3659    /// Sets the *name* path property to the given value.
3660    ///
3661    /// Even though the property as already been set when instantiating this call,
3662    /// we provide this method for API completeness.
3663    pub fn name(
3664        mut self,
3665        new_value: &str,
3666    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3667        self._name = new_value.to_string();
3668        self
3669    }
3670    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3671    /// while executing the actual API request.
3672    ///
3673    /// ````text
3674    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
3675    /// ````
3676    ///
3677    /// Sets the *delegate* property to the given value.
3678    pub fn delegate(
3679        mut self,
3680        new_value: &'a mut dyn common::Delegate,
3681    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3682        self._delegate = Some(new_value);
3683        self
3684    }
3685
3686    /// Set any additional parameter of the query string used in the request.
3687    /// It should be used to set parameters which are not yet available through their own
3688    /// setters.
3689    ///
3690    /// Please note that this method must not be used to set any of the known parameters
3691    /// which have their own setter method. If done anyway, the request will fail.
3692    ///
3693    /// # Additional Parameters
3694    ///
3695    /// * *$.xgafv* (query-string) - V1 error format.
3696    /// * *access_token* (query-string) - OAuth access token.
3697    /// * *alt* (query-string) - Data format for response.
3698    /// * *callback* (query-string) - JSONP
3699    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3700    /// * *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.
3701    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3702    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3703    /// * *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.
3704    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3705    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3706    pub fn param<T>(
3707        mut self,
3708        name: T,
3709        value: T,
3710    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3711    where
3712        T: AsRef<str>,
3713    {
3714        self._additional_params
3715            .insert(name.as_ref().to_string(), value.as_ref().to_string());
3716        self
3717    }
3718
3719    /// Identifies the authorization scope for the method you are building.
3720    ///
3721    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3722    /// [`Scope::CloudPlatform`].
3723    ///
3724    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3725    /// tokens for more than one scope.
3726    ///
3727    /// Usually there is more than one suitable scope to authorize an operation, some of which may
3728    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3729    /// sufficient, a read-write scope will do as well.
3730    pub fn add_scope<St>(
3731        mut self,
3732        scope: St,
3733    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3734    where
3735        St: AsRef<str>,
3736    {
3737        self._scopes.insert(String::from(scope.as_ref()));
3738        self
3739    }
3740    /// Identifies the authorization scope(s) for the method you are building.
3741    ///
3742    /// See [`Self::add_scope()`] for details.
3743    pub fn add_scopes<I, St>(
3744        mut self,
3745        scopes: I,
3746    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3747    where
3748        I: IntoIterator<Item = St>,
3749        St: AsRef<str>,
3750    {
3751        self._scopes
3752            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3753        self
3754    }
3755
3756    /// Removes all scopes, and no default scope will be used either.
3757    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3758    /// for details).
3759    pub fn clear_scopes(
3760        mut self,
3761    ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3762        self._scopes.clear();
3763        self
3764    }
3765}
3766
3767/// Creates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
3768///
3769/// A builder for the *locations.environments.userWorkloadsSecrets.create* method supported by a *project* resource.
3770/// It is not used directly, but through a [`ProjectMethods`] instance.
3771///
3772/// # Example
3773///
3774/// Instantiate a resource method builder
3775///
3776/// ```test_harness,no_run
3777/// # extern crate hyper;
3778/// # extern crate hyper_rustls;
3779/// # extern crate google_composer1 as composer1;
3780/// use composer1::api::UserWorkloadsSecret;
3781/// # async fn dox() {
3782/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3783///
3784/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3785/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
3786/// #     secret,
3787/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3788/// # ).build().await.unwrap();
3789///
3790/// # let client = hyper_util::client::legacy::Client::builder(
3791/// #     hyper_util::rt::TokioExecutor::new()
3792/// # )
3793/// # .build(
3794/// #     hyper_rustls::HttpsConnectorBuilder::new()
3795/// #         .with_native_roots()
3796/// #         .unwrap()
3797/// #         .https_or_http()
3798/// #         .enable_http1()
3799/// #         .build()
3800/// # );
3801/// # let mut hub = CloudComposer::new(client, auth);
3802/// // As the method needs a request, you would usually fill it with the desired information
3803/// // into the respective structure. Some of the parts shown here might not be applicable !
3804/// // Values shown here are possibly random and not representative !
3805/// let mut req = UserWorkloadsSecret::default();
3806///
3807/// // You can configure optional parameters by calling the respective setters at will, and
3808/// // execute the final call using `doit()`.
3809/// // Values shown here are possibly random and not representative !
3810/// let result = hub.projects().locations_environments_user_workloads_secrets_create(req, "parent")
3811///              .doit().await;
3812/// # }
3813/// ```
3814pub struct ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
3815where
3816    C: 'a,
3817{
3818    hub: &'a CloudComposer<C>,
3819    _request: UserWorkloadsSecret,
3820    _parent: String,
3821    _delegate: Option<&'a mut dyn common::Delegate>,
3822    _additional_params: HashMap<String, String>,
3823    _scopes: BTreeSet<String>,
3824}
3825
3826impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {}
3827
3828impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
3829where
3830    C: common::Connector,
3831{
3832    /// Perform the operation you have build so far.
3833    pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsSecret)> {
3834        use std::borrow::Cow;
3835        use std::io::{Read, Seek};
3836
3837        use common::{url::Params, ToParts};
3838        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3839
3840        let mut dd = common::DefaultDelegate;
3841        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3842        dlg.begin(common::MethodInfo {
3843            id: "composer.projects.locations.environments.userWorkloadsSecrets.create",
3844            http_method: hyper::Method::POST,
3845        });
3846
3847        for &field in ["alt", "parent"].iter() {
3848            if self._additional_params.contains_key(field) {
3849                dlg.finished(false);
3850                return Err(common::Error::FieldClash(field));
3851            }
3852        }
3853
3854        let mut params = Params::with_capacity(4 + self._additional_params.len());
3855        params.push("parent", self._parent);
3856
3857        params.extend(self._additional_params.iter());
3858
3859        params.push("alt", "json");
3860        let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsSecrets";
3861        if self._scopes.is_empty() {
3862            self._scopes
3863                .insert(Scope::CloudPlatform.as_ref().to_string());
3864        }
3865
3866        #[allow(clippy::single_element_loop)]
3867        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3868            url = params.uri_replacement(url, param_name, find_this, true);
3869        }
3870        {
3871            let to_remove = ["parent"];
3872            params.remove_params(&to_remove);
3873        }
3874
3875        let url = params.parse_with_url(&url);
3876
3877        let mut json_mime_type = mime::APPLICATION_JSON;
3878        let mut request_value_reader = {
3879            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3880            common::remove_json_null_values(&mut value);
3881            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3882            serde_json::to_writer(&mut dst, &value).unwrap();
3883            dst
3884        };
3885        let request_size = request_value_reader
3886            .seek(std::io::SeekFrom::End(0))
3887            .unwrap();
3888        request_value_reader
3889            .seek(std::io::SeekFrom::Start(0))
3890            .unwrap();
3891
3892        loop {
3893            let token = match self
3894                .hub
3895                .auth
3896                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3897                .await
3898            {
3899                Ok(token) => token,
3900                Err(e) => match dlg.token(e) {
3901                    Ok(token) => token,
3902                    Err(e) => {
3903                        dlg.finished(false);
3904                        return Err(common::Error::MissingToken(e));
3905                    }
3906                },
3907            };
3908            request_value_reader
3909                .seek(std::io::SeekFrom::Start(0))
3910                .unwrap();
3911            let mut req_result = {
3912                let client = &self.hub.client;
3913                dlg.pre_request();
3914                let mut req_builder = hyper::Request::builder()
3915                    .method(hyper::Method::POST)
3916                    .uri(url.as_str())
3917                    .header(USER_AGENT, self.hub._user_agent.clone());
3918
3919                if let Some(token) = token.as_ref() {
3920                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3921                }
3922
3923                let request = req_builder
3924                    .header(CONTENT_TYPE, json_mime_type.to_string())
3925                    .header(CONTENT_LENGTH, request_size as u64)
3926                    .body(common::to_body(
3927                        request_value_reader.get_ref().clone().into(),
3928                    ));
3929
3930                client.request(request.unwrap()).await
3931            };
3932
3933            match req_result {
3934                Err(err) => {
3935                    if let common::Retry::After(d) = dlg.http_error(&err) {
3936                        sleep(d).await;
3937                        continue;
3938                    }
3939                    dlg.finished(false);
3940                    return Err(common::Error::HttpError(err));
3941                }
3942                Ok(res) => {
3943                    let (mut parts, body) = res.into_parts();
3944                    let mut body = common::Body::new(body);
3945                    if !parts.status.is_success() {
3946                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3947                        let error = serde_json::from_str(&common::to_string(&bytes));
3948                        let response = common::to_response(parts, bytes.into());
3949
3950                        if let common::Retry::After(d) =
3951                            dlg.http_failure(&response, error.as_ref().ok())
3952                        {
3953                            sleep(d).await;
3954                            continue;
3955                        }
3956
3957                        dlg.finished(false);
3958
3959                        return Err(match error {
3960                            Ok(value) => common::Error::BadRequest(value),
3961                            _ => common::Error::Failure(response),
3962                        });
3963                    }
3964                    let response = {
3965                        let bytes = common::to_bytes(body).await.unwrap_or_default();
3966                        let encoded = common::to_string(&bytes);
3967                        match serde_json::from_str(&encoded) {
3968                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3969                            Err(error) => {
3970                                dlg.response_json_decode_error(&encoded, &error);
3971                                return Err(common::Error::JsonDecodeError(
3972                                    encoded.to_string(),
3973                                    error,
3974                                ));
3975                            }
3976                        }
3977                    };
3978
3979                    dlg.finished(true);
3980                    return Ok(response);
3981                }
3982            }
3983        }
3984    }
3985
3986    ///
3987    /// Sets the *request* property to the given value.
3988    ///
3989    /// Even though the property as already been set when instantiating this call,
3990    /// we provide this method for API completeness.
3991    pub fn request(
3992        mut self,
3993        new_value: UserWorkloadsSecret,
3994    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
3995        self._request = new_value;
3996        self
3997    }
3998    /// Required. The environment name to create a Secret for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
3999    ///
4000    /// Sets the *parent* path property to the given value.
4001    ///
4002    /// Even though the property as already been set when instantiating this call,
4003    /// we provide this method for API completeness.
4004    pub fn parent(
4005        mut self,
4006        new_value: &str,
4007    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
4008        self._parent = new_value.to_string();
4009        self
4010    }
4011    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4012    /// while executing the actual API request.
4013    ///
4014    /// ````text
4015    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4016    /// ````
4017    ///
4018    /// Sets the *delegate* property to the given value.
4019    pub fn delegate(
4020        mut self,
4021        new_value: &'a mut dyn common::Delegate,
4022    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
4023        self._delegate = Some(new_value);
4024        self
4025    }
4026
4027    /// Set any additional parameter of the query string used in the request.
4028    /// It should be used to set parameters which are not yet available through their own
4029    /// setters.
4030    ///
4031    /// Please note that this method must not be used to set any of the known parameters
4032    /// which have their own setter method. If done anyway, the request will fail.
4033    ///
4034    /// # Additional Parameters
4035    ///
4036    /// * *$.xgafv* (query-string) - V1 error format.
4037    /// * *access_token* (query-string) - OAuth access token.
4038    /// * *alt* (query-string) - Data format for response.
4039    /// * *callback* (query-string) - JSONP
4040    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4041    /// * *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.
4042    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4043    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4044    /// * *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.
4045    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4046    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4047    pub fn param<T>(
4048        mut self,
4049        name: T,
4050        value: T,
4051    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
4052    where
4053        T: AsRef<str>,
4054    {
4055        self._additional_params
4056            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4057        self
4058    }
4059
4060    /// Identifies the authorization scope for the method you are building.
4061    ///
4062    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4063    /// [`Scope::CloudPlatform`].
4064    ///
4065    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4066    /// tokens for more than one scope.
4067    ///
4068    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4069    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4070    /// sufficient, a read-write scope will do as well.
4071    pub fn add_scope<St>(
4072        mut self,
4073        scope: St,
4074    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
4075    where
4076        St: AsRef<str>,
4077    {
4078        self._scopes.insert(String::from(scope.as_ref()));
4079        self
4080    }
4081    /// Identifies the authorization scope(s) for the method you are building.
4082    ///
4083    /// See [`Self::add_scope()`] for details.
4084    pub fn add_scopes<I, St>(
4085        mut self,
4086        scopes: I,
4087    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
4088    where
4089        I: IntoIterator<Item = St>,
4090        St: AsRef<str>,
4091    {
4092        self._scopes
4093            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4094        self
4095    }
4096
4097    /// Removes all scopes, and no default scope will be used either.
4098    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4099    /// for details).
4100    pub fn clear_scopes(
4101        mut self,
4102    ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
4103        self._scopes.clear();
4104        self
4105    }
4106}
4107
4108/// Deletes a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
4109///
4110/// A builder for the *locations.environments.userWorkloadsSecrets.delete* method supported by a *project* resource.
4111/// It is not used directly, but through a [`ProjectMethods`] instance.
4112///
4113/// # Example
4114///
4115/// Instantiate a resource method builder
4116///
4117/// ```test_harness,no_run
4118/// # extern crate hyper;
4119/// # extern crate hyper_rustls;
4120/// # extern crate google_composer1 as composer1;
4121/// # async fn dox() {
4122/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4123///
4124/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4125/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4126/// #     secret,
4127/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4128/// # ).build().await.unwrap();
4129///
4130/// # let client = hyper_util::client::legacy::Client::builder(
4131/// #     hyper_util::rt::TokioExecutor::new()
4132/// # )
4133/// # .build(
4134/// #     hyper_rustls::HttpsConnectorBuilder::new()
4135/// #         .with_native_roots()
4136/// #         .unwrap()
4137/// #         .https_or_http()
4138/// #         .enable_http1()
4139/// #         .build()
4140/// # );
4141/// # let mut hub = CloudComposer::new(client, auth);
4142/// // You can configure optional parameters by calling the respective setters at will, and
4143/// // execute the final call using `doit()`.
4144/// // Values shown here are possibly random and not representative !
4145/// let result = hub.projects().locations_environments_user_workloads_secrets_delete("name")
4146///              .doit().await;
4147/// # }
4148/// ```
4149pub struct ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4150where
4151    C: 'a,
4152{
4153    hub: &'a CloudComposer<C>,
4154    _name: String,
4155    _delegate: Option<&'a mut dyn common::Delegate>,
4156    _additional_params: HashMap<String, String>,
4157    _scopes: BTreeSet<String>,
4158}
4159
4160impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {}
4161
4162impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4163where
4164    C: common::Connector,
4165{
4166    /// Perform the operation you have build so far.
4167    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4168        use std::borrow::Cow;
4169        use std::io::{Read, Seek};
4170
4171        use common::{url::Params, ToParts};
4172        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4173
4174        let mut dd = common::DefaultDelegate;
4175        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4176        dlg.begin(common::MethodInfo {
4177            id: "composer.projects.locations.environments.userWorkloadsSecrets.delete",
4178            http_method: hyper::Method::DELETE,
4179        });
4180
4181        for &field in ["alt", "name"].iter() {
4182            if self._additional_params.contains_key(field) {
4183                dlg.finished(false);
4184                return Err(common::Error::FieldClash(field));
4185            }
4186        }
4187
4188        let mut params = Params::with_capacity(3 + self._additional_params.len());
4189        params.push("name", self._name);
4190
4191        params.extend(self._additional_params.iter());
4192
4193        params.push("alt", "json");
4194        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4195        if self._scopes.is_empty() {
4196            self._scopes
4197                .insert(Scope::CloudPlatform.as_ref().to_string());
4198        }
4199
4200        #[allow(clippy::single_element_loop)]
4201        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4202            url = params.uri_replacement(url, param_name, find_this, true);
4203        }
4204        {
4205            let to_remove = ["name"];
4206            params.remove_params(&to_remove);
4207        }
4208
4209        let url = params.parse_with_url(&url);
4210
4211        loop {
4212            let token = match self
4213                .hub
4214                .auth
4215                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4216                .await
4217            {
4218                Ok(token) => token,
4219                Err(e) => match dlg.token(e) {
4220                    Ok(token) => token,
4221                    Err(e) => {
4222                        dlg.finished(false);
4223                        return Err(common::Error::MissingToken(e));
4224                    }
4225                },
4226            };
4227            let mut req_result = {
4228                let client = &self.hub.client;
4229                dlg.pre_request();
4230                let mut req_builder = hyper::Request::builder()
4231                    .method(hyper::Method::DELETE)
4232                    .uri(url.as_str())
4233                    .header(USER_AGENT, self.hub._user_agent.clone());
4234
4235                if let Some(token) = token.as_ref() {
4236                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4237                }
4238
4239                let request = req_builder
4240                    .header(CONTENT_LENGTH, 0_u64)
4241                    .body(common::to_body::<String>(None));
4242
4243                client.request(request.unwrap()).await
4244            };
4245
4246            match req_result {
4247                Err(err) => {
4248                    if let common::Retry::After(d) = dlg.http_error(&err) {
4249                        sleep(d).await;
4250                        continue;
4251                    }
4252                    dlg.finished(false);
4253                    return Err(common::Error::HttpError(err));
4254                }
4255                Ok(res) => {
4256                    let (mut parts, body) = res.into_parts();
4257                    let mut body = common::Body::new(body);
4258                    if !parts.status.is_success() {
4259                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4260                        let error = serde_json::from_str(&common::to_string(&bytes));
4261                        let response = common::to_response(parts, bytes.into());
4262
4263                        if let common::Retry::After(d) =
4264                            dlg.http_failure(&response, error.as_ref().ok())
4265                        {
4266                            sleep(d).await;
4267                            continue;
4268                        }
4269
4270                        dlg.finished(false);
4271
4272                        return Err(match error {
4273                            Ok(value) => common::Error::BadRequest(value),
4274                            _ => common::Error::Failure(response),
4275                        });
4276                    }
4277                    let response = {
4278                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4279                        let encoded = common::to_string(&bytes);
4280                        match serde_json::from_str(&encoded) {
4281                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4282                            Err(error) => {
4283                                dlg.response_json_decode_error(&encoded, &error);
4284                                return Err(common::Error::JsonDecodeError(
4285                                    encoded.to_string(),
4286                                    error,
4287                                ));
4288                            }
4289                        }
4290                    };
4291
4292                    dlg.finished(true);
4293                    return Ok(response);
4294                }
4295            }
4296        }
4297    }
4298
4299    /// Required. The Secret to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
4300    ///
4301    /// Sets the *name* path property to the given value.
4302    ///
4303    /// Even though the property as already been set when instantiating this call,
4304    /// we provide this method for API completeness.
4305    pub fn name(
4306        mut self,
4307        new_value: &str,
4308    ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
4309        self._name = new_value.to_string();
4310        self
4311    }
4312    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4313    /// while executing the actual API request.
4314    ///
4315    /// ````text
4316    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4317    /// ````
4318    ///
4319    /// Sets the *delegate* property to the given value.
4320    pub fn delegate(
4321        mut self,
4322        new_value: &'a mut dyn common::Delegate,
4323    ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
4324        self._delegate = Some(new_value);
4325        self
4326    }
4327
4328    /// Set any additional parameter of the query string used in the request.
4329    /// It should be used to set parameters which are not yet available through their own
4330    /// setters.
4331    ///
4332    /// Please note that this method must not be used to set any of the known parameters
4333    /// which have their own setter method. If done anyway, the request will fail.
4334    ///
4335    /// # Additional Parameters
4336    ///
4337    /// * *$.xgafv* (query-string) - V1 error format.
4338    /// * *access_token* (query-string) - OAuth access token.
4339    /// * *alt* (query-string) - Data format for response.
4340    /// * *callback* (query-string) - JSONP
4341    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4342    /// * *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.
4343    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4344    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4345    /// * *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.
4346    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4347    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4348    pub fn param<T>(
4349        mut self,
4350        name: T,
4351        value: T,
4352    ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4353    where
4354        T: AsRef<str>,
4355    {
4356        self._additional_params
4357            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4358        self
4359    }
4360
4361    /// Identifies the authorization scope for the method you are building.
4362    ///
4363    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4364    /// [`Scope::CloudPlatform`].
4365    ///
4366    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4367    /// tokens for more than one scope.
4368    ///
4369    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4370    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4371    /// sufficient, a read-write scope will do as well.
4372    pub fn add_scope<St>(
4373        mut self,
4374        scope: St,
4375    ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4376    where
4377        St: AsRef<str>,
4378    {
4379        self._scopes.insert(String::from(scope.as_ref()));
4380        self
4381    }
4382    /// Identifies the authorization scope(s) for the method you are building.
4383    ///
4384    /// See [`Self::add_scope()`] for details.
4385    pub fn add_scopes<I, St>(
4386        mut self,
4387        scopes: I,
4388    ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4389    where
4390        I: IntoIterator<Item = St>,
4391        St: AsRef<str>,
4392    {
4393        self._scopes
4394            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4395        self
4396    }
4397
4398    /// Removes all scopes, and no default scope will be used either.
4399    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4400    /// for details).
4401    pub fn clear_scopes(
4402        mut self,
4403    ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
4404        self._scopes.clear();
4405        self
4406    }
4407}
4408
4409/// Gets an existing user workloads Secret. Values of the "data" field in the response are cleared. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
4410///
4411/// A builder for the *locations.environments.userWorkloadsSecrets.get* method supported by a *project* resource.
4412/// It is not used directly, but through a [`ProjectMethods`] instance.
4413///
4414/// # Example
4415///
4416/// Instantiate a resource method builder
4417///
4418/// ```test_harness,no_run
4419/// # extern crate hyper;
4420/// # extern crate hyper_rustls;
4421/// # extern crate google_composer1 as composer1;
4422/// # async fn dox() {
4423/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4424///
4425/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4426/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4427/// #     secret,
4428/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4429/// # ).build().await.unwrap();
4430///
4431/// # let client = hyper_util::client::legacy::Client::builder(
4432/// #     hyper_util::rt::TokioExecutor::new()
4433/// # )
4434/// # .build(
4435/// #     hyper_rustls::HttpsConnectorBuilder::new()
4436/// #         .with_native_roots()
4437/// #         .unwrap()
4438/// #         .https_or_http()
4439/// #         .enable_http1()
4440/// #         .build()
4441/// # );
4442/// # let mut hub = CloudComposer::new(client, auth);
4443/// // You can configure optional parameters by calling the respective setters at will, and
4444/// // execute the final call using `doit()`.
4445/// // Values shown here are possibly random and not representative !
4446/// let result = hub.projects().locations_environments_user_workloads_secrets_get("name")
4447///              .doit().await;
4448/// # }
4449/// ```
4450pub struct ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4451where
4452    C: 'a,
4453{
4454    hub: &'a CloudComposer<C>,
4455    _name: String,
4456    _delegate: Option<&'a mut dyn common::Delegate>,
4457    _additional_params: HashMap<String, String>,
4458    _scopes: BTreeSet<String>,
4459}
4460
4461impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {}
4462
4463impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4464where
4465    C: common::Connector,
4466{
4467    /// Perform the operation you have build so far.
4468    pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsSecret)> {
4469        use std::borrow::Cow;
4470        use std::io::{Read, Seek};
4471
4472        use common::{url::Params, ToParts};
4473        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4474
4475        let mut dd = common::DefaultDelegate;
4476        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4477        dlg.begin(common::MethodInfo {
4478            id: "composer.projects.locations.environments.userWorkloadsSecrets.get",
4479            http_method: hyper::Method::GET,
4480        });
4481
4482        for &field in ["alt", "name"].iter() {
4483            if self._additional_params.contains_key(field) {
4484                dlg.finished(false);
4485                return Err(common::Error::FieldClash(field));
4486            }
4487        }
4488
4489        let mut params = Params::with_capacity(3 + self._additional_params.len());
4490        params.push("name", self._name);
4491
4492        params.extend(self._additional_params.iter());
4493
4494        params.push("alt", "json");
4495        let mut url = self.hub._base_url.clone() + "v1/{+name}";
4496        if self._scopes.is_empty() {
4497            self._scopes
4498                .insert(Scope::CloudPlatform.as_ref().to_string());
4499        }
4500
4501        #[allow(clippy::single_element_loop)]
4502        for &(find_this, param_name) in [("{+name}", "name")].iter() {
4503            url = params.uri_replacement(url, param_name, find_this, true);
4504        }
4505        {
4506            let to_remove = ["name"];
4507            params.remove_params(&to_remove);
4508        }
4509
4510        let url = params.parse_with_url(&url);
4511
4512        loop {
4513            let token = match self
4514                .hub
4515                .auth
4516                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4517                .await
4518            {
4519                Ok(token) => token,
4520                Err(e) => match dlg.token(e) {
4521                    Ok(token) => token,
4522                    Err(e) => {
4523                        dlg.finished(false);
4524                        return Err(common::Error::MissingToken(e));
4525                    }
4526                },
4527            };
4528            let mut req_result = {
4529                let client = &self.hub.client;
4530                dlg.pre_request();
4531                let mut req_builder = hyper::Request::builder()
4532                    .method(hyper::Method::GET)
4533                    .uri(url.as_str())
4534                    .header(USER_AGENT, self.hub._user_agent.clone());
4535
4536                if let Some(token) = token.as_ref() {
4537                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4538                }
4539
4540                let request = req_builder
4541                    .header(CONTENT_LENGTH, 0_u64)
4542                    .body(common::to_body::<String>(None));
4543
4544                client.request(request.unwrap()).await
4545            };
4546
4547            match req_result {
4548                Err(err) => {
4549                    if let common::Retry::After(d) = dlg.http_error(&err) {
4550                        sleep(d).await;
4551                        continue;
4552                    }
4553                    dlg.finished(false);
4554                    return Err(common::Error::HttpError(err));
4555                }
4556                Ok(res) => {
4557                    let (mut parts, body) = res.into_parts();
4558                    let mut body = common::Body::new(body);
4559                    if !parts.status.is_success() {
4560                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4561                        let error = serde_json::from_str(&common::to_string(&bytes));
4562                        let response = common::to_response(parts, bytes.into());
4563
4564                        if let common::Retry::After(d) =
4565                            dlg.http_failure(&response, error.as_ref().ok())
4566                        {
4567                            sleep(d).await;
4568                            continue;
4569                        }
4570
4571                        dlg.finished(false);
4572
4573                        return Err(match error {
4574                            Ok(value) => common::Error::BadRequest(value),
4575                            _ => common::Error::Failure(response),
4576                        });
4577                    }
4578                    let response = {
4579                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4580                        let encoded = common::to_string(&bytes);
4581                        match serde_json::from_str(&encoded) {
4582                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4583                            Err(error) => {
4584                                dlg.response_json_decode_error(&encoded, &error);
4585                                return Err(common::Error::JsonDecodeError(
4586                                    encoded.to_string(),
4587                                    error,
4588                                ));
4589                            }
4590                        }
4591                    };
4592
4593                    dlg.finished(true);
4594                    return Ok(response);
4595                }
4596            }
4597        }
4598    }
4599
4600    /// Required. The resource name of the Secret to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
4601    ///
4602    /// Sets the *name* path property to the given value.
4603    ///
4604    /// Even though the property as already been set when instantiating this call,
4605    /// we provide this method for API completeness.
4606    pub fn name(
4607        mut self,
4608        new_value: &str,
4609    ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
4610        self._name = new_value.to_string();
4611        self
4612    }
4613    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4614    /// while executing the actual API request.
4615    ///
4616    /// ````text
4617    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4618    /// ````
4619    ///
4620    /// Sets the *delegate* property to the given value.
4621    pub fn delegate(
4622        mut self,
4623        new_value: &'a mut dyn common::Delegate,
4624    ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
4625        self._delegate = Some(new_value);
4626        self
4627    }
4628
4629    /// Set any additional parameter of the query string used in the request.
4630    /// It should be used to set parameters which are not yet available through their own
4631    /// setters.
4632    ///
4633    /// Please note that this method must not be used to set any of the known parameters
4634    /// which have their own setter method. If done anyway, the request will fail.
4635    ///
4636    /// # Additional Parameters
4637    ///
4638    /// * *$.xgafv* (query-string) - V1 error format.
4639    /// * *access_token* (query-string) - OAuth access token.
4640    /// * *alt* (query-string) - Data format for response.
4641    /// * *callback* (query-string) - JSONP
4642    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4643    /// * *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.
4644    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4645    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4646    /// * *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.
4647    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4648    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4649    pub fn param<T>(
4650        mut self,
4651        name: T,
4652        value: T,
4653    ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4654    where
4655        T: AsRef<str>,
4656    {
4657        self._additional_params
4658            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4659        self
4660    }
4661
4662    /// Identifies the authorization scope for the method you are building.
4663    ///
4664    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4665    /// [`Scope::CloudPlatform`].
4666    ///
4667    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4668    /// tokens for more than one scope.
4669    ///
4670    /// Usually there is more than one suitable scope to authorize an operation, some of which may
4671    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4672    /// sufficient, a read-write scope will do as well.
4673    pub fn add_scope<St>(
4674        mut self,
4675        scope: St,
4676    ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4677    where
4678        St: AsRef<str>,
4679    {
4680        self._scopes.insert(String::from(scope.as_ref()));
4681        self
4682    }
4683    /// Identifies the authorization scope(s) for the method you are building.
4684    ///
4685    /// See [`Self::add_scope()`] for details.
4686    pub fn add_scopes<I, St>(
4687        mut self,
4688        scopes: I,
4689    ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4690    where
4691        I: IntoIterator<Item = St>,
4692        St: AsRef<str>,
4693    {
4694        self._scopes
4695            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4696        self
4697    }
4698
4699    /// Removes all scopes, and no default scope will be used either.
4700    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4701    /// for details).
4702    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
4703        self._scopes.clear();
4704        self
4705    }
4706}
4707
4708/// Lists user workloads Secrets. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
4709///
4710/// A builder for the *locations.environments.userWorkloadsSecrets.list* method supported by a *project* resource.
4711/// It is not used directly, but through a [`ProjectMethods`] instance.
4712///
4713/// # Example
4714///
4715/// Instantiate a resource method builder
4716///
4717/// ```test_harness,no_run
4718/// # extern crate hyper;
4719/// # extern crate hyper_rustls;
4720/// # extern crate google_composer1 as composer1;
4721/// # async fn dox() {
4722/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4723///
4724/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4725/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4726/// #     secret,
4727/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4728/// # ).build().await.unwrap();
4729///
4730/// # let client = hyper_util::client::legacy::Client::builder(
4731/// #     hyper_util::rt::TokioExecutor::new()
4732/// # )
4733/// # .build(
4734/// #     hyper_rustls::HttpsConnectorBuilder::new()
4735/// #         .with_native_roots()
4736/// #         .unwrap()
4737/// #         .https_or_http()
4738/// #         .enable_http1()
4739/// #         .build()
4740/// # );
4741/// # let mut hub = CloudComposer::new(client, auth);
4742/// // You can configure optional parameters by calling the respective setters at will, and
4743/// // execute the final call using `doit()`.
4744/// // Values shown here are possibly random and not representative !
4745/// let result = hub.projects().locations_environments_user_workloads_secrets_list("parent")
4746///              .page_token("Lorem")
4747///              .page_size(-12)
4748///              .doit().await;
4749/// # }
4750/// ```
4751pub struct ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
4752where
4753    C: 'a,
4754{
4755    hub: &'a CloudComposer<C>,
4756    _parent: String,
4757    _page_token: Option<String>,
4758    _page_size: Option<i32>,
4759    _delegate: Option<&'a mut dyn common::Delegate>,
4760    _additional_params: HashMap<String, String>,
4761    _scopes: BTreeSet<String>,
4762}
4763
4764impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {}
4765
4766impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
4767where
4768    C: common::Connector,
4769{
4770    /// Perform the operation you have build so far.
4771    pub async fn doit(
4772        mut self,
4773    ) -> common::Result<(common::Response, ListUserWorkloadsSecretsResponse)> {
4774        use std::borrow::Cow;
4775        use std::io::{Read, Seek};
4776
4777        use common::{url::Params, ToParts};
4778        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4779
4780        let mut dd = common::DefaultDelegate;
4781        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4782        dlg.begin(common::MethodInfo {
4783            id: "composer.projects.locations.environments.userWorkloadsSecrets.list",
4784            http_method: hyper::Method::GET,
4785        });
4786
4787        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4788            if self._additional_params.contains_key(field) {
4789                dlg.finished(false);
4790                return Err(common::Error::FieldClash(field));
4791            }
4792        }
4793
4794        let mut params = Params::with_capacity(5 + self._additional_params.len());
4795        params.push("parent", self._parent);
4796        if let Some(value) = self._page_token.as_ref() {
4797            params.push("pageToken", value);
4798        }
4799        if let Some(value) = self._page_size.as_ref() {
4800            params.push("pageSize", value.to_string());
4801        }
4802
4803        params.extend(self._additional_params.iter());
4804
4805        params.push("alt", "json");
4806        let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsSecrets";
4807        if self._scopes.is_empty() {
4808            self._scopes
4809                .insert(Scope::CloudPlatform.as_ref().to_string());
4810        }
4811
4812        #[allow(clippy::single_element_loop)]
4813        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4814            url = params.uri_replacement(url, param_name, find_this, true);
4815        }
4816        {
4817            let to_remove = ["parent"];
4818            params.remove_params(&to_remove);
4819        }
4820
4821        let url = params.parse_with_url(&url);
4822
4823        loop {
4824            let token = match self
4825                .hub
4826                .auth
4827                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4828                .await
4829            {
4830                Ok(token) => token,
4831                Err(e) => match dlg.token(e) {
4832                    Ok(token) => token,
4833                    Err(e) => {
4834                        dlg.finished(false);
4835                        return Err(common::Error::MissingToken(e));
4836                    }
4837                },
4838            };
4839            let mut req_result = {
4840                let client = &self.hub.client;
4841                dlg.pre_request();
4842                let mut req_builder = hyper::Request::builder()
4843                    .method(hyper::Method::GET)
4844                    .uri(url.as_str())
4845                    .header(USER_AGENT, self.hub._user_agent.clone());
4846
4847                if let Some(token) = token.as_ref() {
4848                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4849                }
4850
4851                let request = req_builder
4852                    .header(CONTENT_LENGTH, 0_u64)
4853                    .body(common::to_body::<String>(None));
4854
4855                client.request(request.unwrap()).await
4856            };
4857
4858            match req_result {
4859                Err(err) => {
4860                    if let common::Retry::After(d) = dlg.http_error(&err) {
4861                        sleep(d).await;
4862                        continue;
4863                    }
4864                    dlg.finished(false);
4865                    return Err(common::Error::HttpError(err));
4866                }
4867                Ok(res) => {
4868                    let (mut parts, body) = res.into_parts();
4869                    let mut body = common::Body::new(body);
4870                    if !parts.status.is_success() {
4871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4872                        let error = serde_json::from_str(&common::to_string(&bytes));
4873                        let response = common::to_response(parts, bytes.into());
4874
4875                        if let common::Retry::After(d) =
4876                            dlg.http_failure(&response, error.as_ref().ok())
4877                        {
4878                            sleep(d).await;
4879                            continue;
4880                        }
4881
4882                        dlg.finished(false);
4883
4884                        return Err(match error {
4885                            Ok(value) => common::Error::BadRequest(value),
4886                            _ => common::Error::Failure(response),
4887                        });
4888                    }
4889                    let response = {
4890                        let bytes = common::to_bytes(body).await.unwrap_or_default();
4891                        let encoded = common::to_string(&bytes);
4892                        match serde_json::from_str(&encoded) {
4893                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4894                            Err(error) => {
4895                                dlg.response_json_decode_error(&encoded, &error);
4896                                return Err(common::Error::JsonDecodeError(
4897                                    encoded.to_string(),
4898                                    error,
4899                                ));
4900                            }
4901                        }
4902                    };
4903
4904                    dlg.finished(true);
4905                    return Ok(response);
4906                }
4907            }
4908        }
4909    }
4910
4911    /// Required. List Secrets in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
4912    ///
4913    /// Sets the *parent* path property to the given value.
4914    ///
4915    /// Even though the property as already been set when instantiating this call,
4916    /// we provide this method for API completeness.
4917    pub fn parent(
4918        mut self,
4919        new_value: &str,
4920    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
4921        self._parent = new_value.to_string();
4922        self
4923    }
4924    /// Optional. The next_page_token value returned from a previous List request, if any.
4925    ///
4926    /// Sets the *page token* query property to the given value.
4927    pub fn page_token(
4928        mut self,
4929        new_value: &str,
4930    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
4931        self._page_token = Some(new_value.to_string());
4932        self
4933    }
4934    /// Optional. The maximum number of Secrets to return.
4935    ///
4936    /// Sets the *page size* query property to the given value.
4937    pub fn page_size(
4938        mut self,
4939        new_value: i32,
4940    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
4941        self._page_size = Some(new_value);
4942        self
4943    }
4944    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4945    /// while executing the actual API request.
4946    ///
4947    /// ````text
4948    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
4949    /// ````
4950    ///
4951    /// Sets the *delegate* property to the given value.
4952    pub fn delegate(
4953        mut self,
4954        new_value: &'a mut dyn common::Delegate,
4955    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
4956        self._delegate = Some(new_value);
4957        self
4958    }
4959
4960    /// Set any additional parameter of the query string used in the request.
4961    /// It should be used to set parameters which are not yet available through their own
4962    /// setters.
4963    ///
4964    /// Please note that this method must not be used to set any of the known parameters
4965    /// which have their own setter method. If done anyway, the request will fail.
4966    ///
4967    /// # Additional Parameters
4968    ///
4969    /// * *$.xgafv* (query-string) - V1 error format.
4970    /// * *access_token* (query-string) - OAuth access token.
4971    /// * *alt* (query-string) - Data format for response.
4972    /// * *callback* (query-string) - JSONP
4973    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4974    /// * *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.
4975    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4976    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4977    /// * *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.
4978    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4979    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4980    pub fn param<T>(
4981        mut self,
4982        name: T,
4983        value: T,
4984    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
4985    where
4986        T: AsRef<str>,
4987    {
4988        self._additional_params
4989            .insert(name.as_ref().to_string(), value.as_ref().to_string());
4990        self
4991    }
4992
4993    /// Identifies the authorization scope for the method you are building.
4994    ///
4995    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4996    /// [`Scope::CloudPlatform`].
4997    ///
4998    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4999    /// tokens for more than one scope.
5000    ///
5001    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5002    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5003    /// sufficient, a read-write scope will do as well.
5004    pub fn add_scope<St>(
5005        mut self,
5006        scope: St,
5007    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
5008    where
5009        St: AsRef<str>,
5010    {
5011        self._scopes.insert(String::from(scope.as_ref()));
5012        self
5013    }
5014    /// Identifies the authorization scope(s) for the method you are building.
5015    ///
5016    /// See [`Self::add_scope()`] for details.
5017    pub fn add_scopes<I, St>(
5018        mut self,
5019        scopes: I,
5020    ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
5021    where
5022        I: IntoIterator<Item = St>,
5023        St: AsRef<str>,
5024    {
5025        self._scopes
5026            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5027        self
5028    }
5029
5030    /// Removes all scopes, and no default scope will be used either.
5031    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5032    /// for details).
5033    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
5034        self._scopes.clear();
5035        self
5036    }
5037}
5038
5039/// Updates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
5040///
5041/// A builder for the *locations.environments.userWorkloadsSecrets.update* method supported by a *project* resource.
5042/// It is not used directly, but through a [`ProjectMethods`] instance.
5043///
5044/// # Example
5045///
5046/// Instantiate a resource method builder
5047///
5048/// ```test_harness,no_run
5049/// # extern crate hyper;
5050/// # extern crate hyper_rustls;
5051/// # extern crate google_composer1 as composer1;
5052/// use composer1::api::UserWorkloadsSecret;
5053/// # async fn dox() {
5054/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5055///
5056/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5057/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5058/// #     secret,
5059/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5060/// # ).build().await.unwrap();
5061///
5062/// # let client = hyper_util::client::legacy::Client::builder(
5063/// #     hyper_util::rt::TokioExecutor::new()
5064/// # )
5065/// # .build(
5066/// #     hyper_rustls::HttpsConnectorBuilder::new()
5067/// #         .with_native_roots()
5068/// #         .unwrap()
5069/// #         .https_or_http()
5070/// #         .enable_http1()
5071/// #         .build()
5072/// # );
5073/// # let mut hub = CloudComposer::new(client, auth);
5074/// // As the method needs a request, you would usually fill it with the desired information
5075/// // into the respective structure. Some of the parts shown here might not be applicable !
5076/// // Values shown here are possibly random and not representative !
5077/// let mut req = UserWorkloadsSecret::default();
5078///
5079/// // You can configure optional parameters by calling the respective setters at will, and
5080/// // execute the final call using `doit()`.
5081/// // Values shown here are possibly random and not representative !
5082/// let result = hub.projects().locations_environments_user_workloads_secrets_update(req, "name")
5083///              .doit().await;
5084/// # }
5085/// ```
5086pub struct ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5087where
5088    C: 'a,
5089{
5090    hub: &'a CloudComposer<C>,
5091    _request: UserWorkloadsSecret,
5092    _name: String,
5093    _delegate: Option<&'a mut dyn common::Delegate>,
5094    _additional_params: HashMap<String, String>,
5095    _scopes: BTreeSet<String>,
5096}
5097
5098impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {}
5099
5100impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5101where
5102    C: common::Connector,
5103{
5104    /// Perform the operation you have build so far.
5105    pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsSecret)> {
5106        use std::borrow::Cow;
5107        use std::io::{Read, Seek};
5108
5109        use common::{url::Params, ToParts};
5110        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5111
5112        let mut dd = common::DefaultDelegate;
5113        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5114        dlg.begin(common::MethodInfo {
5115            id: "composer.projects.locations.environments.userWorkloadsSecrets.update",
5116            http_method: hyper::Method::PUT,
5117        });
5118
5119        for &field in ["alt", "name"].iter() {
5120            if self._additional_params.contains_key(field) {
5121                dlg.finished(false);
5122                return Err(common::Error::FieldClash(field));
5123            }
5124        }
5125
5126        let mut params = Params::with_capacity(4 + self._additional_params.len());
5127        params.push("name", self._name);
5128
5129        params.extend(self._additional_params.iter());
5130
5131        params.push("alt", "json");
5132        let mut url = self.hub._base_url.clone() + "v1/{+name}";
5133        if self._scopes.is_empty() {
5134            self._scopes
5135                .insert(Scope::CloudPlatform.as_ref().to_string());
5136        }
5137
5138        #[allow(clippy::single_element_loop)]
5139        for &(find_this, param_name) in [("{+name}", "name")].iter() {
5140            url = params.uri_replacement(url, param_name, find_this, true);
5141        }
5142        {
5143            let to_remove = ["name"];
5144            params.remove_params(&to_remove);
5145        }
5146
5147        let url = params.parse_with_url(&url);
5148
5149        let mut json_mime_type = mime::APPLICATION_JSON;
5150        let mut request_value_reader = {
5151            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5152            common::remove_json_null_values(&mut value);
5153            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5154            serde_json::to_writer(&mut dst, &value).unwrap();
5155            dst
5156        };
5157        let request_size = request_value_reader
5158            .seek(std::io::SeekFrom::End(0))
5159            .unwrap();
5160        request_value_reader
5161            .seek(std::io::SeekFrom::Start(0))
5162            .unwrap();
5163
5164        loop {
5165            let token = match self
5166                .hub
5167                .auth
5168                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5169                .await
5170            {
5171                Ok(token) => token,
5172                Err(e) => match dlg.token(e) {
5173                    Ok(token) => token,
5174                    Err(e) => {
5175                        dlg.finished(false);
5176                        return Err(common::Error::MissingToken(e));
5177                    }
5178                },
5179            };
5180            request_value_reader
5181                .seek(std::io::SeekFrom::Start(0))
5182                .unwrap();
5183            let mut req_result = {
5184                let client = &self.hub.client;
5185                dlg.pre_request();
5186                let mut req_builder = hyper::Request::builder()
5187                    .method(hyper::Method::PUT)
5188                    .uri(url.as_str())
5189                    .header(USER_AGENT, self.hub._user_agent.clone());
5190
5191                if let Some(token) = token.as_ref() {
5192                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5193                }
5194
5195                let request = req_builder
5196                    .header(CONTENT_TYPE, json_mime_type.to_string())
5197                    .header(CONTENT_LENGTH, request_size as u64)
5198                    .body(common::to_body(
5199                        request_value_reader.get_ref().clone().into(),
5200                    ));
5201
5202                client.request(request.unwrap()).await
5203            };
5204
5205            match req_result {
5206                Err(err) => {
5207                    if let common::Retry::After(d) = dlg.http_error(&err) {
5208                        sleep(d).await;
5209                        continue;
5210                    }
5211                    dlg.finished(false);
5212                    return Err(common::Error::HttpError(err));
5213                }
5214                Ok(res) => {
5215                    let (mut parts, body) = res.into_parts();
5216                    let mut body = common::Body::new(body);
5217                    if !parts.status.is_success() {
5218                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5219                        let error = serde_json::from_str(&common::to_string(&bytes));
5220                        let response = common::to_response(parts, bytes.into());
5221
5222                        if let common::Retry::After(d) =
5223                            dlg.http_failure(&response, error.as_ref().ok())
5224                        {
5225                            sleep(d).await;
5226                            continue;
5227                        }
5228
5229                        dlg.finished(false);
5230
5231                        return Err(match error {
5232                            Ok(value) => common::Error::BadRequest(value),
5233                            _ => common::Error::Failure(response),
5234                        });
5235                    }
5236                    let response = {
5237                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5238                        let encoded = common::to_string(&bytes);
5239                        match serde_json::from_str(&encoded) {
5240                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5241                            Err(error) => {
5242                                dlg.response_json_decode_error(&encoded, &error);
5243                                return Err(common::Error::JsonDecodeError(
5244                                    encoded.to_string(),
5245                                    error,
5246                                ));
5247                            }
5248                        }
5249                    };
5250
5251                    dlg.finished(true);
5252                    return Ok(response);
5253                }
5254            }
5255        }
5256    }
5257
5258    ///
5259    /// Sets the *request* property to the given value.
5260    ///
5261    /// Even though the property as already been set when instantiating this call,
5262    /// we provide this method for API completeness.
5263    pub fn request(
5264        mut self,
5265        new_value: UserWorkloadsSecret,
5266    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5267        self._request = new_value;
5268        self
5269    }
5270    /// Identifier. The resource name of the Secret, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
5271    ///
5272    /// Sets the *name* path property to the given value.
5273    ///
5274    /// Even though the property as already been set when instantiating this call,
5275    /// we provide this method for API completeness.
5276    pub fn name(
5277        mut self,
5278        new_value: &str,
5279    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5280        self._name = new_value.to_string();
5281        self
5282    }
5283    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5284    /// while executing the actual API request.
5285    ///
5286    /// ````text
5287    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5288    /// ````
5289    ///
5290    /// Sets the *delegate* property to the given value.
5291    pub fn delegate(
5292        mut self,
5293        new_value: &'a mut dyn common::Delegate,
5294    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5295        self._delegate = Some(new_value);
5296        self
5297    }
5298
5299    /// Set any additional parameter of the query string used in the request.
5300    /// It should be used to set parameters which are not yet available through their own
5301    /// setters.
5302    ///
5303    /// Please note that this method must not be used to set any of the known parameters
5304    /// which have their own setter method. If done anyway, the request will fail.
5305    ///
5306    /// # Additional Parameters
5307    ///
5308    /// * *$.xgafv* (query-string) - V1 error format.
5309    /// * *access_token* (query-string) - OAuth access token.
5310    /// * *alt* (query-string) - Data format for response.
5311    /// * *callback* (query-string) - JSONP
5312    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5313    /// * *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.
5314    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5315    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5316    /// * *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.
5317    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5318    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5319    pub fn param<T>(
5320        mut self,
5321        name: T,
5322        value: T,
5323    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5324    where
5325        T: AsRef<str>,
5326    {
5327        self._additional_params
5328            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5329        self
5330    }
5331
5332    /// Identifies the authorization scope for the method you are building.
5333    ///
5334    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5335    /// [`Scope::CloudPlatform`].
5336    ///
5337    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5338    /// tokens for more than one scope.
5339    ///
5340    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5341    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5342    /// sufficient, a read-write scope will do as well.
5343    pub fn add_scope<St>(
5344        mut self,
5345        scope: St,
5346    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5347    where
5348        St: AsRef<str>,
5349    {
5350        self._scopes.insert(String::from(scope.as_ref()));
5351        self
5352    }
5353    /// Identifies the authorization scope(s) for the method you are building.
5354    ///
5355    /// See [`Self::add_scope()`] for details.
5356    pub fn add_scopes<I, St>(
5357        mut self,
5358        scopes: I,
5359    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5360    where
5361        I: IntoIterator<Item = St>,
5362        St: AsRef<str>,
5363    {
5364        self._scopes
5365            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5366        self
5367    }
5368
5369    /// Removes all scopes, and no default scope will be used either.
5370    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5371    /// for details).
5372    pub fn clear_scopes(
5373        mut self,
5374    ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5375        self._scopes.clear();
5376        self
5377    }
5378}
5379
5380/// Lists workloads in a Cloud Composer environment. Workload is a unit that runs a single Composer component. This method is supported for Cloud Composer environments in versions composer-3.*.*-airflow-*.*.* and newer.
5381///
5382/// A builder for the *locations.environments.workloads.list* method supported by a *project* resource.
5383/// It is not used directly, but through a [`ProjectMethods`] instance.
5384///
5385/// # Example
5386///
5387/// Instantiate a resource method builder
5388///
5389/// ```test_harness,no_run
5390/// # extern crate hyper;
5391/// # extern crate hyper_rustls;
5392/// # extern crate google_composer1 as composer1;
5393/// # async fn dox() {
5394/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5395///
5396/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5397/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5398/// #     secret,
5399/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5400/// # ).build().await.unwrap();
5401///
5402/// # let client = hyper_util::client::legacy::Client::builder(
5403/// #     hyper_util::rt::TokioExecutor::new()
5404/// # )
5405/// # .build(
5406/// #     hyper_rustls::HttpsConnectorBuilder::new()
5407/// #         .with_native_roots()
5408/// #         .unwrap()
5409/// #         .https_or_http()
5410/// #         .enable_http1()
5411/// #         .build()
5412/// # );
5413/// # let mut hub = CloudComposer::new(client, auth);
5414/// // You can configure optional parameters by calling the respective setters at will, and
5415/// // execute the final call using `doit()`.
5416/// // Values shown here are possibly random and not representative !
5417/// let result = hub.projects().locations_environments_workloads_list("parent")
5418///              .page_token("ea")
5419///              .page_size(-55)
5420///              .filter("invidunt")
5421///              .doit().await;
5422/// # }
5423/// ```
5424pub struct ProjectLocationEnvironmentWorkloadListCall<'a, C>
5425where
5426    C: 'a,
5427{
5428    hub: &'a CloudComposer<C>,
5429    _parent: String,
5430    _page_token: Option<String>,
5431    _page_size: Option<i32>,
5432    _filter: Option<String>,
5433    _delegate: Option<&'a mut dyn common::Delegate>,
5434    _additional_params: HashMap<String, String>,
5435    _scopes: BTreeSet<String>,
5436}
5437
5438impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentWorkloadListCall<'a, C> {}
5439
5440impl<'a, C> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5441where
5442    C: common::Connector,
5443{
5444    /// Perform the operation you have build so far.
5445    pub async fn doit(mut self) -> common::Result<(common::Response, ListWorkloadsResponse)> {
5446        use std::borrow::Cow;
5447        use std::io::{Read, Seek};
5448
5449        use common::{url::Params, ToParts};
5450        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5451
5452        let mut dd = common::DefaultDelegate;
5453        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5454        dlg.begin(common::MethodInfo {
5455            id: "composer.projects.locations.environments.workloads.list",
5456            http_method: hyper::Method::GET,
5457        });
5458
5459        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
5460            if self._additional_params.contains_key(field) {
5461                dlg.finished(false);
5462                return Err(common::Error::FieldClash(field));
5463            }
5464        }
5465
5466        let mut params = Params::with_capacity(6 + self._additional_params.len());
5467        params.push("parent", self._parent);
5468        if let Some(value) = self._page_token.as_ref() {
5469            params.push("pageToken", value);
5470        }
5471        if let Some(value) = self._page_size.as_ref() {
5472            params.push("pageSize", value.to_string());
5473        }
5474        if let Some(value) = self._filter.as_ref() {
5475            params.push("filter", value);
5476        }
5477
5478        params.extend(self._additional_params.iter());
5479
5480        params.push("alt", "json");
5481        let mut url = self.hub._base_url.clone() + "v1/{+parent}/workloads";
5482        if self._scopes.is_empty() {
5483            self._scopes
5484                .insert(Scope::CloudPlatform.as_ref().to_string());
5485        }
5486
5487        #[allow(clippy::single_element_loop)]
5488        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5489            url = params.uri_replacement(url, param_name, find_this, true);
5490        }
5491        {
5492            let to_remove = ["parent"];
5493            params.remove_params(&to_remove);
5494        }
5495
5496        let url = params.parse_with_url(&url);
5497
5498        loop {
5499            let token = match self
5500                .hub
5501                .auth
5502                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5503                .await
5504            {
5505                Ok(token) => token,
5506                Err(e) => match dlg.token(e) {
5507                    Ok(token) => token,
5508                    Err(e) => {
5509                        dlg.finished(false);
5510                        return Err(common::Error::MissingToken(e));
5511                    }
5512                },
5513            };
5514            let mut req_result = {
5515                let client = &self.hub.client;
5516                dlg.pre_request();
5517                let mut req_builder = hyper::Request::builder()
5518                    .method(hyper::Method::GET)
5519                    .uri(url.as_str())
5520                    .header(USER_AGENT, self.hub._user_agent.clone());
5521
5522                if let Some(token) = token.as_ref() {
5523                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5524                }
5525
5526                let request = req_builder
5527                    .header(CONTENT_LENGTH, 0_u64)
5528                    .body(common::to_body::<String>(None));
5529
5530                client.request(request.unwrap()).await
5531            };
5532
5533            match req_result {
5534                Err(err) => {
5535                    if let common::Retry::After(d) = dlg.http_error(&err) {
5536                        sleep(d).await;
5537                        continue;
5538                    }
5539                    dlg.finished(false);
5540                    return Err(common::Error::HttpError(err));
5541                }
5542                Ok(res) => {
5543                    let (mut parts, body) = res.into_parts();
5544                    let mut body = common::Body::new(body);
5545                    if !parts.status.is_success() {
5546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5547                        let error = serde_json::from_str(&common::to_string(&bytes));
5548                        let response = common::to_response(parts, bytes.into());
5549
5550                        if let common::Retry::After(d) =
5551                            dlg.http_failure(&response, error.as_ref().ok())
5552                        {
5553                            sleep(d).await;
5554                            continue;
5555                        }
5556
5557                        dlg.finished(false);
5558
5559                        return Err(match error {
5560                            Ok(value) => common::Error::BadRequest(value),
5561                            _ => common::Error::Failure(response),
5562                        });
5563                    }
5564                    let response = {
5565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5566                        let encoded = common::to_string(&bytes);
5567                        match serde_json::from_str(&encoded) {
5568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5569                            Err(error) => {
5570                                dlg.response_json_decode_error(&encoded, &error);
5571                                return Err(common::Error::JsonDecodeError(
5572                                    encoded.to_string(),
5573                                    error,
5574                                ));
5575                            }
5576                        }
5577                    };
5578
5579                    dlg.finished(true);
5580                    return Ok(response);
5581                }
5582            }
5583        }
5584    }
5585
5586    /// Required. The environment name to get workloads for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
5587    ///
5588    /// Sets the *parent* path property to the given value.
5589    ///
5590    /// Even though the property as already been set when instantiating this call,
5591    /// we provide this method for API completeness.
5592    pub fn parent(mut self, new_value: &str) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5593        self._parent = new_value.to_string();
5594        self
5595    }
5596    /// Optional. The next_page_token value returned from a previous List request, if any.
5597    ///
5598    /// Sets the *page token* query property to the given value.
5599    pub fn page_token(
5600        mut self,
5601        new_value: &str,
5602    ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5603        self._page_token = Some(new_value.to_string());
5604        self
5605    }
5606    /// Optional. The maximum number of environments to return.
5607    ///
5608    /// Sets the *page size* query property to the given value.
5609    pub fn page_size(
5610        mut self,
5611        new_value: i32,
5612    ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5613        self._page_size = Some(new_value);
5614        self
5615    }
5616    /// Optional. The list filter. Currently only supports equality on the type field. The value of a field specified in the filter expression must be one ComposerWorkloadType enum option. It's possible to get multiple types using "OR" operator, e.g.: "type=SCHEDULER OR type=CELERY_WORKER". If not specified, all items are returned.
5617    ///
5618    /// Sets the *filter* query property to the given value.
5619    pub fn filter(mut self, new_value: &str) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5620        self._filter = Some(new_value.to_string());
5621        self
5622    }
5623    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5624    /// while executing the actual API request.
5625    ///
5626    /// ````text
5627    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5628    /// ````
5629    ///
5630    /// Sets the *delegate* property to the given value.
5631    pub fn delegate(
5632        mut self,
5633        new_value: &'a mut dyn common::Delegate,
5634    ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5635        self._delegate = Some(new_value);
5636        self
5637    }
5638
5639    /// Set any additional parameter of the query string used in the request.
5640    /// It should be used to set parameters which are not yet available through their own
5641    /// setters.
5642    ///
5643    /// Please note that this method must not be used to set any of the known parameters
5644    /// which have their own setter method. If done anyway, the request will fail.
5645    ///
5646    /// # Additional Parameters
5647    ///
5648    /// * *$.xgafv* (query-string) - V1 error format.
5649    /// * *access_token* (query-string) - OAuth access token.
5650    /// * *alt* (query-string) - Data format for response.
5651    /// * *callback* (query-string) - JSONP
5652    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5653    /// * *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.
5654    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5655    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5656    /// * *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.
5657    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5658    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5659    pub fn param<T>(
5660        mut self,
5661        name: T,
5662        value: T,
5663    ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5664    where
5665        T: AsRef<str>,
5666    {
5667        self._additional_params
5668            .insert(name.as_ref().to_string(), value.as_ref().to_string());
5669        self
5670    }
5671
5672    /// Identifies the authorization scope for the method you are building.
5673    ///
5674    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5675    /// [`Scope::CloudPlatform`].
5676    ///
5677    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5678    /// tokens for more than one scope.
5679    ///
5680    /// Usually there is more than one suitable scope to authorize an operation, some of which may
5681    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5682    /// sufficient, a read-write scope will do as well.
5683    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5684    where
5685        St: AsRef<str>,
5686    {
5687        self._scopes.insert(String::from(scope.as_ref()));
5688        self
5689    }
5690    /// Identifies the authorization scope(s) for the method you are building.
5691    ///
5692    /// See [`Self::add_scope()`] for details.
5693    pub fn add_scopes<I, St>(
5694        mut self,
5695        scopes: I,
5696    ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5697    where
5698        I: IntoIterator<Item = St>,
5699        St: AsRef<str>,
5700    {
5701        self._scopes
5702            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5703        self
5704    }
5705
5706    /// Removes all scopes, and no default scope will be used either.
5707    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5708    /// for details).
5709    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5710        self._scopes.clear();
5711        self
5712    }
5713}
5714
5715/// Check if an upgrade operation on the environment will succeed. In case of problems detailed info can be found in the returned Operation.
5716///
5717/// A builder for the *locations.environments.checkUpgrade* method supported by a *project* resource.
5718/// It is not used directly, but through a [`ProjectMethods`] instance.
5719///
5720/// # Example
5721///
5722/// Instantiate a resource method builder
5723///
5724/// ```test_harness,no_run
5725/// # extern crate hyper;
5726/// # extern crate hyper_rustls;
5727/// # extern crate google_composer1 as composer1;
5728/// use composer1::api::CheckUpgradeRequest;
5729/// # async fn dox() {
5730/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5731///
5732/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
5734/// #     secret,
5735/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5736/// # ).build().await.unwrap();
5737///
5738/// # let client = hyper_util::client::legacy::Client::builder(
5739/// #     hyper_util::rt::TokioExecutor::new()
5740/// # )
5741/// # .build(
5742/// #     hyper_rustls::HttpsConnectorBuilder::new()
5743/// #         .with_native_roots()
5744/// #         .unwrap()
5745/// #         .https_or_http()
5746/// #         .enable_http1()
5747/// #         .build()
5748/// # );
5749/// # let mut hub = CloudComposer::new(client, auth);
5750/// // As the method needs a request, you would usually fill it with the desired information
5751/// // into the respective structure. Some of the parts shown here might not be applicable !
5752/// // Values shown here are possibly random and not representative !
5753/// let mut req = CheckUpgradeRequest::default();
5754///
5755/// // You can configure optional parameters by calling the respective setters at will, and
5756/// // execute the final call using `doit()`.
5757/// // Values shown here are possibly random and not representative !
5758/// let result = hub.projects().locations_environments_check_upgrade(req, "environment")
5759///              .doit().await;
5760/// # }
5761/// ```
5762pub struct ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
5763where
5764    C: 'a,
5765{
5766    hub: &'a CloudComposer<C>,
5767    _request: CheckUpgradeRequest,
5768    _environment: String,
5769    _delegate: Option<&'a mut dyn common::Delegate>,
5770    _additional_params: HashMap<String, String>,
5771    _scopes: BTreeSet<String>,
5772}
5773
5774impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {}
5775
5776impl<'a, C> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
5777where
5778    C: common::Connector,
5779{
5780    /// Perform the operation you have build so far.
5781    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5782        use std::borrow::Cow;
5783        use std::io::{Read, Seek};
5784
5785        use common::{url::Params, ToParts};
5786        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5787
5788        let mut dd = common::DefaultDelegate;
5789        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5790        dlg.begin(common::MethodInfo {
5791            id: "composer.projects.locations.environments.checkUpgrade",
5792            http_method: hyper::Method::POST,
5793        });
5794
5795        for &field in ["alt", "environment"].iter() {
5796            if self._additional_params.contains_key(field) {
5797                dlg.finished(false);
5798                return Err(common::Error::FieldClash(field));
5799            }
5800        }
5801
5802        let mut params = Params::with_capacity(4 + self._additional_params.len());
5803        params.push("environment", self._environment);
5804
5805        params.extend(self._additional_params.iter());
5806
5807        params.push("alt", "json");
5808        let mut url = self.hub._base_url.clone() + "v1/{+environment}:checkUpgrade";
5809        if self._scopes.is_empty() {
5810            self._scopes
5811                .insert(Scope::CloudPlatform.as_ref().to_string());
5812        }
5813
5814        #[allow(clippy::single_element_loop)]
5815        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
5816            url = params.uri_replacement(url, param_name, find_this, true);
5817        }
5818        {
5819            let to_remove = ["environment"];
5820            params.remove_params(&to_remove);
5821        }
5822
5823        let url = params.parse_with_url(&url);
5824
5825        let mut json_mime_type = mime::APPLICATION_JSON;
5826        let mut request_value_reader = {
5827            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5828            common::remove_json_null_values(&mut value);
5829            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5830            serde_json::to_writer(&mut dst, &value).unwrap();
5831            dst
5832        };
5833        let request_size = request_value_reader
5834            .seek(std::io::SeekFrom::End(0))
5835            .unwrap();
5836        request_value_reader
5837            .seek(std::io::SeekFrom::Start(0))
5838            .unwrap();
5839
5840        loop {
5841            let token = match self
5842                .hub
5843                .auth
5844                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5845                .await
5846            {
5847                Ok(token) => token,
5848                Err(e) => match dlg.token(e) {
5849                    Ok(token) => token,
5850                    Err(e) => {
5851                        dlg.finished(false);
5852                        return Err(common::Error::MissingToken(e));
5853                    }
5854                },
5855            };
5856            request_value_reader
5857                .seek(std::io::SeekFrom::Start(0))
5858                .unwrap();
5859            let mut req_result = {
5860                let client = &self.hub.client;
5861                dlg.pre_request();
5862                let mut req_builder = hyper::Request::builder()
5863                    .method(hyper::Method::POST)
5864                    .uri(url.as_str())
5865                    .header(USER_AGENT, self.hub._user_agent.clone());
5866
5867                if let Some(token) = token.as_ref() {
5868                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5869                }
5870
5871                let request = req_builder
5872                    .header(CONTENT_TYPE, json_mime_type.to_string())
5873                    .header(CONTENT_LENGTH, request_size as u64)
5874                    .body(common::to_body(
5875                        request_value_reader.get_ref().clone().into(),
5876                    ));
5877
5878                client.request(request.unwrap()).await
5879            };
5880
5881            match req_result {
5882                Err(err) => {
5883                    if let common::Retry::After(d) = dlg.http_error(&err) {
5884                        sleep(d).await;
5885                        continue;
5886                    }
5887                    dlg.finished(false);
5888                    return Err(common::Error::HttpError(err));
5889                }
5890                Ok(res) => {
5891                    let (mut parts, body) = res.into_parts();
5892                    let mut body = common::Body::new(body);
5893                    if !parts.status.is_success() {
5894                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5895                        let error = serde_json::from_str(&common::to_string(&bytes));
5896                        let response = common::to_response(parts, bytes.into());
5897
5898                        if let common::Retry::After(d) =
5899                            dlg.http_failure(&response, error.as_ref().ok())
5900                        {
5901                            sleep(d).await;
5902                            continue;
5903                        }
5904
5905                        dlg.finished(false);
5906
5907                        return Err(match error {
5908                            Ok(value) => common::Error::BadRequest(value),
5909                            _ => common::Error::Failure(response),
5910                        });
5911                    }
5912                    let response = {
5913                        let bytes = common::to_bytes(body).await.unwrap_or_default();
5914                        let encoded = common::to_string(&bytes);
5915                        match serde_json::from_str(&encoded) {
5916                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5917                            Err(error) => {
5918                                dlg.response_json_decode_error(&encoded, &error);
5919                                return Err(common::Error::JsonDecodeError(
5920                                    encoded.to_string(),
5921                                    error,
5922                                ));
5923                            }
5924                        }
5925                    };
5926
5927                    dlg.finished(true);
5928                    return Ok(response);
5929                }
5930            }
5931        }
5932    }
5933
5934    ///
5935    /// Sets the *request* property to the given value.
5936    ///
5937    /// Even though the property as already been set when instantiating this call,
5938    /// we provide this method for API completeness.
5939    pub fn request(
5940        mut self,
5941        new_value: CheckUpgradeRequest,
5942    ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
5943        self._request = new_value;
5944        self
5945    }
5946    /// Required. The resource name of the environment to check upgrade for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
5947    ///
5948    /// Sets the *environment* path property to the given value.
5949    ///
5950    /// Even though the property as already been set when instantiating this call,
5951    /// we provide this method for API completeness.
5952    pub fn environment(
5953        mut self,
5954        new_value: &str,
5955    ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
5956        self._environment = new_value.to_string();
5957        self
5958    }
5959    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5960    /// while executing the actual API request.
5961    ///
5962    /// ````text
5963    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
5964    /// ````
5965    ///
5966    /// Sets the *delegate* property to the given value.
5967    pub fn delegate(
5968        mut self,
5969        new_value: &'a mut dyn common::Delegate,
5970    ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
5971        self._delegate = Some(new_value);
5972        self
5973    }
5974
5975    /// Set any additional parameter of the query string used in the request.
5976    /// It should be used to set parameters which are not yet available through their own
5977    /// setters.
5978    ///
5979    /// Please note that this method must not be used to set any of the known parameters
5980    /// which have their own setter method. If done anyway, the request will fail.
5981    ///
5982    /// # Additional Parameters
5983    ///
5984    /// * *$.xgafv* (query-string) - V1 error format.
5985    /// * *access_token* (query-string) - OAuth access token.
5986    /// * *alt* (query-string) - Data format for response.
5987    /// * *callback* (query-string) - JSONP
5988    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5989    /// * *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.
5990    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5991    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5992    /// * *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.
5993    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5994    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5995    pub fn param<T>(
5996        mut self,
5997        name: T,
5998        value: T,
5999    ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
6000    where
6001        T: AsRef<str>,
6002    {
6003        self._additional_params
6004            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6005        self
6006    }
6007
6008    /// Identifies the authorization scope for the method you are building.
6009    ///
6010    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6011    /// [`Scope::CloudPlatform`].
6012    ///
6013    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6014    /// tokens for more than one scope.
6015    ///
6016    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6017    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6018    /// sufficient, a read-write scope will do as well.
6019    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
6020    where
6021        St: AsRef<str>,
6022    {
6023        self._scopes.insert(String::from(scope.as_ref()));
6024        self
6025    }
6026    /// Identifies the authorization scope(s) for the method you are building.
6027    ///
6028    /// See [`Self::add_scope()`] for details.
6029    pub fn add_scopes<I, St>(
6030        mut self,
6031        scopes: I,
6032    ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
6033    where
6034        I: IntoIterator<Item = St>,
6035        St: AsRef<str>,
6036    {
6037        self._scopes
6038            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6039        self
6040    }
6041
6042    /// Removes all scopes, and no default scope will be used either.
6043    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6044    /// for details).
6045    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
6046        self._scopes.clear();
6047        self
6048    }
6049}
6050
6051/// Create a new environment.
6052///
6053/// A builder for the *locations.environments.create* method supported by a *project* resource.
6054/// It is not used directly, but through a [`ProjectMethods`] instance.
6055///
6056/// # Example
6057///
6058/// Instantiate a resource method builder
6059///
6060/// ```test_harness,no_run
6061/// # extern crate hyper;
6062/// # extern crate hyper_rustls;
6063/// # extern crate google_composer1 as composer1;
6064/// use composer1::api::Environment;
6065/// # async fn dox() {
6066/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6067///
6068/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6069/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6070/// #     secret,
6071/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6072/// # ).build().await.unwrap();
6073///
6074/// # let client = hyper_util::client::legacy::Client::builder(
6075/// #     hyper_util::rt::TokioExecutor::new()
6076/// # )
6077/// # .build(
6078/// #     hyper_rustls::HttpsConnectorBuilder::new()
6079/// #         .with_native_roots()
6080/// #         .unwrap()
6081/// #         .https_or_http()
6082/// #         .enable_http1()
6083/// #         .build()
6084/// # );
6085/// # let mut hub = CloudComposer::new(client, auth);
6086/// // As the method needs a request, you would usually fill it with the desired information
6087/// // into the respective structure. Some of the parts shown here might not be applicable !
6088/// // Values shown here are possibly random and not representative !
6089/// let mut req = Environment::default();
6090///
6091/// // You can configure optional parameters by calling the respective setters at will, and
6092/// // execute the final call using `doit()`.
6093/// // Values shown here are possibly random and not representative !
6094/// let result = hub.projects().locations_environments_create(req, "parent")
6095///              .doit().await;
6096/// # }
6097/// ```
6098pub struct ProjectLocationEnvironmentCreateCall<'a, C>
6099where
6100    C: 'a,
6101{
6102    hub: &'a CloudComposer<C>,
6103    _request: Environment,
6104    _parent: String,
6105    _delegate: Option<&'a mut dyn common::Delegate>,
6106    _additional_params: HashMap<String, String>,
6107    _scopes: BTreeSet<String>,
6108}
6109
6110impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentCreateCall<'a, C> {}
6111
6112impl<'a, C> ProjectLocationEnvironmentCreateCall<'a, C>
6113where
6114    C: common::Connector,
6115{
6116    /// Perform the operation you have build so far.
6117    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6118        use std::borrow::Cow;
6119        use std::io::{Read, Seek};
6120
6121        use common::{url::Params, ToParts};
6122        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6123
6124        let mut dd = common::DefaultDelegate;
6125        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6126        dlg.begin(common::MethodInfo {
6127            id: "composer.projects.locations.environments.create",
6128            http_method: hyper::Method::POST,
6129        });
6130
6131        for &field in ["alt", "parent"].iter() {
6132            if self._additional_params.contains_key(field) {
6133                dlg.finished(false);
6134                return Err(common::Error::FieldClash(field));
6135            }
6136        }
6137
6138        let mut params = Params::with_capacity(4 + self._additional_params.len());
6139        params.push("parent", self._parent);
6140
6141        params.extend(self._additional_params.iter());
6142
6143        params.push("alt", "json");
6144        let mut url = self.hub._base_url.clone() + "v1/{+parent}/environments";
6145        if self._scopes.is_empty() {
6146            self._scopes
6147                .insert(Scope::CloudPlatform.as_ref().to_string());
6148        }
6149
6150        #[allow(clippy::single_element_loop)]
6151        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6152            url = params.uri_replacement(url, param_name, find_this, true);
6153        }
6154        {
6155            let to_remove = ["parent"];
6156            params.remove_params(&to_remove);
6157        }
6158
6159        let url = params.parse_with_url(&url);
6160
6161        let mut json_mime_type = mime::APPLICATION_JSON;
6162        let mut request_value_reader = {
6163            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6164            common::remove_json_null_values(&mut value);
6165            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6166            serde_json::to_writer(&mut dst, &value).unwrap();
6167            dst
6168        };
6169        let request_size = request_value_reader
6170            .seek(std::io::SeekFrom::End(0))
6171            .unwrap();
6172        request_value_reader
6173            .seek(std::io::SeekFrom::Start(0))
6174            .unwrap();
6175
6176        loop {
6177            let token = match self
6178                .hub
6179                .auth
6180                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6181                .await
6182            {
6183                Ok(token) => token,
6184                Err(e) => match dlg.token(e) {
6185                    Ok(token) => token,
6186                    Err(e) => {
6187                        dlg.finished(false);
6188                        return Err(common::Error::MissingToken(e));
6189                    }
6190                },
6191            };
6192            request_value_reader
6193                .seek(std::io::SeekFrom::Start(0))
6194                .unwrap();
6195            let mut req_result = {
6196                let client = &self.hub.client;
6197                dlg.pre_request();
6198                let mut req_builder = hyper::Request::builder()
6199                    .method(hyper::Method::POST)
6200                    .uri(url.as_str())
6201                    .header(USER_AGENT, self.hub._user_agent.clone());
6202
6203                if let Some(token) = token.as_ref() {
6204                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6205                }
6206
6207                let request = req_builder
6208                    .header(CONTENT_TYPE, json_mime_type.to_string())
6209                    .header(CONTENT_LENGTH, request_size as u64)
6210                    .body(common::to_body(
6211                        request_value_reader.get_ref().clone().into(),
6212                    ));
6213
6214                client.request(request.unwrap()).await
6215            };
6216
6217            match req_result {
6218                Err(err) => {
6219                    if let common::Retry::After(d) = dlg.http_error(&err) {
6220                        sleep(d).await;
6221                        continue;
6222                    }
6223                    dlg.finished(false);
6224                    return Err(common::Error::HttpError(err));
6225                }
6226                Ok(res) => {
6227                    let (mut parts, body) = res.into_parts();
6228                    let mut body = common::Body::new(body);
6229                    if !parts.status.is_success() {
6230                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6231                        let error = serde_json::from_str(&common::to_string(&bytes));
6232                        let response = common::to_response(parts, bytes.into());
6233
6234                        if let common::Retry::After(d) =
6235                            dlg.http_failure(&response, error.as_ref().ok())
6236                        {
6237                            sleep(d).await;
6238                            continue;
6239                        }
6240
6241                        dlg.finished(false);
6242
6243                        return Err(match error {
6244                            Ok(value) => common::Error::BadRequest(value),
6245                            _ => common::Error::Failure(response),
6246                        });
6247                    }
6248                    let response = {
6249                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6250                        let encoded = common::to_string(&bytes);
6251                        match serde_json::from_str(&encoded) {
6252                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6253                            Err(error) => {
6254                                dlg.response_json_decode_error(&encoded, &error);
6255                                return Err(common::Error::JsonDecodeError(
6256                                    encoded.to_string(),
6257                                    error,
6258                                ));
6259                            }
6260                        }
6261                    };
6262
6263                    dlg.finished(true);
6264                    return Ok(response);
6265                }
6266            }
6267        }
6268    }
6269
6270    ///
6271    /// Sets the *request* property to the given value.
6272    ///
6273    /// Even though the property as already been set when instantiating this call,
6274    /// we provide this method for API completeness.
6275    pub fn request(
6276        mut self,
6277        new_value: Environment,
6278    ) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6279        self._request = new_value;
6280        self
6281    }
6282    /// The parent must be of the form "projects/{projectId}/locations/{locationId}".
6283    ///
6284    /// Sets the *parent* path property to the given value.
6285    ///
6286    /// Even though the property as already been set when instantiating this call,
6287    /// we provide this method for API completeness.
6288    pub fn parent(mut self, new_value: &str) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6289        self._parent = new_value.to_string();
6290        self
6291    }
6292    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6293    /// while executing the actual API request.
6294    ///
6295    /// ````text
6296    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6297    /// ````
6298    ///
6299    /// Sets the *delegate* property to the given value.
6300    pub fn delegate(
6301        mut self,
6302        new_value: &'a mut dyn common::Delegate,
6303    ) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6304        self._delegate = Some(new_value);
6305        self
6306    }
6307
6308    /// Set any additional parameter of the query string used in the request.
6309    /// It should be used to set parameters which are not yet available through their own
6310    /// setters.
6311    ///
6312    /// Please note that this method must not be used to set any of the known parameters
6313    /// which have their own setter method. If done anyway, the request will fail.
6314    ///
6315    /// # Additional Parameters
6316    ///
6317    /// * *$.xgafv* (query-string) - V1 error format.
6318    /// * *access_token* (query-string) - OAuth access token.
6319    /// * *alt* (query-string) - Data format for response.
6320    /// * *callback* (query-string) - JSONP
6321    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6322    /// * *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.
6323    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6324    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6325    /// * *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.
6326    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6327    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6328    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentCreateCall<'a, C>
6329    where
6330        T: AsRef<str>,
6331    {
6332        self._additional_params
6333            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6334        self
6335    }
6336
6337    /// Identifies the authorization scope for the method you are building.
6338    ///
6339    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6340    /// [`Scope::CloudPlatform`].
6341    ///
6342    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6343    /// tokens for more than one scope.
6344    ///
6345    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6346    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6347    /// sufficient, a read-write scope will do as well.
6348    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentCreateCall<'a, C>
6349    where
6350        St: AsRef<str>,
6351    {
6352        self._scopes.insert(String::from(scope.as_ref()));
6353        self
6354    }
6355    /// Identifies the authorization scope(s) for the method you are building.
6356    ///
6357    /// See [`Self::add_scope()`] for details.
6358    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentCreateCall<'a, C>
6359    where
6360        I: IntoIterator<Item = St>,
6361        St: AsRef<str>,
6362    {
6363        self._scopes
6364            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6365        self
6366    }
6367
6368    /// Removes all scopes, and no default scope will be used either.
6369    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6370    /// for details).
6371    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6372        self._scopes.clear();
6373        self
6374    }
6375}
6376
6377/// Triggers database failover (only for highly resilient environments).
6378///
6379/// A builder for the *locations.environments.databaseFailover* method supported by a *project* resource.
6380/// It is not used directly, but through a [`ProjectMethods`] instance.
6381///
6382/// # Example
6383///
6384/// Instantiate a resource method builder
6385///
6386/// ```test_harness,no_run
6387/// # extern crate hyper;
6388/// # extern crate hyper_rustls;
6389/// # extern crate google_composer1 as composer1;
6390/// use composer1::api::DatabaseFailoverRequest;
6391/// # async fn dox() {
6392/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6393///
6394/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6395/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6396/// #     secret,
6397/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6398/// # ).build().await.unwrap();
6399///
6400/// # let client = hyper_util::client::legacy::Client::builder(
6401/// #     hyper_util::rt::TokioExecutor::new()
6402/// # )
6403/// # .build(
6404/// #     hyper_rustls::HttpsConnectorBuilder::new()
6405/// #         .with_native_roots()
6406/// #         .unwrap()
6407/// #         .https_or_http()
6408/// #         .enable_http1()
6409/// #         .build()
6410/// # );
6411/// # let mut hub = CloudComposer::new(client, auth);
6412/// // As the method needs a request, you would usually fill it with the desired information
6413/// // into the respective structure. Some of the parts shown here might not be applicable !
6414/// // Values shown here are possibly random and not representative !
6415/// let mut req = DatabaseFailoverRequest::default();
6416///
6417/// // You can configure optional parameters by calling the respective setters at will, and
6418/// // execute the final call using `doit()`.
6419/// // Values shown here are possibly random and not representative !
6420/// let result = hub.projects().locations_environments_database_failover(req, "environment")
6421///              .doit().await;
6422/// # }
6423/// ```
6424pub struct ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6425where
6426    C: 'a,
6427{
6428    hub: &'a CloudComposer<C>,
6429    _request: DatabaseFailoverRequest,
6430    _environment: String,
6431    _delegate: Option<&'a mut dyn common::Delegate>,
6432    _additional_params: HashMap<String, String>,
6433    _scopes: BTreeSet<String>,
6434}
6435
6436impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {}
6437
6438impl<'a, C> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6439where
6440    C: common::Connector,
6441{
6442    /// Perform the operation you have build so far.
6443    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6444        use std::borrow::Cow;
6445        use std::io::{Read, Seek};
6446
6447        use common::{url::Params, ToParts};
6448        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6449
6450        let mut dd = common::DefaultDelegate;
6451        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6452        dlg.begin(common::MethodInfo {
6453            id: "composer.projects.locations.environments.databaseFailover",
6454            http_method: hyper::Method::POST,
6455        });
6456
6457        for &field in ["alt", "environment"].iter() {
6458            if self._additional_params.contains_key(field) {
6459                dlg.finished(false);
6460                return Err(common::Error::FieldClash(field));
6461            }
6462        }
6463
6464        let mut params = Params::with_capacity(4 + self._additional_params.len());
6465        params.push("environment", self._environment);
6466
6467        params.extend(self._additional_params.iter());
6468
6469        params.push("alt", "json");
6470        let mut url = self.hub._base_url.clone() + "v1/{+environment}:databaseFailover";
6471        if self._scopes.is_empty() {
6472            self._scopes
6473                .insert(Scope::CloudPlatform.as_ref().to_string());
6474        }
6475
6476        #[allow(clippy::single_element_loop)]
6477        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
6478            url = params.uri_replacement(url, param_name, find_this, true);
6479        }
6480        {
6481            let to_remove = ["environment"];
6482            params.remove_params(&to_remove);
6483        }
6484
6485        let url = params.parse_with_url(&url);
6486
6487        let mut json_mime_type = mime::APPLICATION_JSON;
6488        let mut request_value_reader = {
6489            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6490            common::remove_json_null_values(&mut value);
6491            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6492            serde_json::to_writer(&mut dst, &value).unwrap();
6493            dst
6494        };
6495        let request_size = request_value_reader
6496            .seek(std::io::SeekFrom::End(0))
6497            .unwrap();
6498        request_value_reader
6499            .seek(std::io::SeekFrom::Start(0))
6500            .unwrap();
6501
6502        loop {
6503            let token = match self
6504                .hub
6505                .auth
6506                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6507                .await
6508            {
6509                Ok(token) => token,
6510                Err(e) => match dlg.token(e) {
6511                    Ok(token) => token,
6512                    Err(e) => {
6513                        dlg.finished(false);
6514                        return Err(common::Error::MissingToken(e));
6515                    }
6516                },
6517            };
6518            request_value_reader
6519                .seek(std::io::SeekFrom::Start(0))
6520                .unwrap();
6521            let mut req_result = {
6522                let client = &self.hub.client;
6523                dlg.pre_request();
6524                let mut req_builder = hyper::Request::builder()
6525                    .method(hyper::Method::POST)
6526                    .uri(url.as_str())
6527                    .header(USER_AGENT, self.hub._user_agent.clone());
6528
6529                if let Some(token) = token.as_ref() {
6530                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6531                }
6532
6533                let request = req_builder
6534                    .header(CONTENT_TYPE, json_mime_type.to_string())
6535                    .header(CONTENT_LENGTH, request_size as u64)
6536                    .body(common::to_body(
6537                        request_value_reader.get_ref().clone().into(),
6538                    ));
6539
6540                client.request(request.unwrap()).await
6541            };
6542
6543            match req_result {
6544                Err(err) => {
6545                    if let common::Retry::After(d) = dlg.http_error(&err) {
6546                        sleep(d).await;
6547                        continue;
6548                    }
6549                    dlg.finished(false);
6550                    return Err(common::Error::HttpError(err));
6551                }
6552                Ok(res) => {
6553                    let (mut parts, body) = res.into_parts();
6554                    let mut body = common::Body::new(body);
6555                    if !parts.status.is_success() {
6556                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6557                        let error = serde_json::from_str(&common::to_string(&bytes));
6558                        let response = common::to_response(parts, bytes.into());
6559
6560                        if let common::Retry::After(d) =
6561                            dlg.http_failure(&response, error.as_ref().ok())
6562                        {
6563                            sleep(d).await;
6564                            continue;
6565                        }
6566
6567                        dlg.finished(false);
6568
6569                        return Err(match error {
6570                            Ok(value) => common::Error::BadRequest(value),
6571                            _ => common::Error::Failure(response),
6572                        });
6573                    }
6574                    let response = {
6575                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6576                        let encoded = common::to_string(&bytes);
6577                        match serde_json::from_str(&encoded) {
6578                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6579                            Err(error) => {
6580                                dlg.response_json_decode_error(&encoded, &error);
6581                                return Err(common::Error::JsonDecodeError(
6582                                    encoded.to_string(),
6583                                    error,
6584                                ));
6585                            }
6586                        }
6587                    };
6588
6589                    dlg.finished(true);
6590                    return Ok(response);
6591                }
6592            }
6593        }
6594    }
6595
6596    ///
6597    /// Sets the *request* property to the given value.
6598    ///
6599    /// Even though the property as already been set when instantiating this call,
6600    /// we provide this method for API completeness.
6601    pub fn request(
6602        mut self,
6603        new_value: DatabaseFailoverRequest,
6604    ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6605        self._request = new_value;
6606        self
6607    }
6608    /// Target environment: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
6609    ///
6610    /// Sets the *environment* path property to the given value.
6611    ///
6612    /// Even though the property as already been set when instantiating this call,
6613    /// we provide this method for API completeness.
6614    pub fn environment(
6615        mut self,
6616        new_value: &str,
6617    ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6618        self._environment = new_value.to_string();
6619        self
6620    }
6621    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6622    /// while executing the actual API request.
6623    ///
6624    /// ````text
6625    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6626    /// ````
6627    ///
6628    /// Sets the *delegate* property to the given value.
6629    pub fn delegate(
6630        mut self,
6631        new_value: &'a mut dyn common::Delegate,
6632    ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6633        self._delegate = Some(new_value);
6634        self
6635    }
6636
6637    /// Set any additional parameter of the query string used in the request.
6638    /// It should be used to set parameters which are not yet available through their own
6639    /// setters.
6640    ///
6641    /// Please note that this method must not be used to set any of the known parameters
6642    /// which have their own setter method. If done anyway, the request will fail.
6643    ///
6644    /// # Additional Parameters
6645    ///
6646    /// * *$.xgafv* (query-string) - V1 error format.
6647    /// * *access_token* (query-string) - OAuth access token.
6648    /// * *alt* (query-string) - Data format for response.
6649    /// * *callback* (query-string) - JSONP
6650    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6651    /// * *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.
6652    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6653    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6654    /// * *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.
6655    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6656    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6657    pub fn param<T>(
6658        mut self,
6659        name: T,
6660        value: T,
6661    ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6662    where
6663        T: AsRef<str>,
6664    {
6665        self._additional_params
6666            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6667        self
6668    }
6669
6670    /// Identifies the authorization scope for the method you are building.
6671    ///
6672    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6673    /// [`Scope::CloudPlatform`].
6674    ///
6675    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6676    /// tokens for more than one scope.
6677    ///
6678    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6679    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6680    /// sufficient, a read-write scope will do as well.
6681    pub fn add_scope<St>(
6682        mut self,
6683        scope: St,
6684    ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6685    where
6686        St: AsRef<str>,
6687    {
6688        self._scopes.insert(String::from(scope.as_ref()));
6689        self
6690    }
6691    /// Identifies the authorization scope(s) for the method you are building.
6692    ///
6693    /// See [`Self::add_scope()`] for details.
6694    pub fn add_scopes<I, St>(
6695        mut self,
6696        scopes: I,
6697    ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6698    where
6699        I: IntoIterator<Item = St>,
6700        St: AsRef<str>,
6701    {
6702        self._scopes
6703            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6704        self
6705    }
6706
6707    /// Removes all scopes, and no default scope will be used either.
6708    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6709    /// for details).
6710    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6711        self._scopes.clear();
6712        self
6713    }
6714}
6715
6716/// Delete an environment.
6717///
6718/// A builder for the *locations.environments.delete* method supported by a *project* resource.
6719/// It is not used directly, but through a [`ProjectMethods`] instance.
6720///
6721/// # Example
6722///
6723/// Instantiate a resource method builder
6724///
6725/// ```test_harness,no_run
6726/// # extern crate hyper;
6727/// # extern crate hyper_rustls;
6728/// # extern crate google_composer1 as composer1;
6729/// # async fn dox() {
6730/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6731///
6732/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6733/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6734/// #     secret,
6735/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6736/// # ).build().await.unwrap();
6737///
6738/// # let client = hyper_util::client::legacy::Client::builder(
6739/// #     hyper_util::rt::TokioExecutor::new()
6740/// # )
6741/// # .build(
6742/// #     hyper_rustls::HttpsConnectorBuilder::new()
6743/// #         .with_native_roots()
6744/// #         .unwrap()
6745/// #         .https_or_http()
6746/// #         .enable_http1()
6747/// #         .build()
6748/// # );
6749/// # let mut hub = CloudComposer::new(client, auth);
6750/// // You can configure optional parameters by calling the respective setters at will, and
6751/// // execute the final call using `doit()`.
6752/// // Values shown here are possibly random and not representative !
6753/// let result = hub.projects().locations_environments_delete("name")
6754///              .doit().await;
6755/// # }
6756/// ```
6757pub struct ProjectLocationEnvironmentDeleteCall<'a, C>
6758where
6759    C: 'a,
6760{
6761    hub: &'a CloudComposer<C>,
6762    _name: String,
6763    _delegate: Option<&'a mut dyn common::Delegate>,
6764    _additional_params: HashMap<String, String>,
6765    _scopes: BTreeSet<String>,
6766}
6767
6768impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentDeleteCall<'a, C> {}
6769
6770impl<'a, C> ProjectLocationEnvironmentDeleteCall<'a, C>
6771where
6772    C: common::Connector,
6773{
6774    /// Perform the operation you have build so far.
6775    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6776        use std::borrow::Cow;
6777        use std::io::{Read, Seek};
6778
6779        use common::{url::Params, ToParts};
6780        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6781
6782        let mut dd = common::DefaultDelegate;
6783        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6784        dlg.begin(common::MethodInfo {
6785            id: "composer.projects.locations.environments.delete",
6786            http_method: hyper::Method::DELETE,
6787        });
6788
6789        for &field in ["alt", "name"].iter() {
6790            if self._additional_params.contains_key(field) {
6791                dlg.finished(false);
6792                return Err(common::Error::FieldClash(field));
6793            }
6794        }
6795
6796        let mut params = Params::with_capacity(3 + self._additional_params.len());
6797        params.push("name", self._name);
6798
6799        params.extend(self._additional_params.iter());
6800
6801        params.push("alt", "json");
6802        let mut url = self.hub._base_url.clone() + "v1/{+name}";
6803        if self._scopes.is_empty() {
6804            self._scopes
6805                .insert(Scope::CloudPlatform.as_ref().to_string());
6806        }
6807
6808        #[allow(clippy::single_element_loop)]
6809        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6810            url = params.uri_replacement(url, param_name, find_this, true);
6811        }
6812        {
6813            let to_remove = ["name"];
6814            params.remove_params(&to_remove);
6815        }
6816
6817        let url = params.parse_with_url(&url);
6818
6819        loop {
6820            let token = match self
6821                .hub
6822                .auth
6823                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6824                .await
6825            {
6826                Ok(token) => token,
6827                Err(e) => match dlg.token(e) {
6828                    Ok(token) => token,
6829                    Err(e) => {
6830                        dlg.finished(false);
6831                        return Err(common::Error::MissingToken(e));
6832                    }
6833                },
6834            };
6835            let mut req_result = {
6836                let client = &self.hub.client;
6837                dlg.pre_request();
6838                let mut req_builder = hyper::Request::builder()
6839                    .method(hyper::Method::DELETE)
6840                    .uri(url.as_str())
6841                    .header(USER_AGENT, self.hub._user_agent.clone());
6842
6843                if let Some(token) = token.as_ref() {
6844                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6845                }
6846
6847                let request = req_builder
6848                    .header(CONTENT_LENGTH, 0_u64)
6849                    .body(common::to_body::<String>(None));
6850
6851                client.request(request.unwrap()).await
6852            };
6853
6854            match req_result {
6855                Err(err) => {
6856                    if let common::Retry::After(d) = dlg.http_error(&err) {
6857                        sleep(d).await;
6858                        continue;
6859                    }
6860                    dlg.finished(false);
6861                    return Err(common::Error::HttpError(err));
6862                }
6863                Ok(res) => {
6864                    let (mut parts, body) = res.into_parts();
6865                    let mut body = common::Body::new(body);
6866                    if !parts.status.is_success() {
6867                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6868                        let error = serde_json::from_str(&common::to_string(&bytes));
6869                        let response = common::to_response(parts, bytes.into());
6870
6871                        if let common::Retry::After(d) =
6872                            dlg.http_failure(&response, error.as_ref().ok())
6873                        {
6874                            sleep(d).await;
6875                            continue;
6876                        }
6877
6878                        dlg.finished(false);
6879
6880                        return Err(match error {
6881                            Ok(value) => common::Error::BadRequest(value),
6882                            _ => common::Error::Failure(response),
6883                        });
6884                    }
6885                    let response = {
6886                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6887                        let encoded = common::to_string(&bytes);
6888                        match serde_json::from_str(&encoded) {
6889                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6890                            Err(error) => {
6891                                dlg.response_json_decode_error(&encoded, &error);
6892                                return Err(common::Error::JsonDecodeError(
6893                                    encoded.to_string(),
6894                                    error,
6895                                ));
6896                            }
6897                        }
6898                    };
6899
6900                    dlg.finished(true);
6901                    return Ok(response);
6902                }
6903            }
6904        }
6905    }
6906
6907    /// The environment to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
6908    ///
6909    /// Sets the *name* path property to the given value.
6910    ///
6911    /// Even though the property as already been set when instantiating this call,
6912    /// we provide this method for API completeness.
6913    pub fn name(mut self, new_value: &str) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
6914        self._name = new_value.to_string();
6915        self
6916    }
6917    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6918    /// while executing the actual API request.
6919    ///
6920    /// ````text
6921    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6922    /// ````
6923    ///
6924    /// Sets the *delegate* property to the given value.
6925    pub fn delegate(
6926        mut self,
6927        new_value: &'a mut dyn common::Delegate,
6928    ) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
6929        self._delegate = Some(new_value);
6930        self
6931    }
6932
6933    /// Set any additional parameter of the query string used in the request.
6934    /// It should be used to set parameters which are not yet available through their own
6935    /// setters.
6936    ///
6937    /// Please note that this method must not be used to set any of the known parameters
6938    /// which have their own setter method. If done anyway, the request will fail.
6939    ///
6940    /// # Additional Parameters
6941    ///
6942    /// * *$.xgafv* (query-string) - V1 error format.
6943    /// * *access_token* (query-string) - OAuth access token.
6944    /// * *alt* (query-string) - Data format for response.
6945    /// * *callback* (query-string) - JSONP
6946    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6947    /// * *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.
6948    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6949    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6950    /// * *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.
6951    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6952    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6953    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentDeleteCall<'a, C>
6954    where
6955        T: AsRef<str>,
6956    {
6957        self._additional_params
6958            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6959        self
6960    }
6961
6962    /// Identifies the authorization scope for the method you are building.
6963    ///
6964    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6965    /// [`Scope::CloudPlatform`].
6966    ///
6967    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6968    /// tokens for more than one scope.
6969    ///
6970    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6971    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6972    /// sufficient, a read-write scope will do as well.
6973    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentDeleteCall<'a, C>
6974    where
6975        St: AsRef<str>,
6976    {
6977        self._scopes.insert(String::from(scope.as_ref()));
6978        self
6979    }
6980    /// Identifies the authorization scope(s) for the method you are building.
6981    ///
6982    /// See [`Self::add_scope()`] for details.
6983    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentDeleteCall<'a, C>
6984    where
6985        I: IntoIterator<Item = St>,
6986        St: AsRef<str>,
6987    {
6988        self._scopes
6989            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6990        self
6991    }
6992
6993    /// Removes all scopes, and no default scope will be used either.
6994    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6995    /// for details).
6996    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
6997        self._scopes.clear();
6998        self
6999    }
7000}
7001
7002/// Executes Airflow CLI command.
7003///
7004/// A builder for the *locations.environments.executeAirflowCommand* method supported by a *project* resource.
7005/// It is not used directly, but through a [`ProjectMethods`] instance.
7006///
7007/// # Example
7008///
7009/// Instantiate a resource method builder
7010///
7011/// ```test_harness,no_run
7012/// # extern crate hyper;
7013/// # extern crate hyper_rustls;
7014/// # extern crate google_composer1 as composer1;
7015/// use composer1::api::ExecuteAirflowCommandRequest;
7016/// # async fn dox() {
7017/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7018///
7019/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7020/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7021/// #     secret,
7022/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7023/// # ).build().await.unwrap();
7024///
7025/// # let client = hyper_util::client::legacy::Client::builder(
7026/// #     hyper_util::rt::TokioExecutor::new()
7027/// # )
7028/// # .build(
7029/// #     hyper_rustls::HttpsConnectorBuilder::new()
7030/// #         .with_native_roots()
7031/// #         .unwrap()
7032/// #         .https_or_http()
7033/// #         .enable_http1()
7034/// #         .build()
7035/// # );
7036/// # let mut hub = CloudComposer::new(client, auth);
7037/// // As the method needs a request, you would usually fill it with the desired information
7038/// // into the respective structure. Some of the parts shown here might not be applicable !
7039/// // Values shown here are possibly random and not representative !
7040/// let mut req = ExecuteAirflowCommandRequest::default();
7041///
7042/// // You can configure optional parameters by calling the respective setters at will, and
7043/// // execute the final call using `doit()`.
7044/// // Values shown here are possibly random and not representative !
7045/// let result = hub.projects().locations_environments_execute_airflow_command(req, "environment")
7046///              .doit().await;
7047/// # }
7048/// ```
7049pub struct ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7050where
7051    C: 'a,
7052{
7053    hub: &'a CloudComposer<C>,
7054    _request: ExecuteAirflowCommandRequest,
7055    _environment: String,
7056    _delegate: Option<&'a mut dyn common::Delegate>,
7057    _additional_params: HashMap<String, String>,
7058    _scopes: BTreeSet<String>,
7059}
7060
7061impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {}
7062
7063impl<'a, C> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7064where
7065    C: common::Connector,
7066{
7067    /// Perform the operation you have build so far.
7068    pub async fn doit(
7069        mut self,
7070    ) -> common::Result<(common::Response, ExecuteAirflowCommandResponse)> {
7071        use std::borrow::Cow;
7072        use std::io::{Read, Seek};
7073
7074        use common::{url::Params, ToParts};
7075        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7076
7077        let mut dd = common::DefaultDelegate;
7078        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7079        dlg.begin(common::MethodInfo {
7080            id: "composer.projects.locations.environments.executeAirflowCommand",
7081            http_method: hyper::Method::POST,
7082        });
7083
7084        for &field in ["alt", "environment"].iter() {
7085            if self._additional_params.contains_key(field) {
7086                dlg.finished(false);
7087                return Err(common::Error::FieldClash(field));
7088            }
7089        }
7090
7091        let mut params = Params::with_capacity(4 + self._additional_params.len());
7092        params.push("environment", self._environment);
7093
7094        params.extend(self._additional_params.iter());
7095
7096        params.push("alt", "json");
7097        let mut url = self.hub._base_url.clone() + "v1/{+environment}:executeAirflowCommand";
7098        if self._scopes.is_empty() {
7099            self._scopes
7100                .insert(Scope::CloudPlatform.as_ref().to_string());
7101        }
7102
7103        #[allow(clippy::single_element_loop)]
7104        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
7105            url = params.uri_replacement(url, param_name, find_this, true);
7106        }
7107        {
7108            let to_remove = ["environment"];
7109            params.remove_params(&to_remove);
7110        }
7111
7112        let url = params.parse_with_url(&url);
7113
7114        let mut json_mime_type = mime::APPLICATION_JSON;
7115        let mut request_value_reader = {
7116            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7117            common::remove_json_null_values(&mut value);
7118            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7119            serde_json::to_writer(&mut dst, &value).unwrap();
7120            dst
7121        };
7122        let request_size = request_value_reader
7123            .seek(std::io::SeekFrom::End(0))
7124            .unwrap();
7125        request_value_reader
7126            .seek(std::io::SeekFrom::Start(0))
7127            .unwrap();
7128
7129        loop {
7130            let token = match self
7131                .hub
7132                .auth
7133                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7134                .await
7135            {
7136                Ok(token) => token,
7137                Err(e) => match dlg.token(e) {
7138                    Ok(token) => token,
7139                    Err(e) => {
7140                        dlg.finished(false);
7141                        return Err(common::Error::MissingToken(e));
7142                    }
7143                },
7144            };
7145            request_value_reader
7146                .seek(std::io::SeekFrom::Start(0))
7147                .unwrap();
7148            let mut req_result = {
7149                let client = &self.hub.client;
7150                dlg.pre_request();
7151                let mut req_builder = hyper::Request::builder()
7152                    .method(hyper::Method::POST)
7153                    .uri(url.as_str())
7154                    .header(USER_AGENT, self.hub._user_agent.clone());
7155
7156                if let Some(token) = token.as_ref() {
7157                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7158                }
7159
7160                let request = req_builder
7161                    .header(CONTENT_TYPE, json_mime_type.to_string())
7162                    .header(CONTENT_LENGTH, request_size as u64)
7163                    .body(common::to_body(
7164                        request_value_reader.get_ref().clone().into(),
7165                    ));
7166
7167                client.request(request.unwrap()).await
7168            };
7169
7170            match req_result {
7171                Err(err) => {
7172                    if let common::Retry::After(d) = dlg.http_error(&err) {
7173                        sleep(d).await;
7174                        continue;
7175                    }
7176                    dlg.finished(false);
7177                    return Err(common::Error::HttpError(err));
7178                }
7179                Ok(res) => {
7180                    let (mut parts, body) = res.into_parts();
7181                    let mut body = common::Body::new(body);
7182                    if !parts.status.is_success() {
7183                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7184                        let error = serde_json::from_str(&common::to_string(&bytes));
7185                        let response = common::to_response(parts, bytes.into());
7186
7187                        if let common::Retry::After(d) =
7188                            dlg.http_failure(&response, error.as_ref().ok())
7189                        {
7190                            sleep(d).await;
7191                            continue;
7192                        }
7193
7194                        dlg.finished(false);
7195
7196                        return Err(match error {
7197                            Ok(value) => common::Error::BadRequest(value),
7198                            _ => common::Error::Failure(response),
7199                        });
7200                    }
7201                    let response = {
7202                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7203                        let encoded = common::to_string(&bytes);
7204                        match serde_json::from_str(&encoded) {
7205                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7206                            Err(error) => {
7207                                dlg.response_json_decode_error(&encoded, &error);
7208                                return Err(common::Error::JsonDecodeError(
7209                                    encoded.to_string(),
7210                                    error,
7211                                ));
7212                            }
7213                        }
7214                    };
7215
7216                    dlg.finished(true);
7217                    return Ok(response);
7218                }
7219            }
7220        }
7221    }
7222
7223    ///
7224    /// Sets the *request* property to the given value.
7225    ///
7226    /// Even though the property as already been set when instantiating this call,
7227    /// we provide this method for API completeness.
7228    pub fn request(
7229        mut self,
7230        new_value: ExecuteAirflowCommandRequest,
7231    ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7232        self._request = new_value;
7233        self
7234    }
7235    /// The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
7236    ///
7237    /// Sets the *environment* path property to the given value.
7238    ///
7239    /// Even though the property as already been set when instantiating this call,
7240    /// we provide this method for API completeness.
7241    pub fn environment(
7242        mut self,
7243        new_value: &str,
7244    ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7245        self._environment = new_value.to_string();
7246        self
7247    }
7248    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7249    /// while executing the actual API request.
7250    ///
7251    /// ````text
7252    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7253    /// ````
7254    ///
7255    /// Sets the *delegate* property to the given value.
7256    pub fn delegate(
7257        mut self,
7258        new_value: &'a mut dyn common::Delegate,
7259    ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7260        self._delegate = Some(new_value);
7261        self
7262    }
7263
7264    /// Set any additional parameter of the query string used in the request.
7265    /// It should be used to set parameters which are not yet available through their own
7266    /// setters.
7267    ///
7268    /// Please note that this method must not be used to set any of the known parameters
7269    /// which have their own setter method. If done anyway, the request will fail.
7270    ///
7271    /// # Additional Parameters
7272    ///
7273    /// * *$.xgafv* (query-string) - V1 error format.
7274    /// * *access_token* (query-string) - OAuth access token.
7275    /// * *alt* (query-string) - Data format for response.
7276    /// * *callback* (query-string) - JSONP
7277    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7278    /// * *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.
7279    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7280    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7281    /// * *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.
7282    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7283    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7284    pub fn param<T>(
7285        mut self,
7286        name: T,
7287        value: T,
7288    ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7289    where
7290        T: AsRef<str>,
7291    {
7292        self._additional_params
7293            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7294        self
7295    }
7296
7297    /// Identifies the authorization scope for the method you are building.
7298    ///
7299    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7300    /// [`Scope::CloudPlatform`].
7301    ///
7302    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7303    /// tokens for more than one scope.
7304    ///
7305    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7306    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7307    /// sufficient, a read-write scope will do as well.
7308    pub fn add_scope<St>(
7309        mut self,
7310        scope: St,
7311    ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7312    where
7313        St: AsRef<str>,
7314    {
7315        self._scopes.insert(String::from(scope.as_ref()));
7316        self
7317    }
7318    /// Identifies the authorization scope(s) for the method you are building.
7319    ///
7320    /// See [`Self::add_scope()`] for details.
7321    pub fn add_scopes<I, St>(
7322        mut self,
7323        scopes: I,
7324    ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7325    where
7326        I: IntoIterator<Item = St>,
7327        St: AsRef<str>,
7328    {
7329        self._scopes
7330            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7331        self
7332    }
7333
7334    /// Removes all scopes, and no default scope will be used either.
7335    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7336    /// for details).
7337    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7338        self._scopes.clear();
7339        self
7340    }
7341}
7342
7343/// Fetches database properties.
7344///
7345/// A builder for the *locations.environments.fetchDatabaseProperties* method supported by a *project* resource.
7346/// It is not used directly, but through a [`ProjectMethods`] instance.
7347///
7348/// # Example
7349///
7350/// Instantiate a resource method builder
7351///
7352/// ```test_harness,no_run
7353/// # extern crate hyper;
7354/// # extern crate hyper_rustls;
7355/// # extern crate google_composer1 as composer1;
7356/// # async fn dox() {
7357/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7358///
7359/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7360/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7361/// #     secret,
7362/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7363/// # ).build().await.unwrap();
7364///
7365/// # let client = hyper_util::client::legacy::Client::builder(
7366/// #     hyper_util::rt::TokioExecutor::new()
7367/// # )
7368/// # .build(
7369/// #     hyper_rustls::HttpsConnectorBuilder::new()
7370/// #         .with_native_roots()
7371/// #         .unwrap()
7372/// #         .https_or_http()
7373/// #         .enable_http1()
7374/// #         .build()
7375/// # );
7376/// # let mut hub = CloudComposer::new(client, auth);
7377/// // You can configure optional parameters by calling the respective setters at will, and
7378/// // execute the final call using `doit()`.
7379/// // Values shown here are possibly random and not representative !
7380/// let result = hub.projects().locations_environments_fetch_database_properties("environment")
7381///              .doit().await;
7382/// # }
7383/// ```
7384pub struct ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7385where
7386    C: 'a,
7387{
7388    hub: &'a CloudComposer<C>,
7389    _environment: String,
7390    _delegate: Option<&'a mut dyn common::Delegate>,
7391    _additional_params: HashMap<String, String>,
7392    _scopes: BTreeSet<String>,
7393}
7394
7395impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {}
7396
7397impl<'a, C> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7398where
7399    C: common::Connector,
7400{
7401    /// Perform the operation you have build so far.
7402    pub async fn doit(
7403        mut self,
7404    ) -> common::Result<(common::Response, FetchDatabasePropertiesResponse)> {
7405        use std::borrow::Cow;
7406        use std::io::{Read, Seek};
7407
7408        use common::{url::Params, ToParts};
7409        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7410
7411        let mut dd = common::DefaultDelegate;
7412        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7413        dlg.begin(common::MethodInfo {
7414            id: "composer.projects.locations.environments.fetchDatabaseProperties",
7415            http_method: hyper::Method::GET,
7416        });
7417
7418        for &field in ["alt", "environment"].iter() {
7419            if self._additional_params.contains_key(field) {
7420                dlg.finished(false);
7421                return Err(common::Error::FieldClash(field));
7422            }
7423        }
7424
7425        let mut params = Params::with_capacity(3 + self._additional_params.len());
7426        params.push("environment", self._environment);
7427
7428        params.extend(self._additional_params.iter());
7429
7430        params.push("alt", "json");
7431        let mut url = self.hub._base_url.clone() + "v1/{+environment}:fetchDatabaseProperties";
7432        if self._scopes.is_empty() {
7433            self._scopes
7434                .insert(Scope::CloudPlatform.as_ref().to_string());
7435        }
7436
7437        #[allow(clippy::single_element_loop)]
7438        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
7439            url = params.uri_replacement(url, param_name, find_this, true);
7440        }
7441        {
7442            let to_remove = ["environment"];
7443            params.remove_params(&to_remove);
7444        }
7445
7446        let url = params.parse_with_url(&url);
7447
7448        loop {
7449            let token = match self
7450                .hub
7451                .auth
7452                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7453                .await
7454            {
7455                Ok(token) => token,
7456                Err(e) => match dlg.token(e) {
7457                    Ok(token) => token,
7458                    Err(e) => {
7459                        dlg.finished(false);
7460                        return Err(common::Error::MissingToken(e));
7461                    }
7462                },
7463            };
7464            let mut req_result = {
7465                let client = &self.hub.client;
7466                dlg.pre_request();
7467                let mut req_builder = hyper::Request::builder()
7468                    .method(hyper::Method::GET)
7469                    .uri(url.as_str())
7470                    .header(USER_AGENT, self.hub._user_agent.clone());
7471
7472                if let Some(token) = token.as_ref() {
7473                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7474                }
7475
7476                let request = req_builder
7477                    .header(CONTENT_LENGTH, 0_u64)
7478                    .body(common::to_body::<String>(None));
7479
7480                client.request(request.unwrap()).await
7481            };
7482
7483            match req_result {
7484                Err(err) => {
7485                    if let common::Retry::After(d) = dlg.http_error(&err) {
7486                        sleep(d).await;
7487                        continue;
7488                    }
7489                    dlg.finished(false);
7490                    return Err(common::Error::HttpError(err));
7491                }
7492                Ok(res) => {
7493                    let (mut parts, body) = res.into_parts();
7494                    let mut body = common::Body::new(body);
7495                    if !parts.status.is_success() {
7496                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7497                        let error = serde_json::from_str(&common::to_string(&bytes));
7498                        let response = common::to_response(parts, bytes.into());
7499
7500                        if let common::Retry::After(d) =
7501                            dlg.http_failure(&response, error.as_ref().ok())
7502                        {
7503                            sleep(d).await;
7504                            continue;
7505                        }
7506
7507                        dlg.finished(false);
7508
7509                        return Err(match error {
7510                            Ok(value) => common::Error::BadRequest(value),
7511                            _ => common::Error::Failure(response),
7512                        });
7513                    }
7514                    let response = {
7515                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7516                        let encoded = common::to_string(&bytes);
7517                        match serde_json::from_str(&encoded) {
7518                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7519                            Err(error) => {
7520                                dlg.response_json_decode_error(&encoded, &error);
7521                                return Err(common::Error::JsonDecodeError(
7522                                    encoded.to_string(),
7523                                    error,
7524                                ));
7525                            }
7526                        }
7527                    };
7528
7529                    dlg.finished(true);
7530                    return Ok(response);
7531                }
7532            }
7533        }
7534    }
7535
7536    /// Required. The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
7537    ///
7538    /// Sets the *environment* path property to the given value.
7539    ///
7540    /// Even though the property as already been set when instantiating this call,
7541    /// we provide this method for API completeness.
7542    pub fn environment(
7543        mut self,
7544        new_value: &str,
7545    ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
7546        self._environment = new_value.to_string();
7547        self
7548    }
7549    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7550    /// while executing the actual API request.
7551    ///
7552    /// ````text
7553    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7554    /// ````
7555    ///
7556    /// Sets the *delegate* property to the given value.
7557    pub fn delegate(
7558        mut self,
7559        new_value: &'a mut dyn common::Delegate,
7560    ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
7561        self._delegate = Some(new_value);
7562        self
7563    }
7564
7565    /// Set any additional parameter of the query string used in the request.
7566    /// It should be used to set parameters which are not yet available through their own
7567    /// setters.
7568    ///
7569    /// Please note that this method must not be used to set any of the known parameters
7570    /// which have their own setter method. If done anyway, the request will fail.
7571    ///
7572    /// # Additional Parameters
7573    ///
7574    /// * *$.xgafv* (query-string) - V1 error format.
7575    /// * *access_token* (query-string) - OAuth access token.
7576    /// * *alt* (query-string) - Data format for response.
7577    /// * *callback* (query-string) - JSONP
7578    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7579    /// * *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.
7580    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7581    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7582    /// * *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.
7583    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7584    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7585    pub fn param<T>(
7586        mut self,
7587        name: T,
7588        value: T,
7589    ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7590    where
7591        T: AsRef<str>,
7592    {
7593        self._additional_params
7594            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7595        self
7596    }
7597
7598    /// Identifies the authorization scope for the method you are building.
7599    ///
7600    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7601    /// [`Scope::CloudPlatform`].
7602    ///
7603    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7604    /// tokens for more than one scope.
7605    ///
7606    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7607    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7608    /// sufficient, a read-write scope will do as well.
7609    pub fn add_scope<St>(
7610        mut self,
7611        scope: St,
7612    ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7613    where
7614        St: AsRef<str>,
7615    {
7616        self._scopes.insert(String::from(scope.as_ref()));
7617        self
7618    }
7619    /// Identifies the authorization scope(s) for the method you are building.
7620    ///
7621    /// See [`Self::add_scope()`] for details.
7622    pub fn add_scopes<I, St>(
7623        mut self,
7624        scopes: I,
7625    ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7626    where
7627        I: IntoIterator<Item = St>,
7628        St: AsRef<str>,
7629    {
7630        self._scopes
7631            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7632        self
7633    }
7634
7635    /// Removes all scopes, and no default scope will be used either.
7636    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7637    /// for details).
7638    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
7639        self._scopes.clear();
7640        self
7641    }
7642}
7643
7644/// Get an existing environment.
7645///
7646/// A builder for the *locations.environments.get* method supported by a *project* resource.
7647/// It is not used directly, but through a [`ProjectMethods`] instance.
7648///
7649/// # Example
7650///
7651/// Instantiate a resource method builder
7652///
7653/// ```test_harness,no_run
7654/// # extern crate hyper;
7655/// # extern crate hyper_rustls;
7656/// # extern crate google_composer1 as composer1;
7657/// # async fn dox() {
7658/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7659///
7660/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7661/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7662/// #     secret,
7663/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7664/// # ).build().await.unwrap();
7665///
7666/// # let client = hyper_util::client::legacy::Client::builder(
7667/// #     hyper_util::rt::TokioExecutor::new()
7668/// # )
7669/// # .build(
7670/// #     hyper_rustls::HttpsConnectorBuilder::new()
7671/// #         .with_native_roots()
7672/// #         .unwrap()
7673/// #         .https_or_http()
7674/// #         .enable_http1()
7675/// #         .build()
7676/// # );
7677/// # let mut hub = CloudComposer::new(client, auth);
7678/// // You can configure optional parameters by calling the respective setters at will, and
7679/// // execute the final call using `doit()`.
7680/// // Values shown here are possibly random and not representative !
7681/// let result = hub.projects().locations_environments_get("name")
7682///              .doit().await;
7683/// # }
7684/// ```
7685pub struct ProjectLocationEnvironmentGetCall<'a, C>
7686where
7687    C: 'a,
7688{
7689    hub: &'a CloudComposer<C>,
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 ProjectLocationEnvironmentGetCall<'a, C> {}
7697
7698impl<'a, C> ProjectLocationEnvironmentGetCall<'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, Environment)> {
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: "composer.projects.locations.environments.get",
7714            http_method: hyper::Method::GET,
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(3 + 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}";
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        loop {
7748            let token = match self
7749                .hub
7750                .auth
7751                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7752                .await
7753            {
7754                Ok(token) => token,
7755                Err(e) => match dlg.token(e) {
7756                    Ok(token) => token,
7757                    Err(e) => {
7758                        dlg.finished(false);
7759                        return Err(common::Error::MissingToken(e));
7760                    }
7761                },
7762            };
7763            let mut req_result = {
7764                let client = &self.hub.client;
7765                dlg.pre_request();
7766                let mut req_builder = hyper::Request::builder()
7767                    .method(hyper::Method::GET)
7768                    .uri(url.as_str())
7769                    .header(USER_AGENT, self.hub._user_agent.clone());
7770
7771                if let Some(token) = token.as_ref() {
7772                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7773                }
7774
7775                let request = req_builder
7776                    .header(CONTENT_LENGTH, 0_u64)
7777                    .body(common::to_body::<String>(None));
7778
7779                client.request(request.unwrap()).await
7780            };
7781
7782            match req_result {
7783                Err(err) => {
7784                    if let common::Retry::After(d) = dlg.http_error(&err) {
7785                        sleep(d).await;
7786                        continue;
7787                    }
7788                    dlg.finished(false);
7789                    return Err(common::Error::HttpError(err));
7790                }
7791                Ok(res) => {
7792                    let (mut parts, body) = res.into_parts();
7793                    let mut body = common::Body::new(body);
7794                    if !parts.status.is_success() {
7795                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7796                        let error = serde_json::from_str(&common::to_string(&bytes));
7797                        let response = common::to_response(parts, bytes.into());
7798
7799                        if let common::Retry::After(d) =
7800                            dlg.http_failure(&response, error.as_ref().ok())
7801                        {
7802                            sleep(d).await;
7803                            continue;
7804                        }
7805
7806                        dlg.finished(false);
7807
7808                        return Err(match error {
7809                            Ok(value) => common::Error::BadRequest(value),
7810                            _ => common::Error::Failure(response),
7811                        });
7812                    }
7813                    let response = {
7814                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7815                        let encoded = common::to_string(&bytes);
7816                        match serde_json::from_str(&encoded) {
7817                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7818                            Err(error) => {
7819                                dlg.response_json_decode_error(&encoded, &error);
7820                                return Err(common::Error::JsonDecodeError(
7821                                    encoded.to_string(),
7822                                    error,
7823                                ));
7824                            }
7825                        }
7826                    };
7827
7828                    dlg.finished(true);
7829                    return Ok(response);
7830                }
7831            }
7832        }
7833    }
7834
7835    /// The resource name of the environment to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
7836    ///
7837    /// Sets the *name* path property to the given value.
7838    ///
7839    /// Even though the property as already been set when instantiating this call,
7840    /// we provide this method for API completeness.
7841    pub fn name(mut self, new_value: &str) -> ProjectLocationEnvironmentGetCall<'a, C> {
7842        self._name = new_value.to_string();
7843        self
7844    }
7845    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7846    /// while executing the actual API request.
7847    ///
7848    /// ````text
7849    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7850    /// ````
7851    ///
7852    /// Sets the *delegate* property to the given value.
7853    pub fn delegate(
7854        mut self,
7855        new_value: &'a mut dyn common::Delegate,
7856    ) -> ProjectLocationEnvironmentGetCall<'a, C> {
7857        self._delegate = Some(new_value);
7858        self
7859    }
7860
7861    /// Set any additional parameter of the query string used in the request.
7862    /// It should be used to set parameters which are not yet available through their own
7863    /// setters.
7864    ///
7865    /// Please note that this method must not be used to set any of the known parameters
7866    /// which have their own setter method. If done anyway, the request will fail.
7867    ///
7868    /// # Additional Parameters
7869    ///
7870    /// * *$.xgafv* (query-string) - V1 error format.
7871    /// * *access_token* (query-string) - OAuth access token.
7872    /// * *alt* (query-string) - Data format for response.
7873    /// * *callback* (query-string) - JSONP
7874    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7875    /// * *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.
7876    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7877    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7878    /// * *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.
7879    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7880    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7881    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentGetCall<'a, C>
7882    where
7883        T: AsRef<str>,
7884    {
7885        self._additional_params
7886            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7887        self
7888    }
7889
7890    /// Identifies the authorization scope for the method you are building.
7891    ///
7892    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7893    /// [`Scope::CloudPlatform`].
7894    ///
7895    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7896    /// tokens for more than one scope.
7897    ///
7898    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7899    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7900    /// sufficient, a read-write scope will do as well.
7901    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentGetCall<'a, C>
7902    where
7903        St: AsRef<str>,
7904    {
7905        self._scopes.insert(String::from(scope.as_ref()));
7906        self
7907    }
7908    /// Identifies the authorization scope(s) for the method you are building.
7909    ///
7910    /// See [`Self::add_scope()`] for details.
7911    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentGetCall<'a, C>
7912    where
7913        I: IntoIterator<Item = St>,
7914        St: AsRef<str>,
7915    {
7916        self._scopes
7917            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7918        self
7919    }
7920
7921    /// Removes all scopes, and no default scope will be used either.
7922    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7923    /// for details).
7924    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentGetCall<'a, C> {
7925        self._scopes.clear();
7926        self
7927    }
7928}
7929
7930/// List environments.
7931///
7932/// A builder for the *locations.environments.list* method supported by a *project* resource.
7933/// It is not used directly, but through a [`ProjectMethods`] instance.
7934///
7935/// # Example
7936///
7937/// Instantiate a resource method builder
7938///
7939/// ```test_harness,no_run
7940/// # extern crate hyper;
7941/// # extern crate hyper_rustls;
7942/// # extern crate google_composer1 as composer1;
7943/// # async fn dox() {
7944/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7945///
7946/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7947/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7948/// #     secret,
7949/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7950/// # ).build().await.unwrap();
7951///
7952/// # let client = hyper_util::client::legacy::Client::builder(
7953/// #     hyper_util::rt::TokioExecutor::new()
7954/// # )
7955/// # .build(
7956/// #     hyper_rustls::HttpsConnectorBuilder::new()
7957/// #         .with_native_roots()
7958/// #         .unwrap()
7959/// #         .https_or_http()
7960/// #         .enable_http1()
7961/// #         .build()
7962/// # );
7963/// # let mut hub = CloudComposer::new(client, auth);
7964/// // You can configure optional parameters by calling the respective setters at will, and
7965/// // execute the final call using `doit()`.
7966/// // Values shown here are possibly random and not representative !
7967/// let result = hub.projects().locations_environments_list("parent")
7968///              .page_token("ipsum")
7969///              .page_size(-50)
7970///              .doit().await;
7971/// # }
7972/// ```
7973pub struct ProjectLocationEnvironmentListCall<'a, C>
7974where
7975    C: 'a,
7976{
7977    hub: &'a CloudComposer<C>,
7978    _parent: String,
7979    _page_token: Option<String>,
7980    _page_size: Option<i32>,
7981    _delegate: Option<&'a mut dyn common::Delegate>,
7982    _additional_params: HashMap<String, String>,
7983    _scopes: BTreeSet<String>,
7984}
7985
7986impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentListCall<'a, C> {}
7987
7988impl<'a, C> ProjectLocationEnvironmentListCall<'a, C>
7989where
7990    C: common::Connector,
7991{
7992    /// Perform the operation you have build so far.
7993    pub async fn doit(mut self) -> common::Result<(common::Response, ListEnvironmentsResponse)> {
7994        use std::borrow::Cow;
7995        use std::io::{Read, Seek};
7996
7997        use common::{url::Params, ToParts};
7998        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7999
8000        let mut dd = common::DefaultDelegate;
8001        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8002        dlg.begin(common::MethodInfo {
8003            id: "composer.projects.locations.environments.list",
8004            http_method: hyper::Method::GET,
8005        });
8006
8007        for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8008            if self._additional_params.contains_key(field) {
8009                dlg.finished(false);
8010                return Err(common::Error::FieldClash(field));
8011            }
8012        }
8013
8014        let mut params = Params::with_capacity(5 + self._additional_params.len());
8015        params.push("parent", self._parent);
8016        if let Some(value) = self._page_token.as_ref() {
8017            params.push("pageToken", value);
8018        }
8019        if let Some(value) = self._page_size.as_ref() {
8020            params.push("pageSize", value.to_string());
8021        }
8022
8023        params.extend(self._additional_params.iter());
8024
8025        params.push("alt", "json");
8026        let mut url = self.hub._base_url.clone() + "v1/{+parent}/environments";
8027        if self._scopes.is_empty() {
8028            self._scopes
8029                .insert(Scope::CloudPlatform.as_ref().to_string());
8030        }
8031
8032        #[allow(clippy::single_element_loop)]
8033        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8034            url = params.uri_replacement(url, param_name, find_this, true);
8035        }
8036        {
8037            let to_remove = ["parent"];
8038            params.remove_params(&to_remove);
8039        }
8040
8041        let url = params.parse_with_url(&url);
8042
8043        loop {
8044            let token = match self
8045                .hub
8046                .auth
8047                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8048                .await
8049            {
8050                Ok(token) => token,
8051                Err(e) => match dlg.token(e) {
8052                    Ok(token) => token,
8053                    Err(e) => {
8054                        dlg.finished(false);
8055                        return Err(common::Error::MissingToken(e));
8056                    }
8057                },
8058            };
8059            let mut req_result = {
8060                let client = &self.hub.client;
8061                dlg.pre_request();
8062                let mut req_builder = hyper::Request::builder()
8063                    .method(hyper::Method::GET)
8064                    .uri(url.as_str())
8065                    .header(USER_AGENT, self.hub._user_agent.clone());
8066
8067                if let Some(token) = token.as_ref() {
8068                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8069                }
8070
8071                let request = req_builder
8072                    .header(CONTENT_LENGTH, 0_u64)
8073                    .body(common::to_body::<String>(None));
8074
8075                client.request(request.unwrap()).await
8076            };
8077
8078            match req_result {
8079                Err(err) => {
8080                    if let common::Retry::After(d) = dlg.http_error(&err) {
8081                        sleep(d).await;
8082                        continue;
8083                    }
8084                    dlg.finished(false);
8085                    return Err(common::Error::HttpError(err));
8086                }
8087                Ok(res) => {
8088                    let (mut parts, body) = res.into_parts();
8089                    let mut body = common::Body::new(body);
8090                    if !parts.status.is_success() {
8091                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8092                        let error = serde_json::from_str(&common::to_string(&bytes));
8093                        let response = common::to_response(parts, bytes.into());
8094
8095                        if let common::Retry::After(d) =
8096                            dlg.http_failure(&response, error.as_ref().ok())
8097                        {
8098                            sleep(d).await;
8099                            continue;
8100                        }
8101
8102                        dlg.finished(false);
8103
8104                        return Err(match error {
8105                            Ok(value) => common::Error::BadRequest(value),
8106                            _ => common::Error::Failure(response),
8107                        });
8108                    }
8109                    let response = {
8110                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8111                        let encoded = common::to_string(&bytes);
8112                        match serde_json::from_str(&encoded) {
8113                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8114                            Err(error) => {
8115                                dlg.response_json_decode_error(&encoded, &error);
8116                                return Err(common::Error::JsonDecodeError(
8117                                    encoded.to_string(),
8118                                    error,
8119                                ));
8120                            }
8121                        }
8122                    };
8123
8124                    dlg.finished(true);
8125                    return Ok(response);
8126                }
8127            }
8128        }
8129    }
8130
8131    /// List environments in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
8132    ///
8133    /// Sets the *parent* path property to the given value.
8134    ///
8135    /// Even though the property as already been set when instantiating this call,
8136    /// we provide this method for API completeness.
8137    pub fn parent(mut self, new_value: &str) -> ProjectLocationEnvironmentListCall<'a, C> {
8138        self._parent = new_value.to_string();
8139        self
8140    }
8141    /// The next_page_token value returned from a previous List request, if any.
8142    ///
8143    /// Sets the *page token* query property to the given value.
8144    pub fn page_token(mut self, new_value: &str) -> ProjectLocationEnvironmentListCall<'a, C> {
8145        self._page_token = Some(new_value.to_string());
8146        self
8147    }
8148    /// The maximum number of environments to return.
8149    ///
8150    /// Sets the *page size* query property to the given value.
8151    pub fn page_size(mut self, new_value: i32) -> ProjectLocationEnvironmentListCall<'a, C> {
8152        self._page_size = Some(new_value);
8153        self
8154    }
8155    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8156    /// while executing the actual API request.
8157    ///
8158    /// ````text
8159    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8160    /// ````
8161    ///
8162    /// Sets the *delegate* property to the given value.
8163    pub fn delegate(
8164        mut self,
8165        new_value: &'a mut dyn common::Delegate,
8166    ) -> ProjectLocationEnvironmentListCall<'a, C> {
8167        self._delegate = Some(new_value);
8168        self
8169    }
8170
8171    /// Set any additional parameter of the query string used in the request.
8172    /// It should be used to set parameters which are not yet available through their own
8173    /// setters.
8174    ///
8175    /// Please note that this method must not be used to set any of the known parameters
8176    /// which have their own setter method. If done anyway, the request will fail.
8177    ///
8178    /// # Additional Parameters
8179    ///
8180    /// * *$.xgafv* (query-string) - V1 error format.
8181    /// * *access_token* (query-string) - OAuth access token.
8182    /// * *alt* (query-string) - Data format for response.
8183    /// * *callback* (query-string) - JSONP
8184    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8185    /// * *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.
8186    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8187    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8188    /// * *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.
8189    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8190    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8191    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentListCall<'a, C>
8192    where
8193        T: AsRef<str>,
8194    {
8195        self._additional_params
8196            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8197        self
8198    }
8199
8200    /// Identifies the authorization scope for the method you are building.
8201    ///
8202    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8203    /// [`Scope::CloudPlatform`].
8204    ///
8205    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8206    /// tokens for more than one scope.
8207    ///
8208    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8209    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8210    /// sufficient, a read-write scope will do as well.
8211    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentListCall<'a, C>
8212    where
8213        St: AsRef<str>,
8214    {
8215        self._scopes.insert(String::from(scope.as_ref()));
8216        self
8217    }
8218    /// Identifies the authorization scope(s) for the method you are building.
8219    ///
8220    /// See [`Self::add_scope()`] for details.
8221    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentListCall<'a, C>
8222    where
8223        I: IntoIterator<Item = St>,
8224        St: AsRef<str>,
8225    {
8226        self._scopes
8227            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8228        self
8229    }
8230
8231    /// Removes all scopes, and no default scope will be used either.
8232    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8233    /// for details).
8234    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentListCall<'a, C> {
8235        self._scopes.clear();
8236        self
8237    }
8238}
8239
8240/// Loads a snapshot of a Cloud Composer environment. As a result of this operation, a snapshot of environment's specified in LoadSnapshotRequest is loaded into the environment.
8241///
8242/// A builder for the *locations.environments.loadSnapshot* method supported by a *project* resource.
8243/// It is not used directly, but through a [`ProjectMethods`] instance.
8244///
8245/// # Example
8246///
8247/// Instantiate a resource method builder
8248///
8249/// ```test_harness,no_run
8250/// # extern crate hyper;
8251/// # extern crate hyper_rustls;
8252/// # extern crate google_composer1 as composer1;
8253/// use composer1::api::LoadSnapshotRequest;
8254/// # async fn dox() {
8255/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8256///
8257/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8258/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8259/// #     secret,
8260/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8261/// # ).build().await.unwrap();
8262///
8263/// # let client = hyper_util::client::legacy::Client::builder(
8264/// #     hyper_util::rt::TokioExecutor::new()
8265/// # )
8266/// # .build(
8267/// #     hyper_rustls::HttpsConnectorBuilder::new()
8268/// #         .with_native_roots()
8269/// #         .unwrap()
8270/// #         .https_or_http()
8271/// #         .enable_http1()
8272/// #         .build()
8273/// # );
8274/// # let mut hub = CloudComposer::new(client, auth);
8275/// // As the method needs a request, you would usually fill it with the desired information
8276/// // into the respective structure. Some of the parts shown here might not be applicable !
8277/// // Values shown here are possibly random and not representative !
8278/// let mut req = LoadSnapshotRequest::default();
8279///
8280/// // You can configure optional parameters by calling the respective setters at will, and
8281/// // execute the final call using `doit()`.
8282/// // Values shown here are possibly random and not representative !
8283/// let result = hub.projects().locations_environments_load_snapshot(req, "environment")
8284///              .doit().await;
8285/// # }
8286/// ```
8287pub struct ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8288where
8289    C: 'a,
8290{
8291    hub: &'a CloudComposer<C>,
8292    _request: LoadSnapshotRequest,
8293    _environment: String,
8294    _delegate: Option<&'a mut dyn common::Delegate>,
8295    _additional_params: HashMap<String, String>,
8296    _scopes: BTreeSet<String>,
8297}
8298
8299impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {}
8300
8301impl<'a, C> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8302where
8303    C: common::Connector,
8304{
8305    /// Perform the operation you have build so far.
8306    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8307        use std::borrow::Cow;
8308        use std::io::{Read, Seek};
8309
8310        use common::{url::Params, ToParts};
8311        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8312
8313        let mut dd = common::DefaultDelegate;
8314        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8315        dlg.begin(common::MethodInfo {
8316            id: "composer.projects.locations.environments.loadSnapshot",
8317            http_method: hyper::Method::POST,
8318        });
8319
8320        for &field in ["alt", "environment"].iter() {
8321            if self._additional_params.contains_key(field) {
8322                dlg.finished(false);
8323                return Err(common::Error::FieldClash(field));
8324            }
8325        }
8326
8327        let mut params = Params::with_capacity(4 + self._additional_params.len());
8328        params.push("environment", self._environment);
8329
8330        params.extend(self._additional_params.iter());
8331
8332        params.push("alt", "json");
8333        let mut url = self.hub._base_url.clone() + "v1/{+environment}:loadSnapshot";
8334        if self._scopes.is_empty() {
8335            self._scopes
8336                .insert(Scope::CloudPlatform.as_ref().to_string());
8337        }
8338
8339        #[allow(clippy::single_element_loop)]
8340        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
8341            url = params.uri_replacement(url, param_name, find_this, true);
8342        }
8343        {
8344            let to_remove = ["environment"];
8345            params.remove_params(&to_remove);
8346        }
8347
8348        let url = params.parse_with_url(&url);
8349
8350        let mut json_mime_type = mime::APPLICATION_JSON;
8351        let mut request_value_reader = {
8352            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8353            common::remove_json_null_values(&mut value);
8354            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8355            serde_json::to_writer(&mut dst, &value).unwrap();
8356            dst
8357        };
8358        let request_size = request_value_reader
8359            .seek(std::io::SeekFrom::End(0))
8360            .unwrap();
8361        request_value_reader
8362            .seek(std::io::SeekFrom::Start(0))
8363            .unwrap();
8364
8365        loop {
8366            let token = match self
8367                .hub
8368                .auth
8369                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8370                .await
8371            {
8372                Ok(token) => token,
8373                Err(e) => match dlg.token(e) {
8374                    Ok(token) => token,
8375                    Err(e) => {
8376                        dlg.finished(false);
8377                        return Err(common::Error::MissingToken(e));
8378                    }
8379                },
8380            };
8381            request_value_reader
8382                .seek(std::io::SeekFrom::Start(0))
8383                .unwrap();
8384            let mut req_result = {
8385                let client = &self.hub.client;
8386                dlg.pre_request();
8387                let mut req_builder = hyper::Request::builder()
8388                    .method(hyper::Method::POST)
8389                    .uri(url.as_str())
8390                    .header(USER_AGENT, self.hub._user_agent.clone());
8391
8392                if let Some(token) = token.as_ref() {
8393                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8394                }
8395
8396                let request = req_builder
8397                    .header(CONTENT_TYPE, json_mime_type.to_string())
8398                    .header(CONTENT_LENGTH, request_size as u64)
8399                    .body(common::to_body(
8400                        request_value_reader.get_ref().clone().into(),
8401                    ));
8402
8403                client.request(request.unwrap()).await
8404            };
8405
8406            match req_result {
8407                Err(err) => {
8408                    if let common::Retry::After(d) = dlg.http_error(&err) {
8409                        sleep(d).await;
8410                        continue;
8411                    }
8412                    dlg.finished(false);
8413                    return Err(common::Error::HttpError(err));
8414                }
8415                Ok(res) => {
8416                    let (mut parts, body) = res.into_parts();
8417                    let mut body = common::Body::new(body);
8418                    if !parts.status.is_success() {
8419                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8420                        let error = serde_json::from_str(&common::to_string(&bytes));
8421                        let response = common::to_response(parts, bytes.into());
8422
8423                        if let common::Retry::After(d) =
8424                            dlg.http_failure(&response, error.as_ref().ok())
8425                        {
8426                            sleep(d).await;
8427                            continue;
8428                        }
8429
8430                        dlg.finished(false);
8431
8432                        return Err(match error {
8433                            Ok(value) => common::Error::BadRequest(value),
8434                            _ => common::Error::Failure(response),
8435                        });
8436                    }
8437                    let response = {
8438                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8439                        let encoded = common::to_string(&bytes);
8440                        match serde_json::from_str(&encoded) {
8441                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8442                            Err(error) => {
8443                                dlg.response_json_decode_error(&encoded, &error);
8444                                return Err(common::Error::JsonDecodeError(
8445                                    encoded.to_string(),
8446                                    error,
8447                                ));
8448                            }
8449                        }
8450                    };
8451
8452                    dlg.finished(true);
8453                    return Ok(response);
8454                }
8455            }
8456        }
8457    }
8458
8459    ///
8460    /// Sets the *request* property to the given value.
8461    ///
8462    /// Even though the property as already been set when instantiating this call,
8463    /// we provide this method for API completeness.
8464    pub fn request(
8465        mut self,
8466        new_value: LoadSnapshotRequest,
8467    ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8468        self._request = new_value;
8469        self
8470    }
8471    /// The resource name of the target environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
8472    ///
8473    /// Sets the *environment* path property to the given value.
8474    ///
8475    /// Even though the property as already been set when instantiating this call,
8476    /// we provide this method for API completeness.
8477    pub fn environment(
8478        mut self,
8479        new_value: &str,
8480    ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8481        self._environment = new_value.to_string();
8482        self
8483    }
8484    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8485    /// while executing the actual API request.
8486    ///
8487    /// ````text
8488    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8489    /// ````
8490    ///
8491    /// Sets the *delegate* property to the given value.
8492    pub fn delegate(
8493        mut self,
8494        new_value: &'a mut dyn common::Delegate,
8495    ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8496        self._delegate = Some(new_value);
8497        self
8498    }
8499
8500    /// Set any additional parameter of the query string used in the request.
8501    /// It should be used to set parameters which are not yet available through their own
8502    /// setters.
8503    ///
8504    /// Please note that this method must not be used to set any of the known parameters
8505    /// which have their own setter method. If done anyway, the request will fail.
8506    ///
8507    /// # Additional Parameters
8508    ///
8509    /// * *$.xgafv* (query-string) - V1 error format.
8510    /// * *access_token* (query-string) - OAuth access token.
8511    /// * *alt* (query-string) - Data format for response.
8512    /// * *callback* (query-string) - JSONP
8513    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8514    /// * *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.
8515    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8516    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8517    /// * *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.
8518    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8519    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8520    pub fn param<T>(
8521        mut self,
8522        name: T,
8523        value: T,
8524    ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8525    where
8526        T: AsRef<str>,
8527    {
8528        self._additional_params
8529            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8530        self
8531    }
8532
8533    /// Identifies the authorization scope for the method you are building.
8534    ///
8535    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8536    /// [`Scope::CloudPlatform`].
8537    ///
8538    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8539    /// tokens for more than one scope.
8540    ///
8541    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8542    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8543    /// sufficient, a read-write scope will do as well.
8544    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8545    where
8546        St: AsRef<str>,
8547    {
8548        self._scopes.insert(String::from(scope.as_ref()));
8549        self
8550    }
8551    /// Identifies the authorization scope(s) for the method you are building.
8552    ///
8553    /// See [`Self::add_scope()`] for details.
8554    pub fn add_scopes<I, St>(
8555        mut self,
8556        scopes: I,
8557    ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8558    where
8559        I: IntoIterator<Item = St>,
8560        St: AsRef<str>,
8561    {
8562        self._scopes
8563            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8564        self
8565    }
8566
8567    /// Removes all scopes, and no default scope will be used either.
8568    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8569    /// for details).
8570    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8571        self._scopes.clear();
8572        self
8573    }
8574}
8575
8576/// Update an environment.
8577///
8578/// A builder for the *locations.environments.patch* method supported by a *project* resource.
8579/// It is not used directly, but through a [`ProjectMethods`] instance.
8580///
8581/// # Example
8582///
8583/// Instantiate a resource method builder
8584///
8585/// ```test_harness,no_run
8586/// # extern crate hyper;
8587/// # extern crate hyper_rustls;
8588/// # extern crate google_composer1 as composer1;
8589/// use composer1::api::Environment;
8590/// # async fn dox() {
8591/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8592///
8593/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8594/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8595/// #     secret,
8596/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8597/// # ).build().await.unwrap();
8598///
8599/// # let client = hyper_util::client::legacy::Client::builder(
8600/// #     hyper_util::rt::TokioExecutor::new()
8601/// # )
8602/// # .build(
8603/// #     hyper_rustls::HttpsConnectorBuilder::new()
8604/// #         .with_native_roots()
8605/// #         .unwrap()
8606/// #         .https_or_http()
8607/// #         .enable_http1()
8608/// #         .build()
8609/// # );
8610/// # let mut hub = CloudComposer::new(client, auth);
8611/// // As the method needs a request, you would usually fill it with the desired information
8612/// // into the respective structure. Some of the parts shown here might not be applicable !
8613/// // Values shown here are possibly random and not representative !
8614/// let mut req = Environment::default();
8615///
8616/// // You can configure optional parameters by calling the respective setters at will, and
8617/// // execute the final call using `doit()`.
8618/// // Values shown here are possibly random and not representative !
8619/// let result = hub.projects().locations_environments_patch(req, "name")
8620///              .update_mask(FieldMask::new::<&str>(&[]))
8621///              .doit().await;
8622/// # }
8623/// ```
8624pub struct ProjectLocationEnvironmentPatchCall<'a, C>
8625where
8626    C: 'a,
8627{
8628    hub: &'a CloudComposer<C>,
8629    _request: Environment,
8630    _name: String,
8631    _update_mask: Option<common::FieldMask>,
8632    _delegate: Option<&'a mut dyn common::Delegate>,
8633    _additional_params: HashMap<String, String>,
8634    _scopes: BTreeSet<String>,
8635}
8636
8637impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentPatchCall<'a, C> {}
8638
8639impl<'a, C> ProjectLocationEnvironmentPatchCall<'a, C>
8640where
8641    C: common::Connector,
8642{
8643    /// Perform the operation you have build so far.
8644    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8645        use std::borrow::Cow;
8646        use std::io::{Read, Seek};
8647
8648        use common::{url::Params, ToParts};
8649        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8650
8651        let mut dd = common::DefaultDelegate;
8652        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8653        dlg.begin(common::MethodInfo {
8654            id: "composer.projects.locations.environments.patch",
8655            http_method: hyper::Method::PATCH,
8656        });
8657
8658        for &field in ["alt", "name", "updateMask"].iter() {
8659            if self._additional_params.contains_key(field) {
8660                dlg.finished(false);
8661                return Err(common::Error::FieldClash(field));
8662            }
8663        }
8664
8665        let mut params = Params::with_capacity(5 + self._additional_params.len());
8666        params.push("name", self._name);
8667        if let Some(value) = self._update_mask.as_ref() {
8668            params.push("updateMask", value.to_string());
8669        }
8670
8671        params.extend(self._additional_params.iter());
8672
8673        params.push("alt", "json");
8674        let mut url = self.hub._base_url.clone() + "v1/{+name}";
8675        if self._scopes.is_empty() {
8676            self._scopes
8677                .insert(Scope::CloudPlatform.as_ref().to_string());
8678        }
8679
8680        #[allow(clippy::single_element_loop)]
8681        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8682            url = params.uri_replacement(url, param_name, find_this, true);
8683        }
8684        {
8685            let to_remove = ["name"];
8686            params.remove_params(&to_remove);
8687        }
8688
8689        let url = params.parse_with_url(&url);
8690
8691        let mut json_mime_type = mime::APPLICATION_JSON;
8692        let mut request_value_reader = {
8693            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8694            common::remove_json_null_values(&mut value);
8695            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8696            serde_json::to_writer(&mut dst, &value).unwrap();
8697            dst
8698        };
8699        let request_size = request_value_reader
8700            .seek(std::io::SeekFrom::End(0))
8701            .unwrap();
8702        request_value_reader
8703            .seek(std::io::SeekFrom::Start(0))
8704            .unwrap();
8705
8706        loop {
8707            let token = match self
8708                .hub
8709                .auth
8710                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8711                .await
8712            {
8713                Ok(token) => token,
8714                Err(e) => match dlg.token(e) {
8715                    Ok(token) => token,
8716                    Err(e) => {
8717                        dlg.finished(false);
8718                        return Err(common::Error::MissingToken(e));
8719                    }
8720                },
8721            };
8722            request_value_reader
8723                .seek(std::io::SeekFrom::Start(0))
8724                .unwrap();
8725            let mut req_result = {
8726                let client = &self.hub.client;
8727                dlg.pre_request();
8728                let mut req_builder = hyper::Request::builder()
8729                    .method(hyper::Method::PATCH)
8730                    .uri(url.as_str())
8731                    .header(USER_AGENT, self.hub._user_agent.clone());
8732
8733                if let Some(token) = token.as_ref() {
8734                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8735                }
8736
8737                let request = req_builder
8738                    .header(CONTENT_TYPE, json_mime_type.to_string())
8739                    .header(CONTENT_LENGTH, request_size as u64)
8740                    .body(common::to_body(
8741                        request_value_reader.get_ref().clone().into(),
8742                    ));
8743
8744                client.request(request.unwrap()).await
8745            };
8746
8747            match req_result {
8748                Err(err) => {
8749                    if let common::Retry::After(d) = dlg.http_error(&err) {
8750                        sleep(d).await;
8751                        continue;
8752                    }
8753                    dlg.finished(false);
8754                    return Err(common::Error::HttpError(err));
8755                }
8756                Ok(res) => {
8757                    let (mut parts, body) = res.into_parts();
8758                    let mut body = common::Body::new(body);
8759                    if !parts.status.is_success() {
8760                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8761                        let error = serde_json::from_str(&common::to_string(&bytes));
8762                        let response = common::to_response(parts, bytes.into());
8763
8764                        if let common::Retry::After(d) =
8765                            dlg.http_failure(&response, error.as_ref().ok())
8766                        {
8767                            sleep(d).await;
8768                            continue;
8769                        }
8770
8771                        dlg.finished(false);
8772
8773                        return Err(match error {
8774                            Ok(value) => common::Error::BadRequest(value),
8775                            _ => common::Error::Failure(response),
8776                        });
8777                    }
8778                    let response = {
8779                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8780                        let encoded = common::to_string(&bytes);
8781                        match serde_json::from_str(&encoded) {
8782                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8783                            Err(error) => {
8784                                dlg.response_json_decode_error(&encoded, &error);
8785                                return Err(common::Error::JsonDecodeError(
8786                                    encoded.to_string(),
8787                                    error,
8788                                ));
8789                            }
8790                        }
8791                    };
8792
8793                    dlg.finished(true);
8794                    return Ok(response);
8795                }
8796            }
8797        }
8798    }
8799
8800    ///
8801    /// Sets the *request* property to the given value.
8802    ///
8803    /// Even though the property as already been set when instantiating this call,
8804    /// we provide this method for API completeness.
8805    pub fn request(mut self, new_value: Environment) -> ProjectLocationEnvironmentPatchCall<'a, C> {
8806        self._request = new_value;
8807        self
8808    }
8809    /// The relative resource name of the environment to update, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
8810    ///
8811    /// Sets the *name* path property to the given value.
8812    ///
8813    /// Even though the property as already been set when instantiating this call,
8814    /// we provide this method for API completeness.
8815    pub fn name(mut self, new_value: &str) -> ProjectLocationEnvironmentPatchCall<'a, C> {
8816        self._name = new_value.to_string();
8817        self
8818    }
8819    /// Required. A comma-separated list of paths, relative to `Environment`, of fields to update. For example, to set the version of scikit-learn to install in the environment to 0.19.0 and to remove an existing installation of numpy, the `updateMask` parameter would include the following two `paths` values: "config.softwareConfig.pypiPackages.scikit-learn" and "config.softwareConfig.pypiPackages.numpy". The included patch environment would specify the scikit-learn version as follows: { "config":{ "softwareConfig":{ "pypiPackages":{ "scikit-learn":"==0.19.0" } } } } Note that in the above example, any existing PyPI packages other than scikit-learn and numpy will be unaffected. Only one update type may be included in a single request's `updateMask`. For example, one cannot update both the PyPI packages and labels in the same request. However, it is possible to update multiple members of a map field simultaneously in the same request. For example, to set the labels "label1" and "label2" while clearing "label3" (assuming it already exists), one can provide the paths "labels.label1", "labels.label2", and "labels.label3" and populate the patch environment as follows: { "labels":{ "label1":"new-label1-value" "label2":"new-label2-value" } } Note that in the above example, any existing labels that are not included in the `updateMask` will be unaffected. It is also possible to replace an entire map field by providing the map field's path in the `updateMask`. The new value of the field will be that which is provided in the patch environment. For example, to delete all pre-existing user-specified PyPI packages and install botocore at version 1.7.14, the `updateMask` would contain the path "config.softwareConfig.pypiPackages", and the patch environment would be the following: { "config":{ "softwareConfig":{ "pypiPackages":{ "botocore":"==1.7.14" } } } } **Note:** Only the following fields can be updated: * `config.softwareConfig.pypiPackages` * Replace all custom custom PyPI packages. If a replacement package map is not included in `environment`, all custom PyPI packages are cleared. It is an error to provide both this mask and a mask specifying an individual package. * `config.softwareConfig.pypiPackages.`packagename * Update the custom PyPI package *packagename*, preserving other packages. To delete the package, include it in `updateMask`, and omit the mapping for it in `environment.config.softwareConfig.pypiPackages`. It is an error to provide both a mask of this form and the `config.softwareConfig.pypiPackages` mask. * `labels` * Replace all environment labels. If a replacement labels map is not included in `environment`, all labels are cleared. It is an error to provide both this mask and a mask specifying one or more individual labels. * `labels.`labelName * Set the label named *labelName*, while preserving other labels. To delete the label, include it in `updateMask` and omit its mapping in `environment.labels`. It is an error to provide both a mask of this form and the `labels` mask. * `config.nodeCount` * Horizontally scale the number of nodes in the environment. An integer greater than or equal to 3 must be provided in the `config.nodeCount` field. Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*. * `config.webServerNetworkAccessControl` * Replace the environment's current `WebServerNetworkAccessControl`. * `config.softwareConfig.airflowConfigOverrides` * Replace all Apache Airflow config overrides. If a replacement config overrides map is not included in `environment`, all config overrides are cleared. It is an error to provide both this mask and a mask specifying one or more individual config overrides. * `config.softwareConfig.airflowConfigOverrides.`section-name * Override the Apache Airflow config property *name* in the section named *section*, preserving other properties. To delete the property override, include it in `updateMask` and omit its mapping in `environment.config.softwareConfig.airflowConfigOverrides`. It is an error to provide both a mask of this form and the `config.softwareConfig.airflowConfigOverrides` mask. * `config.softwareConfig.envVariables` * Replace all environment variables. If a replacement environment variable map is not included in `environment`, all custom environment variables are cleared. * `config.softwareConfig.schedulerCount` * Horizontally scale the number of schedulers in Airflow. A positive integer not greater than the number of nodes must be provided in the `config.softwareConfig.schedulerCount` field. Supported for Cloud Composer environments in versions composer-1.*.*-airflow-2.*.*. * `config.databaseConfig.machineType` * Cloud SQL machine type used by Airflow database. It has to be one of: db-n1-standard-2, db-n1-standard-4, db-n1-standard-8 or db-n1-standard-16. Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*. * `config.webServerConfig.machineType` * Machine type on which Airflow web server is running. It has to be one of: composer-n1-webserver-2, composer-n1-webserver-4 or composer-n1-webserver-8. Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
8820    ///
8821    /// Sets the *update mask* query property to the given value.
8822    pub fn update_mask(
8823        mut self,
8824        new_value: common::FieldMask,
8825    ) -> ProjectLocationEnvironmentPatchCall<'a, C> {
8826        self._update_mask = Some(new_value);
8827        self
8828    }
8829    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8830    /// while executing the actual API request.
8831    ///
8832    /// ````text
8833    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8834    /// ````
8835    ///
8836    /// Sets the *delegate* property to the given value.
8837    pub fn delegate(
8838        mut self,
8839        new_value: &'a mut dyn common::Delegate,
8840    ) -> ProjectLocationEnvironmentPatchCall<'a, C> {
8841        self._delegate = Some(new_value);
8842        self
8843    }
8844
8845    /// Set any additional parameter of the query string used in the request.
8846    /// It should be used to set parameters which are not yet available through their own
8847    /// setters.
8848    ///
8849    /// Please note that this method must not be used to set any of the known parameters
8850    /// which have their own setter method. If done anyway, the request will fail.
8851    ///
8852    /// # Additional Parameters
8853    ///
8854    /// * *$.xgafv* (query-string) - V1 error format.
8855    /// * *access_token* (query-string) - OAuth access token.
8856    /// * *alt* (query-string) - Data format for response.
8857    /// * *callback* (query-string) - JSONP
8858    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8859    /// * *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.
8860    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8861    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8862    /// * *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.
8863    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8864    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8865    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentPatchCall<'a, C>
8866    where
8867        T: AsRef<str>,
8868    {
8869        self._additional_params
8870            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8871        self
8872    }
8873
8874    /// Identifies the authorization scope for the method you are building.
8875    ///
8876    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8877    /// [`Scope::CloudPlatform`].
8878    ///
8879    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8880    /// tokens for more than one scope.
8881    ///
8882    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8883    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8884    /// sufficient, a read-write scope will do as well.
8885    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentPatchCall<'a, C>
8886    where
8887        St: AsRef<str>,
8888    {
8889        self._scopes.insert(String::from(scope.as_ref()));
8890        self
8891    }
8892    /// Identifies the authorization scope(s) for the method you are building.
8893    ///
8894    /// See [`Self::add_scope()`] for details.
8895    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentPatchCall<'a, C>
8896    where
8897        I: IntoIterator<Item = St>,
8898        St: AsRef<str>,
8899    {
8900        self._scopes
8901            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8902        self
8903    }
8904
8905    /// Removes all scopes, and no default scope will be used either.
8906    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8907    /// for details).
8908    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentPatchCall<'a, C> {
8909        self._scopes.clear();
8910        self
8911    }
8912}
8913
8914/// Polls Airflow CLI command execution and fetches logs.
8915///
8916/// A builder for the *locations.environments.pollAirflowCommand* method supported by a *project* resource.
8917/// It is not used directly, but through a [`ProjectMethods`] instance.
8918///
8919/// # Example
8920///
8921/// Instantiate a resource method builder
8922///
8923/// ```test_harness,no_run
8924/// # extern crate hyper;
8925/// # extern crate hyper_rustls;
8926/// # extern crate google_composer1 as composer1;
8927/// use composer1::api::PollAirflowCommandRequest;
8928/// # async fn dox() {
8929/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8930///
8931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8932/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8933/// #     secret,
8934/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8935/// # ).build().await.unwrap();
8936///
8937/// # let client = hyper_util::client::legacy::Client::builder(
8938/// #     hyper_util::rt::TokioExecutor::new()
8939/// # )
8940/// # .build(
8941/// #     hyper_rustls::HttpsConnectorBuilder::new()
8942/// #         .with_native_roots()
8943/// #         .unwrap()
8944/// #         .https_or_http()
8945/// #         .enable_http1()
8946/// #         .build()
8947/// # );
8948/// # let mut hub = CloudComposer::new(client, auth);
8949/// // As the method needs a request, you would usually fill it with the desired information
8950/// // into the respective structure. Some of the parts shown here might not be applicable !
8951/// // Values shown here are possibly random and not representative !
8952/// let mut req = PollAirflowCommandRequest::default();
8953///
8954/// // You can configure optional parameters by calling the respective setters at will, and
8955/// // execute the final call using `doit()`.
8956/// // Values shown here are possibly random and not representative !
8957/// let result = hub.projects().locations_environments_poll_airflow_command(req, "environment")
8958///              .doit().await;
8959/// # }
8960/// ```
8961pub struct ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
8962where
8963    C: 'a,
8964{
8965    hub: &'a CloudComposer<C>,
8966    _request: PollAirflowCommandRequest,
8967    _environment: String,
8968    _delegate: Option<&'a mut dyn common::Delegate>,
8969    _additional_params: HashMap<String, String>,
8970    _scopes: BTreeSet<String>,
8971}
8972
8973impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {}
8974
8975impl<'a, C> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
8976where
8977    C: common::Connector,
8978{
8979    /// Perform the operation you have build so far.
8980    pub async fn doit(mut self) -> common::Result<(common::Response, PollAirflowCommandResponse)> {
8981        use std::borrow::Cow;
8982        use std::io::{Read, Seek};
8983
8984        use common::{url::Params, ToParts};
8985        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8986
8987        let mut dd = common::DefaultDelegate;
8988        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8989        dlg.begin(common::MethodInfo {
8990            id: "composer.projects.locations.environments.pollAirflowCommand",
8991            http_method: hyper::Method::POST,
8992        });
8993
8994        for &field in ["alt", "environment"].iter() {
8995            if self._additional_params.contains_key(field) {
8996                dlg.finished(false);
8997                return Err(common::Error::FieldClash(field));
8998            }
8999        }
9000
9001        let mut params = Params::with_capacity(4 + self._additional_params.len());
9002        params.push("environment", self._environment);
9003
9004        params.extend(self._additional_params.iter());
9005
9006        params.push("alt", "json");
9007        let mut url = self.hub._base_url.clone() + "v1/{+environment}:pollAirflowCommand";
9008        if self._scopes.is_empty() {
9009            self._scopes
9010                .insert(Scope::CloudPlatform.as_ref().to_string());
9011        }
9012
9013        #[allow(clippy::single_element_loop)]
9014        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
9015            url = params.uri_replacement(url, param_name, find_this, true);
9016        }
9017        {
9018            let to_remove = ["environment"];
9019            params.remove_params(&to_remove);
9020        }
9021
9022        let url = params.parse_with_url(&url);
9023
9024        let mut json_mime_type = mime::APPLICATION_JSON;
9025        let mut request_value_reader = {
9026            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9027            common::remove_json_null_values(&mut value);
9028            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9029            serde_json::to_writer(&mut dst, &value).unwrap();
9030            dst
9031        };
9032        let request_size = request_value_reader
9033            .seek(std::io::SeekFrom::End(0))
9034            .unwrap();
9035        request_value_reader
9036            .seek(std::io::SeekFrom::Start(0))
9037            .unwrap();
9038
9039        loop {
9040            let token = match self
9041                .hub
9042                .auth
9043                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9044                .await
9045            {
9046                Ok(token) => token,
9047                Err(e) => match dlg.token(e) {
9048                    Ok(token) => token,
9049                    Err(e) => {
9050                        dlg.finished(false);
9051                        return Err(common::Error::MissingToken(e));
9052                    }
9053                },
9054            };
9055            request_value_reader
9056                .seek(std::io::SeekFrom::Start(0))
9057                .unwrap();
9058            let mut req_result = {
9059                let client = &self.hub.client;
9060                dlg.pre_request();
9061                let mut req_builder = hyper::Request::builder()
9062                    .method(hyper::Method::POST)
9063                    .uri(url.as_str())
9064                    .header(USER_AGENT, self.hub._user_agent.clone());
9065
9066                if let Some(token) = token.as_ref() {
9067                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9068                }
9069
9070                let request = req_builder
9071                    .header(CONTENT_TYPE, json_mime_type.to_string())
9072                    .header(CONTENT_LENGTH, request_size as u64)
9073                    .body(common::to_body(
9074                        request_value_reader.get_ref().clone().into(),
9075                    ));
9076
9077                client.request(request.unwrap()).await
9078            };
9079
9080            match req_result {
9081                Err(err) => {
9082                    if let common::Retry::After(d) = dlg.http_error(&err) {
9083                        sleep(d).await;
9084                        continue;
9085                    }
9086                    dlg.finished(false);
9087                    return Err(common::Error::HttpError(err));
9088                }
9089                Ok(res) => {
9090                    let (mut parts, body) = res.into_parts();
9091                    let mut body = common::Body::new(body);
9092                    if !parts.status.is_success() {
9093                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9094                        let error = serde_json::from_str(&common::to_string(&bytes));
9095                        let response = common::to_response(parts, bytes.into());
9096
9097                        if let common::Retry::After(d) =
9098                            dlg.http_failure(&response, error.as_ref().ok())
9099                        {
9100                            sleep(d).await;
9101                            continue;
9102                        }
9103
9104                        dlg.finished(false);
9105
9106                        return Err(match error {
9107                            Ok(value) => common::Error::BadRequest(value),
9108                            _ => common::Error::Failure(response),
9109                        });
9110                    }
9111                    let response = {
9112                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9113                        let encoded = common::to_string(&bytes);
9114                        match serde_json::from_str(&encoded) {
9115                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9116                            Err(error) => {
9117                                dlg.response_json_decode_error(&encoded, &error);
9118                                return Err(common::Error::JsonDecodeError(
9119                                    encoded.to_string(),
9120                                    error,
9121                                ));
9122                            }
9123                        }
9124                    };
9125
9126                    dlg.finished(true);
9127                    return Ok(response);
9128                }
9129            }
9130        }
9131    }
9132
9133    ///
9134    /// Sets the *request* property to the given value.
9135    ///
9136    /// Even though the property as already been set when instantiating this call,
9137    /// we provide this method for API completeness.
9138    pub fn request(
9139        mut self,
9140        new_value: PollAirflowCommandRequest,
9141    ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9142        self._request = new_value;
9143        self
9144    }
9145    /// The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
9146    ///
9147    /// Sets the *environment* path property to the given value.
9148    ///
9149    /// Even though the property as already been set when instantiating this call,
9150    /// we provide this method for API completeness.
9151    pub fn environment(
9152        mut self,
9153        new_value: &str,
9154    ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9155        self._environment = new_value.to_string();
9156        self
9157    }
9158    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9159    /// while executing the actual API request.
9160    ///
9161    /// ````text
9162    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9163    /// ````
9164    ///
9165    /// Sets the *delegate* property to the given value.
9166    pub fn delegate(
9167        mut self,
9168        new_value: &'a mut dyn common::Delegate,
9169    ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9170        self._delegate = Some(new_value);
9171        self
9172    }
9173
9174    /// Set any additional parameter of the query string used in the request.
9175    /// It should be used to set parameters which are not yet available through their own
9176    /// setters.
9177    ///
9178    /// Please note that this method must not be used to set any of the known parameters
9179    /// which have their own setter method. If done anyway, the request will fail.
9180    ///
9181    /// # Additional Parameters
9182    ///
9183    /// * *$.xgafv* (query-string) - V1 error format.
9184    /// * *access_token* (query-string) - OAuth access token.
9185    /// * *alt* (query-string) - Data format for response.
9186    /// * *callback* (query-string) - JSONP
9187    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9188    /// * *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.
9189    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9190    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9191    /// * *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.
9192    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9193    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9194    pub fn param<T>(
9195        mut self,
9196        name: T,
9197        value: T,
9198    ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9199    where
9200        T: AsRef<str>,
9201    {
9202        self._additional_params
9203            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9204        self
9205    }
9206
9207    /// Identifies the authorization scope for the method you are building.
9208    ///
9209    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9210    /// [`Scope::CloudPlatform`].
9211    ///
9212    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9213    /// tokens for more than one scope.
9214    ///
9215    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9216    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9217    /// sufficient, a read-write scope will do as well.
9218    pub fn add_scope<St>(
9219        mut self,
9220        scope: St,
9221    ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9222    where
9223        St: AsRef<str>,
9224    {
9225        self._scopes.insert(String::from(scope.as_ref()));
9226        self
9227    }
9228    /// Identifies the authorization scope(s) for the method you are building.
9229    ///
9230    /// See [`Self::add_scope()`] for details.
9231    pub fn add_scopes<I, St>(
9232        mut self,
9233        scopes: I,
9234    ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9235    where
9236        I: IntoIterator<Item = St>,
9237        St: AsRef<str>,
9238    {
9239        self._scopes
9240            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9241        self
9242    }
9243
9244    /// Removes all scopes, and no default scope will be used either.
9245    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9246    /// for details).
9247    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9248        self._scopes.clear();
9249        self
9250    }
9251}
9252
9253/// Creates a snapshots of a Cloud Composer environment. As a result of this operation, snapshot of environment's state is stored in a location specified in the SaveSnapshotRequest.
9254///
9255/// A builder for the *locations.environments.saveSnapshot* method supported by a *project* resource.
9256/// It is not used directly, but through a [`ProjectMethods`] instance.
9257///
9258/// # Example
9259///
9260/// Instantiate a resource method builder
9261///
9262/// ```test_harness,no_run
9263/// # extern crate hyper;
9264/// # extern crate hyper_rustls;
9265/// # extern crate google_composer1 as composer1;
9266/// use composer1::api::SaveSnapshotRequest;
9267/// # async fn dox() {
9268/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9269///
9270/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9271/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9272/// #     secret,
9273/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9274/// # ).build().await.unwrap();
9275///
9276/// # let client = hyper_util::client::legacy::Client::builder(
9277/// #     hyper_util::rt::TokioExecutor::new()
9278/// # )
9279/// # .build(
9280/// #     hyper_rustls::HttpsConnectorBuilder::new()
9281/// #         .with_native_roots()
9282/// #         .unwrap()
9283/// #         .https_or_http()
9284/// #         .enable_http1()
9285/// #         .build()
9286/// # );
9287/// # let mut hub = CloudComposer::new(client, auth);
9288/// // As the method needs a request, you would usually fill it with the desired information
9289/// // into the respective structure. Some of the parts shown here might not be applicable !
9290/// // Values shown here are possibly random and not representative !
9291/// let mut req = SaveSnapshotRequest::default();
9292///
9293/// // You can configure optional parameters by calling the respective setters at will, and
9294/// // execute the final call using `doit()`.
9295/// // Values shown here are possibly random and not representative !
9296/// let result = hub.projects().locations_environments_save_snapshot(req, "environment")
9297///              .doit().await;
9298/// # }
9299/// ```
9300pub struct ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
9301where
9302    C: 'a,
9303{
9304    hub: &'a CloudComposer<C>,
9305    _request: SaveSnapshotRequest,
9306    _environment: String,
9307    _delegate: Option<&'a mut dyn common::Delegate>,
9308    _additional_params: HashMap<String, String>,
9309    _scopes: BTreeSet<String>,
9310}
9311
9312impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {}
9313
9314impl<'a, C> ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
9315where
9316    C: common::Connector,
9317{
9318    /// Perform the operation you have build so far.
9319    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9320        use std::borrow::Cow;
9321        use std::io::{Read, Seek};
9322
9323        use common::{url::Params, ToParts};
9324        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9325
9326        let mut dd = common::DefaultDelegate;
9327        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9328        dlg.begin(common::MethodInfo {
9329            id: "composer.projects.locations.environments.saveSnapshot",
9330            http_method: hyper::Method::POST,
9331        });
9332
9333        for &field in ["alt", "environment"].iter() {
9334            if self._additional_params.contains_key(field) {
9335                dlg.finished(false);
9336                return Err(common::Error::FieldClash(field));
9337            }
9338        }
9339
9340        let mut params = Params::with_capacity(4 + self._additional_params.len());
9341        params.push("environment", self._environment);
9342
9343        params.extend(self._additional_params.iter());
9344
9345        params.push("alt", "json");
9346        let mut url = self.hub._base_url.clone() + "v1/{+environment}:saveSnapshot";
9347        if self._scopes.is_empty() {
9348            self._scopes
9349                .insert(Scope::CloudPlatform.as_ref().to_string());
9350        }
9351
9352        #[allow(clippy::single_element_loop)]
9353        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
9354            url = params.uri_replacement(url, param_name, find_this, true);
9355        }
9356        {
9357            let to_remove = ["environment"];
9358            params.remove_params(&to_remove);
9359        }
9360
9361        let url = params.parse_with_url(&url);
9362
9363        let mut json_mime_type = mime::APPLICATION_JSON;
9364        let mut request_value_reader = {
9365            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9366            common::remove_json_null_values(&mut value);
9367            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9368            serde_json::to_writer(&mut dst, &value).unwrap();
9369            dst
9370        };
9371        let request_size = request_value_reader
9372            .seek(std::io::SeekFrom::End(0))
9373            .unwrap();
9374        request_value_reader
9375            .seek(std::io::SeekFrom::Start(0))
9376            .unwrap();
9377
9378        loop {
9379            let token = match self
9380                .hub
9381                .auth
9382                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9383                .await
9384            {
9385                Ok(token) => token,
9386                Err(e) => match dlg.token(e) {
9387                    Ok(token) => token,
9388                    Err(e) => {
9389                        dlg.finished(false);
9390                        return Err(common::Error::MissingToken(e));
9391                    }
9392                },
9393            };
9394            request_value_reader
9395                .seek(std::io::SeekFrom::Start(0))
9396                .unwrap();
9397            let mut req_result = {
9398                let client = &self.hub.client;
9399                dlg.pre_request();
9400                let mut req_builder = hyper::Request::builder()
9401                    .method(hyper::Method::POST)
9402                    .uri(url.as_str())
9403                    .header(USER_AGENT, self.hub._user_agent.clone());
9404
9405                if let Some(token) = token.as_ref() {
9406                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9407                }
9408
9409                let request = req_builder
9410                    .header(CONTENT_TYPE, json_mime_type.to_string())
9411                    .header(CONTENT_LENGTH, request_size as u64)
9412                    .body(common::to_body(
9413                        request_value_reader.get_ref().clone().into(),
9414                    ));
9415
9416                client.request(request.unwrap()).await
9417            };
9418
9419            match req_result {
9420                Err(err) => {
9421                    if let common::Retry::After(d) = dlg.http_error(&err) {
9422                        sleep(d).await;
9423                        continue;
9424                    }
9425                    dlg.finished(false);
9426                    return Err(common::Error::HttpError(err));
9427                }
9428                Ok(res) => {
9429                    let (mut parts, body) = res.into_parts();
9430                    let mut body = common::Body::new(body);
9431                    if !parts.status.is_success() {
9432                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9433                        let error = serde_json::from_str(&common::to_string(&bytes));
9434                        let response = common::to_response(parts, bytes.into());
9435
9436                        if let common::Retry::After(d) =
9437                            dlg.http_failure(&response, error.as_ref().ok())
9438                        {
9439                            sleep(d).await;
9440                            continue;
9441                        }
9442
9443                        dlg.finished(false);
9444
9445                        return Err(match error {
9446                            Ok(value) => common::Error::BadRequest(value),
9447                            _ => common::Error::Failure(response),
9448                        });
9449                    }
9450                    let response = {
9451                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9452                        let encoded = common::to_string(&bytes);
9453                        match serde_json::from_str(&encoded) {
9454                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9455                            Err(error) => {
9456                                dlg.response_json_decode_error(&encoded, &error);
9457                                return Err(common::Error::JsonDecodeError(
9458                                    encoded.to_string(),
9459                                    error,
9460                                ));
9461                            }
9462                        }
9463                    };
9464
9465                    dlg.finished(true);
9466                    return Ok(response);
9467                }
9468            }
9469        }
9470    }
9471
9472    ///
9473    /// Sets the *request* property to the given value.
9474    ///
9475    /// Even though the property as already been set when instantiating this call,
9476    /// we provide this method for API completeness.
9477    pub fn request(
9478        mut self,
9479        new_value: SaveSnapshotRequest,
9480    ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
9481        self._request = new_value;
9482        self
9483    }
9484    /// The resource name of the source environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
9485    ///
9486    /// Sets the *environment* path property to the given value.
9487    ///
9488    /// Even though the property as already been set when instantiating this call,
9489    /// we provide this method for API completeness.
9490    pub fn environment(
9491        mut self,
9492        new_value: &str,
9493    ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
9494        self._environment = new_value.to_string();
9495        self
9496    }
9497    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9498    /// while executing the actual API request.
9499    ///
9500    /// ````text
9501    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9502    /// ````
9503    ///
9504    /// Sets the *delegate* property to the given value.
9505    pub fn delegate(
9506        mut self,
9507        new_value: &'a mut dyn common::Delegate,
9508    ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
9509        self._delegate = Some(new_value);
9510        self
9511    }
9512
9513    /// Set any additional parameter of the query string used in the request.
9514    /// It should be used to set parameters which are not yet available through their own
9515    /// setters.
9516    ///
9517    /// Please note that this method must not be used to set any of the known parameters
9518    /// which have their own setter method. If done anyway, the request will fail.
9519    ///
9520    /// # Additional Parameters
9521    ///
9522    /// * *$.xgafv* (query-string) - V1 error format.
9523    /// * *access_token* (query-string) - OAuth access token.
9524    /// * *alt* (query-string) - Data format for response.
9525    /// * *callback* (query-string) - JSONP
9526    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9527    /// * *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.
9528    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9529    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9530    /// * *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.
9531    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9532    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9533    pub fn param<T>(
9534        mut self,
9535        name: T,
9536        value: T,
9537    ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
9538    where
9539        T: AsRef<str>,
9540    {
9541        self._additional_params
9542            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9543        self
9544    }
9545
9546    /// Identifies the authorization scope for the method you are building.
9547    ///
9548    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9549    /// [`Scope::CloudPlatform`].
9550    ///
9551    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9552    /// tokens for more than one scope.
9553    ///
9554    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9555    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9556    /// sufficient, a read-write scope will do as well.
9557    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
9558    where
9559        St: AsRef<str>,
9560    {
9561        self._scopes.insert(String::from(scope.as_ref()));
9562        self
9563    }
9564    /// Identifies the authorization scope(s) for the method you are building.
9565    ///
9566    /// See [`Self::add_scope()`] for details.
9567    pub fn add_scopes<I, St>(
9568        mut self,
9569        scopes: I,
9570    ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
9571    where
9572        I: IntoIterator<Item = St>,
9573        St: AsRef<str>,
9574    {
9575        self._scopes
9576            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9577        self
9578    }
9579
9580    /// Removes all scopes, and no default scope will be used either.
9581    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9582    /// for details).
9583    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
9584        self._scopes.clear();
9585        self
9586    }
9587}
9588
9589/// Stops Airflow CLI command execution.
9590///
9591/// A builder for the *locations.environments.stopAirflowCommand* method supported by a *project* resource.
9592/// It is not used directly, but through a [`ProjectMethods`] instance.
9593///
9594/// # Example
9595///
9596/// Instantiate a resource method builder
9597///
9598/// ```test_harness,no_run
9599/// # extern crate hyper;
9600/// # extern crate hyper_rustls;
9601/// # extern crate google_composer1 as composer1;
9602/// use composer1::api::StopAirflowCommandRequest;
9603/// # async fn dox() {
9604/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9605///
9606/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9607/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9608/// #     secret,
9609/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9610/// # ).build().await.unwrap();
9611///
9612/// # let client = hyper_util::client::legacy::Client::builder(
9613/// #     hyper_util::rt::TokioExecutor::new()
9614/// # )
9615/// # .build(
9616/// #     hyper_rustls::HttpsConnectorBuilder::new()
9617/// #         .with_native_roots()
9618/// #         .unwrap()
9619/// #         .https_or_http()
9620/// #         .enable_http1()
9621/// #         .build()
9622/// # );
9623/// # let mut hub = CloudComposer::new(client, auth);
9624/// // As the method needs a request, you would usually fill it with the desired information
9625/// // into the respective structure. Some of the parts shown here might not be applicable !
9626/// // Values shown here are possibly random and not representative !
9627/// let mut req = StopAirflowCommandRequest::default();
9628///
9629/// // You can configure optional parameters by calling the respective setters at will, and
9630/// // execute the final call using `doit()`.
9631/// // Values shown here are possibly random and not representative !
9632/// let result = hub.projects().locations_environments_stop_airflow_command(req, "environment")
9633///              .doit().await;
9634/// # }
9635/// ```
9636pub struct ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
9637where
9638    C: 'a,
9639{
9640    hub: &'a CloudComposer<C>,
9641    _request: StopAirflowCommandRequest,
9642    _environment: String,
9643    _delegate: Option<&'a mut dyn common::Delegate>,
9644    _additional_params: HashMap<String, String>,
9645    _scopes: BTreeSet<String>,
9646}
9647
9648impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {}
9649
9650impl<'a, C> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
9651where
9652    C: common::Connector,
9653{
9654    /// Perform the operation you have build so far.
9655    pub async fn doit(mut self) -> common::Result<(common::Response, StopAirflowCommandResponse)> {
9656        use std::borrow::Cow;
9657        use std::io::{Read, Seek};
9658
9659        use common::{url::Params, ToParts};
9660        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9661
9662        let mut dd = common::DefaultDelegate;
9663        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9664        dlg.begin(common::MethodInfo {
9665            id: "composer.projects.locations.environments.stopAirflowCommand",
9666            http_method: hyper::Method::POST,
9667        });
9668
9669        for &field in ["alt", "environment"].iter() {
9670            if self._additional_params.contains_key(field) {
9671                dlg.finished(false);
9672                return Err(common::Error::FieldClash(field));
9673            }
9674        }
9675
9676        let mut params = Params::with_capacity(4 + self._additional_params.len());
9677        params.push("environment", self._environment);
9678
9679        params.extend(self._additional_params.iter());
9680
9681        params.push("alt", "json");
9682        let mut url = self.hub._base_url.clone() + "v1/{+environment}:stopAirflowCommand";
9683        if self._scopes.is_empty() {
9684            self._scopes
9685                .insert(Scope::CloudPlatform.as_ref().to_string());
9686        }
9687
9688        #[allow(clippy::single_element_loop)]
9689        for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
9690            url = params.uri_replacement(url, param_name, find_this, true);
9691        }
9692        {
9693            let to_remove = ["environment"];
9694            params.remove_params(&to_remove);
9695        }
9696
9697        let url = params.parse_with_url(&url);
9698
9699        let mut json_mime_type = mime::APPLICATION_JSON;
9700        let mut request_value_reader = {
9701            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9702            common::remove_json_null_values(&mut value);
9703            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9704            serde_json::to_writer(&mut dst, &value).unwrap();
9705            dst
9706        };
9707        let request_size = request_value_reader
9708            .seek(std::io::SeekFrom::End(0))
9709            .unwrap();
9710        request_value_reader
9711            .seek(std::io::SeekFrom::Start(0))
9712            .unwrap();
9713
9714        loop {
9715            let token = match self
9716                .hub
9717                .auth
9718                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9719                .await
9720            {
9721                Ok(token) => token,
9722                Err(e) => match dlg.token(e) {
9723                    Ok(token) => token,
9724                    Err(e) => {
9725                        dlg.finished(false);
9726                        return Err(common::Error::MissingToken(e));
9727                    }
9728                },
9729            };
9730            request_value_reader
9731                .seek(std::io::SeekFrom::Start(0))
9732                .unwrap();
9733            let mut req_result = {
9734                let client = &self.hub.client;
9735                dlg.pre_request();
9736                let mut req_builder = hyper::Request::builder()
9737                    .method(hyper::Method::POST)
9738                    .uri(url.as_str())
9739                    .header(USER_AGENT, self.hub._user_agent.clone());
9740
9741                if let Some(token) = token.as_ref() {
9742                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9743                }
9744
9745                let request = req_builder
9746                    .header(CONTENT_TYPE, json_mime_type.to_string())
9747                    .header(CONTENT_LENGTH, request_size as u64)
9748                    .body(common::to_body(
9749                        request_value_reader.get_ref().clone().into(),
9750                    ));
9751
9752                client.request(request.unwrap()).await
9753            };
9754
9755            match req_result {
9756                Err(err) => {
9757                    if let common::Retry::After(d) = dlg.http_error(&err) {
9758                        sleep(d).await;
9759                        continue;
9760                    }
9761                    dlg.finished(false);
9762                    return Err(common::Error::HttpError(err));
9763                }
9764                Ok(res) => {
9765                    let (mut parts, body) = res.into_parts();
9766                    let mut body = common::Body::new(body);
9767                    if !parts.status.is_success() {
9768                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9769                        let error = serde_json::from_str(&common::to_string(&bytes));
9770                        let response = common::to_response(parts, bytes.into());
9771
9772                        if let common::Retry::After(d) =
9773                            dlg.http_failure(&response, error.as_ref().ok())
9774                        {
9775                            sleep(d).await;
9776                            continue;
9777                        }
9778
9779                        dlg.finished(false);
9780
9781                        return Err(match error {
9782                            Ok(value) => common::Error::BadRequest(value),
9783                            _ => common::Error::Failure(response),
9784                        });
9785                    }
9786                    let response = {
9787                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9788                        let encoded = common::to_string(&bytes);
9789                        match serde_json::from_str(&encoded) {
9790                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9791                            Err(error) => {
9792                                dlg.response_json_decode_error(&encoded, &error);
9793                                return Err(common::Error::JsonDecodeError(
9794                                    encoded.to_string(),
9795                                    error,
9796                                ));
9797                            }
9798                        }
9799                    };
9800
9801                    dlg.finished(true);
9802                    return Ok(response);
9803                }
9804            }
9805        }
9806    }
9807
9808    ///
9809    /// Sets the *request* property to the given value.
9810    ///
9811    /// Even though the property as already been set when instantiating this call,
9812    /// we provide this method for API completeness.
9813    pub fn request(
9814        mut self,
9815        new_value: StopAirflowCommandRequest,
9816    ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
9817        self._request = new_value;
9818        self
9819    }
9820    /// The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
9821    ///
9822    /// Sets the *environment* path property to the given value.
9823    ///
9824    /// Even though the property as already been set when instantiating this call,
9825    /// we provide this method for API completeness.
9826    pub fn environment(
9827        mut self,
9828        new_value: &str,
9829    ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
9830        self._environment = new_value.to_string();
9831        self
9832    }
9833    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9834    /// while executing the actual API request.
9835    ///
9836    /// ````text
9837    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9838    /// ````
9839    ///
9840    /// Sets the *delegate* property to the given value.
9841    pub fn delegate(
9842        mut self,
9843        new_value: &'a mut dyn common::Delegate,
9844    ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
9845        self._delegate = Some(new_value);
9846        self
9847    }
9848
9849    /// Set any additional parameter of the query string used in the request.
9850    /// It should be used to set parameters which are not yet available through their own
9851    /// setters.
9852    ///
9853    /// Please note that this method must not be used to set any of the known parameters
9854    /// which have their own setter method. If done anyway, the request will fail.
9855    ///
9856    /// # Additional Parameters
9857    ///
9858    /// * *$.xgafv* (query-string) - V1 error format.
9859    /// * *access_token* (query-string) - OAuth access token.
9860    /// * *alt* (query-string) - Data format for response.
9861    /// * *callback* (query-string) - JSONP
9862    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9863    /// * *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.
9864    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9865    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9866    /// * *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.
9867    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9868    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9869    pub fn param<T>(
9870        mut self,
9871        name: T,
9872        value: T,
9873    ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
9874    where
9875        T: AsRef<str>,
9876    {
9877        self._additional_params
9878            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9879        self
9880    }
9881
9882    /// Identifies the authorization scope for the method you are building.
9883    ///
9884    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9885    /// [`Scope::CloudPlatform`].
9886    ///
9887    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9888    /// tokens for more than one scope.
9889    ///
9890    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9891    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9892    /// sufficient, a read-write scope will do as well.
9893    pub fn add_scope<St>(
9894        mut self,
9895        scope: St,
9896    ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
9897    where
9898        St: AsRef<str>,
9899    {
9900        self._scopes.insert(String::from(scope.as_ref()));
9901        self
9902    }
9903    /// Identifies the authorization scope(s) for the method you are building.
9904    ///
9905    /// See [`Self::add_scope()`] for details.
9906    pub fn add_scopes<I, St>(
9907        mut self,
9908        scopes: I,
9909    ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
9910    where
9911        I: IntoIterator<Item = St>,
9912        St: AsRef<str>,
9913    {
9914        self._scopes
9915            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9916        self
9917    }
9918
9919    /// Removes all scopes, and no default scope will be used either.
9920    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9921    /// for details).
9922    pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
9923        self._scopes.clear();
9924        self
9925    }
9926}
9927
9928/// List ImageVersions for provided location.
9929///
9930/// A builder for the *locations.imageVersions.list* method supported by a *project* resource.
9931/// It is not used directly, but through a [`ProjectMethods`] instance.
9932///
9933/// # Example
9934///
9935/// Instantiate a resource method builder
9936///
9937/// ```test_harness,no_run
9938/// # extern crate hyper;
9939/// # extern crate hyper_rustls;
9940/// # extern crate google_composer1 as composer1;
9941/// # async fn dox() {
9942/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9943///
9944/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9945/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9946/// #     secret,
9947/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9948/// # ).build().await.unwrap();
9949///
9950/// # let client = hyper_util::client::legacy::Client::builder(
9951/// #     hyper_util::rt::TokioExecutor::new()
9952/// # )
9953/// # .build(
9954/// #     hyper_rustls::HttpsConnectorBuilder::new()
9955/// #         .with_native_roots()
9956/// #         .unwrap()
9957/// #         .https_or_http()
9958/// #         .enable_http1()
9959/// #         .build()
9960/// # );
9961/// # let mut hub = CloudComposer::new(client, auth);
9962/// // You can configure optional parameters by calling the respective setters at will, and
9963/// // execute the final call using `doit()`.
9964/// // Values shown here are possibly random and not representative !
9965/// let result = hub.projects().locations_image_versions_list("parent")
9966///              .page_token("labore")
9967///              .page_size(-43)
9968///              .include_past_releases(false)
9969///              .doit().await;
9970/// # }
9971/// ```
9972pub struct ProjectLocationImageVersionListCall<'a, C>
9973where
9974    C: 'a,
9975{
9976    hub: &'a CloudComposer<C>,
9977    _parent: String,
9978    _page_token: Option<String>,
9979    _page_size: Option<i32>,
9980    _include_past_releases: Option<bool>,
9981    _delegate: Option<&'a mut dyn common::Delegate>,
9982    _additional_params: HashMap<String, String>,
9983    _scopes: BTreeSet<String>,
9984}
9985
9986impl<'a, C> common::CallBuilder for ProjectLocationImageVersionListCall<'a, C> {}
9987
9988impl<'a, C> ProjectLocationImageVersionListCall<'a, C>
9989where
9990    C: common::Connector,
9991{
9992    /// Perform the operation you have build so far.
9993    pub async fn doit(mut self) -> common::Result<(common::Response, ListImageVersionsResponse)> {
9994        use std::borrow::Cow;
9995        use std::io::{Read, Seek};
9996
9997        use common::{url::Params, ToParts};
9998        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9999
10000        let mut dd = common::DefaultDelegate;
10001        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10002        dlg.begin(common::MethodInfo {
10003            id: "composer.projects.locations.imageVersions.list",
10004            http_method: hyper::Method::GET,
10005        });
10006
10007        for &field in [
10008            "alt",
10009            "parent",
10010            "pageToken",
10011            "pageSize",
10012            "includePastReleases",
10013        ]
10014        .iter()
10015        {
10016            if self._additional_params.contains_key(field) {
10017                dlg.finished(false);
10018                return Err(common::Error::FieldClash(field));
10019            }
10020        }
10021
10022        let mut params = Params::with_capacity(6 + self._additional_params.len());
10023        params.push("parent", self._parent);
10024        if let Some(value) = self._page_token.as_ref() {
10025            params.push("pageToken", value);
10026        }
10027        if let Some(value) = self._page_size.as_ref() {
10028            params.push("pageSize", value.to_string());
10029        }
10030        if let Some(value) = self._include_past_releases.as_ref() {
10031            params.push("includePastReleases", value.to_string());
10032        }
10033
10034        params.extend(self._additional_params.iter());
10035
10036        params.push("alt", "json");
10037        let mut url = self.hub._base_url.clone() + "v1/{+parent}/imageVersions";
10038        if self._scopes.is_empty() {
10039            self._scopes
10040                .insert(Scope::CloudPlatform.as_ref().to_string());
10041        }
10042
10043        #[allow(clippy::single_element_loop)]
10044        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10045            url = params.uri_replacement(url, param_name, find_this, true);
10046        }
10047        {
10048            let to_remove = ["parent"];
10049            params.remove_params(&to_remove);
10050        }
10051
10052        let url = params.parse_with_url(&url);
10053
10054        loop {
10055            let token = match self
10056                .hub
10057                .auth
10058                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10059                .await
10060            {
10061                Ok(token) => token,
10062                Err(e) => match dlg.token(e) {
10063                    Ok(token) => token,
10064                    Err(e) => {
10065                        dlg.finished(false);
10066                        return Err(common::Error::MissingToken(e));
10067                    }
10068                },
10069            };
10070            let mut req_result = {
10071                let client = &self.hub.client;
10072                dlg.pre_request();
10073                let mut req_builder = hyper::Request::builder()
10074                    .method(hyper::Method::GET)
10075                    .uri(url.as_str())
10076                    .header(USER_AGENT, self.hub._user_agent.clone());
10077
10078                if let Some(token) = token.as_ref() {
10079                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10080                }
10081
10082                let request = req_builder
10083                    .header(CONTENT_LENGTH, 0_u64)
10084                    .body(common::to_body::<String>(None));
10085
10086                client.request(request.unwrap()).await
10087            };
10088
10089            match req_result {
10090                Err(err) => {
10091                    if let common::Retry::After(d) = dlg.http_error(&err) {
10092                        sleep(d).await;
10093                        continue;
10094                    }
10095                    dlg.finished(false);
10096                    return Err(common::Error::HttpError(err));
10097                }
10098                Ok(res) => {
10099                    let (mut parts, body) = res.into_parts();
10100                    let mut body = common::Body::new(body);
10101                    if !parts.status.is_success() {
10102                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10103                        let error = serde_json::from_str(&common::to_string(&bytes));
10104                        let response = common::to_response(parts, bytes.into());
10105
10106                        if let common::Retry::After(d) =
10107                            dlg.http_failure(&response, error.as_ref().ok())
10108                        {
10109                            sleep(d).await;
10110                            continue;
10111                        }
10112
10113                        dlg.finished(false);
10114
10115                        return Err(match error {
10116                            Ok(value) => common::Error::BadRequest(value),
10117                            _ => common::Error::Failure(response),
10118                        });
10119                    }
10120                    let response = {
10121                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10122                        let encoded = common::to_string(&bytes);
10123                        match serde_json::from_str(&encoded) {
10124                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10125                            Err(error) => {
10126                                dlg.response_json_decode_error(&encoded, &error);
10127                                return Err(common::Error::JsonDecodeError(
10128                                    encoded.to_string(),
10129                                    error,
10130                                ));
10131                            }
10132                        }
10133                    };
10134
10135                    dlg.finished(true);
10136                    return Ok(response);
10137                }
10138            }
10139        }
10140    }
10141
10142    /// List ImageVersions in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
10143    ///
10144    /// Sets the *parent* path property to the given value.
10145    ///
10146    /// Even though the property as already been set when instantiating this call,
10147    /// we provide this method for API completeness.
10148    pub fn parent(mut self, new_value: &str) -> ProjectLocationImageVersionListCall<'a, C> {
10149        self._parent = new_value.to_string();
10150        self
10151    }
10152    /// The next_page_token value returned from a previous List request, if any.
10153    ///
10154    /// Sets the *page token* query property to the given value.
10155    pub fn page_token(mut self, new_value: &str) -> ProjectLocationImageVersionListCall<'a, C> {
10156        self._page_token = Some(new_value.to_string());
10157        self
10158    }
10159    /// The maximum number of image_versions to return.
10160    ///
10161    /// Sets the *page size* query property to the given value.
10162    pub fn page_size(mut self, new_value: i32) -> ProjectLocationImageVersionListCall<'a, C> {
10163        self._page_size = Some(new_value);
10164        self
10165    }
10166    /// Whether or not image versions from old releases should be included.
10167    ///
10168    /// Sets the *include past releases* query property to the given value.
10169    pub fn include_past_releases(
10170        mut self,
10171        new_value: bool,
10172    ) -> ProjectLocationImageVersionListCall<'a, C> {
10173        self._include_past_releases = Some(new_value);
10174        self
10175    }
10176    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10177    /// while executing the actual API request.
10178    ///
10179    /// ````text
10180    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10181    /// ````
10182    ///
10183    /// Sets the *delegate* property to the given value.
10184    pub fn delegate(
10185        mut self,
10186        new_value: &'a mut dyn common::Delegate,
10187    ) -> ProjectLocationImageVersionListCall<'a, C> {
10188        self._delegate = Some(new_value);
10189        self
10190    }
10191
10192    /// Set any additional parameter of the query string used in the request.
10193    /// It should be used to set parameters which are not yet available through their own
10194    /// setters.
10195    ///
10196    /// Please note that this method must not be used to set any of the known parameters
10197    /// which have their own setter method. If done anyway, the request will fail.
10198    ///
10199    /// # Additional Parameters
10200    ///
10201    /// * *$.xgafv* (query-string) - V1 error format.
10202    /// * *access_token* (query-string) - OAuth access token.
10203    /// * *alt* (query-string) - Data format for response.
10204    /// * *callback* (query-string) - JSONP
10205    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10206    /// * *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.
10207    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10208    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10209    /// * *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.
10210    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10211    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10212    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationImageVersionListCall<'a, C>
10213    where
10214        T: AsRef<str>,
10215    {
10216        self._additional_params
10217            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10218        self
10219    }
10220
10221    /// Identifies the authorization scope for the method you are building.
10222    ///
10223    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10224    /// [`Scope::CloudPlatform`].
10225    ///
10226    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10227    /// tokens for more than one scope.
10228    ///
10229    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10230    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10231    /// sufficient, a read-write scope will do as well.
10232    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationImageVersionListCall<'a, C>
10233    where
10234        St: AsRef<str>,
10235    {
10236        self._scopes.insert(String::from(scope.as_ref()));
10237        self
10238    }
10239    /// Identifies the authorization scope(s) for the method you are building.
10240    ///
10241    /// See [`Self::add_scope()`] for details.
10242    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationImageVersionListCall<'a, C>
10243    where
10244        I: IntoIterator<Item = St>,
10245        St: AsRef<str>,
10246    {
10247        self._scopes
10248            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10249        self
10250    }
10251
10252    /// Removes all scopes, and no default scope will be used either.
10253    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10254    /// for details).
10255    pub fn clear_scopes(mut self) -> ProjectLocationImageVersionListCall<'a, C> {
10256        self._scopes.clear();
10257        self
10258    }
10259}
10260
10261/// 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`.
10262///
10263/// A builder for the *locations.operations.delete* method supported by a *project* resource.
10264/// It is not used directly, but through a [`ProjectMethods`] instance.
10265///
10266/// # Example
10267///
10268/// Instantiate a resource method builder
10269///
10270/// ```test_harness,no_run
10271/// # extern crate hyper;
10272/// # extern crate hyper_rustls;
10273/// # extern crate google_composer1 as composer1;
10274/// # async fn dox() {
10275/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10276///
10277/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10278/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10279/// #     secret,
10280/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10281/// # ).build().await.unwrap();
10282///
10283/// # let client = hyper_util::client::legacy::Client::builder(
10284/// #     hyper_util::rt::TokioExecutor::new()
10285/// # )
10286/// # .build(
10287/// #     hyper_rustls::HttpsConnectorBuilder::new()
10288/// #         .with_native_roots()
10289/// #         .unwrap()
10290/// #         .https_or_http()
10291/// #         .enable_http1()
10292/// #         .build()
10293/// # );
10294/// # let mut hub = CloudComposer::new(client, auth);
10295/// // You can configure optional parameters by calling the respective setters at will, and
10296/// // execute the final call using `doit()`.
10297/// // Values shown here are possibly random and not representative !
10298/// let result = hub.projects().locations_operations_delete("name")
10299///              .doit().await;
10300/// # }
10301/// ```
10302pub struct ProjectLocationOperationDeleteCall<'a, C>
10303where
10304    C: 'a,
10305{
10306    hub: &'a CloudComposer<C>,
10307    _name: String,
10308    _delegate: Option<&'a mut dyn common::Delegate>,
10309    _additional_params: HashMap<String, String>,
10310    _scopes: BTreeSet<String>,
10311}
10312
10313impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
10314
10315impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
10316where
10317    C: common::Connector,
10318{
10319    /// Perform the operation you have build so far.
10320    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
10321        use std::borrow::Cow;
10322        use std::io::{Read, Seek};
10323
10324        use common::{url::Params, ToParts};
10325        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10326
10327        let mut dd = common::DefaultDelegate;
10328        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10329        dlg.begin(common::MethodInfo {
10330            id: "composer.projects.locations.operations.delete",
10331            http_method: hyper::Method::DELETE,
10332        });
10333
10334        for &field in ["alt", "name"].iter() {
10335            if self._additional_params.contains_key(field) {
10336                dlg.finished(false);
10337                return Err(common::Error::FieldClash(field));
10338            }
10339        }
10340
10341        let mut params = Params::with_capacity(3 + self._additional_params.len());
10342        params.push("name", self._name);
10343
10344        params.extend(self._additional_params.iter());
10345
10346        params.push("alt", "json");
10347        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10348        if self._scopes.is_empty() {
10349            self._scopes
10350                .insert(Scope::CloudPlatform.as_ref().to_string());
10351        }
10352
10353        #[allow(clippy::single_element_loop)]
10354        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10355            url = params.uri_replacement(url, param_name, find_this, true);
10356        }
10357        {
10358            let to_remove = ["name"];
10359            params.remove_params(&to_remove);
10360        }
10361
10362        let url = params.parse_with_url(&url);
10363
10364        loop {
10365            let token = match self
10366                .hub
10367                .auth
10368                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10369                .await
10370            {
10371                Ok(token) => token,
10372                Err(e) => match dlg.token(e) {
10373                    Ok(token) => token,
10374                    Err(e) => {
10375                        dlg.finished(false);
10376                        return Err(common::Error::MissingToken(e));
10377                    }
10378                },
10379            };
10380            let mut req_result = {
10381                let client = &self.hub.client;
10382                dlg.pre_request();
10383                let mut req_builder = hyper::Request::builder()
10384                    .method(hyper::Method::DELETE)
10385                    .uri(url.as_str())
10386                    .header(USER_AGENT, self.hub._user_agent.clone());
10387
10388                if let Some(token) = token.as_ref() {
10389                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10390                }
10391
10392                let request = req_builder
10393                    .header(CONTENT_LENGTH, 0_u64)
10394                    .body(common::to_body::<String>(None));
10395
10396                client.request(request.unwrap()).await
10397            };
10398
10399            match req_result {
10400                Err(err) => {
10401                    if let common::Retry::After(d) = dlg.http_error(&err) {
10402                        sleep(d).await;
10403                        continue;
10404                    }
10405                    dlg.finished(false);
10406                    return Err(common::Error::HttpError(err));
10407                }
10408                Ok(res) => {
10409                    let (mut parts, body) = res.into_parts();
10410                    let mut body = common::Body::new(body);
10411                    if !parts.status.is_success() {
10412                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10413                        let error = serde_json::from_str(&common::to_string(&bytes));
10414                        let response = common::to_response(parts, bytes.into());
10415
10416                        if let common::Retry::After(d) =
10417                            dlg.http_failure(&response, error.as_ref().ok())
10418                        {
10419                            sleep(d).await;
10420                            continue;
10421                        }
10422
10423                        dlg.finished(false);
10424
10425                        return Err(match error {
10426                            Ok(value) => common::Error::BadRequest(value),
10427                            _ => common::Error::Failure(response),
10428                        });
10429                    }
10430                    let response = {
10431                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10432                        let encoded = common::to_string(&bytes);
10433                        match serde_json::from_str(&encoded) {
10434                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10435                            Err(error) => {
10436                                dlg.response_json_decode_error(&encoded, &error);
10437                                return Err(common::Error::JsonDecodeError(
10438                                    encoded.to_string(),
10439                                    error,
10440                                ));
10441                            }
10442                        }
10443                    };
10444
10445                    dlg.finished(true);
10446                    return Ok(response);
10447                }
10448            }
10449        }
10450    }
10451
10452    /// The name of the operation resource to be deleted.
10453    ///
10454    /// Sets the *name* path property to the given value.
10455    ///
10456    /// Even though the property as already been set when instantiating this call,
10457    /// we provide this method for API completeness.
10458    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
10459        self._name = new_value.to_string();
10460        self
10461    }
10462    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10463    /// while executing the actual API request.
10464    ///
10465    /// ````text
10466    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10467    /// ````
10468    ///
10469    /// Sets the *delegate* property to the given value.
10470    pub fn delegate(
10471        mut self,
10472        new_value: &'a mut dyn common::Delegate,
10473    ) -> ProjectLocationOperationDeleteCall<'a, C> {
10474        self._delegate = Some(new_value);
10475        self
10476    }
10477
10478    /// Set any additional parameter of the query string used in the request.
10479    /// It should be used to set parameters which are not yet available through their own
10480    /// setters.
10481    ///
10482    /// Please note that this method must not be used to set any of the known parameters
10483    /// which have their own setter method. If done anyway, the request will fail.
10484    ///
10485    /// # Additional Parameters
10486    ///
10487    /// * *$.xgafv* (query-string) - V1 error format.
10488    /// * *access_token* (query-string) - OAuth access token.
10489    /// * *alt* (query-string) - Data format for response.
10490    /// * *callback* (query-string) - JSONP
10491    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10492    /// * *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.
10493    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10494    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10495    /// * *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.
10496    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10497    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10498    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
10499    where
10500        T: AsRef<str>,
10501    {
10502        self._additional_params
10503            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10504        self
10505    }
10506
10507    /// Identifies the authorization scope for the method you are building.
10508    ///
10509    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10510    /// [`Scope::CloudPlatform`].
10511    ///
10512    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10513    /// tokens for more than one scope.
10514    ///
10515    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10516    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10517    /// sufficient, a read-write scope will do as well.
10518    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
10519    where
10520        St: AsRef<str>,
10521    {
10522        self._scopes.insert(String::from(scope.as_ref()));
10523        self
10524    }
10525    /// Identifies the authorization scope(s) for the method you are building.
10526    ///
10527    /// See [`Self::add_scope()`] for details.
10528    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'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) -> ProjectLocationOperationDeleteCall<'a, C> {
10542        self._scopes.clear();
10543        self
10544    }
10545}
10546
10547/// 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.
10548///
10549/// A builder for the *locations.operations.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_composer1 as composer1;
10560/// # async fn dox() {
10561/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10562///
10563/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10564/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10565/// #     secret,
10566/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10567/// # ).build().await.unwrap();
10568///
10569/// # let client = hyper_util::client::legacy::Client::builder(
10570/// #     hyper_util::rt::TokioExecutor::new()
10571/// # )
10572/// # .build(
10573/// #     hyper_rustls::HttpsConnectorBuilder::new()
10574/// #         .with_native_roots()
10575/// #         .unwrap()
10576/// #         .https_or_http()
10577/// #         .enable_http1()
10578/// #         .build()
10579/// # );
10580/// # let mut hub = CloudComposer::new(client, auth);
10581/// // You can configure optional parameters by calling the respective setters at will, and
10582/// // execute the final call using `doit()`.
10583/// // Values shown here are possibly random and not representative !
10584/// let result = hub.projects().locations_operations_get("name")
10585///              .doit().await;
10586/// # }
10587/// ```
10588pub struct ProjectLocationOperationGetCall<'a, C>
10589where
10590    C: 'a,
10591{
10592    hub: &'a CloudComposer<C>,
10593    _name: String,
10594    _delegate: Option<&'a mut dyn common::Delegate>,
10595    _additional_params: HashMap<String, String>,
10596    _scopes: BTreeSet<String>,
10597}
10598
10599impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
10600
10601impl<'a, C> ProjectLocationOperationGetCall<'a, C>
10602where
10603    C: common::Connector,
10604{
10605    /// Perform the operation you have build so far.
10606    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10607        use std::borrow::Cow;
10608        use std::io::{Read, Seek};
10609
10610        use common::{url::Params, ToParts};
10611        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10612
10613        let mut dd = common::DefaultDelegate;
10614        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10615        dlg.begin(common::MethodInfo {
10616            id: "composer.projects.locations.operations.get",
10617            http_method: hyper::Method::GET,
10618        });
10619
10620        for &field in ["alt", "name"].iter() {
10621            if self._additional_params.contains_key(field) {
10622                dlg.finished(false);
10623                return Err(common::Error::FieldClash(field));
10624            }
10625        }
10626
10627        let mut params = Params::with_capacity(3 + self._additional_params.len());
10628        params.push("name", self._name);
10629
10630        params.extend(self._additional_params.iter());
10631
10632        params.push("alt", "json");
10633        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10634        if self._scopes.is_empty() {
10635            self._scopes
10636                .insert(Scope::CloudPlatform.as_ref().to_string());
10637        }
10638
10639        #[allow(clippy::single_element_loop)]
10640        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10641            url = params.uri_replacement(url, param_name, find_this, true);
10642        }
10643        {
10644            let to_remove = ["name"];
10645            params.remove_params(&to_remove);
10646        }
10647
10648        let url = params.parse_with_url(&url);
10649
10650        loop {
10651            let token = match self
10652                .hub
10653                .auth
10654                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10655                .await
10656            {
10657                Ok(token) => token,
10658                Err(e) => match dlg.token(e) {
10659                    Ok(token) => token,
10660                    Err(e) => {
10661                        dlg.finished(false);
10662                        return Err(common::Error::MissingToken(e));
10663                    }
10664                },
10665            };
10666            let mut req_result = {
10667                let client = &self.hub.client;
10668                dlg.pre_request();
10669                let mut req_builder = hyper::Request::builder()
10670                    .method(hyper::Method::GET)
10671                    .uri(url.as_str())
10672                    .header(USER_AGENT, self.hub._user_agent.clone());
10673
10674                if let Some(token) = token.as_ref() {
10675                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10676                }
10677
10678                let request = req_builder
10679                    .header(CONTENT_LENGTH, 0_u64)
10680                    .body(common::to_body::<String>(None));
10681
10682                client.request(request.unwrap()).await
10683            };
10684
10685            match req_result {
10686                Err(err) => {
10687                    if let common::Retry::After(d) = dlg.http_error(&err) {
10688                        sleep(d).await;
10689                        continue;
10690                    }
10691                    dlg.finished(false);
10692                    return Err(common::Error::HttpError(err));
10693                }
10694                Ok(res) => {
10695                    let (mut parts, body) = res.into_parts();
10696                    let mut body = common::Body::new(body);
10697                    if !parts.status.is_success() {
10698                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10699                        let error = serde_json::from_str(&common::to_string(&bytes));
10700                        let response = common::to_response(parts, bytes.into());
10701
10702                        if let common::Retry::After(d) =
10703                            dlg.http_failure(&response, error.as_ref().ok())
10704                        {
10705                            sleep(d).await;
10706                            continue;
10707                        }
10708
10709                        dlg.finished(false);
10710
10711                        return Err(match error {
10712                            Ok(value) => common::Error::BadRequest(value),
10713                            _ => common::Error::Failure(response),
10714                        });
10715                    }
10716                    let response = {
10717                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10718                        let encoded = common::to_string(&bytes);
10719                        match serde_json::from_str(&encoded) {
10720                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10721                            Err(error) => {
10722                                dlg.response_json_decode_error(&encoded, &error);
10723                                return Err(common::Error::JsonDecodeError(
10724                                    encoded.to_string(),
10725                                    error,
10726                                ));
10727                            }
10728                        }
10729                    };
10730
10731                    dlg.finished(true);
10732                    return Ok(response);
10733                }
10734            }
10735        }
10736    }
10737
10738    /// The name of the operation resource.
10739    ///
10740    /// Sets the *name* path property to the given value.
10741    ///
10742    /// Even though the property as already been set when instantiating this call,
10743    /// we provide this method for API completeness.
10744    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
10745        self._name = new_value.to_string();
10746        self
10747    }
10748    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10749    /// while executing the actual API request.
10750    ///
10751    /// ````text
10752    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10753    /// ````
10754    ///
10755    /// Sets the *delegate* property to the given value.
10756    pub fn delegate(
10757        mut self,
10758        new_value: &'a mut dyn common::Delegate,
10759    ) -> ProjectLocationOperationGetCall<'a, C> {
10760        self._delegate = Some(new_value);
10761        self
10762    }
10763
10764    /// Set any additional parameter of the query string used in the request.
10765    /// It should be used to set parameters which are not yet available through their own
10766    /// setters.
10767    ///
10768    /// Please note that this method must not be used to set any of the known parameters
10769    /// which have their own setter method. If done anyway, the request will fail.
10770    ///
10771    /// # Additional Parameters
10772    ///
10773    /// * *$.xgafv* (query-string) - V1 error format.
10774    /// * *access_token* (query-string) - OAuth access token.
10775    /// * *alt* (query-string) - Data format for response.
10776    /// * *callback* (query-string) - JSONP
10777    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10778    /// * *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.
10779    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10780    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10781    /// * *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.
10782    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10783    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10784    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
10785    where
10786        T: AsRef<str>,
10787    {
10788        self._additional_params
10789            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10790        self
10791    }
10792
10793    /// Identifies the authorization scope for the method you are building.
10794    ///
10795    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10796    /// [`Scope::CloudPlatform`].
10797    ///
10798    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10799    /// tokens for more than one scope.
10800    ///
10801    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10802    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10803    /// sufficient, a read-write scope will do as well.
10804    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
10805    where
10806        St: AsRef<str>,
10807    {
10808        self._scopes.insert(String::from(scope.as_ref()));
10809        self
10810    }
10811    /// Identifies the authorization scope(s) for the method you are building.
10812    ///
10813    /// See [`Self::add_scope()`] for details.
10814    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
10815    where
10816        I: IntoIterator<Item = St>,
10817        St: AsRef<str>,
10818    {
10819        self._scopes
10820            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10821        self
10822    }
10823
10824    /// Removes all scopes, and no default scope will be used either.
10825    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10826    /// for details).
10827    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
10828        self._scopes.clear();
10829        self
10830    }
10831}
10832
10833/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
10834///
10835/// A builder for the *locations.operations.list* method supported by a *project* resource.
10836/// It is not used directly, but through a [`ProjectMethods`] instance.
10837///
10838/// # Example
10839///
10840/// Instantiate a resource method builder
10841///
10842/// ```test_harness,no_run
10843/// # extern crate hyper;
10844/// # extern crate hyper_rustls;
10845/// # extern crate google_composer1 as composer1;
10846/// # async fn dox() {
10847/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10848///
10849/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10850/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10851/// #     secret,
10852/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10853/// # ).build().await.unwrap();
10854///
10855/// # let client = hyper_util::client::legacy::Client::builder(
10856/// #     hyper_util::rt::TokioExecutor::new()
10857/// # )
10858/// # .build(
10859/// #     hyper_rustls::HttpsConnectorBuilder::new()
10860/// #         .with_native_roots()
10861/// #         .unwrap()
10862/// #         .https_or_http()
10863/// #         .enable_http1()
10864/// #         .build()
10865/// # );
10866/// # let mut hub = CloudComposer::new(client, auth);
10867/// // You can configure optional parameters by calling the respective setters at will, and
10868/// // execute the final call using `doit()`.
10869/// // Values shown here are possibly random and not representative !
10870/// let result = hub.projects().locations_operations_list("name")
10871///              .page_token("kasd")
10872///              .page_size(-24)
10873///              .filter("sed")
10874///              .doit().await;
10875/// # }
10876/// ```
10877pub struct ProjectLocationOperationListCall<'a, C>
10878where
10879    C: 'a,
10880{
10881    hub: &'a CloudComposer<C>,
10882    _name: String,
10883    _page_token: Option<String>,
10884    _page_size: Option<i32>,
10885    _filter: Option<String>,
10886    _delegate: Option<&'a mut dyn common::Delegate>,
10887    _additional_params: HashMap<String, String>,
10888    _scopes: BTreeSet<String>,
10889}
10890
10891impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
10892
10893impl<'a, C> ProjectLocationOperationListCall<'a, C>
10894where
10895    C: common::Connector,
10896{
10897    /// Perform the operation you have build so far.
10898    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
10899        use std::borrow::Cow;
10900        use std::io::{Read, Seek};
10901
10902        use common::{url::Params, ToParts};
10903        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10904
10905        let mut dd = common::DefaultDelegate;
10906        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10907        dlg.begin(common::MethodInfo {
10908            id: "composer.projects.locations.operations.list",
10909            http_method: hyper::Method::GET,
10910        });
10911
10912        for &field in ["alt", "name", "pageToken", "pageSize", "filter"].iter() {
10913            if self._additional_params.contains_key(field) {
10914                dlg.finished(false);
10915                return Err(common::Error::FieldClash(field));
10916            }
10917        }
10918
10919        let mut params = Params::with_capacity(6 + self._additional_params.len());
10920        params.push("name", self._name);
10921        if let Some(value) = self._page_token.as_ref() {
10922            params.push("pageToken", value);
10923        }
10924        if let Some(value) = self._page_size.as_ref() {
10925            params.push("pageSize", value.to_string());
10926        }
10927        if let Some(value) = self._filter.as_ref() {
10928            params.push("filter", value);
10929        }
10930
10931        params.extend(self._additional_params.iter());
10932
10933        params.push("alt", "json");
10934        let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
10935        if self._scopes.is_empty() {
10936            self._scopes
10937                .insert(Scope::CloudPlatform.as_ref().to_string());
10938        }
10939
10940        #[allow(clippy::single_element_loop)]
10941        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10942            url = params.uri_replacement(url, param_name, find_this, true);
10943        }
10944        {
10945            let to_remove = ["name"];
10946            params.remove_params(&to_remove);
10947        }
10948
10949        let url = params.parse_with_url(&url);
10950
10951        loop {
10952            let token = match self
10953                .hub
10954                .auth
10955                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10956                .await
10957            {
10958                Ok(token) => token,
10959                Err(e) => match dlg.token(e) {
10960                    Ok(token) => token,
10961                    Err(e) => {
10962                        dlg.finished(false);
10963                        return Err(common::Error::MissingToken(e));
10964                    }
10965                },
10966            };
10967            let mut req_result = {
10968                let client = &self.hub.client;
10969                dlg.pre_request();
10970                let mut req_builder = hyper::Request::builder()
10971                    .method(hyper::Method::GET)
10972                    .uri(url.as_str())
10973                    .header(USER_AGENT, self.hub._user_agent.clone());
10974
10975                if let Some(token) = token.as_ref() {
10976                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10977                }
10978
10979                let request = req_builder
10980                    .header(CONTENT_LENGTH, 0_u64)
10981                    .body(common::to_body::<String>(None));
10982
10983                client.request(request.unwrap()).await
10984            };
10985
10986            match req_result {
10987                Err(err) => {
10988                    if let common::Retry::After(d) = dlg.http_error(&err) {
10989                        sleep(d).await;
10990                        continue;
10991                    }
10992                    dlg.finished(false);
10993                    return Err(common::Error::HttpError(err));
10994                }
10995                Ok(res) => {
10996                    let (mut parts, body) = res.into_parts();
10997                    let mut body = common::Body::new(body);
10998                    if !parts.status.is_success() {
10999                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11000                        let error = serde_json::from_str(&common::to_string(&bytes));
11001                        let response = common::to_response(parts, bytes.into());
11002
11003                        if let common::Retry::After(d) =
11004                            dlg.http_failure(&response, error.as_ref().ok())
11005                        {
11006                            sleep(d).await;
11007                            continue;
11008                        }
11009
11010                        dlg.finished(false);
11011
11012                        return Err(match error {
11013                            Ok(value) => common::Error::BadRequest(value),
11014                            _ => common::Error::Failure(response),
11015                        });
11016                    }
11017                    let response = {
11018                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11019                        let encoded = common::to_string(&bytes);
11020                        match serde_json::from_str(&encoded) {
11021                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11022                            Err(error) => {
11023                                dlg.response_json_decode_error(&encoded, &error);
11024                                return Err(common::Error::JsonDecodeError(
11025                                    encoded.to_string(),
11026                                    error,
11027                                ));
11028                            }
11029                        }
11030                    };
11031
11032                    dlg.finished(true);
11033                    return Ok(response);
11034                }
11035            }
11036        }
11037    }
11038
11039    /// The name of the operation's parent resource.
11040    ///
11041    /// Sets the *name* path property to the given value.
11042    ///
11043    /// Even though the property as already been set when instantiating this call,
11044    /// we provide this method for API completeness.
11045    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11046        self._name = new_value.to_string();
11047        self
11048    }
11049    /// The standard list page token.
11050    ///
11051    /// Sets the *page token* query property to the given value.
11052    pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11053        self._page_token = Some(new_value.to_string());
11054        self
11055    }
11056    /// The standard list page size.
11057    ///
11058    /// Sets the *page size* query property to the given value.
11059    pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
11060        self._page_size = Some(new_value);
11061        self
11062    }
11063    /// The standard list filter.
11064    ///
11065    /// Sets the *filter* query property to the given value.
11066    pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11067        self._filter = Some(new_value.to_string());
11068        self
11069    }
11070    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11071    /// while executing the actual API request.
11072    ///
11073    /// ````text
11074    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11075    /// ````
11076    ///
11077    /// Sets the *delegate* property to the given value.
11078    pub fn delegate(
11079        mut self,
11080        new_value: &'a mut dyn common::Delegate,
11081    ) -> ProjectLocationOperationListCall<'a, C> {
11082        self._delegate = Some(new_value);
11083        self
11084    }
11085
11086    /// Set any additional parameter of the query string used in the request.
11087    /// It should be used to set parameters which are not yet available through their own
11088    /// setters.
11089    ///
11090    /// Please note that this method must not be used to set any of the known parameters
11091    /// which have their own setter method. If done anyway, the request will fail.
11092    ///
11093    /// # Additional Parameters
11094    ///
11095    /// * *$.xgafv* (query-string) - V1 error format.
11096    /// * *access_token* (query-string) - OAuth access token.
11097    /// * *alt* (query-string) - Data format for response.
11098    /// * *callback* (query-string) - JSONP
11099    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11100    /// * *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.
11101    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11102    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11103    /// * *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.
11104    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11105    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11106    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
11107    where
11108        T: AsRef<str>,
11109    {
11110        self._additional_params
11111            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11112        self
11113    }
11114
11115    /// Identifies the authorization scope for the method you are building.
11116    ///
11117    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11118    /// [`Scope::CloudPlatform`].
11119    ///
11120    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11121    /// tokens for more than one scope.
11122    ///
11123    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11124    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11125    /// sufficient, a read-write scope will do as well.
11126    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
11127    where
11128        St: AsRef<str>,
11129    {
11130        self._scopes.insert(String::from(scope.as_ref()));
11131        self
11132    }
11133    /// Identifies the authorization scope(s) for the method you are building.
11134    ///
11135    /// See [`Self::add_scope()`] for details.
11136    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
11137    where
11138        I: IntoIterator<Item = St>,
11139        St: AsRef<str>,
11140    {
11141        self._scopes
11142            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11143        self
11144    }
11145
11146    /// Removes all scopes, and no default scope will be used either.
11147    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11148    /// for details).
11149    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
11150        self._scopes.clear();
11151        self
11152    }
11153}