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 connector = hyper_rustls::HttpsConnectorBuilder::new()
63/// .with_native_roots()
64/// .unwrap()
65/// .https_only()
66/// .enable_http2()
67/// .build();
68///
69/// let executor = hyper_util::rt::TokioExecutor::new();
70/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
71/// secret,
72/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
73/// yup_oauth2::client::CustomHyperClientBuilder::from(
74/// hyper_util::client::legacy::Client::builder(executor).build(connector),
75/// ),
76/// ).build().await.unwrap();
77///
78/// let client = hyper_util::client::legacy::Client::builder(
79/// hyper_util::rt::TokioExecutor::new()
80/// )
81/// .build(
82/// hyper_rustls::HttpsConnectorBuilder::new()
83/// .with_native_roots()
84/// .unwrap()
85/// .https_or_http()
86/// .enable_http2()
87/// .build()
88/// );
89/// let mut hub = CloudComposer::new(client, auth);
90/// // As the method needs a request, you would usually fill it with the desired information
91/// // into the respective structure. Some of the parts shown here might not be applicable !
92/// // Values shown here are possibly random and not representative !
93/// let mut req = Environment::default();
94///
95/// // You can configure optional parameters by calling the respective setters at will, and
96/// // execute the final call using `doit()`.
97/// // Values shown here are possibly random and not representative !
98/// let result = hub.projects().locations_environments_patch(req, "name")
99/// .update_mask(FieldMask::new::<&str>(&[]))
100/// .doit().await;
101///
102/// match result {
103/// Err(e) => match e {
104/// // The Error enum provides details about what exactly happened.
105/// // You can also just use its `Debug`, `Display` or `Error` traits
106/// Error::HttpError(_)
107/// |Error::Io(_)
108/// |Error::MissingAPIKey
109/// |Error::MissingToken(_)
110/// |Error::Cancelled
111/// |Error::UploadSizeLimitExceeded(_, _)
112/// |Error::Failure(_)
113/// |Error::BadRequest(_)
114/// |Error::FieldClash(_)
115/// |Error::JsonDecodeError(_, _) => println!("{}", e),
116/// },
117/// Ok(res) => println!("Success: {:?}", res),
118/// }
119/// # }
120/// ```
121#[derive(Clone)]
122pub struct CloudComposer<C> {
123 pub client: common::Client<C>,
124 pub auth: Box<dyn common::GetToken>,
125 _user_agent: String,
126 _base_url: String,
127 _root_url: String,
128}
129
130impl<C> common::Hub for CloudComposer<C> {}
131
132impl<'a, C> CloudComposer<C> {
133 pub fn new<A: 'static + common::GetToken>(
134 client: common::Client<C>,
135 auth: A,
136 ) -> CloudComposer<C> {
137 CloudComposer {
138 client,
139 auth: Box::new(auth),
140 _user_agent: "google-api-rust-client/7.0.0".to_string(),
141 _base_url: "https://composer.googleapis.com/".to_string(),
142 _root_url: "https://composer.googleapis.com/".to_string(),
143 }
144 }
145
146 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
147 ProjectMethods { hub: self }
148 }
149
150 /// Set the user-agent header field to use in all requests to the server.
151 /// It defaults to `google-api-rust-client/7.0.0`.
152 ///
153 /// Returns the previously set user-agent.
154 pub fn user_agent(&mut self, agent_name: String) -> String {
155 std::mem::replace(&mut self._user_agent, agent_name)
156 }
157
158 /// Set the base url to use in all requests to the server.
159 /// It defaults to `https://composer.googleapis.com/`.
160 ///
161 /// Returns the previously set base url.
162 pub fn base_url(&mut self, new_base_url: String) -> String {
163 std::mem::replace(&mut self._base_url, new_base_url)
164 }
165
166 /// Set the root url to use in all requests to the server.
167 /// It defaults to `https://composer.googleapis.com/`.
168 ///
169 /// Returns the previously set root url.
170 pub fn root_url(&mut self, new_root_url: String) -> String {
171 std::mem::replace(&mut self._root_url, new_root_url)
172 }
173}
174
175// ############
176// SCHEMAS ###
177// ##########
178/// The policy for airflow metadata database retention.
179///
180/// This type is not used in any activity, and only used as *part* of another schema.
181///
182#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
183#[serde_with::serde_as]
184#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
185pub struct AirflowMetadataRetentionPolicyConfig {
186 /// Optional. How many days data should be retained for.
187 #[serde(rename = "retentionDays")]
188 pub retention_days: Option<i32>,
189 /// Optional. Retention can be either enabled or disabled.
190 #[serde(rename = "retentionMode")]
191 pub retention_mode: Option<String>,
192}
193
194impl common::Part for AirflowMetadataRetentionPolicyConfig {}
195
196/// Allowed IP range with user-provided description.
197///
198/// This type is not used in any activity, and only used as *part* of another schema.
199///
200#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
201#[serde_with::serde_as]
202#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
203pub struct AllowedIpRange {
204 /// Optional. User-provided description. It must contain at most 300 characters.
205 pub description: Option<String>,
206 /// 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`.
207 pub value: Option<String>,
208}
209
210impl common::Part for AllowedIpRange {}
211
212/// Request to check whether image upgrade will succeed.
213///
214/// # Activities
215///
216/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
217/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
218///
219/// * [locations environments check upgrade projects](ProjectLocationEnvironmentCheckUpgradeCall) (request)
220#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
221#[serde_with::serde_as]
222#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
223pub struct CheckUpgradeRequest {
224 /// 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).
225 #[serde(rename = "imageVersion")]
226 pub image_version: Option<String>,
227}
228
229impl common::RequestValue for CheckUpgradeRequest {}
230
231/// CIDR block with an optional name.
232///
233/// This type is not used in any activity, and only used as *part* of another schema.
234///
235#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
236#[serde_with::serde_as]
237#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
238pub struct CidrBlock {
239 /// CIDR block that must be specified in CIDR notation.
240 #[serde(rename = "cidrBlock")]
241 pub cidr_block: Option<String>,
242 /// User-defined name that identifies the CIDR block.
243 #[serde(rename = "displayName")]
244 pub display_name: Option<String>,
245}
246
247impl common::Part for CidrBlock {}
248
249/// Configuration for Cloud Data Lineage integration.
250///
251/// This type is not used in any activity, and only used as *part* of another schema.
252///
253#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
254#[serde_with::serde_as]
255#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
256pub struct CloudDataLineageIntegration {
257 /// Optional. Whether or not Cloud Data Lineage integration is enabled.
258 pub enabled: Option<bool>,
259}
260
261impl common::Part for CloudDataLineageIntegration {}
262
263/// Information about a single workload.
264///
265/// This type is not used in any activity, and only used as *part* of another schema.
266///
267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
268#[serde_with::serde_as]
269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
270pub struct ComposerWorkload {
271 /// Name of a workload.
272 pub name: Option<String>,
273 /// Output only. Status of a workload.
274 pub status: Option<ComposerWorkloadStatus>,
275 /// Type of a workload.
276 #[serde(rename = "type")]
277 pub type_: Option<String>,
278}
279
280impl common::Part for ComposerWorkload {}
281
282/// Workload status.
283///
284/// This type is not used in any activity, and only used as *part* of another schema.
285///
286#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
287#[serde_with::serde_as]
288#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
289pub struct ComposerWorkloadStatus {
290 /// Output only. Detailed message of the status.
291 #[serde(rename = "detailedStatusMessage")]
292 pub detailed_status_message: Option<String>,
293 /// Output only. Workload state.
294 pub state: Option<String>,
295 /// Output only. Text to provide more descriptive status.
296 #[serde(rename = "statusMessage")]
297 pub status_message: Option<String>,
298}
299
300impl common::Part for ComposerWorkloadStatus {}
301
302/// Configuration for resources used by Airflow DAG processors. This field is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
303///
304/// This type is not used in any activity, and only used as *part* of another schema.
305///
306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
307#[serde_with::serde_as]
308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
309pub struct DagProcessorResource {
310 /// Optional. The number of DAG processors. If not provided or set to 0, a single DAG processor instance will be created.
311 pub count: Option<i32>,
312 /// Optional. CPU request and limit for a single Airflow DAG processor replica.
313 pub cpu: Option<f32>,
314 /// Optional. Memory (GB) request and limit for a single Airflow DAG processor replica.
315 #[serde(rename = "memoryGb")]
316 pub memory_gb: Option<f32>,
317 /// Optional. Storage (GB) request and limit for a single Airflow DAG processor replica.
318 #[serde(rename = "storageGb")]
319 pub storage_gb: Option<f32>,
320}
321
322impl common::Part for DagProcessorResource {}
323
324/// The configuration setting for Airflow database data retention mechanism.
325///
326/// This type is not used in any activity, and only used as *part* of another schema.
327///
328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
329#[serde_with::serde_as]
330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
331pub struct DataRetentionConfig {
332 /// Optional. The retention policy for airflow metadata database.
333 #[serde(rename = "airflowMetadataRetentionConfig")]
334 pub airflow_metadata_retention_config: Option<AirflowMetadataRetentionPolicyConfig>,
335 /// Optional. The configuration settings for task logs retention
336 #[serde(rename = "taskLogsRetentionConfig")]
337 pub task_logs_retention_config: Option<TaskLogsRetentionConfig>,
338}
339
340impl common::Part for DataRetentionConfig {}
341
342/// The configuration of Cloud SQL instance that is used by the Apache Airflow software.
343///
344/// This type is not used in any activity, and only used as *part* of another schema.
345///
346#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
347#[serde_with::serde_as]
348#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
349pub struct DatabaseConfig {
350 /// 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-*.*.*.
351 #[serde(rename = "machineType")]
352 pub machine_type: Option<String>,
353 /// 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-*.*.*.
354 pub zone: Option<String>,
355}
356
357impl common::Part for DatabaseConfig {}
358
359/// Request to trigger database failover (only for highly resilient environments).
360///
361/// # Activities
362///
363/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
364/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
365///
366/// * [locations environments database failover projects](ProjectLocationEnvironmentDatabaseFailoverCall) (request)
367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
368#[serde_with::serde_as]
369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
370pub struct DatabaseFailoverRequest {
371 _never_set: Option<bool>,
372}
373
374impl common::RequestValue for DatabaseFailoverRequest {}
375
376/// 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
377///
378/// This type is not used in any activity, and only used as *part* of another schema.
379///
380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
381#[serde_with::serde_as]
382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
383pub struct Date {
384 /// 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.
385 pub day: Option<i32>,
386 /// Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
387 pub month: Option<i32>,
388 /// Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
389 pub year: Option<i32>,
390}
391
392impl common::Part for Date {}
393
394/// 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); }
395///
396/// # Activities
397///
398/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
399/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
400///
401/// * [locations environments user workloads config maps delete projects](ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall) (response)
402/// * [locations environments user workloads secrets delete projects](ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall) (response)
403/// * [locations operations delete projects](ProjectLocationOperationDeleteCall) (response)
404#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
405#[serde_with::serde_as]
406#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
407pub struct Empty {
408 _never_set: Option<bool>,
409}
410
411impl common::ResponseResult for Empty {}
412
413/// The encryption options for the Cloud Composer environment and its dependencies.Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.
414///
415/// This type is not used in any activity, and only used as *part* of another schema.
416///
417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
418#[serde_with::serde_as]
419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
420pub struct EncryptionConfig {
421 /// Optional. Customer-managed Encryption Key available through Google's Key Management Service. Cannot be updated. If not specified, Google-managed key will be used.
422 #[serde(rename = "kmsKeyName")]
423 pub kms_key_name: Option<String>,
424}
425
426impl common::Part for EncryptionConfig {}
427
428/// An environment for running orchestration tasks.
429///
430/// # Activities
431///
432/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
433/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
434///
435/// * [locations environments create projects](ProjectLocationEnvironmentCreateCall) (request)
436/// * [locations environments get projects](ProjectLocationEnvironmentGetCall) (response)
437/// * [locations environments patch projects](ProjectLocationEnvironmentPatchCall) (request)
438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
439#[serde_with::serde_as]
440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
441pub struct Environment {
442 /// Optional. Configuration parameters for this environment.
443 pub config: Option<EnvironmentConfig>,
444 /// Output only. The time at which this environment was created.
445 #[serde(rename = "createTime")]
446 pub create_time: Option<chrono::DateTime<chrono::offset::Utc>>,
447 /// 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.
448 pub labels: Option<HashMap<String, String>>,
449 /// Identifier. 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.
450 pub name: Option<String>,
451 /// Output only. Reserved for future use.
452 #[serde(rename = "satisfiesPzi")]
453 pub satisfies_pzi: Option<bool>,
454 /// Output only. Reserved for future use.
455 #[serde(rename = "satisfiesPzs")]
456 pub satisfies_pzs: Option<bool>,
457 /// The current state of the environment.
458 pub state: Option<String>,
459 /// Optional. Storage configuration for this environment.
460 #[serde(rename = "storageConfig")]
461 pub storage_config: Option<StorageConfig>,
462 /// Output only. The time at which this environment was last modified.
463 #[serde(rename = "updateTime")]
464 pub update_time: Option<chrono::DateTime<chrono::offset::Utc>>,
465 /// Output only. The UUID (Universally Unique IDentifier) associated with this environment. This value is generated when the environment is created.
466 pub uuid: Option<String>,
467}
468
469impl common::RequestValue for Environment {}
470impl common::ResponseResult for Environment {}
471
472/// Configuration information for an environment.
473///
474/// This type is not used in any activity, and only used as *part* of another schema.
475///
476#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
477#[serde_with::serde_as]
478#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
479pub struct EnvironmentConfig {
480 /// 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)).
481 #[serde(rename = "airflowByoidUri")]
482 pub airflow_byoid_uri: Option<String>,
483 /// 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)).
484 #[serde(rename = "airflowUri")]
485 pub airflow_uri: Option<String>,
486 /// 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.
487 #[serde(rename = "dagGcsPrefix")]
488 pub dag_gcs_prefix: Option<String>,
489 /// Optional. The configuration setting for Airflow database data retention mechanism.
490 #[serde(rename = "dataRetentionConfig")]
491 pub data_retention_config: Option<DataRetentionConfig>,
492 /// Optional. The configuration settings for Cloud SQL instance used internally by Apache Airflow software.
493 #[serde(rename = "databaseConfig")]
494 pub database_config: Option<DatabaseConfig>,
495 /// Optional. The encryption options for the Cloud Composer environment and its dependencies. Cannot be updated.
496 #[serde(rename = "encryptionConfig")]
497 pub encryption_config: Option<EncryptionConfig>,
498 /// Optional. The size of the Cloud Composer environment. This field is supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
499 #[serde(rename = "environmentSize")]
500 pub environment_size: Option<String>,
501 /// Output only. The Kubernetes Engine cluster used to run this environment.
502 #[serde(rename = "gkeCluster")]
503 pub gke_cluster: Option<String>,
504 /// 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.
505 #[serde(rename = "maintenanceWindow")]
506 pub maintenance_window: Option<MaintenanceWindow>,
507 /// 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.
508 #[serde(rename = "masterAuthorizedNetworksConfig")]
509 pub master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
510 /// Optional. The configuration used for the Kubernetes Engine cluster.
511 #[serde(rename = "nodeConfig")]
512 pub node_config: Option<NodeConfig>,
513 /// 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-*.*.*.
514 #[serde(rename = "nodeCount")]
515 pub node_count: Option<i32>,
516 /// Optional. The configuration used for the Private IP Cloud Composer environment.
517 #[serde(rename = "privateEnvironmentConfig")]
518 pub private_environment_config: Option<PrivateEnvironmentConfig>,
519 /// Optional. The Recovery settings configuration of an environment. This field is supported for Cloud Composer environments in versions composer-2.*.*-airflow-*.*.* and newer.
520 #[serde(rename = "recoveryConfig")]
521 pub recovery_config: Option<RecoveryConfig>,
522 /// 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.
523 #[serde(rename = "resilienceMode")]
524 pub resilience_mode: Option<String>,
525 /// Optional. The configuration settings for software inside the environment.
526 #[serde(rename = "softwareConfig")]
527 pub software_config: Option<SoftwareConfig>,
528 /// Optional. The configuration settings for the Airflow web server App Engine instance.
529 #[serde(rename = "webServerConfig")]
530 pub web_server_config: Option<WebServerConfig>,
531 /// Optional. The network-level access control policy for the Airflow web server. If unspecified, no network-level access restrictions will be applied.
532 #[serde(rename = "webServerNetworkAccessControl")]
533 pub web_server_network_access_control: Option<WebServerNetworkAccessControl>,
534 /// 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.
535 #[serde(rename = "workloadsConfig")]
536 pub workloads_config: Option<WorkloadsConfig>,
537}
538
539impl common::Part for EnvironmentConfig {}
540
541/// Execute Airflow Command request.
542///
543/// # Activities
544///
545/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
546/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
547///
548/// * [locations environments execute airflow command projects](ProjectLocationEnvironmentExecuteAirflowCommandCall) (request)
549#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
550#[serde_with::serde_as]
551#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
552pub struct ExecuteAirflowCommandRequest {
553 /// Airflow command.
554 pub command: Option<String>,
555 /// 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"]`.
556 pub parameters: Option<Vec<String>>,
557 /// Airflow subcommand.
558 pub subcommand: Option<String>,
559}
560
561impl common::RequestValue for ExecuteAirflowCommandRequest {}
562
563/// Response to ExecuteAirflowCommandRequest.
564///
565/// # Activities
566///
567/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
568/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
569///
570/// * [locations environments execute airflow command projects](ProjectLocationEnvironmentExecuteAirflowCommandCall) (response)
571#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
572#[serde_with::serde_as]
573#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
574pub struct ExecuteAirflowCommandResponse {
575 /// Error message. Empty if there was no error.
576 pub error: Option<String>,
577 /// The unique ID of the command execution for polling.
578 #[serde(rename = "executionId")]
579 pub execution_id: Option<String>,
580 /// The name of the pod where the command is executed.
581 pub pod: Option<String>,
582 /// The namespace of the pod where the command is executed.
583 #[serde(rename = "podNamespace")]
584 pub pod_namespace: Option<String>,
585}
586
587impl common::ResponseResult for ExecuteAirflowCommandResponse {}
588
589/// Information about how a command ended.
590///
591/// This type is not used in any activity, and only used as *part* of another schema.
592///
593#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
594#[serde_with::serde_as]
595#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
596pub struct ExitInfo {
597 /// Error message. Empty if there was no error.
598 pub error: Option<String>,
599 /// The exit code from the command execution.
600 #[serde(rename = "exitCode")]
601 pub exit_code: Option<i32>,
602}
603
604impl common::Part for ExitInfo {}
605
606/// Response for FetchDatabasePropertiesRequest.
607///
608/// # Activities
609///
610/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
611/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
612///
613/// * [locations environments fetch database properties projects](ProjectLocationEnvironmentFetchDatabasePropertyCall) (response)
614#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
615#[serde_with::serde_as]
616#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
617pub struct FetchDatabasePropertiesResponse {
618 /// 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.
619 #[serde(rename = "isFailoverReplicaAvailable")]
620 pub is_failover_replica_available: Option<bool>,
621 /// The Compute Engine zone that the instance is currently serving from.
622 #[serde(rename = "primaryGceZone")]
623 pub primary_gce_zone: Option<String>,
624 /// The Compute Engine zone that the failover instance is currently serving from for a regional Cloud SQL instance.
625 #[serde(rename = "secondaryGceZone")]
626 pub secondary_gce_zone: Option<String>,
627}
628
629impl common::ResponseResult for FetchDatabasePropertiesResponse {}
630
631/// Configuration for controlling how IPs are allocated in the GKE cluster running the Apache Airflow software.
632///
633/// This type is not used in any activity, and only used as *part* of another schema.
634///
635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
636#[serde_with::serde_as]
637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
638pub struct IPAllocationPolicy {
639 /// 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.
640 #[serde(rename = "clusterIpv4CidrBlock")]
641 pub cluster_ipv4_cidr_block: Option<String>,
642 /// 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.
643 #[serde(rename = "clusterSecondaryRangeName")]
644 pub cluster_secondary_range_name: Option<String>,
645 /// 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.
646 #[serde(rename = "servicesIpv4CidrBlock")]
647 pub services_ipv4_cidr_block: Option<String>,
648 /// 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.
649 #[serde(rename = "servicesSecondaryRangeName")]
650 pub services_secondary_range_name: Option<String>,
651 /// 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.
652 #[serde(rename = "useIpAliases")]
653 pub use_ip_aliases: Option<bool>,
654}
655
656impl common::Part for IPAllocationPolicy {}
657
658/// ImageVersion information
659///
660/// This type is not used in any activity, and only used as *part* of another schema.
661///
662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
663#[serde_with::serde_as]
664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
665pub struct ImageVersion {
666 /// Whether it is impossible to create an environment with the image version.
667 #[serde(rename = "creationDisabled")]
668 pub creation_disabled: Option<bool>,
669 /// The string identifier of the ImageVersion, in the form: "composer-x.y.z-airflow-a.b.c"
670 #[serde(rename = "imageVersionId")]
671 pub image_version_id: Option<String>,
672 /// Whether this is the default ImageVersion used by Composer during environment creation if no input ImageVersion is specified.
673 #[serde(rename = "isDefault")]
674 pub is_default: Option<bool>,
675 /// The date of the version release.
676 #[serde(rename = "releaseDate")]
677 pub release_date: Option<Date>,
678 /// supported python versions
679 #[serde(rename = "supportedPythonVersions")]
680 pub supported_python_versions: Option<Vec<String>>,
681 /// Whether it is impossible to upgrade an environment running with the image version.
682 #[serde(rename = "upgradeDisabled")]
683 pub upgrade_disabled: Option<bool>,
684}
685
686impl common::Part for ImageVersion {}
687
688/// Contains information about a single line from logs.
689///
690/// This type is not used in any activity, and only used as *part* of another schema.
691///
692#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
693#[serde_with::serde_as]
694#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
695pub struct Line {
696 /// Text content of the log line.
697 pub content: Option<String>,
698 /// Number of the line.
699 #[serde(rename = "lineNumber")]
700 pub line_number: Option<i32>,
701}
702
703impl common::Part for Line {}
704
705/// The environments in a project and location.
706///
707/// # Activities
708///
709/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
710/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
711///
712/// * [locations environments list projects](ProjectLocationEnvironmentListCall) (response)
713#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
714#[serde_with::serde_as]
715#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
716pub struct ListEnvironmentsResponse {
717 /// The list of environments returned by a ListEnvironmentsRequest.
718 pub environments: Option<Vec<Environment>>,
719 /// The page token used to query for the next page if one exists.
720 #[serde(rename = "nextPageToken")]
721 pub next_page_token: Option<String>,
722}
723
724impl common::ResponseResult for ListEnvironmentsResponse {}
725
726/// The ImageVersions in a project and location.
727///
728/// # Activities
729///
730/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
731/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
732///
733/// * [locations image versions list projects](ProjectLocationImageVersionListCall) (response)
734#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
735#[serde_with::serde_as]
736#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
737pub struct ListImageVersionsResponse {
738 /// The list of supported ImageVersions in a location.
739 #[serde(rename = "imageVersions")]
740 pub image_versions: Option<Vec<ImageVersion>>,
741 /// The page token used to query for the next page if one exists.
742 #[serde(rename = "nextPageToken")]
743 pub next_page_token: Option<String>,
744}
745
746impl common::ResponseResult for ListImageVersionsResponse {}
747
748/// The response message for Operations.ListOperations.
749///
750/// # Activities
751///
752/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
753/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
754///
755/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
757#[serde_with::serde_as]
758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
759pub struct ListOperationsResponse {
760 /// The standard List next-page token.
761 #[serde(rename = "nextPageToken")]
762 pub next_page_token: Option<String>,
763 /// A list of operations that matches the specified filter in the request.
764 pub operations: Option<Vec<Operation>>,
765 /// Unordered list. Unreachable resources. Populated when the request sets `ListOperationsRequest.return_partial_success` and reads across collections. For example, when attempting to list all resources across all supported locations.
766 pub unreachable: Option<Vec<String>>,
767}
768
769impl common::ResponseResult for ListOperationsResponse {}
770
771/// The user workloads ConfigMaps for a given environment.
772///
773/// # Activities
774///
775/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
776/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
777///
778/// * [locations environments user workloads config maps list projects](ProjectLocationEnvironmentUserWorkloadsConfigMapListCall) (response)
779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
780#[serde_with::serde_as]
781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
782pub struct ListUserWorkloadsConfigMapsResponse {
783 /// The page token used to query for the next page if one exists.
784 #[serde(rename = "nextPageToken")]
785 pub next_page_token: Option<String>,
786 /// The list of ConfigMaps returned by a ListUserWorkloadsConfigMapsRequest.
787 #[serde(rename = "userWorkloadsConfigMaps")]
788 pub user_workloads_config_maps: Option<Vec<UserWorkloadsConfigMap>>,
789}
790
791impl common::ResponseResult for ListUserWorkloadsConfigMapsResponse {}
792
793/// The user workloads Secrets for a given environment.
794///
795/// # Activities
796///
797/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
798/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
799///
800/// * [locations environments user workloads secrets list projects](ProjectLocationEnvironmentUserWorkloadsSecretListCall) (response)
801#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
802#[serde_with::serde_as]
803#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
804pub struct ListUserWorkloadsSecretsResponse {
805 /// The page token used to query for the next page if one exists.
806 #[serde(rename = "nextPageToken")]
807 pub next_page_token: Option<String>,
808 /// The list of Secrets returned by a ListUserWorkloadsSecretsRequest.
809 #[serde(rename = "userWorkloadsSecrets")]
810 pub user_workloads_secrets: Option<Vec<UserWorkloadsSecret>>,
811}
812
813impl common::ResponseResult for ListUserWorkloadsSecretsResponse {}
814
815/// Response to ListWorkloadsRequest.
816///
817/// # Activities
818///
819/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
820/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
821///
822/// * [locations environments workloads list projects](ProjectLocationEnvironmentWorkloadListCall) (response)
823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
824#[serde_with::serde_as]
825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
826pub struct ListWorkloadsResponse {
827 /// The page token used to query for the next page if one exists.
828 #[serde(rename = "nextPageToken")]
829 pub next_page_token: Option<String>,
830 /// The list of environment workloads.
831 pub workloads: Option<Vec<ComposerWorkload>>,
832}
833
834impl common::ResponseResult for ListWorkloadsResponse {}
835
836/// Request to load a snapshot into a Cloud Composer environment.
837///
838/// # Activities
839///
840/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
841/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
842///
843/// * [locations environments load snapshot projects](ProjectLocationEnvironmentLoadSnapshotCall) (request)
844#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
845#[serde_with::serde_as]
846#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
847pub struct LoadSnapshotRequest {
848 /// Whether or not to skip setting Airflow overrides when loading the environment's state.
849 #[serde(rename = "skipAirflowOverridesSetting")]
850 pub skip_airflow_overrides_setting: Option<bool>,
851 /// Whether or not to skip setting environment variables when loading the environment's state.
852 #[serde(rename = "skipEnvironmentVariablesSetting")]
853 pub skip_environment_variables_setting: Option<bool>,
854 /// Whether or not to skip copying Cloud Storage data when loading the environment's state.
855 #[serde(rename = "skipGcsDataCopying")]
856 pub skip_gcs_data_copying: Option<bool>,
857 /// Whether or not to skip installing Pypi packages when loading the environment's state.
858 #[serde(rename = "skipPypiPackagesInstallation")]
859 pub skip_pypi_packages_installation: Option<bool>,
860 /// A Cloud Storage path to a snapshot to load, e.g.: "gs://my-bucket/snapshots/project_location_environment_timestamp".
861 #[serde(rename = "snapshotPath")]
862 pub snapshot_path: Option<String>,
863}
864
865impl common::RequestValue for LoadSnapshotRequest {}
866
867/// 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.
868///
869/// This type is not used in any activity, and only used as *part* of another schema.
870///
871#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
872#[serde_with::serde_as]
873#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
874pub struct MaintenanceWindow {
875 /// 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`.
876 #[serde(rename = "endTime")]
877 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
878 /// 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`.
879 pub recurrence: Option<String>,
880 /// Required. Start time of the first recurrence of the maintenance window.
881 #[serde(rename = "startTime")]
882 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
883}
884
885impl common::Part for MaintenanceWindow {}
886
887/// 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.
888///
889/// This type is not used in any activity, and only used as *part* of another schema.
890///
891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
892#[serde_with::serde_as]
893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
894pub struct MasterAuthorizedNetworksConfig {
895 /// Up to 50 external networks that could access Kubernetes master through HTTPS.
896 #[serde(rename = "cidrBlocks")]
897 pub cidr_blocks: Option<Vec<CidrBlock>>,
898 /// Optional. Whether or not master authorized networks feature is enabled.
899 pub enabled: Option<bool>,
900}
901
902impl common::Part for MasterAuthorizedNetworksConfig {}
903
904/// Configuration options for networking connections in the Composer 2 environment.
905///
906/// This type is not used in any activity, and only used as *part* of another schema.
907///
908#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
909#[serde_with::serde_as]
910#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
911pub struct NetworkingConfig {
912 /// Optional. Indicates the user requested specific connection type between Tenant and Customer projects. You cannot set networking connection type in public IP environment.
913 #[serde(rename = "connectionType")]
914 pub connection_type: Option<String>,
915}
916
917impl common::Part for NetworkingConfig {}
918
919/// The configuration information for the Kubernetes Engine nodes running the Apache Airflow software.
920///
921/// This type is not used in any activity, and only used as *part* of another schema.
922///
923#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
924#[serde_with::serde_as]
925#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
926pub struct NodeConfig {
927 /// 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-*.*.*-build.* and newer.
928 #[serde(rename = "composerInternalIpv4CidrBlock")]
929 pub composer_internal_ipv4_cidr_block: Option<String>,
930 /// 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-*.*.*-build.* and newer.
931 #[serde(rename = "composerNetworkAttachment")]
932 pub composer_network_attachment: Option<String>,
933 /// 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-*.*.*.
934 #[serde(rename = "diskSizeGb")]
935 pub disk_size_gb: Option<i32>,
936 /// 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
937 #[serde(rename = "enableIpMasqAgent")]
938 pub enable_ip_masq_agent: Option<bool>,
939 /// Optional. The configuration for controlling how IPs are allocated in the GKE cluster.
940 #[serde(rename = "ipAllocationPolicy")]
941 pub ip_allocation_policy: Option<IPAllocationPolicy>,
942 /// 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-*.*.\*.
943 pub location: Option<String>,
944 /// 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-*.*.\*.
945 #[serde(rename = "machineType")]
946 pub machine_type: Option<String>,
947 /// 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`.
948 pub network: Option<String>,
949 /// 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-*.*.*.
950 #[serde(rename = "oauthScopes")]
951 pub oauth_scopes: Option<Vec<String>>,
952 /// 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.
953 #[serde(rename = "serviceAccount")]
954 pub service_account: Option<String>,
955 /// 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.
956 pub subnetwork: Option<String>,
957 /// 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.
958 pub tags: Option<Vec<String>>,
959}
960
961impl common::Part for NodeConfig {}
962
963/// This resource represents a long-running operation that is the result of a network API call.
964///
965/// # Activities
966///
967/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
968/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
969///
970/// * [locations environments check upgrade projects](ProjectLocationEnvironmentCheckUpgradeCall) (response)
971/// * [locations environments create projects](ProjectLocationEnvironmentCreateCall) (response)
972/// * [locations environments database failover projects](ProjectLocationEnvironmentDatabaseFailoverCall) (response)
973/// * [locations environments delete projects](ProjectLocationEnvironmentDeleteCall) (response)
974/// * [locations environments load snapshot projects](ProjectLocationEnvironmentLoadSnapshotCall) (response)
975/// * [locations environments patch projects](ProjectLocationEnvironmentPatchCall) (response)
976/// * [locations environments restart web server projects](ProjectLocationEnvironmentRestartWebServerCall) (response)
977/// * [locations environments save snapshot projects](ProjectLocationEnvironmentSaveSnapshotCall) (response)
978/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
979#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
980#[serde_with::serde_as]
981#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
982pub struct Operation {
983 /// 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.
984 pub done: Option<bool>,
985 /// The error result of the operation in case of failure or cancellation.
986 pub error: Option<Status>,
987 /// 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.
988 pub metadata: Option<HashMap<String, serde_json::Value>>,
989 /// 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}`.
990 pub name: Option<String>,
991 /// 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`.
992 pub response: Option<HashMap<String, serde_json::Value>>,
993}
994
995impl common::ResponseResult for Operation {}
996
997/// Poll Airflow Command request.
998///
999/// # Activities
1000///
1001/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1002/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1003///
1004/// * [locations environments poll airflow command projects](ProjectLocationEnvironmentPollAirflowCommandCall) (request)
1005#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1006#[serde_with::serde_as]
1007#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1008pub struct PollAirflowCommandRequest {
1009 /// The unique ID of the command execution.
1010 #[serde(rename = "executionId")]
1011 pub execution_id: Option<String>,
1012 /// Line number from which new logs should be fetched.
1013 #[serde(rename = "nextLineNumber")]
1014 pub next_line_number: Option<i32>,
1015 /// The name of the pod where the command is executed.
1016 pub pod: Option<String>,
1017 /// The namespace of the pod where the command is executed.
1018 #[serde(rename = "podNamespace")]
1019 pub pod_namespace: Option<String>,
1020}
1021
1022impl common::RequestValue for PollAirflowCommandRequest {}
1023
1024/// Response to PollAirflowCommandRequest.
1025///
1026/// # Activities
1027///
1028/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1029/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1030///
1031/// * [locations environments poll airflow command projects](ProjectLocationEnvironmentPollAirflowCommandCall) (response)
1032#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1033#[serde_with::serde_as]
1034#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1035pub struct PollAirflowCommandResponse {
1036 /// The result exit status of the command.
1037 #[serde(rename = "exitInfo")]
1038 pub exit_info: Option<ExitInfo>,
1039 /// Output from the command execution. It may not contain the full output and the caller may need to poll for more lines.
1040 pub output: Option<Vec<Line>>,
1041 /// Whether the command execution has finished and there is no more output.
1042 #[serde(rename = "outputEnd")]
1043 pub output_end: Option<bool>,
1044}
1045
1046impl common::ResponseResult for PollAirflowCommandResponse {}
1047
1048/// Configuration options for the private GKE cluster in a Cloud Composer environment.
1049///
1050/// This type is not used in any activity, and only used as *part* of another schema.
1051///
1052#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1053#[serde_with::serde_as]
1054#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1055pub struct PrivateClusterConfig {
1056 /// Optional. If `true`, access to the public endpoint of the GKE cluster is denied.
1057 #[serde(rename = "enablePrivateEndpoint")]
1058 pub enable_private_endpoint: Option<bool>,
1059 /// 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.
1060 #[serde(rename = "masterIpv4CidrBlock")]
1061 pub master_ipv4_cidr_block: Option<String>,
1062 /// 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.
1063 #[serde(rename = "masterIpv4ReservedRange")]
1064 pub master_ipv4_reserved_range: Option<String>,
1065}
1066
1067impl common::Part for PrivateClusterConfig {}
1068
1069/// The configuration information for configuring a Private IP Cloud Composer environment.
1070///
1071/// This type is not used in any activity, and only used as *part* of another schema.
1072///
1073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1074#[serde_with::serde_as]
1075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1076pub struct PrivateEnvironmentConfig {
1077 /// 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.
1078 #[serde(rename = "cloudComposerConnectionSubnetwork")]
1079 pub cloud_composer_connection_subnetwork: Option<String>,
1080 /// 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.
1081 #[serde(rename = "cloudComposerNetworkIpv4CidrBlock")]
1082 pub cloud_composer_network_ipv4_cidr_block: Option<String>,
1083 /// 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.
1084 #[serde(rename = "cloudComposerNetworkIpv4ReservedRange")]
1085 pub cloud_composer_network_ipv4_reserved_range: Option<String>,
1086 /// 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`.
1087 #[serde(rename = "cloudSqlIpv4CidrBlock")]
1088 pub cloud_sql_ipv4_cidr_block: Option<String>,
1089 /// 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-*.*.*-build.* and newer.
1090 #[serde(rename = "enablePrivateBuildsOnly")]
1091 pub enable_private_builds_only: Option<bool>,
1092 /// 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-*.*.*.
1093 #[serde(rename = "enablePrivateEnvironment")]
1094 pub enable_private_environment: Option<bool>,
1095 /// Optional. When enabled, IPs from public (non-RFC1918) ranges can be used for `IPAllocationPolicy.cluster_ipv4_cidr_block` and `IPAllocationPolicy.service_ipv4_cidr_block`.
1096 #[serde(rename = "enablePrivatelyUsedPublicIps")]
1097 pub enable_privately_used_public_ips: Option<bool>,
1098 /// Optional. Configuration for the network connections configuration in the environment.
1099 #[serde(rename = "networkingConfig")]
1100 pub networking_config: Option<NetworkingConfig>,
1101 /// Optional. Configuration for the private GKE cluster for a Private IP Cloud Composer environment.
1102 #[serde(rename = "privateClusterConfig")]
1103 pub private_cluster_config: Option<PrivateClusterConfig>,
1104 /// 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-*.*.*.
1105 #[serde(rename = "webServerIpv4CidrBlock")]
1106 pub web_server_ipv4_cidr_block: Option<String>,
1107 /// 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-*.*.*.
1108 #[serde(rename = "webServerIpv4ReservedRange")]
1109 pub web_server_ipv4_reserved_range: Option<String>,
1110}
1111
1112impl common::Part for PrivateEnvironmentConfig {}
1113
1114/// The Recovery settings of an environment.
1115///
1116/// This type is not used in any activity, and only used as *part* of another schema.
1117///
1118#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1119#[serde_with::serde_as]
1120#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1121pub struct RecoveryConfig {
1122 /// Optional. The configuration for scheduled snapshot creation mechanism.
1123 #[serde(rename = "scheduledSnapshotsConfig")]
1124 pub scheduled_snapshots_config: Option<ScheduledSnapshotsConfig>,
1125}
1126
1127impl common::Part for RecoveryConfig {}
1128
1129/// Restart Airflow web server.
1130///
1131/// # Activities
1132///
1133/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1134/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1135///
1136/// * [locations environments restart web server projects](ProjectLocationEnvironmentRestartWebServerCall) (request)
1137#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1138#[serde_with::serde_as]
1139#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1140pub struct RestartWebServerRequest {
1141 _never_set: Option<bool>,
1142}
1143
1144impl common::RequestValue for RestartWebServerRequest {}
1145
1146/// Request to create a snapshot of a Cloud Composer environment.
1147///
1148/// # Activities
1149///
1150/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1151/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1152///
1153/// * [locations environments save snapshot projects](ProjectLocationEnvironmentSaveSnapshotCall) (request)
1154#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1155#[serde_with::serde_as]
1156#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1157pub struct SaveSnapshotRequest {
1158 /// Location in a Cloud Storage where the snapshot is going to be stored, e.g.: "gs://my-bucket/snapshots".
1159 #[serde(rename = "snapshotLocation")]
1160 pub snapshot_location: Option<String>,
1161}
1162
1163impl common::RequestValue for SaveSnapshotRequest {}
1164
1165/// The configuration for scheduled snapshot creation mechanism.
1166///
1167/// This type is not used in any activity, and only used as *part* of another schema.
1168///
1169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1170#[serde_with::serde_as]
1171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1172pub struct ScheduledSnapshotsConfig {
1173 /// Optional. Whether scheduled snapshots creation is enabled.
1174 pub enabled: Option<bool>,
1175 /// Optional. The cron expression representing the time when snapshots creation mechanism runs. This field is subject to additional validation around frequency of execution.
1176 #[serde(rename = "snapshotCreationSchedule")]
1177 pub snapshot_creation_schedule: Option<String>,
1178 /// Optional. The Cloud Storage location for storing automatically created snapshots.
1179 #[serde(rename = "snapshotLocation")]
1180 pub snapshot_location: Option<String>,
1181 /// Optional. Time zone that sets the context to interpret snapshot_creation_schedule.
1182 #[serde(rename = "timeZone")]
1183 pub time_zone: Option<String>,
1184}
1185
1186impl common::Part for ScheduledSnapshotsConfig {}
1187
1188/// Configuration for resources used by Airflow schedulers.
1189///
1190/// This type is not used in any activity, and only used as *part* of another schema.
1191///
1192#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1193#[serde_with::serde_as]
1194#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1195pub struct SchedulerResource {
1196 /// Optional. The number of schedulers.
1197 pub count: Option<i32>,
1198 /// Optional. CPU request and limit for a single Airflow scheduler replica.
1199 pub cpu: Option<f32>,
1200 /// Optional. Memory (GB) request and limit for a single Airflow scheduler replica.
1201 #[serde(rename = "memoryGb")]
1202 pub memory_gb: Option<f32>,
1203 /// Optional. Storage (GB) request and limit for a single Airflow scheduler replica.
1204 #[serde(rename = "storageGb")]
1205 pub storage_gb: Option<f32>,
1206}
1207
1208impl common::Part for SchedulerResource {}
1209
1210/// Specifies the selection and configuration of software inside the environment.
1211///
1212/// This type is not used in any activity, and only used as *part* of another schema.
1213///
1214#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1215#[serde_with::serde_as]
1216#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1217pub struct SoftwareConfig {
1218 /// 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.
1219 #[serde(rename = "airflowConfigOverrides")]
1220 pub airflow_config_overrides: Option<HashMap<String, String>>,
1221 /// Optional. The configuration for Cloud Data Lineage integration.
1222 #[serde(rename = "cloudDataLineageIntegration")]
1223 pub cloud_data_lineage_integration: Option<CloudDataLineageIntegration>,
1224 /// 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`
1225 #[serde(rename = "envVariables")]
1226 pub env_variables: Option<HashMap<String, String>>,
1227 /// 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).
1228 #[serde(rename = "imageVersion")]
1229 pub image_version: Option<String>,
1230 /// 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.
1231 #[serde(rename = "pypiPackages")]
1232 pub pypi_packages: Option<HashMap<String, String>>,
1233 /// 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.
1234 #[serde(rename = "pythonVersion")]
1235 pub python_version: Option<String>,
1236 /// Optional. The number of schedulers for Airflow. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-2.*.*.
1237 #[serde(rename = "schedulerCount")]
1238 pub scheduler_count: Option<i32>,
1239 /// 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-*.*.*-build.* and newer.
1240 #[serde(rename = "webServerPluginsMode")]
1241 pub web_server_plugins_mode: Option<String>,
1242}
1243
1244impl common::Part for SoftwareConfig {}
1245
1246/// 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).
1247///
1248/// This type is not used in any activity, and only used as *part* of another schema.
1249///
1250#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1251#[serde_with::serde_as]
1252#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1253pub struct Status {
1254 /// The status code, which should be an enum value of google.rpc.Code.
1255 pub code: Option<i32>,
1256 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
1257 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
1258 /// 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.
1259 pub message: Option<String>,
1260}
1261
1262impl common::Part for Status {}
1263
1264/// Stop Airflow Command request.
1265///
1266/// # Activities
1267///
1268/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1269/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1270///
1271/// * [locations environments stop airflow command projects](ProjectLocationEnvironmentStopAirflowCommandCall) (request)
1272#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1273#[serde_with::serde_as]
1274#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1275pub struct StopAirflowCommandRequest {
1276 /// The unique ID of the command execution.
1277 #[serde(rename = "executionId")]
1278 pub execution_id: Option<String>,
1279 /// If true, the execution is terminated forcefully (SIGKILL). If false, the execution is stopped gracefully, giving it time for cleanup.
1280 pub force: Option<bool>,
1281 /// The name of the pod where the command is executed.
1282 pub pod: Option<String>,
1283 /// The namespace of the pod where the command is executed.
1284 #[serde(rename = "podNamespace")]
1285 pub pod_namespace: Option<String>,
1286}
1287
1288impl common::RequestValue for StopAirflowCommandRequest {}
1289
1290/// Response to StopAirflowCommandRequest.
1291///
1292/// # Activities
1293///
1294/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1295/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1296///
1297/// * [locations environments stop airflow command projects](ProjectLocationEnvironmentStopAirflowCommandCall) (response)
1298#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1299#[serde_with::serde_as]
1300#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1301pub struct StopAirflowCommandResponse {
1302 /// Whether the execution is still running.
1303 #[serde(rename = "isDone")]
1304 pub is_done: Option<bool>,
1305 /// Output message from stopping execution request.
1306 pub output: Option<Vec<String>>,
1307}
1308
1309impl common::ResponseResult for StopAirflowCommandResponse {}
1310
1311/// The configuration for data storage in the environment.
1312///
1313/// This type is not used in any activity, and only used as *part* of another schema.
1314///
1315#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1316#[serde_with::serde_as]
1317#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1318pub struct StorageConfig {
1319 /// Optional. The name of the Cloud Storage bucket used by the environment. No `gs://` prefix.
1320 pub bucket: Option<String>,
1321}
1322
1323impl common::Part for StorageConfig {}
1324
1325/// The configuration setting for Task Logs.
1326///
1327/// This type is not used in any activity, and only used as *part* of another schema.
1328///
1329#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1330#[serde_with::serde_as]
1331#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1332pub struct TaskLogsRetentionConfig {
1333 /// Optional. The mode of storage for Airflow workers task logs.
1334 #[serde(rename = "storageMode")]
1335 pub storage_mode: Option<String>,
1336}
1337
1338impl common::Part for TaskLogsRetentionConfig {}
1339
1340/// Configuration for resources used by Airflow triggerers.
1341///
1342/// This type is not used in any activity, and only used as *part* of another schema.
1343///
1344#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1345#[serde_with::serde_as]
1346#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1347pub struct TriggererResource {
1348 /// Optional. The number of triggerers.
1349 pub count: Option<i32>,
1350 /// Optional. CPU request and limit for a single Airflow triggerer replica.
1351 pub cpu: Option<f32>,
1352 /// Optional. Memory (GB) request and limit for a single Airflow triggerer replica.
1353 #[serde(rename = "memoryGb")]
1354 pub memory_gb: Option<f32>,
1355}
1356
1357impl common::Part for TriggererResource {}
1358
1359/// User workloads ConfigMap used by Airflow tasks that run with Kubernetes executor or KubernetesPodOperator.
1360///
1361/// # Activities
1362///
1363/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1364/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1365///
1366/// * [locations environments user workloads config maps create projects](ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall) (request|response)
1367/// * [locations environments user workloads config maps get projects](ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall) (response)
1368/// * [locations environments user workloads config maps update projects](ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall) (request|response)
1369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1370#[serde_with::serde_as]
1371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1372pub struct UserWorkloadsConfigMap {
1373 /// Optional. The "data" field of Kubernetes ConfigMap, organized in key-value pairs. For details see: https://kubernetes.io/docs/concepts/configuration/configmap/ Example: { "example_key": "example_value", "another_key": "another_value" }
1374 pub data: Option<HashMap<String, String>>,
1375 /// Identifier. The resource name of the ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1376 pub name: Option<String>,
1377}
1378
1379impl common::RequestValue for UserWorkloadsConfigMap {}
1380impl common::ResponseResult for UserWorkloadsConfigMap {}
1381
1382/// User workloads Secret used by Airflow tasks that run with Kubernetes executor or KubernetesPodOperator.
1383///
1384/// # Activities
1385///
1386/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1387/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1388///
1389/// * [locations environments user workloads secrets create projects](ProjectLocationEnvironmentUserWorkloadsSecretCreateCall) (request|response)
1390/// * [locations environments user workloads secrets get projects](ProjectLocationEnvironmentUserWorkloadsSecretGetCall) (response)
1391/// * [locations environments user workloads secrets update projects](ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall) (request|response)
1392#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1393#[serde_with::serde_as]
1394#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1395pub struct UserWorkloadsSecret {
1396 /// 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/ Example: { "example": "ZXhhbXBsZV92YWx1ZQ==", "another-example": "YW5vdGhlcl9leGFtcGxlX3ZhbHVl" }
1397 pub data: Option<HashMap<String, String>>,
1398 /// Identifier. The resource name of the Secret, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1399 pub name: Option<String>,
1400}
1401
1402impl common::RequestValue for UserWorkloadsSecret {}
1403impl common::ResponseResult for UserWorkloadsSecret {}
1404
1405/// The configuration settings for the Airflow web server App Engine instance. Supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*
1406///
1407/// This type is not used in any activity, and only used as *part* of another schema.
1408///
1409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1410#[serde_with::serde_as]
1411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1412pub struct WebServerConfig {
1413 /// 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.
1414 #[serde(rename = "machineType")]
1415 pub machine_type: Option<String>,
1416}
1417
1418impl common::Part for WebServerConfig {}
1419
1420/// Network-level access control policy for the Airflow web server.
1421///
1422/// This type is not used in any activity, and only used as *part* of another schema.
1423///
1424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1425#[serde_with::serde_as]
1426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1427pub struct WebServerNetworkAccessControl {
1428 /// A collection of allowed IP ranges with descriptions.
1429 #[serde(rename = "allowedIpRanges")]
1430 pub allowed_ip_ranges: Option<Vec<AllowedIpRange>>,
1431}
1432
1433impl common::Part for WebServerNetworkAccessControl {}
1434
1435/// Configuration for resources used by Airflow web server.
1436///
1437/// This type is not used in any activity, and only used as *part* of another schema.
1438///
1439#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1440#[serde_with::serde_as]
1441#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1442pub struct WebServerResource {
1443 /// Optional. CPU request and limit for Airflow web server.
1444 pub cpu: Option<f32>,
1445 /// Optional. Memory (GB) request and limit for Airflow web server.
1446 #[serde(rename = "memoryGb")]
1447 pub memory_gb: Option<f32>,
1448 /// Optional. Storage (GB) request and limit for Airflow web server.
1449 #[serde(rename = "storageGb")]
1450 pub storage_gb: Option<f32>,
1451}
1452
1453impl common::Part for WebServerResource {}
1454
1455/// Configuration for resources used by Airflow workers.
1456///
1457/// This type is not used in any activity, and only used as *part* of another schema.
1458///
1459#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1460#[serde_with::serde_as]
1461#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1462pub struct WorkerResource {
1463 /// Optional. CPU request and limit for a single Airflow worker replica.
1464 pub cpu: Option<f32>,
1465 /// Optional. Maximum number of workers for autoscaling.
1466 #[serde(rename = "maxCount")]
1467 pub max_count: Option<i32>,
1468 /// Optional. Memory (GB) request and limit for a single Airflow worker replica.
1469 #[serde(rename = "memoryGb")]
1470 pub memory_gb: Option<f32>,
1471 /// Optional. Minimum number of workers for autoscaling.
1472 #[serde(rename = "minCount")]
1473 pub min_count: Option<i32>,
1474 /// Optional. Storage (GB) request and limit for a single Airflow worker replica.
1475 #[serde(rename = "storageGb")]
1476 pub storage_gb: Option<f32>,
1477}
1478
1479impl common::Part for WorkerResource {}
1480
1481/// 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.
1482///
1483/// This type is not used in any activity, and only used as *part* of another schema.
1484///
1485#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1486#[serde_with::serde_as]
1487#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1488pub struct WorkloadsConfig {
1489 /// Optional. Resources used by Airflow DAG processors. This field is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1490 #[serde(rename = "dagProcessor")]
1491 pub dag_processor: Option<DagProcessorResource>,
1492 /// Optional. Resources used by Airflow schedulers.
1493 pub scheduler: Option<SchedulerResource>,
1494 /// Optional. Resources used by Airflow triggerers.
1495 pub triggerer: Option<TriggererResource>,
1496 /// Optional. Resources used by Airflow web server.
1497 #[serde(rename = "webServer")]
1498 pub web_server: Option<WebServerResource>,
1499 /// Optional. Resources used by Airflow workers.
1500 pub worker: Option<WorkerResource>,
1501}
1502
1503impl common::Part for WorkloadsConfig {}
1504
1505// ###################
1506// MethodBuilders ###
1507// #################
1508
1509/// A builder providing access to all methods supported on *project* resources.
1510/// It is not used directly, but through the [`CloudComposer`] hub.
1511///
1512/// # Example
1513///
1514/// Instantiate a resource builder
1515///
1516/// ```test_harness,no_run
1517/// extern crate hyper;
1518/// extern crate hyper_rustls;
1519/// extern crate google_composer1 as composer1;
1520///
1521/// # async fn dox() {
1522/// use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
1523///
1524/// let secret: yup_oauth2::ApplicationSecret = Default::default();
1525/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
1526/// .with_native_roots()
1527/// .unwrap()
1528/// .https_only()
1529/// .enable_http2()
1530/// .build();
1531///
1532/// let executor = hyper_util::rt::TokioExecutor::new();
1533/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
1534/// secret,
1535/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
1536/// yup_oauth2::client::CustomHyperClientBuilder::from(
1537/// hyper_util::client::legacy::Client::builder(executor).build(connector),
1538/// ),
1539/// ).build().await.unwrap();
1540///
1541/// let client = hyper_util::client::legacy::Client::builder(
1542/// hyper_util::rt::TokioExecutor::new()
1543/// )
1544/// .build(
1545/// hyper_rustls::HttpsConnectorBuilder::new()
1546/// .with_native_roots()
1547/// .unwrap()
1548/// .https_or_http()
1549/// .enable_http2()
1550/// .build()
1551/// );
1552/// let mut hub = CloudComposer::new(client, auth);
1553/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
1554/// // 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_restart_web_server(...)`, `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(...)`
1555/// // to build up your call.
1556/// let rb = hub.projects();
1557/// # }
1558/// ```
1559pub struct ProjectMethods<'a, C>
1560where
1561 C: 'a,
1562{
1563 hub: &'a CloudComposer<C>,
1564}
1565
1566impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
1567
1568impl<'a, C> ProjectMethods<'a, C> {
1569 /// Create a builder to help you perform the following task:
1570 ///
1571 /// Creates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1572 ///
1573 /// # Arguments
1574 ///
1575 /// * `request` - No description provided.
1576 /// * `parent` - Required. The environment name to create a ConfigMap for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1577 pub fn locations_environments_user_workloads_config_maps_create(
1578 &self,
1579 request: UserWorkloadsConfigMap,
1580 parent: &str,
1581 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
1582 ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall {
1583 hub: self.hub,
1584 _request: request,
1585 _parent: parent.to_string(),
1586 _delegate: Default::default(),
1587 _additional_params: Default::default(),
1588 _scopes: Default::default(),
1589 }
1590 }
1591
1592 /// Create a builder to help you perform the following task:
1593 ///
1594 /// Deletes a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1595 ///
1596 /// # Arguments
1597 ///
1598 /// * `name` - Required. The ConfigMap to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1599 pub fn locations_environments_user_workloads_config_maps_delete(
1600 &self,
1601 name: &str,
1602 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
1603 ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall {
1604 hub: self.hub,
1605 _name: name.to_string(),
1606 _delegate: Default::default(),
1607 _additional_params: Default::default(),
1608 _scopes: Default::default(),
1609 }
1610 }
1611
1612 /// Create a builder to help you perform the following task:
1613 ///
1614 /// Gets an existing user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1615 ///
1616 /// # Arguments
1617 ///
1618 /// * `name` - Required. The resource name of the ConfigMap to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1619 pub fn locations_environments_user_workloads_config_maps_get(
1620 &self,
1621 name: &str,
1622 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
1623 ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall {
1624 hub: self.hub,
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 /// Lists user workloads ConfigMaps. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1635 ///
1636 /// # Arguments
1637 ///
1638 /// * `parent` - Required. List ConfigMaps in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1639 pub fn locations_environments_user_workloads_config_maps_list(
1640 &self,
1641 parent: &str,
1642 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
1643 ProjectLocationEnvironmentUserWorkloadsConfigMapListCall {
1644 hub: self.hub,
1645 _parent: parent.to_string(),
1646 _page_token: Default::default(),
1647 _page_size: Default::default(),
1648 _delegate: Default::default(),
1649 _additional_params: Default::default(),
1650 _scopes: Default::default(),
1651 }
1652 }
1653
1654 /// Create a builder to help you perform the following task:
1655 ///
1656 /// Updates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1657 ///
1658 /// # Arguments
1659 ///
1660 /// * `request` - No description provided.
1661 /// * `name` - Identifier. The resource name of the ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
1662 pub fn locations_environments_user_workloads_config_maps_update(
1663 &self,
1664 request: UserWorkloadsConfigMap,
1665 name: &str,
1666 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
1667 ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall {
1668 hub: self.hub,
1669 _request: request,
1670 _name: name.to_string(),
1671 _delegate: Default::default(),
1672 _additional_params: Default::default(),
1673 _scopes: Default::default(),
1674 }
1675 }
1676
1677 /// Create a builder to help you perform the following task:
1678 ///
1679 /// Creates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1680 ///
1681 /// # Arguments
1682 ///
1683 /// * `request` - No description provided.
1684 /// * `parent` - Required. The environment name to create a Secret for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1685 pub fn locations_environments_user_workloads_secrets_create(
1686 &self,
1687 request: UserWorkloadsSecret,
1688 parent: &str,
1689 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
1690 ProjectLocationEnvironmentUserWorkloadsSecretCreateCall {
1691 hub: self.hub,
1692 _request: request,
1693 _parent: parent.to_string(),
1694 _delegate: Default::default(),
1695 _additional_params: Default::default(),
1696 _scopes: Default::default(),
1697 }
1698 }
1699
1700 /// Create a builder to help you perform the following task:
1701 ///
1702 /// Deletes a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1703 ///
1704 /// # Arguments
1705 ///
1706 /// * `name` - Required. The Secret to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1707 pub fn locations_environments_user_workloads_secrets_delete(
1708 &self,
1709 name: &str,
1710 ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
1711 ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall {
1712 hub: self.hub,
1713 _name: name.to_string(),
1714 _delegate: Default::default(),
1715 _additional_params: Default::default(),
1716 _scopes: Default::default(),
1717 }
1718 }
1719
1720 /// Create a builder to help you perform the following task:
1721 ///
1722 /// 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-*.*.*-build.* and newer.
1723 ///
1724 /// # Arguments
1725 ///
1726 /// * `name` - Required. The resource name of the Secret to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1727 pub fn locations_environments_user_workloads_secrets_get(
1728 &self,
1729 name: &str,
1730 ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
1731 ProjectLocationEnvironmentUserWorkloadsSecretGetCall {
1732 hub: self.hub,
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 user workloads Secrets. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1743 ///
1744 /// # Arguments
1745 ///
1746 /// * `parent` - Required. List Secrets in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1747 pub fn locations_environments_user_workloads_secrets_list(
1748 &self,
1749 parent: &str,
1750 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
1751 ProjectLocationEnvironmentUserWorkloadsSecretListCall {
1752 hub: self.hub,
1753 _parent: parent.to_string(),
1754 _page_token: Default::default(),
1755 _page_size: Default::default(),
1756 _delegate: Default::default(),
1757 _additional_params: Default::default(),
1758 _scopes: Default::default(),
1759 }
1760 }
1761
1762 /// Create a builder to help you perform the following task:
1763 ///
1764 /// Updates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
1765 ///
1766 /// # Arguments
1767 ///
1768 /// * `request` - No description provided.
1769 /// * `name` - Identifier. The resource name of the Secret, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
1770 pub fn locations_environments_user_workloads_secrets_update(
1771 &self,
1772 request: UserWorkloadsSecret,
1773 name: &str,
1774 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
1775 ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall {
1776 hub: self.hub,
1777 _request: request,
1778 _name: name.to_string(),
1779 _delegate: Default::default(),
1780 _additional_params: Default::default(),
1781 _scopes: Default::default(),
1782 }
1783 }
1784
1785 /// Create a builder to help you perform the following task:
1786 ///
1787 /// 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-2.*.*-airflow-*.*.* and newer.
1788 ///
1789 /// # Arguments
1790 ///
1791 /// * `parent` - Required. The environment name to get workloads for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1792 pub fn locations_environments_workloads_list(
1793 &self,
1794 parent: &str,
1795 ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
1796 ProjectLocationEnvironmentWorkloadListCall {
1797 hub: self.hub,
1798 _parent: parent.to_string(),
1799 _page_token: Default::default(),
1800 _page_size: Default::default(),
1801 _filter: Default::default(),
1802 _delegate: Default::default(),
1803 _additional_params: Default::default(),
1804 _scopes: Default::default(),
1805 }
1806 }
1807
1808 /// Create a builder to help you perform the following task:
1809 ///
1810 /// Check if an upgrade operation on the environment will succeed. In case of problems detailed info can be found in the returned Operation.
1811 ///
1812 /// # Arguments
1813 ///
1814 /// * `request` - No description provided.
1815 /// * `environment` - Required. The resource name of the environment to check upgrade for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1816 pub fn locations_environments_check_upgrade(
1817 &self,
1818 request: CheckUpgradeRequest,
1819 environment: &str,
1820 ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
1821 ProjectLocationEnvironmentCheckUpgradeCall {
1822 hub: self.hub,
1823 _request: request,
1824 _environment: environment.to_string(),
1825 _delegate: Default::default(),
1826 _additional_params: Default::default(),
1827 _scopes: Default::default(),
1828 }
1829 }
1830
1831 /// Create a builder to help you perform the following task:
1832 ///
1833 /// Create a new environment.
1834 ///
1835 /// # Arguments
1836 ///
1837 /// * `request` - No description provided.
1838 /// * `parent` - The parent must be of the form "projects/{projectId}/locations/{locationId}".
1839 pub fn locations_environments_create(
1840 &self,
1841 request: Environment,
1842 parent: &str,
1843 ) -> ProjectLocationEnvironmentCreateCall<'a, C> {
1844 ProjectLocationEnvironmentCreateCall {
1845 hub: self.hub,
1846 _request: request,
1847 _parent: parent.to_string(),
1848 _delegate: Default::default(),
1849 _additional_params: Default::default(),
1850 _scopes: Default::default(),
1851 }
1852 }
1853
1854 /// Create a builder to help you perform the following task:
1855 ///
1856 /// Triggers database failover (only for highly resilient environments).
1857 ///
1858 /// # Arguments
1859 ///
1860 /// * `request` - No description provided.
1861 /// * `environment` - Target environment: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1862 pub fn locations_environments_database_failover(
1863 &self,
1864 request: DatabaseFailoverRequest,
1865 environment: &str,
1866 ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
1867 ProjectLocationEnvironmentDatabaseFailoverCall {
1868 hub: self.hub,
1869 _request: request,
1870 _environment: environment.to_string(),
1871 _delegate: Default::default(),
1872 _additional_params: Default::default(),
1873 _scopes: Default::default(),
1874 }
1875 }
1876
1877 /// Create a builder to help you perform the following task:
1878 ///
1879 /// Delete an environment.
1880 ///
1881 /// # Arguments
1882 ///
1883 /// * `name` - The environment to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1884 pub fn locations_environments_delete(
1885 &self,
1886 name: &str,
1887 ) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
1888 ProjectLocationEnvironmentDeleteCall {
1889 hub: self.hub,
1890 _name: name.to_string(),
1891 _delegate: Default::default(),
1892 _additional_params: Default::default(),
1893 _scopes: Default::default(),
1894 }
1895 }
1896
1897 /// Create a builder to help you perform the following task:
1898 ///
1899 /// Executes Airflow CLI command.
1900 ///
1901 /// # Arguments
1902 ///
1903 /// * `request` - No description provided.
1904 /// * `environment` - The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
1905 pub fn locations_environments_execute_airflow_command(
1906 &self,
1907 request: ExecuteAirflowCommandRequest,
1908 environment: &str,
1909 ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
1910 ProjectLocationEnvironmentExecuteAirflowCommandCall {
1911 hub: self.hub,
1912 _request: request,
1913 _environment: environment.to_string(),
1914 _delegate: Default::default(),
1915 _additional_params: Default::default(),
1916 _scopes: Default::default(),
1917 }
1918 }
1919
1920 /// Create a builder to help you perform the following task:
1921 ///
1922 /// Fetches database properties.
1923 ///
1924 /// # Arguments
1925 ///
1926 /// * `environment` - Required. The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1927 pub fn locations_environments_fetch_database_properties(
1928 &self,
1929 environment: &str,
1930 ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
1931 ProjectLocationEnvironmentFetchDatabasePropertyCall {
1932 hub: self.hub,
1933 _environment: environment.to_string(),
1934 _delegate: Default::default(),
1935 _additional_params: Default::default(),
1936 _scopes: Default::default(),
1937 }
1938 }
1939
1940 /// Create a builder to help you perform the following task:
1941 ///
1942 /// Get an existing environment.
1943 ///
1944 /// # Arguments
1945 ///
1946 /// * `name` - The resource name of the environment to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1947 pub fn locations_environments_get(
1948 &self,
1949 name: &str,
1950 ) -> ProjectLocationEnvironmentGetCall<'a, C> {
1951 ProjectLocationEnvironmentGetCall {
1952 hub: self.hub,
1953 _name: name.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 /// List environments.
1963 ///
1964 /// # Arguments
1965 ///
1966 /// * `parent` - List environments in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
1967 pub fn locations_environments_list(
1968 &self,
1969 parent: &str,
1970 ) -> ProjectLocationEnvironmentListCall<'a, C> {
1971 ProjectLocationEnvironmentListCall {
1972 hub: self.hub,
1973 _parent: parent.to_string(),
1974 _page_token: Default::default(),
1975 _page_size: Default::default(),
1976 _delegate: Default::default(),
1977 _additional_params: Default::default(),
1978 _scopes: Default::default(),
1979 }
1980 }
1981
1982 /// Create a builder to help you perform the following task:
1983 ///
1984 /// 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.
1985 ///
1986 /// # Arguments
1987 ///
1988 /// * `request` - No description provided.
1989 /// * `environment` - The resource name of the target environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
1990 pub fn locations_environments_load_snapshot(
1991 &self,
1992 request: LoadSnapshotRequest,
1993 environment: &str,
1994 ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
1995 ProjectLocationEnvironmentLoadSnapshotCall {
1996 hub: self.hub,
1997 _request: request,
1998 _environment: environment.to_string(),
1999 _delegate: Default::default(),
2000 _additional_params: Default::default(),
2001 _scopes: Default::default(),
2002 }
2003 }
2004
2005 /// Create a builder to help you perform the following task:
2006 ///
2007 /// Update an environment.
2008 ///
2009 /// # Arguments
2010 ///
2011 /// * `request` - No description provided.
2012 /// * `name` - The relative resource name of the environment to update, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
2013 pub fn locations_environments_patch(
2014 &self,
2015 request: Environment,
2016 name: &str,
2017 ) -> ProjectLocationEnvironmentPatchCall<'a, C> {
2018 ProjectLocationEnvironmentPatchCall {
2019 hub: self.hub,
2020 _request: request,
2021 _name: name.to_string(),
2022 _update_mask: Default::default(),
2023 _delegate: Default::default(),
2024 _additional_params: Default::default(),
2025 _scopes: Default::default(),
2026 }
2027 }
2028
2029 /// Create a builder to help you perform the following task:
2030 ///
2031 /// Polls Airflow CLI command execution and fetches logs.
2032 ///
2033 /// # Arguments
2034 ///
2035 /// * `request` - No description provided.
2036 /// * `environment` - The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
2037 pub fn locations_environments_poll_airflow_command(
2038 &self,
2039 request: PollAirflowCommandRequest,
2040 environment: &str,
2041 ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
2042 ProjectLocationEnvironmentPollAirflowCommandCall {
2043 hub: self.hub,
2044 _request: request,
2045 _environment: environment.to_string(),
2046 _delegate: Default::default(),
2047 _additional_params: Default::default(),
2048 _scopes: Default::default(),
2049 }
2050 }
2051
2052 /// Create a builder to help you perform the following task:
2053 ///
2054 /// Restart Airflow web server.
2055 ///
2056 /// # Arguments
2057 ///
2058 /// * `request` - No description provided.
2059 /// * `name` - Required. The resource name of the environment to restart the web server for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
2060 pub fn locations_environments_restart_web_server(
2061 &self,
2062 request: RestartWebServerRequest,
2063 name: &str,
2064 ) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C> {
2065 ProjectLocationEnvironmentRestartWebServerCall {
2066 hub: self.hub,
2067 _request: request,
2068 _name: name.to_string(),
2069 _delegate: Default::default(),
2070 _additional_params: Default::default(),
2071 _scopes: Default::default(),
2072 }
2073 }
2074
2075 /// Create a builder to help you perform the following task:
2076 ///
2077 /// 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.
2078 ///
2079 /// # Arguments
2080 ///
2081 /// * `request` - No description provided.
2082 /// * `environment` - The resource name of the source environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
2083 pub fn locations_environments_save_snapshot(
2084 &self,
2085 request: SaveSnapshotRequest,
2086 environment: &str,
2087 ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
2088 ProjectLocationEnvironmentSaveSnapshotCall {
2089 hub: self.hub,
2090 _request: request,
2091 _environment: environment.to_string(),
2092 _delegate: Default::default(),
2093 _additional_params: Default::default(),
2094 _scopes: Default::default(),
2095 }
2096 }
2097
2098 /// Create a builder to help you perform the following task:
2099 ///
2100 /// Stops Airflow CLI command execution.
2101 ///
2102 /// # Arguments
2103 ///
2104 /// * `request` - No description provided.
2105 /// * `environment` - The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
2106 pub fn locations_environments_stop_airflow_command(
2107 &self,
2108 request: StopAirflowCommandRequest,
2109 environment: &str,
2110 ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
2111 ProjectLocationEnvironmentStopAirflowCommandCall {
2112 hub: self.hub,
2113 _request: request,
2114 _environment: environment.to_string(),
2115 _delegate: Default::default(),
2116 _additional_params: Default::default(),
2117 _scopes: Default::default(),
2118 }
2119 }
2120
2121 /// Create a builder to help you perform the following task:
2122 ///
2123 /// List ImageVersions for provided location.
2124 ///
2125 /// # Arguments
2126 ///
2127 /// * `parent` - List ImageVersions in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
2128 pub fn locations_image_versions_list(
2129 &self,
2130 parent: &str,
2131 ) -> ProjectLocationImageVersionListCall<'a, C> {
2132 ProjectLocationImageVersionListCall {
2133 hub: self.hub,
2134 _parent: parent.to_string(),
2135 _page_token: Default::default(),
2136 _page_size: Default::default(),
2137 _include_past_releases: Default::default(),
2138 _delegate: Default::default(),
2139 _additional_params: Default::default(),
2140 _scopes: Default::default(),
2141 }
2142 }
2143
2144 /// Create a builder to help you perform the following task:
2145 ///
2146 /// 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`.
2147 ///
2148 /// # Arguments
2149 ///
2150 /// * `name` - The name of the operation resource to be deleted.
2151 pub fn locations_operations_delete(
2152 &self,
2153 name: &str,
2154 ) -> ProjectLocationOperationDeleteCall<'a, C> {
2155 ProjectLocationOperationDeleteCall {
2156 hub: self.hub,
2157 _name: name.to_string(),
2158 _delegate: Default::default(),
2159 _additional_params: Default::default(),
2160 _scopes: Default::default(),
2161 }
2162 }
2163
2164 /// Create a builder to help you perform the following task:
2165 ///
2166 /// 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.
2167 ///
2168 /// # Arguments
2169 ///
2170 /// * `name` - The name of the operation resource.
2171 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
2172 ProjectLocationOperationGetCall {
2173 hub: self.hub,
2174 _name: name.to_string(),
2175 _delegate: Default::default(),
2176 _additional_params: Default::default(),
2177 _scopes: Default::default(),
2178 }
2179 }
2180
2181 /// Create a builder to help you perform the following task:
2182 ///
2183 /// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
2184 ///
2185 /// # Arguments
2186 ///
2187 /// * `name` - The name of the operation's parent resource.
2188 pub fn locations_operations_list(&self, name: &str) -> ProjectLocationOperationListCall<'a, C> {
2189 ProjectLocationOperationListCall {
2190 hub: self.hub,
2191 _name: name.to_string(),
2192 _return_partial_success: Default::default(),
2193 _page_token: Default::default(),
2194 _page_size: Default::default(),
2195 _filter: Default::default(),
2196 _delegate: Default::default(),
2197 _additional_params: Default::default(),
2198 _scopes: Default::default(),
2199 }
2200 }
2201}
2202
2203// ###################
2204// CallBuilders ###
2205// #################
2206
2207/// Creates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
2208///
2209/// A builder for the *locations.environments.userWorkloadsConfigMaps.create* method supported by a *project* resource.
2210/// It is not used directly, but through a [`ProjectMethods`] instance.
2211///
2212/// # Example
2213///
2214/// Instantiate a resource method builder
2215///
2216/// ```test_harness,no_run
2217/// # extern crate hyper;
2218/// # extern crate hyper_rustls;
2219/// # extern crate google_composer1 as composer1;
2220/// use composer1::api::UserWorkloadsConfigMap;
2221/// # async fn dox() {
2222/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2223///
2224/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2225/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2226/// # .with_native_roots()
2227/// # .unwrap()
2228/// # .https_only()
2229/// # .enable_http2()
2230/// # .build();
2231///
2232/// # let executor = hyper_util::rt::TokioExecutor::new();
2233/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2234/// # secret,
2235/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2236/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2237/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2238/// # ),
2239/// # ).build().await.unwrap();
2240///
2241/// # let client = hyper_util::client::legacy::Client::builder(
2242/// # hyper_util::rt::TokioExecutor::new()
2243/// # )
2244/// # .build(
2245/// # hyper_rustls::HttpsConnectorBuilder::new()
2246/// # .with_native_roots()
2247/// # .unwrap()
2248/// # .https_or_http()
2249/// # .enable_http2()
2250/// # .build()
2251/// # );
2252/// # let mut hub = CloudComposer::new(client, auth);
2253/// // As the method needs a request, you would usually fill it with the desired information
2254/// // into the respective structure. Some of the parts shown here might not be applicable !
2255/// // Values shown here are possibly random and not representative !
2256/// let mut req = UserWorkloadsConfigMap::default();
2257///
2258/// // You can configure optional parameters by calling the respective setters at will, and
2259/// // execute the final call using `doit()`.
2260/// // Values shown here are possibly random and not representative !
2261/// let result = hub.projects().locations_environments_user_workloads_config_maps_create(req, "parent")
2262/// .doit().await;
2263/// # }
2264/// ```
2265pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2266where
2267 C: 'a,
2268{
2269 hub: &'a CloudComposer<C>,
2270 _request: UserWorkloadsConfigMap,
2271 _parent: String,
2272 _delegate: Option<&'a mut dyn common::Delegate>,
2273 _additional_params: HashMap<String, String>,
2274 _scopes: BTreeSet<String>,
2275}
2276
2277impl<'a, C> common::CallBuilder
2278 for ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2279{
2280}
2281
2282impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2283where
2284 C: common::Connector,
2285{
2286 /// Perform the operation you have build so far.
2287 pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsConfigMap)> {
2288 use std::borrow::Cow;
2289 use std::io::{Read, Seek};
2290
2291 use common::{url::Params, ToParts};
2292 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2293
2294 let mut dd = common::DefaultDelegate;
2295 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2296 dlg.begin(common::MethodInfo {
2297 id: "composer.projects.locations.environments.userWorkloadsConfigMaps.create",
2298 http_method: hyper::Method::POST,
2299 });
2300
2301 for &field in ["alt", "parent"].iter() {
2302 if self._additional_params.contains_key(field) {
2303 dlg.finished(false);
2304 return Err(common::Error::FieldClash(field));
2305 }
2306 }
2307
2308 let mut params = Params::with_capacity(4 + self._additional_params.len());
2309 params.push("parent", self._parent);
2310
2311 params.extend(self._additional_params.iter());
2312
2313 params.push("alt", "json");
2314 let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsConfigMaps";
2315 if self._scopes.is_empty() {
2316 self._scopes
2317 .insert(Scope::CloudPlatform.as_ref().to_string());
2318 }
2319
2320 #[allow(clippy::single_element_loop)]
2321 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
2322 url = params.uri_replacement(url, param_name, find_this, true);
2323 }
2324 {
2325 let to_remove = ["parent"];
2326 params.remove_params(&to_remove);
2327 }
2328
2329 let url = params.parse_with_url(&url);
2330
2331 let mut json_mime_type = mime::APPLICATION_JSON;
2332 let mut request_value_reader = {
2333 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
2334 common::remove_json_null_values(&mut value);
2335 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
2336 serde_json::to_writer(&mut dst, &value).unwrap();
2337 dst
2338 };
2339 let request_size = request_value_reader
2340 .seek(std::io::SeekFrom::End(0))
2341 .unwrap();
2342 request_value_reader
2343 .seek(std::io::SeekFrom::Start(0))
2344 .unwrap();
2345
2346 loop {
2347 let token = match self
2348 .hub
2349 .auth
2350 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2351 .await
2352 {
2353 Ok(token) => token,
2354 Err(e) => match dlg.token(e) {
2355 Ok(token) => token,
2356 Err(e) => {
2357 dlg.finished(false);
2358 return Err(common::Error::MissingToken(e));
2359 }
2360 },
2361 };
2362 request_value_reader
2363 .seek(std::io::SeekFrom::Start(0))
2364 .unwrap();
2365 let mut req_result = {
2366 let client = &self.hub.client;
2367 dlg.pre_request();
2368 let mut req_builder = hyper::Request::builder()
2369 .method(hyper::Method::POST)
2370 .uri(url.as_str())
2371 .header(USER_AGENT, self.hub._user_agent.clone());
2372
2373 if let Some(token) = token.as_ref() {
2374 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2375 }
2376
2377 let request = req_builder
2378 .header(CONTENT_TYPE, json_mime_type.to_string())
2379 .header(CONTENT_LENGTH, request_size as u64)
2380 .body(common::to_body(
2381 request_value_reader.get_ref().clone().into(),
2382 ));
2383
2384 client.request(request.unwrap()).await
2385 };
2386
2387 match req_result {
2388 Err(err) => {
2389 if let common::Retry::After(d) = dlg.http_error(&err) {
2390 sleep(d).await;
2391 continue;
2392 }
2393 dlg.finished(false);
2394 return Err(common::Error::HttpError(err));
2395 }
2396 Ok(res) => {
2397 let (mut parts, body) = res.into_parts();
2398 let mut body = common::Body::new(body);
2399 if !parts.status.is_success() {
2400 let bytes = common::to_bytes(body).await.unwrap_or_default();
2401 let error = serde_json::from_str(&common::to_string(&bytes));
2402 let response = common::to_response(parts, bytes.into());
2403
2404 if let common::Retry::After(d) =
2405 dlg.http_failure(&response, error.as_ref().ok())
2406 {
2407 sleep(d).await;
2408 continue;
2409 }
2410
2411 dlg.finished(false);
2412
2413 return Err(match error {
2414 Ok(value) => common::Error::BadRequest(value),
2415 _ => common::Error::Failure(response),
2416 });
2417 }
2418 let response = {
2419 let bytes = common::to_bytes(body).await.unwrap_or_default();
2420 let encoded = common::to_string(&bytes);
2421 match serde_json::from_str(&encoded) {
2422 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2423 Err(error) => {
2424 dlg.response_json_decode_error(&encoded, &error);
2425 return Err(common::Error::JsonDecodeError(
2426 encoded.to_string(),
2427 error,
2428 ));
2429 }
2430 }
2431 };
2432
2433 dlg.finished(true);
2434 return Ok(response);
2435 }
2436 }
2437 }
2438 }
2439
2440 ///
2441 /// Sets the *request* property to the given value.
2442 ///
2443 /// Even though the property as already been set when instantiating this call,
2444 /// we provide this method for API completeness.
2445 pub fn request(
2446 mut self,
2447 new_value: UserWorkloadsConfigMap,
2448 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2449 self._request = new_value;
2450 self
2451 }
2452 /// Required. The environment name to create a ConfigMap for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
2453 ///
2454 /// Sets the *parent* path property to the given value.
2455 ///
2456 /// Even though the property as already been set when instantiating this call,
2457 /// we provide this method for API completeness.
2458 pub fn parent(
2459 mut self,
2460 new_value: &str,
2461 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2462 self._parent = new_value.to_string();
2463 self
2464 }
2465 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2466 /// while executing the actual API request.
2467 ///
2468 /// ````text
2469 /// It should be used to handle progress information, and to implement a certain level of resilience.
2470 /// ````
2471 ///
2472 /// Sets the *delegate* property to the given value.
2473 pub fn delegate(
2474 mut self,
2475 new_value: &'a mut dyn common::Delegate,
2476 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2477 self._delegate = Some(new_value);
2478 self
2479 }
2480
2481 /// Set any additional parameter of the query string used in the request.
2482 /// It should be used to set parameters which are not yet available through their own
2483 /// setters.
2484 ///
2485 /// Please note that this method must not be used to set any of the known parameters
2486 /// which have their own setter method. If done anyway, the request will fail.
2487 ///
2488 /// # Additional Parameters
2489 ///
2490 /// * *$.xgafv* (query-string) - V1 error format.
2491 /// * *access_token* (query-string) - OAuth access token.
2492 /// * *alt* (query-string) - Data format for response.
2493 /// * *callback* (query-string) - JSONP
2494 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2495 /// * *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.
2496 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2497 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2498 /// * *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.
2499 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2500 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2501 pub fn param<T>(
2502 mut self,
2503 name: T,
2504 value: T,
2505 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2506 where
2507 T: AsRef<str>,
2508 {
2509 self._additional_params
2510 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2511 self
2512 }
2513
2514 /// Identifies the authorization scope for the method you are building.
2515 ///
2516 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2517 /// [`Scope::CloudPlatform`].
2518 ///
2519 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2520 /// tokens for more than one scope.
2521 ///
2522 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2523 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2524 /// sufficient, a read-write scope will do as well.
2525 pub fn add_scope<St>(
2526 mut self,
2527 scope: St,
2528 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2529 where
2530 St: AsRef<str>,
2531 {
2532 self._scopes.insert(String::from(scope.as_ref()));
2533 self
2534 }
2535 /// Identifies the authorization scope(s) for the method you are building.
2536 ///
2537 /// See [`Self::add_scope()`] for details.
2538 pub fn add_scopes<I, St>(
2539 mut self,
2540 scopes: I,
2541 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C>
2542 where
2543 I: IntoIterator<Item = St>,
2544 St: AsRef<str>,
2545 {
2546 self._scopes
2547 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2548 self
2549 }
2550
2551 /// Removes all scopes, and no default scope will be used either.
2552 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2553 /// for details).
2554 pub fn clear_scopes(
2555 mut self,
2556 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapCreateCall<'a, C> {
2557 self._scopes.clear();
2558 self
2559 }
2560}
2561
2562/// Deletes a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
2563///
2564/// A builder for the *locations.environments.userWorkloadsConfigMaps.delete* method supported by a *project* resource.
2565/// It is not used directly, but through a [`ProjectMethods`] instance.
2566///
2567/// # Example
2568///
2569/// Instantiate a resource method builder
2570///
2571/// ```test_harness,no_run
2572/// # extern crate hyper;
2573/// # extern crate hyper_rustls;
2574/// # extern crate google_composer1 as composer1;
2575/// # async fn dox() {
2576/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2577///
2578/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2579/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2580/// # .with_native_roots()
2581/// # .unwrap()
2582/// # .https_only()
2583/// # .enable_http2()
2584/// # .build();
2585///
2586/// # let executor = hyper_util::rt::TokioExecutor::new();
2587/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2588/// # secret,
2589/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2590/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2591/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2592/// # ),
2593/// # ).build().await.unwrap();
2594///
2595/// # let client = hyper_util::client::legacy::Client::builder(
2596/// # hyper_util::rt::TokioExecutor::new()
2597/// # )
2598/// # .build(
2599/// # hyper_rustls::HttpsConnectorBuilder::new()
2600/// # .with_native_roots()
2601/// # .unwrap()
2602/// # .https_or_http()
2603/// # .enable_http2()
2604/// # .build()
2605/// # );
2606/// # let mut hub = CloudComposer::new(client, auth);
2607/// // You can configure optional parameters by calling the respective setters at will, and
2608/// // execute the final call using `doit()`.
2609/// // Values shown here are possibly random and not representative !
2610/// let result = hub.projects().locations_environments_user_workloads_config_maps_delete("name")
2611/// .doit().await;
2612/// # }
2613/// ```
2614pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2615where
2616 C: 'a,
2617{
2618 hub: &'a CloudComposer<C>,
2619 _name: String,
2620 _delegate: Option<&'a mut dyn common::Delegate>,
2621 _additional_params: HashMap<String, String>,
2622 _scopes: BTreeSet<String>,
2623}
2624
2625impl<'a, C> common::CallBuilder
2626 for ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2627{
2628}
2629
2630impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2631where
2632 C: common::Connector,
2633{
2634 /// Perform the operation you have build so far.
2635 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
2636 use std::borrow::Cow;
2637 use std::io::{Read, Seek};
2638
2639 use common::{url::Params, ToParts};
2640 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2641
2642 let mut dd = common::DefaultDelegate;
2643 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2644 dlg.begin(common::MethodInfo {
2645 id: "composer.projects.locations.environments.userWorkloadsConfigMaps.delete",
2646 http_method: hyper::Method::DELETE,
2647 });
2648
2649 for &field in ["alt", "name"].iter() {
2650 if self._additional_params.contains_key(field) {
2651 dlg.finished(false);
2652 return Err(common::Error::FieldClash(field));
2653 }
2654 }
2655
2656 let mut params = Params::with_capacity(3 + self._additional_params.len());
2657 params.push("name", self._name);
2658
2659 params.extend(self._additional_params.iter());
2660
2661 params.push("alt", "json");
2662 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2663 if self._scopes.is_empty() {
2664 self._scopes
2665 .insert(Scope::CloudPlatform.as_ref().to_string());
2666 }
2667
2668 #[allow(clippy::single_element_loop)]
2669 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2670 url = params.uri_replacement(url, param_name, find_this, true);
2671 }
2672 {
2673 let to_remove = ["name"];
2674 params.remove_params(&to_remove);
2675 }
2676
2677 let url = params.parse_with_url(&url);
2678
2679 loop {
2680 let token = match self
2681 .hub
2682 .auth
2683 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2684 .await
2685 {
2686 Ok(token) => token,
2687 Err(e) => match dlg.token(e) {
2688 Ok(token) => token,
2689 Err(e) => {
2690 dlg.finished(false);
2691 return Err(common::Error::MissingToken(e));
2692 }
2693 },
2694 };
2695 let mut req_result = {
2696 let client = &self.hub.client;
2697 dlg.pre_request();
2698 let mut req_builder = hyper::Request::builder()
2699 .method(hyper::Method::DELETE)
2700 .uri(url.as_str())
2701 .header(USER_AGENT, self.hub._user_agent.clone());
2702
2703 if let Some(token) = token.as_ref() {
2704 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
2705 }
2706
2707 let request = req_builder
2708 .header(CONTENT_LENGTH, 0_u64)
2709 .body(common::to_body::<String>(None));
2710
2711 client.request(request.unwrap()).await
2712 };
2713
2714 match req_result {
2715 Err(err) => {
2716 if let common::Retry::After(d) = dlg.http_error(&err) {
2717 sleep(d).await;
2718 continue;
2719 }
2720 dlg.finished(false);
2721 return Err(common::Error::HttpError(err));
2722 }
2723 Ok(res) => {
2724 let (mut parts, body) = res.into_parts();
2725 let mut body = common::Body::new(body);
2726 if !parts.status.is_success() {
2727 let bytes = common::to_bytes(body).await.unwrap_or_default();
2728 let error = serde_json::from_str(&common::to_string(&bytes));
2729 let response = common::to_response(parts, bytes.into());
2730
2731 if let common::Retry::After(d) =
2732 dlg.http_failure(&response, error.as_ref().ok())
2733 {
2734 sleep(d).await;
2735 continue;
2736 }
2737
2738 dlg.finished(false);
2739
2740 return Err(match error {
2741 Ok(value) => common::Error::BadRequest(value),
2742 _ => common::Error::Failure(response),
2743 });
2744 }
2745 let response = {
2746 let bytes = common::to_bytes(body).await.unwrap_or_default();
2747 let encoded = common::to_string(&bytes);
2748 match serde_json::from_str(&encoded) {
2749 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
2750 Err(error) => {
2751 dlg.response_json_decode_error(&encoded, &error);
2752 return Err(common::Error::JsonDecodeError(
2753 encoded.to_string(),
2754 error,
2755 ));
2756 }
2757 }
2758 };
2759
2760 dlg.finished(true);
2761 return Ok(response);
2762 }
2763 }
2764 }
2765 }
2766
2767 /// Required. The ConfigMap to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
2768 ///
2769 /// Sets the *name* path property to the given value.
2770 ///
2771 /// Even though the property as already been set when instantiating this call,
2772 /// we provide this method for API completeness.
2773 pub fn name(
2774 mut self,
2775 new_value: &str,
2776 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
2777 self._name = new_value.to_string();
2778 self
2779 }
2780 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
2781 /// while executing the actual API request.
2782 ///
2783 /// ````text
2784 /// It should be used to handle progress information, and to implement a certain level of resilience.
2785 /// ````
2786 ///
2787 /// Sets the *delegate* property to the given value.
2788 pub fn delegate(
2789 mut self,
2790 new_value: &'a mut dyn common::Delegate,
2791 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
2792 self._delegate = Some(new_value);
2793 self
2794 }
2795
2796 /// Set any additional parameter of the query string used in the request.
2797 /// It should be used to set parameters which are not yet available through their own
2798 /// setters.
2799 ///
2800 /// Please note that this method must not be used to set any of the known parameters
2801 /// which have their own setter method. If done anyway, the request will fail.
2802 ///
2803 /// # Additional Parameters
2804 ///
2805 /// * *$.xgafv* (query-string) - V1 error format.
2806 /// * *access_token* (query-string) - OAuth access token.
2807 /// * *alt* (query-string) - Data format for response.
2808 /// * *callback* (query-string) - JSONP
2809 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
2810 /// * *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.
2811 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
2812 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
2813 /// * *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.
2814 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
2815 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
2816 pub fn param<T>(
2817 mut self,
2818 name: T,
2819 value: T,
2820 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2821 where
2822 T: AsRef<str>,
2823 {
2824 self._additional_params
2825 .insert(name.as_ref().to_string(), value.as_ref().to_string());
2826 self
2827 }
2828
2829 /// Identifies the authorization scope for the method you are building.
2830 ///
2831 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
2832 /// [`Scope::CloudPlatform`].
2833 ///
2834 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
2835 /// tokens for more than one scope.
2836 ///
2837 /// Usually there is more than one suitable scope to authorize an operation, some of which may
2838 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
2839 /// sufficient, a read-write scope will do as well.
2840 pub fn add_scope<St>(
2841 mut self,
2842 scope: St,
2843 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2844 where
2845 St: AsRef<str>,
2846 {
2847 self._scopes.insert(String::from(scope.as_ref()));
2848 self
2849 }
2850 /// Identifies the authorization scope(s) for the method you are building.
2851 ///
2852 /// See [`Self::add_scope()`] for details.
2853 pub fn add_scopes<I, St>(
2854 mut self,
2855 scopes: I,
2856 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C>
2857 where
2858 I: IntoIterator<Item = St>,
2859 St: AsRef<str>,
2860 {
2861 self._scopes
2862 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
2863 self
2864 }
2865
2866 /// Removes all scopes, and no default scope will be used either.
2867 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
2868 /// for details).
2869 pub fn clear_scopes(
2870 mut self,
2871 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapDeleteCall<'a, C> {
2872 self._scopes.clear();
2873 self
2874 }
2875}
2876
2877/// Gets an existing user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
2878///
2879/// A builder for the *locations.environments.userWorkloadsConfigMaps.get* method supported by a *project* resource.
2880/// It is not used directly, but through a [`ProjectMethods`] instance.
2881///
2882/// # Example
2883///
2884/// Instantiate a resource method builder
2885///
2886/// ```test_harness,no_run
2887/// # extern crate hyper;
2888/// # extern crate hyper_rustls;
2889/// # extern crate google_composer1 as composer1;
2890/// # async fn dox() {
2891/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
2892///
2893/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
2894/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
2895/// # .with_native_roots()
2896/// # .unwrap()
2897/// # .https_only()
2898/// # .enable_http2()
2899/// # .build();
2900///
2901/// # let executor = hyper_util::rt::TokioExecutor::new();
2902/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
2903/// # secret,
2904/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
2905/// # yup_oauth2::client::CustomHyperClientBuilder::from(
2906/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
2907/// # ),
2908/// # ).build().await.unwrap();
2909///
2910/// # let client = hyper_util::client::legacy::Client::builder(
2911/// # hyper_util::rt::TokioExecutor::new()
2912/// # )
2913/// # .build(
2914/// # hyper_rustls::HttpsConnectorBuilder::new()
2915/// # .with_native_roots()
2916/// # .unwrap()
2917/// # .https_or_http()
2918/// # .enable_http2()
2919/// # .build()
2920/// # );
2921/// # let mut hub = CloudComposer::new(client, auth);
2922/// // You can configure optional parameters by calling the respective setters at will, and
2923/// // execute the final call using `doit()`.
2924/// // Values shown here are possibly random and not representative !
2925/// let result = hub.projects().locations_environments_user_workloads_config_maps_get("name")
2926/// .doit().await;
2927/// # }
2928/// ```
2929pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
2930where
2931 C: 'a,
2932{
2933 hub: &'a CloudComposer<C>,
2934 _name: String,
2935 _delegate: Option<&'a mut dyn common::Delegate>,
2936 _additional_params: HashMap<String, String>,
2937 _scopes: BTreeSet<String>,
2938}
2939
2940impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {}
2941
2942impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
2943where
2944 C: common::Connector,
2945{
2946 /// Perform the operation you have build so far.
2947 pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsConfigMap)> {
2948 use std::borrow::Cow;
2949 use std::io::{Read, Seek};
2950
2951 use common::{url::Params, ToParts};
2952 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
2953
2954 let mut dd = common::DefaultDelegate;
2955 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
2956 dlg.begin(common::MethodInfo {
2957 id: "composer.projects.locations.environments.userWorkloadsConfigMaps.get",
2958 http_method: hyper::Method::GET,
2959 });
2960
2961 for &field in ["alt", "name"].iter() {
2962 if self._additional_params.contains_key(field) {
2963 dlg.finished(false);
2964 return Err(common::Error::FieldClash(field));
2965 }
2966 }
2967
2968 let mut params = Params::with_capacity(3 + self._additional_params.len());
2969 params.push("name", self._name);
2970
2971 params.extend(self._additional_params.iter());
2972
2973 params.push("alt", "json");
2974 let mut url = self.hub._base_url.clone() + "v1/{+name}";
2975 if self._scopes.is_empty() {
2976 self._scopes
2977 .insert(Scope::CloudPlatform.as_ref().to_string());
2978 }
2979
2980 #[allow(clippy::single_element_loop)]
2981 for &(find_this, param_name) in [("{+name}", "name")].iter() {
2982 url = params.uri_replacement(url, param_name, find_this, true);
2983 }
2984 {
2985 let to_remove = ["name"];
2986 params.remove_params(&to_remove);
2987 }
2988
2989 let url = params.parse_with_url(&url);
2990
2991 loop {
2992 let token = match self
2993 .hub
2994 .auth
2995 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
2996 .await
2997 {
2998 Ok(token) => token,
2999 Err(e) => match dlg.token(e) {
3000 Ok(token) => token,
3001 Err(e) => {
3002 dlg.finished(false);
3003 return Err(common::Error::MissingToken(e));
3004 }
3005 },
3006 };
3007 let mut req_result = {
3008 let client = &self.hub.client;
3009 dlg.pre_request();
3010 let mut req_builder = hyper::Request::builder()
3011 .method(hyper::Method::GET)
3012 .uri(url.as_str())
3013 .header(USER_AGENT, self.hub._user_agent.clone());
3014
3015 if let Some(token) = token.as_ref() {
3016 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3017 }
3018
3019 let request = req_builder
3020 .header(CONTENT_LENGTH, 0_u64)
3021 .body(common::to_body::<String>(None));
3022
3023 client.request(request.unwrap()).await
3024 };
3025
3026 match req_result {
3027 Err(err) => {
3028 if let common::Retry::After(d) = dlg.http_error(&err) {
3029 sleep(d).await;
3030 continue;
3031 }
3032 dlg.finished(false);
3033 return Err(common::Error::HttpError(err));
3034 }
3035 Ok(res) => {
3036 let (mut parts, body) = res.into_parts();
3037 let mut body = common::Body::new(body);
3038 if !parts.status.is_success() {
3039 let bytes = common::to_bytes(body).await.unwrap_or_default();
3040 let error = serde_json::from_str(&common::to_string(&bytes));
3041 let response = common::to_response(parts, bytes.into());
3042
3043 if let common::Retry::After(d) =
3044 dlg.http_failure(&response, error.as_ref().ok())
3045 {
3046 sleep(d).await;
3047 continue;
3048 }
3049
3050 dlg.finished(false);
3051
3052 return Err(match error {
3053 Ok(value) => common::Error::BadRequest(value),
3054 _ => common::Error::Failure(response),
3055 });
3056 }
3057 let response = {
3058 let bytes = common::to_bytes(body).await.unwrap_or_default();
3059 let encoded = common::to_string(&bytes);
3060 match serde_json::from_str(&encoded) {
3061 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3062 Err(error) => {
3063 dlg.response_json_decode_error(&encoded, &error);
3064 return Err(common::Error::JsonDecodeError(
3065 encoded.to_string(),
3066 error,
3067 ));
3068 }
3069 }
3070 };
3071
3072 dlg.finished(true);
3073 return Ok(response);
3074 }
3075 }
3076 }
3077 }
3078
3079 /// Required. The resource name of the ConfigMap to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
3080 ///
3081 /// Sets the *name* path property to the given value.
3082 ///
3083 /// Even though the property as already been set when instantiating this call,
3084 /// we provide this method for API completeness.
3085 pub fn name(
3086 mut self,
3087 new_value: &str,
3088 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
3089 self._name = new_value.to_string();
3090 self
3091 }
3092 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3093 /// while executing the actual API request.
3094 ///
3095 /// ````text
3096 /// It should be used to handle progress information, and to implement a certain level of resilience.
3097 /// ````
3098 ///
3099 /// Sets the *delegate* property to the given value.
3100 pub fn delegate(
3101 mut self,
3102 new_value: &'a mut dyn common::Delegate,
3103 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
3104 self._delegate = Some(new_value);
3105 self
3106 }
3107
3108 /// Set any additional parameter of the query string used in the request.
3109 /// It should be used to set parameters which are not yet available through their own
3110 /// setters.
3111 ///
3112 /// Please note that this method must not be used to set any of the known parameters
3113 /// which have their own setter method. If done anyway, the request will fail.
3114 ///
3115 /// # Additional Parameters
3116 ///
3117 /// * *$.xgafv* (query-string) - V1 error format.
3118 /// * *access_token* (query-string) - OAuth access token.
3119 /// * *alt* (query-string) - Data format for response.
3120 /// * *callback* (query-string) - JSONP
3121 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3122 /// * *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.
3123 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3124 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3125 /// * *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.
3126 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3127 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3128 pub fn param<T>(
3129 mut self,
3130 name: T,
3131 value: T,
3132 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
3133 where
3134 T: AsRef<str>,
3135 {
3136 self._additional_params
3137 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3138 self
3139 }
3140
3141 /// Identifies the authorization scope for the method you are building.
3142 ///
3143 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3144 /// [`Scope::CloudPlatform`].
3145 ///
3146 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3147 /// tokens for more than one scope.
3148 ///
3149 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3150 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3151 /// sufficient, a read-write scope will do as well.
3152 pub fn add_scope<St>(
3153 mut self,
3154 scope: St,
3155 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
3156 where
3157 St: AsRef<str>,
3158 {
3159 self._scopes.insert(String::from(scope.as_ref()));
3160 self
3161 }
3162 /// Identifies the authorization scope(s) for the method you are building.
3163 ///
3164 /// See [`Self::add_scope()`] for details.
3165 pub fn add_scopes<I, St>(
3166 mut self,
3167 scopes: I,
3168 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C>
3169 where
3170 I: IntoIterator<Item = St>,
3171 St: AsRef<str>,
3172 {
3173 self._scopes
3174 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3175 self
3176 }
3177
3178 /// Removes all scopes, and no default scope will be used either.
3179 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3180 /// for details).
3181 pub fn clear_scopes(
3182 mut self,
3183 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapGetCall<'a, C> {
3184 self._scopes.clear();
3185 self
3186 }
3187}
3188
3189/// Lists user workloads ConfigMaps. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
3190///
3191/// A builder for the *locations.environments.userWorkloadsConfigMaps.list* method supported by a *project* resource.
3192/// It is not used directly, but through a [`ProjectMethods`] instance.
3193///
3194/// # Example
3195///
3196/// Instantiate a resource method builder
3197///
3198/// ```test_harness,no_run
3199/// # extern crate hyper;
3200/// # extern crate hyper_rustls;
3201/// # extern crate google_composer1 as composer1;
3202/// # async fn dox() {
3203/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3204///
3205/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3206/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3207/// # .with_native_roots()
3208/// # .unwrap()
3209/// # .https_only()
3210/// # .enable_http2()
3211/// # .build();
3212///
3213/// # let executor = hyper_util::rt::TokioExecutor::new();
3214/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3215/// # secret,
3216/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3217/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3218/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3219/// # ),
3220/// # ).build().await.unwrap();
3221///
3222/// # let client = hyper_util::client::legacy::Client::builder(
3223/// # hyper_util::rt::TokioExecutor::new()
3224/// # )
3225/// # .build(
3226/// # hyper_rustls::HttpsConnectorBuilder::new()
3227/// # .with_native_roots()
3228/// # .unwrap()
3229/// # .https_or_http()
3230/// # .enable_http2()
3231/// # .build()
3232/// # );
3233/// # let mut hub = CloudComposer::new(client, auth);
3234/// // You can configure optional parameters by calling the respective setters at will, and
3235/// // execute the final call using `doit()`.
3236/// // Values shown here are possibly random and not representative !
3237/// let result = hub.projects().locations_environments_user_workloads_config_maps_list("parent")
3238/// .page_token("sed")
3239/// .page_size(-2)
3240/// .doit().await;
3241/// # }
3242/// ```
3243pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3244where
3245 C: 'a,
3246{
3247 hub: &'a CloudComposer<C>,
3248 _parent: String,
3249 _page_token: Option<String>,
3250 _page_size: Option<i32>,
3251 _delegate: Option<&'a mut dyn common::Delegate>,
3252 _additional_params: HashMap<String, String>,
3253 _scopes: BTreeSet<String>,
3254}
3255
3256impl<'a, C> common::CallBuilder
3257 for ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3258{
3259}
3260
3261impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3262where
3263 C: common::Connector,
3264{
3265 /// Perform the operation you have build so far.
3266 pub async fn doit(
3267 mut self,
3268 ) -> common::Result<(common::Response, ListUserWorkloadsConfigMapsResponse)> {
3269 use std::borrow::Cow;
3270 use std::io::{Read, Seek};
3271
3272 use common::{url::Params, ToParts};
3273 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3274
3275 let mut dd = common::DefaultDelegate;
3276 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3277 dlg.begin(common::MethodInfo {
3278 id: "composer.projects.locations.environments.userWorkloadsConfigMaps.list",
3279 http_method: hyper::Method::GET,
3280 });
3281
3282 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
3283 if self._additional_params.contains_key(field) {
3284 dlg.finished(false);
3285 return Err(common::Error::FieldClash(field));
3286 }
3287 }
3288
3289 let mut params = Params::with_capacity(5 + self._additional_params.len());
3290 params.push("parent", self._parent);
3291 if let Some(value) = self._page_token.as_ref() {
3292 params.push("pageToken", value);
3293 }
3294 if let Some(value) = self._page_size.as_ref() {
3295 params.push("pageSize", value.to_string());
3296 }
3297
3298 params.extend(self._additional_params.iter());
3299
3300 params.push("alt", "json");
3301 let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsConfigMaps";
3302 if self._scopes.is_empty() {
3303 self._scopes
3304 .insert(Scope::CloudPlatform.as_ref().to_string());
3305 }
3306
3307 #[allow(clippy::single_element_loop)]
3308 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
3309 url = params.uri_replacement(url, param_name, find_this, true);
3310 }
3311 {
3312 let to_remove = ["parent"];
3313 params.remove_params(&to_remove);
3314 }
3315
3316 let url = params.parse_with_url(&url);
3317
3318 loop {
3319 let token = match self
3320 .hub
3321 .auth
3322 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3323 .await
3324 {
3325 Ok(token) => token,
3326 Err(e) => match dlg.token(e) {
3327 Ok(token) => token,
3328 Err(e) => {
3329 dlg.finished(false);
3330 return Err(common::Error::MissingToken(e));
3331 }
3332 },
3333 };
3334 let mut req_result = {
3335 let client = &self.hub.client;
3336 dlg.pre_request();
3337 let mut req_builder = hyper::Request::builder()
3338 .method(hyper::Method::GET)
3339 .uri(url.as_str())
3340 .header(USER_AGENT, self.hub._user_agent.clone());
3341
3342 if let Some(token) = token.as_ref() {
3343 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3344 }
3345
3346 let request = req_builder
3347 .header(CONTENT_LENGTH, 0_u64)
3348 .body(common::to_body::<String>(None));
3349
3350 client.request(request.unwrap()).await
3351 };
3352
3353 match req_result {
3354 Err(err) => {
3355 if let common::Retry::After(d) = dlg.http_error(&err) {
3356 sleep(d).await;
3357 continue;
3358 }
3359 dlg.finished(false);
3360 return Err(common::Error::HttpError(err));
3361 }
3362 Ok(res) => {
3363 let (mut parts, body) = res.into_parts();
3364 let mut body = common::Body::new(body);
3365 if !parts.status.is_success() {
3366 let bytes = common::to_bytes(body).await.unwrap_or_default();
3367 let error = serde_json::from_str(&common::to_string(&bytes));
3368 let response = common::to_response(parts, bytes.into());
3369
3370 if let common::Retry::After(d) =
3371 dlg.http_failure(&response, error.as_ref().ok())
3372 {
3373 sleep(d).await;
3374 continue;
3375 }
3376
3377 dlg.finished(false);
3378
3379 return Err(match error {
3380 Ok(value) => common::Error::BadRequest(value),
3381 _ => common::Error::Failure(response),
3382 });
3383 }
3384 let response = {
3385 let bytes = common::to_bytes(body).await.unwrap_or_default();
3386 let encoded = common::to_string(&bytes);
3387 match serde_json::from_str(&encoded) {
3388 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3389 Err(error) => {
3390 dlg.response_json_decode_error(&encoded, &error);
3391 return Err(common::Error::JsonDecodeError(
3392 encoded.to_string(),
3393 error,
3394 ));
3395 }
3396 }
3397 };
3398
3399 dlg.finished(true);
3400 return Ok(response);
3401 }
3402 }
3403 }
3404 }
3405
3406 /// Required. List ConfigMaps in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
3407 ///
3408 /// Sets the *parent* path property to the given value.
3409 ///
3410 /// Even though the property as already been set when instantiating this call,
3411 /// we provide this method for API completeness.
3412 pub fn parent(
3413 mut self,
3414 new_value: &str,
3415 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3416 self._parent = new_value.to_string();
3417 self
3418 }
3419 /// Optional. The next_page_token value returned from a previous List request, if any.
3420 ///
3421 /// Sets the *page token* query property to the given value.
3422 pub fn page_token(
3423 mut self,
3424 new_value: &str,
3425 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3426 self._page_token = Some(new_value.to_string());
3427 self
3428 }
3429 /// Optional. The maximum number of ConfigMaps to return.
3430 ///
3431 /// Sets the *page size* query property to the given value.
3432 pub fn page_size(
3433 mut self,
3434 new_value: i32,
3435 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3436 self._page_size = Some(new_value);
3437 self
3438 }
3439 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3440 /// while executing the actual API request.
3441 ///
3442 /// ````text
3443 /// It should be used to handle progress information, and to implement a certain level of resilience.
3444 /// ````
3445 ///
3446 /// Sets the *delegate* property to the given value.
3447 pub fn delegate(
3448 mut self,
3449 new_value: &'a mut dyn common::Delegate,
3450 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3451 self._delegate = Some(new_value);
3452 self
3453 }
3454
3455 /// Set any additional parameter of the query string used in the request.
3456 /// It should be used to set parameters which are not yet available through their own
3457 /// setters.
3458 ///
3459 /// Please note that this method must not be used to set any of the known parameters
3460 /// which have their own setter method. If done anyway, the request will fail.
3461 ///
3462 /// # Additional Parameters
3463 ///
3464 /// * *$.xgafv* (query-string) - V1 error format.
3465 /// * *access_token* (query-string) - OAuth access token.
3466 /// * *alt* (query-string) - Data format for response.
3467 /// * *callback* (query-string) - JSONP
3468 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3469 /// * *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.
3470 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3471 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3472 /// * *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.
3473 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3474 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3475 pub fn param<T>(
3476 mut self,
3477 name: T,
3478 value: T,
3479 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3480 where
3481 T: AsRef<str>,
3482 {
3483 self._additional_params
3484 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3485 self
3486 }
3487
3488 /// Identifies the authorization scope for the method you are building.
3489 ///
3490 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3491 /// [`Scope::CloudPlatform`].
3492 ///
3493 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3494 /// tokens for more than one scope.
3495 ///
3496 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3497 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3498 /// sufficient, a read-write scope will do as well.
3499 pub fn add_scope<St>(
3500 mut self,
3501 scope: St,
3502 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3503 where
3504 St: AsRef<str>,
3505 {
3506 self._scopes.insert(String::from(scope.as_ref()));
3507 self
3508 }
3509 /// Identifies the authorization scope(s) for the method you are building.
3510 ///
3511 /// See [`Self::add_scope()`] for details.
3512 pub fn add_scopes<I, St>(
3513 mut self,
3514 scopes: I,
3515 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C>
3516 where
3517 I: IntoIterator<Item = St>,
3518 St: AsRef<str>,
3519 {
3520 self._scopes
3521 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3522 self
3523 }
3524
3525 /// Removes all scopes, and no default scope will be used either.
3526 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3527 /// for details).
3528 pub fn clear_scopes(
3529 mut self,
3530 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapListCall<'a, C> {
3531 self._scopes.clear();
3532 self
3533 }
3534}
3535
3536/// Updates a user workloads ConfigMap. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
3537///
3538/// A builder for the *locations.environments.userWorkloadsConfigMaps.update* method supported by a *project* resource.
3539/// It is not used directly, but through a [`ProjectMethods`] instance.
3540///
3541/// # Example
3542///
3543/// Instantiate a resource method builder
3544///
3545/// ```test_harness,no_run
3546/// # extern crate hyper;
3547/// # extern crate hyper_rustls;
3548/// # extern crate google_composer1 as composer1;
3549/// use composer1::api::UserWorkloadsConfigMap;
3550/// # async fn dox() {
3551/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3552///
3553/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3554/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3555/// # .with_native_roots()
3556/// # .unwrap()
3557/// # .https_only()
3558/// # .enable_http2()
3559/// # .build();
3560///
3561/// # let executor = hyper_util::rt::TokioExecutor::new();
3562/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3563/// # secret,
3564/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3565/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3566/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3567/// # ),
3568/// # ).build().await.unwrap();
3569///
3570/// # let client = hyper_util::client::legacy::Client::builder(
3571/// # hyper_util::rt::TokioExecutor::new()
3572/// # )
3573/// # .build(
3574/// # hyper_rustls::HttpsConnectorBuilder::new()
3575/// # .with_native_roots()
3576/// # .unwrap()
3577/// # .https_or_http()
3578/// # .enable_http2()
3579/// # .build()
3580/// # );
3581/// # let mut hub = CloudComposer::new(client, auth);
3582/// // As the method needs a request, you would usually fill it with the desired information
3583/// // into the respective structure. Some of the parts shown here might not be applicable !
3584/// // Values shown here are possibly random and not representative !
3585/// let mut req = UserWorkloadsConfigMap::default();
3586///
3587/// // You can configure optional parameters by calling the respective setters at will, and
3588/// // execute the final call using `doit()`.
3589/// // Values shown here are possibly random and not representative !
3590/// let result = hub.projects().locations_environments_user_workloads_config_maps_update(req, "name")
3591/// .doit().await;
3592/// # }
3593/// ```
3594pub struct ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3595where
3596 C: 'a,
3597{
3598 hub: &'a CloudComposer<C>,
3599 _request: UserWorkloadsConfigMap,
3600 _name: String,
3601 _delegate: Option<&'a mut dyn common::Delegate>,
3602 _additional_params: HashMap<String, String>,
3603 _scopes: BTreeSet<String>,
3604}
3605
3606impl<'a, C> common::CallBuilder
3607 for ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3608{
3609}
3610
3611impl<'a, C> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3612where
3613 C: common::Connector,
3614{
3615 /// Perform the operation you have build so far.
3616 pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsConfigMap)> {
3617 use std::borrow::Cow;
3618 use std::io::{Read, Seek};
3619
3620 use common::{url::Params, ToParts};
3621 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3622
3623 let mut dd = common::DefaultDelegate;
3624 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3625 dlg.begin(common::MethodInfo {
3626 id: "composer.projects.locations.environments.userWorkloadsConfigMaps.update",
3627 http_method: hyper::Method::PUT,
3628 });
3629
3630 for &field in ["alt", "name"].iter() {
3631 if self._additional_params.contains_key(field) {
3632 dlg.finished(false);
3633 return Err(common::Error::FieldClash(field));
3634 }
3635 }
3636
3637 let mut params = Params::with_capacity(4 + self._additional_params.len());
3638 params.push("name", self._name);
3639
3640 params.extend(self._additional_params.iter());
3641
3642 params.push("alt", "json");
3643 let mut url = self.hub._base_url.clone() + "v1/{+name}";
3644 if self._scopes.is_empty() {
3645 self._scopes
3646 .insert(Scope::CloudPlatform.as_ref().to_string());
3647 }
3648
3649 #[allow(clippy::single_element_loop)]
3650 for &(find_this, param_name) in [("{+name}", "name")].iter() {
3651 url = params.uri_replacement(url, param_name, find_this, true);
3652 }
3653 {
3654 let to_remove = ["name"];
3655 params.remove_params(&to_remove);
3656 }
3657
3658 let url = params.parse_with_url(&url);
3659
3660 let mut json_mime_type = mime::APPLICATION_JSON;
3661 let mut request_value_reader = {
3662 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
3663 common::remove_json_null_values(&mut value);
3664 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
3665 serde_json::to_writer(&mut dst, &value).unwrap();
3666 dst
3667 };
3668 let request_size = request_value_reader
3669 .seek(std::io::SeekFrom::End(0))
3670 .unwrap();
3671 request_value_reader
3672 .seek(std::io::SeekFrom::Start(0))
3673 .unwrap();
3674
3675 loop {
3676 let token = match self
3677 .hub
3678 .auth
3679 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
3680 .await
3681 {
3682 Ok(token) => token,
3683 Err(e) => match dlg.token(e) {
3684 Ok(token) => token,
3685 Err(e) => {
3686 dlg.finished(false);
3687 return Err(common::Error::MissingToken(e));
3688 }
3689 },
3690 };
3691 request_value_reader
3692 .seek(std::io::SeekFrom::Start(0))
3693 .unwrap();
3694 let mut req_result = {
3695 let client = &self.hub.client;
3696 dlg.pre_request();
3697 let mut req_builder = hyper::Request::builder()
3698 .method(hyper::Method::PUT)
3699 .uri(url.as_str())
3700 .header(USER_AGENT, self.hub._user_agent.clone());
3701
3702 if let Some(token) = token.as_ref() {
3703 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
3704 }
3705
3706 let request = req_builder
3707 .header(CONTENT_TYPE, json_mime_type.to_string())
3708 .header(CONTENT_LENGTH, request_size as u64)
3709 .body(common::to_body(
3710 request_value_reader.get_ref().clone().into(),
3711 ));
3712
3713 client.request(request.unwrap()).await
3714 };
3715
3716 match req_result {
3717 Err(err) => {
3718 if let common::Retry::After(d) = dlg.http_error(&err) {
3719 sleep(d).await;
3720 continue;
3721 }
3722 dlg.finished(false);
3723 return Err(common::Error::HttpError(err));
3724 }
3725 Ok(res) => {
3726 let (mut parts, body) = res.into_parts();
3727 let mut body = common::Body::new(body);
3728 if !parts.status.is_success() {
3729 let bytes = common::to_bytes(body).await.unwrap_or_default();
3730 let error = serde_json::from_str(&common::to_string(&bytes));
3731 let response = common::to_response(parts, bytes.into());
3732
3733 if let common::Retry::After(d) =
3734 dlg.http_failure(&response, error.as_ref().ok())
3735 {
3736 sleep(d).await;
3737 continue;
3738 }
3739
3740 dlg.finished(false);
3741
3742 return Err(match error {
3743 Ok(value) => common::Error::BadRequest(value),
3744 _ => common::Error::Failure(response),
3745 });
3746 }
3747 let response = {
3748 let bytes = common::to_bytes(body).await.unwrap_or_default();
3749 let encoded = common::to_string(&bytes);
3750 match serde_json::from_str(&encoded) {
3751 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
3752 Err(error) => {
3753 dlg.response_json_decode_error(&encoded, &error);
3754 return Err(common::Error::JsonDecodeError(
3755 encoded.to_string(),
3756 error,
3757 ));
3758 }
3759 }
3760 };
3761
3762 dlg.finished(true);
3763 return Ok(response);
3764 }
3765 }
3766 }
3767 }
3768
3769 ///
3770 /// Sets the *request* property to the given value.
3771 ///
3772 /// Even though the property as already been set when instantiating this call,
3773 /// we provide this method for API completeness.
3774 pub fn request(
3775 mut self,
3776 new_value: UserWorkloadsConfigMap,
3777 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3778 self._request = new_value;
3779 self
3780 }
3781 /// Identifier. The resource name of the ConfigMap, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsConfigMaps/{userWorkloadsConfigMapId}"
3782 ///
3783 /// Sets the *name* path property to the given value.
3784 ///
3785 /// Even though the property as already been set when instantiating this call,
3786 /// we provide this method for API completeness.
3787 pub fn name(
3788 mut self,
3789 new_value: &str,
3790 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3791 self._name = new_value.to_string();
3792 self
3793 }
3794 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
3795 /// while executing the actual API request.
3796 ///
3797 /// ````text
3798 /// It should be used to handle progress information, and to implement a certain level of resilience.
3799 /// ````
3800 ///
3801 /// Sets the *delegate* property to the given value.
3802 pub fn delegate(
3803 mut self,
3804 new_value: &'a mut dyn common::Delegate,
3805 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3806 self._delegate = Some(new_value);
3807 self
3808 }
3809
3810 /// Set any additional parameter of the query string used in the request.
3811 /// It should be used to set parameters which are not yet available through their own
3812 /// setters.
3813 ///
3814 /// Please note that this method must not be used to set any of the known parameters
3815 /// which have their own setter method. If done anyway, the request will fail.
3816 ///
3817 /// # Additional Parameters
3818 ///
3819 /// * *$.xgafv* (query-string) - V1 error format.
3820 /// * *access_token* (query-string) - OAuth access token.
3821 /// * *alt* (query-string) - Data format for response.
3822 /// * *callback* (query-string) - JSONP
3823 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
3824 /// * *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.
3825 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
3826 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
3827 /// * *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.
3828 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
3829 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
3830 pub fn param<T>(
3831 mut self,
3832 name: T,
3833 value: T,
3834 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3835 where
3836 T: AsRef<str>,
3837 {
3838 self._additional_params
3839 .insert(name.as_ref().to_string(), value.as_ref().to_string());
3840 self
3841 }
3842
3843 /// Identifies the authorization scope for the method you are building.
3844 ///
3845 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
3846 /// [`Scope::CloudPlatform`].
3847 ///
3848 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
3849 /// tokens for more than one scope.
3850 ///
3851 /// Usually there is more than one suitable scope to authorize an operation, some of which may
3852 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
3853 /// sufficient, a read-write scope will do as well.
3854 pub fn add_scope<St>(
3855 mut self,
3856 scope: St,
3857 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3858 where
3859 St: AsRef<str>,
3860 {
3861 self._scopes.insert(String::from(scope.as_ref()));
3862 self
3863 }
3864 /// Identifies the authorization scope(s) for the method you are building.
3865 ///
3866 /// See [`Self::add_scope()`] for details.
3867 pub fn add_scopes<I, St>(
3868 mut self,
3869 scopes: I,
3870 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C>
3871 where
3872 I: IntoIterator<Item = St>,
3873 St: AsRef<str>,
3874 {
3875 self._scopes
3876 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
3877 self
3878 }
3879
3880 /// Removes all scopes, and no default scope will be used either.
3881 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
3882 /// for details).
3883 pub fn clear_scopes(
3884 mut self,
3885 ) -> ProjectLocationEnvironmentUserWorkloadsConfigMapUpdateCall<'a, C> {
3886 self._scopes.clear();
3887 self
3888 }
3889}
3890
3891/// Creates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
3892///
3893/// A builder for the *locations.environments.userWorkloadsSecrets.create* method supported by a *project* resource.
3894/// It is not used directly, but through a [`ProjectMethods`] instance.
3895///
3896/// # Example
3897///
3898/// Instantiate a resource method builder
3899///
3900/// ```test_harness,no_run
3901/// # extern crate hyper;
3902/// # extern crate hyper_rustls;
3903/// # extern crate google_composer1 as composer1;
3904/// use composer1::api::UserWorkloadsSecret;
3905/// # async fn dox() {
3906/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
3907///
3908/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
3909/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
3910/// # .with_native_roots()
3911/// # .unwrap()
3912/// # .https_only()
3913/// # .enable_http2()
3914/// # .build();
3915///
3916/// # let executor = hyper_util::rt::TokioExecutor::new();
3917/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
3918/// # secret,
3919/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
3920/// # yup_oauth2::client::CustomHyperClientBuilder::from(
3921/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
3922/// # ),
3923/// # ).build().await.unwrap();
3924///
3925/// # let client = hyper_util::client::legacy::Client::builder(
3926/// # hyper_util::rt::TokioExecutor::new()
3927/// # )
3928/// # .build(
3929/// # hyper_rustls::HttpsConnectorBuilder::new()
3930/// # .with_native_roots()
3931/// # .unwrap()
3932/// # .https_or_http()
3933/// # .enable_http2()
3934/// # .build()
3935/// # );
3936/// # let mut hub = CloudComposer::new(client, auth);
3937/// // As the method needs a request, you would usually fill it with the desired information
3938/// // into the respective structure. Some of the parts shown here might not be applicable !
3939/// // Values shown here are possibly random and not representative !
3940/// let mut req = UserWorkloadsSecret::default();
3941///
3942/// // You can configure optional parameters by calling the respective setters at will, and
3943/// // execute the final call using `doit()`.
3944/// // Values shown here are possibly random and not representative !
3945/// let result = hub.projects().locations_environments_user_workloads_secrets_create(req, "parent")
3946/// .doit().await;
3947/// # }
3948/// ```
3949pub struct ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
3950where
3951 C: 'a,
3952{
3953 hub: &'a CloudComposer<C>,
3954 _request: UserWorkloadsSecret,
3955 _parent: String,
3956 _delegate: Option<&'a mut dyn common::Delegate>,
3957 _additional_params: HashMap<String, String>,
3958 _scopes: BTreeSet<String>,
3959}
3960
3961impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {}
3962
3963impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
3964where
3965 C: common::Connector,
3966{
3967 /// Perform the operation you have build so far.
3968 pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsSecret)> {
3969 use std::borrow::Cow;
3970 use std::io::{Read, Seek};
3971
3972 use common::{url::Params, ToParts};
3973 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
3974
3975 let mut dd = common::DefaultDelegate;
3976 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
3977 dlg.begin(common::MethodInfo {
3978 id: "composer.projects.locations.environments.userWorkloadsSecrets.create",
3979 http_method: hyper::Method::POST,
3980 });
3981
3982 for &field in ["alt", "parent"].iter() {
3983 if self._additional_params.contains_key(field) {
3984 dlg.finished(false);
3985 return Err(common::Error::FieldClash(field));
3986 }
3987 }
3988
3989 let mut params = Params::with_capacity(4 + self._additional_params.len());
3990 params.push("parent", self._parent);
3991
3992 params.extend(self._additional_params.iter());
3993
3994 params.push("alt", "json");
3995 let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsSecrets";
3996 if self._scopes.is_empty() {
3997 self._scopes
3998 .insert(Scope::CloudPlatform.as_ref().to_string());
3999 }
4000
4001 #[allow(clippy::single_element_loop)]
4002 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4003 url = params.uri_replacement(url, param_name, find_this, true);
4004 }
4005 {
4006 let to_remove = ["parent"];
4007 params.remove_params(&to_remove);
4008 }
4009
4010 let url = params.parse_with_url(&url);
4011
4012 let mut json_mime_type = mime::APPLICATION_JSON;
4013 let mut request_value_reader = {
4014 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
4015 common::remove_json_null_values(&mut value);
4016 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
4017 serde_json::to_writer(&mut dst, &value).unwrap();
4018 dst
4019 };
4020 let request_size = request_value_reader
4021 .seek(std::io::SeekFrom::End(0))
4022 .unwrap();
4023 request_value_reader
4024 .seek(std::io::SeekFrom::Start(0))
4025 .unwrap();
4026
4027 loop {
4028 let token = match self
4029 .hub
4030 .auth
4031 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4032 .await
4033 {
4034 Ok(token) => token,
4035 Err(e) => match dlg.token(e) {
4036 Ok(token) => token,
4037 Err(e) => {
4038 dlg.finished(false);
4039 return Err(common::Error::MissingToken(e));
4040 }
4041 },
4042 };
4043 request_value_reader
4044 .seek(std::io::SeekFrom::Start(0))
4045 .unwrap();
4046 let mut req_result = {
4047 let client = &self.hub.client;
4048 dlg.pre_request();
4049 let mut req_builder = hyper::Request::builder()
4050 .method(hyper::Method::POST)
4051 .uri(url.as_str())
4052 .header(USER_AGENT, self.hub._user_agent.clone());
4053
4054 if let Some(token) = token.as_ref() {
4055 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4056 }
4057
4058 let request = req_builder
4059 .header(CONTENT_TYPE, json_mime_type.to_string())
4060 .header(CONTENT_LENGTH, request_size as u64)
4061 .body(common::to_body(
4062 request_value_reader.get_ref().clone().into(),
4063 ));
4064
4065 client.request(request.unwrap()).await
4066 };
4067
4068 match req_result {
4069 Err(err) => {
4070 if let common::Retry::After(d) = dlg.http_error(&err) {
4071 sleep(d).await;
4072 continue;
4073 }
4074 dlg.finished(false);
4075 return Err(common::Error::HttpError(err));
4076 }
4077 Ok(res) => {
4078 let (mut parts, body) = res.into_parts();
4079 let mut body = common::Body::new(body);
4080 if !parts.status.is_success() {
4081 let bytes = common::to_bytes(body).await.unwrap_or_default();
4082 let error = serde_json::from_str(&common::to_string(&bytes));
4083 let response = common::to_response(parts, bytes.into());
4084
4085 if let common::Retry::After(d) =
4086 dlg.http_failure(&response, error.as_ref().ok())
4087 {
4088 sleep(d).await;
4089 continue;
4090 }
4091
4092 dlg.finished(false);
4093
4094 return Err(match error {
4095 Ok(value) => common::Error::BadRequest(value),
4096 _ => common::Error::Failure(response),
4097 });
4098 }
4099 let response = {
4100 let bytes = common::to_bytes(body).await.unwrap_or_default();
4101 let encoded = common::to_string(&bytes);
4102 match serde_json::from_str(&encoded) {
4103 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4104 Err(error) => {
4105 dlg.response_json_decode_error(&encoded, &error);
4106 return Err(common::Error::JsonDecodeError(
4107 encoded.to_string(),
4108 error,
4109 ));
4110 }
4111 }
4112 };
4113
4114 dlg.finished(true);
4115 return Ok(response);
4116 }
4117 }
4118 }
4119 }
4120
4121 ///
4122 /// Sets the *request* property to the given value.
4123 ///
4124 /// Even though the property as already been set when instantiating this call,
4125 /// we provide this method for API completeness.
4126 pub fn request(
4127 mut self,
4128 new_value: UserWorkloadsSecret,
4129 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
4130 self._request = new_value;
4131 self
4132 }
4133 /// Required. The environment name to create a Secret for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
4134 ///
4135 /// Sets the *parent* path property to the given value.
4136 ///
4137 /// Even though the property as already been set when instantiating this call,
4138 /// we provide this method for API completeness.
4139 pub fn parent(
4140 mut self,
4141 new_value: &str,
4142 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
4143 self._parent = new_value.to_string();
4144 self
4145 }
4146 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4147 /// while executing the actual API request.
4148 ///
4149 /// ````text
4150 /// It should be used to handle progress information, and to implement a certain level of resilience.
4151 /// ````
4152 ///
4153 /// Sets the *delegate* property to the given value.
4154 pub fn delegate(
4155 mut self,
4156 new_value: &'a mut dyn common::Delegate,
4157 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
4158 self._delegate = Some(new_value);
4159 self
4160 }
4161
4162 /// Set any additional parameter of the query string used in the request.
4163 /// It should be used to set parameters which are not yet available through their own
4164 /// setters.
4165 ///
4166 /// Please note that this method must not be used to set any of the known parameters
4167 /// which have their own setter method. If done anyway, the request will fail.
4168 ///
4169 /// # Additional Parameters
4170 ///
4171 /// * *$.xgafv* (query-string) - V1 error format.
4172 /// * *access_token* (query-string) - OAuth access token.
4173 /// * *alt* (query-string) - Data format for response.
4174 /// * *callback* (query-string) - JSONP
4175 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4176 /// * *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.
4177 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4178 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4179 /// * *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.
4180 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4181 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4182 pub fn param<T>(
4183 mut self,
4184 name: T,
4185 value: T,
4186 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
4187 where
4188 T: AsRef<str>,
4189 {
4190 self._additional_params
4191 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4192 self
4193 }
4194
4195 /// Identifies the authorization scope for the method you are building.
4196 ///
4197 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4198 /// [`Scope::CloudPlatform`].
4199 ///
4200 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4201 /// tokens for more than one scope.
4202 ///
4203 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4204 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4205 /// sufficient, a read-write scope will do as well.
4206 pub fn add_scope<St>(
4207 mut self,
4208 scope: St,
4209 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
4210 where
4211 St: AsRef<str>,
4212 {
4213 self._scopes.insert(String::from(scope.as_ref()));
4214 self
4215 }
4216 /// Identifies the authorization scope(s) for the method you are building.
4217 ///
4218 /// See [`Self::add_scope()`] for details.
4219 pub fn add_scopes<I, St>(
4220 mut self,
4221 scopes: I,
4222 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C>
4223 where
4224 I: IntoIterator<Item = St>,
4225 St: AsRef<str>,
4226 {
4227 self._scopes
4228 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4229 self
4230 }
4231
4232 /// Removes all scopes, and no default scope will be used either.
4233 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4234 /// for details).
4235 pub fn clear_scopes(
4236 mut self,
4237 ) -> ProjectLocationEnvironmentUserWorkloadsSecretCreateCall<'a, C> {
4238 self._scopes.clear();
4239 self
4240 }
4241}
4242
4243/// Deletes a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
4244///
4245/// A builder for the *locations.environments.userWorkloadsSecrets.delete* method supported by a *project* resource.
4246/// It is not used directly, but through a [`ProjectMethods`] instance.
4247///
4248/// # Example
4249///
4250/// Instantiate a resource method builder
4251///
4252/// ```test_harness,no_run
4253/// # extern crate hyper;
4254/// # extern crate hyper_rustls;
4255/// # extern crate google_composer1 as composer1;
4256/// # async fn dox() {
4257/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4258///
4259/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4260/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4261/// # .with_native_roots()
4262/// # .unwrap()
4263/// # .https_only()
4264/// # .enable_http2()
4265/// # .build();
4266///
4267/// # let executor = hyper_util::rt::TokioExecutor::new();
4268/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4269/// # secret,
4270/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4271/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4272/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4273/// # ),
4274/// # ).build().await.unwrap();
4275///
4276/// # let client = hyper_util::client::legacy::Client::builder(
4277/// # hyper_util::rt::TokioExecutor::new()
4278/// # )
4279/// # .build(
4280/// # hyper_rustls::HttpsConnectorBuilder::new()
4281/// # .with_native_roots()
4282/// # .unwrap()
4283/// # .https_or_http()
4284/// # .enable_http2()
4285/// # .build()
4286/// # );
4287/// # let mut hub = CloudComposer::new(client, auth);
4288/// // You can configure optional parameters by calling the respective setters at will, and
4289/// // execute the final call using `doit()`.
4290/// // Values shown here are possibly random and not representative !
4291/// let result = hub.projects().locations_environments_user_workloads_secrets_delete("name")
4292/// .doit().await;
4293/// # }
4294/// ```
4295pub struct ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4296where
4297 C: 'a,
4298{
4299 hub: &'a CloudComposer<C>,
4300 _name: String,
4301 _delegate: Option<&'a mut dyn common::Delegate>,
4302 _additional_params: HashMap<String, String>,
4303 _scopes: BTreeSet<String>,
4304}
4305
4306impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {}
4307
4308impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4309where
4310 C: common::Connector,
4311{
4312 /// Perform the operation you have build so far.
4313 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
4314 use std::borrow::Cow;
4315 use std::io::{Read, Seek};
4316
4317 use common::{url::Params, ToParts};
4318 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4319
4320 let mut dd = common::DefaultDelegate;
4321 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4322 dlg.begin(common::MethodInfo {
4323 id: "composer.projects.locations.environments.userWorkloadsSecrets.delete",
4324 http_method: hyper::Method::DELETE,
4325 });
4326
4327 for &field in ["alt", "name"].iter() {
4328 if self._additional_params.contains_key(field) {
4329 dlg.finished(false);
4330 return Err(common::Error::FieldClash(field));
4331 }
4332 }
4333
4334 let mut params = Params::with_capacity(3 + self._additional_params.len());
4335 params.push("name", self._name);
4336
4337 params.extend(self._additional_params.iter());
4338
4339 params.push("alt", "json");
4340 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4341 if self._scopes.is_empty() {
4342 self._scopes
4343 .insert(Scope::CloudPlatform.as_ref().to_string());
4344 }
4345
4346 #[allow(clippy::single_element_loop)]
4347 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4348 url = params.uri_replacement(url, param_name, find_this, true);
4349 }
4350 {
4351 let to_remove = ["name"];
4352 params.remove_params(&to_remove);
4353 }
4354
4355 let url = params.parse_with_url(&url);
4356
4357 loop {
4358 let token = match self
4359 .hub
4360 .auth
4361 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4362 .await
4363 {
4364 Ok(token) => token,
4365 Err(e) => match dlg.token(e) {
4366 Ok(token) => token,
4367 Err(e) => {
4368 dlg.finished(false);
4369 return Err(common::Error::MissingToken(e));
4370 }
4371 },
4372 };
4373 let mut req_result = {
4374 let client = &self.hub.client;
4375 dlg.pre_request();
4376 let mut req_builder = hyper::Request::builder()
4377 .method(hyper::Method::DELETE)
4378 .uri(url.as_str())
4379 .header(USER_AGENT, self.hub._user_agent.clone());
4380
4381 if let Some(token) = token.as_ref() {
4382 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4383 }
4384
4385 let request = req_builder
4386 .header(CONTENT_LENGTH, 0_u64)
4387 .body(common::to_body::<String>(None));
4388
4389 client.request(request.unwrap()).await
4390 };
4391
4392 match req_result {
4393 Err(err) => {
4394 if let common::Retry::After(d) = dlg.http_error(&err) {
4395 sleep(d).await;
4396 continue;
4397 }
4398 dlg.finished(false);
4399 return Err(common::Error::HttpError(err));
4400 }
4401 Ok(res) => {
4402 let (mut parts, body) = res.into_parts();
4403 let mut body = common::Body::new(body);
4404 if !parts.status.is_success() {
4405 let bytes = common::to_bytes(body).await.unwrap_or_default();
4406 let error = serde_json::from_str(&common::to_string(&bytes));
4407 let response = common::to_response(parts, bytes.into());
4408
4409 if let common::Retry::After(d) =
4410 dlg.http_failure(&response, error.as_ref().ok())
4411 {
4412 sleep(d).await;
4413 continue;
4414 }
4415
4416 dlg.finished(false);
4417
4418 return Err(match error {
4419 Ok(value) => common::Error::BadRequest(value),
4420 _ => common::Error::Failure(response),
4421 });
4422 }
4423 let response = {
4424 let bytes = common::to_bytes(body).await.unwrap_or_default();
4425 let encoded = common::to_string(&bytes);
4426 match serde_json::from_str(&encoded) {
4427 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4428 Err(error) => {
4429 dlg.response_json_decode_error(&encoded, &error);
4430 return Err(common::Error::JsonDecodeError(
4431 encoded.to_string(),
4432 error,
4433 ));
4434 }
4435 }
4436 };
4437
4438 dlg.finished(true);
4439 return Ok(response);
4440 }
4441 }
4442 }
4443 }
4444
4445 /// Required. The Secret to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
4446 ///
4447 /// Sets the *name* path property to the given value.
4448 ///
4449 /// Even though the property as already been set when instantiating this call,
4450 /// we provide this method for API completeness.
4451 pub fn name(
4452 mut self,
4453 new_value: &str,
4454 ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
4455 self._name = new_value.to_string();
4456 self
4457 }
4458 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4459 /// while executing the actual API request.
4460 ///
4461 /// ````text
4462 /// It should be used to handle progress information, and to implement a certain level of resilience.
4463 /// ````
4464 ///
4465 /// Sets the *delegate* property to the given value.
4466 pub fn delegate(
4467 mut self,
4468 new_value: &'a mut dyn common::Delegate,
4469 ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
4470 self._delegate = Some(new_value);
4471 self
4472 }
4473
4474 /// Set any additional parameter of the query string used in the request.
4475 /// It should be used to set parameters which are not yet available through their own
4476 /// setters.
4477 ///
4478 /// Please note that this method must not be used to set any of the known parameters
4479 /// which have their own setter method. If done anyway, the request will fail.
4480 ///
4481 /// # Additional Parameters
4482 ///
4483 /// * *$.xgafv* (query-string) - V1 error format.
4484 /// * *access_token* (query-string) - OAuth access token.
4485 /// * *alt* (query-string) - Data format for response.
4486 /// * *callback* (query-string) - JSONP
4487 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4488 /// * *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.
4489 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4490 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4491 /// * *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.
4492 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4493 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4494 pub fn param<T>(
4495 mut self,
4496 name: T,
4497 value: T,
4498 ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4499 where
4500 T: AsRef<str>,
4501 {
4502 self._additional_params
4503 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4504 self
4505 }
4506
4507 /// Identifies the authorization scope for the method you are building.
4508 ///
4509 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4510 /// [`Scope::CloudPlatform`].
4511 ///
4512 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4513 /// tokens for more than one scope.
4514 ///
4515 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4516 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4517 /// sufficient, a read-write scope will do as well.
4518 pub fn add_scope<St>(
4519 mut self,
4520 scope: St,
4521 ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4522 where
4523 St: AsRef<str>,
4524 {
4525 self._scopes.insert(String::from(scope.as_ref()));
4526 self
4527 }
4528 /// Identifies the authorization scope(s) for the method you are building.
4529 ///
4530 /// See [`Self::add_scope()`] for details.
4531 pub fn add_scopes<I, St>(
4532 mut self,
4533 scopes: I,
4534 ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C>
4535 where
4536 I: IntoIterator<Item = St>,
4537 St: AsRef<str>,
4538 {
4539 self._scopes
4540 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4541 self
4542 }
4543
4544 /// Removes all scopes, and no default scope will be used either.
4545 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4546 /// for details).
4547 pub fn clear_scopes(
4548 mut self,
4549 ) -> ProjectLocationEnvironmentUserWorkloadsSecretDeleteCall<'a, C> {
4550 self._scopes.clear();
4551 self
4552 }
4553}
4554
4555/// 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-*.*.*-build.* and newer.
4556///
4557/// A builder for the *locations.environments.userWorkloadsSecrets.get* method supported by a *project* resource.
4558/// It is not used directly, but through a [`ProjectMethods`] instance.
4559///
4560/// # Example
4561///
4562/// Instantiate a resource method builder
4563///
4564/// ```test_harness,no_run
4565/// # extern crate hyper;
4566/// # extern crate hyper_rustls;
4567/// # extern crate google_composer1 as composer1;
4568/// # async fn dox() {
4569/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4570///
4571/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4572/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4573/// # .with_native_roots()
4574/// # .unwrap()
4575/// # .https_only()
4576/// # .enable_http2()
4577/// # .build();
4578///
4579/// # let executor = hyper_util::rt::TokioExecutor::new();
4580/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4581/// # secret,
4582/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4583/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4584/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4585/// # ),
4586/// # ).build().await.unwrap();
4587///
4588/// # let client = hyper_util::client::legacy::Client::builder(
4589/// # hyper_util::rt::TokioExecutor::new()
4590/// # )
4591/// # .build(
4592/// # hyper_rustls::HttpsConnectorBuilder::new()
4593/// # .with_native_roots()
4594/// # .unwrap()
4595/// # .https_or_http()
4596/// # .enable_http2()
4597/// # .build()
4598/// # );
4599/// # let mut hub = CloudComposer::new(client, auth);
4600/// // You can configure optional parameters by calling the respective setters at will, and
4601/// // execute the final call using `doit()`.
4602/// // Values shown here are possibly random and not representative !
4603/// let result = hub.projects().locations_environments_user_workloads_secrets_get("name")
4604/// .doit().await;
4605/// # }
4606/// ```
4607pub struct ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4608where
4609 C: 'a,
4610{
4611 hub: &'a CloudComposer<C>,
4612 _name: String,
4613 _delegate: Option<&'a mut dyn common::Delegate>,
4614 _additional_params: HashMap<String, String>,
4615 _scopes: BTreeSet<String>,
4616}
4617
4618impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {}
4619
4620impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4621where
4622 C: common::Connector,
4623{
4624 /// Perform the operation you have build so far.
4625 pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsSecret)> {
4626 use std::borrow::Cow;
4627 use std::io::{Read, Seek};
4628
4629 use common::{url::Params, ToParts};
4630 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4631
4632 let mut dd = common::DefaultDelegate;
4633 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4634 dlg.begin(common::MethodInfo {
4635 id: "composer.projects.locations.environments.userWorkloadsSecrets.get",
4636 http_method: hyper::Method::GET,
4637 });
4638
4639 for &field in ["alt", "name"].iter() {
4640 if self._additional_params.contains_key(field) {
4641 dlg.finished(false);
4642 return Err(common::Error::FieldClash(field));
4643 }
4644 }
4645
4646 let mut params = Params::with_capacity(3 + self._additional_params.len());
4647 params.push("name", self._name);
4648
4649 params.extend(self._additional_params.iter());
4650
4651 params.push("alt", "json");
4652 let mut url = self.hub._base_url.clone() + "v1/{+name}";
4653 if self._scopes.is_empty() {
4654 self._scopes
4655 .insert(Scope::CloudPlatform.as_ref().to_string());
4656 }
4657
4658 #[allow(clippy::single_element_loop)]
4659 for &(find_this, param_name) in [("{+name}", "name")].iter() {
4660 url = params.uri_replacement(url, param_name, find_this, true);
4661 }
4662 {
4663 let to_remove = ["name"];
4664 params.remove_params(&to_remove);
4665 }
4666
4667 let url = params.parse_with_url(&url);
4668
4669 loop {
4670 let token = match self
4671 .hub
4672 .auth
4673 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4674 .await
4675 {
4676 Ok(token) => token,
4677 Err(e) => match dlg.token(e) {
4678 Ok(token) => token,
4679 Err(e) => {
4680 dlg.finished(false);
4681 return Err(common::Error::MissingToken(e));
4682 }
4683 },
4684 };
4685 let mut req_result = {
4686 let client = &self.hub.client;
4687 dlg.pre_request();
4688 let mut req_builder = hyper::Request::builder()
4689 .method(hyper::Method::GET)
4690 .uri(url.as_str())
4691 .header(USER_AGENT, self.hub._user_agent.clone());
4692
4693 if let Some(token) = token.as_ref() {
4694 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
4695 }
4696
4697 let request = req_builder
4698 .header(CONTENT_LENGTH, 0_u64)
4699 .body(common::to_body::<String>(None));
4700
4701 client.request(request.unwrap()).await
4702 };
4703
4704 match req_result {
4705 Err(err) => {
4706 if let common::Retry::After(d) = dlg.http_error(&err) {
4707 sleep(d).await;
4708 continue;
4709 }
4710 dlg.finished(false);
4711 return Err(common::Error::HttpError(err));
4712 }
4713 Ok(res) => {
4714 let (mut parts, body) = res.into_parts();
4715 let mut body = common::Body::new(body);
4716 if !parts.status.is_success() {
4717 let bytes = common::to_bytes(body).await.unwrap_or_default();
4718 let error = serde_json::from_str(&common::to_string(&bytes));
4719 let response = common::to_response(parts, bytes.into());
4720
4721 if let common::Retry::After(d) =
4722 dlg.http_failure(&response, error.as_ref().ok())
4723 {
4724 sleep(d).await;
4725 continue;
4726 }
4727
4728 dlg.finished(false);
4729
4730 return Err(match error {
4731 Ok(value) => common::Error::BadRequest(value),
4732 _ => common::Error::Failure(response),
4733 });
4734 }
4735 let response = {
4736 let bytes = common::to_bytes(body).await.unwrap_or_default();
4737 let encoded = common::to_string(&bytes);
4738 match serde_json::from_str(&encoded) {
4739 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
4740 Err(error) => {
4741 dlg.response_json_decode_error(&encoded, &error);
4742 return Err(common::Error::JsonDecodeError(
4743 encoded.to_string(),
4744 error,
4745 ));
4746 }
4747 }
4748 };
4749
4750 dlg.finished(true);
4751 return Ok(response);
4752 }
4753 }
4754 }
4755 }
4756
4757 /// Required. The resource name of the Secret to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
4758 ///
4759 /// Sets the *name* path property to the given value.
4760 ///
4761 /// Even though the property as already been set when instantiating this call,
4762 /// we provide this method for API completeness.
4763 pub fn name(
4764 mut self,
4765 new_value: &str,
4766 ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
4767 self._name = new_value.to_string();
4768 self
4769 }
4770 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
4771 /// while executing the actual API request.
4772 ///
4773 /// ````text
4774 /// It should be used to handle progress information, and to implement a certain level of resilience.
4775 /// ````
4776 ///
4777 /// Sets the *delegate* property to the given value.
4778 pub fn delegate(
4779 mut self,
4780 new_value: &'a mut dyn common::Delegate,
4781 ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
4782 self._delegate = Some(new_value);
4783 self
4784 }
4785
4786 /// Set any additional parameter of the query string used in the request.
4787 /// It should be used to set parameters which are not yet available through their own
4788 /// setters.
4789 ///
4790 /// Please note that this method must not be used to set any of the known parameters
4791 /// which have their own setter method. If done anyway, the request will fail.
4792 ///
4793 /// # Additional Parameters
4794 ///
4795 /// * *$.xgafv* (query-string) - V1 error format.
4796 /// * *access_token* (query-string) - OAuth access token.
4797 /// * *alt* (query-string) - Data format for response.
4798 /// * *callback* (query-string) - JSONP
4799 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
4800 /// * *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.
4801 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
4802 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
4803 /// * *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.
4804 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
4805 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
4806 pub fn param<T>(
4807 mut self,
4808 name: T,
4809 value: T,
4810 ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4811 where
4812 T: AsRef<str>,
4813 {
4814 self._additional_params
4815 .insert(name.as_ref().to_string(), value.as_ref().to_string());
4816 self
4817 }
4818
4819 /// Identifies the authorization scope for the method you are building.
4820 ///
4821 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
4822 /// [`Scope::CloudPlatform`].
4823 ///
4824 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
4825 /// tokens for more than one scope.
4826 ///
4827 /// Usually there is more than one suitable scope to authorize an operation, some of which may
4828 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
4829 /// sufficient, a read-write scope will do as well.
4830 pub fn add_scope<St>(
4831 mut self,
4832 scope: St,
4833 ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4834 where
4835 St: AsRef<str>,
4836 {
4837 self._scopes.insert(String::from(scope.as_ref()));
4838 self
4839 }
4840 /// Identifies the authorization scope(s) for the method you are building.
4841 ///
4842 /// See [`Self::add_scope()`] for details.
4843 pub fn add_scopes<I, St>(
4844 mut self,
4845 scopes: I,
4846 ) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C>
4847 where
4848 I: IntoIterator<Item = St>,
4849 St: AsRef<str>,
4850 {
4851 self._scopes
4852 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
4853 self
4854 }
4855
4856 /// Removes all scopes, and no default scope will be used either.
4857 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
4858 /// for details).
4859 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentUserWorkloadsSecretGetCall<'a, C> {
4860 self._scopes.clear();
4861 self
4862 }
4863}
4864
4865/// Lists user workloads Secrets. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
4866///
4867/// A builder for the *locations.environments.userWorkloadsSecrets.list* method supported by a *project* resource.
4868/// It is not used directly, but through a [`ProjectMethods`] instance.
4869///
4870/// # Example
4871///
4872/// Instantiate a resource method builder
4873///
4874/// ```test_harness,no_run
4875/// # extern crate hyper;
4876/// # extern crate hyper_rustls;
4877/// # extern crate google_composer1 as composer1;
4878/// # async fn dox() {
4879/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4880///
4881/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
4882/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
4883/// # .with_native_roots()
4884/// # .unwrap()
4885/// # .https_only()
4886/// # .enable_http2()
4887/// # .build();
4888///
4889/// # let executor = hyper_util::rt::TokioExecutor::new();
4890/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
4891/// # secret,
4892/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4893/// # yup_oauth2::client::CustomHyperClientBuilder::from(
4894/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
4895/// # ),
4896/// # ).build().await.unwrap();
4897///
4898/// # let client = hyper_util::client::legacy::Client::builder(
4899/// # hyper_util::rt::TokioExecutor::new()
4900/// # )
4901/// # .build(
4902/// # hyper_rustls::HttpsConnectorBuilder::new()
4903/// # .with_native_roots()
4904/// # .unwrap()
4905/// # .https_or_http()
4906/// # .enable_http2()
4907/// # .build()
4908/// # );
4909/// # let mut hub = CloudComposer::new(client, auth);
4910/// // You can configure optional parameters by calling the respective setters at will, and
4911/// // execute the final call using `doit()`.
4912/// // Values shown here are possibly random and not representative !
4913/// let result = hub.projects().locations_environments_user_workloads_secrets_list("parent")
4914/// .page_token("Lorem")
4915/// .page_size(-12)
4916/// .doit().await;
4917/// # }
4918/// ```
4919pub struct ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
4920where
4921 C: 'a,
4922{
4923 hub: &'a CloudComposer<C>,
4924 _parent: String,
4925 _page_token: Option<String>,
4926 _page_size: Option<i32>,
4927 _delegate: Option<&'a mut dyn common::Delegate>,
4928 _additional_params: HashMap<String, String>,
4929 _scopes: BTreeSet<String>,
4930}
4931
4932impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {}
4933
4934impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
4935where
4936 C: common::Connector,
4937{
4938 /// Perform the operation you have build so far.
4939 pub async fn doit(
4940 mut self,
4941 ) -> common::Result<(common::Response, ListUserWorkloadsSecretsResponse)> {
4942 use std::borrow::Cow;
4943 use std::io::{Read, Seek};
4944
4945 use common::{url::Params, ToParts};
4946 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
4947
4948 let mut dd = common::DefaultDelegate;
4949 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
4950 dlg.begin(common::MethodInfo {
4951 id: "composer.projects.locations.environments.userWorkloadsSecrets.list",
4952 http_method: hyper::Method::GET,
4953 });
4954
4955 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
4956 if self._additional_params.contains_key(field) {
4957 dlg.finished(false);
4958 return Err(common::Error::FieldClash(field));
4959 }
4960 }
4961
4962 let mut params = Params::with_capacity(5 + self._additional_params.len());
4963 params.push("parent", self._parent);
4964 if let Some(value) = self._page_token.as_ref() {
4965 params.push("pageToken", value);
4966 }
4967 if let Some(value) = self._page_size.as_ref() {
4968 params.push("pageSize", value.to_string());
4969 }
4970
4971 params.extend(self._additional_params.iter());
4972
4973 params.push("alt", "json");
4974 let mut url = self.hub._base_url.clone() + "v1/{+parent}/userWorkloadsSecrets";
4975 if self._scopes.is_empty() {
4976 self._scopes
4977 .insert(Scope::CloudPlatform.as_ref().to_string());
4978 }
4979
4980 #[allow(clippy::single_element_loop)]
4981 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
4982 url = params.uri_replacement(url, param_name, find_this, true);
4983 }
4984 {
4985 let to_remove = ["parent"];
4986 params.remove_params(&to_remove);
4987 }
4988
4989 let url = params.parse_with_url(&url);
4990
4991 loop {
4992 let token = match self
4993 .hub
4994 .auth
4995 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
4996 .await
4997 {
4998 Ok(token) => token,
4999 Err(e) => match dlg.token(e) {
5000 Ok(token) => token,
5001 Err(e) => {
5002 dlg.finished(false);
5003 return Err(common::Error::MissingToken(e));
5004 }
5005 },
5006 };
5007 let mut req_result = {
5008 let client = &self.hub.client;
5009 dlg.pre_request();
5010 let mut req_builder = hyper::Request::builder()
5011 .method(hyper::Method::GET)
5012 .uri(url.as_str())
5013 .header(USER_AGENT, self.hub._user_agent.clone());
5014
5015 if let Some(token) = token.as_ref() {
5016 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5017 }
5018
5019 let request = req_builder
5020 .header(CONTENT_LENGTH, 0_u64)
5021 .body(common::to_body::<String>(None));
5022
5023 client.request(request.unwrap()).await
5024 };
5025
5026 match req_result {
5027 Err(err) => {
5028 if let common::Retry::After(d) = dlg.http_error(&err) {
5029 sleep(d).await;
5030 continue;
5031 }
5032 dlg.finished(false);
5033 return Err(common::Error::HttpError(err));
5034 }
5035 Ok(res) => {
5036 let (mut parts, body) = res.into_parts();
5037 let mut body = common::Body::new(body);
5038 if !parts.status.is_success() {
5039 let bytes = common::to_bytes(body).await.unwrap_or_default();
5040 let error = serde_json::from_str(&common::to_string(&bytes));
5041 let response = common::to_response(parts, bytes.into());
5042
5043 if let common::Retry::After(d) =
5044 dlg.http_failure(&response, error.as_ref().ok())
5045 {
5046 sleep(d).await;
5047 continue;
5048 }
5049
5050 dlg.finished(false);
5051
5052 return Err(match error {
5053 Ok(value) => common::Error::BadRequest(value),
5054 _ => common::Error::Failure(response),
5055 });
5056 }
5057 let response = {
5058 let bytes = common::to_bytes(body).await.unwrap_or_default();
5059 let encoded = common::to_string(&bytes);
5060 match serde_json::from_str(&encoded) {
5061 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5062 Err(error) => {
5063 dlg.response_json_decode_error(&encoded, &error);
5064 return Err(common::Error::JsonDecodeError(
5065 encoded.to_string(),
5066 error,
5067 ));
5068 }
5069 }
5070 };
5071
5072 dlg.finished(true);
5073 return Ok(response);
5074 }
5075 }
5076 }
5077 }
5078
5079 /// Required. List Secrets in the given environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
5080 ///
5081 /// Sets the *parent* path property to the given value.
5082 ///
5083 /// Even though the property as already been set when instantiating this call,
5084 /// we provide this method for API completeness.
5085 pub fn parent(
5086 mut self,
5087 new_value: &str,
5088 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
5089 self._parent = new_value.to_string();
5090 self
5091 }
5092 /// Optional. The next_page_token value returned from a previous List request, if any.
5093 ///
5094 /// Sets the *page token* query property to the given value.
5095 pub fn page_token(
5096 mut self,
5097 new_value: &str,
5098 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
5099 self._page_token = Some(new_value.to_string());
5100 self
5101 }
5102 /// Optional. The maximum number of Secrets to return.
5103 ///
5104 /// Sets the *page size* query property to the given value.
5105 pub fn page_size(
5106 mut self,
5107 new_value: i32,
5108 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
5109 self._page_size = Some(new_value);
5110 self
5111 }
5112 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5113 /// while executing the actual API request.
5114 ///
5115 /// ````text
5116 /// It should be used to handle progress information, and to implement a certain level of resilience.
5117 /// ````
5118 ///
5119 /// Sets the *delegate* property to the given value.
5120 pub fn delegate(
5121 mut self,
5122 new_value: &'a mut dyn common::Delegate,
5123 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
5124 self._delegate = Some(new_value);
5125 self
5126 }
5127
5128 /// Set any additional parameter of the query string used in the request.
5129 /// It should be used to set parameters which are not yet available through their own
5130 /// setters.
5131 ///
5132 /// Please note that this method must not be used to set any of the known parameters
5133 /// which have their own setter method. If done anyway, the request will fail.
5134 ///
5135 /// # Additional Parameters
5136 ///
5137 /// * *$.xgafv* (query-string) - V1 error format.
5138 /// * *access_token* (query-string) - OAuth access token.
5139 /// * *alt* (query-string) - Data format for response.
5140 /// * *callback* (query-string) - JSONP
5141 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5142 /// * *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.
5143 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5144 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5145 /// * *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.
5146 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5147 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5148 pub fn param<T>(
5149 mut self,
5150 name: T,
5151 value: T,
5152 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
5153 where
5154 T: AsRef<str>,
5155 {
5156 self._additional_params
5157 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5158 self
5159 }
5160
5161 /// Identifies the authorization scope for the method you are building.
5162 ///
5163 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5164 /// [`Scope::CloudPlatform`].
5165 ///
5166 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5167 /// tokens for more than one scope.
5168 ///
5169 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5170 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5171 /// sufficient, a read-write scope will do as well.
5172 pub fn add_scope<St>(
5173 mut self,
5174 scope: St,
5175 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
5176 where
5177 St: AsRef<str>,
5178 {
5179 self._scopes.insert(String::from(scope.as_ref()));
5180 self
5181 }
5182 /// Identifies the authorization scope(s) for the method you are building.
5183 ///
5184 /// See [`Self::add_scope()`] for details.
5185 pub fn add_scopes<I, St>(
5186 mut self,
5187 scopes: I,
5188 ) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C>
5189 where
5190 I: IntoIterator<Item = St>,
5191 St: AsRef<str>,
5192 {
5193 self._scopes
5194 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5195 self
5196 }
5197
5198 /// Removes all scopes, and no default scope will be used either.
5199 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5200 /// for details).
5201 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentUserWorkloadsSecretListCall<'a, C> {
5202 self._scopes.clear();
5203 self
5204 }
5205}
5206
5207/// Updates a user workloads Secret. This method is supported for Cloud Composer environments in versions composer-3-airflow-*.*.*-build.* and newer.
5208///
5209/// A builder for the *locations.environments.userWorkloadsSecrets.update* method supported by a *project* resource.
5210/// It is not used directly, but through a [`ProjectMethods`] instance.
5211///
5212/// # Example
5213///
5214/// Instantiate a resource method builder
5215///
5216/// ```test_harness,no_run
5217/// # extern crate hyper;
5218/// # extern crate hyper_rustls;
5219/// # extern crate google_composer1 as composer1;
5220/// use composer1::api::UserWorkloadsSecret;
5221/// # async fn dox() {
5222/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5223///
5224/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5225/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5226/// # .with_native_roots()
5227/// # .unwrap()
5228/// # .https_only()
5229/// # .enable_http2()
5230/// # .build();
5231///
5232/// # let executor = hyper_util::rt::TokioExecutor::new();
5233/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5234/// # secret,
5235/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5236/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5237/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5238/// # ),
5239/// # ).build().await.unwrap();
5240///
5241/// # let client = hyper_util::client::legacy::Client::builder(
5242/// # hyper_util::rt::TokioExecutor::new()
5243/// # )
5244/// # .build(
5245/// # hyper_rustls::HttpsConnectorBuilder::new()
5246/// # .with_native_roots()
5247/// # .unwrap()
5248/// # .https_or_http()
5249/// # .enable_http2()
5250/// # .build()
5251/// # );
5252/// # let mut hub = CloudComposer::new(client, auth);
5253/// // As the method needs a request, you would usually fill it with the desired information
5254/// // into the respective structure. Some of the parts shown here might not be applicable !
5255/// // Values shown here are possibly random and not representative !
5256/// let mut req = UserWorkloadsSecret::default();
5257///
5258/// // You can configure optional parameters by calling the respective setters at will, and
5259/// // execute the final call using `doit()`.
5260/// // Values shown here are possibly random and not representative !
5261/// let result = hub.projects().locations_environments_user_workloads_secrets_update(req, "name")
5262/// .doit().await;
5263/// # }
5264/// ```
5265pub struct ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5266where
5267 C: 'a,
5268{
5269 hub: &'a CloudComposer<C>,
5270 _request: UserWorkloadsSecret,
5271 _name: String,
5272 _delegate: Option<&'a mut dyn common::Delegate>,
5273 _additional_params: HashMap<String, String>,
5274 _scopes: BTreeSet<String>,
5275}
5276
5277impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {}
5278
5279impl<'a, C> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5280where
5281 C: common::Connector,
5282{
5283 /// Perform the operation you have build so far.
5284 pub async fn doit(mut self) -> common::Result<(common::Response, UserWorkloadsSecret)> {
5285 use std::borrow::Cow;
5286 use std::io::{Read, Seek};
5287
5288 use common::{url::Params, ToParts};
5289 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5290
5291 let mut dd = common::DefaultDelegate;
5292 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5293 dlg.begin(common::MethodInfo {
5294 id: "composer.projects.locations.environments.userWorkloadsSecrets.update",
5295 http_method: hyper::Method::PUT,
5296 });
5297
5298 for &field in ["alt", "name"].iter() {
5299 if self._additional_params.contains_key(field) {
5300 dlg.finished(false);
5301 return Err(common::Error::FieldClash(field));
5302 }
5303 }
5304
5305 let mut params = Params::with_capacity(4 + self._additional_params.len());
5306 params.push("name", self._name);
5307
5308 params.extend(self._additional_params.iter());
5309
5310 params.push("alt", "json");
5311 let mut url = self.hub._base_url.clone() + "v1/{+name}";
5312 if self._scopes.is_empty() {
5313 self._scopes
5314 .insert(Scope::CloudPlatform.as_ref().to_string());
5315 }
5316
5317 #[allow(clippy::single_element_loop)]
5318 for &(find_this, param_name) in [("{+name}", "name")].iter() {
5319 url = params.uri_replacement(url, param_name, find_this, true);
5320 }
5321 {
5322 let to_remove = ["name"];
5323 params.remove_params(&to_remove);
5324 }
5325
5326 let url = params.parse_with_url(&url);
5327
5328 let mut json_mime_type = mime::APPLICATION_JSON;
5329 let mut request_value_reader = {
5330 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
5331 common::remove_json_null_values(&mut value);
5332 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
5333 serde_json::to_writer(&mut dst, &value).unwrap();
5334 dst
5335 };
5336 let request_size = request_value_reader
5337 .seek(std::io::SeekFrom::End(0))
5338 .unwrap();
5339 request_value_reader
5340 .seek(std::io::SeekFrom::Start(0))
5341 .unwrap();
5342
5343 loop {
5344 let token = match self
5345 .hub
5346 .auth
5347 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5348 .await
5349 {
5350 Ok(token) => token,
5351 Err(e) => match dlg.token(e) {
5352 Ok(token) => token,
5353 Err(e) => {
5354 dlg.finished(false);
5355 return Err(common::Error::MissingToken(e));
5356 }
5357 },
5358 };
5359 request_value_reader
5360 .seek(std::io::SeekFrom::Start(0))
5361 .unwrap();
5362 let mut req_result = {
5363 let client = &self.hub.client;
5364 dlg.pre_request();
5365 let mut req_builder = hyper::Request::builder()
5366 .method(hyper::Method::PUT)
5367 .uri(url.as_str())
5368 .header(USER_AGENT, self.hub._user_agent.clone());
5369
5370 if let Some(token) = token.as_ref() {
5371 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5372 }
5373
5374 let request = req_builder
5375 .header(CONTENT_TYPE, json_mime_type.to_string())
5376 .header(CONTENT_LENGTH, request_size as u64)
5377 .body(common::to_body(
5378 request_value_reader.get_ref().clone().into(),
5379 ));
5380
5381 client.request(request.unwrap()).await
5382 };
5383
5384 match req_result {
5385 Err(err) => {
5386 if let common::Retry::After(d) = dlg.http_error(&err) {
5387 sleep(d).await;
5388 continue;
5389 }
5390 dlg.finished(false);
5391 return Err(common::Error::HttpError(err));
5392 }
5393 Ok(res) => {
5394 let (mut parts, body) = res.into_parts();
5395 let mut body = common::Body::new(body);
5396 if !parts.status.is_success() {
5397 let bytes = common::to_bytes(body).await.unwrap_or_default();
5398 let error = serde_json::from_str(&common::to_string(&bytes));
5399 let response = common::to_response(parts, bytes.into());
5400
5401 if let common::Retry::After(d) =
5402 dlg.http_failure(&response, error.as_ref().ok())
5403 {
5404 sleep(d).await;
5405 continue;
5406 }
5407
5408 dlg.finished(false);
5409
5410 return Err(match error {
5411 Ok(value) => common::Error::BadRequest(value),
5412 _ => common::Error::Failure(response),
5413 });
5414 }
5415 let response = {
5416 let bytes = common::to_bytes(body).await.unwrap_or_default();
5417 let encoded = common::to_string(&bytes);
5418 match serde_json::from_str(&encoded) {
5419 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5420 Err(error) => {
5421 dlg.response_json_decode_error(&encoded, &error);
5422 return Err(common::Error::JsonDecodeError(
5423 encoded.to_string(),
5424 error,
5425 ));
5426 }
5427 }
5428 };
5429
5430 dlg.finished(true);
5431 return Ok(response);
5432 }
5433 }
5434 }
5435 }
5436
5437 ///
5438 /// Sets the *request* property to the given value.
5439 ///
5440 /// Even though the property as already been set when instantiating this call,
5441 /// we provide this method for API completeness.
5442 pub fn request(
5443 mut self,
5444 new_value: UserWorkloadsSecret,
5445 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5446 self._request = new_value;
5447 self
5448 }
5449 /// Identifier. The resource name of the Secret, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}/userWorkloadsSecrets/{userWorkloadsSecretId}"
5450 ///
5451 /// Sets the *name* path property to the given value.
5452 ///
5453 /// Even though the property as already been set when instantiating this call,
5454 /// we provide this method for API completeness.
5455 pub fn name(
5456 mut self,
5457 new_value: &str,
5458 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5459 self._name = new_value.to_string();
5460 self
5461 }
5462 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5463 /// while executing the actual API request.
5464 ///
5465 /// ````text
5466 /// It should be used to handle progress information, and to implement a certain level of resilience.
5467 /// ````
5468 ///
5469 /// Sets the *delegate* property to the given value.
5470 pub fn delegate(
5471 mut self,
5472 new_value: &'a mut dyn common::Delegate,
5473 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5474 self._delegate = Some(new_value);
5475 self
5476 }
5477
5478 /// Set any additional parameter of the query string used in the request.
5479 /// It should be used to set parameters which are not yet available through their own
5480 /// setters.
5481 ///
5482 /// Please note that this method must not be used to set any of the known parameters
5483 /// which have their own setter method. If done anyway, the request will fail.
5484 ///
5485 /// # Additional Parameters
5486 ///
5487 /// * *$.xgafv* (query-string) - V1 error format.
5488 /// * *access_token* (query-string) - OAuth access token.
5489 /// * *alt* (query-string) - Data format for response.
5490 /// * *callback* (query-string) - JSONP
5491 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5492 /// * *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.
5493 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5494 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5495 /// * *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.
5496 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5497 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5498 pub fn param<T>(
5499 mut self,
5500 name: T,
5501 value: T,
5502 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5503 where
5504 T: AsRef<str>,
5505 {
5506 self._additional_params
5507 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5508 self
5509 }
5510
5511 /// Identifies the authorization scope for the method you are building.
5512 ///
5513 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5514 /// [`Scope::CloudPlatform`].
5515 ///
5516 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5517 /// tokens for more than one scope.
5518 ///
5519 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5520 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5521 /// sufficient, a read-write scope will do as well.
5522 pub fn add_scope<St>(
5523 mut self,
5524 scope: St,
5525 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5526 where
5527 St: AsRef<str>,
5528 {
5529 self._scopes.insert(String::from(scope.as_ref()));
5530 self
5531 }
5532 /// Identifies the authorization scope(s) for the method you are building.
5533 ///
5534 /// See [`Self::add_scope()`] for details.
5535 pub fn add_scopes<I, St>(
5536 mut self,
5537 scopes: I,
5538 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C>
5539 where
5540 I: IntoIterator<Item = St>,
5541 St: AsRef<str>,
5542 {
5543 self._scopes
5544 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5545 self
5546 }
5547
5548 /// Removes all scopes, and no default scope will be used either.
5549 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5550 /// for details).
5551 pub fn clear_scopes(
5552 mut self,
5553 ) -> ProjectLocationEnvironmentUserWorkloadsSecretUpdateCall<'a, C> {
5554 self._scopes.clear();
5555 self
5556 }
5557}
5558
5559/// 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-2.*.*-airflow-*.*.* and newer.
5560///
5561/// A builder for the *locations.environments.workloads.list* method supported by a *project* resource.
5562/// It is not used directly, but through a [`ProjectMethods`] instance.
5563///
5564/// # Example
5565///
5566/// Instantiate a resource method builder
5567///
5568/// ```test_harness,no_run
5569/// # extern crate hyper;
5570/// # extern crate hyper_rustls;
5571/// # extern crate google_composer1 as composer1;
5572/// # async fn dox() {
5573/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5574///
5575/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5576/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5577/// # .with_native_roots()
5578/// # .unwrap()
5579/// # .https_only()
5580/// # .enable_http2()
5581/// # .build();
5582///
5583/// # let executor = hyper_util::rt::TokioExecutor::new();
5584/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5585/// # secret,
5586/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5587/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5588/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5589/// # ),
5590/// # ).build().await.unwrap();
5591///
5592/// # let client = hyper_util::client::legacy::Client::builder(
5593/// # hyper_util::rt::TokioExecutor::new()
5594/// # )
5595/// # .build(
5596/// # hyper_rustls::HttpsConnectorBuilder::new()
5597/// # .with_native_roots()
5598/// # .unwrap()
5599/// # .https_or_http()
5600/// # .enable_http2()
5601/// # .build()
5602/// # );
5603/// # let mut hub = CloudComposer::new(client, auth);
5604/// // You can configure optional parameters by calling the respective setters at will, and
5605/// // execute the final call using `doit()`.
5606/// // Values shown here are possibly random and not representative !
5607/// let result = hub.projects().locations_environments_workloads_list("parent")
5608/// .page_token("ea")
5609/// .page_size(-55)
5610/// .filter("invidunt")
5611/// .doit().await;
5612/// # }
5613/// ```
5614pub struct ProjectLocationEnvironmentWorkloadListCall<'a, C>
5615where
5616 C: 'a,
5617{
5618 hub: &'a CloudComposer<C>,
5619 _parent: String,
5620 _page_token: Option<String>,
5621 _page_size: Option<i32>,
5622 _filter: Option<String>,
5623 _delegate: Option<&'a mut dyn common::Delegate>,
5624 _additional_params: HashMap<String, String>,
5625 _scopes: BTreeSet<String>,
5626}
5627
5628impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentWorkloadListCall<'a, C> {}
5629
5630impl<'a, C> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5631where
5632 C: common::Connector,
5633{
5634 /// Perform the operation you have build so far.
5635 pub async fn doit(mut self) -> common::Result<(common::Response, ListWorkloadsResponse)> {
5636 use std::borrow::Cow;
5637 use std::io::{Read, Seek};
5638
5639 use common::{url::Params, ToParts};
5640 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5641
5642 let mut dd = common::DefaultDelegate;
5643 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5644 dlg.begin(common::MethodInfo {
5645 id: "composer.projects.locations.environments.workloads.list",
5646 http_method: hyper::Method::GET,
5647 });
5648
5649 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
5650 if self._additional_params.contains_key(field) {
5651 dlg.finished(false);
5652 return Err(common::Error::FieldClash(field));
5653 }
5654 }
5655
5656 let mut params = Params::with_capacity(6 + self._additional_params.len());
5657 params.push("parent", self._parent);
5658 if let Some(value) = self._page_token.as_ref() {
5659 params.push("pageToken", value);
5660 }
5661 if let Some(value) = self._page_size.as_ref() {
5662 params.push("pageSize", value.to_string());
5663 }
5664 if let Some(value) = self._filter.as_ref() {
5665 params.push("filter", value);
5666 }
5667
5668 params.extend(self._additional_params.iter());
5669
5670 params.push("alt", "json");
5671 let mut url = self.hub._base_url.clone() + "v1/{+parent}/workloads";
5672 if self._scopes.is_empty() {
5673 self._scopes
5674 .insert(Scope::CloudPlatform.as_ref().to_string());
5675 }
5676
5677 #[allow(clippy::single_element_loop)]
5678 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
5679 url = params.uri_replacement(url, param_name, find_this, true);
5680 }
5681 {
5682 let to_remove = ["parent"];
5683 params.remove_params(&to_remove);
5684 }
5685
5686 let url = params.parse_with_url(&url);
5687
5688 loop {
5689 let token = match self
5690 .hub
5691 .auth
5692 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
5693 .await
5694 {
5695 Ok(token) => token,
5696 Err(e) => match dlg.token(e) {
5697 Ok(token) => token,
5698 Err(e) => {
5699 dlg.finished(false);
5700 return Err(common::Error::MissingToken(e));
5701 }
5702 },
5703 };
5704 let mut req_result = {
5705 let client = &self.hub.client;
5706 dlg.pre_request();
5707 let mut req_builder = hyper::Request::builder()
5708 .method(hyper::Method::GET)
5709 .uri(url.as_str())
5710 .header(USER_AGENT, self.hub._user_agent.clone());
5711
5712 if let Some(token) = token.as_ref() {
5713 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
5714 }
5715
5716 let request = req_builder
5717 .header(CONTENT_LENGTH, 0_u64)
5718 .body(common::to_body::<String>(None));
5719
5720 client.request(request.unwrap()).await
5721 };
5722
5723 match req_result {
5724 Err(err) => {
5725 if let common::Retry::After(d) = dlg.http_error(&err) {
5726 sleep(d).await;
5727 continue;
5728 }
5729 dlg.finished(false);
5730 return Err(common::Error::HttpError(err));
5731 }
5732 Ok(res) => {
5733 let (mut parts, body) = res.into_parts();
5734 let mut body = common::Body::new(body);
5735 if !parts.status.is_success() {
5736 let bytes = common::to_bytes(body).await.unwrap_or_default();
5737 let error = serde_json::from_str(&common::to_string(&bytes));
5738 let response = common::to_response(parts, bytes.into());
5739
5740 if let common::Retry::After(d) =
5741 dlg.http_failure(&response, error.as_ref().ok())
5742 {
5743 sleep(d).await;
5744 continue;
5745 }
5746
5747 dlg.finished(false);
5748
5749 return Err(match error {
5750 Ok(value) => common::Error::BadRequest(value),
5751 _ => common::Error::Failure(response),
5752 });
5753 }
5754 let response = {
5755 let bytes = common::to_bytes(body).await.unwrap_or_default();
5756 let encoded = common::to_string(&bytes);
5757 match serde_json::from_str(&encoded) {
5758 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
5759 Err(error) => {
5760 dlg.response_json_decode_error(&encoded, &error);
5761 return Err(common::Error::JsonDecodeError(
5762 encoded.to_string(),
5763 error,
5764 ));
5765 }
5766 }
5767 };
5768
5769 dlg.finished(true);
5770 return Ok(response);
5771 }
5772 }
5773 }
5774 }
5775
5776 /// Required. The environment name to get workloads for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
5777 ///
5778 /// Sets the *parent* path property to the given value.
5779 ///
5780 /// Even though the property as already been set when instantiating this call,
5781 /// we provide this method for API completeness.
5782 pub fn parent(mut self, new_value: &str) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5783 self._parent = new_value.to_string();
5784 self
5785 }
5786 /// Optional. The next_page_token value returned from a previous List request, if any.
5787 ///
5788 /// Sets the *page token* query property to the given value.
5789 pub fn page_token(
5790 mut self,
5791 new_value: &str,
5792 ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5793 self._page_token = Some(new_value.to_string());
5794 self
5795 }
5796 /// Optional. The maximum number of environments to return.
5797 ///
5798 /// Sets the *page size* query property to the given value.
5799 pub fn page_size(
5800 mut self,
5801 new_value: i32,
5802 ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5803 self._page_size = Some(new_value);
5804 self
5805 }
5806 /// 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.
5807 ///
5808 /// Sets the *filter* query property to the given value.
5809 pub fn filter(mut self, new_value: &str) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5810 self._filter = Some(new_value.to_string());
5811 self
5812 }
5813 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
5814 /// while executing the actual API request.
5815 ///
5816 /// ````text
5817 /// It should be used to handle progress information, and to implement a certain level of resilience.
5818 /// ````
5819 ///
5820 /// Sets the *delegate* property to the given value.
5821 pub fn delegate(
5822 mut self,
5823 new_value: &'a mut dyn common::Delegate,
5824 ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5825 self._delegate = Some(new_value);
5826 self
5827 }
5828
5829 /// Set any additional parameter of the query string used in the request.
5830 /// It should be used to set parameters which are not yet available through their own
5831 /// setters.
5832 ///
5833 /// Please note that this method must not be used to set any of the known parameters
5834 /// which have their own setter method. If done anyway, the request will fail.
5835 ///
5836 /// # Additional Parameters
5837 ///
5838 /// * *$.xgafv* (query-string) - V1 error format.
5839 /// * *access_token* (query-string) - OAuth access token.
5840 /// * *alt* (query-string) - Data format for response.
5841 /// * *callback* (query-string) - JSONP
5842 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
5843 /// * *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.
5844 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
5845 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
5846 /// * *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.
5847 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
5848 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
5849 pub fn param<T>(
5850 mut self,
5851 name: T,
5852 value: T,
5853 ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5854 where
5855 T: AsRef<str>,
5856 {
5857 self._additional_params
5858 .insert(name.as_ref().to_string(), value.as_ref().to_string());
5859 self
5860 }
5861
5862 /// Identifies the authorization scope for the method you are building.
5863 ///
5864 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
5865 /// [`Scope::CloudPlatform`].
5866 ///
5867 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
5868 /// tokens for more than one scope.
5869 ///
5870 /// Usually there is more than one suitable scope to authorize an operation, some of which may
5871 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
5872 /// sufficient, a read-write scope will do as well.
5873 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5874 where
5875 St: AsRef<str>,
5876 {
5877 self._scopes.insert(String::from(scope.as_ref()));
5878 self
5879 }
5880 /// Identifies the authorization scope(s) for the method you are building.
5881 ///
5882 /// See [`Self::add_scope()`] for details.
5883 pub fn add_scopes<I, St>(
5884 mut self,
5885 scopes: I,
5886 ) -> ProjectLocationEnvironmentWorkloadListCall<'a, C>
5887 where
5888 I: IntoIterator<Item = St>,
5889 St: AsRef<str>,
5890 {
5891 self._scopes
5892 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
5893 self
5894 }
5895
5896 /// Removes all scopes, and no default scope will be used either.
5897 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
5898 /// for details).
5899 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentWorkloadListCall<'a, C> {
5900 self._scopes.clear();
5901 self
5902 }
5903}
5904
5905/// Check if an upgrade operation on the environment will succeed. In case of problems detailed info can be found in the returned Operation.
5906///
5907/// A builder for the *locations.environments.checkUpgrade* method supported by a *project* resource.
5908/// It is not used directly, but through a [`ProjectMethods`] instance.
5909///
5910/// # Example
5911///
5912/// Instantiate a resource method builder
5913///
5914/// ```test_harness,no_run
5915/// # extern crate hyper;
5916/// # extern crate hyper_rustls;
5917/// # extern crate google_composer1 as composer1;
5918/// use composer1::api::CheckUpgradeRequest;
5919/// # async fn dox() {
5920/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5921///
5922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
5923/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
5924/// # .with_native_roots()
5925/// # .unwrap()
5926/// # .https_only()
5927/// # .enable_http2()
5928/// # .build();
5929///
5930/// # let executor = hyper_util::rt::TokioExecutor::new();
5931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5932/// # secret,
5933/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5934/// # yup_oauth2::client::CustomHyperClientBuilder::from(
5935/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
5936/// # ),
5937/// # ).build().await.unwrap();
5938///
5939/// # let client = hyper_util::client::legacy::Client::builder(
5940/// # hyper_util::rt::TokioExecutor::new()
5941/// # )
5942/// # .build(
5943/// # hyper_rustls::HttpsConnectorBuilder::new()
5944/// # .with_native_roots()
5945/// # .unwrap()
5946/// # .https_or_http()
5947/// # .enable_http2()
5948/// # .build()
5949/// # );
5950/// # let mut hub = CloudComposer::new(client, auth);
5951/// // As the method needs a request, you would usually fill it with the desired information
5952/// // into the respective structure. Some of the parts shown here might not be applicable !
5953/// // Values shown here are possibly random and not representative !
5954/// let mut req = CheckUpgradeRequest::default();
5955///
5956/// // You can configure optional parameters by calling the respective setters at will, and
5957/// // execute the final call using `doit()`.
5958/// // Values shown here are possibly random and not representative !
5959/// let result = hub.projects().locations_environments_check_upgrade(req, "environment")
5960/// .doit().await;
5961/// # }
5962/// ```
5963pub struct ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
5964where
5965 C: 'a,
5966{
5967 hub: &'a CloudComposer<C>,
5968 _request: CheckUpgradeRequest,
5969 _environment: String,
5970 _delegate: Option<&'a mut dyn common::Delegate>,
5971 _additional_params: HashMap<String, String>,
5972 _scopes: BTreeSet<String>,
5973}
5974
5975impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {}
5976
5977impl<'a, C> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
5978where
5979 C: common::Connector,
5980{
5981 /// Perform the operation you have build so far.
5982 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
5983 use std::borrow::Cow;
5984 use std::io::{Read, Seek};
5985
5986 use common::{url::Params, ToParts};
5987 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
5988
5989 let mut dd = common::DefaultDelegate;
5990 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
5991 dlg.begin(common::MethodInfo {
5992 id: "composer.projects.locations.environments.checkUpgrade",
5993 http_method: hyper::Method::POST,
5994 });
5995
5996 for &field in ["alt", "environment"].iter() {
5997 if self._additional_params.contains_key(field) {
5998 dlg.finished(false);
5999 return Err(common::Error::FieldClash(field));
6000 }
6001 }
6002
6003 let mut params = Params::with_capacity(4 + self._additional_params.len());
6004 params.push("environment", self._environment);
6005
6006 params.extend(self._additional_params.iter());
6007
6008 params.push("alt", "json");
6009 let mut url = self.hub._base_url.clone() + "v1/{+environment}:checkUpgrade";
6010 if self._scopes.is_empty() {
6011 self._scopes
6012 .insert(Scope::CloudPlatform.as_ref().to_string());
6013 }
6014
6015 #[allow(clippy::single_element_loop)]
6016 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
6017 url = params.uri_replacement(url, param_name, find_this, true);
6018 }
6019 {
6020 let to_remove = ["environment"];
6021 params.remove_params(&to_remove);
6022 }
6023
6024 let url = params.parse_with_url(&url);
6025
6026 let mut json_mime_type = mime::APPLICATION_JSON;
6027 let mut request_value_reader = {
6028 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6029 common::remove_json_null_values(&mut value);
6030 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6031 serde_json::to_writer(&mut dst, &value).unwrap();
6032 dst
6033 };
6034 let request_size = request_value_reader
6035 .seek(std::io::SeekFrom::End(0))
6036 .unwrap();
6037 request_value_reader
6038 .seek(std::io::SeekFrom::Start(0))
6039 .unwrap();
6040
6041 loop {
6042 let token = match self
6043 .hub
6044 .auth
6045 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6046 .await
6047 {
6048 Ok(token) => token,
6049 Err(e) => match dlg.token(e) {
6050 Ok(token) => token,
6051 Err(e) => {
6052 dlg.finished(false);
6053 return Err(common::Error::MissingToken(e));
6054 }
6055 },
6056 };
6057 request_value_reader
6058 .seek(std::io::SeekFrom::Start(0))
6059 .unwrap();
6060 let mut req_result = {
6061 let client = &self.hub.client;
6062 dlg.pre_request();
6063 let mut req_builder = hyper::Request::builder()
6064 .method(hyper::Method::POST)
6065 .uri(url.as_str())
6066 .header(USER_AGENT, self.hub._user_agent.clone());
6067
6068 if let Some(token) = token.as_ref() {
6069 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6070 }
6071
6072 let request = req_builder
6073 .header(CONTENT_TYPE, json_mime_type.to_string())
6074 .header(CONTENT_LENGTH, request_size as u64)
6075 .body(common::to_body(
6076 request_value_reader.get_ref().clone().into(),
6077 ));
6078
6079 client.request(request.unwrap()).await
6080 };
6081
6082 match req_result {
6083 Err(err) => {
6084 if let common::Retry::After(d) = dlg.http_error(&err) {
6085 sleep(d).await;
6086 continue;
6087 }
6088 dlg.finished(false);
6089 return Err(common::Error::HttpError(err));
6090 }
6091 Ok(res) => {
6092 let (mut parts, body) = res.into_parts();
6093 let mut body = common::Body::new(body);
6094 if !parts.status.is_success() {
6095 let bytes = common::to_bytes(body).await.unwrap_or_default();
6096 let error = serde_json::from_str(&common::to_string(&bytes));
6097 let response = common::to_response(parts, bytes.into());
6098
6099 if let common::Retry::After(d) =
6100 dlg.http_failure(&response, error.as_ref().ok())
6101 {
6102 sleep(d).await;
6103 continue;
6104 }
6105
6106 dlg.finished(false);
6107
6108 return Err(match error {
6109 Ok(value) => common::Error::BadRequest(value),
6110 _ => common::Error::Failure(response),
6111 });
6112 }
6113 let response = {
6114 let bytes = common::to_bytes(body).await.unwrap_or_default();
6115 let encoded = common::to_string(&bytes);
6116 match serde_json::from_str(&encoded) {
6117 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6118 Err(error) => {
6119 dlg.response_json_decode_error(&encoded, &error);
6120 return Err(common::Error::JsonDecodeError(
6121 encoded.to_string(),
6122 error,
6123 ));
6124 }
6125 }
6126 };
6127
6128 dlg.finished(true);
6129 return Ok(response);
6130 }
6131 }
6132 }
6133 }
6134
6135 ///
6136 /// Sets the *request* property to the given value.
6137 ///
6138 /// Even though the property as already been set when instantiating this call,
6139 /// we provide this method for API completeness.
6140 pub fn request(
6141 mut self,
6142 new_value: CheckUpgradeRequest,
6143 ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
6144 self._request = new_value;
6145 self
6146 }
6147 /// Required. The resource name of the environment to check upgrade for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
6148 ///
6149 /// Sets the *environment* path property to the given value.
6150 ///
6151 /// Even though the property as already been set when instantiating this call,
6152 /// we provide this method for API completeness.
6153 pub fn environment(
6154 mut self,
6155 new_value: &str,
6156 ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
6157 self._environment = new_value.to_string();
6158 self
6159 }
6160 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6161 /// while executing the actual API request.
6162 ///
6163 /// ````text
6164 /// It should be used to handle progress information, and to implement a certain level of resilience.
6165 /// ````
6166 ///
6167 /// Sets the *delegate* property to the given value.
6168 pub fn delegate(
6169 mut self,
6170 new_value: &'a mut dyn common::Delegate,
6171 ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
6172 self._delegate = Some(new_value);
6173 self
6174 }
6175
6176 /// Set any additional parameter of the query string used in the request.
6177 /// It should be used to set parameters which are not yet available through their own
6178 /// setters.
6179 ///
6180 /// Please note that this method must not be used to set any of the known parameters
6181 /// which have their own setter method. If done anyway, the request will fail.
6182 ///
6183 /// # Additional Parameters
6184 ///
6185 /// * *$.xgafv* (query-string) - V1 error format.
6186 /// * *access_token* (query-string) - OAuth access token.
6187 /// * *alt* (query-string) - Data format for response.
6188 /// * *callback* (query-string) - JSONP
6189 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6190 /// * *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.
6191 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6192 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6193 /// * *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.
6194 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6195 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6196 pub fn param<T>(
6197 mut self,
6198 name: T,
6199 value: T,
6200 ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
6201 where
6202 T: AsRef<str>,
6203 {
6204 self._additional_params
6205 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6206 self
6207 }
6208
6209 /// Identifies the authorization scope for the method you are building.
6210 ///
6211 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6212 /// [`Scope::CloudPlatform`].
6213 ///
6214 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6215 /// tokens for more than one scope.
6216 ///
6217 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6218 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6219 /// sufficient, a read-write scope will do as well.
6220 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
6221 where
6222 St: AsRef<str>,
6223 {
6224 self._scopes.insert(String::from(scope.as_ref()));
6225 self
6226 }
6227 /// Identifies the authorization scope(s) for the method you are building.
6228 ///
6229 /// See [`Self::add_scope()`] for details.
6230 pub fn add_scopes<I, St>(
6231 mut self,
6232 scopes: I,
6233 ) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C>
6234 where
6235 I: IntoIterator<Item = St>,
6236 St: AsRef<str>,
6237 {
6238 self._scopes
6239 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6240 self
6241 }
6242
6243 /// Removes all scopes, and no default scope will be used either.
6244 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6245 /// for details).
6246 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentCheckUpgradeCall<'a, C> {
6247 self._scopes.clear();
6248 self
6249 }
6250}
6251
6252/// Create a new environment.
6253///
6254/// A builder for the *locations.environments.create* method supported by a *project* resource.
6255/// It is not used directly, but through a [`ProjectMethods`] instance.
6256///
6257/// # Example
6258///
6259/// Instantiate a resource method builder
6260///
6261/// ```test_harness,no_run
6262/// # extern crate hyper;
6263/// # extern crate hyper_rustls;
6264/// # extern crate google_composer1 as composer1;
6265/// use composer1::api::Environment;
6266/// # async fn dox() {
6267/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6268///
6269/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6270/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6271/// # .with_native_roots()
6272/// # .unwrap()
6273/// # .https_only()
6274/// # .enable_http2()
6275/// # .build();
6276///
6277/// # let executor = hyper_util::rt::TokioExecutor::new();
6278/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6279/// # secret,
6280/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6281/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6282/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6283/// # ),
6284/// # ).build().await.unwrap();
6285///
6286/// # let client = hyper_util::client::legacy::Client::builder(
6287/// # hyper_util::rt::TokioExecutor::new()
6288/// # )
6289/// # .build(
6290/// # hyper_rustls::HttpsConnectorBuilder::new()
6291/// # .with_native_roots()
6292/// # .unwrap()
6293/// # .https_or_http()
6294/// # .enable_http2()
6295/// # .build()
6296/// # );
6297/// # let mut hub = CloudComposer::new(client, auth);
6298/// // As the method needs a request, you would usually fill it with the desired information
6299/// // into the respective structure. Some of the parts shown here might not be applicable !
6300/// // Values shown here are possibly random and not representative !
6301/// let mut req = Environment::default();
6302///
6303/// // You can configure optional parameters by calling the respective setters at will, and
6304/// // execute the final call using `doit()`.
6305/// // Values shown here are possibly random and not representative !
6306/// let result = hub.projects().locations_environments_create(req, "parent")
6307/// .doit().await;
6308/// # }
6309/// ```
6310pub struct ProjectLocationEnvironmentCreateCall<'a, C>
6311where
6312 C: 'a,
6313{
6314 hub: &'a CloudComposer<C>,
6315 _request: Environment,
6316 _parent: String,
6317 _delegate: Option<&'a mut dyn common::Delegate>,
6318 _additional_params: HashMap<String, String>,
6319 _scopes: BTreeSet<String>,
6320}
6321
6322impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentCreateCall<'a, C> {}
6323
6324impl<'a, C> ProjectLocationEnvironmentCreateCall<'a, C>
6325where
6326 C: common::Connector,
6327{
6328 /// Perform the operation you have build so far.
6329 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6330 use std::borrow::Cow;
6331 use std::io::{Read, Seek};
6332
6333 use common::{url::Params, ToParts};
6334 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6335
6336 let mut dd = common::DefaultDelegate;
6337 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6338 dlg.begin(common::MethodInfo {
6339 id: "composer.projects.locations.environments.create",
6340 http_method: hyper::Method::POST,
6341 });
6342
6343 for &field in ["alt", "parent"].iter() {
6344 if self._additional_params.contains_key(field) {
6345 dlg.finished(false);
6346 return Err(common::Error::FieldClash(field));
6347 }
6348 }
6349
6350 let mut params = Params::with_capacity(4 + self._additional_params.len());
6351 params.push("parent", self._parent);
6352
6353 params.extend(self._additional_params.iter());
6354
6355 params.push("alt", "json");
6356 let mut url = self.hub._base_url.clone() + "v1/{+parent}/environments";
6357 if self._scopes.is_empty() {
6358 self._scopes
6359 .insert(Scope::CloudPlatform.as_ref().to_string());
6360 }
6361
6362 #[allow(clippy::single_element_loop)]
6363 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6364 url = params.uri_replacement(url, param_name, find_this, true);
6365 }
6366 {
6367 let to_remove = ["parent"];
6368 params.remove_params(&to_remove);
6369 }
6370
6371 let url = params.parse_with_url(&url);
6372
6373 let mut json_mime_type = mime::APPLICATION_JSON;
6374 let mut request_value_reader = {
6375 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6376 common::remove_json_null_values(&mut value);
6377 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6378 serde_json::to_writer(&mut dst, &value).unwrap();
6379 dst
6380 };
6381 let request_size = request_value_reader
6382 .seek(std::io::SeekFrom::End(0))
6383 .unwrap();
6384 request_value_reader
6385 .seek(std::io::SeekFrom::Start(0))
6386 .unwrap();
6387
6388 loop {
6389 let token = match self
6390 .hub
6391 .auth
6392 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6393 .await
6394 {
6395 Ok(token) => token,
6396 Err(e) => match dlg.token(e) {
6397 Ok(token) => token,
6398 Err(e) => {
6399 dlg.finished(false);
6400 return Err(common::Error::MissingToken(e));
6401 }
6402 },
6403 };
6404 request_value_reader
6405 .seek(std::io::SeekFrom::Start(0))
6406 .unwrap();
6407 let mut req_result = {
6408 let client = &self.hub.client;
6409 dlg.pre_request();
6410 let mut req_builder = hyper::Request::builder()
6411 .method(hyper::Method::POST)
6412 .uri(url.as_str())
6413 .header(USER_AGENT, self.hub._user_agent.clone());
6414
6415 if let Some(token) = token.as_ref() {
6416 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6417 }
6418
6419 let request = req_builder
6420 .header(CONTENT_TYPE, json_mime_type.to_string())
6421 .header(CONTENT_LENGTH, request_size as u64)
6422 .body(common::to_body(
6423 request_value_reader.get_ref().clone().into(),
6424 ));
6425
6426 client.request(request.unwrap()).await
6427 };
6428
6429 match req_result {
6430 Err(err) => {
6431 if let common::Retry::After(d) = dlg.http_error(&err) {
6432 sleep(d).await;
6433 continue;
6434 }
6435 dlg.finished(false);
6436 return Err(common::Error::HttpError(err));
6437 }
6438 Ok(res) => {
6439 let (mut parts, body) = res.into_parts();
6440 let mut body = common::Body::new(body);
6441 if !parts.status.is_success() {
6442 let bytes = common::to_bytes(body).await.unwrap_or_default();
6443 let error = serde_json::from_str(&common::to_string(&bytes));
6444 let response = common::to_response(parts, bytes.into());
6445
6446 if let common::Retry::After(d) =
6447 dlg.http_failure(&response, error.as_ref().ok())
6448 {
6449 sleep(d).await;
6450 continue;
6451 }
6452
6453 dlg.finished(false);
6454
6455 return Err(match error {
6456 Ok(value) => common::Error::BadRequest(value),
6457 _ => common::Error::Failure(response),
6458 });
6459 }
6460 let response = {
6461 let bytes = common::to_bytes(body).await.unwrap_or_default();
6462 let encoded = common::to_string(&bytes);
6463 match serde_json::from_str(&encoded) {
6464 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6465 Err(error) => {
6466 dlg.response_json_decode_error(&encoded, &error);
6467 return Err(common::Error::JsonDecodeError(
6468 encoded.to_string(),
6469 error,
6470 ));
6471 }
6472 }
6473 };
6474
6475 dlg.finished(true);
6476 return Ok(response);
6477 }
6478 }
6479 }
6480 }
6481
6482 ///
6483 /// Sets the *request* property to the given value.
6484 ///
6485 /// Even though the property as already been set when instantiating this call,
6486 /// we provide this method for API completeness.
6487 pub fn request(
6488 mut self,
6489 new_value: Environment,
6490 ) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6491 self._request = new_value;
6492 self
6493 }
6494 /// The parent must be of the form "projects/{projectId}/locations/{locationId}".
6495 ///
6496 /// Sets the *parent* path property to the given value.
6497 ///
6498 /// Even though the property as already been set when instantiating this call,
6499 /// we provide this method for API completeness.
6500 pub fn parent(mut self, new_value: &str) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6501 self._parent = new_value.to_string();
6502 self
6503 }
6504 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6505 /// while executing the actual API request.
6506 ///
6507 /// ````text
6508 /// It should be used to handle progress information, and to implement a certain level of resilience.
6509 /// ````
6510 ///
6511 /// Sets the *delegate* property to the given value.
6512 pub fn delegate(
6513 mut self,
6514 new_value: &'a mut dyn common::Delegate,
6515 ) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6516 self._delegate = Some(new_value);
6517 self
6518 }
6519
6520 /// Set any additional parameter of the query string used in the request.
6521 /// It should be used to set parameters which are not yet available through their own
6522 /// setters.
6523 ///
6524 /// Please note that this method must not be used to set any of the known parameters
6525 /// which have their own setter method. If done anyway, the request will fail.
6526 ///
6527 /// # Additional Parameters
6528 ///
6529 /// * *$.xgafv* (query-string) - V1 error format.
6530 /// * *access_token* (query-string) - OAuth access token.
6531 /// * *alt* (query-string) - Data format for response.
6532 /// * *callback* (query-string) - JSONP
6533 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6534 /// * *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.
6535 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6536 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6537 /// * *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.
6538 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6539 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6540 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentCreateCall<'a, C>
6541 where
6542 T: AsRef<str>,
6543 {
6544 self._additional_params
6545 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6546 self
6547 }
6548
6549 /// Identifies the authorization scope for the method you are building.
6550 ///
6551 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6552 /// [`Scope::CloudPlatform`].
6553 ///
6554 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6555 /// tokens for more than one scope.
6556 ///
6557 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6558 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6559 /// sufficient, a read-write scope will do as well.
6560 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentCreateCall<'a, C>
6561 where
6562 St: AsRef<str>,
6563 {
6564 self._scopes.insert(String::from(scope.as_ref()));
6565 self
6566 }
6567 /// Identifies the authorization scope(s) for the method you are building.
6568 ///
6569 /// See [`Self::add_scope()`] for details.
6570 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentCreateCall<'a, C>
6571 where
6572 I: IntoIterator<Item = St>,
6573 St: AsRef<str>,
6574 {
6575 self._scopes
6576 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6577 self
6578 }
6579
6580 /// Removes all scopes, and no default scope will be used either.
6581 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6582 /// for details).
6583 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentCreateCall<'a, C> {
6584 self._scopes.clear();
6585 self
6586 }
6587}
6588
6589/// Triggers database failover (only for highly resilient environments).
6590///
6591/// A builder for the *locations.environments.databaseFailover* method supported by a *project* resource.
6592/// It is not used directly, but through a [`ProjectMethods`] instance.
6593///
6594/// # Example
6595///
6596/// Instantiate a resource method builder
6597///
6598/// ```test_harness,no_run
6599/// # extern crate hyper;
6600/// # extern crate hyper_rustls;
6601/// # extern crate google_composer1 as composer1;
6602/// use composer1::api::DatabaseFailoverRequest;
6603/// # async fn dox() {
6604/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6605///
6606/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6607/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6608/// # .with_native_roots()
6609/// # .unwrap()
6610/// # .https_only()
6611/// # .enable_http2()
6612/// # .build();
6613///
6614/// # let executor = hyper_util::rt::TokioExecutor::new();
6615/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6616/// # secret,
6617/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6618/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6619/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6620/// # ),
6621/// # ).build().await.unwrap();
6622///
6623/// # let client = hyper_util::client::legacy::Client::builder(
6624/// # hyper_util::rt::TokioExecutor::new()
6625/// # )
6626/// # .build(
6627/// # hyper_rustls::HttpsConnectorBuilder::new()
6628/// # .with_native_roots()
6629/// # .unwrap()
6630/// # .https_or_http()
6631/// # .enable_http2()
6632/// # .build()
6633/// # );
6634/// # let mut hub = CloudComposer::new(client, auth);
6635/// // As the method needs a request, you would usually fill it with the desired information
6636/// // into the respective structure. Some of the parts shown here might not be applicable !
6637/// // Values shown here are possibly random and not representative !
6638/// let mut req = DatabaseFailoverRequest::default();
6639///
6640/// // You can configure optional parameters by calling the respective setters at will, and
6641/// // execute the final call using `doit()`.
6642/// // Values shown here are possibly random and not representative !
6643/// let result = hub.projects().locations_environments_database_failover(req, "environment")
6644/// .doit().await;
6645/// # }
6646/// ```
6647pub struct ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6648where
6649 C: 'a,
6650{
6651 hub: &'a CloudComposer<C>,
6652 _request: DatabaseFailoverRequest,
6653 _environment: String,
6654 _delegate: Option<&'a mut dyn common::Delegate>,
6655 _additional_params: HashMap<String, String>,
6656 _scopes: BTreeSet<String>,
6657}
6658
6659impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {}
6660
6661impl<'a, C> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6662where
6663 C: common::Connector,
6664{
6665 /// Perform the operation you have build so far.
6666 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6667 use std::borrow::Cow;
6668 use std::io::{Read, Seek};
6669
6670 use common::{url::Params, ToParts};
6671 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6672
6673 let mut dd = common::DefaultDelegate;
6674 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6675 dlg.begin(common::MethodInfo {
6676 id: "composer.projects.locations.environments.databaseFailover",
6677 http_method: hyper::Method::POST,
6678 });
6679
6680 for &field in ["alt", "environment"].iter() {
6681 if self._additional_params.contains_key(field) {
6682 dlg.finished(false);
6683 return Err(common::Error::FieldClash(field));
6684 }
6685 }
6686
6687 let mut params = Params::with_capacity(4 + self._additional_params.len());
6688 params.push("environment", self._environment);
6689
6690 params.extend(self._additional_params.iter());
6691
6692 params.push("alt", "json");
6693 let mut url = self.hub._base_url.clone() + "v1/{+environment}:databaseFailover";
6694 if self._scopes.is_empty() {
6695 self._scopes
6696 .insert(Scope::CloudPlatform.as_ref().to_string());
6697 }
6698
6699 #[allow(clippy::single_element_loop)]
6700 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
6701 url = params.uri_replacement(url, param_name, find_this, true);
6702 }
6703 {
6704 let to_remove = ["environment"];
6705 params.remove_params(&to_remove);
6706 }
6707
6708 let url = params.parse_with_url(&url);
6709
6710 let mut json_mime_type = mime::APPLICATION_JSON;
6711 let mut request_value_reader = {
6712 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6713 common::remove_json_null_values(&mut value);
6714 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6715 serde_json::to_writer(&mut dst, &value).unwrap();
6716 dst
6717 };
6718 let request_size = request_value_reader
6719 .seek(std::io::SeekFrom::End(0))
6720 .unwrap();
6721 request_value_reader
6722 .seek(std::io::SeekFrom::Start(0))
6723 .unwrap();
6724
6725 loop {
6726 let token = match self
6727 .hub
6728 .auth
6729 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6730 .await
6731 {
6732 Ok(token) => token,
6733 Err(e) => match dlg.token(e) {
6734 Ok(token) => token,
6735 Err(e) => {
6736 dlg.finished(false);
6737 return Err(common::Error::MissingToken(e));
6738 }
6739 },
6740 };
6741 request_value_reader
6742 .seek(std::io::SeekFrom::Start(0))
6743 .unwrap();
6744 let mut req_result = {
6745 let client = &self.hub.client;
6746 dlg.pre_request();
6747 let mut req_builder = hyper::Request::builder()
6748 .method(hyper::Method::POST)
6749 .uri(url.as_str())
6750 .header(USER_AGENT, self.hub._user_agent.clone());
6751
6752 if let Some(token) = token.as_ref() {
6753 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6754 }
6755
6756 let request = req_builder
6757 .header(CONTENT_TYPE, json_mime_type.to_string())
6758 .header(CONTENT_LENGTH, request_size as u64)
6759 .body(common::to_body(
6760 request_value_reader.get_ref().clone().into(),
6761 ));
6762
6763 client.request(request.unwrap()).await
6764 };
6765
6766 match req_result {
6767 Err(err) => {
6768 if let common::Retry::After(d) = dlg.http_error(&err) {
6769 sleep(d).await;
6770 continue;
6771 }
6772 dlg.finished(false);
6773 return Err(common::Error::HttpError(err));
6774 }
6775 Ok(res) => {
6776 let (mut parts, body) = res.into_parts();
6777 let mut body = common::Body::new(body);
6778 if !parts.status.is_success() {
6779 let bytes = common::to_bytes(body).await.unwrap_or_default();
6780 let error = serde_json::from_str(&common::to_string(&bytes));
6781 let response = common::to_response(parts, bytes.into());
6782
6783 if let common::Retry::After(d) =
6784 dlg.http_failure(&response, error.as_ref().ok())
6785 {
6786 sleep(d).await;
6787 continue;
6788 }
6789
6790 dlg.finished(false);
6791
6792 return Err(match error {
6793 Ok(value) => common::Error::BadRequest(value),
6794 _ => common::Error::Failure(response),
6795 });
6796 }
6797 let response = {
6798 let bytes = common::to_bytes(body).await.unwrap_or_default();
6799 let encoded = common::to_string(&bytes);
6800 match serde_json::from_str(&encoded) {
6801 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6802 Err(error) => {
6803 dlg.response_json_decode_error(&encoded, &error);
6804 return Err(common::Error::JsonDecodeError(
6805 encoded.to_string(),
6806 error,
6807 ));
6808 }
6809 }
6810 };
6811
6812 dlg.finished(true);
6813 return Ok(response);
6814 }
6815 }
6816 }
6817 }
6818
6819 ///
6820 /// Sets the *request* property to the given value.
6821 ///
6822 /// Even though the property as already been set when instantiating this call,
6823 /// we provide this method for API completeness.
6824 pub fn request(
6825 mut self,
6826 new_value: DatabaseFailoverRequest,
6827 ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6828 self._request = new_value;
6829 self
6830 }
6831 /// Target environment: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
6832 ///
6833 /// Sets the *environment* path property to the given value.
6834 ///
6835 /// Even though the property as already been set when instantiating this call,
6836 /// we provide this method for API completeness.
6837 pub fn environment(
6838 mut self,
6839 new_value: &str,
6840 ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6841 self._environment = new_value.to_string();
6842 self
6843 }
6844 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6845 /// while executing the actual API request.
6846 ///
6847 /// ````text
6848 /// It should be used to handle progress information, and to implement a certain level of resilience.
6849 /// ````
6850 ///
6851 /// Sets the *delegate* property to the given value.
6852 pub fn delegate(
6853 mut self,
6854 new_value: &'a mut dyn common::Delegate,
6855 ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6856 self._delegate = Some(new_value);
6857 self
6858 }
6859
6860 /// Set any additional parameter of the query string used in the request.
6861 /// It should be used to set parameters which are not yet available through their own
6862 /// setters.
6863 ///
6864 /// Please note that this method must not be used to set any of the known parameters
6865 /// which have their own setter method. If done anyway, the request will fail.
6866 ///
6867 /// # Additional Parameters
6868 ///
6869 /// * *$.xgafv* (query-string) - V1 error format.
6870 /// * *access_token* (query-string) - OAuth access token.
6871 /// * *alt* (query-string) - Data format for response.
6872 /// * *callback* (query-string) - JSONP
6873 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6874 /// * *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.
6875 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6876 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6877 /// * *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.
6878 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6879 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6880 pub fn param<T>(
6881 mut self,
6882 name: T,
6883 value: T,
6884 ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6885 where
6886 T: AsRef<str>,
6887 {
6888 self._additional_params
6889 .insert(name.as_ref().to_string(), value.as_ref().to_string());
6890 self
6891 }
6892
6893 /// Identifies the authorization scope for the method you are building.
6894 ///
6895 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6896 /// [`Scope::CloudPlatform`].
6897 ///
6898 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6899 /// tokens for more than one scope.
6900 ///
6901 /// Usually there is more than one suitable scope to authorize an operation, some of which may
6902 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6903 /// sufficient, a read-write scope will do as well.
6904 pub fn add_scope<St>(
6905 mut self,
6906 scope: St,
6907 ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6908 where
6909 St: AsRef<str>,
6910 {
6911 self._scopes.insert(String::from(scope.as_ref()));
6912 self
6913 }
6914 /// Identifies the authorization scope(s) for the method you are building.
6915 ///
6916 /// See [`Self::add_scope()`] for details.
6917 pub fn add_scopes<I, St>(
6918 mut self,
6919 scopes: I,
6920 ) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C>
6921 where
6922 I: IntoIterator<Item = St>,
6923 St: AsRef<str>,
6924 {
6925 self._scopes
6926 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6927 self
6928 }
6929
6930 /// Removes all scopes, and no default scope will be used either.
6931 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6932 /// for details).
6933 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentDatabaseFailoverCall<'a, C> {
6934 self._scopes.clear();
6935 self
6936 }
6937}
6938
6939/// Delete an environment.
6940///
6941/// A builder for the *locations.environments.delete* method supported by a *project* resource.
6942/// It is not used directly, but through a [`ProjectMethods`] instance.
6943///
6944/// # Example
6945///
6946/// Instantiate a resource method builder
6947///
6948/// ```test_harness,no_run
6949/// # extern crate hyper;
6950/// # extern crate hyper_rustls;
6951/// # extern crate google_composer1 as composer1;
6952/// # async fn dox() {
6953/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6954///
6955/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6956/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
6957/// # .with_native_roots()
6958/// # .unwrap()
6959/// # .https_only()
6960/// # .enable_http2()
6961/// # .build();
6962///
6963/// # let executor = hyper_util::rt::TokioExecutor::new();
6964/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
6965/// # secret,
6966/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6967/// # yup_oauth2::client::CustomHyperClientBuilder::from(
6968/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
6969/// # ),
6970/// # ).build().await.unwrap();
6971///
6972/// # let client = hyper_util::client::legacy::Client::builder(
6973/// # hyper_util::rt::TokioExecutor::new()
6974/// # )
6975/// # .build(
6976/// # hyper_rustls::HttpsConnectorBuilder::new()
6977/// # .with_native_roots()
6978/// # .unwrap()
6979/// # .https_or_http()
6980/// # .enable_http2()
6981/// # .build()
6982/// # );
6983/// # let mut hub = CloudComposer::new(client, auth);
6984/// // You can configure optional parameters by calling the respective setters at will, and
6985/// // execute the final call using `doit()`.
6986/// // Values shown here are possibly random and not representative !
6987/// let result = hub.projects().locations_environments_delete("name")
6988/// .doit().await;
6989/// # }
6990/// ```
6991pub struct ProjectLocationEnvironmentDeleteCall<'a, C>
6992where
6993 C: 'a,
6994{
6995 hub: &'a CloudComposer<C>,
6996 _name: String,
6997 _delegate: Option<&'a mut dyn common::Delegate>,
6998 _additional_params: HashMap<String, String>,
6999 _scopes: BTreeSet<String>,
7000}
7001
7002impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentDeleteCall<'a, C> {}
7003
7004impl<'a, C> ProjectLocationEnvironmentDeleteCall<'a, C>
7005where
7006 C: common::Connector,
7007{
7008 /// Perform the operation you have build so far.
7009 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7010 use std::borrow::Cow;
7011 use std::io::{Read, Seek};
7012
7013 use common::{url::Params, ToParts};
7014 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7015
7016 let mut dd = common::DefaultDelegate;
7017 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7018 dlg.begin(common::MethodInfo {
7019 id: "composer.projects.locations.environments.delete",
7020 http_method: hyper::Method::DELETE,
7021 });
7022
7023 for &field in ["alt", "name"].iter() {
7024 if self._additional_params.contains_key(field) {
7025 dlg.finished(false);
7026 return Err(common::Error::FieldClash(field));
7027 }
7028 }
7029
7030 let mut params = Params::with_capacity(3 + self._additional_params.len());
7031 params.push("name", self._name);
7032
7033 params.extend(self._additional_params.iter());
7034
7035 params.push("alt", "json");
7036 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7037 if self._scopes.is_empty() {
7038 self._scopes
7039 .insert(Scope::CloudPlatform.as_ref().to_string());
7040 }
7041
7042 #[allow(clippy::single_element_loop)]
7043 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7044 url = params.uri_replacement(url, param_name, find_this, true);
7045 }
7046 {
7047 let to_remove = ["name"];
7048 params.remove_params(&to_remove);
7049 }
7050
7051 let url = params.parse_with_url(&url);
7052
7053 loop {
7054 let token = match self
7055 .hub
7056 .auth
7057 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7058 .await
7059 {
7060 Ok(token) => token,
7061 Err(e) => match dlg.token(e) {
7062 Ok(token) => token,
7063 Err(e) => {
7064 dlg.finished(false);
7065 return Err(common::Error::MissingToken(e));
7066 }
7067 },
7068 };
7069 let mut req_result = {
7070 let client = &self.hub.client;
7071 dlg.pre_request();
7072 let mut req_builder = hyper::Request::builder()
7073 .method(hyper::Method::DELETE)
7074 .uri(url.as_str())
7075 .header(USER_AGENT, self.hub._user_agent.clone());
7076
7077 if let Some(token) = token.as_ref() {
7078 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7079 }
7080
7081 let request = req_builder
7082 .header(CONTENT_LENGTH, 0_u64)
7083 .body(common::to_body::<String>(None));
7084
7085 client.request(request.unwrap()).await
7086 };
7087
7088 match req_result {
7089 Err(err) => {
7090 if let common::Retry::After(d) = dlg.http_error(&err) {
7091 sleep(d).await;
7092 continue;
7093 }
7094 dlg.finished(false);
7095 return Err(common::Error::HttpError(err));
7096 }
7097 Ok(res) => {
7098 let (mut parts, body) = res.into_parts();
7099 let mut body = common::Body::new(body);
7100 if !parts.status.is_success() {
7101 let bytes = common::to_bytes(body).await.unwrap_or_default();
7102 let error = serde_json::from_str(&common::to_string(&bytes));
7103 let response = common::to_response(parts, bytes.into());
7104
7105 if let common::Retry::After(d) =
7106 dlg.http_failure(&response, error.as_ref().ok())
7107 {
7108 sleep(d).await;
7109 continue;
7110 }
7111
7112 dlg.finished(false);
7113
7114 return Err(match error {
7115 Ok(value) => common::Error::BadRequest(value),
7116 _ => common::Error::Failure(response),
7117 });
7118 }
7119 let response = {
7120 let bytes = common::to_bytes(body).await.unwrap_or_default();
7121 let encoded = common::to_string(&bytes);
7122 match serde_json::from_str(&encoded) {
7123 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7124 Err(error) => {
7125 dlg.response_json_decode_error(&encoded, &error);
7126 return Err(common::Error::JsonDecodeError(
7127 encoded.to_string(),
7128 error,
7129 ));
7130 }
7131 }
7132 };
7133
7134 dlg.finished(true);
7135 return Ok(response);
7136 }
7137 }
7138 }
7139 }
7140
7141 /// The environment to delete, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
7142 ///
7143 /// Sets the *name* path property to the given value.
7144 ///
7145 /// Even though the property as already been set when instantiating this call,
7146 /// we provide this method for API completeness.
7147 pub fn name(mut self, new_value: &str) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
7148 self._name = new_value.to_string();
7149 self
7150 }
7151 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7152 /// while executing the actual API request.
7153 ///
7154 /// ````text
7155 /// It should be used to handle progress information, and to implement a certain level of resilience.
7156 /// ````
7157 ///
7158 /// Sets the *delegate* property to the given value.
7159 pub fn delegate(
7160 mut self,
7161 new_value: &'a mut dyn common::Delegate,
7162 ) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
7163 self._delegate = Some(new_value);
7164 self
7165 }
7166
7167 /// Set any additional parameter of the query string used in the request.
7168 /// It should be used to set parameters which are not yet available through their own
7169 /// setters.
7170 ///
7171 /// Please note that this method must not be used to set any of the known parameters
7172 /// which have their own setter method. If done anyway, the request will fail.
7173 ///
7174 /// # Additional Parameters
7175 ///
7176 /// * *$.xgafv* (query-string) - V1 error format.
7177 /// * *access_token* (query-string) - OAuth access token.
7178 /// * *alt* (query-string) - Data format for response.
7179 /// * *callback* (query-string) - JSONP
7180 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7181 /// * *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.
7182 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7183 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7184 /// * *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.
7185 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7186 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7187 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentDeleteCall<'a, C>
7188 where
7189 T: AsRef<str>,
7190 {
7191 self._additional_params
7192 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7193 self
7194 }
7195
7196 /// Identifies the authorization scope for the method you are building.
7197 ///
7198 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7199 /// [`Scope::CloudPlatform`].
7200 ///
7201 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7202 /// tokens for more than one scope.
7203 ///
7204 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7205 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7206 /// sufficient, a read-write scope will do as well.
7207 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentDeleteCall<'a, C>
7208 where
7209 St: AsRef<str>,
7210 {
7211 self._scopes.insert(String::from(scope.as_ref()));
7212 self
7213 }
7214 /// Identifies the authorization scope(s) for the method you are building.
7215 ///
7216 /// See [`Self::add_scope()`] for details.
7217 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentDeleteCall<'a, C>
7218 where
7219 I: IntoIterator<Item = St>,
7220 St: AsRef<str>,
7221 {
7222 self._scopes
7223 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7224 self
7225 }
7226
7227 /// Removes all scopes, and no default scope will be used either.
7228 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7229 /// for details).
7230 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentDeleteCall<'a, C> {
7231 self._scopes.clear();
7232 self
7233 }
7234}
7235
7236/// Executes Airflow CLI command.
7237///
7238/// A builder for the *locations.environments.executeAirflowCommand* method supported by a *project* resource.
7239/// It is not used directly, but through a [`ProjectMethods`] instance.
7240///
7241/// # Example
7242///
7243/// Instantiate a resource method builder
7244///
7245/// ```test_harness,no_run
7246/// # extern crate hyper;
7247/// # extern crate hyper_rustls;
7248/// # extern crate google_composer1 as composer1;
7249/// use composer1::api::ExecuteAirflowCommandRequest;
7250/// # async fn dox() {
7251/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7252///
7253/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7254/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7255/// # .with_native_roots()
7256/// # .unwrap()
7257/// # .https_only()
7258/// # .enable_http2()
7259/// # .build();
7260///
7261/// # let executor = hyper_util::rt::TokioExecutor::new();
7262/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7263/// # secret,
7264/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7265/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7266/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7267/// # ),
7268/// # ).build().await.unwrap();
7269///
7270/// # let client = hyper_util::client::legacy::Client::builder(
7271/// # hyper_util::rt::TokioExecutor::new()
7272/// # )
7273/// # .build(
7274/// # hyper_rustls::HttpsConnectorBuilder::new()
7275/// # .with_native_roots()
7276/// # .unwrap()
7277/// # .https_or_http()
7278/// # .enable_http2()
7279/// # .build()
7280/// # );
7281/// # let mut hub = CloudComposer::new(client, auth);
7282/// // As the method needs a request, you would usually fill it with the desired information
7283/// // into the respective structure. Some of the parts shown here might not be applicable !
7284/// // Values shown here are possibly random and not representative !
7285/// let mut req = ExecuteAirflowCommandRequest::default();
7286///
7287/// // You can configure optional parameters by calling the respective setters at will, and
7288/// // execute the final call using `doit()`.
7289/// // Values shown here are possibly random and not representative !
7290/// let result = hub.projects().locations_environments_execute_airflow_command(req, "environment")
7291/// .doit().await;
7292/// # }
7293/// ```
7294pub struct ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7295where
7296 C: 'a,
7297{
7298 hub: &'a CloudComposer<C>,
7299 _request: ExecuteAirflowCommandRequest,
7300 _environment: String,
7301 _delegate: Option<&'a mut dyn common::Delegate>,
7302 _additional_params: HashMap<String, String>,
7303 _scopes: BTreeSet<String>,
7304}
7305
7306impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {}
7307
7308impl<'a, C> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7309where
7310 C: common::Connector,
7311{
7312 /// Perform the operation you have build so far.
7313 pub async fn doit(
7314 mut self,
7315 ) -> common::Result<(common::Response, ExecuteAirflowCommandResponse)> {
7316 use std::borrow::Cow;
7317 use std::io::{Read, Seek};
7318
7319 use common::{url::Params, ToParts};
7320 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7321
7322 let mut dd = common::DefaultDelegate;
7323 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7324 dlg.begin(common::MethodInfo {
7325 id: "composer.projects.locations.environments.executeAirflowCommand",
7326 http_method: hyper::Method::POST,
7327 });
7328
7329 for &field in ["alt", "environment"].iter() {
7330 if self._additional_params.contains_key(field) {
7331 dlg.finished(false);
7332 return Err(common::Error::FieldClash(field));
7333 }
7334 }
7335
7336 let mut params = Params::with_capacity(4 + self._additional_params.len());
7337 params.push("environment", self._environment);
7338
7339 params.extend(self._additional_params.iter());
7340
7341 params.push("alt", "json");
7342 let mut url = self.hub._base_url.clone() + "v1/{+environment}:executeAirflowCommand";
7343 if self._scopes.is_empty() {
7344 self._scopes
7345 .insert(Scope::CloudPlatform.as_ref().to_string());
7346 }
7347
7348 #[allow(clippy::single_element_loop)]
7349 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
7350 url = params.uri_replacement(url, param_name, find_this, true);
7351 }
7352 {
7353 let to_remove = ["environment"];
7354 params.remove_params(&to_remove);
7355 }
7356
7357 let url = params.parse_with_url(&url);
7358
7359 let mut json_mime_type = mime::APPLICATION_JSON;
7360 let mut request_value_reader = {
7361 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7362 common::remove_json_null_values(&mut value);
7363 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7364 serde_json::to_writer(&mut dst, &value).unwrap();
7365 dst
7366 };
7367 let request_size = request_value_reader
7368 .seek(std::io::SeekFrom::End(0))
7369 .unwrap();
7370 request_value_reader
7371 .seek(std::io::SeekFrom::Start(0))
7372 .unwrap();
7373
7374 loop {
7375 let token = match self
7376 .hub
7377 .auth
7378 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7379 .await
7380 {
7381 Ok(token) => token,
7382 Err(e) => match dlg.token(e) {
7383 Ok(token) => token,
7384 Err(e) => {
7385 dlg.finished(false);
7386 return Err(common::Error::MissingToken(e));
7387 }
7388 },
7389 };
7390 request_value_reader
7391 .seek(std::io::SeekFrom::Start(0))
7392 .unwrap();
7393 let mut req_result = {
7394 let client = &self.hub.client;
7395 dlg.pre_request();
7396 let mut req_builder = hyper::Request::builder()
7397 .method(hyper::Method::POST)
7398 .uri(url.as_str())
7399 .header(USER_AGENT, self.hub._user_agent.clone());
7400
7401 if let Some(token) = token.as_ref() {
7402 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7403 }
7404
7405 let request = req_builder
7406 .header(CONTENT_TYPE, json_mime_type.to_string())
7407 .header(CONTENT_LENGTH, request_size as u64)
7408 .body(common::to_body(
7409 request_value_reader.get_ref().clone().into(),
7410 ));
7411
7412 client.request(request.unwrap()).await
7413 };
7414
7415 match req_result {
7416 Err(err) => {
7417 if let common::Retry::After(d) = dlg.http_error(&err) {
7418 sleep(d).await;
7419 continue;
7420 }
7421 dlg.finished(false);
7422 return Err(common::Error::HttpError(err));
7423 }
7424 Ok(res) => {
7425 let (mut parts, body) = res.into_parts();
7426 let mut body = common::Body::new(body);
7427 if !parts.status.is_success() {
7428 let bytes = common::to_bytes(body).await.unwrap_or_default();
7429 let error = serde_json::from_str(&common::to_string(&bytes));
7430 let response = common::to_response(parts, bytes.into());
7431
7432 if let common::Retry::After(d) =
7433 dlg.http_failure(&response, error.as_ref().ok())
7434 {
7435 sleep(d).await;
7436 continue;
7437 }
7438
7439 dlg.finished(false);
7440
7441 return Err(match error {
7442 Ok(value) => common::Error::BadRequest(value),
7443 _ => common::Error::Failure(response),
7444 });
7445 }
7446 let response = {
7447 let bytes = common::to_bytes(body).await.unwrap_or_default();
7448 let encoded = common::to_string(&bytes);
7449 match serde_json::from_str(&encoded) {
7450 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7451 Err(error) => {
7452 dlg.response_json_decode_error(&encoded, &error);
7453 return Err(common::Error::JsonDecodeError(
7454 encoded.to_string(),
7455 error,
7456 ));
7457 }
7458 }
7459 };
7460
7461 dlg.finished(true);
7462 return Ok(response);
7463 }
7464 }
7465 }
7466 }
7467
7468 ///
7469 /// Sets the *request* property to the given value.
7470 ///
7471 /// Even though the property as already been set when instantiating this call,
7472 /// we provide this method for API completeness.
7473 pub fn request(
7474 mut self,
7475 new_value: ExecuteAirflowCommandRequest,
7476 ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7477 self._request = new_value;
7478 self
7479 }
7480 /// The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
7481 ///
7482 /// Sets the *environment* path property to the given value.
7483 ///
7484 /// Even though the property as already been set when instantiating this call,
7485 /// we provide this method for API completeness.
7486 pub fn environment(
7487 mut self,
7488 new_value: &str,
7489 ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7490 self._environment = new_value.to_string();
7491 self
7492 }
7493 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7494 /// while executing the actual API request.
7495 ///
7496 /// ````text
7497 /// It should be used to handle progress information, and to implement a certain level of resilience.
7498 /// ````
7499 ///
7500 /// Sets the *delegate* property to the given value.
7501 pub fn delegate(
7502 mut self,
7503 new_value: &'a mut dyn common::Delegate,
7504 ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7505 self._delegate = Some(new_value);
7506 self
7507 }
7508
7509 /// Set any additional parameter of the query string used in the request.
7510 /// It should be used to set parameters which are not yet available through their own
7511 /// setters.
7512 ///
7513 /// Please note that this method must not be used to set any of the known parameters
7514 /// which have their own setter method. If done anyway, the request will fail.
7515 ///
7516 /// # Additional Parameters
7517 ///
7518 /// * *$.xgafv* (query-string) - V1 error format.
7519 /// * *access_token* (query-string) - OAuth access token.
7520 /// * *alt* (query-string) - Data format for response.
7521 /// * *callback* (query-string) - JSONP
7522 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7523 /// * *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.
7524 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7525 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7526 /// * *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.
7527 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7528 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7529 pub fn param<T>(
7530 mut self,
7531 name: T,
7532 value: T,
7533 ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7534 where
7535 T: AsRef<str>,
7536 {
7537 self._additional_params
7538 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7539 self
7540 }
7541
7542 /// Identifies the authorization scope for the method you are building.
7543 ///
7544 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7545 /// [`Scope::CloudPlatform`].
7546 ///
7547 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7548 /// tokens for more than one scope.
7549 ///
7550 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7551 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7552 /// sufficient, a read-write scope will do as well.
7553 pub fn add_scope<St>(
7554 mut self,
7555 scope: St,
7556 ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7557 where
7558 St: AsRef<str>,
7559 {
7560 self._scopes.insert(String::from(scope.as_ref()));
7561 self
7562 }
7563 /// Identifies the authorization scope(s) for the method you are building.
7564 ///
7565 /// See [`Self::add_scope()`] for details.
7566 pub fn add_scopes<I, St>(
7567 mut self,
7568 scopes: I,
7569 ) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C>
7570 where
7571 I: IntoIterator<Item = St>,
7572 St: AsRef<str>,
7573 {
7574 self._scopes
7575 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7576 self
7577 }
7578
7579 /// Removes all scopes, and no default scope will be used either.
7580 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7581 /// for details).
7582 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentExecuteAirflowCommandCall<'a, C> {
7583 self._scopes.clear();
7584 self
7585 }
7586}
7587
7588/// Fetches database properties.
7589///
7590/// A builder for the *locations.environments.fetchDatabaseProperties* method supported by a *project* resource.
7591/// It is not used directly, but through a [`ProjectMethods`] instance.
7592///
7593/// # Example
7594///
7595/// Instantiate a resource method builder
7596///
7597/// ```test_harness,no_run
7598/// # extern crate hyper;
7599/// # extern crate hyper_rustls;
7600/// # extern crate google_composer1 as composer1;
7601/// # async fn dox() {
7602/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7603///
7604/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7605/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7606/// # .with_native_roots()
7607/// # .unwrap()
7608/// # .https_only()
7609/// # .enable_http2()
7610/// # .build();
7611///
7612/// # let executor = hyper_util::rt::TokioExecutor::new();
7613/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7614/// # secret,
7615/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7616/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7617/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7618/// # ),
7619/// # ).build().await.unwrap();
7620///
7621/// # let client = hyper_util::client::legacy::Client::builder(
7622/// # hyper_util::rt::TokioExecutor::new()
7623/// # )
7624/// # .build(
7625/// # hyper_rustls::HttpsConnectorBuilder::new()
7626/// # .with_native_roots()
7627/// # .unwrap()
7628/// # .https_or_http()
7629/// # .enable_http2()
7630/// # .build()
7631/// # );
7632/// # let mut hub = CloudComposer::new(client, auth);
7633/// // You can configure optional parameters by calling the respective setters at will, and
7634/// // execute the final call using `doit()`.
7635/// // Values shown here are possibly random and not representative !
7636/// let result = hub.projects().locations_environments_fetch_database_properties("environment")
7637/// .doit().await;
7638/// # }
7639/// ```
7640pub struct ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7641where
7642 C: 'a,
7643{
7644 hub: &'a CloudComposer<C>,
7645 _environment: String,
7646 _delegate: Option<&'a mut dyn common::Delegate>,
7647 _additional_params: HashMap<String, String>,
7648 _scopes: BTreeSet<String>,
7649}
7650
7651impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {}
7652
7653impl<'a, C> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7654where
7655 C: common::Connector,
7656{
7657 /// Perform the operation you have build so far.
7658 pub async fn doit(
7659 mut self,
7660 ) -> common::Result<(common::Response, FetchDatabasePropertiesResponse)> {
7661 use std::borrow::Cow;
7662 use std::io::{Read, Seek};
7663
7664 use common::{url::Params, ToParts};
7665 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7666
7667 let mut dd = common::DefaultDelegate;
7668 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7669 dlg.begin(common::MethodInfo {
7670 id: "composer.projects.locations.environments.fetchDatabaseProperties",
7671 http_method: hyper::Method::GET,
7672 });
7673
7674 for &field in ["alt", "environment"].iter() {
7675 if self._additional_params.contains_key(field) {
7676 dlg.finished(false);
7677 return Err(common::Error::FieldClash(field));
7678 }
7679 }
7680
7681 let mut params = Params::with_capacity(3 + self._additional_params.len());
7682 params.push("environment", self._environment);
7683
7684 params.extend(self._additional_params.iter());
7685
7686 params.push("alt", "json");
7687 let mut url = self.hub._base_url.clone() + "v1/{+environment}:fetchDatabaseProperties";
7688 if self._scopes.is_empty() {
7689 self._scopes
7690 .insert(Scope::CloudPlatform.as_ref().to_string());
7691 }
7692
7693 #[allow(clippy::single_element_loop)]
7694 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
7695 url = params.uri_replacement(url, param_name, find_this, true);
7696 }
7697 {
7698 let to_remove = ["environment"];
7699 params.remove_params(&to_remove);
7700 }
7701
7702 let url = params.parse_with_url(&url);
7703
7704 loop {
7705 let token = match self
7706 .hub
7707 .auth
7708 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7709 .await
7710 {
7711 Ok(token) => token,
7712 Err(e) => match dlg.token(e) {
7713 Ok(token) => token,
7714 Err(e) => {
7715 dlg.finished(false);
7716 return Err(common::Error::MissingToken(e));
7717 }
7718 },
7719 };
7720 let mut req_result = {
7721 let client = &self.hub.client;
7722 dlg.pre_request();
7723 let mut req_builder = hyper::Request::builder()
7724 .method(hyper::Method::GET)
7725 .uri(url.as_str())
7726 .header(USER_AGENT, self.hub._user_agent.clone());
7727
7728 if let Some(token) = token.as_ref() {
7729 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7730 }
7731
7732 let request = req_builder
7733 .header(CONTENT_LENGTH, 0_u64)
7734 .body(common::to_body::<String>(None));
7735
7736 client.request(request.unwrap()).await
7737 };
7738
7739 match req_result {
7740 Err(err) => {
7741 if let common::Retry::After(d) = dlg.http_error(&err) {
7742 sleep(d).await;
7743 continue;
7744 }
7745 dlg.finished(false);
7746 return Err(common::Error::HttpError(err));
7747 }
7748 Ok(res) => {
7749 let (mut parts, body) = res.into_parts();
7750 let mut body = common::Body::new(body);
7751 if !parts.status.is_success() {
7752 let bytes = common::to_bytes(body).await.unwrap_or_default();
7753 let error = serde_json::from_str(&common::to_string(&bytes));
7754 let response = common::to_response(parts, bytes.into());
7755
7756 if let common::Retry::After(d) =
7757 dlg.http_failure(&response, error.as_ref().ok())
7758 {
7759 sleep(d).await;
7760 continue;
7761 }
7762
7763 dlg.finished(false);
7764
7765 return Err(match error {
7766 Ok(value) => common::Error::BadRequest(value),
7767 _ => common::Error::Failure(response),
7768 });
7769 }
7770 let response = {
7771 let bytes = common::to_bytes(body).await.unwrap_or_default();
7772 let encoded = common::to_string(&bytes);
7773 match serde_json::from_str(&encoded) {
7774 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7775 Err(error) => {
7776 dlg.response_json_decode_error(&encoded, &error);
7777 return Err(common::Error::JsonDecodeError(
7778 encoded.to_string(),
7779 error,
7780 ));
7781 }
7782 }
7783 };
7784
7785 dlg.finished(true);
7786 return Ok(response);
7787 }
7788 }
7789 }
7790 }
7791
7792 /// Required. The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
7793 ///
7794 /// Sets the *environment* path property to the given value.
7795 ///
7796 /// Even though the property as already been set when instantiating this call,
7797 /// we provide this method for API completeness.
7798 pub fn environment(
7799 mut self,
7800 new_value: &str,
7801 ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
7802 self._environment = new_value.to_string();
7803 self
7804 }
7805 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7806 /// while executing the actual API request.
7807 ///
7808 /// ````text
7809 /// It should be used to handle progress information, and to implement a certain level of resilience.
7810 /// ````
7811 ///
7812 /// Sets the *delegate* property to the given value.
7813 pub fn delegate(
7814 mut self,
7815 new_value: &'a mut dyn common::Delegate,
7816 ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
7817 self._delegate = Some(new_value);
7818 self
7819 }
7820
7821 /// Set any additional parameter of the query string used in the request.
7822 /// It should be used to set parameters which are not yet available through their own
7823 /// setters.
7824 ///
7825 /// Please note that this method must not be used to set any of the known parameters
7826 /// which have their own setter method. If done anyway, the request will fail.
7827 ///
7828 /// # Additional Parameters
7829 ///
7830 /// * *$.xgafv* (query-string) - V1 error format.
7831 /// * *access_token* (query-string) - OAuth access token.
7832 /// * *alt* (query-string) - Data format for response.
7833 /// * *callback* (query-string) - JSONP
7834 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7835 /// * *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.
7836 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7837 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7838 /// * *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.
7839 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7840 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7841 pub fn param<T>(
7842 mut self,
7843 name: T,
7844 value: T,
7845 ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7846 where
7847 T: AsRef<str>,
7848 {
7849 self._additional_params
7850 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7851 self
7852 }
7853
7854 /// Identifies the authorization scope for the method you are building.
7855 ///
7856 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7857 /// [`Scope::CloudPlatform`].
7858 ///
7859 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7860 /// tokens for more than one scope.
7861 ///
7862 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7863 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7864 /// sufficient, a read-write scope will do as well.
7865 pub fn add_scope<St>(
7866 mut self,
7867 scope: St,
7868 ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7869 where
7870 St: AsRef<str>,
7871 {
7872 self._scopes.insert(String::from(scope.as_ref()));
7873 self
7874 }
7875 /// Identifies the authorization scope(s) for the method you are building.
7876 ///
7877 /// See [`Self::add_scope()`] for details.
7878 pub fn add_scopes<I, St>(
7879 mut self,
7880 scopes: I,
7881 ) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C>
7882 where
7883 I: IntoIterator<Item = St>,
7884 St: AsRef<str>,
7885 {
7886 self._scopes
7887 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7888 self
7889 }
7890
7891 /// Removes all scopes, and no default scope will be used either.
7892 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7893 /// for details).
7894 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentFetchDatabasePropertyCall<'a, C> {
7895 self._scopes.clear();
7896 self
7897 }
7898}
7899
7900/// Get an existing environment.
7901///
7902/// A builder for the *locations.environments.get* method supported by a *project* resource.
7903/// It is not used directly, but through a [`ProjectMethods`] instance.
7904///
7905/// # Example
7906///
7907/// Instantiate a resource method builder
7908///
7909/// ```test_harness,no_run
7910/// # extern crate hyper;
7911/// # extern crate hyper_rustls;
7912/// # extern crate google_composer1 as composer1;
7913/// # async fn dox() {
7914/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7915///
7916/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7917/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7918/// # .with_native_roots()
7919/// # .unwrap()
7920/// # .https_only()
7921/// # .enable_http2()
7922/// # .build();
7923///
7924/// # let executor = hyper_util::rt::TokioExecutor::new();
7925/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7926/// # secret,
7927/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7928/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7929/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7930/// # ),
7931/// # ).build().await.unwrap();
7932///
7933/// # let client = hyper_util::client::legacy::Client::builder(
7934/// # hyper_util::rt::TokioExecutor::new()
7935/// # )
7936/// # .build(
7937/// # hyper_rustls::HttpsConnectorBuilder::new()
7938/// # .with_native_roots()
7939/// # .unwrap()
7940/// # .https_or_http()
7941/// # .enable_http2()
7942/// # .build()
7943/// # );
7944/// # let mut hub = CloudComposer::new(client, auth);
7945/// // You can configure optional parameters by calling the respective setters at will, and
7946/// // execute the final call using `doit()`.
7947/// // Values shown here are possibly random and not representative !
7948/// let result = hub.projects().locations_environments_get("name")
7949/// .doit().await;
7950/// # }
7951/// ```
7952pub struct ProjectLocationEnvironmentGetCall<'a, C>
7953where
7954 C: 'a,
7955{
7956 hub: &'a CloudComposer<C>,
7957 _name: String,
7958 _delegate: Option<&'a mut dyn common::Delegate>,
7959 _additional_params: HashMap<String, String>,
7960 _scopes: BTreeSet<String>,
7961}
7962
7963impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentGetCall<'a, C> {}
7964
7965impl<'a, C> ProjectLocationEnvironmentGetCall<'a, C>
7966where
7967 C: common::Connector,
7968{
7969 /// Perform the operation you have build so far.
7970 pub async fn doit(mut self) -> common::Result<(common::Response, Environment)> {
7971 use std::borrow::Cow;
7972 use std::io::{Read, Seek};
7973
7974 use common::{url::Params, ToParts};
7975 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7976
7977 let mut dd = common::DefaultDelegate;
7978 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7979 dlg.begin(common::MethodInfo {
7980 id: "composer.projects.locations.environments.get",
7981 http_method: hyper::Method::GET,
7982 });
7983
7984 for &field in ["alt", "name"].iter() {
7985 if self._additional_params.contains_key(field) {
7986 dlg.finished(false);
7987 return Err(common::Error::FieldClash(field));
7988 }
7989 }
7990
7991 let mut params = Params::with_capacity(3 + self._additional_params.len());
7992 params.push("name", self._name);
7993
7994 params.extend(self._additional_params.iter());
7995
7996 params.push("alt", "json");
7997 let mut url = self.hub._base_url.clone() + "v1/{+name}";
7998 if self._scopes.is_empty() {
7999 self._scopes
8000 .insert(Scope::CloudPlatform.as_ref().to_string());
8001 }
8002
8003 #[allow(clippy::single_element_loop)]
8004 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8005 url = params.uri_replacement(url, param_name, find_this, true);
8006 }
8007 {
8008 let to_remove = ["name"];
8009 params.remove_params(&to_remove);
8010 }
8011
8012 let url = params.parse_with_url(&url);
8013
8014 loop {
8015 let token = match self
8016 .hub
8017 .auth
8018 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8019 .await
8020 {
8021 Ok(token) => token,
8022 Err(e) => match dlg.token(e) {
8023 Ok(token) => token,
8024 Err(e) => {
8025 dlg.finished(false);
8026 return Err(common::Error::MissingToken(e));
8027 }
8028 },
8029 };
8030 let mut req_result = {
8031 let client = &self.hub.client;
8032 dlg.pre_request();
8033 let mut req_builder = hyper::Request::builder()
8034 .method(hyper::Method::GET)
8035 .uri(url.as_str())
8036 .header(USER_AGENT, self.hub._user_agent.clone());
8037
8038 if let Some(token) = token.as_ref() {
8039 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8040 }
8041
8042 let request = req_builder
8043 .header(CONTENT_LENGTH, 0_u64)
8044 .body(common::to_body::<String>(None));
8045
8046 client.request(request.unwrap()).await
8047 };
8048
8049 match req_result {
8050 Err(err) => {
8051 if let common::Retry::After(d) = dlg.http_error(&err) {
8052 sleep(d).await;
8053 continue;
8054 }
8055 dlg.finished(false);
8056 return Err(common::Error::HttpError(err));
8057 }
8058 Ok(res) => {
8059 let (mut parts, body) = res.into_parts();
8060 let mut body = common::Body::new(body);
8061 if !parts.status.is_success() {
8062 let bytes = common::to_bytes(body).await.unwrap_or_default();
8063 let error = serde_json::from_str(&common::to_string(&bytes));
8064 let response = common::to_response(parts, bytes.into());
8065
8066 if let common::Retry::After(d) =
8067 dlg.http_failure(&response, error.as_ref().ok())
8068 {
8069 sleep(d).await;
8070 continue;
8071 }
8072
8073 dlg.finished(false);
8074
8075 return Err(match error {
8076 Ok(value) => common::Error::BadRequest(value),
8077 _ => common::Error::Failure(response),
8078 });
8079 }
8080 let response = {
8081 let bytes = common::to_bytes(body).await.unwrap_or_default();
8082 let encoded = common::to_string(&bytes);
8083 match serde_json::from_str(&encoded) {
8084 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8085 Err(error) => {
8086 dlg.response_json_decode_error(&encoded, &error);
8087 return Err(common::Error::JsonDecodeError(
8088 encoded.to_string(),
8089 error,
8090 ));
8091 }
8092 }
8093 };
8094
8095 dlg.finished(true);
8096 return Ok(response);
8097 }
8098 }
8099 }
8100 }
8101
8102 /// The resource name of the environment to get, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
8103 ///
8104 /// Sets the *name* path property to the given value.
8105 ///
8106 /// Even though the property as already been set when instantiating this call,
8107 /// we provide this method for API completeness.
8108 pub fn name(mut self, new_value: &str) -> ProjectLocationEnvironmentGetCall<'a, C> {
8109 self._name = new_value.to_string();
8110 self
8111 }
8112 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8113 /// while executing the actual API request.
8114 ///
8115 /// ````text
8116 /// It should be used to handle progress information, and to implement a certain level of resilience.
8117 /// ````
8118 ///
8119 /// Sets the *delegate* property to the given value.
8120 pub fn delegate(
8121 mut self,
8122 new_value: &'a mut dyn common::Delegate,
8123 ) -> ProjectLocationEnvironmentGetCall<'a, C> {
8124 self._delegate = Some(new_value);
8125 self
8126 }
8127
8128 /// Set any additional parameter of the query string used in the request.
8129 /// It should be used to set parameters which are not yet available through their own
8130 /// setters.
8131 ///
8132 /// Please note that this method must not be used to set any of the known parameters
8133 /// which have their own setter method. If done anyway, the request will fail.
8134 ///
8135 /// # Additional Parameters
8136 ///
8137 /// * *$.xgafv* (query-string) - V1 error format.
8138 /// * *access_token* (query-string) - OAuth access token.
8139 /// * *alt* (query-string) - Data format for response.
8140 /// * *callback* (query-string) - JSONP
8141 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8142 /// * *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.
8143 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8144 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8145 /// * *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.
8146 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8147 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8148 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentGetCall<'a, C>
8149 where
8150 T: AsRef<str>,
8151 {
8152 self._additional_params
8153 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8154 self
8155 }
8156
8157 /// Identifies the authorization scope for the method you are building.
8158 ///
8159 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8160 /// [`Scope::CloudPlatform`].
8161 ///
8162 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8163 /// tokens for more than one scope.
8164 ///
8165 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8166 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8167 /// sufficient, a read-write scope will do as well.
8168 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentGetCall<'a, C>
8169 where
8170 St: AsRef<str>,
8171 {
8172 self._scopes.insert(String::from(scope.as_ref()));
8173 self
8174 }
8175 /// Identifies the authorization scope(s) for the method you are building.
8176 ///
8177 /// See [`Self::add_scope()`] for details.
8178 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentGetCall<'a, C>
8179 where
8180 I: IntoIterator<Item = St>,
8181 St: AsRef<str>,
8182 {
8183 self._scopes
8184 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8185 self
8186 }
8187
8188 /// Removes all scopes, and no default scope will be used either.
8189 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8190 /// for details).
8191 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentGetCall<'a, C> {
8192 self._scopes.clear();
8193 self
8194 }
8195}
8196
8197/// List environments.
8198///
8199/// A builder for the *locations.environments.list* method supported by a *project* resource.
8200/// It is not used directly, but through a [`ProjectMethods`] instance.
8201///
8202/// # Example
8203///
8204/// Instantiate a resource method builder
8205///
8206/// ```test_harness,no_run
8207/// # extern crate hyper;
8208/// # extern crate hyper_rustls;
8209/// # extern crate google_composer1 as composer1;
8210/// # async fn dox() {
8211/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8212///
8213/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8214/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8215/// # .with_native_roots()
8216/// # .unwrap()
8217/// # .https_only()
8218/// # .enable_http2()
8219/// # .build();
8220///
8221/// # let executor = hyper_util::rt::TokioExecutor::new();
8222/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8223/// # secret,
8224/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8225/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8226/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8227/// # ),
8228/// # ).build().await.unwrap();
8229///
8230/// # let client = hyper_util::client::legacy::Client::builder(
8231/// # hyper_util::rt::TokioExecutor::new()
8232/// # )
8233/// # .build(
8234/// # hyper_rustls::HttpsConnectorBuilder::new()
8235/// # .with_native_roots()
8236/// # .unwrap()
8237/// # .https_or_http()
8238/// # .enable_http2()
8239/// # .build()
8240/// # );
8241/// # let mut hub = CloudComposer::new(client, auth);
8242/// // You can configure optional parameters by calling the respective setters at will, and
8243/// // execute the final call using `doit()`.
8244/// // Values shown here are possibly random and not representative !
8245/// let result = hub.projects().locations_environments_list("parent")
8246/// .page_token("ipsum")
8247/// .page_size(-50)
8248/// .doit().await;
8249/// # }
8250/// ```
8251pub struct ProjectLocationEnvironmentListCall<'a, C>
8252where
8253 C: 'a,
8254{
8255 hub: &'a CloudComposer<C>,
8256 _parent: String,
8257 _page_token: Option<String>,
8258 _page_size: Option<i32>,
8259 _delegate: Option<&'a mut dyn common::Delegate>,
8260 _additional_params: HashMap<String, String>,
8261 _scopes: BTreeSet<String>,
8262}
8263
8264impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentListCall<'a, C> {}
8265
8266impl<'a, C> ProjectLocationEnvironmentListCall<'a, C>
8267where
8268 C: common::Connector,
8269{
8270 /// Perform the operation you have build so far.
8271 pub async fn doit(mut self) -> common::Result<(common::Response, ListEnvironmentsResponse)> {
8272 use std::borrow::Cow;
8273 use std::io::{Read, Seek};
8274
8275 use common::{url::Params, ToParts};
8276 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8277
8278 let mut dd = common::DefaultDelegate;
8279 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8280 dlg.begin(common::MethodInfo {
8281 id: "composer.projects.locations.environments.list",
8282 http_method: hyper::Method::GET,
8283 });
8284
8285 for &field in ["alt", "parent", "pageToken", "pageSize"].iter() {
8286 if self._additional_params.contains_key(field) {
8287 dlg.finished(false);
8288 return Err(common::Error::FieldClash(field));
8289 }
8290 }
8291
8292 let mut params = Params::with_capacity(5 + self._additional_params.len());
8293 params.push("parent", self._parent);
8294 if let Some(value) = self._page_token.as_ref() {
8295 params.push("pageToken", value);
8296 }
8297 if let Some(value) = self._page_size.as_ref() {
8298 params.push("pageSize", value.to_string());
8299 }
8300
8301 params.extend(self._additional_params.iter());
8302
8303 params.push("alt", "json");
8304 let mut url = self.hub._base_url.clone() + "v1/{+parent}/environments";
8305 if self._scopes.is_empty() {
8306 self._scopes
8307 .insert(Scope::CloudPlatform.as_ref().to_string());
8308 }
8309
8310 #[allow(clippy::single_element_loop)]
8311 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8312 url = params.uri_replacement(url, param_name, find_this, true);
8313 }
8314 {
8315 let to_remove = ["parent"];
8316 params.remove_params(&to_remove);
8317 }
8318
8319 let url = params.parse_with_url(&url);
8320
8321 loop {
8322 let token = match self
8323 .hub
8324 .auth
8325 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8326 .await
8327 {
8328 Ok(token) => token,
8329 Err(e) => match dlg.token(e) {
8330 Ok(token) => token,
8331 Err(e) => {
8332 dlg.finished(false);
8333 return Err(common::Error::MissingToken(e));
8334 }
8335 },
8336 };
8337 let mut req_result = {
8338 let client = &self.hub.client;
8339 dlg.pre_request();
8340 let mut req_builder = hyper::Request::builder()
8341 .method(hyper::Method::GET)
8342 .uri(url.as_str())
8343 .header(USER_AGENT, self.hub._user_agent.clone());
8344
8345 if let Some(token) = token.as_ref() {
8346 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8347 }
8348
8349 let request = req_builder
8350 .header(CONTENT_LENGTH, 0_u64)
8351 .body(common::to_body::<String>(None));
8352
8353 client.request(request.unwrap()).await
8354 };
8355
8356 match req_result {
8357 Err(err) => {
8358 if let common::Retry::After(d) = dlg.http_error(&err) {
8359 sleep(d).await;
8360 continue;
8361 }
8362 dlg.finished(false);
8363 return Err(common::Error::HttpError(err));
8364 }
8365 Ok(res) => {
8366 let (mut parts, body) = res.into_parts();
8367 let mut body = common::Body::new(body);
8368 if !parts.status.is_success() {
8369 let bytes = common::to_bytes(body).await.unwrap_or_default();
8370 let error = serde_json::from_str(&common::to_string(&bytes));
8371 let response = common::to_response(parts, bytes.into());
8372
8373 if let common::Retry::After(d) =
8374 dlg.http_failure(&response, error.as_ref().ok())
8375 {
8376 sleep(d).await;
8377 continue;
8378 }
8379
8380 dlg.finished(false);
8381
8382 return Err(match error {
8383 Ok(value) => common::Error::BadRequest(value),
8384 _ => common::Error::Failure(response),
8385 });
8386 }
8387 let response = {
8388 let bytes = common::to_bytes(body).await.unwrap_or_default();
8389 let encoded = common::to_string(&bytes);
8390 match serde_json::from_str(&encoded) {
8391 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8392 Err(error) => {
8393 dlg.response_json_decode_error(&encoded, &error);
8394 return Err(common::Error::JsonDecodeError(
8395 encoded.to_string(),
8396 error,
8397 ));
8398 }
8399 }
8400 };
8401
8402 dlg.finished(true);
8403 return Ok(response);
8404 }
8405 }
8406 }
8407 }
8408
8409 /// List environments in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
8410 ///
8411 /// Sets the *parent* path property to the given value.
8412 ///
8413 /// Even though the property as already been set when instantiating this call,
8414 /// we provide this method for API completeness.
8415 pub fn parent(mut self, new_value: &str) -> ProjectLocationEnvironmentListCall<'a, C> {
8416 self._parent = new_value.to_string();
8417 self
8418 }
8419 /// The next_page_token value returned from a previous List request, if any.
8420 ///
8421 /// Sets the *page token* query property to the given value.
8422 pub fn page_token(mut self, new_value: &str) -> ProjectLocationEnvironmentListCall<'a, C> {
8423 self._page_token = Some(new_value.to_string());
8424 self
8425 }
8426 /// The maximum number of environments to return.
8427 ///
8428 /// Sets the *page size* query property to the given value.
8429 pub fn page_size(mut self, new_value: i32) -> ProjectLocationEnvironmentListCall<'a, C> {
8430 self._page_size = Some(new_value);
8431 self
8432 }
8433 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8434 /// while executing the actual API request.
8435 ///
8436 /// ````text
8437 /// It should be used to handle progress information, and to implement a certain level of resilience.
8438 /// ````
8439 ///
8440 /// Sets the *delegate* property to the given value.
8441 pub fn delegate(
8442 mut self,
8443 new_value: &'a mut dyn common::Delegate,
8444 ) -> ProjectLocationEnvironmentListCall<'a, C> {
8445 self._delegate = Some(new_value);
8446 self
8447 }
8448
8449 /// Set any additional parameter of the query string used in the request.
8450 /// It should be used to set parameters which are not yet available through their own
8451 /// setters.
8452 ///
8453 /// Please note that this method must not be used to set any of the known parameters
8454 /// which have their own setter method. If done anyway, the request will fail.
8455 ///
8456 /// # Additional Parameters
8457 ///
8458 /// * *$.xgafv* (query-string) - V1 error format.
8459 /// * *access_token* (query-string) - OAuth access token.
8460 /// * *alt* (query-string) - Data format for response.
8461 /// * *callback* (query-string) - JSONP
8462 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8463 /// * *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.
8464 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8465 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8466 /// * *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.
8467 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8468 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8469 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentListCall<'a, C>
8470 where
8471 T: AsRef<str>,
8472 {
8473 self._additional_params
8474 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8475 self
8476 }
8477
8478 /// Identifies the authorization scope for the method you are building.
8479 ///
8480 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8481 /// [`Scope::CloudPlatform`].
8482 ///
8483 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8484 /// tokens for more than one scope.
8485 ///
8486 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8487 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8488 /// sufficient, a read-write scope will do as well.
8489 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentListCall<'a, C>
8490 where
8491 St: AsRef<str>,
8492 {
8493 self._scopes.insert(String::from(scope.as_ref()));
8494 self
8495 }
8496 /// Identifies the authorization scope(s) for the method you are building.
8497 ///
8498 /// See [`Self::add_scope()`] for details.
8499 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentListCall<'a, C>
8500 where
8501 I: IntoIterator<Item = St>,
8502 St: AsRef<str>,
8503 {
8504 self._scopes
8505 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8506 self
8507 }
8508
8509 /// Removes all scopes, and no default scope will be used either.
8510 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8511 /// for details).
8512 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentListCall<'a, C> {
8513 self._scopes.clear();
8514 self
8515 }
8516}
8517
8518/// 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.
8519///
8520/// A builder for the *locations.environments.loadSnapshot* method supported by a *project* resource.
8521/// It is not used directly, but through a [`ProjectMethods`] instance.
8522///
8523/// # Example
8524///
8525/// Instantiate a resource method builder
8526///
8527/// ```test_harness,no_run
8528/// # extern crate hyper;
8529/// # extern crate hyper_rustls;
8530/// # extern crate google_composer1 as composer1;
8531/// use composer1::api::LoadSnapshotRequest;
8532/// # async fn dox() {
8533/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8534///
8535/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8536/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8537/// # .with_native_roots()
8538/// # .unwrap()
8539/// # .https_only()
8540/// # .enable_http2()
8541/// # .build();
8542///
8543/// # let executor = hyper_util::rt::TokioExecutor::new();
8544/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8545/// # secret,
8546/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8547/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8548/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8549/// # ),
8550/// # ).build().await.unwrap();
8551///
8552/// # let client = hyper_util::client::legacy::Client::builder(
8553/// # hyper_util::rt::TokioExecutor::new()
8554/// # )
8555/// # .build(
8556/// # hyper_rustls::HttpsConnectorBuilder::new()
8557/// # .with_native_roots()
8558/// # .unwrap()
8559/// # .https_or_http()
8560/// # .enable_http2()
8561/// # .build()
8562/// # );
8563/// # let mut hub = CloudComposer::new(client, auth);
8564/// // As the method needs a request, you would usually fill it with the desired information
8565/// // into the respective structure. Some of the parts shown here might not be applicable !
8566/// // Values shown here are possibly random and not representative !
8567/// let mut req = LoadSnapshotRequest::default();
8568///
8569/// // You can configure optional parameters by calling the respective setters at will, and
8570/// // execute the final call using `doit()`.
8571/// // Values shown here are possibly random and not representative !
8572/// let result = hub.projects().locations_environments_load_snapshot(req, "environment")
8573/// .doit().await;
8574/// # }
8575/// ```
8576pub struct ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8577where
8578 C: 'a,
8579{
8580 hub: &'a CloudComposer<C>,
8581 _request: LoadSnapshotRequest,
8582 _environment: String,
8583 _delegate: Option<&'a mut dyn common::Delegate>,
8584 _additional_params: HashMap<String, String>,
8585 _scopes: BTreeSet<String>,
8586}
8587
8588impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {}
8589
8590impl<'a, C> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8591where
8592 C: common::Connector,
8593{
8594 /// Perform the operation you have build so far.
8595 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8596 use std::borrow::Cow;
8597 use std::io::{Read, Seek};
8598
8599 use common::{url::Params, ToParts};
8600 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8601
8602 let mut dd = common::DefaultDelegate;
8603 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8604 dlg.begin(common::MethodInfo {
8605 id: "composer.projects.locations.environments.loadSnapshot",
8606 http_method: hyper::Method::POST,
8607 });
8608
8609 for &field in ["alt", "environment"].iter() {
8610 if self._additional_params.contains_key(field) {
8611 dlg.finished(false);
8612 return Err(common::Error::FieldClash(field));
8613 }
8614 }
8615
8616 let mut params = Params::with_capacity(4 + self._additional_params.len());
8617 params.push("environment", self._environment);
8618
8619 params.extend(self._additional_params.iter());
8620
8621 params.push("alt", "json");
8622 let mut url = self.hub._base_url.clone() + "v1/{+environment}:loadSnapshot";
8623 if self._scopes.is_empty() {
8624 self._scopes
8625 .insert(Scope::CloudPlatform.as_ref().to_string());
8626 }
8627
8628 #[allow(clippy::single_element_loop)]
8629 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
8630 url = params.uri_replacement(url, param_name, find_this, true);
8631 }
8632 {
8633 let to_remove = ["environment"];
8634 params.remove_params(&to_remove);
8635 }
8636
8637 let url = params.parse_with_url(&url);
8638
8639 let mut json_mime_type = mime::APPLICATION_JSON;
8640 let mut request_value_reader = {
8641 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8642 common::remove_json_null_values(&mut value);
8643 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8644 serde_json::to_writer(&mut dst, &value).unwrap();
8645 dst
8646 };
8647 let request_size = request_value_reader
8648 .seek(std::io::SeekFrom::End(0))
8649 .unwrap();
8650 request_value_reader
8651 .seek(std::io::SeekFrom::Start(0))
8652 .unwrap();
8653
8654 loop {
8655 let token = match self
8656 .hub
8657 .auth
8658 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8659 .await
8660 {
8661 Ok(token) => token,
8662 Err(e) => match dlg.token(e) {
8663 Ok(token) => token,
8664 Err(e) => {
8665 dlg.finished(false);
8666 return Err(common::Error::MissingToken(e));
8667 }
8668 },
8669 };
8670 request_value_reader
8671 .seek(std::io::SeekFrom::Start(0))
8672 .unwrap();
8673 let mut req_result = {
8674 let client = &self.hub.client;
8675 dlg.pre_request();
8676 let mut req_builder = hyper::Request::builder()
8677 .method(hyper::Method::POST)
8678 .uri(url.as_str())
8679 .header(USER_AGENT, self.hub._user_agent.clone());
8680
8681 if let Some(token) = token.as_ref() {
8682 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8683 }
8684
8685 let request = req_builder
8686 .header(CONTENT_TYPE, json_mime_type.to_string())
8687 .header(CONTENT_LENGTH, request_size as u64)
8688 .body(common::to_body(
8689 request_value_reader.get_ref().clone().into(),
8690 ));
8691
8692 client.request(request.unwrap()).await
8693 };
8694
8695 match req_result {
8696 Err(err) => {
8697 if let common::Retry::After(d) = dlg.http_error(&err) {
8698 sleep(d).await;
8699 continue;
8700 }
8701 dlg.finished(false);
8702 return Err(common::Error::HttpError(err));
8703 }
8704 Ok(res) => {
8705 let (mut parts, body) = res.into_parts();
8706 let mut body = common::Body::new(body);
8707 if !parts.status.is_success() {
8708 let bytes = common::to_bytes(body).await.unwrap_or_default();
8709 let error = serde_json::from_str(&common::to_string(&bytes));
8710 let response = common::to_response(parts, bytes.into());
8711
8712 if let common::Retry::After(d) =
8713 dlg.http_failure(&response, error.as_ref().ok())
8714 {
8715 sleep(d).await;
8716 continue;
8717 }
8718
8719 dlg.finished(false);
8720
8721 return Err(match error {
8722 Ok(value) => common::Error::BadRequest(value),
8723 _ => common::Error::Failure(response),
8724 });
8725 }
8726 let response = {
8727 let bytes = common::to_bytes(body).await.unwrap_or_default();
8728 let encoded = common::to_string(&bytes);
8729 match serde_json::from_str(&encoded) {
8730 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8731 Err(error) => {
8732 dlg.response_json_decode_error(&encoded, &error);
8733 return Err(common::Error::JsonDecodeError(
8734 encoded.to_string(),
8735 error,
8736 ));
8737 }
8738 }
8739 };
8740
8741 dlg.finished(true);
8742 return Ok(response);
8743 }
8744 }
8745 }
8746 }
8747
8748 ///
8749 /// Sets the *request* property to the given value.
8750 ///
8751 /// Even though the property as already been set when instantiating this call,
8752 /// we provide this method for API completeness.
8753 pub fn request(
8754 mut self,
8755 new_value: LoadSnapshotRequest,
8756 ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8757 self._request = new_value;
8758 self
8759 }
8760 /// The resource name of the target environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
8761 ///
8762 /// Sets the *environment* path property to the given value.
8763 ///
8764 /// Even though the property as already been set when instantiating this call,
8765 /// we provide this method for API completeness.
8766 pub fn environment(
8767 mut self,
8768 new_value: &str,
8769 ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8770 self._environment = new_value.to_string();
8771 self
8772 }
8773 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8774 /// while executing the actual API request.
8775 ///
8776 /// ````text
8777 /// It should be used to handle progress information, and to implement a certain level of resilience.
8778 /// ````
8779 ///
8780 /// Sets the *delegate* property to the given value.
8781 pub fn delegate(
8782 mut self,
8783 new_value: &'a mut dyn common::Delegate,
8784 ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8785 self._delegate = Some(new_value);
8786 self
8787 }
8788
8789 /// Set any additional parameter of the query string used in the request.
8790 /// It should be used to set parameters which are not yet available through their own
8791 /// setters.
8792 ///
8793 /// Please note that this method must not be used to set any of the known parameters
8794 /// which have their own setter method. If done anyway, the request will fail.
8795 ///
8796 /// # Additional Parameters
8797 ///
8798 /// * *$.xgafv* (query-string) - V1 error format.
8799 /// * *access_token* (query-string) - OAuth access token.
8800 /// * *alt* (query-string) - Data format for response.
8801 /// * *callback* (query-string) - JSONP
8802 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8803 /// * *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.
8804 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8805 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8806 /// * *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.
8807 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8808 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8809 pub fn param<T>(
8810 mut self,
8811 name: T,
8812 value: T,
8813 ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8814 where
8815 T: AsRef<str>,
8816 {
8817 self._additional_params
8818 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8819 self
8820 }
8821
8822 /// Identifies the authorization scope for the method you are building.
8823 ///
8824 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8825 /// [`Scope::CloudPlatform`].
8826 ///
8827 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8828 /// tokens for more than one scope.
8829 ///
8830 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8831 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8832 /// sufficient, a read-write scope will do as well.
8833 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8834 where
8835 St: AsRef<str>,
8836 {
8837 self._scopes.insert(String::from(scope.as_ref()));
8838 self
8839 }
8840 /// Identifies the authorization scope(s) for the method you are building.
8841 ///
8842 /// See [`Self::add_scope()`] for details.
8843 pub fn add_scopes<I, St>(
8844 mut self,
8845 scopes: I,
8846 ) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C>
8847 where
8848 I: IntoIterator<Item = St>,
8849 St: AsRef<str>,
8850 {
8851 self._scopes
8852 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8853 self
8854 }
8855
8856 /// Removes all scopes, and no default scope will be used either.
8857 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8858 /// for details).
8859 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentLoadSnapshotCall<'a, C> {
8860 self._scopes.clear();
8861 self
8862 }
8863}
8864
8865/// Update an environment.
8866///
8867/// A builder for the *locations.environments.patch* method supported by a *project* resource.
8868/// It is not used directly, but through a [`ProjectMethods`] instance.
8869///
8870/// # Example
8871///
8872/// Instantiate a resource method builder
8873///
8874/// ```test_harness,no_run
8875/// # extern crate hyper;
8876/// # extern crate hyper_rustls;
8877/// # extern crate google_composer1 as composer1;
8878/// use composer1::api::Environment;
8879/// # async fn dox() {
8880/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8881///
8882/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8883/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8884/// # .with_native_roots()
8885/// # .unwrap()
8886/// # .https_only()
8887/// # .enable_http2()
8888/// # .build();
8889///
8890/// # let executor = hyper_util::rt::TokioExecutor::new();
8891/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8892/// # secret,
8893/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8894/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8895/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8896/// # ),
8897/// # ).build().await.unwrap();
8898///
8899/// # let client = hyper_util::client::legacy::Client::builder(
8900/// # hyper_util::rt::TokioExecutor::new()
8901/// # )
8902/// # .build(
8903/// # hyper_rustls::HttpsConnectorBuilder::new()
8904/// # .with_native_roots()
8905/// # .unwrap()
8906/// # .https_or_http()
8907/// # .enable_http2()
8908/// # .build()
8909/// # );
8910/// # let mut hub = CloudComposer::new(client, auth);
8911/// // As the method needs a request, you would usually fill it with the desired information
8912/// // into the respective structure. Some of the parts shown here might not be applicable !
8913/// // Values shown here are possibly random and not representative !
8914/// let mut req = Environment::default();
8915///
8916/// // You can configure optional parameters by calling the respective setters at will, and
8917/// // execute the final call using `doit()`.
8918/// // Values shown here are possibly random and not representative !
8919/// let result = hub.projects().locations_environments_patch(req, "name")
8920/// .update_mask(FieldMask::new::<&str>(&[]))
8921/// .doit().await;
8922/// # }
8923/// ```
8924pub struct ProjectLocationEnvironmentPatchCall<'a, C>
8925where
8926 C: 'a,
8927{
8928 hub: &'a CloudComposer<C>,
8929 _request: Environment,
8930 _name: String,
8931 _update_mask: Option<common::FieldMask>,
8932 _delegate: Option<&'a mut dyn common::Delegate>,
8933 _additional_params: HashMap<String, String>,
8934 _scopes: BTreeSet<String>,
8935}
8936
8937impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentPatchCall<'a, C> {}
8938
8939impl<'a, C> ProjectLocationEnvironmentPatchCall<'a, C>
8940where
8941 C: common::Connector,
8942{
8943 /// Perform the operation you have build so far.
8944 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8945 use std::borrow::Cow;
8946 use std::io::{Read, Seek};
8947
8948 use common::{url::Params, ToParts};
8949 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8950
8951 let mut dd = common::DefaultDelegate;
8952 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8953 dlg.begin(common::MethodInfo {
8954 id: "composer.projects.locations.environments.patch",
8955 http_method: hyper::Method::PATCH,
8956 });
8957
8958 for &field in ["alt", "name", "updateMask"].iter() {
8959 if self._additional_params.contains_key(field) {
8960 dlg.finished(false);
8961 return Err(common::Error::FieldClash(field));
8962 }
8963 }
8964
8965 let mut params = Params::with_capacity(5 + self._additional_params.len());
8966 params.push("name", self._name);
8967 if let Some(value) = self._update_mask.as_ref() {
8968 params.push("updateMask", value.to_string());
8969 }
8970
8971 params.extend(self._additional_params.iter());
8972
8973 params.push("alt", "json");
8974 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8975 if self._scopes.is_empty() {
8976 self._scopes
8977 .insert(Scope::CloudPlatform.as_ref().to_string());
8978 }
8979
8980 #[allow(clippy::single_element_loop)]
8981 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8982 url = params.uri_replacement(url, param_name, find_this, true);
8983 }
8984 {
8985 let to_remove = ["name"];
8986 params.remove_params(&to_remove);
8987 }
8988
8989 let url = params.parse_with_url(&url);
8990
8991 let mut json_mime_type = mime::APPLICATION_JSON;
8992 let mut request_value_reader = {
8993 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8994 common::remove_json_null_values(&mut value);
8995 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8996 serde_json::to_writer(&mut dst, &value).unwrap();
8997 dst
8998 };
8999 let request_size = request_value_reader
9000 .seek(std::io::SeekFrom::End(0))
9001 .unwrap();
9002 request_value_reader
9003 .seek(std::io::SeekFrom::Start(0))
9004 .unwrap();
9005
9006 loop {
9007 let token = match self
9008 .hub
9009 .auth
9010 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9011 .await
9012 {
9013 Ok(token) => token,
9014 Err(e) => match dlg.token(e) {
9015 Ok(token) => token,
9016 Err(e) => {
9017 dlg.finished(false);
9018 return Err(common::Error::MissingToken(e));
9019 }
9020 },
9021 };
9022 request_value_reader
9023 .seek(std::io::SeekFrom::Start(0))
9024 .unwrap();
9025 let mut req_result = {
9026 let client = &self.hub.client;
9027 dlg.pre_request();
9028 let mut req_builder = hyper::Request::builder()
9029 .method(hyper::Method::PATCH)
9030 .uri(url.as_str())
9031 .header(USER_AGENT, self.hub._user_agent.clone());
9032
9033 if let Some(token) = token.as_ref() {
9034 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9035 }
9036
9037 let request = req_builder
9038 .header(CONTENT_TYPE, json_mime_type.to_string())
9039 .header(CONTENT_LENGTH, request_size as u64)
9040 .body(common::to_body(
9041 request_value_reader.get_ref().clone().into(),
9042 ));
9043
9044 client.request(request.unwrap()).await
9045 };
9046
9047 match req_result {
9048 Err(err) => {
9049 if let common::Retry::After(d) = dlg.http_error(&err) {
9050 sleep(d).await;
9051 continue;
9052 }
9053 dlg.finished(false);
9054 return Err(common::Error::HttpError(err));
9055 }
9056 Ok(res) => {
9057 let (mut parts, body) = res.into_parts();
9058 let mut body = common::Body::new(body);
9059 if !parts.status.is_success() {
9060 let bytes = common::to_bytes(body).await.unwrap_or_default();
9061 let error = serde_json::from_str(&common::to_string(&bytes));
9062 let response = common::to_response(parts, bytes.into());
9063
9064 if let common::Retry::After(d) =
9065 dlg.http_failure(&response, error.as_ref().ok())
9066 {
9067 sleep(d).await;
9068 continue;
9069 }
9070
9071 dlg.finished(false);
9072
9073 return Err(match error {
9074 Ok(value) => common::Error::BadRequest(value),
9075 _ => common::Error::Failure(response),
9076 });
9077 }
9078 let response = {
9079 let bytes = common::to_bytes(body).await.unwrap_or_default();
9080 let encoded = common::to_string(&bytes);
9081 match serde_json::from_str(&encoded) {
9082 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9083 Err(error) => {
9084 dlg.response_json_decode_error(&encoded, &error);
9085 return Err(common::Error::JsonDecodeError(
9086 encoded.to_string(),
9087 error,
9088 ));
9089 }
9090 }
9091 };
9092
9093 dlg.finished(true);
9094 return Ok(response);
9095 }
9096 }
9097 }
9098 }
9099
9100 ///
9101 /// Sets the *request* property to the given value.
9102 ///
9103 /// Even though the property as already been set when instantiating this call,
9104 /// we provide this method for API completeness.
9105 pub fn request(mut self, new_value: Environment) -> ProjectLocationEnvironmentPatchCall<'a, C> {
9106 self._request = new_value;
9107 self
9108 }
9109 /// The relative resource name of the environment to update, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
9110 ///
9111 /// Sets the *name* path property to the given value.
9112 ///
9113 /// Even though the property as already been set when instantiating this call,
9114 /// we provide this method for API completeness.
9115 pub fn name(mut self, new_value: &str) -> ProjectLocationEnvironmentPatchCall<'a, C> {
9116 self._name = new_value.to_string();
9117 self
9118 }
9119 /// 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-*.*.*.
9120 ///
9121 /// Sets the *update mask* query property to the given value.
9122 pub fn update_mask(
9123 mut self,
9124 new_value: common::FieldMask,
9125 ) -> ProjectLocationEnvironmentPatchCall<'a, C> {
9126 self._update_mask = Some(new_value);
9127 self
9128 }
9129 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9130 /// while executing the actual API request.
9131 ///
9132 /// ````text
9133 /// It should be used to handle progress information, and to implement a certain level of resilience.
9134 /// ````
9135 ///
9136 /// Sets the *delegate* property to the given value.
9137 pub fn delegate(
9138 mut self,
9139 new_value: &'a mut dyn common::Delegate,
9140 ) -> ProjectLocationEnvironmentPatchCall<'a, C> {
9141 self._delegate = Some(new_value);
9142 self
9143 }
9144
9145 /// Set any additional parameter of the query string used in the request.
9146 /// It should be used to set parameters which are not yet available through their own
9147 /// setters.
9148 ///
9149 /// Please note that this method must not be used to set any of the known parameters
9150 /// which have their own setter method. If done anyway, the request will fail.
9151 ///
9152 /// # Additional Parameters
9153 ///
9154 /// * *$.xgafv* (query-string) - V1 error format.
9155 /// * *access_token* (query-string) - OAuth access token.
9156 /// * *alt* (query-string) - Data format for response.
9157 /// * *callback* (query-string) - JSONP
9158 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9159 /// * *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.
9160 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9161 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9162 /// * *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.
9163 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9164 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9165 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationEnvironmentPatchCall<'a, C>
9166 where
9167 T: AsRef<str>,
9168 {
9169 self._additional_params
9170 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9171 self
9172 }
9173
9174 /// Identifies the authorization scope for the method you are building.
9175 ///
9176 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9177 /// [`Scope::CloudPlatform`].
9178 ///
9179 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9180 /// tokens for more than one scope.
9181 ///
9182 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9183 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9184 /// sufficient, a read-write scope will do as well.
9185 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentPatchCall<'a, C>
9186 where
9187 St: AsRef<str>,
9188 {
9189 self._scopes.insert(String::from(scope.as_ref()));
9190 self
9191 }
9192 /// Identifies the authorization scope(s) for the method you are building.
9193 ///
9194 /// See [`Self::add_scope()`] for details.
9195 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationEnvironmentPatchCall<'a, C>
9196 where
9197 I: IntoIterator<Item = St>,
9198 St: AsRef<str>,
9199 {
9200 self._scopes
9201 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9202 self
9203 }
9204
9205 /// Removes all scopes, and no default scope will be used either.
9206 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9207 /// for details).
9208 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentPatchCall<'a, C> {
9209 self._scopes.clear();
9210 self
9211 }
9212}
9213
9214/// Polls Airflow CLI command execution and fetches logs.
9215///
9216/// A builder for the *locations.environments.pollAirflowCommand* method supported by a *project* resource.
9217/// It is not used directly, but through a [`ProjectMethods`] instance.
9218///
9219/// # Example
9220///
9221/// Instantiate a resource method builder
9222///
9223/// ```test_harness,no_run
9224/// # extern crate hyper;
9225/// # extern crate hyper_rustls;
9226/// # extern crate google_composer1 as composer1;
9227/// use composer1::api::PollAirflowCommandRequest;
9228/// # async fn dox() {
9229/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9230///
9231/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9232/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9233/// # .with_native_roots()
9234/// # .unwrap()
9235/// # .https_only()
9236/// # .enable_http2()
9237/// # .build();
9238///
9239/// # let executor = hyper_util::rt::TokioExecutor::new();
9240/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9241/// # secret,
9242/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9243/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9244/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9245/// # ),
9246/// # ).build().await.unwrap();
9247///
9248/// # let client = hyper_util::client::legacy::Client::builder(
9249/// # hyper_util::rt::TokioExecutor::new()
9250/// # )
9251/// # .build(
9252/// # hyper_rustls::HttpsConnectorBuilder::new()
9253/// # .with_native_roots()
9254/// # .unwrap()
9255/// # .https_or_http()
9256/// # .enable_http2()
9257/// # .build()
9258/// # );
9259/// # let mut hub = CloudComposer::new(client, auth);
9260/// // As the method needs a request, you would usually fill it with the desired information
9261/// // into the respective structure. Some of the parts shown here might not be applicable !
9262/// // Values shown here are possibly random and not representative !
9263/// let mut req = PollAirflowCommandRequest::default();
9264///
9265/// // You can configure optional parameters by calling the respective setters at will, and
9266/// // execute the final call using `doit()`.
9267/// // Values shown here are possibly random and not representative !
9268/// let result = hub.projects().locations_environments_poll_airflow_command(req, "environment")
9269/// .doit().await;
9270/// # }
9271/// ```
9272pub struct ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9273where
9274 C: 'a,
9275{
9276 hub: &'a CloudComposer<C>,
9277 _request: PollAirflowCommandRequest,
9278 _environment: String,
9279 _delegate: Option<&'a mut dyn common::Delegate>,
9280 _additional_params: HashMap<String, String>,
9281 _scopes: BTreeSet<String>,
9282}
9283
9284impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {}
9285
9286impl<'a, C> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9287where
9288 C: common::Connector,
9289{
9290 /// Perform the operation you have build so far.
9291 pub async fn doit(mut self) -> common::Result<(common::Response, PollAirflowCommandResponse)> {
9292 use std::borrow::Cow;
9293 use std::io::{Read, Seek};
9294
9295 use common::{url::Params, ToParts};
9296 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9297
9298 let mut dd = common::DefaultDelegate;
9299 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9300 dlg.begin(common::MethodInfo {
9301 id: "composer.projects.locations.environments.pollAirflowCommand",
9302 http_method: hyper::Method::POST,
9303 });
9304
9305 for &field in ["alt", "environment"].iter() {
9306 if self._additional_params.contains_key(field) {
9307 dlg.finished(false);
9308 return Err(common::Error::FieldClash(field));
9309 }
9310 }
9311
9312 let mut params = Params::with_capacity(4 + self._additional_params.len());
9313 params.push("environment", self._environment);
9314
9315 params.extend(self._additional_params.iter());
9316
9317 params.push("alt", "json");
9318 let mut url = self.hub._base_url.clone() + "v1/{+environment}:pollAirflowCommand";
9319 if self._scopes.is_empty() {
9320 self._scopes
9321 .insert(Scope::CloudPlatform.as_ref().to_string());
9322 }
9323
9324 #[allow(clippy::single_element_loop)]
9325 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
9326 url = params.uri_replacement(url, param_name, find_this, true);
9327 }
9328 {
9329 let to_remove = ["environment"];
9330 params.remove_params(&to_remove);
9331 }
9332
9333 let url = params.parse_with_url(&url);
9334
9335 let mut json_mime_type = mime::APPLICATION_JSON;
9336 let mut request_value_reader = {
9337 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9338 common::remove_json_null_values(&mut value);
9339 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9340 serde_json::to_writer(&mut dst, &value).unwrap();
9341 dst
9342 };
9343 let request_size = request_value_reader
9344 .seek(std::io::SeekFrom::End(0))
9345 .unwrap();
9346 request_value_reader
9347 .seek(std::io::SeekFrom::Start(0))
9348 .unwrap();
9349
9350 loop {
9351 let token = match self
9352 .hub
9353 .auth
9354 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9355 .await
9356 {
9357 Ok(token) => token,
9358 Err(e) => match dlg.token(e) {
9359 Ok(token) => token,
9360 Err(e) => {
9361 dlg.finished(false);
9362 return Err(common::Error::MissingToken(e));
9363 }
9364 },
9365 };
9366 request_value_reader
9367 .seek(std::io::SeekFrom::Start(0))
9368 .unwrap();
9369 let mut req_result = {
9370 let client = &self.hub.client;
9371 dlg.pre_request();
9372 let mut req_builder = hyper::Request::builder()
9373 .method(hyper::Method::POST)
9374 .uri(url.as_str())
9375 .header(USER_AGENT, self.hub._user_agent.clone());
9376
9377 if let Some(token) = token.as_ref() {
9378 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9379 }
9380
9381 let request = req_builder
9382 .header(CONTENT_TYPE, json_mime_type.to_string())
9383 .header(CONTENT_LENGTH, request_size as u64)
9384 .body(common::to_body(
9385 request_value_reader.get_ref().clone().into(),
9386 ));
9387
9388 client.request(request.unwrap()).await
9389 };
9390
9391 match req_result {
9392 Err(err) => {
9393 if let common::Retry::After(d) = dlg.http_error(&err) {
9394 sleep(d).await;
9395 continue;
9396 }
9397 dlg.finished(false);
9398 return Err(common::Error::HttpError(err));
9399 }
9400 Ok(res) => {
9401 let (mut parts, body) = res.into_parts();
9402 let mut body = common::Body::new(body);
9403 if !parts.status.is_success() {
9404 let bytes = common::to_bytes(body).await.unwrap_or_default();
9405 let error = serde_json::from_str(&common::to_string(&bytes));
9406 let response = common::to_response(parts, bytes.into());
9407
9408 if let common::Retry::After(d) =
9409 dlg.http_failure(&response, error.as_ref().ok())
9410 {
9411 sleep(d).await;
9412 continue;
9413 }
9414
9415 dlg.finished(false);
9416
9417 return Err(match error {
9418 Ok(value) => common::Error::BadRequest(value),
9419 _ => common::Error::Failure(response),
9420 });
9421 }
9422 let response = {
9423 let bytes = common::to_bytes(body).await.unwrap_or_default();
9424 let encoded = common::to_string(&bytes);
9425 match serde_json::from_str(&encoded) {
9426 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9427 Err(error) => {
9428 dlg.response_json_decode_error(&encoded, &error);
9429 return Err(common::Error::JsonDecodeError(
9430 encoded.to_string(),
9431 error,
9432 ));
9433 }
9434 }
9435 };
9436
9437 dlg.finished(true);
9438 return Ok(response);
9439 }
9440 }
9441 }
9442 }
9443
9444 ///
9445 /// Sets the *request* property to the given value.
9446 ///
9447 /// Even though the property as already been set when instantiating this call,
9448 /// we provide this method for API completeness.
9449 pub fn request(
9450 mut self,
9451 new_value: PollAirflowCommandRequest,
9452 ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9453 self._request = new_value;
9454 self
9455 }
9456 /// The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
9457 ///
9458 /// Sets the *environment* path property to the given value.
9459 ///
9460 /// Even though the property as already been set when instantiating this call,
9461 /// we provide this method for API completeness.
9462 pub fn environment(
9463 mut self,
9464 new_value: &str,
9465 ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9466 self._environment = new_value.to_string();
9467 self
9468 }
9469 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9470 /// while executing the actual API request.
9471 ///
9472 /// ````text
9473 /// It should be used to handle progress information, and to implement a certain level of resilience.
9474 /// ````
9475 ///
9476 /// Sets the *delegate* property to the given value.
9477 pub fn delegate(
9478 mut self,
9479 new_value: &'a mut dyn common::Delegate,
9480 ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9481 self._delegate = Some(new_value);
9482 self
9483 }
9484
9485 /// Set any additional parameter of the query string used in the request.
9486 /// It should be used to set parameters which are not yet available through their own
9487 /// setters.
9488 ///
9489 /// Please note that this method must not be used to set any of the known parameters
9490 /// which have their own setter method. If done anyway, the request will fail.
9491 ///
9492 /// # Additional Parameters
9493 ///
9494 /// * *$.xgafv* (query-string) - V1 error format.
9495 /// * *access_token* (query-string) - OAuth access token.
9496 /// * *alt* (query-string) - Data format for response.
9497 /// * *callback* (query-string) - JSONP
9498 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9499 /// * *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.
9500 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9501 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9502 /// * *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.
9503 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9504 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9505 pub fn param<T>(
9506 mut self,
9507 name: T,
9508 value: T,
9509 ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9510 where
9511 T: AsRef<str>,
9512 {
9513 self._additional_params
9514 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9515 self
9516 }
9517
9518 /// Identifies the authorization scope for the method you are building.
9519 ///
9520 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9521 /// [`Scope::CloudPlatform`].
9522 ///
9523 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9524 /// tokens for more than one scope.
9525 ///
9526 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9527 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9528 /// sufficient, a read-write scope will do as well.
9529 pub fn add_scope<St>(
9530 mut self,
9531 scope: St,
9532 ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9533 where
9534 St: AsRef<str>,
9535 {
9536 self._scopes.insert(String::from(scope.as_ref()));
9537 self
9538 }
9539 /// Identifies the authorization scope(s) for the method you are building.
9540 ///
9541 /// See [`Self::add_scope()`] for details.
9542 pub fn add_scopes<I, St>(
9543 mut self,
9544 scopes: I,
9545 ) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C>
9546 where
9547 I: IntoIterator<Item = St>,
9548 St: AsRef<str>,
9549 {
9550 self._scopes
9551 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9552 self
9553 }
9554
9555 /// Removes all scopes, and no default scope will be used either.
9556 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9557 /// for details).
9558 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentPollAirflowCommandCall<'a, C> {
9559 self._scopes.clear();
9560 self
9561 }
9562}
9563
9564/// Restart Airflow web server.
9565///
9566/// A builder for the *locations.environments.restartWebServer* method supported by a *project* resource.
9567/// It is not used directly, but through a [`ProjectMethods`] instance.
9568///
9569/// # Example
9570///
9571/// Instantiate a resource method builder
9572///
9573/// ```test_harness,no_run
9574/// # extern crate hyper;
9575/// # extern crate hyper_rustls;
9576/// # extern crate google_composer1 as composer1;
9577/// use composer1::api::RestartWebServerRequest;
9578/// # async fn dox() {
9579/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9580///
9581/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9582/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9583/// # .with_native_roots()
9584/// # .unwrap()
9585/// # .https_only()
9586/// # .enable_http2()
9587/// # .build();
9588///
9589/// # let executor = hyper_util::rt::TokioExecutor::new();
9590/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9591/// # secret,
9592/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9593/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9594/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9595/// # ),
9596/// # ).build().await.unwrap();
9597///
9598/// # let client = hyper_util::client::legacy::Client::builder(
9599/// # hyper_util::rt::TokioExecutor::new()
9600/// # )
9601/// # .build(
9602/// # hyper_rustls::HttpsConnectorBuilder::new()
9603/// # .with_native_roots()
9604/// # .unwrap()
9605/// # .https_or_http()
9606/// # .enable_http2()
9607/// # .build()
9608/// # );
9609/// # let mut hub = CloudComposer::new(client, auth);
9610/// // As the method needs a request, you would usually fill it with the desired information
9611/// // into the respective structure. Some of the parts shown here might not be applicable !
9612/// // Values shown here are possibly random and not representative !
9613/// let mut req = RestartWebServerRequest::default();
9614///
9615/// // You can configure optional parameters by calling the respective setters at will, and
9616/// // execute the final call using `doit()`.
9617/// // Values shown here are possibly random and not representative !
9618/// let result = hub.projects().locations_environments_restart_web_server(req, "name")
9619/// .doit().await;
9620/// # }
9621/// ```
9622pub struct ProjectLocationEnvironmentRestartWebServerCall<'a, C>
9623where
9624 C: 'a,
9625{
9626 hub: &'a CloudComposer<C>,
9627 _request: RestartWebServerRequest,
9628 _name: String,
9629 _delegate: Option<&'a mut dyn common::Delegate>,
9630 _additional_params: HashMap<String, String>,
9631 _scopes: BTreeSet<String>,
9632}
9633
9634impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentRestartWebServerCall<'a, C> {}
9635
9636impl<'a, C> ProjectLocationEnvironmentRestartWebServerCall<'a, C>
9637where
9638 C: common::Connector,
9639{
9640 /// Perform the operation you have build so far.
9641 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9642 use std::borrow::Cow;
9643 use std::io::{Read, Seek};
9644
9645 use common::{url::Params, ToParts};
9646 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9647
9648 let mut dd = common::DefaultDelegate;
9649 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9650 dlg.begin(common::MethodInfo {
9651 id: "composer.projects.locations.environments.restartWebServer",
9652 http_method: hyper::Method::POST,
9653 });
9654
9655 for &field in ["alt", "name"].iter() {
9656 if self._additional_params.contains_key(field) {
9657 dlg.finished(false);
9658 return Err(common::Error::FieldClash(field));
9659 }
9660 }
9661
9662 let mut params = Params::with_capacity(4 + self._additional_params.len());
9663 params.push("name", self._name);
9664
9665 params.extend(self._additional_params.iter());
9666
9667 params.push("alt", "json");
9668 let mut url = self.hub._base_url.clone() + "v1/{+name}:restartWebServer";
9669 if self._scopes.is_empty() {
9670 self._scopes
9671 .insert(Scope::CloudPlatform.as_ref().to_string());
9672 }
9673
9674 #[allow(clippy::single_element_loop)]
9675 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9676 url = params.uri_replacement(url, param_name, find_this, true);
9677 }
9678 {
9679 let to_remove = ["name"];
9680 params.remove_params(&to_remove);
9681 }
9682
9683 let url = params.parse_with_url(&url);
9684
9685 let mut json_mime_type = mime::APPLICATION_JSON;
9686 let mut request_value_reader = {
9687 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9688 common::remove_json_null_values(&mut value);
9689 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9690 serde_json::to_writer(&mut dst, &value).unwrap();
9691 dst
9692 };
9693 let request_size = request_value_reader
9694 .seek(std::io::SeekFrom::End(0))
9695 .unwrap();
9696 request_value_reader
9697 .seek(std::io::SeekFrom::Start(0))
9698 .unwrap();
9699
9700 loop {
9701 let token = match self
9702 .hub
9703 .auth
9704 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9705 .await
9706 {
9707 Ok(token) => token,
9708 Err(e) => match dlg.token(e) {
9709 Ok(token) => token,
9710 Err(e) => {
9711 dlg.finished(false);
9712 return Err(common::Error::MissingToken(e));
9713 }
9714 },
9715 };
9716 request_value_reader
9717 .seek(std::io::SeekFrom::Start(0))
9718 .unwrap();
9719 let mut req_result = {
9720 let client = &self.hub.client;
9721 dlg.pre_request();
9722 let mut req_builder = hyper::Request::builder()
9723 .method(hyper::Method::POST)
9724 .uri(url.as_str())
9725 .header(USER_AGENT, self.hub._user_agent.clone());
9726
9727 if let Some(token) = token.as_ref() {
9728 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9729 }
9730
9731 let request = req_builder
9732 .header(CONTENT_TYPE, json_mime_type.to_string())
9733 .header(CONTENT_LENGTH, request_size as u64)
9734 .body(common::to_body(
9735 request_value_reader.get_ref().clone().into(),
9736 ));
9737
9738 client.request(request.unwrap()).await
9739 };
9740
9741 match req_result {
9742 Err(err) => {
9743 if let common::Retry::After(d) = dlg.http_error(&err) {
9744 sleep(d).await;
9745 continue;
9746 }
9747 dlg.finished(false);
9748 return Err(common::Error::HttpError(err));
9749 }
9750 Ok(res) => {
9751 let (mut parts, body) = res.into_parts();
9752 let mut body = common::Body::new(body);
9753 if !parts.status.is_success() {
9754 let bytes = common::to_bytes(body).await.unwrap_or_default();
9755 let error = serde_json::from_str(&common::to_string(&bytes));
9756 let response = common::to_response(parts, bytes.into());
9757
9758 if let common::Retry::After(d) =
9759 dlg.http_failure(&response, error.as_ref().ok())
9760 {
9761 sleep(d).await;
9762 continue;
9763 }
9764
9765 dlg.finished(false);
9766
9767 return Err(match error {
9768 Ok(value) => common::Error::BadRequest(value),
9769 _ => common::Error::Failure(response),
9770 });
9771 }
9772 let response = {
9773 let bytes = common::to_bytes(body).await.unwrap_or_default();
9774 let encoded = common::to_string(&bytes);
9775 match serde_json::from_str(&encoded) {
9776 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9777 Err(error) => {
9778 dlg.response_json_decode_error(&encoded, &error);
9779 return Err(common::Error::JsonDecodeError(
9780 encoded.to_string(),
9781 error,
9782 ));
9783 }
9784 }
9785 };
9786
9787 dlg.finished(true);
9788 return Ok(response);
9789 }
9790 }
9791 }
9792 }
9793
9794 ///
9795 /// Sets the *request* property to the given value.
9796 ///
9797 /// Even though the property as already been set when instantiating this call,
9798 /// we provide this method for API completeness.
9799 pub fn request(
9800 mut self,
9801 new_value: RestartWebServerRequest,
9802 ) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C> {
9803 self._request = new_value;
9804 self
9805 }
9806 /// Required. The resource name of the environment to restart the web server for, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
9807 ///
9808 /// Sets the *name* path property to the given value.
9809 ///
9810 /// Even though the property as already been set when instantiating this call,
9811 /// we provide this method for API completeness.
9812 pub fn name(
9813 mut self,
9814 new_value: &str,
9815 ) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C> {
9816 self._name = new_value.to_string();
9817 self
9818 }
9819 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9820 /// while executing the actual API request.
9821 ///
9822 /// ````text
9823 /// It should be used to handle progress information, and to implement a certain level of resilience.
9824 /// ````
9825 ///
9826 /// Sets the *delegate* property to the given value.
9827 pub fn delegate(
9828 mut self,
9829 new_value: &'a mut dyn common::Delegate,
9830 ) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C> {
9831 self._delegate = Some(new_value);
9832 self
9833 }
9834
9835 /// Set any additional parameter of the query string used in the request.
9836 /// It should be used to set parameters which are not yet available through their own
9837 /// setters.
9838 ///
9839 /// Please note that this method must not be used to set any of the known parameters
9840 /// which have their own setter method. If done anyway, the request will fail.
9841 ///
9842 /// # Additional Parameters
9843 ///
9844 /// * *$.xgafv* (query-string) - V1 error format.
9845 /// * *access_token* (query-string) - OAuth access token.
9846 /// * *alt* (query-string) - Data format for response.
9847 /// * *callback* (query-string) - JSONP
9848 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9849 /// * *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.
9850 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9851 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9852 /// * *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.
9853 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9854 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9855 pub fn param<T>(
9856 mut self,
9857 name: T,
9858 value: T,
9859 ) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C>
9860 where
9861 T: AsRef<str>,
9862 {
9863 self._additional_params
9864 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9865 self
9866 }
9867
9868 /// Identifies the authorization scope for the method you are building.
9869 ///
9870 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9871 /// [`Scope::CloudPlatform`].
9872 ///
9873 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9874 /// tokens for more than one scope.
9875 ///
9876 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9877 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9878 /// sufficient, a read-write scope will do as well.
9879 pub fn add_scope<St>(
9880 mut self,
9881 scope: St,
9882 ) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C>
9883 where
9884 St: AsRef<str>,
9885 {
9886 self._scopes.insert(String::from(scope.as_ref()));
9887 self
9888 }
9889 /// Identifies the authorization scope(s) for the method you are building.
9890 ///
9891 /// See [`Self::add_scope()`] for details.
9892 pub fn add_scopes<I, St>(
9893 mut self,
9894 scopes: I,
9895 ) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C>
9896 where
9897 I: IntoIterator<Item = St>,
9898 St: AsRef<str>,
9899 {
9900 self._scopes
9901 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9902 self
9903 }
9904
9905 /// Removes all scopes, and no default scope will be used either.
9906 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9907 /// for details).
9908 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentRestartWebServerCall<'a, C> {
9909 self._scopes.clear();
9910 self
9911 }
9912}
9913
9914/// 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.
9915///
9916/// A builder for the *locations.environments.saveSnapshot* method supported by a *project* resource.
9917/// It is not used directly, but through a [`ProjectMethods`] instance.
9918///
9919/// # Example
9920///
9921/// Instantiate a resource method builder
9922///
9923/// ```test_harness,no_run
9924/// # extern crate hyper;
9925/// # extern crate hyper_rustls;
9926/// # extern crate google_composer1 as composer1;
9927/// use composer1::api::SaveSnapshotRequest;
9928/// # async fn dox() {
9929/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9930///
9931/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9932/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9933/// # .with_native_roots()
9934/// # .unwrap()
9935/// # .https_only()
9936/// # .enable_http2()
9937/// # .build();
9938///
9939/// # let executor = hyper_util::rt::TokioExecutor::new();
9940/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9941/// # secret,
9942/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9943/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9944/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9945/// # ),
9946/// # ).build().await.unwrap();
9947///
9948/// # let client = hyper_util::client::legacy::Client::builder(
9949/// # hyper_util::rt::TokioExecutor::new()
9950/// # )
9951/// # .build(
9952/// # hyper_rustls::HttpsConnectorBuilder::new()
9953/// # .with_native_roots()
9954/// # .unwrap()
9955/// # .https_or_http()
9956/// # .enable_http2()
9957/// # .build()
9958/// # );
9959/// # let mut hub = CloudComposer::new(client, auth);
9960/// // As the method needs a request, you would usually fill it with the desired information
9961/// // into the respective structure. Some of the parts shown here might not be applicable !
9962/// // Values shown here are possibly random and not representative !
9963/// let mut req = SaveSnapshotRequest::default();
9964///
9965/// // You can configure optional parameters by calling the respective setters at will, and
9966/// // execute the final call using `doit()`.
9967/// // Values shown here are possibly random and not representative !
9968/// let result = hub.projects().locations_environments_save_snapshot(req, "environment")
9969/// .doit().await;
9970/// # }
9971/// ```
9972pub struct ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
9973where
9974 C: 'a,
9975{
9976 hub: &'a CloudComposer<C>,
9977 _request: SaveSnapshotRequest,
9978 _environment: String,
9979 _delegate: Option<&'a mut dyn common::Delegate>,
9980 _additional_params: HashMap<String, String>,
9981 _scopes: BTreeSet<String>,
9982}
9983
9984impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {}
9985
9986impl<'a, C> ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
9987where
9988 C: common::Connector,
9989{
9990 /// Perform the operation you have build so far.
9991 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9992 use std::borrow::Cow;
9993 use std::io::{Read, Seek};
9994
9995 use common::{url::Params, ToParts};
9996 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9997
9998 let mut dd = common::DefaultDelegate;
9999 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10000 dlg.begin(common::MethodInfo {
10001 id: "composer.projects.locations.environments.saveSnapshot",
10002 http_method: hyper::Method::POST,
10003 });
10004
10005 for &field in ["alt", "environment"].iter() {
10006 if self._additional_params.contains_key(field) {
10007 dlg.finished(false);
10008 return Err(common::Error::FieldClash(field));
10009 }
10010 }
10011
10012 let mut params = Params::with_capacity(4 + self._additional_params.len());
10013 params.push("environment", self._environment);
10014
10015 params.extend(self._additional_params.iter());
10016
10017 params.push("alt", "json");
10018 let mut url = self.hub._base_url.clone() + "v1/{+environment}:saveSnapshot";
10019 if self._scopes.is_empty() {
10020 self._scopes
10021 .insert(Scope::CloudPlatform.as_ref().to_string());
10022 }
10023
10024 #[allow(clippy::single_element_loop)]
10025 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
10026 url = params.uri_replacement(url, param_name, find_this, true);
10027 }
10028 {
10029 let to_remove = ["environment"];
10030 params.remove_params(&to_remove);
10031 }
10032
10033 let url = params.parse_with_url(&url);
10034
10035 let mut json_mime_type = mime::APPLICATION_JSON;
10036 let mut request_value_reader = {
10037 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10038 common::remove_json_null_values(&mut value);
10039 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10040 serde_json::to_writer(&mut dst, &value).unwrap();
10041 dst
10042 };
10043 let request_size = request_value_reader
10044 .seek(std::io::SeekFrom::End(0))
10045 .unwrap();
10046 request_value_reader
10047 .seek(std::io::SeekFrom::Start(0))
10048 .unwrap();
10049
10050 loop {
10051 let token = match self
10052 .hub
10053 .auth
10054 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10055 .await
10056 {
10057 Ok(token) => token,
10058 Err(e) => match dlg.token(e) {
10059 Ok(token) => token,
10060 Err(e) => {
10061 dlg.finished(false);
10062 return Err(common::Error::MissingToken(e));
10063 }
10064 },
10065 };
10066 request_value_reader
10067 .seek(std::io::SeekFrom::Start(0))
10068 .unwrap();
10069 let mut req_result = {
10070 let client = &self.hub.client;
10071 dlg.pre_request();
10072 let mut req_builder = hyper::Request::builder()
10073 .method(hyper::Method::POST)
10074 .uri(url.as_str())
10075 .header(USER_AGENT, self.hub._user_agent.clone());
10076
10077 if let Some(token) = token.as_ref() {
10078 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10079 }
10080
10081 let request = req_builder
10082 .header(CONTENT_TYPE, json_mime_type.to_string())
10083 .header(CONTENT_LENGTH, request_size as u64)
10084 .body(common::to_body(
10085 request_value_reader.get_ref().clone().into(),
10086 ));
10087
10088 client.request(request.unwrap()).await
10089 };
10090
10091 match req_result {
10092 Err(err) => {
10093 if let common::Retry::After(d) = dlg.http_error(&err) {
10094 sleep(d).await;
10095 continue;
10096 }
10097 dlg.finished(false);
10098 return Err(common::Error::HttpError(err));
10099 }
10100 Ok(res) => {
10101 let (mut parts, body) = res.into_parts();
10102 let mut body = common::Body::new(body);
10103 if !parts.status.is_success() {
10104 let bytes = common::to_bytes(body).await.unwrap_or_default();
10105 let error = serde_json::from_str(&common::to_string(&bytes));
10106 let response = common::to_response(parts, bytes.into());
10107
10108 if let common::Retry::After(d) =
10109 dlg.http_failure(&response, error.as_ref().ok())
10110 {
10111 sleep(d).await;
10112 continue;
10113 }
10114
10115 dlg.finished(false);
10116
10117 return Err(match error {
10118 Ok(value) => common::Error::BadRequest(value),
10119 _ => common::Error::Failure(response),
10120 });
10121 }
10122 let response = {
10123 let bytes = common::to_bytes(body).await.unwrap_or_default();
10124 let encoded = common::to_string(&bytes);
10125 match serde_json::from_str(&encoded) {
10126 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10127 Err(error) => {
10128 dlg.response_json_decode_error(&encoded, &error);
10129 return Err(common::Error::JsonDecodeError(
10130 encoded.to_string(),
10131 error,
10132 ));
10133 }
10134 }
10135 };
10136
10137 dlg.finished(true);
10138 return Ok(response);
10139 }
10140 }
10141 }
10142 }
10143
10144 ///
10145 /// Sets the *request* property to the given value.
10146 ///
10147 /// Even though the property as already been set when instantiating this call,
10148 /// we provide this method for API completeness.
10149 pub fn request(
10150 mut self,
10151 new_value: SaveSnapshotRequest,
10152 ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
10153 self._request = new_value;
10154 self
10155 }
10156 /// The resource name of the source environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
10157 ///
10158 /// Sets the *environment* path property to the given value.
10159 ///
10160 /// Even though the property as already been set when instantiating this call,
10161 /// we provide this method for API completeness.
10162 pub fn environment(
10163 mut self,
10164 new_value: &str,
10165 ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
10166 self._environment = new_value.to_string();
10167 self
10168 }
10169 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10170 /// while executing the actual API request.
10171 ///
10172 /// ````text
10173 /// It should be used to handle progress information, and to implement a certain level of resilience.
10174 /// ````
10175 ///
10176 /// Sets the *delegate* property to the given value.
10177 pub fn delegate(
10178 mut self,
10179 new_value: &'a mut dyn common::Delegate,
10180 ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
10181 self._delegate = Some(new_value);
10182 self
10183 }
10184
10185 /// Set any additional parameter of the query string used in the request.
10186 /// It should be used to set parameters which are not yet available through their own
10187 /// setters.
10188 ///
10189 /// Please note that this method must not be used to set any of the known parameters
10190 /// which have their own setter method. If done anyway, the request will fail.
10191 ///
10192 /// # Additional Parameters
10193 ///
10194 /// * *$.xgafv* (query-string) - V1 error format.
10195 /// * *access_token* (query-string) - OAuth access token.
10196 /// * *alt* (query-string) - Data format for response.
10197 /// * *callback* (query-string) - JSONP
10198 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10199 /// * *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.
10200 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10201 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10202 /// * *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.
10203 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10204 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10205 pub fn param<T>(
10206 mut self,
10207 name: T,
10208 value: T,
10209 ) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
10210 where
10211 T: AsRef<str>,
10212 {
10213 self._additional_params
10214 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10215 self
10216 }
10217
10218 /// Identifies the authorization scope for the method you are building.
10219 ///
10220 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10221 /// [`Scope::CloudPlatform`].
10222 ///
10223 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10224 /// tokens for more than one scope.
10225 ///
10226 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10227 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10228 /// sufficient, a read-write scope will do as well.
10229 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C>
10230 where
10231 St: AsRef<str>,
10232 {
10233 self._scopes.insert(String::from(scope.as_ref()));
10234 self
10235 }
10236 /// Identifies the authorization scope(s) for the method you are building.
10237 ///
10238 /// See [`Self::add_scope()`] for details.
10239 pub fn add_scopes<I, St>(
10240 mut self,
10241 scopes: I,
10242 ) -> ProjectLocationEnvironmentSaveSnapshotCall<'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) -> ProjectLocationEnvironmentSaveSnapshotCall<'a, C> {
10256 self._scopes.clear();
10257 self
10258 }
10259}
10260
10261/// Stops Airflow CLI command execution.
10262///
10263/// A builder for the *locations.environments.stopAirflowCommand* 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/// use composer1::api::StopAirflowCommandRequest;
10275/// # async fn dox() {
10276/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10277///
10278/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10279/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10280/// # .with_native_roots()
10281/// # .unwrap()
10282/// # .https_only()
10283/// # .enable_http2()
10284/// # .build();
10285///
10286/// # let executor = hyper_util::rt::TokioExecutor::new();
10287/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10288/// # secret,
10289/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10290/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10291/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10292/// # ),
10293/// # ).build().await.unwrap();
10294///
10295/// # let client = hyper_util::client::legacy::Client::builder(
10296/// # hyper_util::rt::TokioExecutor::new()
10297/// # )
10298/// # .build(
10299/// # hyper_rustls::HttpsConnectorBuilder::new()
10300/// # .with_native_roots()
10301/// # .unwrap()
10302/// # .https_or_http()
10303/// # .enable_http2()
10304/// # .build()
10305/// # );
10306/// # let mut hub = CloudComposer::new(client, auth);
10307/// // As the method needs a request, you would usually fill it with the desired information
10308/// // into the respective structure. Some of the parts shown here might not be applicable !
10309/// // Values shown here are possibly random and not representative !
10310/// let mut req = StopAirflowCommandRequest::default();
10311///
10312/// // You can configure optional parameters by calling the respective setters at will, and
10313/// // execute the final call using `doit()`.
10314/// // Values shown here are possibly random and not representative !
10315/// let result = hub.projects().locations_environments_stop_airflow_command(req, "environment")
10316/// .doit().await;
10317/// # }
10318/// ```
10319pub struct ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
10320where
10321 C: 'a,
10322{
10323 hub: &'a CloudComposer<C>,
10324 _request: StopAirflowCommandRequest,
10325 _environment: String,
10326 _delegate: Option<&'a mut dyn common::Delegate>,
10327 _additional_params: HashMap<String, String>,
10328 _scopes: BTreeSet<String>,
10329}
10330
10331impl<'a, C> common::CallBuilder for ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {}
10332
10333impl<'a, C> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
10334where
10335 C: common::Connector,
10336{
10337 /// Perform the operation you have build so far.
10338 pub async fn doit(mut self) -> common::Result<(common::Response, StopAirflowCommandResponse)> {
10339 use std::borrow::Cow;
10340 use std::io::{Read, Seek};
10341
10342 use common::{url::Params, ToParts};
10343 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10344
10345 let mut dd = common::DefaultDelegate;
10346 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10347 dlg.begin(common::MethodInfo {
10348 id: "composer.projects.locations.environments.stopAirflowCommand",
10349 http_method: hyper::Method::POST,
10350 });
10351
10352 for &field in ["alt", "environment"].iter() {
10353 if self._additional_params.contains_key(field) {
10354 dlg.finished(false);
10355 return Err(common::Error::FieldClash(field));
10356 }
10357 }
10358
10359 let mut params = Params::with_capacity(4 + self._additional_params.len());
10360 params.push("environment", self._environment);
10361
10362 params.extend(self._additional_params.iter());
10363
10364 params.push("alt", "json");
10365 let mut url = self.hub._base_url.clone() + "v1/{+environment}:stopAirflowCommand";
10366 if self._scopes.is_empty() {
10367 self._scopes
10368 .insert(Scope::CloudPlatform.as_ref().to_string());
10369 }
10370
10371 #[allow(clippy::single_element_loop)]
10372 for &(find_this, param_name) in [("{+environment}", "environment")].iter() {
10373 url = params.uri_replacement(url, param_name, find_this, true);
10374 }
10375 {
10376 let to_remove = ["environment"];
10377 params.remove_params(&to_remove);
10378 }
10379
10380 let url = params.parse_with_url(&url);
10381
10382 let mut json_mime_type = mime::APPLICATION_JSON;
10383 let mut request_value_reader = {
10384 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10385 common::remove_json_null_values(&mut value);
10386 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10387 serde_json::to_writer(&mut dst, &value).unwrap();
10388 dst
10389 };
10390 let request_size = request_value_reader
10391 .seek(std::io::SeekFrom::End(0))
10392 .unwrap();
10393 request_value_reader
10394 .seek(std::io::SeekFrom::Start(0))
10395 .unwrap();
10396
10397 loop {
10398 let token = match self
10399 .hub
10400 .auth
10401 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10402 .await
10403 {
10404 Ok(token) => token,
10405 Err(e) => match dlg.token(e) {
10406 Ok(token) => token,
10407 Err(e) => {
10408 dlg.finished(false);
10409 return Err(common::Error::MissingToken(e));
10410 }
10411 },
10412 };
10413 request_value_reader
10414 .seek(std::io::SeekFrom::Start(0))
10415 .unwrap();
10416 let mut req_result = {
10417 let client = &self.hub.client;
10418 dlg.pre_request();
10419 let mut req_builder = hyper::Request::builder()
10420 .method(hyper::Method::POST)
10421 .uri(url.as_str())
10422 .header(USER_AGENT, self.hub._user_agent.clone());
10423
10424 if let Some(token) = token.as_ref() {
10425 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10426 }
10427
10428 let request = req_builder
10429 .header(CONTENT_TYPE, json_mime_type.to_string())
10430 .header(CONTENT_LENGTH, request_size as u64)
10431 .body(common::to_body(
10432 request_value_reader.get_ref().clone().into(),
10433 ));
10434
10435 client.request(request.unwrap()).await
10436 };
10437
10438 match req_result {
10439 Err(err) => {
10440 if let common::Retry::After(d) = dlg.http_error(&err) {
10441 sleep(d).await;
10442 continue;
10443 }
10444 dlg.finished(false);
10445 return Err(common::Error::HttpError(err));
10446 }
10447 Ok(res) => {
10448 let (mut parts, body) = res.into_parts();
10449 let mut body = common::Body::new(body);
10450 if !parts.status.is_success() {
10451 let bytes = common::to_bytes(body).await.unwrap_or_default();
10452 let error = serde_json::from_str(&common::to_string(&bytes));
10453 let response = common::to_response(parts, bytes.into());
10454
10455 if let common::Retry::After(d) =
10456 dlg.http_failure(&response, error.as_ref().ok())
10457 {
10458 sleep(d).await;
10459 continue;
10460 }
10461
10462 dlg.finished(false);
10463
10464 return Err(match error {
10465 Ok(value) => common::Error::BadRequest(value),
10466 _ => common::Error::Failure(response),
10467 });
10468 }
10469 let response = {
10470 let bytes = common::to_bytes(body).await.unwrap_or_default();
10471 let encoded = common::to_string(&bytes);
10472 match serde_json::from_str(&encoded) {
10473 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10474 Err(error) => {
10475 dlg.response_json_decode_error(&encoded, &error);
10476 return Err(common::Error::JsonDecodeError(
10477 encoded.to_string(),
10478 error,
10479 ));
10480 }
10481 }
10482 };
10483
10484 dlg.finished(true);
10485 return Ok(response);
10486 }
10487 }
10488 }
10489 }
10490
10491 ///
10492 /// Sets the *request* property to the given value.
10493 ///
10494 /// Even though the property as already been set when instantiating this call,
10495 /// we provide this method for API completeness.
10496 pub fn request(
10497 mut self,
10498 new_value: StopAirflowCommandRequest,
10499 ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
10500 self._request = new_value;
10501 self
10502 }
10503 /// The resource name of the environment in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
10504 ///
10505 /// Sets the *environment* path property to the given value.
10506 ///
10507 /// Even though the property as already been set when instantiating this call,
10508 /// we provide this method for API completeness.
10509 pub fn environment(
10510 mut self,
10511 new_value: &str,
10512 ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
10513 self._environment = new_value.to_string();
10514 self
10515 }
10516 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10517 /// while executing the actual API request.
10518 ///
10519 /// ````text
10520 /// It should be used to handle progress information, and to implement a certain level of resilience.
10521 /// ````
10522 ///
10523 /// Sets the *delegate* property to the given value.
10524 pub fn delegate(
10525 mut self,
10526 new_value: &'a mut dyn common::Delegate,
10527 ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
10528 self._delegate = Some(new_value);
10529 self
10530 }
10531
10532 /// Set any additional parameter of the query string used in the request.
10533 /// It should be used to set parameters which are not yet available through their own
10534 /// setters.
10535 ///
10536 /// Please note that this method must not be used to set any of the known parameters
10537 /// which have their own setter method. If done anyway, the request will fail.
10538 ///
10539 /// # Additional Parameters
10540 ///
10541 /// * *$.xgafv* (query-string) - V1 error format.
10542 /// * *access_token* (query-string) - OAuth access token.
10543 /// * *alt* (query-string) - Data format for response.
10544 /// * *callback* (query-string) - JSONP
10545 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10546 /// * *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.
10547 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10548 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10549 /// * *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.
10550 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10551 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10552 pub fn param<T>(
10553 mut self,
10554 name: T,
10555 value: T,
10556 ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
10557 where
10558 T: AsRef<str>,
10559 {
10560 self._additional_params
10561 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10562 self
10563 }
10564
10565 /// Identifies the authorization scope for the method you are building.
10566 ///
10567 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10568 /// [`Scope::CloudPlatform`].
10569 ///
10570 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10571 /// tokens for more than one scope.
10572 ///
10573 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10574 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10575 /// sufficient, a read-write scope will do as well.
10576 pub fn add_scope<St>(
10577 mut self,
10578 scope: St,
10579 ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
10580 where
10581 St: AsRef<str>,
10582 {
10583 self._scopes.insert(String::from(scope.as_ref()));
10584 self
10585 }
10586 /// Identifies the authorization scope(s) for the method you are building.
10587 ///
10588 /// See [`Self::add_scope()`] for details.
10589 pub fn add_scopes<I, St>(
10590 mut self,
10591 scopes: I,
10592 ) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C>
10593 where
10594 I: IntoIterator<Item = St>,
10595 St: AsRef<str>,
10596 {
10597 self._scopes
10598 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10599 self
10600 }
10601
10602 /// Removes all scopes, and no default scope will be used either.
10603 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10604 /// for details).
10605 pub fn clear_scopes(mut self) -> ProjectLocationEnvironmentStopAirflowCommandCall<'a, C> {
10606 self._scopes.clear();
10607 self
10608 }
10609}
10610
10611/// List ImageVersions for provided location.
10612///
10613/// A builder for the *locations.imageVersions.list* method supported by a *project* resource.
10614/// It is not used directly, but through a [`ProjectMethods`] instance.
10615///
10616/// # Example
10617///
10618/// Instantiate a resource method builder
10619///
10620/// ```test_harness,no_run
10621/// # extern crate hyper;
10622/// # extern crate hyper_rustls;
10623/// # extern crate google_composer1 as composer1;
10624/// # async fn dox() {
10625/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10626///
10627/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10628/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10629/// # .with_native_roots()
10630/// # .unwrap()
10631/// # .https_only()
10632/// # .enable_http2()
10633/// # .build();
10634///
10635/// # let executor = hyper_util::rt::TokioExecutor::new();
10636/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10637/// # secret,
10638/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10639/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10640/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10641/// # ),
10642/// # ).build().await.unwrap();
10643///
10644/// # let client = hyper_util::client::legacy::Client::builder(
10645/// # hyper_util::rt::TokioExecutor::new()
10646/// # )
10647/// # .build(
10648/// # hyper_rustls::HttpsConnectorBuilder::new()
10649/// # .with_native_roots()
10650/// # .unwrap()
10651/// # .https_or_http()
10652/// # .enable_http2()
10653/// # .build()
10654/// # );
10655/// # let mut hub = CloudComposer::new(client, auth);
10656/// // You can configure optional parameters by calling the respective setters at will, and
10657/// // execute the final call using `doit()`.
10658/// // Values shown here are possibly random and not representative !
10659/// let result = hub.projects().locations_image_versions_list("parent")
10660/// .page_token("sed")
10661/// .page_size(-70)
10662/// .include_past_releases(false)
10663/// .doit().await;
10664/// # }
10665/// ```
10666pub struct ProjectLocationImageVersionListCall<'a, C>
10667where
10668 C: 'a,
10669{
10670 hub: &'a CloudComposer<C>,
10671 _parent: String,
10672 _page_token: Option<String>,
10673 _page_size: Option<i32>,
10674 _include_past_releases: Option<bool>,
10675 _delegate: Option<&'a mut dyn common::Delegate>,
10676 _additional_params: HashMap<String, String>,
10677 _scopes: BTreeSet<String>,
10678}
10679
10680impl<'a, C> common::CallBuilder for ProjectLocationImageVersionListCall<'a, C> {}
10681
10682impl<'a, C> ProjectLocationImageVersionListCall<'a, C>
10683where
10684 C: common::Connector,
10685{
10686 /// Perform the operation you have build so far.
10687 pub async fn doit(mut self) -> common::Result<(common::Response, ListImageVersionsResponse)> {
10688 use std::borrow::Cow;
10689 use std::io::{Read, Seek};
10690
10691 use common::{url::Params, ToParts};
10692 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10693
10694 let mut dd = common::DefaultDelegate;
10695 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10696 dlg.begin(common::MethodInfo {
10697 id: "composer.projects.locations.imageVersions.list",
10698 http_method: hyper::Method::GET,
10699 });
10700
10701 for &field in [
10702 "alt",
10703 "parent",
10704 "pageToken",
10705 "pageSize",
10706 "includePastReleases",
10707 ]
10708 .iter()
10709 {
10710 if self._additional_params.contains_key(field) {
10711 dlg.finished(false);
10712 return Err(common::Error::FieldClash(field));
10713 }
10714 }
10715
10716 let mut params = Params::with_capacity(6 + self._additional_params.len());
10717 params.push("parent", self._parent);
10718 if let Some(value) = self._page_token.as_ref() {
10719 params.push("pageToken", value);
10720 }
10721 if let Some(value) = self._page_size.as_ref() {
10722 params.push("pageSize", value.to_string());
10723 }
10724 if let Some(value) = self._include_past_releases.as_ref() {
10725 params.push("includePastReleases", value.to_string());
10726 }
10727
10728 params.extend(self._additional_params.iter());
10729
10730 params.push("alt", "json");
10731 let mut url = self.hub._base_url.clone() + "v1/{+parent}/imageVersions";
10732 if self._scopes.is_empty() {
10733 self._scopes
10734 .insert(Scope::CloudPlatform.as_ref().to_string());
10735 }
10736
10737 #[allow(clippy::single_element_loop)]
10738 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10739 url = params.uri_replacement(url, param_name, find_this, true);
10740 }
10741 {
10742 let to_remove = ["parent"];
10743 params.remove_params(&to_remove);
10744 }
10745
10746 let url = params.parse_with_url(&url);
10747
10748 loop {
10749 let token = match self
10750 .hub
10751 .auth
10752 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10753 .await
10754 {
10755 Ok(token) => token,
10756 Err(e) => match dlg.token(e) {
10757 Ok(token) => token,
10758 Err(e) => {
10759 dlg.finished(false);
10760 return Err(common::Error::MissingToken(e));
10761 }
10762 },
10763 };
10764 let mut req_result = {
10765 let client = &self.hub.client;
10766 dlg.pre_request();
10767 let mut req_builder = hyper::Request::builder()
10768 .method(hyper::Method::GET)
10769 .uri(url.as_str())
10770 .header(USER_AGENT, self.hub._user_agent.clone());
10771
10772 if let Some(token) = token.as_ref() {
10773 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10774 }
10775
10776 let request = req_builder
10777 .header(CONTENT_LENGTH, 0_u64)
10778 .body(common::to_body::<String>(None));
10779
10780 client.request(request.unwrap()).await
10781 };
10782
10783 match req_result {
10784 Err(err) => {
10785 if let common::Retry::After(d) = dlg.http_error(&err) {
10786 sleep(d).await;
10787 continue;
10788 }
10789 dlg.finished(false);
10790 return Err(common::Error::HttpError(err));
10791 }
10792 Ok(res) => {
10793 let (mut parts, body) = res.into_parts();
10794 let mut body = common::Body::new(body);
10795 if !parts.status.is_success() {
10796 let bytes = common::to_bytes(body).await.unwrap_or_default();
10797 let error = serde_json::from_str(&common::to_string(&bytes));
10798 let response = common::to_response(parts, bytes.into());
10799
10800 if let common::Retry::After(d) =
10801 dlg.http_failure(&response, error.as_ref().ok())
10802 {
10803 sleep(d).await;
10804 continue;
10805 }
10806
10807 dlg.finished(false);
10808
10809 return Err(match error {
10810 Ok(value) => common::Error::BadRequest(value),
10811 _ => common::Error::Failure(response),
10812 });
10813 }
10814 let response = {
10815 let bytes = common::to_bytes(body).await.unwrap_or_default();
10816 let encoded = common::to_string(&bytes);
10817 match serde_json::from_str(&encoded) {
10818 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10819 Err(error) => {
10820 dlg.response_json_decode_error(&encoded, &error);
10821 return Err(common::Error::JsonDecodeError(
10822 encoded.to_string(),
10823 error,
10824 ));
10825 }
10826 }
10827 };
10828
10829 dlg.finished(true);
10830 return Ok(response);
10831 }
10832 }
10833 }
10834 }
10835
10836 /// List ImageVersions in the given project and location, in the form: "projects/{projectId}/locations/{locationId}"
10837 ///
10838 /// Sets the *parent* path property to the given value.
10839 ///
10840 /// Even though the property as already been set when instantiating this call,
10841 /// we provide this method for API completeness.
10842 pub fn parent(mut self, new_value: &str) -> ProjectLocationImageVersionListCall<'a, C> {
10843 self._parent = new_value.to_string();
10844 self
10845 }
10846 /// The next_page_token value returned from a previous List request, if any.
10847 ///
10848 /// Sets the *page token* query property to the given value.
10849 pub fn page_token(mut self, new_value: &str) -> ProjectLocationImageVersionListCall<'a, C> {
10850 self._page_token = Some(new_value.to_string());
10851 self
10852 }
10853 /// The maximum number of image_versions to return.
10854 ///
10855 /// Sets the *page size* query property to the given value.
10856 pub fn page_size(mut self, new_value: i32) -> ProjectLocationImageVersionListCall<'a, C> {
10857 self._page_size = Some(new_value);
10858 self
10859 }
10860 /// Whether or not image versions from old releases should be included.
10861 ///
10862 /// Sets the *include past releases* query property to the given value.
10863 pub fn include_past_releases(
10864 mut self,
10865 new_value: bool,
10866 ) -> ProjectLocationImageVersionListCall<'a, C> {
10867 self._include_past_releases = Some(new_value);
10868 self
10869 }
10870 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10871 /// while executing the actual API request.
10872 ///
10873 /// ````text
10874 /// It should be used to handle progress information, and to implement a certain level of resilience.
10875 /// ````
10876 ///
10877 /// Sets the *delegate* property to the given value.
10878 pub fn delegate(
10879 mut self,
10880 new_value: &'a mut dyn common::Delegate,
10881 ) -> ProjectLocationImageVersionListCall<'a, C> {
10882 self._delegate = Some(new_value);
10883 self
10884 }
10885
10886 /// Set any additional parameter of the query string used in the request.
10887 /// It should be used to set parameters which are not yet available through their own
10888 /// setters.
10889 ///
10890 /// Please note that this method must not be used to set any of the known parameters
10891 /// which have their own setter method. If done anyway, the request will fail.
10892 ///
10893 /// # Additional Parameters
10894 ///
10895 /// * *$.xgafv* (query-string) - V1 error format.
10896 /// * *access_token* (query-string) - OAuth access token.
10897 /// * *alt* (query-string) - Data format for response.
10898 /// * *callback* (query-string) - JSONP
10899 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10900 /// * *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.
10901 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10902 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10903 /// * *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.
10904 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10905 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10906 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationImageVersionListCall<'a, C>
10907 where
10908 T: AsRef<str>,
10909 {
10910 self._additional_params
10911 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10912 self
10913 }
10914
10915 /// Identifies the authorization scope for the method you are building.
10916 ///
10917 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10918 /// [`Scope::CloudPlatform`].
10919 ///
10920 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10921 /// tokens for more than one scope.
10922 ///
10923 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10924 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10925 /// sufficient, a read-write scope will do as well.
10926 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationImageVersionListCall<'a, C>
10927 where
10928 St: AsRef<str>,
10929 {
10930 self._scopes.insert(String::from(scope.as_ref()));
10931 self
10932 }
10933 /// Identifies the authorization scope(s) for the method you are building.
10934 ///
10935 /// See [`Self::add_scope()`] for details.
10936 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationImageVersionListCall<'a, C>
10937 where
10938 I: IntoIterator<Item = St>,
10939 St: AsRef<str>,
10940 {
10941 self._scopes
10942 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10943 self
10944 }
10945
10946 /// Removes all scopes, and no default scope will be used either.
10947 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10948 /// for details).
10949 pub fn clear_scopes(mut self) -> ProjectLocationImageVersionListCall<'a, C> {
10950 self._scopes.clear();
10951 self
10952 }
10953}
10954
10955/// 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`.
10956///
10957/// A builder for the *locations.operations.delete* method supported by a *project* resource.
10958/// It is not used directly, but through a [`ProjectMethods`] instance.
10959///
10960/// # Example
10961///
10962/// Instantiate a resource method builder
10963///
10964/// ```test_harness,no_run
10965/// # extern crate hyper;
10966/// # extern crate hyper_rustls;
10967/// # extern crate google_composer1 as composer1;
10968/// # async fn dox() {
10969/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10970///
10971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10972/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10973/// # .with_native_roots()
10974/// # .unwrap()
10975/// # .https_only()
10976/// # .enable_http2()
10977/// # .build();
10978///
10979/// # let executor = hyper_util::rt::TokioExecutor::new();
10980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10981/// # secret,
10982/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10983/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10984/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10985/// # ),
10986/// # ).build().await.unwrap();
10987///
10988/// # let client = hyper_util::client::legacy::Client::builder(
10989/// # hyper_util::rt::TokioExecutor::new()
10990/// # )
10991/// # .build(
10992/// # hyper_rustls::HttpsConnectorBuilder::new()
10993/// # .with_native_roots()
10994/// # .unwrap()
10995/// # .https_or_http()
10996/// # .enable_http2()
10997/// # .build()
10998/// # );
10999/// # let mut hub = CloudComposer::new(client, auth);
11000/// // You can configure optional parameters by calling the respective setters at will, and
11001/// // execute the final call using `doit()`.
11002/// // Values shown here are possibly random and not representative !
11003/// let result = hub.projects().locations_operations_delete("name")
11004/// .doit().await;
11005/// # }
11006/// ```
11007pub struct ProjectLocationOperationDeleteCall<'a, C>
11008where
11009 C: 'a,
11010{
11011 hub: &'a CloudComposer<C>,
11012 _name: String,
11013 _delegate: Option<&'a mut dyn common::Delegate>,
11014 _additional_params: HashMap<String, String>,
11015 _scopes: BTreeSet<String>,
11016}
11017
11018impl<'a, C> common::CallBuilder for ProjectLocationOperationDeleteCall<'a, C> {}
11019
11020impl<'a, C> ProjectLocationOperationDeleteCall<'a, C>
11021where
11022 C: common::Connector,
11023{
11024 /// Perform the operation you have build so far.
11025 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
11026 use std::borrow::Cow;
11027 use std::io::{Read, Seek};
11028
11029 use common::{url::Params, ToParts};
11030 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11031
11032 let mut dd = common::DefaultDelegate;
11033 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11034 dlg.begin(common::MethodInfo {
11035 id: "composer.projects.locations.operations.delete",
11036 http_method: hyper::Method::DELETE,
11037 });
11038
11039 for &field in ["alt", "name"].iter() {
11040 if self._additional_params.contains_key(field) {
11041 dlg.finished(false);
11042 return Err(common::Error::FieldClash(field));
11043 }
11044 }
11045
11046 let mut params = Params::with_capacity(3 + self._additional_params.len());
11047 params.push("name", self._name);
11048
11049 params.extend(self._additional_params.iter());
11050
11051 params.push("alt", "json");
11052 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11053 if self._scopes.is_empty() {
11054 self._scopes
11055 .insert(Scope::CloudPlatform.as_ref().to_string());
11056 }
11057
11058 #[allow(clippy::single_element_loop)]
11059 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11060 url = params.uri_replacement(url, param_name, find_this, true);
11061 }
11062 {
11063 let to_remove = ["name"];
11064 params.remove_params(&to_remove);
11065 }
11066
11067 let url = params.parse_with_url(&url);
11068
11069 loop {
11070 let token = match self
11071 .hub
11072 .auth
11073 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11074 .await
11075 {
11076 Ok(token) => token,
11077 Err(e) => match dlg.token(e) {
11078 Ok(token) => token,
11079 Err(e) => {
11080 dlg.finished(false);
11081 return Err(common::Error::MissingToken(e));
11082 }
11083 },
11084 };
11085 let mut req_result = {
11086 let client = &self.hub.client;
11087 dlg.pre_request();
11088 let mut req_builder = hyper::Request::builder()
11089 .method(hyper::Method::DELETE)
11090 .uri(url.as_str())
11091 .header(USER_AGENT, self.hub._user_agent.clone());
11092
11093 if let Some(token) = token.as_ref() {
11094 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11095 }
11096
11097 let request = req_builder
11098 .header(CONTENT_LENGTH, 0_u64)
11099 .body(common::to_body::<String>(None));
11100
11101 client.request(request.unwrap()).await
11102 };
11103
11104 match req_result {
11105 Err(err) => {
11106 if let common::Retry::After(d) = dlg.http_error(&err) {
11107 sleep(d).await;
11108 continue;
11109 }
11110 dlg.finished(false);
11111 return Err(common::Error::HttpError(err));
11112 }
11113 Ok(res) => {
11114 let (mut parts, body) = res.into_parts();
11115 let mut body = common::Body::new(body);
11116 if !parts.status.is_success() {
11117 let bytes = common::to_bytes(body).await.unwrap_or_default();
11118 let error = serde_json::from_str(&common::to_string(&bytes));
11119 let response = common::to_response(parts, bytes.into());
11120
11121 if let common::Retry::After(d) =
11122 dlg.http_failure(&response, error.as_ref().ok())
11123 {
11124 sleep(d).await;
11125 continue;
11126 }
11127
11128 dlg.finished(false);
11129
11130 return Err(match error {
11131 Ok(value) => common::Error::BadRequest(value),
11132 _ => common::Error::Failure(response),
11133 });
11134 }
11135 let response = {
11136 let bytes = common::to_bytes(body).await.unwrap_or_default();
11137 let encoded = common::to_string(&bytes);
11138 match serde_json::from_str(&encoded) {
11139 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11140 Err(error) => {
11141 dlg.response_json_decode_error(&encoded, &error);
11142 return Err(common::Error::JsonDecodeError(
11143 encoded.to_string(),
11144 error,
11145 ));
11146 }
11147 }
11148 };
11149
11150 dlg.finished(true);
11151 return Ok(response);
11152 }
11153 }
11154 }
11155 }
11156
11157 /// The name of the operation resource to be deleted.
11158 ///
11159 /// Sets the *name* path property to the given value.
11160 ///
11161 /// Even though the property as already been set when instantiating this call,
11162 /// we provide this method for API completeness.
11163 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationDeleteCall<'a, C> {
11164 self._name = new_value.to_string();
11165 self
11166 }
11167 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11168 /// while executing the actual API request.
11169 ///
11170 /// ````text
11171 /// It should be used to handle progress information, and to implement a certain level of resilience.
11172 /// ````
11173 ///
11174 /// Sets the *delegate* property to the given value.
11175 pub fn delegate(
11176 mut self,
11177 new_value: &'a mut dyn common::Delegate,
11178 ) -> ProjectLocationOperationDeleteCall<'a, C> {
11179 self._delegate = Some(new_value);
11180 self
11181 }
11182
11183 /// Set any additional parameter of the query string used in the request.
11184 /// It should be used to set parameters which are not yet available through their own
11185 /// setters.
11186 ///
11187 /// Please note that this method must not be used to set any of the known parameters
11188 /// which have their own setter method. If done anyway, the request will fail.
11189 ///
11190 /// # Additional Parameters
11191 ///
11192 /// * *$.xgafv* (query-string) - V1 error format.
11193 /// * *access_token* (query-string) - OAuth access token.
11194 /// * *alt* (query-string) - Data format for response.
11195 /// * *callback* (query-string) - JSONP
11196 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11197 /// * *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.
11198 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11199 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11200 /// * *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.
11201 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11202 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11203 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationDeleteCall<'a, C>
11204 where
11205 T: AsRef<str>,
11206 {
11207 self._additional_params
11208 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11209 self
11210 }
11211
11212 /// Identifies the authorization scope for the method you are building.
11213 ///
11214 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11215 /// [`Scope::CloudPlatform`].
11216 ///
11217 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11218 /// tokens for more than one scope.
11219 ///
11220 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11221 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11222 /// sufficient, a read-write scope will do as well.
11223 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationDeleteCall<'a, C>
11224 where
11225 St: AsRef<str>,
11226 {
11227 self._scopes.insert(String::from(scope.as_ref()));
11228 self
11229 }
11230 /// Identifies the authorization scope(s) for the method you are building.
11231 ///
11232 /// See [`Self::add_scope()`] for details.
11233 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationDeleteCall<'a, C>
11234 where
11235 I: IntoIterator<Item = St>,
11236 St: AsRef<str>,
11237 {
11238 self._scopes
11239 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11240 self
11241 }
11242
11243 /// Removes all scopes, and no default scope will be used either.
11244 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11245 /// for details).
11246 pub fn clear_scopes(mut self) -> ProjectLocationOperationDeleteCall<'a, C> {
11247 self._scopes.clear();
11248 self
11249 }
11250}
11251
11252/// 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.
11253///
11254/// A builder for the *locations.operations.get* method supported by a *project* resource.
11255/// It is not used directly, but through a [`ProjectMethods`] instance.
11256///
11257/// # Example
11258///
11259/// Instantiate a resource method builder
11260///
11261/// ```test_harness,no_run
11262/// # extern crate hyper;
11263/// # extern crate hyper_rustls;
11264/// # extern crate google_composer1 as composer1;
11265/// # async fn dox() {
11266/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11267///
11268/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11269/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11270/// # .with_native_roots()
11271/// # .unwrap()
11272/// # .https_only()
11273/// # .enable_http2()
11274/// # .build();
11275///
11276/// # let executor = hyper_util::rt::TokioExecutor::new();
11277/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11278/// # secret,
11279/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11280/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11281/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11282/// # ),
11283/// # ).build().await.unwrap();
11284///
11285/// # let client = hyper_util::client::legacy::Client::builder(
11286/// # hyper_util::rt::TokioExecutor::new()
11287/// # )
11288/// # .build(
11289/// # hyper_rustls::HttpsConnectorBuilder::new()
11290/// # .with_native_roots()
11291/// # .unwrap()
11292/// # .https_or_http()
11293/// # .enable_http2()
11294/// # .build()
11295/// # );
11296/// # let mut hub = CloudComposer::new(client, auth);
11297/// // You can configure optional parameters by calling the respective setters at will, and
11298/// // execute the final call using `doit()`.
11299/// // Values shown here are possibly random and not representative !
11300/// let result = hub.projects().locations_operations_get("name")
11301/// .doit().await;
11302/// # }
11303/// ```
11304pub struct ProjectLocationOperationGetCall<'a, C>
11305where
11306 C: 'a,
11307{
11308 hub: &'a CloudComposer<C>,
11309 _name: String,
11310 _delegate: Option<&'a mut dyn common::Delegate>,
11311 _additional_params: HashMap<String, String>,
11312 _scopes: BTreeSet<String>,
11313}
11314
11315impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
11316
11317impl<'a, C> ProjectLocationOperationGetCall<'a, C>
11318where
11319 C: common::Connector,
11320{
11321 /// Perform the operation you have build so far.
11322 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11323 use std::borrow::Cow;
11324 use std::io::{Read, Seek};
11325
11326 use common::{url::Params, ToParts};
11327 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11328
11329 let mut dd = common::DefaultDelegate;
11330 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11331 dlg.begin(common::MethodInfo {
11332 id: "composer.projects.locations.operations.get",
11333 http_method: hyper::Method::GET,
11334 });
11335
11336 for &field in ["alt", "name"].iter() {
11337 if self._additional_params.contains_key(field) {
11338 dlg.finished(false);
11339 return Err(common::Error::FieldClash(field));
11340 }
11341 }
11342
11343 let mut params = Params::with_capacity(3 + self._additional_params.len());
11344 params.push("name", self._name);
11345
11346 params.extend(self._additional_params.iter());
11347
11348 params.push("alt", "json");
11349 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11350 if self._scopes.is_empty() {
11351 self._scopes
11352 .insert(Scope::CloudPlatform.as_ref().to_string());
11353 }
11354
11355 #[allow(clippy::single_element_loop)]
11356 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11357 url = params.uri_replacement(url, param_name, find_this, true);
11358 }
11359 {
11360 let to_remove = ["name"];
11361 params.remove_params(&to_remove);
11362 }
11363
11364 let url = params.parse_with_url(&url);
11365
11366 loop {
11367 let token = match self
11368 .hub
11369 .auth
11370 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11371 .await
11372 {
11373 Ok(token) => token,
11374 Err(e) => match dlg.token(e) {
11375 Ok(token) => token,
11376 Err(e) => {
11377 dlg.finished(false);
11378 return Err(common::Error::MissingToken(e));
11379 }
11380 },
11381 };
11382 let mut req_result = {
11383 let client = &self.hub.client;
11384 dlg.pre_request();
11385 let mut req_builder = hyper::Request::builder()
11386 .method(hyper::Method::GET)
11387 .uri(url.as_str())
11388 .header(USER_AGENT, self.hub._user_agent.clone());
11389
11390 if let Some(token) = token.as_ref() {
11391 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11392 }
11393
11394 let request = req_builder
11395 .header(CONTENT_LENGTH, 0_u64)
11396 .body(common::to_body::<String>(None));
11397
11398 client.request(request.unwrap()).await
11399 };
11400
11401 match req_result {
11402 Err(err) => {
11403 if let common::Retry::After(d) = dlg.http_error(&err) {
11404 sleep(d).await;
11405 continue;
11406 }
11407 dlg.finished(false);
11408 return Err(common::Error::HttpError(err));
11409 }
11410 Ok(res) => {
11411 let (mut parts, body) = res.into_parts();
11412 let mut body = common::Body::new(body);
11413 if !parts.status.is_success() {
11414 let bytes = common::to_bytes(body).await.unwrap_or_default();
11415 let error = serde_json::from_str(&common::to_string(&bytes));
11416 let response = common::to_response(parts, bytes.into());
11417
11418 if let common::Retry::After(d) =
11419 dlg.http_failure(&response, error.as_ref().ok())
11420 {
11421 sleep(d).await;
11422 continue;
11423 }
11424
11425 dlg.finished(false);
11426
11427 return Err(match error {
11428 Ok(value) => common::Error::BadRequest(value),
11429 _ => common::Error::Failure(response),
11430 });
11431 }
11432 let response = {
11433 let bytes = common::to_bytes(body).await.unwrap_or_default();
11434 let encoded = common::to_string(&bytes);
11435 match serde_json::from_str(&encoded) {
11436 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11437 Err(error) => {
11438 dlg.response_json_decode_error(&encoded, &error);
11439 return Err(common::Error::JsonDecodeError(
11440 encoded.to_string(),
11441 error,
11442 ));
11443 }
11444 }
11445 };
11446
11447 dlg.finished(true);
11448 return Ok(response);
11449 }
11450 }
11451 }
11452 }
11453
11454 /// The name of the operation resource.
11455 ///
11456 /// Sets the *name* path property to the given value.
11457 ///
11458 /// Even though the property as already been set when instantiating this call,
11459 /// we provide this method for API completeness.
11460 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
11461 self._name = new_value.to_string();
11462 self
11463 }
11464 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11465 /// while executing the actual API request.
11466 ///
11467 /// ````text
11468 /// It should be used to handle progress information, and to implement a certain level of resilience.
11469 /// ````
11470 ///
11471 /// Sets the *delegate* property to the given value.
11472 pub fn delegate(
11473 mut self,
11474 new_value: &'a mut dyn common::Delegate,
11475 ) -> ProjectLocationOperationGetCall<'a, C> {
11476 self._delegate = Some(new_value);
11477 self
11478 }
11479
11480 /// Set any additional parameter of the query string used in the request.
11481 /// It should be used to set parameters which are not yet available through their own
11482 /// setters.
11483 ///
11484 /// Please note that this method must not be used to set any of the known parameters
11485 /// which have their own setter method. If done anyway, the request will fail.
11486 ///
11487 /// # Additional Parameters
11488 ///
11489 /// * *$.xgafv* (query-string) - V1 error format.
11490 /// * *access_token* (query-string) - OAuth access token.
11491 /// * *alt* (query-string) - Data format for response.
11492 /// * *callback* (query-string) - JSONP
11493 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11494 /// * *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.
11495 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11496 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11497 /// * *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.
11498 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11499 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11500 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
11501 where
11502 T: AsRef<str>,
11503 {
11504 self._additional_params
11505 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11506 self
11507 }
11508
11509 /// Identifies the authorization scope for the method you are building.
11510 ///
11511 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11512 /// [`Scope::CloudPlatform`].
11513 ///
11514 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11515 /// tokens for more than one scope.
11516 ///
11517 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11518 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11519 /// sufficient, a read-write scope will do as well.
11520 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
11521 where
11522 St: AsRef<str>,
11523 {
11524 self._scopes.insert(String::from(scope.as_ref()));
11525 self
11526 }
11527 /// Identifies the authorization scope(s) for the method you are building.
11528 ///
11529 /// See [`Self::add_scope()`] for details.
11530 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
11531 where
11532 I: IntoIterator<Item = St>,
11533 St: AsRef<str>,
11534 {
11535 self._scopes
11536 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11537 self
11538 }
11539
11540 /// Removes all scopes, and no default scope will be used either.
11541 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11542 /// for details).
11543 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
11544 self._scopes.clear();
11545 self
11546 }
11547}
11548
11549/// Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
11550///
11551/// A builder for the *locations.operations.list* method supported by a *project* resource.
11552/// It is not used directly, but through a [`ProjectMethods`] instance.
11553///
11554/// # Example
11555///
11556/// Instantiate a resource method builder
11557///
11558/// ```test_harness,no_run
11559/// # extern crate hyper;
11560/// # extern crate hyper_rustls;
11561/// # extern crate google_composer1 as composer1;
11562/// # async fn dox() {
11563/// # use composer1::{CloudComposer, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11564///
11565/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11566/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11567/// # .with_native_roots()
11568/// # .unwrap()
11569/// # .https_only()
11570/// # .enable_http2()
11571/// # .build();
11572///
11573/// # let executor = hyper_util::rt::TokioExecutor::new();
11574/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11575/// # secret,
11576/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11577/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11578/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11579/// # ),
11580/// # ).build().await.unwrap();
11581///
11582/// # let client = hyper_util::client::legacy::Client::builder(
11583/// # hyper_util::rt::TokioExecutor::new()
11584/// # )
11585/// # .build(
11586/// # hyper_rustls::HttpsConnectorBuilder::new()
11587/// # .with_native_roots()
11588/// # .unwrap()
11589/// # .https_or_http()
11590/// # .enable_http2()
11591/// # .build()
11592/// # );
11593/// # let mut hub = CloudComposer::new(client, auth);
11594/// // You can configure optional parameters by calling the respective setters at will, and
11595/// // execute the final call using `doit()`.
11596/// // Values shown here are possibly random and not representative !
11597/// let result = hub.projects().locations_operations_list("name")
11598/// .return_partial_success(true)
11599/// .page_token("et")
11600/// .page_size(-68)
11601/// .filter("vero")
11602/// .doit().await;
11603/// # }
11604/// ```
11605pub struct ProjectLocationOperationListCall<'a, C>
11606where
11607 C: 'a,
11608{
11609 hub: &'a CloudComposer<C>,
11610 _name: String,
11611 _return_partial_success: Option<bool>,
11612 _page_token: Option<String>,
11613 _page_size: Option<i32>,
11614 _filter: Option<String>,
11615 _delegate: Option<&'a mut dyn common::Delegate>,
11616 _additional_params: HashMap<String, String>,
11617 _scopes: BTreeSet<String>,
11618}
11619
11620impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
11621
11622impl<'a, C> ProjectLocationOperationListCall<'a, C>
11623where
11624 C: common::Connector,
11625{
11626 /// Perform the operation you have build so far.
11627 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
11628 use std::borrow::Cow;
11629 use std::io::{Read, Seek};
11630
11631 use common::{url::Params, ToParts};
11632 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11633
11634 let mut dd = common::DefaultDelegate;
11635 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11636 dlg.begin(common::MethodInfo {
11637 id: "composer.projects.locations.operations.list",
11638 http_method: hyper::Method::GET,
11639 });
11640
11641 for &field in [
11642 "alt",
11643 "name",
11644 "returnPartialSuccess",
11645 "pageToken",
11646 "pageSize",
11647 "filter",
11648 ]
11649 .iter()
11650 {
11651 if self._additional_params.contains_key(field) {
11652 dlg.finished(false);
11653 return Err(common::Error::FieldClash(field));
11654 }
11655 }
11656
11657 let mut params = Params::with_capacity(7 + self._additional_params.len());
11658 params.push("name", self._name);
11659 if let Some(value) = self._return_partial_success.as_ref() {
11660 params.push("returnPartialSuccess", value.to_string());
11661 }
11662 if let Some(value) = self._page_token.as_ref() {
11663 params.push("pageToken", value);
11664 }
11665 if let Some(value) = self._page_size.as_ref() {
11666 params.push("pageSize", value.to_string());
11667 }
11668 if let Some(value) = self._filter.as_ref() {
11669 params.push("filter", value);
11670 }
11671
11672 params.extend(self._additional_params.iter());
11673
11674 params.push("alt", "json");
11675 let mut url = self.hub._base_url.clone() + "v1/{+name}/operations";
11676 if self._scopes.is_empty() {
11677 self._scopes
11678 .insert(Scope::CloudPlatform.as_ref().to_string());
11679 }
11680
11681 #[allow(clippy::single_element_loop)]
11682 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11683 url = params.uri_replacement(url, param_name, find_this, true);
11684 }
11685 {
11686 let to_remove = ["name"];
11687 params.remove_params(&to_remove);
11688 }
11689
11690 let url = params.parse_with_url(&url);
11691
11692 loop {
11693 let token = match self
11694 .hub
11695 .auth
11696 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11697 .await
11698 {
11699 Ok(token) => token,
11700 Err(e) => match dlg.token(e) {
11701 Ok(token) => token,
11702 Err(e) => {
11703 dlg.finished(false);
11704 return Err(common::Error::MissingToken(e));
11705 }
11706 },
11707 };
11708 let mut req_result = {
11709 let client = &self.hub.client;
11710 dlg.pre_request();
11711 let mut req_builder = hyper::Request::builder()
11712 .method(hyper::Method::GET)
11713 .uri(url.as_str())
11714 .header(USER_AGENT, self.hub._user_agent.clone());
11715
11716 if let Some(token) = token.as_ref() {
11717 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11718 }
11719
11720 let request = req_builder
11721 .header(CONTENT_LENGTH, 0_u64)
11722 .body(common::to_body::<String>(None));
11723
11724 client.request(request.unwrap()).await
11725 };
11726
11727 match req_result {
11728 Err(err) => {
11729 if let common::Retry::After(d) = dlg.http_error(&err) {
11730 sleep(d).await;
11731 continue;
11732 }
11733 dlg.finished(false);
11734 return Err(common::Error::HttpError(err));
11735 }
11736 Ok(res) => {
11737 let (mut parts, body) = res.into_parts();
11738 let mut body = common::Body::new(body);
11739 if !parts.status.is_success() {
11740 let bytes = common::to_bytes(body).await.unwrap_or_default();
11741 let error = serde_json::from_str(&common::to_string(&bytes));
11742 let response = common::to_response(parts, bytes.into());
11743
11744 if let common::Retry::After(d) =
11745 dlg.http_failure(&response, error.as_ref().ok())
11746 {
11747 sleep(d).await;
11748 continue;
11749 }
11750
11751 dlg.finished(false);
11752
11753 return Err(match error {
11754 Ok(value) => common::Error::BadRequest(value),
11755 _ => common::Error::Failure(response),
11756 });
11757 }
11758 let response = {
11759 let bytes = common::to_bytes(body).await.unwrap_or_default();
11760 let encoded = common::to_string(&bytes);
11761 match serde_json::from_str(&encoded) {
11762 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11763 Err(error) => {
11764 dlg.response_json_decode_error(&encoded, &error);
11765 return Err(common::Error::JsonDecodeError(
11766 encoded.to_string(),
11767 error,
11768 ));
11769 }
11770 }
11771 };
11772
11773 dlg.finished(true);
11774 return Ok(response);
11775 }
11776 }
11777 }
11778 }
11779
11780 /// The name of the operation's parent resource.
11781 ///
11782 /// Sets the *name* path property to the given value.
11783 ///
11784 /// Even though the property as already been set when instantiating this call,
11785 /// we provide this method for API completeness.
11786 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11787 self._name = new_value.to_string();
11788 self
11789 }
11790 /// When set to `true`, operations that are reachable are returned as normal, and those that are unreachable are returned in the ListOperationsResponse.unreachable field. This can only be `true` when reading across collections. For example, when `parent` is set to `"projects/example/locations/-"`. This field is not supported by default and will result in an `UNIMPLEMENTED` error if set unless explicitly documented otherwise in service or product specific documentation.
11791 ///
11792 /// Sets the *return partial success* query property to the given value.
11793 pub fn return_partial_success(
11794 mut self,
11795 new_value: bool,
11796 ) -> ProjectLocationOperationListCall<'a, C> {
11797 self._return_partial_success = Some(new_value);
11798 self
11799 }
11800 /// The standard list page token.
11801 ///
11802 /// Sets the *page token* query property to the given value.
11803 pub fn page_token(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11804 self._page_token = Some(new_value.to_string());
11805 self
11806 }
11807 /// The standard list page size.
11808 ///
11809 /// Sets the *page size* query property to the given value.
11810 pub fn page_size(mut self, new_value: i32) -> ProjectLocationOperationListCall<'a, C> {
11811 self._page_size = Some(new_value);
11812 self
11813 }
11814 /// The standard list filter.
11815 ///
11816 /// Sets the *filter* query property to the given value.
11817 pub fn filter(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
11818 self._filter = Some(new_value.to_string());
11819 self
11820 }
11821 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11822 /// while executing the actual API request.
11823 ///
11824 /// ````text
11825 /// It should be used to handle progress information, and to implement a certain level of resilience.
11826 /// ````
11827 ///
11828 /// Sets the *delegate* property to the given value.
11829 pub fn delegate(
11830 mut self,
11831 new_value: &'a mut dyn common::Delegate,
11832 ) -> ProjectLocationOperationListCall<'a, C> {
11833 self._delegate = Some(new_value);
11834 self
11835 }
11836
11837 /// Set any additional parameter of the query string used in the request.
11838 /// It should be used to set parameters which are not yet available through their own
11839 /// setters.
11840 ///
11841 /// Please note that this method must not be used to set any of the known parameters
11842 /// which have their own setter method. If done anyway, the request will fail.
11843 ///
11844 /// # Additional Parameters
11845 ///
11846 /// * *$.xgafv* (query-string) - V1 error format.
11847 /// * *access_token* (query-string) - OAuth access token.
11848 /// * *alt* (query-string) - Data format for response.
11849 /// * *callback* (query-string) - JSONP
11850 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11851 /// * *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.
11852 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11853 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11854 /// * *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.
11855 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11856 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11857 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
11858 where
11859 T: AsRef<str>,
11860 {
11861 self._additional_params
11862 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11863 self
11864 }
11865
11866 /// Identifies the authorization scope for the method you are building.
11867 ///
11868 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11869 /// [`Scope::CloudPlatform`].
11870 ///
11871 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11872 /// tokens for more than one scope.
11873 ///
11874 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11875 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11876 /// sufficient, a read-write scope will do as well.
11877 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
11878 where
11879 St: AsRef<str>,
11880 {
11881 self._scopes.insert(String::from(scope.as_ref()));
11882 self
11883 }
11884 /// Identifies the authorization scope(s) for the method you are building.
11885 ///
11886 /// See [`Self::add_scope()`] for details.
11887 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
11888 where
11889 I: IntoIterator<Item = St>,
11890 St: AsRef<str>,
11891 {
11892 self._scopes
11893 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11894 self
11895 }
11896
11897 /// Removes all scopes, and no default scope will be used either.
11898 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11899 /// for details).
11900 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
11901 self._scopes.clear();
11902 self
11903 }
11904}