google_container1/
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 Container 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_container1 as container1;
49/// use container1::{Result, Error};
50/// # async fn dox() {
51/// use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
52///
53/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
54/// // `client_secret`, among other things.
55/// let secret: yup_oauth2::ApplicationSecret = Default::default();
56/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
57/// // unless you replace  `None` with the desired Flow.
58/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
59/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
60/// // retrieve them from storage.
61/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
62///     secret,
63///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
64/// ).build().await.unwrap();
65///
66/// let client = hyper_util::client::legacy::Client::builder(
67///     hyper_util::rt::TokioExecutor::new()
68/// )
69/// .build(
70///     hyper_rustls::HttpsConnectorBuilder::new()
71///         .with_native_roots()
72///         .unwrap()
73///         .https_or_http()
74///         .enable_http1()
75///         .build()
76/// );
77/// let mut hub = Container::new(client, auth);
78/// // You can configure optional parameters by calling the respective setters at will, and
79/// // execute the final call using `doit()`.
80/// // Values shown here are possibly random and not representative !
81/// let result = hub.projects().locations_clusters_node_pools_delete("name")
82///              .zone("duo")
83///              .project_id("ipsum")
84///              .node_pool_id("gubergren")
85///              .cluster_id("Lorem")
86///              .doit().await;
87///
88/// match result {
89///     Err(e) => match e {
90///         // The Error enum provides details about what exactly happened.
91///         // You can also just use its `Debug`, `Display` or `Error` traits
92///          Error::HttpError(_)
93///         |Error::Io(_)
94///         |Error::MissingAPIKey
95///         |Error::MissingToken(_)
96///         |Error::Cancelled
97///         |Error::UploadSizeLimitExceeded(_, _)
98///         |Error::Failure(_)
99///         |Error::BadRequest(_)
100///         |Error::FieldClash(_)
101///         |Error::JsonDecodeError(_, _) => println!("{}", e),
102///     },
103///     Ok(res) => println!("Success: {:?}", res),
104/// }
105/// # }
106/// ```
107#[derive(Clone)]
108pub struct Container<C> {
109    pub client: common::Client<C>,
110    pub auth: Box<dyn common::GetToken>,
111    _user_agent: String,
112    _base_url: String,
113    _root_url: String,
114}
115
116impl<C> common::Hub for Container<C> {}
117
118impl<'a, C> Container<C> {
119    pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Container<C> {
120        Container {
121            client,
122            auth: Box::new(auth),
123            _user_agent: "google-api-rust-client/6.0.0".to_string(),
124            _base_url: "https://container.googleapis.com/".to_string(),
125            _root_url: "https://container.googleapis.com/".to_string(),
126        }
127    }
128
129    pub fn projects(&'a self) -> ProjectMethods<'a, C> {
130        ProjectMethods { hub: self }
131    }
132
133    /// Set the user-agent header field to use in all requests to the server.
134    /// It defaults to `google-api-rust-client/6.0.0`.
135    ///
136    /// Returns the previously set user-agent.
137    pub fn user_agent(&mut self, agent_name: String) -> String {
138        std::mem::replace(&mut self._user_agent, agent_name)
139    }
140
141    /// Set the base url to use in all requests to the server.
142    /// It defaults to `https://container.googleapis.com/`.
143    ///
144    /// Returns the previously set base url.
145    pub fn base_url(&mut self, new_base_url: String) -> String {
146        std::mem::replace(&mut self._base_url, new_base_url)
147    }
148
149    /// Set the root url to use in all requests to the server.
150    /// It defaults to `https://container.googleapis.com/`.
151    ///
152    /// Returns the previously set root url.
153    pub fn root_url(&mut self, new_root_url: String) -> String {
154        std::mem::replace(&mut self._root_url, new_root_url)
155    }
156}
157
158// ############
159// SCHEMAS ###
160// ##########
161/// AcceleratorConfig represents a Hardware Accelerator request.
162///
163/// This type is not used in any activity, and only used as *part* of another schema.
164///
165#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
166#[serde_with::serde_as]
167#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
168pub struct AcceleratorConfig {
169    /// The number of the accelerator cards exposed to an instance.
170    #[serde(rename = "acceleratorCount")]
171    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
172    pub accelerator_count: Option<i64>,
173    /// The accelerator type resource name. List of supported accelerators [here](https://cloud.google.com/compute/docs/gpus)
174    #[serde(rename = "acceleratorType")]
175    pub accelerator_type: Option<String>,
176    /// The configuration for auto installation of GPU driver.
177    #[serde(rename = "gpuDriverInstallationConfig")]
178    pub gpu_driver_installation_config: Option<GPUDriverInstallationConfig>,
179    /// Size of partitions to create on the GPU. Valid values are described in the NVIDIA [mig user guide](https://docs.nvidia.com/datacenter/tesla/mig-user-guide/#partitioning).
180    #[serde(rename = "gpuPartitionSize")]
181    pub gpu_partition_size: Option<String>,
182    /// The configuration for GPU sharing options.
183    #[serde(rename = "gpuSharingConfig")]
184    pub gpu_sharing_config: Option<GPUSharingConfig>,
185}
186
187impl common::Part for AcceleratorConfig {}
188
189/// AdditionalNodeNetworkConfig is the configuration for additional node networks within the NodeNetworkConfig message
190///
191/// This type is not used in any activity, and only used as *part* of another schema.
192///
193#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
194#[serde_with::serde_as]
195#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
196pub struct AdditionalNodeNetworkConfig {
197    /// Name of the VPC where the additional interface belongs
198    pub network: Option<String>,
199    /// Name of the subnetwork where the additional interface belongs
200    pub subnetwork: Option<String>,
201}
202
203impl common::Part for AdditionalNodeNetworkConfig {}
204
205/// AdditionalPodNetworkConfig is the configuration for additional pod networks within the NodeNetworkConfig message
206///
207/// This type is not used in any activity, and only used as *part* of another schema.
208///
209#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
210#[serde_with::serde_as]
211#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
212pub struct AdditionalPodNetworkConfig {
213    /// The maximum number of pods per node which use this pod network
214    #[serde(rename = "maxPodsPerNode")]
215    pub max_pods_per_node: Option<MaxPodsConstraint>,
216    /// The name of the secondary range on the subnet which provides IP address for this pod range
217    #[serde(rename = "secondaryPodRange")]
218    pub secondary_pod_range: Option<String>,
219    /// Name of the subnetwork where the additional pod network belongs
220    pub subnetwork: Option<String>,
221}
222
223impl common::Part for AdditionalPodNetworkConfig {}
224
225/// AdditionalPodRangesConfig is the configuration for additional pod secondary ranges supporting the ClusterUpdate message.
226///
227/// This type is not used in any activity, and only used as *part* of another schema.
228///
229#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
230#[serde_with::serde_as]
231#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
232pub struct AdditionalPodRangesConfig {
233    /// Output only. [Output only] Information for additional pod range.
234    #[serde(rename = "podRangeInfo")]
235    pub pod_range_info: Option<Vec<RangeInfo>>,
236    /// Name for pod secondary ipv4 range which has the actual range defined ahead.
237    #[serde(rename = "podRangeNames")]
238    pub pod_range_names: Option<Vec<String>>,
239}
240
241impl common::Part for AdditionalPodRangesConfig {}
242
243/// Configuration for the addons that can be automatically spun up in the cluster, enabling additional functionality.
244///
245/// This type is not used in any activity, and only used as *part* of another schema.
246///
247#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
248#[serde_with::serde_as]
249#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
250pub struct AddonsConfig {
251    /// Configuration for the Cloud Run addon, which allows the user to use a managed Knative service.
252    #[serde(rename = "cloudRunConfig")]
253    pub cloud_run_config: Option<CloudRunConfig>,
254    /// Configuration for the ConfigConnector add-on, a Kubernetes extension to manage hosted GCP services through the Kubernetes API
255    #[serde(rename = "configConnectorConfig")]
256    pub config_connector_config: Option<ConfigConnectorConfig>,
257    /// Configuration for NodeLocalDNS, a dns cache running on cluster nodes
258    #[serde(rename = "dnsCacheConfig")]
259    pub dns_cache_config: Option<DnsCacheConfig>,
260    /// Configuration for the Compute Engine Persistent Disk CSI driver.
261    #[serde(rename = "gcePersistentDiskCsiDriverConfig")]
262    pub gce_persistent_disk_csi_driver_config: Option<GcePersistentDiskCsiDriverConfig>,
263    /// Configuration for the GCP Filestore CSI driver.
264    #[serde(rename = "gcpFilestoreCsiDriverConfig")]
265    pub gcp_filestore_csi_driver_config: Option<GcpFilestoreCsiDriverConfig>,
266    /// Configuration for the Cloud Storage Fuse CSI driver.
267    #[serde(rename = "gcsFuseCsiDriverConfig")]
268    pub gcs_fuse_csi_driver_config: Option<GcsFuseCsiDriverConfig>,
269    /// Configuration for the Backup for GKE agent addon.
270    #[serde(rename = "gkeBackupAgentConfig")]
271    pub gke_backup_agent_config: Option<GkeBackupAgentConfig>,
272    /// Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods.
273    #[serde(rename = "horizontalPodAutoscaling")]
274    pub horizontal_pod_autoscaling: Option<HorizontalPodAutoscaling>,
275    /// Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.
276    #[serde(rename = "httpLoadBalancing")]
277    pub http_load_balancing: Option<HttpLoadBalancing>,
278    /// Configuration for the Kubernetes Dashboard. This addon is deprecated, and will be disabled in 1.15. It is recommended to use the Cloud Console to manage and monitor your Kubernetes clusters, workloads and applications. For more information, see: https://cloud.google.com/kubernetes-engine/docs/concepts/dashboards
279    #[serde(rename = "kubernetesDashboard")]
280    pub kubernetes_dashboard: Option<KubernetesDashboard>,
281    /// Configuration for NetworkPolicy. This only tracks whether the addon is enabled or not on the Master, it does not track whether network policy is enabled for the nodes.
282    #[serde(rename = "networkPolicyConfig")]
283    pub network_policy_config: Option<NetworkPolicyConfig>,
284    /// Optional. Configuration for the StatefulHA add-on.
285    #[serde(rename = "statefulHaConfig")]
286    pub stateful_ha_config: Option<StatefulHAConfig>,
287}
288
289impl common::Part for AddonsConfig {}
290
291/// AdvancedDatapathObservabilityConfig specifies configuration of observability features of advanced datapath.
292///
293/// This type is not used in any activity, and only used as *part* of another schema.
294///
295#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
296#[serde_with::serde_as]
297#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
298pub struct AdvancedDatapathObservabilityConfig {
299    /// Expose flow metrics on nodes
300    #[serde(rename = "enableMetrics")]
301    pub enable_metrics: Option<bool>,
302    /// Enable Relay component
303    #[serde(rename = "enableRelay")]
304    pub enable_relay: Option<bool>,
305    /// Method used to make Relay available
306    #[serde(rename = "relayMode")]
307    pub relay_mode: Option<String>,
308}
309
310impl common::Part for AdvancedDatapathObservabilityConfig {}
311
312/// Specifies options for controlling advanced machine features.
313///
314/// This type is not used in any activity, and only used as *part* of another schema.
315///
316#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
317#[serde_with::serde_as]
318#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
319pub struct AdvancedMachineFeatures {
320    /// Whether or not to enable nested virtualization (defaults to false).
321    #[serde(rename = "enableNestedVirtualization")]
322    pub enable_nested_virtualization: Option<bool>,
323    /// The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed.
324    #[serde(rename = "threadsPerCore")]
325    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
326    pub threads_per_core: Option<i64>,
327}
328
329impl common::Part for AdvancedMachineFeatures {}
330
331/// Configuration for returning group information from authenticators.
332///
333/// This type is not used in any activity, and only used as *part* of another schema.
334///
335#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
336#[serde_with::serde_as]
337#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
338pub struct AuthenticatorGroupsConfig {
339    /// Whether this cluster should return group membership lookups during authentication using a group of security groups.
340    pub enabled: Option<bool>,
341    /// The name of the security group-of-groups to be used. Only relevant if enabled = true.
342    #[serde(rename = "securityGroup")]
343    pub security_group: Option<String>,
344}
345
346impl common::Part for AuthenticatorGroupsConfig {}
347
348/// AutoUpgradeOptions defines the set of options for the user to control how the Auto Upgrades will proceed.
349///
350/// This type is not used in any activity, and only used as *part* of another schema.
351///
352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
353#[serde_with::serde_as]
354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
355pub struct AutoUpgradeOptions {
356    /// [Output only] This field is set when upgrades are about to commence with the approximate start time for the upgrades, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
357    #[serde(rename = "autoUpgradeStartTime")]
358    pub auto_upgrade_start_time: Option<String>,
359    /// [Output only] This field is set when upgrades are about to commence with the description of the upgrade.
360    pub description: Option<String>,
361}
362
363impl common::Part for AutoUpgradeOptions {}
364
365/// Autopilot is the configuration for Autopilot settings on the cluster.
366///
367/// This type is not used in any activity, and only used as *part* of another schema.
368///
369#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
370#[serde_with::serde_as]
371#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
372pub struct Autopilot {
373    /// Enable Autopilot
374    pub enabled: Option<bool>,
375    /// Workload policy configuration for Autopilot.
376    #[serde(rename = "workloadPolicyConfig")]
377    pub workload_policy_config: Option<WorkloadPolicyConfig>,
378}
379
380impl common::Part for Autopilot {}
381
382/// AutopilotCompatibilityIssue contains information about a specific compatibility issue with Autopilot mode.
383///
384/// This type is not used in any activity, and only used as *part* of another schema.
385///
386#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
387#[serde_with::serde_as]
388#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
389pub struct AutopilotCompatibilityIssue {
390    /// The constraint type of the issue.
391    #[serde(rename = "constraintType")]
392    pub constraint_type: Option<String>,
393    /// The description of the issue.
394    pub description: Option<String>,
395    /// A URL to a public documnetation, which addresses resolving this issue.
396    #[serde(rename = "documentationUrl")]
397    pub documentation_url: Option<String>,
398    /// The incompatibility type of this issue.
399    #[serde(rename = "incompatibilityType")]
400    pub incompatibility_type: Option<String>,
401    /// The last time when this issue was observed.
402    #[serde(rename = "lastObservation")]
403    pub last_observation: Option<chrono::DateTime<chrono::offset::Utc>>,
404    /// The name of the resources which are subject to this issue.
405    pub subjects: Option<Vec<String>>,
406}
407
408impl common::Part for AutopilotCompatibilityIssue {}
409
410/// AutoprovisioningNodePoolDefaults contains defaults for a node pool created by NAP.
411///
412/// This type is not used in any activity, and only used as *part* of another schema.
413///
414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
415#[serde_with::serde_as]
416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
417pub struct AutoprovisioningNodePoolDefaults {
418    /// The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool. This should be of the form projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. For more information about protecting resources with Cloud KMS Keys please see: https://cloud.google.com/compute/docs/disks/customer-managed-encryption
419    #[serde(rename = "bootDiskKmsKey")]
420    pub boot_disk_kms_key: Option<String>,
421    /// Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB. If unspecified, the default disk size is 100GB.
422    #[serde(rename = "diskSizeGb")]
423    pub disk_size_gb: Option<i32>,
424    /// Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or 'pd-balanced') If unspecified, the default disk type is 'pd-standard'
425    #[serde(rename = "diskType")]
426    pub disk_type: Option<String>,
427    /// The image type to use for NAP created node. Please see https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for available image types.
428    #[serde(rename = "imageType")]
429    pub image_type: Option<String>,
430    /// Enable or disable Kubelet read only port.
431    #[serde(rename = "insecureKubeletReadonlyPortEnabled")]
432    pub insecure_kubelet_readonly_port_enabled: Option<bool>,
433    /// Specifies the node management options for NAP created node-pools.
434    pub management: Option<NodeManagement>,
435    /// Deprecated. Minimum CPU platform to be used for NAP created node pools. The instance may be scheduled on the specified or newer CPU platform. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: Intel Haswell or minCpuPlatform: Intel Sandy Bridge. For more information, read [how to specify min CPU platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform). This field is deprecated, min_cpu_platform should be specified using `cloud.google.com/requested-min-cpu-platform` label selector on the pod. To unset the min cpu platform field pass "automatic" as field value.
436    #[serde(rename = "minCpuPlatform")]
437    pub min_cpu_platform: Option<String>,
438    /// Scopes that are used by NAP when creating node pools.
439    #[serde(rename = "oauthScopes")]
440    pub oauth_scopes: Option<Vec<String>>,
441    /// The Google Cloud Platform Service Account to be used by the node VMs.
442    #[serde(rename = "serviceAccount")]
443    pub service_account: Option<String>,
444    /// Shielded Instance options.
445    #[serde(rename = "shieldedInstanceConfig")]
446    pub shielded_instance_config: Option<ShieldedInstanceConfig>,
447    /// Specifies the upgrade settings for NAP created node pools
448    #[serde(rename = "upgradeSettings")]
449    pub upgrade_settings: Option<UpgradeSettings>,
450}
451
452impl common::Part for AutoprovisioningNodePoolDefaults {}
453
454/// Best effort provisioning.
455///
456/// This type is not used in any activity, and only used as *part* of another schema.
457///
458#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
459#[serde_with::serde_as]
460#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
461pub struct BestEffortProvisioning {
462    /// When this is enabled, cluster/node pool creations will ignore non-fatal errors like stockout to best provision as many nodes as possible right now and eventually bring up all target number of nodes
463    pub enabled: Option<bool>,
464    /// Minimum number of nodes to be provisioned to be considered as succeeded, and the rest of nodes will be provisioned gradually and eventually when stockout issue has been resolved.
465    #[serde(rename = "minProvisionNodes")]
466    pub min_provision_nodes: Option<i32>,
467}
468
469impl common::Part for BestEffortProvisioning {}
470
471/// Parameters for using BigQuery as the destination of resource usage export.
472///
473/// This type is not used in any activity, and only used as *part* of another schema.
474///
475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
476#[serde_with::serde_as]
477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
478pub struct BigQueryDestination {
479    /// The ID of a BigQuery Dataset.
480    #[serde(rename = "datasetId")]
481    pub dataset_id: Option<String>,
482}
483
484impl common::Part for BigQueryDestination {}
485
486/// Configuration for Binary Authorization.
487///
488/// This type is not used in any activity, and only used as *part* of another schema.
489///
490#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
491#[serde_with::serde_as]
492#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
493pub struct BinaryAuthorization {
494    /// This field is deprecated. Leave this unset and instead configure BinaryAuthorization using evaluation_mode. If evaluation_mode is set to anything other than EVALUATION_MODE_UNSPECIFIED, this field is ignored.
495    pub enabled: Option<bool>,
496    /// Mode of operation for binauthz policy evaluation. If unspecified, defaults to DISABLED.
497    #[serde(rename = "evaluationMode")]
498    pub evaluation_mode: Option<String>,
499}
500
501impl common::Part for BinaryAuthorization {}
502
503/// Information relevant to blue-green upgrade.
504///
505/// This type is not used in any activity, and only used as *part* of another schema.
506///
507#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
508#[serde_with::serde_as]
509#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
510pub struct BlueGreenInfo {
511    /// The resource URLs of the \[managed instance groups\] (/compute/docs/instance-groups/creating-groups-of-managed-instances) associated with blue pool.
512    #[serde(rename = "blueInstanceGroupUrls")]
513    pub blue_instance_group_urls: Option<Vec<String>>,
514    /// Time to start deleting blue pool to complete blue-green upgrade, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
515    #[serde(rename = "bluePoolDeletionStartTime")]
516    pub blue_pool_deletion_start_time: Option<String>,
517    /// The resource URLs of the \[managed instance groups\] (/compute/docs/instance-groups/creating-groups-of-managed-instances) associated with green pool.
518    #[serde(rename = "greenInstanceGroupUrls")]
519    pub green_instance_group_urls: Option<Vec<String>>,
520    /// Version of green pool.
521    #[serde(rename = "greenPoolVersion")]
522    pub green_pool_version: Option<String>,
523    /// Current blue-green upgrade phase.
524    pub phase: Option<String>,
525}
526
527impl common::Part for BlueGreenInfo {}
528
529/// Settings for blue-green upgrade.
530///
531/// This type is not used in any activity, and only used as *part* of another schema.
532///
533#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
534#[serde_with::serde_as]
535#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
536pub struct BlueGreenSettings {
537    /// Time needed after draining entire blue pool. After this period, blue pool will be cleaned up.
538    #[serde(rename = "nodePoolSoakDuration")]
539    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
540    pub node_pool_soak_duration: Option<chrono::Duration>,
541    /// Standard policy for the blue-green upgrade.
542    #[serde(rename = "standardRolloutPolicy")]
543    pub standard_rollout_policy: Option<StandardRolloutPolicy>,
544}
545
546impl common::Part for BlueGreenSettings {}
547
548/// CancelOperationRequest cancels a single operation.
549///
550/// # Activities
551///
552/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
553/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
554///
555/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
556/// * [zones operations cancel projects](ProjectZoneOperationCancelCall) (request)
557#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
558#[serde_with::serde_as]
559#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
560pub struct CancelOperationRequest {
561    /// The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
562    pub name: Option<String>,
563    /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
564    #[serde(rename = "operationId")]
565    pub operation_id: Option<String>,
566    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
567    #[serde(rename = "projectId")]
568    pub project_id: Option<String>,
569    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the operation resides. This field has been deprecated and replaced by the name field.
570    pub zone: Option<String>,
571}
572
573impl common::RequestValue for CancelOperationRequest {}
574
575/// CertificateAuthorityDomainConfig configures one or more fully qualified domain names (FQDN) to a specific certificate.
576///
577/// This type is not used in any activity, and only used as *part* of another schema.
578///
579#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
580#[serde_with::serde_as]
581#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
582pub struct CertificateAuthorityDomainConfig {
583    /// List of fully qualified domain names (FQDN). Specifying port is supported. Wilcards are NOT supported. Examples: - my.customdomain.com - 10.0.1.2:5000
584    pub fqdns: Option<Vec<String>>,
585    /// Google Secret Manager (GCP) certificate configuration.
586    #[serde(rename = "gcpSecretManagerCertificateConfig")]
587    pub gcp_secret_manager_certificate_config: Option<GCPSecretManagerCertificateConfig>,
588}
589
590impl common::Part for CertificateAuthorityDomainConfig {}
591
592/// CheckAutopilotCompatibilityResponse has a list of compatibility issues.
593///
594/// # Activities
595///
596/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
597/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
598///
599/// * [locations clusters check autopilot compatibility projects](ProjectLocationClusterCheckAutopilotCompatibilityCall) (response)
600#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
601#[serde_with::serde_as]
602#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
603pub struct CheckAutopilotCompatibilityResponse {
604    /// The list of issues for the given operation.
605    pub issues: Option<Vec<AutopilotCompatibilityIssue>>,
606    /// The summary of the autopilot compatibility response.
607    pub summary: Option<String>,
608}
609
610impl common::ResponseResult for CheckAutopilotCompatibilityResponse {}
611
612/// CidrBlock contains an optional name and one CIDR block.
613///
614/// This type is not used in any activity, and only used as *part* of another schema.
615///
616#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
617#[serde_with::serde_as]
618#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
619pub struct CidrBlock {
620    /// cidr_block must be specified in CIDR notation.
621    #[serde(rename = "cidrBlock")]
622    pub cidr_block: Option<String>,
623    /// display_name is an optional field for users to identify CIDR blocks.
624    #[serde(rename = "displayName")]
625    pub display_name: Option<String>,
626}
627
628impl common::Part for CidrBlock {}
629
630/// Configuration for client certificates on the cluster.
631///
632/// This type is not used in any activity, and only used as *part* of another schema.
633///
634#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
635#[serde_with::serde_as]
636#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
637pub struct ClientCertificateConfig {
638    /// Issue a client certificate.
639    #[serde(rename = "issueClientCertificate")]
640    pub issue_client_certificate: Option<bool>,
641}
642
643impl common::Part for ClientCertificateConfig {}
644
645/// Configuration options for the Cloud Run feature.
646///
647/// This type is not used in any activity, and only used as *part* of another schema.
648///
649#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
650#[serde_with::serde_as]
651#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
652pub struct CloudRunConfig {
653    /// Whether Cloud Run addon is enabled for this cluster.
654    pub disabled: Option<bool>,
655    /// Which load balancer type is installed for Cloud Run.
656    #[serde(rename = "loadBalancerType")]
657    pub load_balancer_type: Option<String>,
658}
659
660impl common::Part for CloudRunConfig {}
661
662/// A Google Kubernetes Engine cluster.
663///
664/// # Activities
665///
666/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
667/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
668///
669/// * [locations clusters get projects](ProjectLocationClusterGetCall) (response)
670/// * [zones clusters get projects](ProjectZoneClusterGetCall) (response)
671#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
672#[serde_with::serde_as]
673#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
674pub struct Cluster {
675    /// Configurations for the various addons available to run in the cluster.
676    #[serde(rename = "addonsConfig")]
677    pub addons_config: Option<AddonsConfig>,
678    /// Configuration controlling RBAC group membership information.
679    #[serde(rename = "authenticatorGroupsConfig")]
680    pub authenticator_groups_config: Option<AuthenticatorGroupsConfig>,
681    /// Autopilot configuration for the cluster.
682    pub autopilot: Option<Autopilot>,
683    /// Cluster-level autoscaling configuration.
684    pub autoscaling: Option<ClusterAutoscaling>,
685    /// Configuration for Binary Authorization.
686    #[serde(rename = "binaryAuthorization")]
687    pub binary_authorization: Option<BinaryAuthorization>,
688    /// The IP address range of the container pods in this cluster, in [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `10.96.0.0/14`). Leave blank to have one automatically chosen or specify a `/14` block in `10.0.0.0/8`.
689    #[serde(rename = "clusterIpv4Cidr")]
690    pub cluster_ipv4_cidr: Option<String>,
691    /// Which conditions caused the current cluster state.
692    pub conditions: Option<Vec<StatusCondition>>,
693    /// Configuration of Confidential Nodes. All the nodes in the cluster will be Confidential VM once enabled.
694    #[serde(rename = "confidentialNodes")]
695    pub confidential_nodes: Option<ConfidentialNodes>,
696    /// Configuration for the fine-grained cost management feature.
697    #[serde(rename = "costManagementConfig")]
698    pub cost_management_config: Option<CostManagementConfig>,
699    /// [Output only] The time the cluster was created, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
700    #[serde(rename = "createTime")]
701    pub create_time: Option<String>,
702    /// [Output only] The current software version of the master endpoint.
703    #[serde(rename = "currentMasterVersion")]
704    pub current_master_version: Option<String>,
705    /// [Output only] The number of nodes currently in the cluster. Deprecated. Call Kubernetes API directly to retrieve node information.
706    #[serde(rename = "currentNodeCount")]
707    pub current_node_count: Option<i32>,
708    /// [Output only] Deprecated, use [NodePools.version](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools) instead. The current version of the node software components. If they are currently at multiple versions because they're in the process of being upgraded, this reflects the minimum version of all nodes.
709    #[serde(rename = "currentNodeVersion")]
710    pub current_node_version: Option<String>,
711    /// Configuration of etcd encryption.
712    #[serde(rename = "databaseEncryption")]
713    pub database_encryption: Option<DatabaseEncryption>,
714    /// The default constraint on the maximum number of pods that can be run simultaneously on a node in the node pool of this cluster. Only honored if cluster created with IP Alias support.
715    #[serde(rename = "defaultMaxPodsConstraint")]
716    pub default_max_pods_constraint: Option<MaxPodsConstraint>,
717    /// An optional description of this cluster.
718    pub description: Option<String>,
719    /// Beta APIs Config
720    #[serde(rename = "enableK8sBetaApis")]
721    pub enable_k8s_beta_apis: Option<K8sBetaAPIConfig>,
722    /// Kubernetes alpha features are enabled on this cluster. This includes alpha API groups (e.g. v1alpha1) and features that may not be production ready in the kubernetes version of the master and nodes. The cluster has no SLA for uptime and master/node upgrades are disabled. Alpha enabled clusters are automatically deleted thirty days after creation.
723    #[serde(rename = "enableKubernetesAlpha")]
724    pub enable_kubernetes_alpha: Option<bool>,
725    /// Enable the ability to use Cloud TPUs in this cluster.
726    #[serde(rename = "enableTpu")]
727    pub enable_tpu: Option<bool>,
728    /// [Output only] The IP address of this cluster's master endpoint. The endpoint can be accessed from the internet at `https://username:password@endpoint/`. See the `masterAuth` property of this resource for username and password information.
729    pub endpoint: Option<String>,
730    /// GKE Enterprise Configuration.
731    #[serde(rename = "enterpriseConfig")]
732    pub enterprise_config: Option<EnterpriseConfig>,
733    /// This checksum is computed by the server based on the value of cluster fields, and may be sent on update requests to ensure the client has an up-to-date value before proceeding.
734    pub etag: Option<String>,
735    /// [Output only] The time the cluster will be automatically deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
736    #[serde(rename = "expireTime")]
737    pub expire_time: Option<String>,
738    /// Fleet information for the cluster.
739    pub fleet: Option<Fleet>,
740    /// Output only. Unique id for the cluster.
741    pub id: Option<String>,
742    /// Configuration for Identity Service component.
743    #[serde(rename = "identityServiceConfig")]
744    pub identity_service_config: Option<IdentityServiceConfig>,
745    /// The initial Kubernetes version for this cluster. Valid versions are those found in validMasterVersions returned by getServerConfig. The version can be upgraded over time; such upgrades are reflected in currentMasterVersion and currentNodeVersion. Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior: - "latest": picks the highest valid Kubernetes version - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - "1.X.Y-gke.N": picks an explicit Kubernetes version - "","-": picks the default Kubernetes version
746    #[serde(rename = "initialClusterVersion")]
747    pub initial_cluster_version: Option<String>,
748    /// The number of nodes to create in this cluster. You must ensure that your Compute Engine [resource quota](https://cloud.google.com/compute/quotas) is sufficient for this number of instances. You must also have available firewall and routes quota. For requests, this field should only be used in lieu of a "node_pool" object, since this configuration (along with the "node_config") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a node_pool at the same time. This field is deprecated, use node_pool.initial_node_count instead.
749    #[serde(rename = "initialNodeCount")]
750    pub initial_node_count: Option<i32>,
751    /// Deprecated. Use node_pools.instance_group_urls.
752    #[serde(rename = "instanceGroupUrls")]
753    pub instance_group_urls: Option<Vec<String>>,
754    /// Configuration for cluster IP allocation.
755    #[serde(rename = "ipAllocationPolicy")]
756    pub ip_allocation_policy: Option<IPAllocationPolicy>,
757    /// The fingerprint of the set of labels for this cluster.
758    #[serde(rename = "labelFingerprint")]
759    pub label_fingerprint: Option<String>,
760    /// Configuration for the legacy ABAC authorization mode.
761    #[serde(rename = "legacyAbac")]
762    pub legacy_abac: Option<LegacyAbac>,
763    /// [Output only] The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) or [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) in which the cluster resides.
764    pub location: Option<String>,
765    /// The list of Google Compute Engine [zones](https://cloud.google.com/compute/docs/zones#available) in which the cluster's nodes should be located. This field provides a default value if [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) are not specified during node pool creation. Warning: changing cluster locations will update the [NodePool.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters.nodePools#NodePool.FIELDS.locations) of all node pools and will result in nodes being added and/or removed.
766    pub locations: Option<Vec<String>>,
767    /// Logging configuration for the cluster.
768    #[serde(rename = "loggingConfig")]
769    pub logging_config: Option<LoggingConfig>,
770    /// The logging service the cluster should use to write logs. Currently available options: * `logging.googleapis.com/kubernetes` - The Cloud Logging service with a Kubernetes-native resource model * `logging.googleapis.com` - The legacy Cloud Logging service (no longer available as of GKE 1.15). * `none` - no logs will be exported from the cluster. If left as an empty string,`logging.googleapis.com/kubernetes` will be used for GKE 1.14+ or `logging.googleapis.com` for earlier versions.
771    #[serde(rename = "loggingService")]
772    pub logging_service: Option<String>,
773    /// Configure the maintenance policy for this cluster.
774    #[serde(rename = "maintenancePolicy")]
775    pub maintenance_policy: Option<MaintenancePolicy>,
776    /// The authentication information for accessing the master endpoint. If unspecified, the defaults are used: For clusters before v1.12, if master_auth is unspecified, `username` will be set to "admin", a random password will be generated, and a client certificate will be issued.
777    #[serde(rename = "masterAuth")]
778    pub master_auth: Option<MasterAuth>,
779    /// The configuration options for master authorized networks feature.
780    #[serde(rename = "masterAuthorizedNetworksConfig")]
781    pub master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
782    /// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
783    #[serde(rename = "meshCertificates")]
784    pub mesh_certificates: Option<MeshCertificates>,
785    /// Monitoring configuration for the cluster.
786    #[serde(rename = "monitoringConfig")]
787    pub monitoring_config: Option<MonitoringConfig>,
788    /// The monitoring service the cluster should use to write metrics. Currently available options: * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring service with a Kubernetes-native resource model * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no longer available as of GKE 1.15). * `none` - No metrics will be exported from the cluster. If left as an empty string,`monitoring.googleapis.com/kubernetes` will be used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions.
789    #[serde(rename = "monitoringService")]
790    pub monitoring_service: Option<String>,
791    /// The name of this cluster. The name must be unique within this project and location (e.g. zone or region), and can be up to 40 characters with the following restrictions: * Lowercase letters, numbers, and hyphens only. * Must start with a letter. * Must end with a number or a letter.
792    pub name: Option<String>,
793    /// The name of the Google Compute Engine [network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the cluster is connected. If left unspecified, the `default` network will be used.
794    pub network: Option<String>,
795    /// Configuration for cluster networking.
796    #[serde(rename = "networkConfig")]
797    pub network_config: Option<NetworkConfig>,
798    /// Configuration options for the NetworkPolicy feature.
799    #[serde(rename = "networkPolicy")]
800    pub network_policy: Option<NetworkPolicy>,
801    /// Parameters used in creating the cluster's nodes. For requests, this field should only be used in lieu of a "node_pool" object, since this configuration (along with the "initial_node_count") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a node_pool at the same time. For responses, this field will be populated with the node configuration of the first node pool. (For configuration of each node pool, see `node_pool.config`) If unspecified, the defaults are used. This field is deprecated, use node_pool.config instead.
802    #[serde(rename = "nodeConfig")]
803    pub node_config: Option<NodeConfig>,
804    /// [Output only] The size of the address space on each node for hosting containers. This is provisioned from within the `container_ipv4_cidr` range. This field will only be set when cluster is in route-based network mode.
805    #[serde(rename = "nodeIpv4CidrSize")]
806    pub node_ipv4_cidr_size: Option<i32>,
807    /// Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
808    #[serde(rename = "nodePoolAutoConfig")]
809    pub node_pool_auto_config: Option<NodePoolAutoConfig>,
810    /// Default NodePool settings for the entire cluster. These settings are overridden if specified on the specific NodePool object.
811    #[serde(rename = "nodePoolDefaults")]
812    pub node_pool_defaults: Option<NodePoolDefaults>,
813    /// The node pools associated with this cluster. This field should not be set if "node_config" or "initial_node_count" are specified.
814    #[serde(rename = "nodePools")]
815    pub node_pools: Option<Vec<NodePool>>,
816    /// Notification configuration of the cluster.
817    #[serde(rename = "notificationConfig")]
818    pub notification_config: Option<NotificationConfig>,
819    /// The configuration of the parent product of the cluster. This field is used by Google internal products that are built on top of the GKE cluster and take the ownership of the cluster.
820    #[serde(rename = "parentProductConfig")]
821    pub parent_product_config: Option<ParentProductConfig>,
822    /// Configuration for private cluster.
823    #[serde(rename = "privateClusterConfig")]
824    pub private_cluster_config: Option<PrivateClusterConfig>,
825    /// Release channel configuration. If left unspecified on cluster creation and a version is specified, the cluster is enrolled in the most mature release channel where the version is available (first checking STABLE, then REGULAR, and finally RAPID). Otherwise, if no release channel configuration and no version is specified, the cluster is enrolled in the REGULAR channel with its default version.
826    #[serde(rename = "releaseChannel")]
827    pub release_channel: Option<ReleaseChannel>,
828    /// The resource labels for the cluster to use to annotate any related Google Compute Engine resources.
829    #[serde(rename = "resourceLabels")]
830    pub resource_labels: Option<HashMap<String, String>>,
831    /// Configuration for exporting resource usages. Resource usage export is disabled when this config is unspecified.
832    #[serde(rename = "resourceUsageExportConfig")]
833    pub resource_usage_export_config: Option<ResourceUsageExportConfig>,
834    /// Output only. Reserved for future use.
835    #[serde(rename = "satisfiesPzi")]
836    pub satisfies_pzi: Option<bool>,
837    /// Output only. Reserved for future use.
838    #[serde(rename = "satisfiesPzs")]
839    pub satisfies_pzs: Option<bool>,
840    /// Enable/Disable Security Posture API features for the cluster.
841    #[serde(rename = "securityPostureConfig")]
842    pub security_posture_config: Option<SecurityPostureConfig>,
843    /// [Output only] Server-defined URL for the resource.
844    #[serde(rename = "selfLink")]
845    pub self_link: Option<String>,
846    /// [Output only] The IP address range of the Kubernetes services in this cluster, in [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `1.2.3.4/29`). Service addresses are typically put in the last `/16` from the container CIDR.
847    #[serde(rename = "servicesIpv4Cidr")]
848    pub services_ipv4_cidr: Option<String>,
849    /// Shielded Nodes configuration.
850    #[serde(rename = "shieldedNodes")]
851    pub shielded_nodes: Option<ShieldedNodes>,
852    /// [Output only] The current status of this cluster.
853    pub status: Option<String>,
854    /// [Output only] Deprecated. Use conditions instead. Additional information about the current status of this cluster, if available.
855    #[serde(rename = "statusMessage")]
856    pub status_message: Option<String>,
857    /// The name of the Google Compute Engine [subnetwork](https://cloud.google.com/compute/docs/subnetworks) to which the cluster is connected.
858    pub subnetwork: Option<String>,
859    /// [Output only] The IP address range of the Cloud TPUs in this cluster, in [CIDR](http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) notation (e.g. `1.2.3.4/29`).
860    #[serde(rename = "tpuIpv4CidrBlock")]
861    pub tpu_ipv4_cidr_block: Option<String>,
862    /// Cluster-level Vertical Pod Autoscaling configuration.
863    #[serde(rename = "verticalPodAutoscaling")]
864    pub vertical_pod_autoscaling: Option<VerticalPodAutoscaling>,
865    /// Configuration for the use of Kubernetes Service Accounts in GCP IAM policies.
866    #[serde(rename = "workloadIdentityConfig")]
867    pub workload_identity_config: Option<WorkloadIdentityConfig>,
868    /// [Output only] The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field is deprecated, use location instead.
869    pub zone: Option<String>,
870}
871
872impl common::ResponseResult for Cluster {}
873
874/// ClusterAutoscaling contains global, per-cluster information required by Cluster Autoscaler to automatically adjust the size of the cluster and create/delete node pools based on the current needs.
875///
876/// This type is not used in any activity, and only used as *part* of another schema.
877///
878#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
879#[serde_with::serde_as]
880#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
881pub struct ClusterAutoscaling {
882    /// The list of Google Compute Engine [zones](https://cloud.google.com/compute/docs/zones#available) in which the NodePool's nodes can be created by NAP.
883    #[serde(rename = "autoprovisioningLocations")]
884    pub autoprovisioning_locations: Option<Vec<String>>,
885    /// AutoprovisioningNodePoolDefaults contains defaults for a node pool created by NAP.
886    #[serde(rename = "autoprovisioningNodePoolDefaults")]
887    pub autoprovisioning_node_pool_defaults: Option<AutoprovisioningNodePoolDefaults>,
888    /// Defines autoscaling behaviour.
889    #[serde(rename = "autoscalingProfile")]
890    pub autoscaling_profile: Option<String>,
891    /// Enables automatic node pool creation and deletion.
892    #[serde(rename = "enableNodeAutoprovisioning")]
893    pub enable_node_autoprovisioning: Option<bool>,
894    /// Contains global constraints regarding minimum and maximum amount of resources in the cluster.
895    #[serde(rename = "resourceLimits")]
896    pub resource_limits: Option<Vec<ResourceLimit>>,
897}
898
899impl common::Part for ClusterAutoscaling {}
900
901/// Configuration of network bandwidth tiers
902///
903/// This type is not used in any activity, and only used as *part* of another schema.
904///
905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
906#[serde_with::serde_as]
907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
908pub struct ClusterNetworkPerformanceConfig {
909    /// Specifies the total network bandwidth tier for NodePools in the cluster.
910    #[serde(rename = "totalEgressBandwidthTier")]
911    pub total_egress_bandwidth_tier: Option<String>,
912}
913
914impl common::Part for ClusterNetworkPerformanceConfig {}
915
916/// ClusterUpdate describes an update to the cluster. Exactly one update can be applied to a cluster with each request, so at most one field can be provided.
917///
918/// This type is not used in any activity, and only used as *part* of another schema.
919///
920#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
921#[serde_with::serde_as]
922#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
923pub struct ClusterUpdate {
924    /// The additional pod ranges to be added to the cluster. These pod ranges can be used by node pools to allocate pod IPs.
925    #[serde(rename = "additionalPodRangesConfig")]
926    pub additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
927    /// Configurations for the various addons available to run in the cluster.
928    #[serde(rename = "desiredAddonsConfig")]
929    pub desired_addons_config: Option<AddonsConfig>,
930    /// The desired authenticator groups config for the cluster.
931    #[serde(rename = "desiredAuthenticatorGroupsConfig")]
932    pub desired_authenticator_groups_config: Option<AuthenticatorGroupsConfig>,
933    /// The desired workload policy configuration for the autopilot cluster.
934    #[serde(rename = "desiredAutopilotWorkloadPolicyConfig")]
935    pub desired_autopilot_workload_policy_config: Option<WorkloadPolicyConfig>,
936    /// The desired configuration options for the Binary Authorization feature.
937    #[serde(rename = "desiredBinaryAuthorization")]
938    pub desired_binary_authorization: Option<BinaryAuthorization>,
939    /// Cluster-level autoscaling configuration.
940    #[serde(rename = "desiredClusterAutoscaling")]
941    pub desired_cluster_autoscaling: Option<ClusterAutoscaling>,
942    /// The desired containerd config for the cluster.
943    #[serde(rename = "desiredContainerdConfig")]
944    pub desired_containerd_config: Option<ContainerdConfig>,
945    /// The desired configuration for the fine-grained cost management feature.
946    #[serde(rename = "desiredCostManagementConfig")]
947    pub desired_cost_management_config: Option<CostManagementConfig>,
948    /// Configuration of etcd encryption.
949    #[serde(rename = "desiredDatabaseEncryption")]
950    pub desired_database_encryption: Option<DatabaseEncryption>,
951    /// The desired datapath provider for the cluster.
952    #[serde(rename = "desiredDatapathProvider")]
953    pub desired_datapath_provider: Option<String>,
954    /// The desired status of whether to disable default sNAT for this cluster.
955    #[serde(rename = "desiredDefaultSnatStatus")]
956    pub desired_default_snat_status: Option<DefaultSnatStatus>,
957    /// DNSConfig contains clusterDNS config for this cluster.
958    #[serde(rename = "desiredDnsConfig")]
959    pub desired_dns_config: Option<DNSConfig>,
960    /// Enable/Disable Cilium Clusterwide Network Policy for the cluster.
961    #[serde(rename = "desiredEnableCiliumClusterwideNetworkPolicy")]
962    pub desired_enable_cilium_clusterwide_network_policy: Option<bool>,
963    /// Enable/Disable FQDN Network Policy for the cluster.
964    #[serde(rename = "desiredEnableFqdnNetworkPolicy")]
965    pub desired_enable_fqdn_network_policy: Option<bool>,
966    /// Enable/Disable Multi-Networking for the cluster
967    #[serde(rename = "desiredEnableMultiNetworking")]
968    pub desired_enable_multi_networking: Option<bool>,
969    /// Enable/Disable private endpoint for the cluster's master.
970    #[serde(rename = "desiredEnablePrivateEndpoint")]
971    pub desired_enable_private_endpoint: Option<bool>,
972    /// The desired fleet configuration for the cluster.
973    #[serde(rename = "desiredFleet")]
974    pub desired_fleet: Option<Fleet>,
975    /// The desired config of Gateway API on this cluster.
976    #[serde(rename = "desiredGatewayApiConfig")]
977    pub desired_gateway_api_config: Option<GatewayAPIConfig>,
978    /// The desired GCFS config for the cluster
979    #[serde(rename = "desiredGcfsConfig")]
980    pub desired_gcfs_config: Option<GcfsConfig>,
981    /// The desired Identity Service component configuration.
982    #[serde(rename = "desiredIdentityServiceConfig")]
983    pub desired_identity_service_config: Option<IdentityServiceConfig>,
984    /// The desired image type for the node pool. NOTE: Set the "desired_node_pool" field as well.
985    #[serde(rename = "desiredImageType")]
986    pub desired_image_type: Option<String>,
987    /// Specify the details of in-transit encryption.
988    #[serde(rename = "desiredInTransitEncryptionConfig")]
989    pub desired_in_transit_encryption_config: Option<String>,
990    /// The desired config of Intra-node visibility.
991    #[serde(rename = "desiredIntraNodeVisibilityConfig")]
992    pub desired_intra_node_visibility_config: Option<IntraNodeVisibilityConfig>,
993    /// Desired Beta APIs to be enabled for cluster.
994    #[serde(rename = "desiredK8sBetaApis")]
995    pub desired_k8s_beta_apis: Option<K8sBetaAPIConfig>,
996    /// The desired L4 Internal Load Balancer Subsetting configuration.
997    #[serde(rename = "desiredL4ilbSubsettingConfig")]
998    pub desired_l4ilb_subsetting_config: Option<ILBSubsettingConfig>,
999    /// The desired list of Google Compute Engine [zones](https://cloud.google.com/compute/docs/zones#available) in which the cluster's nodes should be located. This list must always include the cluster's primary zone. Warning: changing cluster locations will update the locations of all node pools and will result in nodes being added and/or removed.
1000    #[serde(rename = "desiredLocations")]
1001    pub desired_locations: Option<Vec<String>>,
1002    /// The desired logging configuration.
1003    #[serde(rename = "desiredLoggingConfig")]
1004    pub desired_logging_config: Option<LoggingConfig>,
1005    /// The logging service the cluster should use to write logs. Currently available options: * `logging.googleapis.com/kubernetes` - The Cloud Logging service with a Kubernetes-native resource model * `logging.googleapis.com` - The legacy Cloud Logging service (no longer available as of GKE 1.15). * `none` - no logs will be exported from the cluster. If left as an empty string,`logging.googleapis.com/kubernetes` will be used for GKE 1.14+ or `logging.googleapis.com` for earlier versions.
1006    #[serde(rename = "desiredLoggingService")]
1007    pub desired_logging_service: Option<String>,
1008    /// The desired configuration options for master authorized networks feature.
1009    #[serde(rename = "desiredMasterAuthorizedNetworksConfig")]
1010    pub desired_master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
1011    /// The Kubernetes version to change the master to. Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior: - "latest": picks the highest valid Kubernetes version - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - "1.X.Y-gke.N": picks an explicit Kubernetes version - "-": picks the default Kubernetes version
1012    #[serde(rename = "desiredMasterVersion")]
1013    pub desired_master_version: Option<String>,
1014    /// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
1015    #[serde(rename = "desiredMeshCertificates")]
1016    pub desired_mesh_certificates: Option<MeshCertificates>,
1017    /// The desired monitoring configuration.
1018    #[serde(rename = "desiredMonitoringConfig")]
1019    pub desired_monitoring_config: Option<MonitoringConfig>,
1020    /// The monitoring service the cluster should use to write metrics. Currently available options: * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring service with a Kubernetes-native resource model * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no longer available as of GKE 1.15). * `none` - No metrics will be exported from the cluster. If left as an empty string,`monitoring.googleapis.com/kubernetes` will be used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions.
1021    #[serde(rename = "desiredMonitoringService")]
1022    pub desired_monitoring_service: Option<String>,
1023    /// The desired network performance config.
1024    #[serde(rename = "desiredNetworkPerformanceConfig")]
1025    pub desired_network_performance_config: Option<ClusterNetworkPerformanceConfig>,
1026    /// The desired node kubelet config for the cluster.
1027    #[serde(rename = "desiredNodeKubeletConfig")]
1028    pub desired_node_kubelet_config: Option<NodeKubeletConfig>,
1029    /// The desired node kubelet config for all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
1030    #[serde(rename = "desiredNodePoolAutoConfigKubeletConfig")]
1031    pub desired_node_pool_auto_config_kubelet_config: Option<NodeKubeletConfig>,
1032    /// The desired network tags that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
1033    #[serde(rename = "desiredNodePoolAutoConfigNetworkTags")]
1034    pub desired_node_pool_auto_config_network_tags: Option<NetworkTags>,
1035    /// The desired resource manager tags that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
1036    #[serde(rename = "desiredNodePoolAutoConfigResourceManagerTags")]
1037    pub desired_node_pool_auto_config_resource_manager_tags: Option<ResourceManagerTags>,
1038    /// Autoscaler configuration for the node pool specified in desired_node_pool_id. If there is only one pool in the cluster and desired_node_pool_id is not provided then the change applies to that single node pool.
1039    #[serde(rename = "desiredNodePoolAutoscaling")]
1040    pub desired_node_pool_autoscaling: Option<NodePoolAutoscaling>,
1041    /// The node pool to be upgraded. This field is mandatory if "desired_node_version", "desired_image_family" or "desired_node_pool_autoscaling" is specified and there is more than one node pool on the cluster.
1042    #[serde(rename = "desiredNodePoolId")]
1043    pub desired_node_pool_id: Option<String>,
1044    /// The desired node pool logging configuration defaults for the cluster.
1045    #[serde(rename = "desiredNodePoolLoggingConfig")]
1046    pub desired_node_pool_logging_config: Option<NodePoolLoggingConfig>,
1047    /// The Kubernetes version to change the nodes to (typically an upgrade). Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior: - "latest": picks the highest valid Kubernetes version - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - "1.X.Y-gke.N": picks an explicit Kubernetes version - "-": picks the Kubernetes master version
1048    #[serde(rename = "desiredNodeVersion")]
1049    pub desired_node_version: Option<String>,
1050    /// The desired notification configuration.
1051    #[serde(rename = "desiredNotificationConfig")]
1052    pub desired_notification_config: Option<NotificationConfig>,
1053    /// The desired parent product config for the cluster.
1054    #[serde(rename = "desiredParentProductConfig")]
1055    pub desired_parent_product_config: Option<ParentProductConfig>,
1056    /// The desired private cluster configuration. master_global_access_config is the only field that can be changed via this field. See also ClusterUpdate.desired_enable_private_endpoint for modifying other fields within PrivateClusterConfig.
1057    #[serde(rename = "desiredPrivateClusterConfig")]
1058    pub desired_private_cluster_config: Option<PrivateClusterConfig>,
1059    /// The desired state of IPv6 connectivity to Google Services.
1060    #[serde(rename = "desiredPrivateIpv6GoogleAccess")]
1061    pub desired_private_ipv6_google_access: Option<String>,
1062    /// The desired release channel configuration.
1063    #[serde(rename = "desiredReleaseChannel")]
1064    pub desired_release_channel: Option<ReleaseChannel>,
1065    /// The desired configuration for exporting resource usage.
1066    #[serde(rename = "desiredResourceUsageExportConfig")]
1067    pub desired_resource_usage_export_config: Option<ResourceUsageExportConfig>,
1068    /// Enable/Disable Security Posture API features for the cluster.
1069    #[serde(rename = "desiredSecurityPostureConfig")]
1070    pub desired_security_posture_config: Option<SecurityPostureConfig>,
1071    /// ServiceExternalIPsConfig specifies the config for the use of Services with ExternalIPs field.
1072    #[serde(rename = "desiredServiceExternalIpsConfig")]
1073    pub desired_service_external_ips_config: Option<ServiceExternalIPsConfig>,
1074    /// Configuration for Shielded Nodes.
1075    #[serde(rename = "desiredShieldedNodes")]
1076    pub desired_shielded_nodes: Option<ShieldedNodes>,
1077    /// The desired stack type of the cluster. If a stack type is provided and does not match the current stack type of the cluster, update will attempt to change the stack type to the new type.
1078    #[serde(rename = "desiredStackType")]
1079    pub desired_stack_type: Option<String>,
1080    /// Cluster-level Vertical Pod Autoscaling configuration.
1081    #[serde(rename = "desiredVerticalPodAutoscaling")]
1082    pub desired_vertical_pod_autoscaling: Option<VerticalPodAutoscaling>,
1083    /// Configuration for Workload Identity.
1084    #[serde(rename = "desiredWorkloadIdentityConfig")]
1085    pub desired_workload_identity_config: Option<WorkloadIdentityConfig>,
1086    /// Kubernetes open source beta apis enabled on the cluster. Only beta apis
1087    #[serde(rename = "enableK8sBetaApis")]
1088    pub enable_k8s_beta_apis: Option<K8sBetaAPIConfig>,
1089    /// The current etag of the cluster. If an etag is provided and does not match the current etag of the cluster, update will be blocked and an ABORTED error will be returned.
1090    pub etag: Option<String>,
1091    /// The additional pod ranges that are to be removed from the cluster. The pod ranges specified here must have been specified earlier in the 'additional_pod_ranges_config' argument.
1092    #[serde(rename = "removedAdditionalPodRangesConfig")]
1093    pub removed_additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
1094}
1095
1096impl common::Part for ClusterUpdate {}
1097
1098/// CompleteIPRotationRequest moves the cluster master back into single-IP mode.
1099///
1100/// # Activities
1101///
1102/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1103/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1104///
1105/// * [locations clusters complete ip rotation projects](ProjectLocationClusterCompleteIpRotationCall) (request)
1106/// * [zones clusters complete ip rotation projects](ProjectZoneClusterCompleteIpRotationCall) (request)
1107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1108#[serde_with::serde_as]
1109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1110pub struct CompleteIPRotationRequest {
1111    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
1112    #[serde(rename = "clusterId")]
1113    pub cluster_id: Option<String>,
1114    /// The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
1115    pub name: Option<String>,
1116    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
1117    #[serde(rename = "projectId")]
1118    pub project_id: Option<String>,
1119    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
1120    pub zone: Option<String>,
1121}
1122
1123impl common::RequestValue for CompleteIPRotationRequest {}
1124
1125/// CompleteNodePoolUpgradeRequest sets the name of target node pool to complete upgrade.
1126///
1127/// # Activities
1128///
1129/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1130/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1131///
1132/// * [locations clusters node pools complete upgrade projects](ProjectLocationClusterNodePoolCompleteUpgradeCall) (request)
1133#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1134#[serde_with::serde_as]
1135#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1136pub struct CompleteNodePoolUpgradeRequest {
1137    _never_set: Option<bool>,
1138}
1139
1140impl common::RequestValue for CompleteNodePoolUpgradeRequest {}
1141
1142/// ConfidentialNodes is configuration for the confidential nodes feature, which makes nodes run on confidential VMs.
1143///
1144/// This type is not used in any activity, and only used as *part* of another schema.
1145///
1146#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1147#[serde_with::serde_as]
1148#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1149pub struct ConfidentialNodes {
1150    /// Whether Confidential Nodes feature is enabled.
1151    pub enabled: Option<bool>,
1152}
1153
1154impl common::Part for ConfidentialNodes {}
1155
1156/// Configuration options for the Config Connector add-on.
1157///
1158/// This type is not used in any activity, and only used as *part* of another schema.
1159///
1160#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1161#[serde_with::serde_as]
1162#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1163pub struct ConfigConnectorConfig {
1164    /// Whether Cloud Connector is enabled for this cluster.
1165    pub enabled: Option<bool>,
1166}
1167
1168impl common::Part for ConfigConnectorConfig {}
1169
1170/// Parameters for controlling consumption metering.
1171///
1172/// This type is not used in any activity, and only used as *part* of another schema.
1173///
1174#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1175#[serde_with::serde_as]
1176#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1177pub struct ConsumptionMeteringConfig {
1178    /// Whether to enable consumption metering for this cluster. If enabled, a second BigQuery table will be created to hold resource consumption records.
1179    pub enabled: Option<bool>,
1180}
1181
1182impl common::Part for ConsumptionMeteringConfig {}
1183
1184/// ContainerdConfig contains configuration to customize containerd.
1185///
1186/// This type is not used in any activity, and only used as *part* of another schema.
1187///
1188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1189#[serde_with::serde_as]
1190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1191pub struct ContainerdConfig {
1192    /// PrivateRegistryAccessConfig is used to configure access configuration for private container registries.
1193    #[serde(rename = "privateRegistryAccessConfig")]
1194    pub private_registry_access_config: Option<PrivateRegistryAccessConfig>,
1195}
1196
1197impl common::Part for ContainerdConfig {}
1198
1199/// Configuration for fine-grained cost management feature.
1200///
1201/// This type is not used in any activity, and only used as *part* of another schema.
1202///
1203#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1204#[serde_with::serde_as]
1205#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1206pub struct CostManagementConfig {
1207    /// Whether the feature is enabled or not.
1208    pub enabled: Option<bool>,
1209}
1210
1211impl common::Part for CostManagementConfig {}
1212
1213/// CreateClusterRequest creates a cluster.
1214///
1215/// # Activities
1216///
1217/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1218/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1219///
1220/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (request)
1221/// * [zones clusters create projects](ProjectZoneClusterCreateCall) (request)
1222#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1223#[serde_with::serde_as]
1224#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1225pub struct CreateClusterRequest {
1226    /// Required. A [cluster resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters)
1227    pub cluster: Option<Cluster>,
1228    /// The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
1229    pub parent: Option<String>,
1230    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
1231    #[serde(rename = "projectId")]
1232    pub project_id: Option<String>,
1233    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
1234    pub zone: Option<String>,
1235}
1236
1237impl common::RequestValue for CreateClusterRequest {}
1238
1239/// CreateNodePoolRequest creates a node pool for a cluster.
1240///
1241/// # Activities
1242///
1243/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1244/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1245///
1246/// * [locations clusters node pools create projects](ProjectLocationClusterNodePoolCreateCall) (request)
1247/// * [zones clusters node pools create projects](ProjectZoneClusterNodePoolCreateCall) (request)
1248#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1249#[serde_with::serde_as]
1250#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1251pub struct CreateNodePoolRequest {
1252    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
1253    #[serde(rename = "clusterId")]
1254    pub cluster_id: Option<String>,
1255    /// Required. The node pool to create.
1256    #[serde(rename = "nodePool")]
1257    pub node_pool: Option<NodePool>,
1258    /// The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
1259    pub parent: Option<String>,
1260    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
1261    #[serde(rename = "projectId")]
1262    pub project_id: Option<String>,
1263    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
1264    pub zone: Option<String>,
1265}
1266
1267impl common::RequestValue for CreateNodePoolRequest {}
1268
1269/// DNSConfig contains the desired set of options for configuring clusterDNS.
1270///
1271/// This type is not used in any activity, and only used as *part* of another schema.
1272///
1273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1274#[serde_with::serde_as]
1275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1276pub struct DNSConfig {
1277    /// Optional. The domain used in Additive VPC scope.
1278    #[serde(rename = "additiveVpcScopeDnsDomain")]
1279    pub additive_vpc_scope_dns_domain: Option<String>,
1280    /// cluster_dns indicates which in-cluster DNS provider should be used.
1281    #[serde(rename = "clusterDns")]
1282    pub cluster_dns: Option<String>,
1283    /// cluster_dns_domain is the suffix used for all cluster service records.
1284    #[serde(rename = "clusterDnsDomain")]
1285    pub cluster_dns_domain: Option<String>,
1286    /// cluster_dns_scope indicates the scope of access to cluster DNS records.
1287    #[serde(rename = "clusterDnsScope")]
1288    pub cluster_dns_scope: Option<String>,
1289}
1290
1291impl common::Part for DNSConfig {}
1292
1293/// Time window specified for daily maintenance operations.
1294///
1295/// This type is not used in any activity, and only used as *part* of another schema.
1296///
1297#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1298#[serde_with::serde_as]
1299#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1300pub struct DailyMaintenanceWindow {
1301    /// [Output only] Duration of the time window, automatically chosen to be smallest possible in the given scenario. Duration will be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format "PTnHnMnS".
1302    pub duration: Option<String>,
1303    /// Time within the maintenance window to start the maintenance operations. Time format should be in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) format "HH:MM", where HH : [00-23] and MM : [00-59] GMT.
1304    #[serde(rename = "startTime")]
1305    pub start_time: Option<String>,
1306}
1307
1308impl common::Part for DailyMaintenanceWindow {}
1309
1310/// Configuration of etcd encryption.
1311///
1312/// This type is not used in any activity, and only used as *part* of another schema.
1313///
1314#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1315#[serde_with::serde_as]
1316#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1317pub struct DatabaseEncryption {
1318    /// Output only. The current state of etcd encryption.
1319    #[serde(rename = "currentState")]
1320    pub current_state: Option<String>,
1321    /// Output only. Keys in use by the cluster for decrypting existing objects, in addition to the key in `key_name`. Each item is a CloudKMS key resource.
1322    #[serde(rename = "decryptionKeys")]
1323    pub decryption_keys: Option<Vec<String>>,
1324    /// Name of CloudKMS key to use for the encryption of secrets in etcd. Ex. projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key
1325    #[serde(rename = "keyName")]
1326    pub key_name: Option<String>,
1327    /// Output only. Records errors seen during DatabaseEncryption update operations.
1328    #[serde(rename = "lastOperationErrors")]
1329    pub last_operation_errors: Option<Vec<OperationError>>,
1330    /// The desired state of etcd encryption.
1331    pub state: Option<String>,
1332}
1333
1334impl common::Part for DatabaseEncryption {}
1335
1336/// DefaultSnatStatus contains the desired state of whether default sNAT should be disabled on the cluster.
1337///
1338/// This type is not used in any activity, and only used as *part* of another schema.
1339///
1340#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1341#[serde_with::serde_as]
1342#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1343pub struct DefaultSnatStatus {
1344    /// Disables cluster default sNAT rules.
1345    pub disabled: Option<bool>,
1346}
1347
1348impl common::Part for DefaultSnatStatus {}
1349
1350/// Configuration for NodeLocal DNSCache
1351///
1352/// This type is not used in any activity, and only used as *part* of another schema.
1353///
1354#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1355#[serde_with::serde_as]
1356#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1357pub struct DnsCacheConfig {
1358    /// Whether NodeLocal DNSCache is enabled for this cluster.
1359    pub enabled: Option<bool>,
1360}
1361
1362impl common::Part for DnsCacheConfig {}
1363
1364/// 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); }
1365///
1366/// # Activities
1367///
1368/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1369/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1370///
1371/// * [locations clusters node pools complete upgrade projects](ProjectLocationClusterNodePoolCompleteUpgradeCall) (response)
1372/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1373/// * [zones operations cancel projects](ProjectZoneOperationCancelCall) (response)
1374#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1375#[serde_with::serde_as]
1376#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1377pub struct Empty {
1378    _never_set: Option<bool>,
1379}
1380
1381impl common::ResponseResult for Empty {}
1382
1383/// EnterpriseConfig is the cluster enterprise configuration.
1384///
1385/// This type is not used in any activity, and only used as *part* of another schema.
1386///
1387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1388#[serde_with::serde_as]
1389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1390pub struct EnterpriseConfig {
1391    /// Output only. [Output only] cluster_tier specifies the premium tier of the cluster.
1392    #[serde(rename = "clusterTier")]
1393    pub cluster_tier: Option<String>,
1394}
1395
1396impl common::Part for EnterpriseConfig {}
1397
1398/// EphemeralStorageLocalSsdConfig contains configuration for the node ephemeral storage using Local SSDs.
1399///
1400/// This type is not used in any activity, and only used as *part* of another schema.
1401///
1402#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1403#[serde_with::serde_as]
1404#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1405pub struct EphemeralStorageLocalSsdConfig {
1406    /// Number of local SSDs to use to back ephemeral storage. Uses NVMe interfaces. A zero (or unset) value has different meanings depending on machine type being used: 1. For pre-Gen3 machines, which support flexible numbers of local ssds, zero (or unset) means to disable using local SSDs as ephemeral storage. The limit for this value is dependent upon the maximum number of disk available on a machine per zone. See: https://cloud.google.com/compute/docs/disks/local-ssd for more information. 2. For Gen3 machines which dictate a specific number of local ssds, zero (or unset) means to use the default number of local ssds that goes with that machine type. For example, for a c3-standard-8-lssd machine, 2 local ssds would be provisioned. For c3-standard-8 (which doesn't support local ssds), 0 will be provisioned. See https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds for more info.
1407    #[serde(rename = "localSsdCount")]
1408    pub local_ssd_count: Option<i32>,
1409}
1410
1411impl common::Part for EphemeralStorageLocalSsdConfig {}
1412
1413/// Configuration of Fast Socket feature.
1414///
1415/// This type is not used in any activity, and only used as *part* of another schema.
1416///
1417#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1418#[serde_with::serde_as]
1419#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1420pub struct FastSocket {
1421    /// Whether Fast Socket features are enabled in the node pool.
1422    pub enabled: Option<bool>,
1423}
1424
1425impl common::Part for FastSocket {}
1426
1427/// Allows filtering to one or more specific event types. If event types are present, those and only those event types will be transmitted to the cluster. Other types will be skipped. If no filter is specified, or no event types are present, all event types will be sent
1428///
1429/// This type is not used in any activity, and only used as *part* of another schema.
1430///
1431#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1432#[serde_with::serde_as]
1433#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1434pub struct Filter {
1435    /// Event types to allowlist.
1436    #[serde(rename = "eventType")]
1437    pub event_type: Option<Vec<String>>,
1438}
1439
1440impl common::Part for Filter {}
1441
1442/// Fleet is the fleet configuration for the cluster.
1443///
1444/// This type is not used in any activity, and only used as *part* of another schema.
1445///
1446#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1447#[serde_with::serde_as]
1448#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1449pub struct Fleet {
1450    /// [Output only] The full resource name of the registered fleet membership of the cluster, in the format `//gkehub.googleapis.com/projects/*/locations/*/memberships/*`.
1451    pub membership: Option<String>,
1452    /// [Output only] Whether the cluster has been registered through the fleet API.
1453    #[serde(rename = "preRegistered")]
1454    pub pre_registered: Option<bool>,
1455    /// The Fleet host project(project ID or project number) where this cluster will be registered to. This field cannot be changed after the cluster has been registered.
1456    pub project: Option<String>,
1457}
1458
1459impl common::Part for Fleet {}
1460
1461/// GCPSecretManagerCertificateConfig configures a secret from [Google Secret Manager](https://cloud.google.com/secret-manager).
1462///
1463/// This type is not used in any activity, and only used as *part* of another schema.
1464///
1465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1466#[serde_with::serde_as]
1467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1468pub struct GCPSecretManagerCertificateConfig {
1469    /// Secret URI, in the form "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION". Version can be fixed (e.g. "2") or "latest"
1470    #[serde(rename = "secretUri")]
1471    pub secret_uri: Option<String>,
1472}
1473
1474impl common::Part for GCPSecretManagerCertificateConfig {}
1475
1476/// GPUDriverInstallationConfig specifies the version of GPU driver to be auto installed.
1477///
1478/// This type is not used in any activity, and only used as *part* of another schema.
1479///
1480#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1481#[serde_with::serde_as]
1482#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1483pub struct GPUDriverInstallationConfig {
1484    /// Mode for how the GPU driver is installed.
1485    #[serde(rename = "gpuDriverVersion")]
1486    pub gpu_driver_version: Option<String>,
1487}
1488
1489impl common::Part for GPUDriverInstallationConfig {}
1490
1491/// GPUSharingConfig represents the GPU sharing configuration for Hardware Accelerators.
1492///
1493/// This type is not used in any activity, and only used as *part* of another schema.
1494///
1495#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1496#[serde_with::serde_as]
1497#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1498pub struct GPUSharingConfig {
1499    /// The type of GPU sharing strategy to enable on the GPU node.
1500    #[serde(rename = "gpuSharingStrategy")]
1501    pub gpu_sharing_strategy: Option<String>,
1502    /// The max number of containers that can share a physical GPU.
1503    #[serde(rename = "maxSharedClientsPerGpu")]
1504    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1505    pub max_shared_clients_per_gpu: Option<i64>,
1506}
1507
1508impl common::Part for GPUSharingConfig {}
1509
1510/// GatewayAPIConfig contains the desired config of Gateway API on this cluster.
1511///
1512/// This type is not used in any activity, and only used as *part* of another schema.
1513///
1514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1515#[serde_with::serde_as]
1516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1517pub struct GatewayAPIConfig {
1518    /// The Gateway API release channel to use for Gateway API.
1519    pub channel: Option<String>,
1520}
1521
1522impl common::Part for GatewayAPIConfig {}
1523
1524/// Configuration for the Compute Engine PD CSI driver.
1525///
1526/// This type is not used in any activity, and only used as *part* of another schema.
1527///
1528#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1529#[serde_with::serde_as]
1530#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1531pub struct GcePersistentDiskCsiDriverConfig {
1532    /// Whether the Compute Engine PD CSI driver is enabled for this cluster.
1533    pub enabled: Option<bool>,
1534}
1535
1536impl common::Part for GcePersistentDiskCsiDriverConfig {}
1537
1538/// GcfsConfig contains configurations of Google Container File System (image streaming).
1539///
1540/// This type is not used in any activity, and only used as *part* of another schema.
1541///
1542#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1543#[serde_with::serde_as]
1544#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1545pub struct GcfsConfig {
1546    /// Whether to use GCFS.
1547    pub enabled: Option<bool>,
1548}
1549
1550impl common::Part for GcfsConfig {}
1551
1552/// Configuration for the GCP Filestore CSI driver.
1553///
1554/// This type is not used in any activity, and only used as *part* of another schema.
1555///
1556#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1557#[serde_with::serde_as]
1558#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1559pub struct GcpFilestoreCsiDriverConfig {
1560    /// Whether the GCP Filestore CSI driver is enabled for this cluster.
1561    pub enabled: Option<bool>,
1562}
1563
1564impl common::Part for GcpFilestoreCsiDriverConfig {}
1565
1566/// Configuration for the Cloud Storage Fuse CSI driver.
1567///
1568/// This type is not used in any activity, and only used as *part* of another schema.
1569///
1570#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1571#[serde_with::serde_as]
1572#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1573pub struct GcsFuseCsiDriverConfig {
1574    /// Whether the Cloud Storage Fuse CSI driver is enabled for this cluster.
1575    pub enabled: Option<bool>,
1576}
1577
1578impl common::Part for GcsFuseCsiDriverConfig {}
1579
1580/// GetJSONWebKeysResponse is a valid JSON Web Key Set as specififed in rfc 7517
1581///
1582/// # Activities
1583///
1584/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1585/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1586///
1587/// * [locations clusters get jwks projects](ProjectLocationClusterGetJwkCall) (response)
1588#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1589#[serde_with::serde_as]
1590#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1591pub struct GetJSONWebKeysResponse {
1592    /// OnePlatform automatically extracts this field and uses it to set the HTTP Cache-Control header.
1593    #[serde(rename = "cacheHeader")]
1594    pub cache_header: Option<HttpCacheControlResponseHeader>,
1595    /// The public component of the keys used by the cluster to sign token requests.
1596    pub keys: Option<Vec<Jwk>>,
1597}
1598
1599impl common::ResponseResult for GetJSONWebKeysResponse {}
1600
1601/// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. See the OpenID Connect Discovery 1.0 specification for details.
1602///
1603/// # Activities
1604///
1605/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1606/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1607///
1608/// * [locations clusters well-known get openid-configuration projects](ProjectLocationClusterWellKnownGetOpenidConfigurationCall) (response)
1609#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1610#[serde_with::serde_as]
1611#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1612pub struct GetOpenIDConfigResponse {
1613    /// OnePlatform automatically extracts this field and uses it to set the HTTP Cache-Control header.
1614    #[serde(rename = "cacheHeader")]
1615    pub cache_header: Option<HttpCacheControlResponseHeader>,
1616    /// Supported claims.
1617    pub claims_supported: Option<Vec<String>>,
1618    /// Supported grant types.
1619    pub grant_types: Option<Vec<String>>,
1620    /// supported ID Token signing Algorithms.
1621    pub id_token_signing_alg_values_supported: Option<Vec<String>>,
1622    /// OIDC Issuer.
1623    pub issuer: Option<String>,
1624    /// JSON Web Key uri.
1625    pub jwks_uri: Option<String>,
1626    /// Supported response types.
1627    pub response_types_supported: Option<Vec<String>>,
1628    /// Supported subject types.
1629    pub subject_types_supported: Option<Vec<String>>,
1630}
1631
1632impl common::ResponseResult for GetOpenIDConfigResponse {}
1633
1634/// Configuration for the Backup for GKE Agent.
1635///
1636/// This type is not used in any activity, and only used as *part* of another schema.
1637///
1638#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1639#[serde_with::serde_as]
1640#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1641pub struct GkeBackupAgentConfig {
1642    /// Whether the Backup for GKE agent is enabled for this cluster.
1643    pub enabled: Option<bool>,
1644}
1645
1646impl common::Part for GkeBackupAgentConfig {}
1647
1648/// Configuration options for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods.
1649///
1650/// This type is not used in any activity, and only used as *part* of another schema.
1651///
1652#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1653#[serde_with::serde_as]
1654#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1655pub struct HorizontalPodAutoscaling {
1656    /// Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, it ensures that metrics are collected into Stackdriver Monitoring.
1657    pub disabled: Option<bool>,
1658}
1659
1660impl common::Part for HorizontalPodAutoscaling {}
1661
1662/// RFC-2616: cache control support
1663///
1664/// This type is not used in any activity, and only used as *part* of another schema.
1665///
1666#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1667#[serde_with::serde_as]
1668#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1669pub struct HttpCacheControlResponseHeader {
1670    /// 14.6 response cache age, in seconds since the response is generated
1671    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
1672    pub age: Option<i64>,
1673    /// 14.9 request and response directives
1674    pub directive: Option<String>,
1675    /// 14.21 response cache expires, in RFC 1123 date format
1676    pub expires: Option<String>,
1677}
1678
1679impl common::Part for HttpCacheControlResponseHeader {}
1680
1681/// Configuration options for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.
1682///
1683/// This type is not used in any activity, and only used as *part* of another schema.
1684///
1685#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1686#[serde_with::serde_as]
1687#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1688pub struct HttpLoadBalancing {
1689    /// Whether the HTTP Load Balancing controller is enabled in the cluster. When enabled, it runs a small pod in the cluster that manages the load balancers.
1690    pub disabled: Option<bool>,
1691}
1692
1693impl common::Part for HttpLoadBalancing {}
1694
1695/// Hugepages amount in both 2m and 1g size
1696///
1697/// This type is not used in any activity, and only used as *part* of another schema.
1698///
1699#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1700#[serde_with::serde_as]
1701#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1702pub struct HugepagesConfig {
1703    /// Optional. Amount of 1G hugepages
1704    #[serde(rename = "hugepageSize1g")]
1705    pub hugepage_size1g: Option<i32>,
1706    /// Optional. Amount of 2M hugepages
1707    #[serde(rename = "hugepageSize2m")]
1708    pub hugepage_size2m: Option<i32>,
1709}
1710
1711impl common::Part for HugepagesConfig {}
1712
1713/// ILBSubsettingConfig contains the desired config of L4 Internal LoadBalancer subsetting on this cluster.
1714///
1715/// This type is not used in any activity, and only used as *part* of another schema.
1716///
1717#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1718#[serde_with::serde_as]
1719#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1720pub struct ILBSubsettingConfig {
1721    /// Enables l4 ILB subsetting for this cluster.
1722    pub enabled: Option<bool>,
1723}
1724
1725impl common::Part for ILBSubsettingConfig {}
1726
1727/// Configuration for controlling how IPs are allocated in the cluster.
1728///
1729/// This type is not used in any activity, and only used as *part* of another schema.
1730///
1731#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1732#[serde_with::serde_as]
1733#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1734pub struct IPAllocationPolicy {
1735    /// Output only. [Output only] The additional pod ranges that are added to the cluster. These pod ranges can be used by new node pools to allocate pod IPs automatically. Once the range is removed it will not show up in IPAllocationPolicy.
1736    #[serde(rename = "additionalPodRangesConfig")]
1737    pub additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
1738    /// This field is deprecated, use cluster_ipv4_cidr_block.
1739    #[serde(rename = "clusterIpv4Cidr")]
1740    pub cluster_ipv4_cidr: Option<String>,
1741    /// The IP address range for the cluster pod IPs. If this field is set, then `cluster.cluster_ipv4_cidr` must be left blank. This field is only applicable when `use_ip_aliases` is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://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.
1742    #[serde(rename = "clusterIpv4CidrBlock")]
1743    pub cluster_ipv4_cidr_block: Option<String>,
1744    /// The name of the secondary range to be used for the cluster CIDR block. The secondary range will be used for pod IP addresses. This must be an existing secondary range associated with the cluster subnetwork. This field is only applicable with use_ip_aliases is true and create_subnetwork is false.
1745    #[serde(rename = "clusterSecondaryRangeName")]
1746    pub cluster_secondary_range_name: Option<String>,
1747    /// Whether a new subnetwork will be created automatically for the cluster. This field is only applicable when `use_ip_aliases` is true.
1748    #[serde(rename = "createSubnetwork")]
1749    pub create_subnetwork: Option<bool>,
1750    /// Output only. [Output only] The utilization of the cluster default IPv4 range for the pod. The ratio is Usage/[Total number of IPs in the secondary range], Usage=numNodes*numZones*podIPsPerNode.
1751    #[serde(rename = "defaultPodIpv4RangeUtilization")]
1752    pub default_pod_ipv4_range_utilization: Option<f64>,
1753    /// The ipv6 access type (internal or external) when create_subnetwork is true
1754    #[serde(rename = "ipv6AccessType")]
1755    pub ipv6_access_type: Option<String>,
1756    /// This field is deprecated, use node_ipv4_cidr_block.
1757    #[serde(rename = "nodeIpv4Cidr")]
1758    pub node_ipv4_cidr: Option<String>,
1759    /// The IP address range of the instance IPs in this cluster. This is applicable only if `create_subnetwork` is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://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.
1760    #[serde(rename = "nodeIpv4CidrBlock")]
1761    pub node_ipv4_cidr_block: Option<String>,
1762    /// [PRIVATE FIELD] Pod CIDR size overprovisioning config for the cluster. Pod CIDR size per node depends on max_pods_per_node. By default, the value of max_pods_per_node is doubled and then rounded off to next power of 2 to get the size of pod CIDR block per node. Example: max_pods_per_node of 30 would result in 64 IPs (/26). This config can disable the doubling of IPs (we still round off to next power of 2) Example: max_pods_per_node of 30 will result in 32 IPs (/27) when overprovisioning is disabled.
1763    #[serde(rename = "podCidrOverprovisionConfig")]
1764    pub pod_cidr_overprovision_config: Option<PodCIDROverprovisionConfig>,
1765    /// This field is deprecated, use services_ipv4_cidr_block.
1766    #[serde(rename = "servicesIpv4Cidr")]
1767    pub services_ipv4_cidr: Option<String>,
1768    /// The IP address range of the services IPs in this cluster. If blank, a range will be automatically chosen with the default size. This field is only applicable when `use_ip_aliases` is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://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.
1769    #[serde(rename = "servicesIpv4CidrBlock")]
1770    pub services_ipv4_cidr_block: Option<String>,
1771    /// Output only. [Output only] The services IPv6 CIDR block for the cluster.
1772    #[serde(rename = "servicesIpv6CidrBlock")]
1773    pub services_ipv6_cidr_block: Option<String>,
1774    /// The name of the secondary range to be used as for the services CIDR block. The secondary range will be used for service ClusterIPs. This must be an existing secondary range associated with the cluster subnetwork. This field is only applicable with use_ip_aliases is true and create_subnetwork is false.
1775    #[serde(rename = "servicesSecondaryRangeName")]
1776    pub services_secondary_range_name: Option<String>,
1777    /// The IP stack type of the cluster
1778    #[serde(rename = "stackType")]
1779    pub stack_type: Option<String>,
1780    /// Output only. [Output only] The subnet's IPv6 CIDR block used by nodes and pods.
1781    #[serde(rename = "subnetIpv6CidrBlock")]
1782    pub subnet_ipv6_cidr_block: Option<String>,
1783    /// A custom subnetwork name to be used if `create_subnetwork` is true. If this field is empty, then an automatic name will be chosen for the new subnetwork.
1784    #[serde(rename = "subnetworkName")]
1785    pub subnetwork_name: Option<String>,
1786    /// The IP address range of the Cloud TPUs in this cluster. If unspecified, a range will be automatically chosen with the default size. This field is only applicable when `use_ip_aliases` is true. If unspecified, the range will use the default size. Set to /netmask (e.g. `/14`) to have a range chosen with a specific netmask. Set to a [CIDR](http://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.
1787    #[serde(rename = "tpuIpv4CidrBlock")]
1788    pub tpu_ipv4_cidr_block: Option<String>,
1789    /// Whether alias IPs will be used for pod IPs in the cluster. This is used in conjunction with use_routes. It cannot be true if use_routes is true. If both use_ip_aliases and use_routes are false, then the server picks the default IP allocation mode
1790    #[serde(rename = "useIpAliases")]
1791    pub use_ip_aliases: Option<bool>,
1792    /// Whether routes will be used for pod IPs in the cluster. This is used in conjunction with use_ip_aliases. It cannot be true if use_ip_aliases is true. If both use_ip_aliases and use_routes are false, then the server picks the default IP allocation mode
1793    #[serde(rename = "useRoutes")]
1794    pub use_routes: Option<bool>,
1795}
1796
1797impl common::Part for IPAllocationPolicy {}
1798
1799/// IdentityServiceConfig is configuration for Identity Service which allows customers to use external identity providers with the K8S API
1800///
1801/// This type is not used in any activity, and only used as *part* of another schema.
1802///
1803#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1804#[serde_with::serde_as]
1805#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1806pub struct IdentityServiceConfig {
1807    /// Whether to enable the Identity Service component
1808    pub enabled: Option<bool>,
1809}
1810
1811impl common::Part for IdentityServiceConfig {}
1812
1813/// IntraNodeVisibilityConfig contains the desired config of the intra-node visibility on this cluster.
1814///
1815/// This type is not used in any activity, and only used as *part* of another schema.
1816///
1817#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1818#[serde_with::serde_as]
1819#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1820pub struct IntraNodeVisibilityConfig {
1821    /// Enables intra node visibility for this cluster.
1822    pub enabled: Option<bool>,
1823}
1824
1825impl common::Part for IntraNodeVisibilityConfig {}
1826
1827/// Jwk is a JSON Web Key as specified in RFC 7517
1828///
1829/// This type is not used in any activity, and only used as *part* of another schema.
1830///
1831#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1832#[serde_with::serde_as]
1833#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1834pub struct Jwk {
1835    /// Algorithm.
1836    pub alg: Option<String>,
1837    /// Used for ECDSA keys.
1838    pub crv: Option<String>,
1839    /// Used for RSA keys.
1840    pub e: Option<String>,
1841    /// Key ID.
1842    pub kid: Option<String>,
1843    /// Key Type.
1844    pub kty: Option<String>,
1845    /// Used for RSA keys.
1846    pub n: Option<String>,
1847    /// Permitted uses for the public keys.
1848    #[serde(rename = "use")]
1849    pub use_: Option<String>,
1850    /// Used for ECDSA keys.
1851    pub x: Option<String>,
1852    /// Used for ECDSA keys.
1853    pub y: Option<String>,
1854}
1855
1856impl common::Part for Jwk {}
1857
1858/// K8sBetaAPIConfig , configuration for beta APIs
1859///
1860/// This type is not used in any activity, and only used as *part* of another schema.
1861///
1862#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1863#[serde_with::serde_as]
1864#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1865pub struct K8sBetaAPIConfig {
1866    /// Enabled k8s beta APIs.
1867    #[serde(rename = "enabledApis")]
1868    pub enabled_apis: Option<Vec<String>>,
1869}
1870
1871impl common::Part for K8sBetaAPIConfig {}
1872
1873/// Configuration for the Kubernetes Dashboard.
1874///
1875/// This type is not used in any activity, and only used as *part* of another schema.
1876///
1877#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1878#[serde_with::serde_as]
1879#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1880pub struct KubernetesDashboard {
1881    /// Whether the Kubernetes Dashboard is enabled for this cluster.
1882    pub disabled: Option<bool>,
1883}
1884
1885impl common::Part for KubernetesDashboard {}
1886
1887/// Configuration for the legacy Attribute Based Access Control authorization mode.
1888///
1889/// This type is not used in any activity, and only used as *part* of another schema.
1890///
1891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1892#[serde_with::serde_as]
1893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1894pub struct LegacyAbac {
1895    /// Whether the ABAC authorizer is enabled for this cluster. When enabled, identities in the system, including service accounts, nodes, and controllers, will have statically granted permissions beyond those provided by the RBAC configuration or IAM.
1896    pub enabled: Option<bool>,
1897}
1898
1899impl common::Part for LegacyAbac {}
1900
1901/// Parameters that can be configured on Linux nodes.
1902///
1903/// This type is not used in any activity, and only used as *part* of another schema.
1904///
1905#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1906#[serde_with::serde_as]
1907#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1908pub struct LinuxNodeConfig {
1909    /// cgroup_mode specifies the cgroup mode to be used on the node.
1910    #[serde(rename = "cgroupMode")]
1911    pub cgroup_mode: Option<String>,
1912    /// Optional. Amounts for 2M and 1G hugepages
1913    pub hugepages: Option<HugepagesConfig>,
1914    /// The Linux kernel parameters to be applied to the nodes and all pods running on the nodes. The following parameters are supported. net.core.busy_poll net.core.busy_read net.core.netdev_max_backlog net.core.rmem_max net.core.wmem_default net.core.wmem_max net.core.optmem_max net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem net.ipv4.tcp_tw_reuse
1915    pub sysctls: Option<HashMap<String, String>>,
1916}
1917
1918impl common::Part for LinuxNodeConfig {}
1919
1920/// ListClustersResponse is the result of ListClustersRequest.
1921///
1922/// # Activities
1923///
1924/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1925/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1926///
1927/// * [locations clusters list projects](ProjectLocationClusterListCall) (response)
1928/// * [zones clusters list projects](ProjectZoneClusterListCall) (response)
1929#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1930#[serde_with::serde_as]
1931#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1932pub struct ListClustersResponse {
1933    /// A list of clusters in the project in the specified zone, or across all ones.
1934    pub clusters: Option<Vec<Cluster>>,
1935    /// If any zones are listed here, the list of clusters returned may be missing those zones.
1936    #[serde(rename = "missingZones")]
1937    pub missing_zones: Option<Vec<String>>,
1938}
1939
1940impl common::ResponseResult for ListClustersResponse {}
1941
1942/// ListNodePoolsResponse is the result of ListNodePoolsRequest.
1943///
1944/// # Activities
1945///
1946/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1947/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1948///
1949/// * [locations clusters node pools list projects](ProjectLocationClusterNodePoolListCall) (response)
1950/// * [zones clusters node pools list projects](ProjectZoneClusterNodePoolListCall) (response)
1951#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1952#[serde_with::serde_as]
1953#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1954pub struct ListNodePoolsResponse {
1955    /// A list of node pools for a cluster.
1956    #[serde(rename = "nodePools")]
1957    pub node_pools: Option<Vec<NodePool>>,
1958}
1959
1960impl common::ResponseResult for ListNodePoolsResponse {}
1961
1962/// ListOperationsResponse is the result of ListOperationsRequest.
1963///
1964/// # Activities
1965///
1966/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1967/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1968///
1969/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
1970/// * [zones operations list projects](ProjectZoneOperationListCall) (response)
1971#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1972#[serde_with::serde_as]
1973#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1974pub struct ListOperationsResponse {
1975    /// If any zones are listed here, the list of operations returned may be missing the operations from those zones.
1976    #[serde(rename = "missingZones")]
1977    pub missing_zones: Option<Vec<String>>,
1978    /// A list of operations in the project in the specified zone.
1979    pub operations: Option<Vec<Operation>>,
1980}
1981
1982impl common::ResponseResult for ListOperationsResponse {}
1983
1984/// ListUsableSubnetworksResponse is the response of ListUsableSubnetworksRequest.
1985///
1986/// # Activities
1987///
1988/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1989/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1990///
1991/// * [aggregated usable subnetworks list projects](ProjectAggregatedUsableSubnetworkListCall) (response)
1992#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1993#[serde_with::serde_as]
1994#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1995pub struct ListUsableSubnetworksResponse {
1996    /// This token allows you to get the next page of results for list requests. If the number of results is larger than `page_size`, use the `next_page_token` as a value for the query parameter `page_token` in the next request. The value will become empty when there are no more pages.
1997    #[serde(rename = "nextPageToken")]
1998    pub next_page_token: Option<String>,
1999    /// A list of usable subnetworks in the specified network project.
2000    pub subnetworks: Option<Vec<UsableSubnetwork>>,
2001}
2002
2003impl common::ResponseResult for ListUsableSubnetworksResponse {}
2004
2005/// LocalNvmeSsdBlockConfig contains configuration for using raw-block local NVMe SSDs
2006///
2007/// This type is not used in any activity, and only used as *part* of another schema.
2008///
2009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2010#[serde_with::serde_as]
2011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2012pub struct LocalNvmeSsdBlockConfig {
2013    /// Number of local NVMe SSDs to use. The limit for this value is dependent upon the maximum number of disk available on a machine per zone. See: https://cloud.google.com/compute/docs/disks/local-ssd for more information. A zero (or unset) value has different meanings depending on machine type being used: 1. For pre-Gen3 machines, which support flexible numbers of local ssds, zero (or unset) means to disable using local SSDs as ephemeral storage. 2. For Gen3 machines which dictate a specific number of local ssds, zero (or unset) means to use the default number of local ssds that goes with that machine type. For example, for a c3-standard-8-lssd machine, 2 local ssds would be provisioned. For c3-standard-8 (which doesn't support local ssds), 0 will be provisioned. See https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds for more info.
2014    #[serde(rename = "localSsdCount")]
2015    pub local_ssd_count: Option<i32>,
2016}
2017
2018impl common::Part for LocalNvmeSsdBlockConfig {}
2019
2020/// LoggingComponentConfig is cluster logging component configuration.
2021///
2022/// This type is not used in any activity, and only used as *part* of another schema.
2023///
2024#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2025#[serde_with::serde_as]
2026#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2027pub struct LoggingComponentConfig {
2028    /// Select components to collect logs. An empty set would disable all logging.
2029    #[serde(rename = "enableComponents")]
2030    pub enable_components: Option<Vec<String>>,
2031}
2032
2033impl common::Part for LoggingComponentConfig {}
2034
2035/// LoggingConfig is cluster logging configuration.
2036///
2037/// This type is not used in any activity, and only used as *part* of another schema.
2038///
2039#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2040#[serde_with::serde_as]
2041#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2042pub struct LoggingConfig {
2043    /// Logging components configuration
2044    #[serde(rename = "componentConfig")]
2045    pub component_config: Option<LoggingComponentConfig>,
2046}
2047
2048impl common::Part for LoggingConfig {}
2049
2050/// LoggingVariantConfig specifies the behaviour of the logging component.
2051///
2052/// This type is not used in any activity, and only used as *part* of another schema.
2053///
2054#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2055#[serde_with::serde_as]
2056#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2057pub struct LoggingVariantConfig {
2058    /// Logging variant deployed on nodes.
2059    pub variant: Option<String>,
2060}
2061
2062impl common::Part for LoggingVariantConfig {}
2063
2064/// Represents the Maintenance exclusion option.
2065///
2066/// This type is not used in any activity, and only used as *part* of another schema.
2067///
2068#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2069#[serde_with::serde_as]
2070#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2071pub struct MaintenanceExclusionOptions {
2072    /// Scope specifies the upgrade scope which upgrades are blocked by the exclusion.
2073    pub scope: Option<String>,
2074}
2075
2076impl common::Part for MaintenanceExclusionOptions {}
2077
2078/// MaintenancePolicy defines the maintenance policy to be used for the cluster.
2079///
2080/// This type is not used in any activity, and only used as *part* of another schema.
2081///
2082#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2083#[serde_with::serde_as]
2084#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2085pub struct MaintenancePolicy {
2086    /// A hash identifying the version of this policy, so that updates to fields of the policy won't accidentally undo intermediate changes (and so that users of the API unaware of some fields won't accidentally remove other fields). Make a `get()` request to the cluster to get the current resource version and include it with requests to set the policy.
2087    #[serde(rename = "resourceVersion")]
2088    pub resource_version: Option<String>,
2089    /// Specifies the maintenance window in which maintenance may be performed.
2090    pub window: Option<MaintenanceWindow>,
2091}
2092
2093impl common::Part for MaintenancePolicy {}
2094
2095/// MaintenanceWindow defines the maintenance window to be used for the cluster.
2096///
2097/// This type is not used in any activity, and only used as *part* of another schema.
2098///
2099#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2100#[serde_with::serde_as]
2101#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2102pub struct MaintenanceWindow {
2103    /// DailyMaintenanceWindow specifies a daily maintenance operation window.
2104    #[serde(rename = "dailyMaintenanceWindow")]
2105    pub daily_maintenance_window: Option<DailyMaintenanceWindow>,
2106    /// Exceptions to maintenance window. Non-emergency maintenance should not occur in these windows.
2107    #[serde(rename = "maintenanceExclusions")]
2108    pub maintenance_exclusions: Option<HashMap<String, TimeWindow>>,
2109    /// RecurringWindow specifies some number of recurring time periods for maintenance to occur. The time windows may be overlapping. If no maintenance windows are set, maintenance can occur at any time.
2110    #[serde(rename = "recurringWindow")]
2111    pub recurring_window: Option<RecurringTimeWindow>,
2112}
2113
2114impl common::Part for MaintenanceWindow {}
2115
2116/// ManagedPrometheusConfig defines the configuration for Google Cloud Managed Service for Prometheus.
2117///
2118/// This type is not used in any activity, and only used as *part* of another schema.
2119///
2120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2121#[serde_with::serde_as]
2122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2123pub struct ManagedPrometheusConfig {
2124    /// Enable Managed Collection.
2125    pub enabled: Option<bool>,
2126}
2127
2128impl common::Part for ManagedPrometheusConfig {}
2129
2130/// The authentication information for accessing the master endpoint. Authentication can be done using HTTP basic auth or using client certificates.
2131///
2132/// This type is not used in any activity, and only used as *part* of another schema.
2133///
2134#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2135#[serde_with::serde_as]
2136#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2137pub struct MasterAuth {
2138    /// [Output only] Base64-encoded public certificate used by clients to authenticate to the cluster endpoint.
2139    #[serde(rename = "clientCertificate")]
2140    pub client_certificate: Option<String>,
2141    /// Configuration for client certificate authentication on the cluster. For clusters before v1.12, if no configuration is specified, a client certificate is issued.
2142    #[serde(rename = "clientCertificateConfig")]
2143    pub client_certificate_config: Option<ClientCertificateConfig>,
2144    /// [Output only] Base64-encoded private key used by clients to authenticate to the cluster endpoint.
2145    #[serde(rename = "clientKey")]
2146    pub client_key: Option<String>,
2147    /// [Output only] Base64-encoded public certificate that is the root of trust for the cluster.
2148    #[serde(rename = "clusterCaCertificate")]
2149    pub cluster_ca_certificate: Option<String>,
2150    /// The password to use for HTTP basic authentication to the master endpoint. Because the master endpoint is open to the Internet, you should create a strong password. If a password is provided for cluster creation, username must be non-empty. Warning: basic authentication is deprecated, and will be removed in GKE control plane versions 1.19 and newer. For a list of recommended authentication methods, see: https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication
2151    pub password: Option<String>,
2152    /// The username to use for HTTP basic authentication to the master endpoint. For clusters v1.6.0 and later, basic authentication can be disabled by leaving username unspecified (or setting it to the empty string). Warning: basic authentication is deprecated, and will be removed in GKE control plane versions 1.19 and newer. For a list of recommended authentication methods, see: https://cloud.google.com/kubernetes-engine/docs/how-to/api-server-authentication
2153    pub username: Option<String>,
2154}
2155
2156impl common::Part for MasterAuth {}
2157
2158/// 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.
2159///
2160/// This type is not used in any activity, and only used as *part* of another schema.
2161///
2162#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2163#[serde_with::serde_as]
2164#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2165pub struct MasterAuthorizedNetworksConfig {
2166    /// cidr_blocks define up to 50 external networks that could access Kubernetes master through HTTPS.
2167    #[serde(rename = "cidrBlocks")]
2168    pub cidr_blocks: Option<Vec<CidrBlock>>,
2169    /// Whether or not master authorized networks is enabled.
2170    pub enabled: Option<bool>,
2171    /// Whether master is accessbile via Google Compute Engine Public IP addresses.
2172    #[serde(rename = "gcpPublicCidrsAccessEnabled")]
2173    pub gcp_public_cidrs_access_enabled: Option<bool>,
2174}
2175
2176impl common::Part for MasterAuthorizedNetworksConfig {}
2177
2178/// Constraints applied to pods.
2179///
2180/// This type is not used in any activity, and only used as *part* of another schema.
2181///
2182#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2183#[serde_with::serde_as]
2184#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2185pub struct MaxPodsConstraint {
2186    /// Constraint enforced on the max num of pods per node.
2187    #[serde(rename = "maxPodsPerNode")]
2188    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2189    pub max_pods_per_node: Option<i64>,
2190}
2191
2192impl common::Part for MaxPodsConstraint {}
2193
2194/// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
2195///
2196/// This type is not used in any activity, and only used as *part* of another schema.
2197///
2198#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2199#[serde_with::serde_as]
2200#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2201pub struct MeshCertificates {
2202    /// enable_certificates controls issuance of workload mTLS certificates. If set, the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster, which can then be configured by creating a WorkloadCertificateConfig Custom Resource. Requires Workload Identity (workload_pool must be non-empty).
2203    #[serde(rename = "enableCertificates")]
2204    pub enable_certificates: Option<bool>,
2205}
2206
2207impl common::Part for MeshCertificates {}
2208
2209/// Progress metric is (string, int|float|string) pair.
2210///
2211/// This type is not used in any activity, and only used as *part* of another schema.
2212///
2213#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2214#[serde_with::serde_as]
2215#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2216pub struct Metric {
2217    /// For metrics with floating point value.
2218    #[serde(rename = "doubleValue")]
2219    pub double_value: Option<f64>,
2220    /// For metrics with integer value.
2221    #[serde(rename = "intValue")]
2222    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2223    pub int_value: Option<i64>,
2224    /// Required. Metric name, e.g., "nodes total", "percent done".
2225    pub name: Option<String>,
2226    /// For metrics with custom values (ratios, visual progress, etc.).
2227    #[serde(rename = "stringValue")]
2228    pub string_value: Option<String>,
2229}
2230
2231impl common::Part for Metric {}
2232
2233/// MonitoringComponentConfig is cluster monitoring component configuration.
2234///
2235/// This type is not used in any activity, and only used as *part* of another schema.
2236///
2237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2238#[serde_with::serde_as]
2239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2240pub struct MonitoringComponentConfig {
2241    /// Select components to collect metrics. An empty set would disable all monitoring.
2242    #[serde(rename = "enableComponents")]
2243    pub enable_components: Option<Vec<String>>,
2244}
2245
2246impl common::Part for MonitoringComponentConfig {}
2247
2248/// MonitoringConfig is cluster monitoring configuration.
2249///
2250/// This type is not used in any activity, and only used as *part* of another schema.
2251///
2252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2253#[serde_with::serde_as]
2254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2255pub struct MonitoringConfig {
2256    /// Configuration of Advanced Datapath Observability features.
2257    #[serde(rename = "advancedDatapathObservabilityConfig")]
2258    pub advanced_datapath_observability_config: Option<AdvancedDatapathObservabilityConfig>,
2259    /// Monitoring components configuration
2260    #[serde(rename = "componentConfig")]
2261    pub component_config: Option<MonitoringComponentConfig>,
2262    /// Enable Google Cloud Managed Service for Prometheus in the cluster.
2263    #[serde(rename = "managedPrometheusConfig")]
2264    pub managed_prometheus_config: Option<ManagedPrometheusConfig>,
2265}
2266
2267impl common::Part for MonitoringConfig {}
2268
2269/// NetworkConfig reports the relative names of network & subnetwork.
2270///
2271/// This type is not used in any activity, and only used as *part* of another schema.
2272///
2273#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2274#[serde_with::serde_as]
2275#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2276pub struct NetworkConfig {
2277    /// The desired datapath provider for this cluster. By default, uses the IPTables-based kube-proxy implementation.
2278    #[serde(rename = "datapathProvider")]
2279    pub datapath_provider: Option<String>,
2280    /// Whether the cluster disables default in-node sNAT rules. In-node sNAT rules will be disabled when default_snat_status is disabled. When disabled is set to false, default IP masquerade rules will be applied to the nodes to prevent sNAT on cluster internal traffic.
2281    #[serde(rename = "defaultSnatStatus")]
2282    pub default_snat_status: Option<DefaultSnatStatus>,
2283    /// DNSConfig contains clusterDNS config for this cluster.
2284    #[serde(rename = "dnsConfig")]
2285    pub dns_config: Option<DNSConfig>,
2286    /// Whether CiliumClusterwideNetworkPolicy is enabled on this cluster.
2287    #[serde(rename = "enableCiliumClusterwideNetworkPolicy")]
2288    pub enable_cilium_clusterwide_network_policy: Option<bool>,
2289    /// Whether FQDN Network Policy is enabled on this cluster.
2290    #[serde(rename = "enableFqdnNetworkPolicy")]
2291    pub enable_fqdn_network_policy: Option<bool>,
2292    /// Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network.
2293    #[serde(rename = "enableIntraNodeVisibility")]
2294    pub enable_intra_node_visibility: Option<bool>,
2295    /// Whether L4ILB Subsetting is enabled for this cluster.
2296    #[serde(rename = "enableL4ilbSubsetting")]
2297    pub enable_l4ilb_subsetting: Option<bool>,
2298    /// Whether multi-networking is enabled for this cluster.
2299    #[serde(rename = "enableMultiNetworking")]
2300    pub enable_multi_networking: Option<bool>,
2301    /// GatewayAPIConfig contains the desired config of Gateway API on this cluster.
2302    #[serde(rename = "gatewayApiConfig")]
2303    pub gateway_api_config: Option<GatewayAPIConfig>,
2304    /// Specify the details of in-transit encryption. Now named inter-node transparent encryption.
2305    #[serde(rename = "inTransitEncryptionConfig")]
2306    pub in_transit_encryption_config: Option<String>,
2307    /// Output only. The relative name of the Google Compute Engine network(https://cloud.google.com/compute/docs/networks-and-firewalls#networks) to which the cluster is connected. Example: projects/my-project/global/networks/my-network
2308    pub network: Option<String>,
2309    /// Network bandwidth tier configuration.
2310    #[serde(rename = "networkPerformanceConfig")]
2311    pub network_performance_config: Option<ClusterNetworkPerformanceConfig>,
2312    /// The desired state of IPv6 connectivity to Google Services. By default, no private IPv6 access to or from Google Services (all access will be via IPv4)
2313    #[serde(rename = "privateIpv6GoogleAccess")]
2314    pub private_ipv6_google_access: Option<String>,
2315    /// ServiceExternalIPsConfig specifies if services with externalIPs field are blocked or not.
2316    #[serde(rename = "serviceExternalIpsConfig")]
2317    pub service_external_ips_config: Option<ServiceExternalIPsConfig>,
2318    /// Output only. The relative name of the Google Compute Engine [subnetwork](https://cloud.google.com/compute/docs/vpc) to which the cluster is connected. Example: projects/my-project/regions/us-central1/subnetworks/my-subnet
2319    pub subnetwork: Option<String>,
2320}
2321
2322impl common::Part for NetworkConfig {}
2323
2324/// Configuration of all network bandwidth tiers
2325///
2326/// This type is not used in any activity, and only used as *part* of another schema.
2327///
2328#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2329#[serde_with::serde_as]
2330#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2331pub struct NetworkPerformanceConfig {
2332    /// Specifies the total network bandwidth tier for the NodePool.
2333    #[serde(rename = "totalEgressBandwidthTier")]
2334    pub total_egress_bandwidth_tier: Option<String>,
2335}
2336
2337impl common::Part for NetworkPerformanceConfig {}
2338
2339/// Configuration options for the NetworkPolicy feature. https://kubernetes.io/docs/concepts/services-networking/networkpolicies/
2340///
2341/// This type is not used in any activity, and only used as *part* of another schema.
2342///
2343#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2344#[serde_with::serde_as]
2345#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2346pub struct NetworkPolicy {
2347    /// Whether network policy is enabled on the cluster.
2348    pub enabled: Option<bool>,
2349    /// The selected network policy provider.
2350    pub provider: Option<String>,
2351}
2352
2353impl common::Part for NetworkPolicy {}
2354
2355/// Configuration for NetworkPolicy. This only tracks whether the addon is enabled or not on the Master, it does not track whether network policy is enabled for the nodes.
2356///
2357/// This type is not used in any activity, and only used as *part* of another schema.
2358///
2359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2360#[serde_with::serde_as]
2361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2362pub struct NetworkPolicyConfig {
2363    /// Whether NetworkPolicy is enabled for this cluster.
2364    pub disabled: Option<bool>,
2365}
2366
2367impl common::Part for NetworkPolicyConfig {}
2368
2369/// Collection of Compute Engine network tags that can be applied to a node's underlying VM instance.
2370///
2371/// This type is not used in any activity, and only used as *part* of another schema.
2372///
2373#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2374#[serde_with::serde_as]
2375#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2376pub struct NetworkTags {
2377    /// List of network tags.
2378    pub tags: Option<Vec<String>>,
2379}
2380
2381impl common::Part for NetworkTags {}
2382
2383/// Specifies the NodeAffinity key, values, and affinity operator according to [shared sole tenant node group affinities](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes#node_affinity_and_anti-affinity).
2384///
2385/// This type is not used in any activity, and only used as *part* of another schema.
2386///
2387#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2388#[serde_with::serde_as]
2389#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2390pub struct NodeAffinity {
2391    /// Key for NodeAffinity.
2392    pub key: Option<String>,
2393    /// Operator for NodeAffinity.
2394    pub operator: Option<String>,
2395    /// Values for NodeAffinity.
2396    pub values: Option<Vec<String>>,
2397}
2398
2399impl common::Part for NodeAffinity {}
2400
2401/// Parameters that describe the nodes in a cluster. GKE Autopilot clusters do not recognize parameters in `NodeConfig`. Use AutoprovisioningNodePoolDefaults instead.
2402///
2403/// This type is not used in any activity, and only used as *part* of another schema.
2404///
2405#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2406#[serde_with::serde_as]
2407#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2408pub struct NodeConfig {
2409    /// A list of hardware accelerators to be attached to each node. See https://cloud.google.com/compute/docs/gpus for more information about support for GPUs.
2410    pub accelerators: Option<Vec<AcceleratorConfig>>,
2411    /// Advanced features for the Compute Engine VM.
2412    #[serde(rename = "advancedMachineFeatures")]
2413    pub advanced_machine_features: Option<AdvancedMachineFeatures>,
2414    ///  The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool. This should be of the form projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME]. For more information about protecting resources with Cloud KMS Keys please see: https://cloud.google.com/compute/docs/disks/customer-managed-encryption
2415    #[serde(rename = "bootDiskKmsKey")]
2416    pub boot_disk_kms_key: Option<String>,
2417    /// Confidential nodes config. All the nodes in the node pool will be Confidential VM once enabled.
2418    #[serde(rename = "confidentialNodes")]
2419    pub confidential_nodes: Option<ConfidentialNodes>,
2420    /// Parameters for containerd customization.
2421    #[serde(rename = "containerdConfig")]
2422    pub containerd_config: Option<ContainerdConfig>,
2423    /// Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB. If unspecified, the default disk size is 100GB.
2424    #[serde(rename = "diskSizeGb")]
2425    pub disk_size_gb: Option<i32>,
2426    /// Type of the disk attached to each node (e.g. 'pd-standard', 'pd-ssd' or 'pd-balanced') If unspecified, the default disk type is 'pd-standard'
2427    #[serde(rename = "diskType")]
2428    pub disk_type: Option<String>,
2429    /// Optional. Reserved for future use.
2430    #[serde(rename = "enableConfidentialStorage")]
2431    pub enable_confidential_storage: Option<bool>,
2432    /// Parameters for the node ephemeral storage using Local SSDs. If unspecified, ephemeral storage is backed by the boot disk.
2433    #[serde(rename = "ephemeralStorageLocalSsdConfig")]
2434    pub ephemeral_storage_local_ssd_config: Option<EphemeralStorageLocalSsdConfig>,
2435    /// Enable or disable NCCL fast socket for the node pool.
2436    #[serde(rename = "fastSocket")]
2437    pub fast_socket: Option<FastSocket>,
2438    /// Google Container File System (image streaming) configs.
2439    #[serde(rename = "gcfsConfig")]
2440    pub gcfs_config: Option<GcfsConfig>,
2441    /// Enable or disable gvnic in the node pool.
2442    pub gvnic: Option<VirtualNIC>,
2443    /// The image type to use for this node. Note that for a given image type, the latest version of it will be used. Please see https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for available image types.
2444    #[serde(rename = "imageType")]
2445    pub image_type: Option<String>,
2446    /// Node kubelet configs.
2447    #[serde(rename = "kubeletConfig")]
2448    pub kubelet_config: Option<NodeKubeletConfig>,
2449    /// The map of Kubernetes labels (key/value pairs) to be applied to each node. These will added in addition to any default label(s) that Kubernetes may apply to the node. In case of conflict in label keys, the applied set may differ depending on the Kubernetes version -- it's best to assume the behavior is undefined and conflicts should be avoided. For more information, including usage and the valid values, see: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
2450    pub labels: Option<HashMap<String, String>>,
2451    /// Parameters that can be configured on Linux nodes.
2452    #[serde(rename = "linuxNodeConfig")]
2453    pub linux_node_config: Option<LinuxNodeConfig>,
2454    /// Parameters for using raw-block Local NVMe SSDs.
2455    #[serde(rename = "localNvmeSsdBlockConfig")]
2456    pub local_nvme_ssd_block_config: Option<LocalNvmeSsdBlockConfig>,
2457    /// The number of local SSD disks to be attached to the node. The limit for this value is dependent upon the maximum number of disks available on a machine per zone. See: https://cloud.google.com/compute/docs/disks/local-ssd for more information.
2458    #[serde(rename = "localSsdCount")]
2459    pub local_ssd_count: Option<i32>,
2460    /// Logging configuration.
2461    #[serde(rename = "loggingConfig")]
2462    pub logging_config: Option<NodePoolLoggingConfig>,
2463    /// The name of a Google Compute Engine [machine type](https://cloud.google.com/compute/docs/machine-types) If unspecified, the default machine type is `e2-medium`.
2464    #[serde(rename = "machineType")]
2465    pub machine_type: Option<String>,
2466    /// The metadata key/value pairs assigned to instances in the cluster. Keys must conform to the regexp `[a-zA-Z0-9-_]+` and be less than 128 bytes in length. These are reflected as part of a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with any other metadata keys for the project or be one of the reserved keys: - "cluster-location" - "cluster-name" - "cluster-uid" - "configure-sh" - "containerd-configure-sh" - "enable-os-login" - "gci-ensure-gke-docker" - "gci-metrics-enabled" - "gci-update-strategy" - "instance-template" - "kube-env" - "startup-script" - "user-data" - "disable-address-manager" - "windows-startup-script-ps1" - "common-psm1" - "k8s-node-setup-psm1" - "install-ssh-psm1" - "user-profile-psm1" Values are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on them is that each value's size must be less than or equal to 32 KB. The total size of all keys and values must be less than 512 KB.
2467    pub metadata: Option<HashMap<String, String>>,
2468    /// Minimum CPU platform to be used by this instance. The instance may be scheduled on the specified or newer CPU platform. Applicable values are the friendly names of CPU platforms, such as `minCpuPlatform: "Intel Haswell"` or `minCpuPlatform: "Intel Sandy Bridge"`. For more information, read [how to specify min CPU platform](https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform)
2469    #[serde(rename = "minCpuPlatform")]
2470    pub min_cpu_platform: Option<String>,
2471    /// Setting this field will assign instances of this pool to run on the specified node group. This is useful for running workloads on [sole tenant nodes](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes).
2472    #[serde(rename = "nodeGroup")]
2473    pub node_group: Option<String>,
2474    /// The set of Google API scopes to be made available on all of the node VMs under the "default" service account. The following scopes are recommended, but not required, and by default are not included: * `https://www.googleapis.com/auth/compute` is required for mounting persistent storage on your nodes. * `https://www.googleapis.com/auth/devstorage.read_only` is required for communicating with **gcr.io** (the [Google Container Registry](https://cloud.google.com/container-registry/)). If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are enabled, in which case their required scopes will be added.
2475    #[serde(rename = "oauthScopes")]
2476    pub oauth_scopes: Option<Vec<String>>,
2477    /// Whether the nodes are created as preemptible VM instances. See: https://cloud.google.com/compute/docs/instances/preemptible for more information about preemptible VM instances.
2478    pub preemptible: Option<bool>,
2479    /// The optional reservation affinity. Setting this field will apply the specified [Zonal Compute Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) to this node pool.
2480    #[serde(rename = "reservationAffinity")]
2481    pub reservation_affinity: Option<ReservationAffinity>,
2482    /// The resource labels for the node pool to use to annotate any related Google Compute Engine resources.
2483    #[serde(rename = "resourceLabels")]
2484    pub resource_labels: Option<HashMap<String, String>>,
2485    /// A map of resource manager tag keys and values to be attached to the nodes.
2486    #[serde(rename = "resourceManagerTags")]
2487    pub resource_manager_tags: Option<ResourceManagerTags>,
2488    /// Sandbox configuration for this node.
2489    #[serde(rename = "sandboxConfig")]
2490    pub sandbox_config: Option<SandboxConfig>,
2491    /// Secondary boot disk update strategy.
2492    #[serde(rename = "secondaryBootDiskUpdateStrategy")]
2493    pub secondary_boot_disk_update_strategy: Option<SecondaryBootDiskUpdateStrategy>,
2494    /// List of secondary boot disks attached to the nodes.
2495    #[serde(rename = "secondaryBootDisks")]
2496    pub secondary_boot_disks: Option<Vec<SecondaryBootDisk>>,
2497    /// The Google Cloud Platform Service Account to be used by the node VMs. Specify the email address of the Service Account; otherwise, if no Service Account is specified, the "default" service account is used.
2498    #[serde(rename = "serviceAccount")]
2499    pub service_account: Option<String>,
2500    /// Shielded Instance options.
2501    #[serde(rename = "shieldedInstanceConfig")]
2502    pub shielded_instance_config: Option<ShieldedInstanceConfig>,
2503    /// Parameters for node pools to be backed by shared sole tenant node groups.
2504    #[serde(rename = "soleTenantConfig")]
2505    pub sole_tenant_config: Option<SoleTenantConfig>,
2506    /// Spot flag for enabling Spot VM, which is a rebrand of the existing preemptible flag.
2507    pub spot: Option<bool>,
2508    /// The list of instance tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during cluster or node pool creation. Each tag within the list must comply with RFC1035.
2509    pub tags: Option<Vec<String>>,
2510    /// List of kubernetes taints to be applied to each node. For more information, including usage and the valid values, see: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
2511    pub taints: Option<Vec<NodeTaint>>,
2512    /// Parameters that can be configured on Windows nodes.
2513    #[serde(rename = "windowsNodeConfig")]
2514    pub windows_node_config: Option<WindowsNodeConfig>,
2515    /// The workload metadata configuration for this node.
2516    #[serde(rename = "workloadMetadataConfig")]
2517    pub workload_metadata_config: Option<WorkloadMetadataConfig>,
2518}
2519
2520impl common::Part for NodeConfig {}
2521
2522/// Subset of NodeConfig message that has defaults.
2523///
2524/// This type is not used in any activity, and only used as *part* of another schema.
2525///
2526#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2527#[serde_with::serde_as]
2528#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2529pub struct NodeConfigDefaults {
2530    /// Parameters for containerd customization.
2531    #[serde(rename = "containerdConfig")]
2532    pub containerd_config: Option<ContainerdConfig>,
2533    /// GCFS (Google Container File System, also known as Riptide) options.
2534    #[serde(rename = "gcfsConfig")]
2535    pub gcfs_config: Option<GcfsConfig>,
2536    /// Logging configuration for node pools.
2537    #[serde(rename = "loggingConfig")]
2538    pub logging_config: Option<NodePoolLoggingConfig>,
2539    /// NodeKubeletConfig controls the defaults for new node-pools. Currently only `insecure_kubelet_readonly_port_enabled` can be set here.
2540    #[serde(rename = "nodeKubeletConfig")]
2541    pub node_kubelet_config: Option<NodeKubeletConfig>,
2542}
2543
2544impl common::Part for NodeConfigDefaults {}
2545
2546/// Node kubelet configs.
2547///
2548/// This type is not used in any activity, and only used as *part* of another schema.
2549///
2550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2551#[serde_with::serde_as]
2552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2553pub struct NodeKubeletConfig {
2554    /// Enable CPU CFS quota enforcement for containers that specify CPU limits. This option is enabled by default which makes kubelet use CFS quota (https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt) to enforce container CPU limits. Otherwise, CPU limits will not be enforced at all. Disable this option to mitigate CPU throttling problems while still having your pods to be in Guaranteed QoS class by specifying the CPU limits. The default value is 'true' if unspecified.
2555    #[serde(rename = "cpuCfsQuota")]
2556    pub cpu_cfs_quota: Option<bool>,
2557    /// Set the CPU CFS quota period value 'cpu.cfs_period_us'. The string must be a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The value must be a positive duration.
2558    #[serde(rename = "cpuCfsQuotaPeriod")]
2559    pub cpu_cfs_quota_period: Option<String>,
2560    /// Control the CPU management policy on the node. See https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/ The following values are allowed. * "none": the default, which represents the existing scheduling behavior. * "static": allows pods with certain resource characteristics to be granted increased CPU affinity and exclusivity on the node. The default value is 'none' if unspecified.
2561    #[serde(rename = "cpuManagerPolicy")]
2562    pub cpu_manager_policy: Option<String>,
2563    /// Enable or disable Kubelet read only port.
2564    #[serde(rename = "insecureKubeletReadonlyPortEnabled")]
2565    pub insecure_kubelet_readonly_port_enabled: Option<bool>,
2566    /// Set the Pod PID limits. See https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits Controls the maximum number of processes allowed to run in a pod. The value must be greater than or equal to 1024 and less than 4194304.
2567    #[serde(rename = "podPidsLimit")]
2568    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2569    pub pod_pids_limit: Option<i64>,
2570}
2571
2572impl common::Part for NodeKubeletConfig {}
2573
2574/// Collection of node-level [Kubernetes labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels).
2575///
2576/// This type is not used in any activity, and only used as *part* of another schema.
2577///
2578#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2579#[serde_with::serde_as]
2580#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2581pub struct NodeLabels {
2582    /// Map of node label keys and node label values.
2583    pub labels: Option<HashMap<String, String>>,
2584}
2585
2586impl common::Part for NodeLabels {}
2587
2588/// NodeManagement defines the set of node management services turned on for the node pool.
2589///
2590/// This type is not used in any activity, and only used as *part* of another schema.
2591///
2592#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2593#[serde_with::serde_as]
2594#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2595pub struct NodeManagement {
2596    /// A flag that specifies whether the node auto-repair is enabled for the node pool. If enabled, the nodes in this node pool will be monitored and, if they fail health checks too many times, an automatic repair action will be triggered.
2597    #[serde(rename = "autoRepair")]
2598    pub auto_repair: Option<bool>,
2599    /// A flag that specifies whether node auto-upgrade is enabled for the node pool. If enabled, node auto-upgrade helps keep the nodes in your node pool up to date with the latest release version of Kubernetes.
2600    #[serde(rename = "autoUpgrade")]
2601    pub auto_upgrade: Option<bool>,
2602    /// Specifies the Auto Upgrade knobs for the node pool.
2603    #[serde(rename = "upgradeOptions")]
2604    pub upgrade_options: Option<AutoUpgradeOptions>,
2605}
2606
2607impl common::Part for NodeManagement {}
2608
2609/// Parameters for node pool-level network config.
2610///
2611/// This type is not used in any activity, and only used as *part* of another schema.
2612///
2613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2614#[serde_with::serde_as]
2615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2616pub struct NodeNetworkConfig {
2617    /// We specify the additional node networks for this node pool using this list. Each node network corresponds to an additional interface
2618    #[serde(rename = "additionalNodeNetworkConfigs")]
2619    pub additional_node_network_configs: Option<Vec<AdditionalNodeNetworkConfig>>,
2620    /// We specify the additional pod networks for this node pool using this list. Each pod network corresponds to an additional alias IP range for the node
2621    #[serde(rename = "additionalPodNetworkConfigs")]
2622    pub additional_pod_network_configs: Option<Vec<AdditionalPodNetworkConfig>>,
2623    /// Input only. Whether to create a new range for pod IPs in this node pool. Defaults are provided for `pod_range` and `pod_ipv4_cidr_block` if they are not specified. If neither `create_pod_range` or `pod_range` are specified, the cluster-level default (`ip_allocation_policy.cluster_ipv4_cidr_block`) is used. Only applicable if `ip_allocation_policy.use_ip_aliases` is true. This field cannot be changed after the node pool has been created.
2624    #[serde(rename = "createPodRange")]
2625    pub create_pod_range: Option<bool>,
2626    /// Whether nodes have internal IP addresses only. If enable_private_nodes is not specified, then the value is derived from cluster.privateClusterConfig.enablePrivateNodes
2627    #[serde(rename = "enablePrivateNodes")]
2628    pub enable_private_nodes: Option<bool>,
2629    /// Network bandwidth tier configuration.
2630    #[serde(rename = "networkPerformanceConfig")]
2631    pub network_performance_config: Option<NetworkPerformanceConfig>,
2632    /// [PRIVATE FIELD] Pod CIDR size overprovisioning config for the nodepool. Pod CIDR size per node depends on max_pods_per_node. By default, the value of max_pods_per_node is rounded off to next power of 2 and we then double that to get the size of pod CIDR block per node. Example: max_pods_per_node of 30 would result in 64 IPs (/26). This config can disable the doubling of IPs (we still round off to next power of 2) Example: max_pods_per_node of 30 will result in 32 IPs (/27) when overprovisioning is disabled.
2633    #[serde(rename = "podCidrOverprovisionConfig")]
2634    pub pod_cidr_overprovision_config: Option<PodCIDROverprovisionConfig>,
2635    /// The IP address range for pod IPs in this node pool. Only applicable if `create_pod_range` is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. `/14`) to have a range chosen 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`) to pick a specific range to use. Only applicable if `ip_allocation_policy.use_ip_aliases` is true. This field cannot be changed after the node pool has been created.
2636    #[serde(rename = "podIpv4CidrBlock")]
2637    pub pod_ipv4_cidr_block: Option<String>,
2638    /// Output only. [Output only] The utilization of the IPv4 range for the pod. The ratio is Usage/[Total number of IPs in the secondary range], Usage=numNodes*numZones*podIPsPerNode.
2639    #[serde(rename = "podIpv4RangeUtilization")]
2640    pub pod_ipv4_range_utilization: Option<f64>,
2641    /// The ID of the secondary range for pod IPs. If `create_pod_range` is true, this ID is used for the new range. If `create_pod_range` is false, uses an existing secondary range with this ID. Only applicable if `ip_allocation_policy.use_ip_aliases` is true. This field cannot be changed after the node pool has been created.
2642    #[serde(rename = "podRange")]
2643    pub pod_range: Option<String>,
2644}
2645
2646impl common::Part for NodeNetworkConfig {}
2647
2648/// NodePool contains the name and configuration for a cluster’s node pool. Node pools are a set of nodes (i.e. VM’s), with a common configuration and specification, under the control of the cluster master. They may have a set of Kubernetes labels applied to them, which may be used to reference them during pod scheduling. They may also be resized up or down, to accommodate the workload.
2649///
2650/// # Activities
2651///
2652/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2653/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2654///
2655/// * [locations clusters node pools get projects](ProjectLocationClusterNodePoolGetCall) (response)
2656/// * [zones clusters node pools get projects](ProjectZoneClusterNodePoolGetCall) (response)
2657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2658#[serde_with::serde_as]
2659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2660pub struct NodePool {
2661    /// Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid configuration is present.
2662    pub autoscaling: Option<NodePoolAutoscaling>,
2663    /// Enable best effort provisioning for nodes
2664    #[serde(rename = "bestEffortProvisioning")]
2665    pub best_effort_provisioning: Option<BestEffortProvisioning>,
2666    /// Which conditions caused the current node pool state.
2667    pub conditions: Option<Vec<StatusCondition>>,
2668    /// The node configuration of the pool.
2669    pub config: Option<NodeConfig>,
2670    /// This checksum is computed by the server based on the value of node pool fields, and may be sent on update requests to ensure the client has an up-to-date value before proceeding.
2671    pub etag: Option<String>,
2672    /// The initial node count for the pool. You must ensure that your Compute Engine [resource quota](https://cloud.google.com/compute/quotas) is sufficient for this number of instances. You must also have available firewall and routes quota.
2673    #[serde(rename = "initialNodeCount")]
2674    pub initial_node_count: Option<i32>,
2675    /// [Output only] The resource URLs of the [managed instance groups](https://cloud.google.com/compute/docs/instance-groups/creating-groups-of-managed-instances) associated with this node pool. During the node pool blue-green upgrade operation, the URLs contain both blue and green resources.
2676    #[serde(rename = "instanceGroupUrls")]
2677    pub instance_group_urls: Option<Vec<String>>,
2678    /// The list of Google Compute Engine [zones](https://cloud.google.com/compute/docs/zones#available) in which the NodePool's nodes should be located. If this value is unspecified during node pool creation, the [Cluster.Locations](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters#Cluster.FIELDS.locations) value will be used, instead. Warning: changing node pool locations will result in nodes being added and/or removed.
2679    pub locations: Option<Vec<String>>,
2680    /// NodeManagement configuration for this NodePool.
2681    pub management: Option<NodeManagement>,
2682    /// The constraint on the maximum number of pods that can be run simultaneously on a node in the node pool.
2683    #[serde(rename = "maxPodsConstraint")]
2684    pub max_pods_constraint: Option<MaxPodsConstraint>,
2685    /// The name of the node pool.
2686    pub name: Option<String>,
2687    /// Networking configuration for this NodePool. If specified, it overrides the cluster-level defaults.
2688    #[serde(rename = "networkConfig")]
2689    pub network_config: Option<NodeNetworkConfig>,
2690    /// Specifies the node placement policy.
2691    #[serde(rename = "placementPolicy")]
2692    pub placement_policy: Option<PlacementPolicy>,
2693    /// [Output only] The pod CIDR block size per node in this node pool.
2694    #[serde(rename = "podIpv4CidrSize")]
2695    pub pod_ipv4_cidr_size: Option<i32>,
2696    /// Specifies the configuration of queued provisioning.
2697    #[serde(rename = "queuedProvisioning")]
2698    pub queued_provisioning: Option<QueuedProvisioning>,
2699    /// [Output only] Server-defined URL for the resource.
2700    #[serde(rename = "selfLink")]
2701    pub self_link: Option<String>,
2702    /// [Output only] The status of the nodes in this pool instance.
2703    pub status: Option<String>,
2704    /// [Output only] Deprecated. Use conditions instead. Additional information about the current status of this node pool instance, if available.
2705    #[serde(rename = "statusMessage")]
2706    pub status_message: Option<String>,
2707    /// Output only. [Output only] Update info contains relevant information during a node pool update.
2708    #[serde(rename = "updateInfo")]
2709    pub update_info: Option<UpdateInfo>,
2710    /// Upgrade settings control disruption and speed of the upgrade.
2711    #[serde(rename = "upgradeSettings")]
2712    pub upgrade_settings: Option<UpgradeSettings>,
2713    /// The version of Kubernetes running on this NodePool's nodes. If unspecified, it defaults as described [here](https://cloud.google.com/kubernetes-engine/versioning#specifying_node_version).
2714    pub version: Option<String>,
2715}
2716
2717impl common::ResponseResult for NodePool {}
2718
2719/// Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
2720///
2721/// This type is not used in any activity, and only used as *part* of another schema.
2722///
2723#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2724#[serde_with::serde_as]
2725#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2726pub struct NodePoolAutoConfig {
2727    /// The list of instance tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during cluster creation. Each tag within the list must comply with RFC1035.
2728    #[serde(rename = "networkTags")]
2729    pub network_tags: Option<NetworkTags>,
2730    /// NodeKubeletConfig controls the defaults for autoprovisioned node-pools. Currently only `insecure_kubelet_readonly_port_enabled` can be set here.
2731    #[serde(rename = "nodeKubeletConfig")]
2732    pub node_kubelet_config: Option<NodeKubeletConfig>,
2733    /// Resource manager tag keys and values to be attached to the nodes for managing Compute Engine firewalls using Network Firewall Policies.
2734    #[serde(rename = "resourceManagerTags")]
2735    pub resource_manager_tags: Option<ResourceManagerTags>,
2736}
2737
2738impl common::Part for NodePoolAutoConfig {}
2739
2740/// NodePoolAutoscaling contains information required by cluster autoscaler to adjust the size of the node pool to the current cluster usage.
2741///
2742/// This type is not used in any activity, and only used as *part* of another schema.
2743///
2744#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2745#[serde_with::serde_as]
2746#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2747pub struct NodePoolAutoscaling {
2748    /// Can this node pool be deleted automatically.
2749    pub autoprovisioned: Option<bool>,
2750    /// Is autoscaling enabled for this node pool.
2751    pub enabled: Option<bool>,
2752    /// Location policy used when scaling up a nodepool.
2753    #[serde(rename = "locationPolicy")]
2754    pub location_policy: Option<String>,
2755    /// Maximum number of nodes for one location in the NodePool. Must be >= min_node_count. There has to be enough quota to scale up the cluster.
2756    #[serde(rename = "maxNodeCount")]
2757    pub max_node_count: Option<i32>,
2758    /// Minimum number of nodes for one location in the NodePool. Must be >= 1 and <= max_node_count.
2759    #[serde(rename = "minNodeCount")]
2760    pub min_node_count: Option<i32>,
2761    /// Maximum number of nodes in the node pool. Must be greater than total_min_node_count. There has to be enough quota to scale up the cluster. The total_*_node_count fields are mutually exclusive with the *_node_count fields.
2762    #[serde(rename = "totalMaxNodeCount")]
2763    pub total_max_node_count: Option<i32>,
2764    /// Minimum number of nodes in the node pool. Must be greater than 1 less than total_max_node_count. The total_*_node_count fields are mutually exclusive with the *_node_count fields.
2765    #[serde(rename = "totalMinNodeCount")]
2766    pub total_min_node_count: Option<i32>,
2767}
2768
2769impl common::Part for NodePoolAutoscaling {}
2770
2771/// Subset of Nodepool message that has defaults.
2772///
2773/// This type is not used in any activity, and only used as *part* of another schema.
2774///
2775#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2776#[serde_with::serde_as]
2777#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2778pub struct NodePoolDefaults {
2779    /// Subset of NodeConfig message that has defaults.
2780    #[serde(rename = "nodeConfigDefaults")]
2781    pub node_config_defaults: Option<NodeConfigDefaults>,
2782}
2783
2784impl common::Part for NodePoolDefaults {}
2785
2786/// NodePoolLoggingConfig specifies logging configuration for nodepools.
2787///
2788/// This type is not used in any activity, and only used as *part* of another schema.
2789///
2790#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2791#[serde_with::serde_as]
2792#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2793pub struct NodePoolLoggingConfig {
2794    /// Logging variant configuration.
2795    #[serde(rename = "variantConfig")]
2796    pub variant_config: Option<LoggingVariantConfig>,
2797}
2798
2799impl common::Part for NodePoolLoggingConfig {}
2800
2801/// Kubernetes taint is composed of three fields: key, value, and effect. Effect can only be one of three types: NoSchedule, PreferNoSchedule or NoExecute. See [here](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration) for more information, including usage and the valid values.
2802///
2803/// This type is not used in any activity, and only used as *part* of another schema.
2804///
2805#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2806#[serde_with::serde_as]
2807#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2808pub struct NodeTaint {
2809    /// Effect for taint.
2810    pub effect: Option<String>,
2811    /// Key for taint.
2812    pub key: Option<String>,
2813    /// Value for taint.
2814    pub value: Option<String>,
2815}
2816
2817impl common::Part for NodeTaint {}
2818
2819/// Collection of Kubernetes [node taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration).
2820///
2821/// This type is not used in any activity, and only used as *part* of another schema.
2822///
2823#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2824#[serde_with::serde_as]
2825#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2826pub struct NodeTaints {
2827    /// List of node taints.
2828    pub taints: Option<Vec<NodeTaint>>,
2829}
2830
2831impl common::Part for NodeTaints {}
2832
2833/// NotificationConfig is the configuration of notifications.
2834///
2835/// This type is not used in any activity, and only used as *part* of another schema.
2836///
2837#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2838#[serde_with::serde_as]
2839#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2840pub struct NotificationConfig {
2841    /// Notification config for Pub/Sub.
2842    pub pubsub: Option<PubSub>,
2843}
2844
2845impl common::Part for NotificationConfig {}
2846
2847/// This operation resource represents operations that may have happened or are happening on the cluster. All fields are output only.
2848///
2849/// # Activities
2850///
2851/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2852/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2853///
2854/// * [locations clusters node pools create projects](ProjectLocationClusterNodePoolCreateCall) (response)
2855/// * [locations clusters node pools delete projects](ProjectLocationClusterNodePoolDeleteCall) (response)
2856/// * [locations clusters node pools rollback projects](ProjectLocationClusterNodePoolRollbackCall) (response)
2857/// * [locations clusters node pools set autoscaling projects](ProjectLocationClusterNodePoolSetAutoscalingCall) (response)
2858/// * [locations clusters node pools set management projects](ProjectLocationClusterNodePoolSetManagementCall) (response)
2859/// * [locations clusters node pools set size projects](ProjectLocationClusterNodePoolSetSizeCall) (response)
2860/// * [locations clusters node pools update projects](ProjectLocationClusterNodePoolUpdateCall) (response)
2861/// * [locations clusters complete ip rotation projects](ProjectLocationClusterCompleteIpRotationCall) (response)
2862/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (response)
2863/// * [locations clusters delete projects](ProjectLocationClusterDeleteCall) (response)
2864/// * [locations clusters set addons projects](ProjectLocationClusterSetAddonCall) (response)
2865/// * [locations clusters set legacy abac projects](ProjectLocationClusterSetLegacyAbacCall) (response)
2866/// * [locations clusters set locations projects](ProjectLocationClusterSetLocationCall) (response)
2867/// * [locations clusters set logging projects](ProjectLocationClusterSetLoggingCall) (response)
2868/// * [locations clusters set maintenance policy projects](ProjectLocationClusterSetMaintenancePolicyCall) (response)
2869/// * [locations clusters set master auth projects](ProjectLocationClusterSetMasterAuthCall) (response)
2870/// * [locations clusters set monitoring projects](ProjectLocationClusterSetMonitoringCall) (response)
2871/// * [locations clusters set network policy projects](ProjectLocationClusterSetNetworkPolicyCall) (response)
2872/// * [locations clusters set resource labels projects](ProjectLocationClusterSetResourceLabelCall) (response)
2873/// * [locations clusters start ip rotation projects](ProjectLocationClusterStartIpRotationCall) (response)
2874/// * [locations clusters update projects](ProjectLocationClusterUpdateCall) (response)
2875/// * [locations clusters update master projects](ProjectLocationClusterUpdateMasterCall) (response)
2876/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
2877/// * [zones clusters node pools autoscaling projects](ProjectZoneClusterNodePoolAutoscalingCall) (response)
2878/// * [zones clusters node pools create projects](ProjectZoneClusterNodePoolCreateCall) (response)
2879/// * [zones clusters node pools delete projects](ProjectZoneClusterNodePoolDeleteCall) (response)
2880/// * [zones clusters node pools rollback projects](ProjectZoneClusterNodePoolRollbackCall) (response)
2881/// * [zones clusters node pools set management projects](ProjectZoneClusterNodePoolSetManagementCall) (response)
2882/// * [zones clusters node pools set size projects](ProjectZoneClusterNodePoolSetSizeCall) (response)
2883/// * [zones clusters node pools update projects](ProjectZoneClusterNodePoolUpdateCall) (response)
2884/// * [zones clusters addons projects](ProjectZoneClusterAddonCall) (response)
2885/// * [zones clusters complete ip rotation projects](ProjectZoneClusterCompleteIpRotationCall) (response)
2886/// * [zones clusters create projects](ProjectZoneClusterCreateCall) (response)
2887/// * [zones clusters delete projects](ProjectZoneClusterDeleteCall) (response)
2888/// * [zones clusters legacy abac projects](ProjectZoneClusterLegacyAbacCall) (response)
2889/// * [zones clusters locations projects](ProjectZoneClusterLocationCall) (response)
2890/// * [zones clusters logging projects](ProjectZoneClusterLoggingCall) (response)
2891/// * [zones clusters master projects](ProjectZoneClusterMasterCall) (response)
2892/// * [zones clusters monitoring projects](ProjectZoneClusterMonitoringCall) (response)
2893/// * [zones clusters resource labels projects](ProjectZoneClusterResourceLabelCall) (response)
2894/// * [zones clusters set maintenance policy projects](ProjectZoneClusterSetMaintenancePolicyCall) (response)
2895/// * [zones clusters set master auth projects](ProjectZoneClusterSetMasterAuthCall) (response)
2896/// * [zones clusters set network policy projects](ProjectZoneClusterSetNetworkPolicyCall) (response)
2897/// * [zones clusters start ip rotation projects](ProjectZoneClusterStartIpRotationCall) (response)
2898/// * [zones clusters update projects](ProjectZoneClusterUpdateCall) (response)
2899/// * [zones operations get projects](ProjectZoneOperationGetCall) (response)
2900#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2901#[serde_with::serde_as]
2902#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2903pub struct Operation {
2904    /// Which conditions caused the current cluster state. Deprecated. Use field error instead.
2905    #[serde(rename = "clusterConditions")]
2906    pub cluster_conditions: Option<Vec<StatusCondition>>,
2907    /// Detailed operation progress, if available.
2908    pub detail: Option<String>,
2909    /// [Output only] The time the operation completed, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
2910    #[serde(rename = "endTime")]
2911    pub end_time: Option<String>,
2912    /// The error result of the operation in case of failure.
2913    pub error: Option<Status>,
2914    /// [Output only] The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) or [region](https://cloud.google.com/compute/docs/regions-zones/regions-zones#available) in which the cluster resides.
2915    pub location: Option<String>,
2916    /// The server-assigned ID for the operation.
2917    pub name: Option<String>,
2918    /// Which conditions caused the current node pool state. Deprecated. Use field error instead.
2919    #[serde(rename = "nodepoolConditions")]
2920    pub nodepool_conditions: Option<Vec<StatusCondition>>,
2921    /// The operation type.
2922    #[serde(rename = "operationType")]
2923    pub operation_type: Option<String>,
2924    /// Output only. [Output only] Progress information for an operation.
2925    pub progress: Option<OperationProgress>,
2926    /// Server-defined URI for the operation. Example: `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`.
2927    #[serde(rename = "selfLink")]
2928    pub self_link: Option<String>,
2929    /// [Output only] The time the operation started, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
2930    #[serde(rename = "startTime")]
2931    pub start_time: Option<String>,
2932    /// The current status of the operation.
2933    pub status: Option<String>,
2934    /// Output only. If an error has occurred, a textual description of the error. Deprecated. Use the field error instead.
2935    #[serde(rename = "statusMessage")]
2936    pub status_message: Option<String>,
2937    /// Server-defined URI for the target of the operation. The format of this is a URI to the resource being modified (such as a cluster, node pool, or node). For node pool repairs, there may be multiple nodes being repaired, but only one will be the target. Examples: - ## `https://container.googleapis.com/v1/projects/123/locations/us-central1/clusters/my-cluster` ## `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np` `https://container.googleapis.com/v1/projects/123/zones/us-central1-c/clusters/my-cluster/nodePools/my-np/node/my-node`
2938    #[serde(rename = "targetLink")]
2939    pub target_link: Option<String>,
2940    /// The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the operation is taking place. This field is deprecated, use location instead.
2941    pub zone: Option<String>,
2942}
2943
2944impl common::ResponseResult for Operation {}
2945
2946/// OperationError records errors seen from CloudKMS keys encountered during updates to DatabaseEncryption configuration.
2947///
2948/// This type is not used in any activity, and only used as *part* of another schema.
2949///
2950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2951#[serde_with::serde_as]
2952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2953pub struct OperationError {
2954    /// Description of the error seen during the operation.
2955    #[serde(rename = "errorMessage")]
2956    pub error_message: Option<String>,
2957    /// CloudKMS key resource that had the error.
2958    #[serde(rename = "keyName")]
2959    pub key_name: Option<String>,
2960    /// Time when the CloudKMS error was seen.
2961    pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
2962}
2963
2964impl common::Part for OperationError {}
2965
2966/// Information about operation (or operation stage) progress.
2967///
2968/// This type is not used in any activity, and only used as *part* of another schema.
2969///
2970#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2971#[serde_with::serde_as]
2972#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2973pub struct OperationProgress {
2974    /// Progress metric bundle, for example: metrics: [{name: "nodes done", int_value: 15}, {name: "nodes total", int_value: 32}] or metrics: [{name: "progress", double_value: 0.56}, {name: "progress scale", double_value: 1.0}]
2975    pub metrics: Option<Vec<Metric>>,
2976    /// A non-parameterized string describing an operation stage. Unset for single-stage operations.
2977    pub name: Option<String>,
2978    /// Substages of an operation or a stage.
2979    pub stages: Option<Vec<OperationProgress>>,
2980    /// Status of an operation stage. Unset for single-stage operations.
2981    pub status: Option<String>,
2982}
2983
2984impl common::Part for OperationProgress {}
2985
2986/// ParentProductConfig is the configuration of the parent product of the cluster. This field is used by Google internal products that are built on top of a GKE cluster and take the ownership of the cluster.
2987///
2988/// This type is not used in any activity, and only used as *part* of another schema.
2989///
2990#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2991#[serde_with::serde_as]
2992#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2993pub struct ParentProductConfig {
2994    /// Labels contain the configuration of the parent product.
2995    pub labels: Option<HashMap<String, String>>,
2996    /// Name of the parent product associated with the cluster.
2997    #[serde(rename = "productName")]
2998    pub product_name: Option<String>,
2999}
3000
3001impl common::Part for ParentProductConfig {}
3002
3003/// PlacementPolicy defines the placement policy used by the node pool.
3004///
3005/// This type is not used in any activity, and only used as *part* of another schema.
3006///
3007#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3008#[serde_with::serde_as]
3009#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3010pub struct PlacementPolicy {
3011    /// If set, refers to the name of a custom resource policy supplied by the user. The resource policy must be in the same project and region as the node pool. If not found, InvalidArgument error is returned.
3012    #[serde(rename = "policyName")]
3013    pub policy_name: Option<String>,
3014    /// Optional. TPU placement topology for pod slice node pool. https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies
3015    #[serde(rename = "tpuTopology")]
3016    pub tpu_topology: Option<String>,
3017    /// The type of placement.
3018    #[serde(rename = "type")]
3019    pub type_: Option<String>,
3020}
3021
3022impl common::Part for PlacementPolicy {}
3023
3024/// [PRIVATE FIELD] Config for pod CIDR size overprovisioning.
3025///
3026/// This type is not used in any activity, and only used as *part* of another schema.
3027///
3028#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3029#[serde_with::serde_as]
3030#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3031pub struct PodCIDROverprovisionConfig {
3032    /// Whether Pod CIDR overprovisioning is disabled. Note: Pod CIDR overprovisioning is enabled by default.
3033    pub disable: Option<bool>,
3034}
3035
3036impl common::Part for PodCIDROverprovisionConfig {}
3037
3038/// Configuration options for private clusters.
3039///
3040/// This type is not used in any activity, and only used as *part* of another schema.
3041///
3042#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3043#[serde_with::serde_as]
3044#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3045pub struct PrivateClusterConfig {
3046    /// Whether the master's internal IP address is used as the cluster endpoint.
3047    #[serde(rename = "enablePrivateEndpoint")]
3048    pub enable_private_endpoint: Option<bool>,
3049    /// Whether nodes have internal IP addresses only. If enabled, all nodes are given only RFC 1918 private addresses and communicate with the master via private networking.
3050    #[serde(rename = "enablePrivateNodes")]
3051    pub enable_private_nodes: Option<bool>,
3052    /// Controls master global access settings.
3053    #[serde(rename = "masterGlobalAccessConfig")]
3054    pub master_global_access_config: Option<PrivateClusterMasterGlobalAccessConfig>,
3055    /// The IP range in CIDR notation to use for the hosted master network. This range will be used for assigning internal IP addresses to the master or set of masters, as well as the ILB VIP. This range must not overlap with any other ranges in use within the cluster's network.
3056    #[serde(rename = "masterIpv4CidrBlock")]
3057    pub master_ipv4_cidr_block: Option<String>,
3058    /// Output only. The peering name in the customer VPC used by this cluster.
3059    #[serde(rename = "peeringName")]
3060    pub peering_name: Option<String>,
3061    /// Output only. The internal IP address of this cluster's master endpoint.
3062    #[serde(rename = "privateEndpoint")]
3063    pub private_endpoint: Option<String>,
3064    /// Subnet to provision the master's private endpoint during cluster creation. Specified in projects/*/regions/*/subnetworks/* format.
3065    #[serde(rename = "privateEndpointSubnetwork")]
3066    pub private_endpoint_subnetwork: Option<String>,
3067    /// Output only. The external IP address of this cluster's master endpoint.
3068    #[serde(rename = "publicEndpoint")]
3069    pub public_endpoint: Option<String>,
3070}
3071
3072impl common::Part for PrivateClusterConfig {}
3073
3074/// Configuration for controlling master global access settings.
3075///
3076/// This type is not used in any activity, and only used as *part* of another schema.
3077///
3078#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3079#[serde_with::serde_as]
3080#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3081pub struct PrivateClusterMasterGlobalAccessConfig {
3082    /// Whenever master is accessible globally or not.
3083    pub enabled: Option<bool>,
3084}
3085
3086impl common::Part for PrivateClusterMasterGlobalAccessConfig {}
3087
3088/// PrivateRegistryAccessConfig contains access configuration for private container registries.
3089///
3090/// This type is not used in any activity, and only used as *part* of another schema.
3091///
3092#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3093#[serde_with::serde_as]
3094#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3095pub struct PrivateRegistryAccessConfig {
3096    /// Private registry access configuration.
3097    #[serde(rename = "certificateAuthorityDomainConfig")]
3098    pub certificate_authority_domain_config: Option<Vec<CertificateAuthorityDomainConfig>>,
3099    /// Private registry access is enabled.
3100    pub enabled: Option<bool>,
3101}
3102
3103impl common::Part for PrivateRegistryAccessConfig {}
3104
3105/// Pub/Sub specific notification config.
3106///
3107/// This type is not used in any activity, and only used as *part* of another schema.
3108///
3109#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3110#[serde_with::serde_as]
3111#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3112pub struct PubSub {
3113    /// Enable notifications for Pub/Sub.
3114    pub enabled: Option<bool>,
3115    /// Allows filtering to one or more specific event types. If no filter is specified, or if a filter is specified with no event types, all event types will be sent
3116    pub filter: Option<Filter>,
3117    /// The desired Pub/Sub topic to which notifications will be sent by GKE. Format is `projects/{project}/topics/{topic}`.
3118    pub topic: Option<String>,
3119}
3120
3121impl common::Part for PubSub {}
3122
3123/// QueuedProvisioning defines the queued provisioning used by the node pool.
3124///
3125/// This type is not used in any activity, and only used as *part* of another schema.
3126///
3127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3128#[serde_with::serde_as]
3129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3130pub struct QueuedProvisioning {
3131    /// Denotes that this nodepool is QRM specific, meaning nodes can be only obtained through queuing via the Cluster Autoscaler ProvisioningRequest API.
3132    pub enabled: Option<bool>,
3133}
3134
3135impl common::Part for QueuedProvisioning {}
3136
3137/// RangeInfo contains the range name and the range utilization by this cluster.
3138///
3139/// This type is not used in any activity, and only used as *part* of another schema.
3140///
3141#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3142#[serde_with::serde_as]
3143#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3144pub struct RangeInfo {
3145    /// Output only. [Output only] Name of a range.
3146    #[serde(rename = "rangeName")]
3147    pub range_name: Option<String>,
3148    /// Output only. [Output only] The utilization of the range.
3149    pub utilization: Option<f64>,
3150}
3151
3152impl common::Part for RangeInfo {}
3153
3154/// Represents an arbitrary window of time that recurs.
3155///
3156/// This type is not used in any activity, and only used as *part* of another schema.
3157///
3158#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3159#[serde_with::serde_as]
3160#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3161pub struct RecurringTimeWindow {
3162    /// An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how this window reccurs. They go on for the span of time between the start and end time. For example, to have something repeat every weekday, you'd use: `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` To repeat some window daily (equivalent to the DailyMaintenanceWindow): `FREQ=DAILY` For the first weekend of every month: `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` This specifies how frequently the window starts. Eg, if you wanted to have a 9-5 UTC-4 window every weekday, you'd use something like: ``` start time = 2019-01-01T09:00:00-0400 end time = 2019-01-01T17:00:00-0400 recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR ``` Windows can span multiple days. Eg, to make the window encompass every weekend from midnight Saturday till the last minute of Sunday UTC: ``` start time = 2019-01-05T00:00:00Z end time = 2019-01-07T23:59:00Z recurrence = FREQ=WEEKLY;BYDAY=SA ``` Note the start and end time's specific dates are largely arbitrary except to specify duration of the window and when it first starts. The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported.
3163    pub recurrence: Option<String>,
3164    /// The window of the first recurrence.
3165    pub window: Option<TimeWindow>,
3166}
3167
3168impl common::Part for RecurringTimeWindow {}
3169
3170/// ReleaseChannel indicates which release channel a cluster is subscribed to. Release channels are arranged in order of risk. When a cluster is subscribed to a release channel, Google maintains both the master version and the node version. Node auto-upgrade defaults to true and cannot be disabled.
3171///
3172/// This type is not used in any activity, and only used as *part* of another schema.
3173///
3174#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3175#[serde_with::serde_as]
3176#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3177pub struct ReleaseChannel {
3178    /// channel specifies which release channel the cluster is subscribed to.
3179    pub channel: Option<String>,
3180}
3181
3182impl common::Part for ReleaseChannel {}
3183
3184/// ReleaseChannelConfig exposes configuration for a release channel.
3185///
3186/// This type is not used in any activity, and only used as *part* of another schema.
3187///
3188#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3189#[serde_with::serde_as]
3190#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3191pub struct ReleaseChannelConfig {
3192    /// The release channel this configuration applies to.
3193    pub channel: Option<String>,
3194    /// The default version for newly created clusters on the channel.
3195    #[serde(rename = "defaultVersion")]
3196    pub default_version: Option<String>,
3197    /// List of valid versions for the channel.
3198    #[serde(rename = "validVersions")]
3199    pub valid_versions: Option<Vec<String>>,
3200}
3201
3202impl common::Part for ReleaseChannelConfig {}
3203
3204/// [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) is the configuration of desired reservation which instances could take capacity from.
3205///
3206/// This type is not used in any activity, and only used as *part* of another schema.
3207///
3208#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3209#[serde_with::serde_as]
3210#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3211pub struct ReservationAffinity {
3212    /// Corresponds to the type of reservation consumption.
3213    #[serde(rename = "consumeReservationType")]
3214    pub consume_reservation_type: Option<String>,
3215    /// Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, specify "compute.googleapis.com/reservation-name" as the key and specify the name of your reservation as its value.
3216    pub key: Option<String>,
3217    /// Corresponds to the label value(s) of reservation resource(s).
3218    pub values: Option<Vec<String>>,
3219}
3220
3221impl common::Part for ReservationAffinity {}
3222
3223/// Collection of [GCP labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels).
3224///
3225/// This type is not used in any activity, and only used as *part* of another schema.
3226///
3227#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3228#[serde_with::serde_as]
3229#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3230pub struct ResourceLabels {
3231    /// Map of node label keys and node label values.
3232    pub labels: Option<HashMap<String, String>>,
3233}
3234
3235impl common::Part for ResourceLabels {}
3236
3237/// Contains information about amount of some resource in the cluster. For memory, value should be in GB.
3238///
3239/// This type is not used in any activity, and only used as *part* of another schema.
3240///
3241#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3242#[serde_with::serde_as]
3243#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3244pub struct ResourceLimit {
3245    /// Maximum amount of the resource in the cluster.
3246    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3247    pub maximum: Option<i64>,
3248    /// Minimum amount of the resource in the cluster.
3249    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3250    pub minimum: Option<i64>,
3251    /// Resource name "cpu", "memory" or gpu-specific string.
3252    #[serde(rename = "resourceType")]
3253    pub resource_type: Option<String>,
3254}
3255
3256impl common::Part for ResourceLimit {}
3257
3258/// A map of resource manager tag keys and values to be attached to the nodes for managing Compute Engine firewalls using Network Firewall Policies. Tags must be according to specifications in https://cloud.google.com/vpc/docs/tags-firewalls-overview#specifications. A maximum of 5 tag key-value pairs can be specified. Existing tags will be replaced with new values.
3259///
3260/// This type is not used in any activity, and only used as *part* of another schema.
3261///
3262#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3263#[serde_with::serde_as]
3264#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3265pub struct ResourceManagerTags {
3266    /// TagKeyValue must be in one of the following formats ([KEY]=[VALUE]) 1. `tagKeys/{tag_key_id}=tagValues/{tag_value_id}` 2. `{org_id}/{tag_key_name}={tag_value_name}` 3. `{project_id}/{tag_key_name}={tag_value_name}`
3267    pub tags: Option<HashMap<String, String>>,
3268}
3269
3270impl common::Part for ResourceManagerTags {}
3271
3272/// Configuration for exporting cluster resource usages.
3273///
3274/// This type is not used in any activity, and only used as *part* of another schema.
3275///
3276#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3277#[serde_with::serde_as]
3278#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3279pub struct ResourceUsageExportConfig {
3280    /// Configuration to use BigQuery as usage export destination.
3281    #[serde(rename = "bigqueryDestination")]
3282    pub bigquery_destination: Option<BigQueryDestination>,
3283    /// Configuration to enable resource consumption metering.
3284    #[serde(rename = "consumptionMeteringConfig")]
3285    pub consumption_metering_config: Option<ConsumptionMeteringConfig>,
3286    /// Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic.
3287    #[serde(rename = "enableNetworkEgressMetering")]
3288    pub enable_network_egress_metering: Option<bool>,
3289}
3290
3291impl common::Part for ResourceUsageExportConfig {}
3292
3293/// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed NodePool upgrade. This will be an no-op if the last upgrade successfully completed.
3294///
3295/// # Activities
3296///
3297/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3298/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3299///
3300/// * [locations clusters node pools rollback projects](ProjectLocationClusterNodePoolRollbackCall) (request)
3301/// * [zones clusters node pools rollback projects](ProjectZoneClusterNodePoolRollbackCall) (request)
3302#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3303#[serde_with::serde_as]
3304#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3305pub struct RollbackNodePoolUpgradeRequest {
3306    /// Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
3307    #[serde(rename = "clusterId")]
3308    pub cluster_id: Option<String>,
3309    /// The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
3310    pub name: Option<String>,
3311    /// Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
3312    #[serde(rename = "nodePoolId")]
3313    pub node_pool_id: Option<String>,
3314    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3315    #[serde(rename = "projectId")]
3316    pub project_id: Option<String>,
3317    /// Option for rollback to ignore the PodDisruptionBudget. Default value is false.
3318    #[serde(rename = "respectPdb")]
3319    pub respect_pdb: Option<bool>,
3320    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3321    pub zone: Option<String>,
3322}
3323
3324impl common::RequestValue for RollbackNodePoolUpgradeRequest {}
3325
3326/// SandboxConfig contains configurations of the sandbox to use for the node.
3327///
3328/// This type is not used in any activity, and only used as *part* of another schema.
3329///
3330#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3331#[serde_with::serde_as]
3332#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3333pub struct SandboxConfig {
3334    /// Type of the sandbox to use for the node.
3335    #[serde(rename = "type")]
3336    pub type_: Option<String>,
3337}
3338
3339impl common::Part for SandboxConfig {}
3340
3341/// SecondaryBootDisk represents a persistent disk attached to a node with special configurations based on its mode.
3342///
3343/// This type is not used in any activity, and only used as *part* of another schema.
3344///
3345#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3346#[serde_with::serde_as]
3347#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3348pub struct SecondaryBootDisk {
3349    /// Fully-qualified resource ID for an existing disk image.
3350    #[serde(rename = "diskImage")]
3351    pub disk_image: Option<String>,
3352    /// Disk mode (container image cache, etc.)
3353    pub mode: Option<String>,
3354}
3355
3356impl common::Part for SecondaryBootDisk {}
3357
3358/// SecondaryBootDiskUpdateStrategy is a placeholder which will be extended in the future to define different options for updating secondary boot disks.
3359///
3360/// This type is not used in any activity, and only used as *part* of another schema.
3361///
3362#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3363#[serde_with::serde_as]
3364#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3365pub struct SecondaryBootDiskUpdateStrategy {
3366    _never_set: Option<bool>,
3367}
3368
3369impl common::Part for SecondaryBootDiskUpdateStrategy {}
3370
3371/// SecurityPostureConfig defines the flags needed to enable/disable features for the Security Posture API.
3372///
3373/// This type is not used in any activity, and only used as *part* of another schema.
3374///
3375#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3376#[serde_with::serde_as]
3377#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3378pub struct SecurityPostureConfig {
3379    /// Sets which mode to use for Security Posture features.
3380    pub mode: Option<String>,
3381    /// Sets which mode to use for vulnerability scanning.
3382    #[serde(rename = "vulnerabilityMode")]
3383    pub vulnerability_mode: Option<String>,
3384}
3385
3386impl common::Part for SecurityPostureConfig {}
3387
3388/// Kubernetes Engine service configuration.
3389///
3390/// # Activities
3391///
3392/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3393/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3394///
3395/// * [locations get server config projects](ProjectLocationGetServerConfigCall) (response)
3396/// * [zones get serverconfig projects](ProjectZoneGetServerconfigCall) (response)
3397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3398#[serde_with::serde_as]
3399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3400pub struct ServerConfig {
3401    /// List of release channel configurations.
3402    pub channels: Option<Vec<ReleaseChannelConfig>>,
3403    /// Version of Kubernetes the service deploys by default.
3404    #[serde(rename = "defaultClusterVersion")]
3405    pub default_cluster_version: Option<String>,
3406    /// Default image type.
3407    #[serde(rename = "defaultImageType")]
3408    pub default_image_type: Option<String>,
3409    /// List of valid image types.
3410    #[serde(rename = "validImageTypes")]
3411    pub valid_image_types: Option<Vec<String>>,
3412    /// List of valid master versions, in descending order.
3413    #[serde(rename = "validMasterVersions")]
3414    pub valid_master_versions: Option<Vec<String>>,
3415    /// List of valid node upgrade target versions, in descending order.
3416    #[serde(rename = "validNodeVersions")]
3417    pub valid_node_versions: Option<Vec<String>>,
3418}
3419
3420impl common::ResponseResult for ServerConfig {}
3421
3422/// Config to block services with externalIPs field.
3423///
3424/// This type is not used in any activity, and only used as *part* of another schema.
3425///
3426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3427#[serde_with::serde_as]
3428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3429pub struct ServiceExternalIPsConfig {
3430    /// Whether Services with ExternalIPs field are allowed or not.
3431    pub enabled: Option<bool>,
3432}
3433
3434impl common::Part for ServiceExternalIPsConfig {}
3435
3436/// SetAddonsConfigRequest sets the addons associated with the cluster.
3437///
3438/// # Activities
3439///
3440/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3441/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3442///
3443/// * [locations clusters set addons projects](ProjectLocationClusterSetAddonCall) (request)
3444/// * [zones clusters addons projects](ProjectZoneClusterAddonCall) (request)
3445#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3446#[serde_with::serde_as]
3447#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3448pub struct SetAddonsConfigRequest {
3449    /// Required. The desired configurations for the various addons available to run in the cluster.
3450    #[serde(rename = "addonsConfig")]
3451    pub addons_config: Option<AddonsConfig>,
3452    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
3453    #[serde(rename = "clusterId")]
3454    pub cluster_id: Option<String>,
3455    /// The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
3456    pub name: Option<String>,
3457    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3458    #[serde(rename = "projectId")]
3459    pub project_id: Option<String>,
3460    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3461    pub zone: Option<String>,
3462}
3463
3464impl common::RequestValue for SetAddonsConfigRequest {}
3465
3466/// SetLabelsRequest sets the Google Cloud Platform labels on a Google Container Engine cluster, which will in turn set them for Google Compute Engine resources used by that cluster
3467///
3468/// # Activities
3469///
3470/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3471/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3472///
3473/// * [locations clusters set resource labels projects](ProjectLocationClusterSetResourceLabelCall) (request)
3474/// * [zones clusters resource labels projects](ProjectZoneClusterResourceLabelCall) (request)
3475#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3476#[serde_with::serde_as]
3477#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3478pub struct SetLabelsRequest {
3479    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
3480    #[serde(rename = "clusterId")]
3481    pub cluster_id: Option<String>,
3482    /// Required. The fingerprint of the previous set of labels for this resource, used to detect conflicts. The fingerprint is initially generated by Kubernetes Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash when updating or changing labels. Make a `get()` request to the resource to get the latest fingerprint.
3483    #[serde(rename = "labelFingerprint")]
3484    pub label_fingerprint: Option<String>,
3485    /// The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
3486    pub name: Option<String>,
3487    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3488    #[serde(rename = "projectId")]
3489    pub project_id: Option<String>,
3490    /// Required. The labels to set for that cluster.
3491    #[serde(rename = "resourceLabels")]
3492    pub resource_labels: Option<HashMap<String, String>>,
3493    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3494    pub zone: Option<String>,
3495}
3496
3497impl common::RequestValue for SetLabelsRequest {}
3498
3499/// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for a cluster.
3500///
3501/// # Activities
3502///
3503/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3504/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3505///
3506/// * [locations clusters set legacy abac projects](ProjectLocationClusterSetLegacyAbacCall) (request)
3507/// * [zones clusters legacy abac projects](ProjectZoneClusterLegacyAbacCall) (request)
3508#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3509#[serde_with::serde_as]
3510#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3511pub struct SetLegacyAbacRequest {
3512    /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
3513    #[serde(rename = "clusterId")]
3514    pub cluster_id: Option<String>,
3515    /// Required. Whether ABAC authorization will be enabled in the cluster.
3516    pub enabled: Option<bool>,
3517    /// The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
3518    pub name: Option<String>,
3519    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3520    #[serde(rename = "projectId")]
3521    pub project_id: Option<String>,
3522    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3523    pub zone: Option<String>,
3524}
3525
3526impl common::RequestValue for SetLegacyAbacRequest {}
3527
3528/// SetLocationsRequest sets the locations of the cluster.
3529///
3530/// # Activities
3531///
3532/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3533/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3534///
3535/// * [locations clusters set locations projects](ProjectLocationClusterSetLocationCall) (request)
3536/// * [zones clusters locations projects](ProjectZoneClusterLocationCall) (request)
3537#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3538#[serde_with::serde_as]
3539#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3540pub struct SetLocationsRequest {
3541    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
3542    #[serde(rename = "clusterId")]
3543    pub cluster_id: Option<String>,
3544    /// Required. The desired list of Google Compute Engine [zones](https://cloud.google.com/compute/docs/zones#available) in which the cluster's nodes should be located. Changing the locations a cluster is in will result in nodes being either created or removed from the cluster, depending on whether locations are being added or removed. This list must always include the cluster's primary zone.
3545    pub locations: Option<Vec<String>>,
3546    /// The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
3547    pub name: Option<String>,
3548    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3549    #[serde(rename = "projectId")]
3550    pub project_id: Option<String>,
3551    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3552    pub zone: Option<String>,
3553}
3554
3555impl common::RequestValue for SetLocationsRequest {}
3556
3557/// SetLoggingServiceRequest sets the logging service of a cluster.
3558///
3559/// # Activities
3560///
3561/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3562/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3563///
3564/// * [locations clusters set logging projects](ProjectLocationClusterSetLoggingCall) (request)
3565/// * [zones clusters logging projects](ProjectZoneClusterLoggingCall) (request)
3566#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3567#[serde_with::serde_as]
3568#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3569pub struct SetLoggingServiceRequest {
3570    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
3571    #[serde(rename = "clusterId")]
3572    pub cluster_id: Option<String>,
3573    /// Required. The logging service the cluster should use to write logs. Currently available options: * `logging.googleapis.com/kubernetes` - The Cloud Logging service with a Kubernetes-native resource model * `logging.googleapis.com` - The legacy Cloud Logging service (no longer available as of GKE 1.15). * `none` - no logs will be exported from the cluster. If left as an empty string,`logging.googleapis.com/kubernetes` will be used for GKE 1.14+ or `logging.googleapis.com` for earlier versions.
3574    #[serde(rename = "loggingService")]
3575    pub logging_service: Option<String>,
3576    /// The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
3577    pub name: Option<String>,
3578    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3579    #[serde(rename = "projectId")]
3580    pub project_id: Option<String>,
3581    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3582    pub zone: Option<String>,
3583}
3584
3585impl common::RequestValue for SetLoggingServiceRequest {}
3586
3587/// SetMaintenancePolicyRequest sets the maintenance policy for a cluster.
3588///
3589/// # Activities
3590///
3591/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3592/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3593///
3594/// * [locations clusters set maintenance policy projects](ProjectLocationClusterSetMaintenancePolicyCall) (request)
3595/// * [zones clusters set maintenance policy projects](ProjectZoneClusterSetMaintenancePolicyCall) (request)
3596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3597#[serde_with::serde_as]
3598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3599pub struct SetMaintenancePolicyRequest {
3600    /// Required. The name of the cluster to update.
3601    #[serde(rename = "clusterId")]
3602    pub cluster_id: Option<String>,
3603    /// Required. The maintenance policy to be set for the cluster. An empty field clears the existing maintenance policy.
3604    #[serde(rename = "maintenancePolicy")]
3605    pub maintenance_policy: Option<MaintenancePolicy>,
3606    /// The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
3607    pub name: Option<String>,
3608    /// Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
3609    #[serde(rename = "projectId")]
3610    pub project_id: Option<String>,
3611    /// Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
3612    pub zone: Option<String>,
3613}
3614
3615impl common::RequestValue for SetMaintenancePolicyRequest {}
3616
3617/// SetMasterAuthRequest updates the admin password of a cluster.
3618///
3619/// # Activities
3620///
3621/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3622/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3623///
3624/// * [locations clusters set master auth projects](ProjectLocationClusterSetMasterAuthCall) (request)
3625/// * [zones clusters set master auth projects](ProjectZoneClusterSetMasterAuthCall) (request)
3626#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3627#[serde_with::serde_as]
3628#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3629pub struct SetMasterAuthRequest {
3630    /// Required. The exact form of action to be taken on the master auth.
3631    pub action: Option<String>,
3632    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
3633    #[serde(rename = "clusterId")]
3634    pub cluster_id: Option<String>,
3635    /// The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
3636    pub name: Option<String>,
3637    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3638    #[serde(rename = "projectId")]
3639    pub project_id: Option<String>,
3640    /// Required. A description of the update.
3641    pub update: Option<MasterAuth>,
3642    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3643    pub zone: Option<String>,
3644}
3645
3646impl common::RequestValue for SetMasterAuthRequest {}
3647
3648/// SetMonitoringServiceRequest sets the monitoring service of a cluster.
3649///
3650/// # Activities
3651///
3652/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3653/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3654///
3655/// * [locations clusters set monitoring projects](ProjectLocationClusterSetMonitoringCall) (request)
3656/// * [zones clusters monitoring projects](ProjectZoneClusterMonitoringCall) (request)
3657#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3658#[serde_with::serde_as]
3659#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3660pub struct SetMonitoringServiceRequest {
3661    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
3662    #[serde(rename = "clusterId")]
3663    pub cluster_id: Option<String>,
3664    /// Required. The monitoring service the cluster should use to write metrics. Currently available options: * "monitoring.googleapis.com/kubernetes" - The Cloud Monitoring service with a Kubernetes-native resource model * `monitoring.googleapis.com` - The legacy Cloud Monitoring service (no longer available as of GKE 1.15). * `none` - No metrics will be exported from the cluster. If left as an empty string,`monitoring.googleapis.com/kubernetes` will be used for GKE 1.14+ or `monitoring.googleapis.com` for earlier versions.
3665    #[serde(rename = "monitoringService")]
3666    pub monitoring_service: Option<String>,
3667    /// The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
3668    pub name: Option<String>,
3669    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3670    #[serde(rename = "projectId")]
3671    pub project_id: Option<String>,
3672    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3673    pub zone: Option<String>,
3674}
3675
3676impl common::RequestValue for SetMonitoringServiceRequest {}
3677
3678/// SetNetworkPolicyRequest enables/disables network policy for a cluster.
3679///
3680/// # Activities
3681///
3682/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3683/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3684///
3685/// * [locations clusters set network policy projects](ProjectLocationClusterSetNetworkPolicyCall) (request)
3686/// * [zones clusters set network policy projects](ProjectZoneClusterSetNetworkPolicyCall) (request)
3687#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3688#[serde_with::serde_as]
3689#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3690pub struct SetNetworkPolicyRequest {
3691    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
3692    #[serde(rename = "clusterId")]
3693    pub cluster_id: Option<String>,
3694    /// The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
3695    pub name: Option<String>,
3696    /// Required. Configuration options for the NetworkPolicy feature.
3697    #[serde(rename = "networkPolicy")]
3698    pub network_policy: Option<NetworkPolicy>,
3699    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3700    #[serde(rename = "projectId")]
3701    pub project_id: Option<String>,
3702    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3703    pub zone: Option<String>,
3704}
3705
3706impl common::RequestValue for SetNetworkPolicyRequest {}
3707
3708/// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool.
3709///
3710/// # Activities
3711///
3712/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3713/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3714///
3715/// * [locations clusters node pools set autoscaling projects](ProjectLocationClusterNodePoolSetAutoscalingCall) (request)
3716/// * [zones clusters node pools autoscaling projects](ProjectZoneClusterNodePoolAutoscalingCall) (request)
3717#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3718#[serde_with::serde_as]
3719#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3720pub struct SetNodePoolAutoscalingRequest {
3721    /// Required. Autoscaling configuration for the node pool.
3722    pub autoscaling: Option<NodePoolAutoscaling>,
3723    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
3724    #[serde(rename = "clusterId")]
3725    pub cluster_id: Option<String>,
3726    /// The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
3727    pub name: Option<String>,
3728    /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
3729    #[serde(rename = "nodePoolId")]
3730    pub node_pool_id: Option<String>,
3731    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3732    #[serde(rename = "projectId")]
3733    pub project_id: Option<String>,
3734    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3735    pub zone: Option<String>,
3736}
3737
3738impl common::RequestValue for SetNodePoolAutoscalingRequest {}
3739
3740/// SetNodePoolManagementRequest sets the node management properties of a node pool.
3741///
3742/// # Activities
3743///
3744/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3745/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3746///
3747/// * [locations clusters node pools set management projects](ProjectLocationClusterNodePoolSetManagementCall) (request)
3748/// * [zones clusters node pools set management projects](ProjectZoneClusterNodePoolSetManagementCall) (request)
3749#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3750#[serde_with::serde_as]
3751#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3752pub struct SetNodePoolManagementRequest {
3753    /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
3754    #[serde(rename = "clusterId")]
3755    pub cluster_id: Option<String>,
3756    /// Required. NodeManagement configuration for the node pool.
3757    pub management: Option<NodeManagement>,
3758    /// The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
3759    pub name: Option<String>,
3760    /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
3761    #[serde(rename = "nodePoolId")]
3762    pub node_pool_id: Option<String>,
3763    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3764    #[serde(rename = "projectId")]
3765    pub project_id: Option<String>,
3766    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3767    pub zone: Option<String>,
3768}
3769
3770impl common::RequestValue for SetNodePoolManagementRequest {}
3771
3772/// SetNodePoolSizeRequest sets the size of a node pool.
3773///
3774/// # Activities
3775///
3776/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3777/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3778///
3779/// * [locations clusters node pools set size projects](ProjectLocationClusterNodePoolSetSizeCall) (request)
3780/// * [zones clusters node pools set size projects](ProjectZoneClusterNodePoolSetSizeCall) (request)
3781#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3782#[serde_with::serde_as]
3783#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3784pub struct SetNodePoolSizeRequest {
3785    /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
3786    #[serde(rename = "clusterId")]
3787    pub cluster_id: Option<String>,
3788    /// The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
3789    pub name: Option<String>,
3790    /// Required. The desired node count for the pool.
3791    #[serde(rename = "nodeCount")]
3792    pub node_count: Option<i32>,
3793    /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
3794    #[serde(rename = "nodePoolId")]
3795    pub node_pool_id: Option<String>,
3796    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3797    #[serde(rename = "projectId")]
3798    pub project_id: Option<String>,
3799    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3800    pub zone: Option<String>,
3801}
3802
3803impl common::RequestValue for SetNodePoolSizeRequest {}
3804
3805/// A set of Shielded Instance options.
3806///
3807/// This type is not used in any activity, and only used as *part* of another schema.
3808///
3809#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3810#[serde_with::serde_as]
3811#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3812pub struct ShieldedInstanceConfig {
3813    /// Defines whether the instance has integrity monitoring enabled. Enables monitoring and attestation of the boot integrity of the instance. The attestation is performed against the integrity policy baseline. This baseline is initially derived from the implicitly trusted boot image when the instance is created.
3814    #[serde(rename = "enableIntegrityMonitoring")]
3815    pub enable_integrity_monitoring: Option<bool>,
3816    /// Defines whether the instance has Secure Boot enabled. Secure Boot helps ensure that the system only runs authentic software by verifying the digital signature of all boot components, and halting the boot process if signature verification fails.
3817    #[serde(rename = "enableSecureBoot")]
3818    pub enable_secure_boot: Option<bool>,
3819}
3820
3821impl common::Part for ShieldedInstanceConfig {}
3822
3823/// Configuration of Shielded Nodes feature.
3824///
3825/// This type is not used in any activity, and only used as *part* of another schema.
3826///
3827#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3828#[serde_with::serde_as]
3829#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3830pub struct ShieldedNodes {
3831    /// Whether Shielded Nodes features are enabled on all nodes in this cluster.
3832    pub enabled: Option<bool>,
3833}
3834
3835impl common::Part for ShieldedNodes {}
3836
3837/// SoleTenantConfig contains the NodeAffinities to specify what shared sole tenant node groups should back the node pool.
3838///
3839/// This type is not used in any activity, and only used as *part* of another schema.
3840///
3841#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3842#[serde_with::serde_as]
3843#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3844pub struct SoleTenantConfig {
3845    /// NodeAffinities used to match to a shared sole tenant node group.
3846    #[serde(rename = "nodeAffinities")]
3847    pub node_affinities: Option<Vec<NodeAffinity>>,
3848}
3849
3850impl common::Part for SoleTenantConfig {}
3851
3852/// Standard rollout policy is the default policy for blue-green.
3853///
3854/// This type is not used in any activity, and only used as *part* of another schema.
3855///
3856#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3857#[serde_with::serde_as]
3858#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3859pub struct StandardRolloutPolicy {
3860    /// Number of blue nodes to drain in a batch.
3861    #[serde(rename = "batchNodeCount")]
3862    pub batch_node_count: Option<i32>,
3863    /// Percentage of the blue pool nodes to drain in a batch. The range of this field should be (0.0, 1.0].
3864    #[serde(rename = "batchPercentage")]
3865    pub batch_percentage: Option<f32>,
3866    /// Soak time after each batch gets drained. Default to zero.
3867    #[serde(rename = "batchSoakDuration")]
3868    #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
3869    pub batch_soak_duration: Option<chrono::Duration>,
3870}
3871
3872impl common::Part for StandardRolloutPolicy {}
3873
3874/// StartIPRotationRequest creates a new IP for the cluster and then performs a node upgrade on each node pool to point to the new IP.
3875///
3876/// # Activities
3877///
3878/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3879/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3880///
3881/// * [locations clusters start ip rotation projects](ProjectLocationClusterStartIpRotationCall) (request)
3882/// * [zones clusters start ip rotation projects](ProjectZoneClusterStartIpRotationCall) (request)
3883#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3884#[serde_with::serde_as]
3885#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3886pub struct StartIPRotationRequest {
3887    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
3888    #[serde(rename = "clusterId")]
3889    pub cluster_id: Option<String>,
3890    /// The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
3891    pub name: Option<String>,
3892    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3893    #[serde(rename = "projectId")]
3894    pub project_id: Option<String>,
3895    /// Whether to rotate credentials during IP rotation.
3896    #[serde(rename = "rotateCredentials")]
3897    pub rotate_credentials: Option<bool>,
3898    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
3899    pub zone: Option<String>,
3900}
3901
3902impl common::RequestValue for StartIPRotationRequest {}
3903
3904/// Configuration for the Stateful HA add-on.
3905///
3906/// This type is not used in any activity, and only used as *part* of another schema.
3907///
3908#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3909#[serde_with::serde_as]
3910#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3911pub struct StatefulHAConfig {
3912    /// Whether the Stateful HA add-on is enabled for this cluster.
3913    pub enabled: Option<bool>,
3914}
3915
3916impl common::Part for StatefulHAConfig {}
3917
3918/// 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).
3919///
3920/// This type is not used in any activity, and only used as *part* of another schema.
3921///
3922#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3923#[serde_with::serde_as]
3924#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3925pub struct Status {
3926    /// The status code, which should be an enum value of google.rpc.Code.
3927    pub code: Option<i32>,
3928    /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
3929    pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
3930    /// 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.
3931    pub message: Option<String>,
3932}
3933
3934impl common::Part for Status {}
3935
3936/// StatusCondition describes why a cluster or a node pool has a certain status (e.g., ERROR or DEGRADED).
3937///
3938/// This type is not used in any activity, and only used as *part* of another schema.
3939///
3940#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3941#[serde_with::serde_as]
3942#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3943pub struct StatusCondition {
3944    /// Canonical code of the condition.
3945    #[serde(rename = "canonicalCode")]
3946    pub canonical_code: Option<String>,
3947    /// Machine-friendly representation of the condition Deprecated. Use canonical_code instead.
3948    pub code: Option<String>,
3949    /// Human-friendly representation of the condition
3950    pub message: Option<String>,
3951}
3952
3953impl common::Part for StatusCondition {}
3954
3955/// Represents an arbitrary window of time.
3956///
3957/// This type is not used in any activity, and only used as *part* of another schema.
3958///
3959#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3960#[serde_with::serde_as]
3961#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3962pub struct TimeWindow {
3963    /// The time that the window ends. The end time should take place after the start time.
3964    #[serde(rename = "endTime")]
3965    pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3966    /// MaintenanceExclusionOptions provides maintenance exclusion related options.
3967    #[serde(rename = "maintenanceExclusionOptions")]
3968    pub maintenance_exclusion_options: Option<MaintenanceExclusionOptions>,
3969    /// The time that the window first starts.
3970    #[serde(rename = "startTime")]
3971    pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
3972}
3973
3974impl common::Part for TimeWindow {}
3975
3976/// UpdateClusterRequest updates the settings of a cluster.
3977///
3978/// # Activities
3979///
3980/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3981/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3982///
3983/// * [locations clusters update projects](ProjectLocationClusterUpdateCall) (request)
3984/// * [zones clusters update projects](ProjectZoneClusterUpdateCall) (request)
3985#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3986#[serde_with::serde_as]
3987#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3988pub struct UpdateClusterRequest {
3989    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
3990    #[serde(rename = "clusterId")]
3991    pub cluster_id: Option<String>,
3992    /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
3993    pub name: Option<String>,
3994    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
3995    #[serde(rename = "projectId")]
3996    pub project_id: Option<String>,
3997    /// Required. A description of the update.
3998    pub update: Option<ClusterUpdate>,
3999    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
4000    pub zone: Option<String>,
4001}
4002
4003impl common::RequestValue for UpdateClusterRequest {}
4004
4005/// UpdateInfo contains resource (instance groups, etc), status and other intermediate information relevant to a node pool upgrade.
4006///
4007/// This type is not used in any activity, and only used as *part* of another schema.
4008///
4009#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4010#[serde_with::serde_as]
4011#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4012pub struct UpdateInfo {
4013    /// Information of a blue-green upgrade.
4014    #[serde(rename = "blueGreenInfo")]
4015    pub blue_green_info: Option<BlueGreenInfo>,
4016}
4017
4018impl common::Part for UpdateInfo {}
4019
4020/// UpdateMasterRequest updates the master of the cluster.
4021///
4022/// # Activities
4023///
4024/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4025/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4026///
4027/// * [locations clusters update master projects](ProjectLocationClusterUpdateMasterCall) (request)
4028/// * [zones clusters master projects](ProjectZoneClusterMasterCall) (request)
4029#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4030#[serde_with::serde_as]
4031#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4032pub struct UpdateMasterRequest {
4033    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4034    #[serde(rename = "clusterId")]
4035    pub cluster_id: Option<String>,
4036    /// Required. The Kubernetes version to change the master to. Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior: - "latest": picks the highest valid Kubernetes version - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - "1.X.Y-gke.N": picks an explicit Kubernetes version - "-": picks the default Kubernetes version
4037    #[serde(rename = "masterVersion")]
4038    pub master_version: Option<String>,
4039    /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
4040    pub name: Option<String>,
4041    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
4042    #[serde(rename = "projectId")]
4043    pub project_id: Option<String>,
4044    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
4045    pub zone: Option<String>,
4046}
4047
4048impl common::RequestValue for UpdateMasterRequest {}
4049
4050/// UpdateNodePoolRequests update a node pool’s image and/or version.
4051///
4052/// # Activities
4053///
4054/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4055/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4056///
4057/// * [locations clusters node pools update projects](ProjectLocationClusterNodePoolUpdateCall) (request)
4058/// * [zones clusters node pools update projects](ProjectZoneClusterNodePoolUpdateCall) (request)
4059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4060#[serde_with::serde_as]
4061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4062pub struct UpdateNodePoolRequest {
4063    /// A list of hardware accelerators to be attached to each node. See https://cloud.google.com/compute/docs/gpus for more information about support for GPUs.
4064    pub accelerators: Option<Vec<AcceleratorConfig>>,
4065    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4066    #[serde(rename = "clusterId")]
4067    pub cluster_id: Option<String>,
4068    /// Confidential nodes config. All the nodes in the node pool will be Confidential VM once enabled.
4069    #[serde(rename = "confidentialNodes")]
4070    pub confidential_nodes: Option<ConfidentialNodes>,
4071    /// The desired containerd config for nodes in the node pool. Initiates an upgrade operation that recreates the nodes with the new config.
4072    #[serde(rename = "containerdConfig")]
4073    pub containerd_config: Option<ContainerdConfig>,
4074    /// Optional. The desired disk size for nodes in the node pool specified in GB. The smallest allowed disk size is 10GB. Initiates an upgrade operation that migrates the nodes in the node pool to the specified disk size.
4075    #[serde(rename = "diskSizeGb")]
4076    #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4077    pub disk_size_gb: Option<i64>,
4078    /// Optional. The desired disk type (e.g. 'pd-standard', 'pd-ssd' or 'pd-balanced') for nodes in the node pool. Initiates an upgrade operation that migrates the nodes in the node pool to the specified disk type.
4079    #[serde(rename = "diskType")]
4080    pub disk_type: Option<String>,
4081    /// The current etag of the node pool. If an etag is provided and does not match the current etag of the node pool, update will be blocked and an ABORTED error will be returned.
4082    pub etag: Option<String>,
4083    /// Enable or disable NCCL fast socket for the node pool.
4084    #[serde(rename = "fastSocket")]
4085    pub fast_socket: Option<FastSocket>,
4086    /// GCFS config.
4087    #[serde(rename = "gcfsConfig")]
4088    pub gcfs_config: Option<GcfsConfig>,
4089    /// Enable or disable gvnic on the node pool.
4090    pub gvnic: Option<VirtualNIC>,
4091    /// Required. The desired image type for the node pool. Please see https://cloud.google.com/kubernetes-engine/docs/concepts/node-images for available image types.
4092    #[serde(rename = "imageType")]
4093    pub image_type: Option<String>,
4094    /// Node kubelet configs.
4095    #[serde(rename = "kubeletConfig")]
4096    pub kubelet_config: Option<NodeKubeletConfig>,
4097    /// The desired node labels to be applied to all nodes in the node pool. If this field is not present, the labels will not be changed. Otherwise, the existing node labels will be *replaced* with the provided labels.
4098    pub labels: Option<NodeLabels>,
4099    /// Parameters that can be configured on Linux nodes.
4100    #[serde(rename = "linuxNodeConfig")]
4101    pub linux_node_config: Option<LinuxNodeConfig>,
4102    /// The desired list of Google Compute Engine [zones](https://cloud.google.com/compute/docs/zones#available) in which the node pool's nodes should be located. Changing the locations for a node pool will result in nodes being either created or removed from the node pool, depending on whether locations are being added or removed.
4103    pub locations: Option<Vec<String>>,
4104    /// Logging configuration.
4105    #[serde(rename = "loggingConfig")]
4106    pub logging_config: Option<NodePoolLoggingConfig>,
4107    /// Optional. The desired [Google Compute Engine machine type](https://cloud.google.com/compute/docs/machine-types) for nodes in the node pool. Initiates an upgrade operation that migrates the nodes in the node pool to the specified machine type.
4108    #[serde(rename = "machineType")]
4109    pub machine_type: Option<String>,
4110    /// The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4111    pub name: Option<String>,
4112    /// Node network config.
4113    #[serde(rename = "nodeNetworkConfig")]
4114    pub node_network_config: Option<NodeNetworkConfig>,
4115    /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
4116    #[serde(rename = "nodePoolId")]
4117    pub node_pool_id: Option<String>,
4118    /// Required. The Kubernetes version to change the nodes to (typically an upgrade). Users may specify either explicit versions offered by Kubernetes Engine or version aliases, which have the following behavior: - "latest": picks the highest valid Kubernetes version - "1.X": picks the highest valid patch+gke.N patch in the 1.X version - "1.X.Y": picks the highest valid gke.N patch in the 1.X.Y version - "1.X.Y-gke.N": picks an explicit Kubernetes version - "-": picks the Kubernetes master version
4119    #[serde(rename = "nodeVersion")]
4120    pub node_version: Option<String>,
4121    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
4122    #[serde(rename = "projectId")]
4123    pub project_id: Option<String>,
4124    /// Specifies the configuration of queued provisioning.
4125    #[serde(rename = "queuedProvisioning")]
4126    pub queued_provisioning: Option<QueuedProvisioning>,
4127    /// The resource labels for the node pool to use to annotate any related Google Compute Engine resources.
4128    #[serde(rename = "resourceLabels")]
4129    pub resource_labels: Option<ResourceLabels>,
4130    /// Desired resource manager tag keys and values to be attached to the nodes for managing Compute Engine firewalls using Network Firewall Policies. Existing tags will be replaced with new values.
4131    #[serde(rename = "resourceManagerTags")]
4132    pub resource_manager_tags: Option<ResourceManagerTags>,
4133    /// The desired network tags to be applied to all nodes in the node pool. If this field is not present, the tags will not be changed. Otherwise, the existing network tags will be *replaced* with the provided tags.
4134    pub tags: Option<NetworkTags>,
4135    /// The desired node taints to be applied to all nodes in the node pool. If this field is not present, the taints will not be changed. Otherwise, the existing node taints will be *replaced* with the provided taints.
4136    pub taints: Option<NodeTaints>,
4137    /// Upgrade settings control disruption and speed of the upgrade.
4138    #[serde(rename = "upgradeSettings")]
4139    pub upgrade_settings: Option<UpgradeSettings>,
4140    /// Parameters that can be configured on Windows nodes.
4141    #[serde(rename = "windowsNodeConfig")]
4142    pub windows_node_config: Option<WindowsNodeConfig>,
4143    /// The desired workload metadata config for the node pool.
4144    #[serde(rename = "workloadMetadataConfig")]
4145    pub workload_metadata_config: Option<WorkloadMetadataConfig>,
4146    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
4147    pub zone: Option<String>,
4148}
4149
4150impl common::RequestValue for UpdateNodePoolRequest {}
4151
4152/// These upgrade settings control the level of parallelism and the level of disruption caused by an upgrade. maxUnavailable controls the number of nodes that can be simultaneously unavailable. maxSurge controls the number of additional nodes that can be added to the node pool temporarily for the time of the upgrade to increase the number of available nodes. (maxUnavailable + maxSurge) determines the level of parallelism (how many nodes are being upgraded at the same time). Note: upgrades inevitably introduce some disruption since workloads need to be moved from old nodes to new, upgraded ones. Even if maxUnavailable=0, this holds true. (Disruption stays within the limits of PodDisruptionBudget, if it is configured.) Consider a hypothetical node pool with 5 nodes having maxSurge=2, maxUnavailable=1. This means the upgrade process upgrades 3 nodes simultaneously. It creates 2 additional (upgraded) nodes, then it brings down 3 old (not yet upgraded) nodes at the same time. This ensures that there are always at least 4 nodes available. These upgrade settings configure the upgrade strategy for the node pool. Use strategy to switch between the strategies applied to the node pool. If the strategy is ROLLING, use max_surge and max_unavailable to control the level of parallelism and the level of disruption caused by upgrade. 1. maxSurge controls the number of additional nodes that can be added to the node pool temporarily for the time of the upgrade to increase the number of available nodes. 2. maxUnavailable controls the number of nodes that can be simultaneously unavailable. 3. (maxUnavailable + maxSurge) determines the level of parallelism (how many nodes are being upgraded at the same time). If the strategy is BLUE_GREEN, use blue_green_settings to configure the blue-green upgrade related settings. 1. standard_rollout_policy is the default policy. The policy is used to control the way blue pool gets drained. The draining is executed in the batch mode. The batch size could be specified as either percentage of the node pool size or the number of nodes. batch_soak_duration is the soak time after each batch gets drained. 2. node_pool_soak_duration is the soak time after all blue nodes are drained. After this period, the blue pool nodes will be deleted.
4153///
4154/// This type is not used in any activity, and only used as *part* of another schema.
4155///
4156#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4157#[serde_with::serde_as]
4158#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4159pub struct UpgradeSettings {
4160    /// Settings for blue-green upgrade strategy.
4161    #[serde(rename = "blueGreenSettings")]
4162    pub blue_green_settings: Option<BlueGreenSettings>,
4163    /// The maximum number of nodes that can be created beyond the current size of the node pool during the upgrade process.
4164    #[serde(rename = "maxSurge")]
4165    pub max_surge: Option<i32>,
4166    /// The maximum number of nodes that can be simultaneously unavailable during the upgrade process. A node is considered available if its status is Ready.
4167    #[serde(rename = "maxUnavailable")]
4168    pub max_unavailable: Option<i32>,
4169    /// Update strategy of the node pool.
4170    pub strategy: Option<String>,
4171}
4172
4173impl common::Part for UpgradeSettings {}
4174
4175/// UsableSubnetwork resource returns the subnetwork name, its associated network and the primary CIDR range.
4176///
4177/// This type is not used in any activity, and only used as *part* of another schema.
4178///
4179#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4180#[serde_with::serde_as]
4181#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4182pub struct UsableSubnetwork {
4183    /// The range of internal addresses that are owned by this subnetwork.
4184    #[serde(rename = "ipCidrRange")]
4185    pub ip_cidr_range: Option<String>,
4186    /// Network Name. Example: projects/my-project/global/networks/my-network
4187    pub network: Option<String>,
4188    /// Secondary IP ranges.
4189    #[serde(rename = "secondaryIpRanges")]
4190    pub secondary_ip_ranges: Option<Vec<UsableSubnetworkSecondaryRange>>,
4191    /// A human readable status message representing the reasons for cases where the caller cannot use the secondary ranges under the subnet. For example if the secondary_ip_ranges is empty due to a permission issue, an insufficient permission message will be given by status_message.
4192    #[serde(rename = "statusMessage")]
4193    pub status_message: Option<String>,
4194    /// Subnetwork Name. Example: projects/my-project/regions/us-central1/subnetworks/my-subnet
4195    pub subnetwork: Option<String>,
4196}
4197
4198impl common::Part for UsableSubnetwork {}
4199
4200/// Secondary IP range of a usable subnetwork.
4201///
4202/// This type is not used in any activity, and only used as *part* of another schema.
4203///
4204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4205#[serde_with::serde_as]
4206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4207pub struct UsableSubnetworkSecondaryRange {
4208    /// The range of IP addresses belonging to this subnetwork secondary range.
4209    #[serde(rename = "ipCidrRange")]
4210    pub ip_cidr_range: Option<String>,
4211    /// The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.
4212    #[serde(rename = "rangeName")]
4213    pub range_name: Option<String>,
4214    /// This field is to determine the status of the secondary range programmably.
4215    pub status: Option<String>,
4216}
4217
4218impl common::Part for UsableSubnetworkSecondaryRange {}
4219
4220/// VerticalPodAutoscaling contains global, per-cluster information required by Vertical Pod Autoscaler to automatically adjust the resources of pods controlled by it.
4221///
4222/// This type is not used in any activity, and only used as *part* of another schema.
4223///
4224#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4225#[serde_with::serde_as]
4226#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4227pub struct VerticalPodAutoscaling {
4228    /// Enables vertical pod autoscaling.
4229    pub enabled: Option<bool>,
4230}
4231
4232impl common::Part for VerticalPodAutoscaling {}
4233
4234/// Configuration of gVNIC feature.
4235///
4236/// This type is not used in any activity, and only used as *part* of another schema.
4237///
4238#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4239#[serde_with::serde_as]
4240#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4241pub struct VirtualNIC {
4242    /// Whether gVNIC features are enabled in the node pool.
4243    pub enabled: Option<bool>,
4244}
4245
4246impl common::Part for VirtualNIC {}
4247
4248/// Parameters that can be configured on Windows nodes. Windows Node Config that define the parameters that will be used to configure the Windows node pool settings
4249///
4250/// This type is not used in any activity, and only used as *part* of another schema.
4251///
4252#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4253#[serde_with::serde_as]
4254#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4255pub struct WindowsNodeConfig {
4256    /// OSVersion specifies the Windows node config to be used on the node
4257    #[serde(rename = "osVersion")]
4258    pub os_version: Option<String>,
4259}
4260
4261impl common::Part for WindowsNodeConfig {}
4262
4263/// Configuration for the use of Kubernetes Service Accounts in GCP IAM policies.
4264///
4265/// This type is not used in any activity, and only used as *part* of another schema.
4266///
4267#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4268#[serde_with::serde_as]
4269#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4270pub struct WorkloadIdentityConfig {
4271    /// The workload pool to attach all Kubernetes service accounts to.
4272    #[serde(rename = "workloadPool")]
4273    pub workload_pool: Option<String>,
4274}
4275
4276impl common::Part for WorkloadIdentityConfig {}
4277
4278/// WorkloadMetadataConfig defines the metadata configuration to expose to workloads on the node pool.
4279///
4280/// This type is not used in any activity, and only used as *part* of another schema.
4281///
4282#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4283#[serde_with::serde_as]
4284#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4285pub struct WorkloadMetadataConfig {
4286    /// Mode is the configuration for how to expose metadata to workloads running on the node pool.
4287    pub mode: Option<String>,
4288}
4289
4290impl common::Part for WorkloadMetadataConfig {}
4291
4292/// WorkloadPolicyConfig is the configuration of workload policy for autopilot clusters.
4293///
4294/// This type is not used in any activity, and only used as *part* of another schema.
4295///
4296#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4297#[serde_with::serde_as]
4298#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4299pub struct WorkloadPolicyConfig {
4300    /// If true, workloads can use NET_ADMIN capability.
4301    #[serde(rename = "allowNetAdmin")]
4302    pub allow_net_admin: Option<bool>,
4303}
4304
4305impl common::Part for WorkloadPolicyConfig {}
4306
4307// ###################
4308// MethodBuilders ###
4309// #################
4310
4311/// A builder providing access to all methods supported on *project* resources.
4312/// It is not used directly, but through the [`Container`] hub.
4313///
4314/// # Example
4315///
4316/// Instantiate a resource builder
4317///
4318/// ```test_harness,no_run
4319/// extern crate hyper;
4320/// extern crate hyper_rustls;
4321/// extern crate google_container1 as container1;
4322///
4323/// # async fn dox() {
4324/// use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
4325///
4326/// let secret: yup_oauth2::ApplicationSecret = Default::default();
4327/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
4328///     secret,
4329///     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
4330/// ).build().await.unwrap();
4331///
4332/// let client = hyper_util::client::legacy::Client::builder(
4333///     hyper_util::rt::TokioExecutor::new()
4334/// )
4335/// .build(
4336///     hyper_rustls::HttpsConnectorBuilder::new()
4337///         .with_native_roots()
4338///         .unwrap()
4339///         .https_or_http()
4340///         .enable_http1()
4341///         .build()
4342/// );
4343/// let mut hub = Container::new(client, auth);
4344/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
4345/// // like `aggregated_usable_subnetworks_list(...)`, `locations_clusters_check_autopilot_compatibility(...)`, `locations_clusters_complete_ip_rotation(...)`, `locations_clusters_create(...)`, `locations_clusters_delete(...)`, `locations_clusters_get(...)`, `locations_clusters_get_jwks(...)`, `locations_clusters_list(...)`, `locations_clusters_node_pools_complete_upgrade(...)`, `locations_clusters_node_pools_create(...)`, `locations_clusters_node_pools_delete(...)`, `locations_clusters_node_pools_get(...)`, `locations_clusters_node_pools_list(...)`, `locations_clusters_node_pools_rollback(...)`, `locations_clusters_node_pools_set_autoscaling(...)`, `locations_clusters_node_pools_set_management(...)`, `locations_clusters_node_pools_set_size(...)`, `locations_clusters_node_pools_update(...)`, `locations_clusters_set_addons(...)`, `locations_clusters_set_legacy_abac(...)`, `locations_clusters_set_locations(...)`, `locations_clusters_set_logging(...)`, `locations_clusters_set_maintenance_policy(...)`, `locations_clusters_set_master_auth(...)`, `locations_clusters_set_monitoring(...)`, `locations_clusters_set_network_policy(...)`, `locations_clusters_set_resource_labels(...)`, `locations_clusters_start_ip_rotation(...)`, `locations_clusters_update(...)`, `locations_clusters_update_master(...)`, `locations_clusters_well_known_get_openid_configuration(...)`, `locations_get_server_config(...)`, `locations_operations_cancel(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `zones_clusters_addons(...)`, `zones_clusters_complete_ip_rotation(...)`, `zones_clusters_create(...)`, `zones_clusters_delete(...)`, `zones_clusters_get(...)`, `zones_clusters_legacy_abac(...)`, `zones_clusters_list(...)`, `zones_clusters_locations(...)`, `zones_clusters_logging(...)`, `zones_clusters_master(...)`, `zones_clusters_monitoring(...)`, `zones_clusters_node_pools_autoscaling(...)`, `zones_clusters_node_pools_create(...)`, `zones_clusters_node_pools_delete(...)`, `zones_clusters_node_pools_get(...)`, `zones_clusters_node_pools_list(...)`, `zones_clusters_node_pools_rollback(...)`, `zones_clusters_node_pools_set_management(...)`, `zones_clusters_node_pools_set_size(...)`, `zones_clusters_node_pools_update(...)`, `zones_clusters_resource_labels(...)`, `zones_clusters_set_maintenance_policy(...)`, `zones_clusters_set_master_auth(...)`, `zones_clusters_set_network_policy(...)`, `zones_clusters_start_ip_rotation(...)`, `zones_clusters_update(...)`, `zones_get_serverconfig(...)`, `zones_operations_cancel(...)`, `zones_operations_get(...)` and `zones_operations_list(...)`
4346/// // to build up your call.
4347/// let rb = hub.projects();
4348/// # }
4349/// ```
4350pub struct ProjectMethods<'a, C>
4351where
4352    C: 'a,
4353{
4354    hub: &'a Container<C>,
4355}
4356
4357impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
4358
4359impl<'a, C> ProjectMethods<'a, C> {
4360    /// Create a builder to help you perform the following task:
4361    ///
4362    /// Lists subnetworks that are usable for creating clusters in a project.
4363    ///
4364    /// # Arguments
4365    ///
4366    /// * `parent` - The parent project where subnetworks are usable. Specified in the format `projects/*`.
4367    pub fn aggregated_usable_subnetworks_list(
4368        &self,
4369        parent: &str,
4370    ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
4371        ProjectAggregatedUsableSubnetworkListCall {
4372            hub: self.hub,
4373            _parent: parent.to_string(),
4374            _page_token: Default::default(),
4375            _page_size: Default::default(),
4376            _filter: Default::default(),
4377            _delegate: Default::default(),
4378            _additional_params: Default::default(),
4379            _scopes: Default::default(),
4380        }
4381    }
4382
4383    /// Create a builder to help you perform the following task:
4384    ///
4385    /// CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.
4386    ///
4387    /// # Arguments
4388    ///
4389    /// * `request` - No description provided.
4390    /// * `name` - The name (project, location, cluster, node pool id) of the node pool to complete upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4391    pub fn locations_clusters_node_pools_complete_upgrade(
4392        &self,
4393        request: CompleteNodePoolUpgradeRequest,
4394        name: &str,
4395    ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
4396        ProjectLocationClusterNodePoolCompleteUpgradeCall {
4397            hub: self.hub,
4398            _request: request,
4399            _name: name.to_string(),
4400            _delegate: Default::default(),
4401            _additional_params: Default::default(),
4402            _scopes: Default::default(),
4403        }
4404    }
4405
4406    /// Create a builder to help you perform the following task:
4407    ///
4408    /// Creates a node pool for a cluster.
4409    ///
4410    /// # Arguments
4411    ///
4412    /// * `request` - No description provided.
4413    /// * `parent` - The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
4414    pub fn locations_clusters_node_pools_create(
4415        &self,
4416        request: CreateNodePoolRequest,
4417        parent: &str,
4418    ) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
4419        ProjectLocationClusterNodePoolCreateCall {
4420            hub: self.hub,
4421            _request: request,
4422            _parent: parent.to_string(),
4423            _delegate: Default::default(),
4424            _additional_params: Default::default(),
4425            _scopes: Default::default(),
4426        }
4427    }
4428
4429    /// Create a builder to help you perform the following task:
4430    ///
4431    /// Deletes a node pool from a cluster.
4432    ///
4433    /// # Arguments
4434    ///
4435    /// * `name` - The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4436    pub fn locations_clusters_node_pools_delete(
4437        &self,
4438        name: &str,
4439    ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
4440        ProjectLocationClusterNodePoolDeleteCall {
4441            hub: self.hub,
4442            _name: name.to_string(),
4443            _zone: Default::default(),
4444            _project_id: Default::default(),
4445            _node_pool_id: Default::default(),
4446            _cluster_id: Default::default(),
4447            _delegate: Default::default(),
4448            _additional_params: Default::default(),
4449            _scopes: Default::default(),
4450        }
4451    }
4452
4453    /// Create a builder to help you perform the following task:
4454    ///
4455    /// Retrieves the requested node pool.
4456    ///
4457    /// # Arguments
4458    ///
4459    /// * `name` - The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4460    pub fn locations_clusters_node_pools_get(
4461        &self,
4462        name: &str,
4463    ) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
4464        ProjectLocationClusterNodePoolGetCall {
4465            hub: self.hub,
4466            _name: name.to_string(),
4467            _zone: Default::default(),
4468            _project_id: Default::default(),
4469            _node_pool_id: Default::default(),
4470            _cluster_id: Default::default(),
4471            _delegate: Default::default(),
4472            _additional_params: Default::default(),
4473            _scopes: Default::default(),
4474        }
4475    }
4476
4477    /// Create a builder to help you perform the following task:
4478    ///
4479    /// Lists the node pools for a cluster.
4480    ///
4481    /// # Arguments
4482    ///
4483    /// * `parent` - The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
4484    pub fn locations_clusters_node_pools_list(
4485        &self,
4486        parent: &str,
4487    ) -> ProjectLocationClusterNodePoolListCall<'a, C> {
4488        ProjectLocationClusterNodePoolListCall {
4489            hub: self.hub,
4490            _parent: parent.to_string(),
4491            _zone: Default::default(),
4492            _project_id: Default::default(),
4493            _cluster_id: Default::default(),
4494            _delegate: Default::default(),
4495            _additional_params: Default::default(),
4496            _scopes: Default::default(),
4497        }
4498    }
4499
4500    /// Create a builder to help you perform the following task:
4501    ///
4502    /// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
4503    ///
4504    /// # Arguments
4505    ///
4506    /// * `request` - No description provided.
4507    /// * `name` - The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4508    pub fn locations_clusters_node_pools_rollback(
4509        &self,
4510        request: RollbackNodePoolUpgradeRequest,
4511        name: &str,
4512    ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
4513        ProjectLocationClusterNodePoolRollbackCall {
4514            hub: self.hub,
4515            _request: request,
4516            _name: name.to_string(),
4517            _delegate: Default::default(),
4518            _additional_params: Default::default(),
4519            _scopes: Default::default(),
4520        }
4521    }
4522
4523    /// Create a builder to help you perform the following task:
4524    ///
4525    /// Sets the autoscaling settings for the specified node pool.
4526    ///
4527    /// # Arguments
4528    ///
4529    /// * `request` - No description provided.
4530    /// * `name` - The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4531    pub fn locations_clusters_node_pools_set_autoscaling(
4532        &self,
4533        request: SetNodePoolAutoscalingRequest,
4534        name: &str,
4535    ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
4536        ProjectLocationClusterNodePoolSetAutoscalingCall {
4537            hub: self.hub,
4538            _request: request,
4539            _name: name.to_string(),
4540            _delegate: Default::default(),
4541            _additional_params: Default::default(),
4542            _scopes: Default::default(),
4543        }
4544    }
4545
4546    /// Create a builder to help you perform the following task:
4547    ///
4548    /// Sets the NodeManagement options for a node pool.
4549    ///
4550    /// # Arguments
4551    ///
4552    /// * `request` - No description provided.
4553    /// * `name` - The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4554    pub fn locations_clusters_node_pools_set_management(
4555        &self,
4556        request: SetNodePoolManagementRequest,
4557        name: &str,
4558    ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
4559        ProjectLocationClusterNodePoolSetManagementCall {
4560            hub: self.hub,
4561            _request: request,
4562            _name: name.to_string(),
4563            _delegate: Default::default(),
4564            _additional_params: Default::default(),
4565            _scopes: Default::default(),
4566        }
4567    }
4568
4569    /// Create a builder to help you perform the following task:
4570    ///
4571    /// Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
4572    ///
4573    /// # Arguments
4574    ///
4575    /// * `request` - No description provided.
4576    /// * `name` - The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4577    pub fn locations_clusters_node_pools_set_size(
4578        &self,
4579        request: SetNodePoolSizeRequest,
4580        name: &str,
4581    ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
4582        ProjectLocationClusterNodePoolSetSizeCall {
4583            hub: self.hub,
4584            _request: request,
4585            _name: name.to_string(),
4586            _delegate: Default::default(),
4587            _additional_params: Default::default(),
4588            _scopes: Default::default(),
4589        }
4590    }
4591
4592    /// Create a builder to help you perform the following task:
4593    ///
4594    /// Updates the version and/or image type for the specified node pool.
4595    ///
4596    /// # Arguments
4597    ///
4598    /// * `request` - No description provided.
4599    /// * `name` - The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4600    pub fn locations_clusters_node_pools_update(
4601        &self,
4602        request: UpdateNodePoolRequest,
4603        name: &str,
4604    ) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
4605        ProjectLocationClusterNodePoolUpdateCall {
4606            hub: self.hub,
4607            _request: request,
4608            _name: name.to_string(),
4609            _delegate: Default::default(),
4610            _additional_params: Default::default(),
4611            _scopes: Default::default(),
4612        }
4613    }
4614
4615    /// Create a builder to help you perform the following task:
4616    ///
4617    /// Gets the OIDC discovery document for the cluster. See the [OpenID Connect Discovery 1.0 specification](https://openid.net/specs/openid-connect-discovery-1_0.html) for details.
4618    ///
4619    /// # Arguments
4620    ///
4621    /// * `parent` - The cluster (project, location, cluster name) to get the discovery document for. Specified in the format `projects/*/locations/*/clusters/*`.
4622    pub fn locations_clusters_well_known_get_openid_configuration(
4623        &self,
4624        parent: &str,
4625    ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
4626        ProjectLocationClusterWellKnownGetOpenidConfigurationCall {
4627            hub: self.hub,
4628            _parent: parent.to_string(),
4629            _delegate: Default::default(),
4630            _additional_params: Default::default(),
4631        }
4632    }
4633
4634    /// Create a builder to help you perform the following task:
4635    ///
4636    /// Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.
4637    ///
4638    /// # Arguments
4639    ///
4640    /// * `name` - The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
4641    pub fn locations_clusters_check_autopilot_compatibility(
4642        &self,
4643        name: &str,
4644    ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
4645        ProjectLocationClusterCheckAutopilotCompatibilityCall {
4646            hub: self.hub,
4647            _name: name.to_string(),
4648            _delegate: Default::default(),
4649            _additional_params: Default::default(),
4650            _scopes: Default::default(),
4651        }
4652    }
4653
4654    /// Create a builder to help you perform the following task:
4655    ///
4656    /// Completes master IP rotation.
4657    ///
4658    /// # Arguments
4659    ///
4660    /// * `request` - No description provided.
4661    /// * `name` - The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
4662    pub fn locations_clusters_complete_ip_rotation(
4663        &self,
4664        request: CompleteIPRotationRequest,
4665        name: &str,
4666    ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
4667        ProjectLocationClusterCompleteIpRotationCall {
4668            hub: self.hub,
4669            _request: request,
4670            _name: name.to_string(),
4671            _delegate: Default::default(),
4672            _additional_params: Default::default(),
4673            _scopes: Default::default(),
4674        }
4675    }
4676
4677    /// Create a builder to help you perform the following task:
4678    ///
4679    /// Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
4680    ///
4681    /// # Arguments
4682    ///
4683    /// * `request` - No description provided.
4684    /// * `parent` - The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
4685    pub fn locations_clusters_create(
4686        &self,
4687        request: CreateClusterRequest,
4688        parent: &str,
4689    ) -> ProjectLocationClusterCreateCall<'a, C> {
4690        ProjectLocationClusterCreateCall {
4691            hub: self.hub,
4692            _request: request,
4693            _parent: parent.to_string(),
4694            _delegate: Default::default(),
4695            _additional_params: Default::default(),
4696            _scopes: Default::default(),
4697        }
4698    }
4699
4700    /// Create a builder to help you perform the following task:
4701    ///
4702    /// Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
4703    ///
4704    /// # Arguments
4705    ///
4706    /// * `name` - The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
4707    pub fn locations_clusters_delete(&self, name: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
4708        ProjectLocationClusterDeleteCall {
4709            hub: self.hub,
4710            _name: name.to_string(),
4711            _zone: Default::default(),
4712            _project_id: Default::default(),
4713            _cluster_id: Default::default(),
4714            _delegate: Default::default(),
4715            _additional_params: Default::default(),
4716            _scopes: Default::default(),
4717        }
4718    }
4719
4720    /// Create a builder to help you perform the following task:
4721    ///
4722    /// Gets the details of a specific cluster.
4723    ///
4724    /// # Arguments
4725    ///
4726    /// * `name` - The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
4727    pub fn locations_clusters_get(&self, name: &str) -> ProjectLocationClusterGetCall<'a, C> {
4728        ProjectLocationClusterGetCall {
4729            hub: self.hub,
4730            _name: name.to_string(),
4731            _zone: Default::default(),
4732            _project_id: Default::default(),
4733            _cluster_id: Default::default(),
4734            _delegate: Default::default(),
4735            _additional_params: Default::default(),
4736            _scopes: Default::default(),
4737        }
4738    }
4739
4740    /// Create a builder to help you perform the following task:
4741    ///
4742    /// Gets the public component of the cluster signing keys in JSON Web Key format.
4743    ///
4744    /// # Arguments
4745    ///
4746    /// * `parent` - The cluster (project, location, cluster name) to get keys for. Specified in the format `projects/*/locations/*/clusters/*`.
4747    pub fn locations_clusters_get_jwks(
4748        &self,
4749        parent: &str,
4750    ) -> ProjectLocationClusterGetJwkCall<'a, C> {
4751        ProjectLocationClusterGetJwkCall {
4752            hub: self.hub,
4753            _parent: parent.to_string(),
4754            _delegate: Default::default(),
4755            _additional_params: Default::default(),
4756        }
4757    }
4758
4759    /// Create a builder to help you perform the following task:
4760    ///
4761    /// Lists all clusters owned by a project in either the specified zone or all zones.
4762    ///
4763    /// # Arguments
4764    ///
4765    /// * `parent` - The parent (project and location) where the clusters will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
4766    pub fn locations_clusters_list(&self, parent: &str) -> ProjectLocationClusterListCall<'a, C> {
4767        ProjectLocationClusterListCall {
4768            hub: self.hub,
4769            _parent: parent.to_string(),
4770            _zone: Default::default(),
4771            _project_id: Default::default(),
4772            _delegate: Default::default(),
4773            _additional_params: Default::default(),
4774            _scopes: Default::default(),
4775        }
4776    }
4777
4778    /// Create a builder to help you perform the following task:
4779    ///
4780    /// Sets the addons for a specific cluster.
4781    ///
4782    /// # Arguments
4783    ///
4784    /// * `request` - No description provided.
4785    /// * `name` - The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
4786    pub fn locations_clusters_set_addons(
4787        &self,
4788        request: SetAddonsConfigRequest,
4789        name: &str,
4790    ) -> ProjectLocationClusterSetAddonCall<'a, C> {
4791        ProjectLocationClusterSetAddonCall {
4792            hub: self.hub,
4793            _request: request,
4794            _name: name.to_string(),
4795            _delegate: Default::default(),
4796            _additional_params: Default::default(),
4797            _scopes: Default::default(),
4798        }
4799    }
4800
4801    /// Create a builder to help you perform the following task:
4802    ///
4803    /// Enables or disables the ABAC authorization mechanism on a cluster.
4804    ///
4805    /// # Arguments
4806    ///
4807    /// * `request` - No description provided.
4808    /// * `name` - The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
4809    pub fn locations_clusters_set_legacy_abac(
4810        &self,
4811        request: SetLegacyAbacRequest,
4812        name: &str,
4813    ) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
4814        ProjectLocationClusterSetLegacyAbacCall {
4815            hub: self.hub,
4816            _request: request,
4817            _name: name.to_string(),
4818            _delegate: Default::default(),
4819            _additional_params: Default::default(),
4820            _scopes: Default::default(),
4821        }
4822    }
4823
4824    /// Create a builder to help you perform the following task:
4825    ///
4826    /// Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) instead.
4827    ///
4828    /// # Arguments
4829    ///
4830    /// * `request` - No description provided.
4831    /// * `name` - The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
4832    pub fn locations_clusters_set_locations(
4833        &self,
4834        request: SetLocationsRequest,
4835        name: &str,
4836    ) -> ProjectLocationClusterSetLocationCall<'a, C> {
4837        ProjectLocationClusterSetLocationCall {
4838            hub: self.hub,
4839            _request: request,
4840            _name: name.to_string(),
4841            _delegate: Default::default(),
4842            _additional_params: Default::default(),
4843            _scopes: Default::default(),
4844        }
4845    }
4846
4847    /// Create a builder to help you perform the following task:
4848    ///
4849    /// Sets the logging service for a specific cluster.
4850    ///
4851    /// # Arguments
4852    ///
4853    /// * `request` - No description provided.
4854    /// * `name` - The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
4855    pub fn locations_clusters_set_logging(
4856        &self,
4857        request: SetLoggingServiceRequest,
4858        name: &str,
4859    ) -> ProjectLocationClusterSetLoggingCall<'a, C> {
4860        ProjectLocationClusterSetLoggingCall {
4861            hub: self.hub,
4862            _request: request,
4863            _name: name.to_string(),
4864            _delegate: Default::default(),
4865            _additional_params: Default::default(),
4866            _scopes: Default::default(),
4867        }
4868    }
4869
4870    /// Create a builder to help you perform the following task:
4871    ///
4872    /// Sets the maintenance policy for a cluster.
4873    ///
4874    /// # Arguments
4875    ///
4876    /// * `request` - No description provided.
4877    /// * `name` - The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
4878    pub fn locations_clusters_set_maintenance_policy(
4879        &self,
4880        request: SetMaintenancePolicyRequest,
4881        name: &str,
4882    ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
4883        ProjectLocationClusterSetMaintenancePolicyCall {
4884            hub: self.hub,
4885            _request: request,
4886            _name: name.to_string(),
4887            _delegate: Default::default(),
4888            _additional_params: Default::default(),
4889            _scopes: Default::default(),
4890        }
4891    }
4892
4893    /// Create a builder to help you perform the following task:
4894    ///
4895    /// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
4896    ///
4897    /// # Arguments
4898    ///
4899    /// * `request` - No description provided.
4900    /// * `name` - The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
4901    pub fn locations_clusters_set_master_auth(
4902        &self,
4903        request: SetMasterAuthRequest,
4904        name: &str,
4905    ) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
4906        ProjectLocationClusterSetMasterAuthCall {
4907            hub: self.hub,
4908            _request: request,
4909            _name: name.to_string(),
4910            _delegate: Default::default(),
4911            _additional_params: Default::default(),
4912            _scopes: Default::default(),
4913        }
4914    }
4915
4916    /// Create a builder to help you perform the following task:
4917    ///
4918    /// Sets the monitoring service for a specific cluster.
4919    ///
4920    /// # Arguments
4921    ///
4922    /// * `request` - No description provided.
4923    /// * `name` - The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
4924    pub fn locations_clusters_set_monitoring(
4925        &self,
4926        request: SetMonitoringServiceRequest,
4927        name: &str,
4928    ) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
4929        ProjectLocationClusterSetMonitoringCall {
4930            hub: self.hub,
4931            _request: request,
4932            _name: name.to_string(),
4933            _delegate: Default::default(),
4934            _additional_params: Default::default(),
4935            _scopes: Default::default(),
4936        }
4937    }
4938
4939    /// Create a builder to help you perform the following task:
4940    ///
4941    /// Enables or disables Network Policy for a cluster.
4942    ///
4943    /// # Arguments
4944    ///
4945    /// * `request` - No description provided.
4946    /// * `name` - The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
4947    pub fn locations_clusters_set_network_policy(
4948        &self,
4949        request: SetNetworkPolicyRequest,
4950        name: &str,
4951    ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
4952        ProjectLocationClusterSetNetworkPolicyCall {
4953            hub: self.hub,
4954            _request: request,
4955            _name: name.to_string(),
4956            _delegate: Default::default(),
4957            _additional_params: Default::default(),
4958            _scopes: Default::default(),
4959        }
4960    }
4961
4962    /// Create a builder to help you perform the following task:
4963    ///
4964    /// Sets labels on a cluster.
4965    ///
4966    /// # Arguments
4967    ///
4968    /// * `request` - No description provided.
4969    /// * `name` - The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
4970    pub fn locations_clusters_set_resource_labels(
4971        &self,
4972        request: SetLabelsRequest,
4973        name: &str,
4974    ) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
4975        ProjectLocationClusterSetResourceLabelCall {
4976            hub: self.hub,
4977            _request: request,
4978            _name: name.to_string(),
4979            _delegate: Default::default(),
4980            _additional_params: Default::default(),
4981            _scopes: Default::default(),
4982        }
4983    }
4984
4985    /// Create a builder to help you perform the following task:
4986    ///
4987    /// Starts master IP rotation.
4988    ///
4989    /// # Arguments
4990    ///
4991    /// * `request` - No description provided.
4992    /// * `name` - The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
4993    pub fn locations_clusters_start_ip_rotation(
4994        &self,
4995        request: StartIPRotationRequest,
4996        name: &str,
4997    ) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
4998        ProjectLocationClusterStartIpRotationCall {
4999            hub: self.hub,
5000            _request: request,
5001            _name: name.to_string(),
5002            _delegate: Default::default(),
5003            _additional_params: Default::default(),
5004            _scopes: Default::default(),
5005        }
5006    }
5007
5008    /// Create a builder to help you perform the following task:
5009    ///
5010    /// Updates the settings of a specific cluster.
5011    ///
5012    /// # Arguments
5013    ///
5014    /// * `request` - No description provided.
5015    /// * `name` - The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
5016    pub fn locations_clusters_update(
5017        &self,
5018        request: UpdateClusterRequest,
5019        name: &str,
5020    ) -> ProjectLocationClusterUpdateCall<'a, C> {
5021        ProjectLocationClusterUpdateCall {
5022            hub: self.hub,
5023            _request: request,
5024            _name: name.to_string(),
5025            _delegate: Default::default(),
5026            _additional_params: Default::default(),
5027            _scopes: Default::default(),
5028        }
5029    }
5030
5031    /// Create a builder to help you perform the following task:
5032    ///
5033    /// Updates the master for a specific cluster.
5034    ///
5035    /// # Arguments
5036    ///
5037    /// * `request` - No description provided.
5038    /// * `name` - The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
5039    pub fn locations_clusters_update_master(
5040        &self,
5041        request: UpdateMasterRequest,
5042        name: &str,
5043    ) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
5044        ProjectLocationClusterUpdateMasterCall {
5045            hub: self.hub,
5046            _request: request,
5047            _name: name.to_string(),
5048            _delegate: Default::default(),
5049            _additional_params: Default::default(),
5050            _scopes: Default::default(),
5051        }
5052    }
5053
5054    /// Create a builder to help you perform the following task:
5055    ///
5056    /// Cancels the specified operation.
5057    ///
5058    /// # Arguments
5059    ///
5060    /// * `request` - No description provided.
5061    /// * `name` - The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
5062    pub fn locations_operations_cancel(
5063        &self,
5064        request: CancelOperationRequest,
5065        name: &str,
5066    ) -> ProjectLocationOperationCancelCall<'a, C> {
5067        ProjectLocationOperationCancelCall {
5068            hub: self.hub,
5069            _request: request,
5070            _name: name.to_string(),
5071            _delegate: Default::default(),
5072            _additional_params: Default::default(),
5073            _scopes: Default::default(),
5074        }
5075    }
5076
5077    /// Create a builder to help you perform the following task:
5078    ///
5079    /// Gets the specified operation.
5080    ///
5081    /// # Arguments
5082    ///
5083    /// * `name` - The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
5084    pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
5085        ProjectLocationOperationGetCall {
5086            hub: self.hub,
5087            _name: name.to_string(),
5088            _zone: Default::default(),
5089            _project_id: Default::default(),
5090            _operation_id: Default::default(),
5091            _delegate: Default::default(),
5092            _additional_params: Default::default(),
5093            _scopes: Default::default(),
5094        }
5095    }
5096
5097    /// Create a builder to help you perform the following task:
5098    ///
5099    /// Lists all operations in a project in a specific zone or all zones.
5100    ///
5101    /// # Arguments
5102    ///
5103    /// * `parent` - The parent (project and location) where the operations will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
5104    pub fn locations_operations_list(
5105        &self,
5106        parent: &str,
5107    ) -> ProjectLocationOperationListCall<'a, C> {
5108        ProjectLocationOperationListCall {
5109            hub: self.hub,
5110            _parent: parent.to_string(),
5111            _zone: Default::default(),
5112            _project_id: Default::default(),
5113            _delegate: Default::default(),
5114            _additional_params: Default::default(),
5115            _scopes: Default::default(),
5116        }
5117    }
5118
5119    /// Create a builder to help you perform the following task:
5120    ///
5121    /// Returns configuration info about the Google Kubernetes Engine service.
5122    ///
5123    /// # Arguments
5124    ///
5125    /// * `name` - The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
5126    pub fn locations_get_server_config(
5127        &self,
5128        name: &str,
5129    ) -> ProjectLocationGetServerConfigCall<'a, C> {
5130        ProjectLocationGetServerConfigCall {
5131            hub: self.hub,
5132            _name: name.to_string(),
5133            _zone: Default::default(),
5134            _project_id: Default::default(),
5135            _delegate: Default::default(),
5136            _additional_params: Default::default(),
5137            _scopes: Default::default(),
5138        }
5139    }
5140
5141    /// Create a builder to help you perform the following task:
5142    ///
5143    /// Sets the autoscaling settings for the specified node pool.
5144    ///
5145    /// # Arguments
5146    ///
5147    /// * `request` - No description provided.
5148    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5149    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5150    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5151    /// * `nodePoolId` - Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
5152    pub fn zones_clusters_node_pools_autoscaling(
5153        &self,
5154        request: SetNodePoolAutoscalingRequest,
5155        project_id: &str,
5156        zone: &str,
5157        cluster_id: &str,
5158        node_pool_id: &str,
5159    ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
5160        ProjectZoneClusterNodePoolAutoscalingCall {
5161            hub: self.hub,
5162            _request: request,
5163            _project_id: project_id.to_string(),
5164            _zone: zone.to_string(),
5165            _cluster_id: cluster_id.to_string(),
5166            _node_pool_id: node_pool_id.to_string(),
5167            _delegate: Default::default(),
5168            _additional_params: Default::default(),
5169            _scopes: Default::default(),
5170        }
5171    }
5172
5173    /// Create a builder to help you perform the following task:
5174    ///
5175    /// Creates a node pool for a cluster.
5176    ///
5177    /// # Arguments
5178    ///
5179    /// * `request` - No description provided.
5180    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
5181    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
5182    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
5183    pub fn zones_clusters_node_pools_create(
5184        &self,
5185        request: CreateNodePoolRequest,
5186        project_id: &str,
5187        zone: &str,
5188        cluster_id: &str,
5189    ) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
5190        ProjectZoneClusterNodePoolCreateCall {
5191            hub: self.hub,
5192            _request: request,
5193            _project_id: project_id.to_string(),
5194            _zone: zone.to_string(),
5195            _cluster_id: cluster_id.to_string(),
5196            _delegate: Default::default(),
5197            _additional_params: Default::default(),
5198            _scopes: Default::default(),
5199        }
5200    }
5201
5202    /// Create a builder to help you perform the following task:
5203    ///
5204    /// Deletes a node pool from a cluster.
5205    ///
5206    /// # Arguments
5207    ///
5208    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5209    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5210    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
5211    /// * `nodePoolId` - Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
5212    pub fn zones_clusters_node_pools_delete(
5213        &self,
5214        project_id: &str,
5215        zone: &str,
5216        cluster_id: &str,
5217        node_pool_id: &str,
5218    ) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
5219        ProjectZoneClusterNodePoolDeleteCall {
5220            hub: self.hub,
5221            _project_id: project_id.to_string(),
5222            _zone: zone.to_string(),
5223            _cluster_id: cluster_id.to_string(),
5224            _node_pool_id: node_pool_id.to_string(),
5225            _name: Default::default(),
5226            _delegate: Default::default(),
5227            _additional_params: Default::default(),
5228            _scopes: Default::default(),
5229        }
5230    }
5231
5232    /// Create a builder to help you perform the following task:
5233    ///
5234    /// Retrieves the requested node pool.
5235    ///
5236    /// # Arguments
5237    ///
5238    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5239    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5240    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
5241    /// * `nodePoolId` - Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
5242    pub fn zones_clusters_node_pools_get(
5243        &self,
5244        project_id: &str,
5245        zone: &str,
5246        cluster_id: &str,
5247        node_pool_id: &str,
5248    ) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
5249        ProjectZoneClusterNodePoolGetCall {
5250            hub: self.hub,
5251            _project_id: project_id.to_string(),
5252            _zone: zone.to_string(),
5253            _cluster_id: cluster_id.to_string(),
5254            _node_pool_id: node_pool_id.to_string(),
5255            _name: Default::default(),
5256            _delegate: Default::default(),
5257            _additional_params: Default::default(),
5258            _scopes: Default::default(),
5259        }
5260    }
5261
5262    /// Create a builder to help you perform the following task:
5263    ///
5264    /// Lists the node pools for a cluster.
5265    ///
5266    /// # Arguments
5267    ///
5268    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
5269    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
5270    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
5271    pub fn zones_clusters_node_pools_list(
5272        &self,
5273        project_id: &str,
5274        zone: &str,
5275        cluster_id: &str,
5276    ) -> ProjectZoneClusterNodePoolListCall<'a, C> {
5277        ProjectZoneClusterNodePoolListCall {
5278            hub: self.hub,
5279            _project_id: project_id.to_string(),
5280            _zone: zone.to_string(),
5281            _cluster_id: cluster_id.to_string(),
5282            _parent: Default::default(),
5283            _delegate: Default::default(),
5284            _additional_params: Default::default(),
5285            _scopes: Default::default(),
5286        }
5287    }
5288
5289    /// Create a builder to help you perform the following task:
5290    ///
5291    /// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
5292    ///
5293    /// # Arguments
5294    ///
5295    /// * `request` - No description provided.
5296    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5297    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5298    /// * `clusterId` - Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
5299    /// * `nodePoolId` - Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
5300    pub fn zones_clusters_node_pools_rollback(
5301        &self,
5302        request: RollbackNodePoolUpgradeRequest,
5303        project_id: &str,
5304        zone: &str,
5305        cluster_id: &str,
5306        node_pool_id: &str,
5307    ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
5308        ProjectZoneClusterNodePoolRollbackCall {
5309            hub: self.hub,
5310            _request: request,
5311            _project_id: project_id.to_string(),
5312            _zone: zone.to_string(),
5313            _cluster_id: cluster_id.to_string(),
5314            _node_pool_id: node_pool_id.to_string(),
5315            _delegate: Default::default(),
5316            _additional_params: Default::default(),
5317            _scopes: Default::default(),
5318        }
5319    }
5320
5321    /// Create a builder to help you perform the following task:
5322    ///
5323    /// Sets the NodeManagement options for a node pool.
5324    ///
5325    /// # Arguments
5326    ///
5327    /// * `request` - No description provided.
5328    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5329    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5330    /// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
5331    /// * `nodePoolId` - Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
5332    pub fn zones_clusters_node_pools_set_management(
5333        &self,
5334        request: SetNodePoolManagementRequest,
5335        project_id: &str,
5336        zone: &str,
5337        cluster_id: &str,
5338        node_pool_id: &str,
5339    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
5340        ProjectZoneClusterNodePoolSetManagementCall {
5341            hub: self.hub,
5342            _request: request,
5343            _project_id: project_id.to_string(),
5344            _zone: zone.to_string(),
5345            _cluster_id: cluster_id.to_string(),
5346            _node_pool_id: node_pool_id.to_string(),
5347            _delegate: Default::default(),
5348            _additional_params: Default::default(),
5349            _scopes: Default::default(),
5350        }
5351    }
5352
5353    /// Create a builder to help you perform the following task:
5354    ///
5355    /// Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
5356    ///
5357    /// # Arguments
5358    ///
5359    /// * `request` - No description provided.
5360    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5361    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5362    /// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
5363    /// * `nodePoolId` - Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
5364    pub fn zones_clusters_node_pools_set_size(
5365        &self,
5366        request: SetNodePoolSizeRequest,
5367        project_id: &str,
5368        zone: &str,
5369        cluster_id: &str,
5370        node_pool_id: &str,
5371    ) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
5372        ProjectZoneClusterNodePoolSetSizeCall {
5373            hub: self.hub,
5374            _request: request,
5375            _project_id: project_id.to_string(),
5376            _zone: zone.to_string(),
5377            _cluster_id: cluster_id.to_string(),
5378            _node_pool_id: node_pool_id.to_string(),
5379            _delegate: Default::default(),
5380            _additional_params: Default::default(),
5381            _scopes: Default::default(),
5382        }
5383    }
5384
5385    /// Create a builder to help you perform the following task:
5386    ///
5387    /// Updates the version and/or image type for the specified node pool.
5388    ///
5389    /// # Arguments
5390    ///
5391    /// * `request` - No description provided.
5392    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5393    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5394    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5395    /// * `nodePoolId` - Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
5396    pub fn zones_clusters_node_pools_update(
5397        &self,
5398        request: UpdateNodePoolRequest,
5399        project_id: &str,
5400        zone: &str,
5401        cluster_id: &str,
5402        node_pool_id: &str,
5403    ) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
5404        ProjectZoneClusterNodePoolUpdateCall {
5405            hub: self.hub,
5406            _request: request,
5407            _project_id: project_id.to_string(),
5408            _zone: zone.to_string(),
5409            _cluster_id: cluster_id.to_string(),
5410            _node_pool_id: node_pool_id.to_string(),
5411            _delegate: Default::default(),
5412            _additional_params: Default::default(),
5413            _scopes: Default::default(),
5414        }
5415    }
5416
5417    /// Create a builder to help you perform the following task:
5418    ///
5419    /// Sets the addons for a specific cluster.
5420    ///
5421    /// # Arguments
5422    ///
5423    /// * `request` - No description provided.
5424    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5425    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5426    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5427    pub fn zones_clusters_addons(
5428        &self,
5429        request: SetAddonsConfigRequest,
5430        project_id: &str,
5431        zone: &str,
5432        cluster_id: &str,
5433    ) -> ProjectZoneClusterAddonCall<'a, C> {
5434        ProjectZoneClusterAddonCall {
5435            hub: self.hub,
5436            _request: request,
5437            _project_id: project_id.to_string(),
5438            _zone: zone.to_string(),
5439            _cluster_id: cluster_id.to_string(),
5440            _delegate: Default::default(),
5441            _additional_params: Default::default(),
5442            _scopes: Default::default(),
5443        }
5444    }
5445
5446    /// Create a builder to help you perform the following task:
5447    ///
5448    /// Completes master IP rotation.
5449    ///
5450    /// # Arguments
5451    ///
5452    /// * `request` - No description provided.
5453    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5454    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5455    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
5456    pub fn zones_clusters_complete_ip_rotation(
5457        &self,
5458        request: CompleteIPRotationRequest,
5459        project_id: &str,
5460        zone: &str,
5461        cluster_id: &str,
5462    ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
5463        ProjectZoneClusterCompleteIpRotationCall {
5464            hub: self.hub,
5465            _request: request,
5466            _project_id: project_id.to_string(),
5467            _zone: zone.to_string(),
5468            _cluster_id: cluster_id.to_string(),
5469            _delegate: Default::default(),
5470            _additional_params: Default::default(),
5471            _scopes: Default::default(),
5472        }
5473    }
5474
5475    /// Create a builder to help you perform the following task:
5476    ///
5477    /// Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
5478    ///
5479    /// # Arguments
5480    ///
5481    /// * `request` - No description provided.
5482    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
5483    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
5484    pub fn zones_clusters_create(
5485        &self,
5486        request: CreateClusterRequest,
5487        project_id: &str,
5488        zone: &str,
5489    ) -> ProjectZoneClusterCreateCall<'a, C> {
5490        ProjectZoneClusterCreateCall {
5491            hub: self.hub,
5492            _request: request,
5493            _project_id: project_id.to_string(),
5494            _zone: zone.to_string(),
5495            _delegate: Default::default(),
5496            _additional_params: Default::default(),
5497            _scopes: Default::default(),
5498        }
5499    }
5500
5501    /// Create a builder to help you perform the following task:
5502    ///
5503    /// Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
5504    ///
5505    /// # Arguments
5506    ///
5507    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5508    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5509    /// * `clusterId` - Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
5510    pub fn zones_clusters_delete(
5511        &self,
5512        project_id: &str,
5513        zone: &str,
5514        cluster_id: &str,
5515    ) -> ProjectZoneClusterDeleteCall<'a, C> {
5516        ProjectZoneClusterDeleteCall {
5517            hub: self.hub,
5518            _project_id: project_id.to_string(),
5519            _zone: zone.to_string(),
5520            _cluster_id: cluster_id.to_string(),
5521            _name: Default::default(),
5522            _delegate: Default::default(),
5523            _additional_params: Default::default(),
5524            _scopes: Default::default(),
5525        }
5526    }
5527
5528    /// Create a builder to help you perform the following task:
5529    ///
5530    /// Gets the details of a specific cluster.
5531    ///
5532    /// # Arguments
5533    ///
5534    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5535    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5536    /// * `clusterId` - Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
5537    pub fn zones_clusters_get(
5538        &self,
5539        project_id: &str,
5540        zone: &str,
5541        cluster_id: &str,
5542    ) -> ProjectZoneClusterGetCall<'a, C> {
5543        ProjectZoneClusterGetCall {
5544            hub: self.hub,
5545            _project_id: project_id.to_string(),
5546            _zone: zone.to_string(),
5547            _cluster_id: cluster_id.to_string(),
5548            _name: Default::default(),
5549            _delegate: Default::default(),
5550            _additional_params: Default::default(),
5551            _scopes: Default::default(),
5552        }
5553    }
5554
5555    /// Create a builder to help you perform the following task:
5556    ///
5557    /// Enables or disables the ABAC authorization mechanism on a cluster.
5558    ///
5559    /// # Arguments
5560    ///
5561    /// * `request` - No description provided.
5562    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5563    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5564    /// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
5565    pub fn zones_clusters_legacy_abac(
5566        &self,
5567        request: SetLegacyAbacRequest,
5568        project_id: &str,
5569        zone: &str,
5570        cluster_id: &str,
5571    ) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
5572        ProjectZoneClusterLegacyAbacCall {
5573            hub: self.hub,
5574            _request: request,
5575            _project_id: project_id.to_string(),
5576            _zone: zone.to_string(),
5577            _cluster_id: cluster_id.to_string(),
5578            _delegate: Default::default(),
5579            _additional_params: Default::default(),
5580            _scopes: Default::default(),
5581        }
5582    }
5583
5584    /// Create a builder to help you perform the following task:
5585    ///
5586    /// Lists all clusters owned by a project in either the specified zone or all zones.
5587    ///
5588    /// # Arguments
5589    ///
5590    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
5591    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides, or "-" for all zones. This field has been deprecated and replaced by the parent field.
5592    pub fn zones_clusters_list(
5593        &self,
5594        project_id: &str,
5595        zone: &str,
5596    ) -> ProjectZoneClusterListCall<'a, C> {
5597        ProjectZoneClusterListCall {
5598            hub: self.hub,
5599            _project_id: project_id.to_string(),
5600            _zone: zone.to_string(),
5601            _parent: Default::default(),
5602            _delegate: Default::default(),
5603            _additional_params: Default::default(),
5604            _scopes: Default::default(),
5605        }
5606    }
5607
5608    /// Create a builder to help you perform the following task:
5609    ///
5610    /// Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) instead.
5611    ///
5612    /// # Arguments
5613    ///
5614    /// * `request` - No description provided.
5615    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5616    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5617    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5618    pub fn zones_clusters_locations(
5619        &self,
5620        request: SetLocationsRequest,
5621        project_id: &str,
5622        zone: &str,
5623        cluster_id: &str,
5624    ) -> ProjectZoneClusterLocationCall<'a, C> {
5625        ProjectZoneClusterLocationCall {
5626            hub: self.hub,
5627            _request: request,
5628            _project_id: project_id.to_string(),
5629            _zone: zone.to_string(),
5630            _cluster_id: cluster_id.to_string(),
5631            _delegate: Default::default(),
5632            _additional_params: Default::default(),
5633            _scopes: Default::default(),
5634        }
5635    }
5636
5637    /// Create a builder to help you perform the following task:
5638    ///
5639    /// Sets the logging service for a specific cluster.
5640    ///
5641    /// # Arguments
5642    ///
5643    /// * `request` - No description provided.
5644    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5645    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5646    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5647    pub fn zones_clusters_logging(
5648        &self,
5649        request: SetLoggingServiceRequest,
5650        project_id: &str,
5651        zone: &str,
5652        cluster_id: &str,
5653    ) -> ProjectZoneClusterLoggingCall<'a, C> {
5654        ProjectZoneClusterLoggingCall {
5655            hub: self.hub,
5656            _request: request,
5657            _project_id: project_id.to_string(),
5658            _zone: zone.to_string(),
5659            _cluster_id: cluster_id.to_string(),
5660            _delegate: Default::default(),
5661            _additional_params: Default::default(),
5662            _scopes: Default::default(),
5663        }
5664    }
5665
5666    /// Create a builder to help you perform the following task:
5667    ///
5668    /// Updates the master for a specific cluster.
5669    ///
5670    /// # Arguments
5671    ///
5672    /// * `request` - No description provided.
5673    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5674    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5675    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5676    pub fn zones_clusters_master(
5677        &self,
5678        request: UpdateMasterRequest,
5679        project_id: &str,
5680        zone: &str,
5681        cluster_id: &str,
5682    ) -> ProjectZoneClusterMasterCall<'a, C> {
5683        ProjectZoneClusterMasterCall {
5684            hub: self.hub,
5685            _request: request,
5686            _project_id: project_id.to_string(),
5687            _zone: zone.to_string(),
5688            _cluster_id: cluster_id.to_string(),
5689            _delegate: Default::default(),
5690            _additional_params: Default::default(),
5691            _scopes: Default::default(),
5692        }
5693    }
5694
5695    /// Create a builder to help you perform the following task:
5696    ///
5697    /// Sets the monitoring service for a specific cluster.
5698    ///
5699    /// # Arguments
5700    ///
5701    /// * `request` - No description provided.
5702    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5703    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5704    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5705    pub fn zones_clusters_monitoring(
5706        &self,
5707        request: SetMonitoringServiceRequest,
5708        project_id: &str,
5709        zone: &str,
5710        cluster_id: &str,
5711    ) -> ProjectZoneClusterMonitoringCall<'a, C> {
5712        ProjectZoneClusterMonitoringCall {
5713            hub: self.hub,
5714            _request: request,
5715            _project_id: project_id.to_string(),
5716            _zone: zone.to_string(),
5717            _cluster_id: cluster_id.to_string(),
5718            _delegate: Default::default(),
5719            _additional_params: Default::default(),
5720            _scopes: Default::default(),
5721        }
5722    }
5723
5724    /// Create a builder to help you perform the following task:
5725    ///
5726    /// Sets labels on a cluster.
5727    ///
5728    /// # Arguments
5729    ///
5730    /// * `request` - No description provided.
5731    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5732    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5733    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
5734    pub fn zones_clusters_resource_labels(
5735        &self,
5736        request: SetLabelsRequest,
5737        project_id: &str,
5738        zone: &str,
5739        cluster_id: &str,
5740    ) -> ProjectZoneClusterResourceLabelCall<'a, C> {
5741        ProjectZoneClusterResourceLabelCall {
5742            hub: self.hub,
5743            _request: request,
5744            _project_id: project_id.to_string(),
5745            _zone: zone.to_string(),
5746            _cluster_id: cluster_id.to_string(),
5747            _delegate: Default::default(),
5748            _additional_params: Default::default(),
5749            _scopes: Default::default(),
5750        }
5751    }
5752
5753    /// Create a builder to help you perform the following task:
5754    ///
5755    /// Sets the maintenance policy for a cluster.
5756    ///
5757    /// # Arguments
5758    ///
5759    /// * `request` - No description provided.
5760    /// * `projectId` - Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
5761    /// * `zone` - Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
5762    /// * `clusterId` - Required. The name of the cluster to update.
5763    pub fn zones_clusters_set_maintenance_policy(
5764        &self,
5765        request: SetMaintenancePolicyRequest,
5766        project_id: &str,
5767        zone: &str,
5768        cluster_id: &str,
5769    ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
5770        ProjectZoneClusterSetMaintenancePolicyCall {
5771            hub: self.hub,
5772            _request: request,
5773            _project_id: project_id.to_string(),
5774            _zone: zone.to_string(),
5775            _cluster_id: cluster_id.to_string(),
5776            _delegate: Default::default(),
5777            _additional_params: Default::default(),
5778            _scopes: Default::default(),
5779        }
5780    }
5781
5782    /// Create a builder to help you perform the following task:
5783    ///
5784    /// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
5785    ///
5786    /// # Arguments
5787    ///
5788    /// * `request` - No description provided.
5789    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5790    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5791    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5792    pub fn zones_clusters_set_master_auth(
5793        &self,
5794        request: SetMasterAuthRequest,
5795        project_id: &str,
5796        zone: &str,
5797        cluster_id: &str,
5798    ) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
5799        ProjectZoneClusterSetMasterAuthCall {
5800            hub: self.hub,
5801            _request: request,
5802            _project_id: project_id.to_string(),
5803            _zone: zone.to_string(),
5804            _cluster_id: cluster_id.to_string(),
5805            _delegate: Default::default(),
5806            _additional_params: Default::default(),
5807            _scopes: Default::default(),
5808        }
5809    }
5810
5811    /// Create a builder to help you perform the following task:
5812    ///
5813    /// Enables or disables Network Policy for a cluster.
5814    ///
5815    /// # Arguments
5816    ///
5817    /// * `request` - No description provided.
5818    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5819    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5820    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
5821    pub fn zones_clusters_set_network_policy(
5822        &self,
5823        request: SetNetworkPolicyRequest,
5824        project_id: &str,
5825        zone: &str,
5826        cluster_id: &str,
5827    ) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
5828        ProjectZoneClusterSetNetworkPolicyCall {
5829            hub: self.hub,
5830            _request: request,
5831            _project_id: project_id.to_string(),
5832            _zone: zone.to_string(),
5833            _cluster_id: cluster_id.to_string(),
5834            _delegate: Default::default(),
5835            _additional_params: Default::default(),
5836            _scopes: Default::default(),
5837        }
5838    }
5839
5840    /// Create a builder to help you perform the following task:
5841    ///
5842    /// Starts master IP rotation.
5843    ///
5844    /// # Arguments
5845    ///
5846    /// * `request` - No description provided.
5847    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5848    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5849    /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
5850    pub fn zones_clusters_start_ip_rotation(
5851        &self,
5852        request: StartIPRotationRequest,
5853        project_id: &str,
5854        zone: &str,
5855        cluster_id: &str,
5856    ) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
5857        ProjectZoneClusterStartIpRotationCall {
5858            hub: self.hub,
5859            _request: request,
5860            _project_id: project_id.to_string(),
5861            _zone: zone.to_string(),
5862            _cluster_id: cluster_id.to_string(),
5863            _delegate: Default::default(),
5864            _additional_params: Default::default(),
5865            _scopes: Default::default(),
5866        }
5867    }
5868
5869    /// Create a builder to help you perform the following task:
5870    ///
5871    /// Updates the settings of a specific cluster.
5872    ///
5873    /// # Arguments
5874    ///
5875    /// * `request` - No description provided.
5876    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5877    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5878    /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5879    pub fn zones_clusters_update(
5880        &self,
5881        request: UpdateClusterRequest,
5882        project_id: &str,
5883        zone: &str,
5884        cluster_id: &str,
5885    ) -> ProjectZoneClusterUpdateCall<'a, C> {
5886        ProjectZoneClusterUpdateCall {
5887            hub: self.hub,
5888            _request: request,
5889            _project_id: project_id.to_string(),
5890            _zone: zone.to_string(),
5891            _cluster_id: cluster_id.to_string(),
5892            _delegate: Default::default(),
5893            _additional_params: Default::default(),
5894            _scopes: Default::default(),
5895        }
5896    }
5897
5898    /// Create a builder to help you perform the following task:
5899    ///
5900    /// Cancels the specified operation.
5901    ///
5902    /// # Arguments
5903    ///
5904    /// * `request` - No description provided.
5905    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5906    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the operation resides. This field has been deprecated and replaced by the name field.
5907    /// * `operationId` - Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
5908    pub fn zones_operations_cancel(
5909        &self,
5910        request: CancelOperationRequest,
5911        project_id: &str,
5912        zone: &str,
5913        operation_id: &str,
5914    ) -> ProjectZoneOperationCancelCall<'a, C> {
5915        ProjectZoneOperationCancelCall {
5916            hub: self.hub,
5917            _request: request,
5918            _project_id: project_id.to_string(),
5919            _zone: zone.to_string(),
5920            _operation_id: operation_id.to_string(),
5921            _delegate: Default::default(),
5922            _additional_params: Default::default(),
5923            _scopes: Default::default(),
5924        }
5925    }
5926
5927    /// Create a builder to help you perform the following task:
5928    ///
5929    /// Gets the specified operation.
5930    ///
5931    /// # Arguments
5932    ///
5933    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5934    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
5935    /// * `operationId` - Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
5936    pub fn zones_operations_get(
5937        &self,
5938        project_id: &str,
5939        zone: &str,
5940        operation_id: &str,
5941    ) -> ProjectZoneOperationGetCall<'a, C> {
5942        ProjectZoneOperationGetCall {
5943            hub: self.hub,
5944            _project_id: project_id.to_string(),
5945            _zone: zone.to_string(),
5946            _operation_id: operation_id.to_string(),
5947            _name: Default::default(),
5948            _delegate: Default::default(),
5949            _additional_params: Default::default(),
5950            _scopes: Default::default(),
5951        }
5952    }
5953
5954    /// Create a builder to help you perform the following task:
5955    ///
5956    /// Lists all operations in a project in a specific zone or all zones.
5957    ///
5958    /// # Arguments
5959    ///
5960    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
5961    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) to return operations for, or `-` for all zones. This field has been deprecated and replaced by the parent field.
5962    pub fn zones_operations_list(
5963        &self,
5964        project_id: &str,
5965        zone: &str,
5966    ) -> ProjectZoneOperationListCall<'a, C> {
5967        ProjectZoneOperationListCall {
5968            hub: self.hub,
5969            _project_id: project_id.to_string(),
5970            _zone: zone.to_string(),
5971            _parent: Default::default(),
5972            _delegate: Default::default(),
5973            _additional_params: Default::default(),
5974            _scopes: Default::default(),
5975        }
5976    }
5977
5978    /// Create a builder to help you perform the following task:
5979    ///
5980    /// Returns configuration info about the Google Kubernetes Engine service.
5981    ///
5982    /// # Arguments
5983    ///
5984    /// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
5985    /// * `zone` - Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) to return operations for. This field has been deprecated and replaced by the name field.
5986    pub fn zones_get_serverconfig(
5987        &self,
5988        project_id: &str,
5989        zone: &str,
5990    ) -> ProjectZoneGetServerconfigCall<'a, C> {
5991        ProjectZoneGetServerconfigCall {
5992            hub: self.hub,
5993            _project_id: project_id.to_string(),
5994            _zone: zone.to_string(),
5995            _name: Default::default(),
5996            _delegate: Default::default(),
5997            _additional_params: Default::default(),
5998            _scopes: Default::default(),
5999        }
6000    }
6001}
6002
6003// ###################
6004// CallBuilders   ###
6005// #################
6006
6007/// Lists subnetworks that are usable for creating clusters in a project.
6008///
6009/// A builder for the *aggregated.usableSubnetworks.list* method supported by a *project* resource.
6010/// It is not used directly, but through a [`ProjectMethods`] instance.
6011///
6012/// # Example
6013///
6014/// Instantiate a resource method builder
6015///
6016/// ```test_harness,no_run
6017/// # extern crate hyper;
6018/// # extern crate hyper_rustls;
6019/// # extern crate google_container1 as container1;
6020/// # async fn dox() {
6021/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6022///
6023/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6024/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6025/// #     secret,
6026/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6027/// # ).build().await.unwrap();
6028///
6029/// # let client = hyper_util::client::legacy::Client::builder(
6030/// #     hyper_util::rt::TokioExecutor::new()
6031/// # )
6032/// # .build(
6033/// #     hyper_rustls::HttpsConnectorBuilder::new()
6034/// #         .with_native_roots()
6035/// #         .unwrap()
6036/// #         .https_or_http()
6037/// #         .enable_http1()
6038/// #         .build()
6039/// # );
6040/// # let mut hub = Container::new(client, auth);
6041/// // You can configure optional parameters by calling the respective setters at will, and
6042/// // execute the final call using `doit()`.
6043/// // Values shown here are possibly random and not representative !
6044/// let result = hub.projects().aggregated_usable_subnetworks_list("parent")
6045///              .page_token("eos")
6046///              .page_size(-4)
6047///              .filter("ea")
6048///              .doit().await;
6049/// # }
6050/// ```
6051pub struct ProjectAggregatedUsableSubnetworkListCall<'a, C>
6052where
6053    C: 'a,
6054{
6055    hub: &'a Container<C>,
6056    _parent: String,
6057    _page_token: Option<String>,
6058    _page_size: Option<i32>,
6059    _filter: Option<String>,
6060    _delegate: Option<&'a mut dyn common::Delegate>,
6061    _additional_params: HashMap<String, String>,
6062    _scopes: BTreeSet<String>,
6063}
6064
6065impl<'a, C> common::CallBuilder for ProjectAggregatedUsableSubnetworkListCall<'a, C> {}
6066
6067impl<'a, C> ProjectAggregatedUsableSubnetworkListCall<'a, C>
6068where
6069    C: common::Connector,
6070{
6071    /// Perform the operation you have build so far.
6072    pub async fn doit(
6073        mut self,
6074    ) -> common::Result<(common::Response, ListUsableSubnetworksResponse)> {
6075        use std::borrow::Cow;
6076        use std::io::{Read, Seek};
6077
6078        use common::{url::Params, ToParts};
6079        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6080
6081        let mut dd = common::DefaultDelegate;
6082        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6083        dlg.begin(common::MethodInfo {
6084            id: "container.projects.aggregated.usableSubnetworks.list",
6085            http_method: hyper::Method::GET,
6086        });
6087
6088        for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
6089            if self._additional_params.contains_key(field) {
6090                dlg.finished(false);
6091                return Err(common::Error::FieldClash(field));
6092            }
6093        }
6094
6095        let mut params = Params::with_capacity(6 + self._additional_params.len());
6096        params.push("parent", self._parent);
6097        if let Some(value) = self._page_token.as_ref() {
6098            params.push("pageToken", value);
6099        }
6100        if let Some(value) = self._page_size.as_ref() {
6101            params.push("pageSize", value.to_string());
6102        }
6103        if let Some(value) = self._filter.as_ref() {
6104            params.push("filter", value);
6105        }
6106
6107        params.extend(self._additional_params.iter());
6108
6109        params.push("alt", "json");
6110        let mut url = self.hub._base_url.clone() + "v1/{+parent}/aggregated/usableSubnetworks";
6111        if self._scopes.is_empty() {
6112            self._scopes
6113                .insert(Scope::CloudPlatform.as_ref().to_string());
6114        }
6115
6116        #[allow(clippy::single_element_loop)]
6117        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6118            url = params.uri_replacement(url, param_name, find_this, true);
6119        }
6120        {
6121            let to_remove = ["parent"];
6122            params.remove_params(&to_remove);
6123        }
6124
6125        let url = params.parse_with_url(&url);
6126
6127        loop {
6128            let token = match self
6129                .hub
6130                .auth
6131                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6132                .await
6133            {
6134                Ok(token) => token,
6135                Err(e) => match dlg.token(e) {
6136                    Ok(token) => token,
6137                    Err(e) => {
6138                        dlg.finished(false);
6139                        return Err(common::Error::MissingToken(e));
6140                    }
6141                },
6142            };
6143            let mut req_result = {
6144                let client = &self.hub.client;
6145                dlg.pre_request();
6146                let mut req_builder = hyper::Request::builder()
6147                    .method(hyper::Method::GET)
6148                    .uri(url.as_str())
6149                    .header(USER_AGENT, self.hub._user_agent.clone());
6150
6151                if let Some(token) = token.as_ref() {
6152                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6153                }
6154
6155                let request = req_builder
6156                    .header(CONTENT_LENGTH, 0_u64)
6157                    .body(common::to_body::<String>(None));
6158
6159                client.request(request.unwrap()).await
6160            };
6161
6162            match req_result {
6163                Err(err) => {
6164                    if let common::Retry::After(d) = dlg.http_error(&err) {
6165                        sleep(d).await;
6166                        continue;
6167                    }
6168                    dlg.finished(false);
6169                    return Err(common::Error::HttpError(err));
6170                }
6171                Ok(res) => {
6172                    let (mut parts, body) = res.into_parts();
6173                    let mut body = common::Body::new(body);
6174                    if !parts.status.is_success() {
6175                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6176                        let error = serde_json::from_str(&common::to_string(&bytes));
6177                        let response = common::to_response(parts, bytes.into());
6178
6179                        if let common::Retry::After(d) =
6180                            dlg.http_failure(&response, error.as_ref().ok())
6181                        {
6182                            sleep(d).await;
6183                            continue;
6184                        }
6185
6186                        dlg.finished(false);
6187
6188                        return Err(match error {
6189                            Ok(value) => common::Error::BadRequest(value),
6190                            _ => common::Error::Failure(response),
6191                        });
6192                    }
6193                    let response = {
6194                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6195                        let encoded = common::to_string(&bytes);
6196                        match serde_json::from_str(&encoded) {
6197                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6198                            Err(error) => {
6199                                dlg.response_json_decode_error(&encoded, &error);
6200                                return Err(common::Error::JsonDecodeError(
6201                                    encoded.to_string(),
6202                                    error,
6203                                ));
6204                            }
6205                        }
6206                    };
6207
6208                    dlg.finished(true);
6209                    return Ok(response);
6210                }
6211            }
6212        }
6213    }
6214
6215    /// The parent project where subnetworks are usable. Specified in the format `projects/*`.
6216    ///
6217    /// Sets the *parent* path property to the given value.
6218    ///
6219    /// Even though the property as already been set when instantiating this call,
6220    /// we provide this method for API completeness.
6221    pub fn parent(mut self, new_value: &str) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
6222        self._parent = new_value.to_string();
6223        self
6224    }
6225    /// Specifies a page token to use. Set this to the nextPageToken returned by previous list requests to get the next page of results.
6226    ///
6227    /// Sets the *page token* query property to the given value.
6228    pub fn page_token(
6229        mut self,
6230        new_value: &str,
6231    ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
6232        self._page_token = Some(new_value.to_string());
6233        self
6234    }
6235    /// The max number of results per page that should be returned. If the number of available results is larger than `page_size`, a `next_page_token` is returned which can be used to get the next page of results in subsequent requests. Acceptable values are 0 to 500, inclusive. (Default: 500)
6236    ///
6237    /// Sets the *page size* query property to the given value.
6238    pub fn page_size(mut self, new_value: i32) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
6239        self._page_size = Some(new_value);
6240        self
6241    }
6242    /// Filtering currently only supports equality on the networkProjectId and must be in the form: "networkProjectId=[PROJECTID]", where `networkProjectId` is the project which owns the listed subnetworks. This defaults to the parent project ID.
6243    ///
6244    /// Sets the *filter* query property to the given value.
6245    pub fn filter(mut self, new_value: &str) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
6246        self._filter = Some(new_value.to_string());
6247        self
6248    }
6249    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6250    /// while executing the actual API request.
6251    ///
6252    /// ````text
6253    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6254    /// ````
6255    ///
6256    /// Sets the *delegate* property to the given value.
6257    pub fn delegate(
6258        mut self,
6259        new_value: &'a mut dyn common::Delegate,
6260    ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
6261        self._delegate = Some(new_value);
6262        self
6263    }
6264
6265    /// Set any additional parameter of the query string used in the request.
6266    /// It should be used to set parameters which are not yet available through their own
6267    /// setters.
6268    ///
6269    /// Please note that this method must not be used to set any of the known parameters
6270    /// which have their own setter method. If done anyway, the request will fail.
6271    ///
6272    /// # Additional Parameters
6273    ///
6274    /// * *$.xgafv* (query-string) - V1 error format.
6275    /// * *access_token* (query-string) - OAuth access token.
6276    /// * *alt* (query-string) - Data format for response.
6277    /// * *callback* (query-string) - JSONP
6278    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6279    /// * *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.
6280    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6281    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6282    /// * *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.
6283    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6284    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6285    pub fn param<T>(mut self, name: T, value: T) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
6286    where
6287        T: AsRef<str>,
6288    {
6289        self._additional_params
6290            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6291        self
6292    }
6293
6294    /// Identifies the authorization scope for the method you are building.
6295    ///
6296    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6297    /// [`Scope::CloudPlatform`].
6298    ///
6299    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6300    /// tokens for more than one scope.
6301    ///
6302    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6303    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6304    /// sufficient, a read-write scope will do as well.
6305    pub fn add_scope<St>(mut self, scope: St) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
6306    where
6307        St: AsRef<str>,
6308    {
6309        self._scopes.insert(String::from(scope.as_ref()));
6310        self
6311    }
6312    /// Identifies the authorization scope(s) for the method you are building.
6313    ///
6314    /// See [`Self::add_scope()`] for details.
6315    pub fn add_scopes<I, St>(
6316        mut self,
6317        scopes: I,
6318    ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
6319    where
6320        I: IntoIterator<Item = St>,
6321        St: AsRef<str>,
6322    {
6323        self._scopes
6324            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6325        self
6326    }
6327
6328    /// Removes all scopes, and no default scope will be used either.
6329    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6330    /// for details).
6331    pub fn clear_scopes(mut self) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
6332        self._scopes.clear();
6333        self
6334    }
6335}
6336
6337/// CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.
6338///
6339/// A builder for the *locations.clusters.nodePools.completeUpgrade* method supported by a *project* resource.
6340/// It is not used directly, but through a [`ProjectMethods`] instance.
6341///
6342/// # Example
6343///
6344/// Instantiate a resource method builder
6345///
6346/// ```test_harness,no_run
6347/// # extern crate hyper;
6348/// # extern crate hyper_rustls;
6349/// # extern crate google_container1 as container1;
6350/// use container1::api::CompleteNodePoolUpgradeRequest;
6351/// # async fn dox() {
6352/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6353///
6354/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6355/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6356/// #     secret,
6357/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6358/// # ).build().await.unwrap();
6359///
6360/// # let client = hyper_util::client::legacy::Client::builder(
6361/// #     hyper_util::rt::TokioExecutor::new()
6362/// # )
6363/// # .build(
6364/// #     hyper_rustls::HttpsConnectorBuilder::new()
6365/// #         .with_native_roots()
6366/// #         .unwrap()
6367/// #         .https_or_http()
6368/// #         .enable_http1()
6369/// #         .build()
6370/// # );
6371/// # let mut hub = Container::new(client, auth);
6372/// // As the method needs a request, you would usually fill it with the desired information
6373/// // into the respective structure. Some of the parts shown here might not be applicable !
6374/// // Values shown here are possibly random and not representative !
6375/// let mut req = CompleteNodePoolUpgradeRequest::default();
6376///
6377/// // You can configure optional parameters by calling the respective setters at will, and
6378/// // execute the final call using `doit()`.
6379/// // Values shown here are possibly random and not representative !
6380/// let result = hub.projects().locations_clusters_node_pools_complete_upgrade(req, "name")
6381///              .doit().await;
6382/// # }
6383/// ```
6384pub struct ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
6385where
6386    C: 'a,
6387{
6388    hub: &'a Container<C>,
6389    _request: CompleteNodePoolUpgradeRequest,
6390    _name: String,
6391    _delegate: Option<&'a mut dyn common::Delegate>,
6392    _additional_params: HashMap<String, String>,
6393    _scopes: BTreeSet<String>,
6394}
6395
6396impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {}
6397
6398impl<'a, C> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
6399where
6400    C: common::Connector,
6401{
6402    /// Perform the operation you have build so far.
6403    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
6404        use std::borrow::Cow;
6405        use std::io::{Read, Seek};
6406
6407        use common::{url::Params, ToParts};
6408        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6409
6410        let mut dd = common::DefaultDelegate;
6411        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6412        dlg.begin(common::MethodInfo {
6413            id: "container.projects.locations.clusters.nodePools.completeUpgrade",
6414            http_method: hyper::Method::POST,
6415        });
6416
6417        for &field in ["alt", "name"].iter() {
6418            if self._additional_params.contains_key(field) {
6419                dlg.finished(false);
6420                return Err(common::Error::FieldClash(field));
6421            }
6422        }
6423
6424        let mut params = Params::with_capacity(4 + self._additional_params.len());
6425        params.push("name", self._name);
6426
6427        params.extend(self._additional_params.iter());
6428
6429        params.push("alt", "json");
6430        let mut url = self.hub._base_url.clone() + "v1/{+name}:completeUpgrade";
6431        if self._scopes.is_empty() {
6432            self._scopes
6433                .insert(Scope::CloudPlatform.as_ref().to_string());
6434        }
6435
6436        #[allow(clippy::single_element_loop)]
6437        for &(find_this, param_name) in [("{+name}", "name")].iter() {
6438            url = params.uri_replacement(url, param_name, find_this, true);
6439        }
6440        {
6441            let to_remove = ["name"];
6442            params.remove_params(&to_remove);
6443        }
6444
6445        let url = params.parse_with_url(&url);
6446
6447        let mut json_mime_type = mime::APPLICATION_JSON;
6448        let mut request_value_reader = {
6449            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6450            common::remove_json_null_values(&mut value);
6451            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6452            serde_json::to_writer(&mut dst, &value).unwrap();
6453            dst
6454        };
6455        let request_size = request_value_reader
6456            .seek(std::io::SeekFrom::End(0))
6457            .unwrap();
6458        request_value_reader
6459            .seek(std::io::SeekFrom::Start(0))
6460            .unwrap();
6461
6462        loop {
6463            let token = match self
6464                .hub
6465                .auth
6466                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6467                .await
6468            {
6469                Ok(token) => token,
6470                Err(e) => match dlg.token(e) {
6471                    Ok(token) => token,
6472                    Err(e) => {
6473                        dlg.finished(false);
6474                        return Err(common::Error::MissingToken(e));
6475                    }
6476                },
6477            };
6478            request_value_reader
6479                .seek(std::io::SeekFrom::Start(0))
6480                .unwrap();
6481            let mut req_result = {
6482                let client = &self.hub.client;
6483                dlg.pre_request();
6484                let mut req_builder = hyper::Request::builder()
6485                    .method(hyper::Method::POST)
6486                    .uri(url.as_str())
6487                    .header(USER_AGENT, self.hub._user_agent.clone());
6488
6489                if let Some(token) = token.as_ref() {
6490                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6491                }
6492
6493                let request = req_builder
6494                    .header(CONTENT_TYPE, json_mime_type.to_string())
6495                    .header(CONTENT_LENGTH, request_size as u64)
6496                    .body(common::to_body(
6497                        request_value_reader.get_ref().clone().into(),
6498                    ));
6499
6500                client.request(request.unwrap()).await
6501            };
6502
6503            match req_result {
6504                Err(err) => {
6505                    if let common::Retry::After(d) = dlg.http_error(&err) {
6506                        sleep(d).await;
6507                        continue;
6508                    }
6509                    dlg.finished(false);
6510                    return Err(common::Error::HttpError(err));
6511                }
6512                Ok(res) => {
6513                    let (mut parts, body) = res.into_parts();
6514                    let mut body = common::Body::new(body);
6515                    if !parts.status.is_success() {
6516                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6517                        let error = serde_json::from_str(&common::to_string(&bytes));
6518                        let response = common::to_response(parts, bytes.into());
6519
6520                        if let common::Retry::After(d) =
6521                            dlg.http_failure(&response, error.as_ref().ok())
6522                        {
6523                            sleep(d).await;
6524                            continue;
6525                        }
6526
6527                        dlg.finished(false);
6528
6529                        return Err(match error {
6530                            Ok(value) => common::Error::BadRequest(value),
6531                            _ => common::Error::Failure(response),
6532                        });
6533                    }
6534                    let response = {
6535                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6536                        let encoded = common::to_string(&bytes);
6537                        match serde_json::from_str(&encoded) {
6538                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6539                            Err(error) => {
6540                                dlg.response_json_decode_error(&encoded, &error);
6541                                return Err(common::Error::JsonDecodeError(
6542                                    encoded.to_string(),
6543                                    error,
6544                                ));
6545                            }
6546                        }
6547                    };
6548
6549                    dlg.finished(true);
6550                    return Ok(response);
6551                }
6552            }
6553        }
6554    }
6555
6556    ///
6557    /// Sets the *request* property to the given value.
6558    ///
6559    /// Even though the property as already been set when instantiating this call,
6560    /// we provide this method for API completeness.
6561    pub fn request(
6562        mut self,
6563        new_value: CompleteNodePoolUpgradeRequest,
6564    ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
6565        self._request = new_value;
6566        self
6567    }
6568    /// The name (project, location, cluster, node pool id) of the node pool to complete upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
6569    ///
6570    /// Sets the *name* path property to the given value.
6571    ///
6572    /// Even though the property as already been set when instantiating this call,
6573    /// we provide this method for API completeness.
6574    pub fn name(
6575        mut self,
6576        new_value: &str,
6577    ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
6578        self._name = new_value.to_string();
6579        self
6580    }
6581    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6582    /// while executing the actual API request.
6583    ///
6584    /// ````text
6585    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6586    /// ````
6587    ///
6588    /// Sets the *delegate* property to the given value.
6589    pub fn delegate(
6590        mut self,
6591        new_value: &'a mut dyn common::Delegate,
6592    ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
6593        self._delegate = Some(new_value);
6594        self
6595    }
6596
6597    /// Set any additional parameter of the query string used in the request.
6598    /// It should be used to set parameters which are not yet available through their own
6599    /// setters.
6600    ///
6601    /// Please note that this method must not be used to set any of the known parameters
6602    /// which have their own setter method. If done anyway, the request will fail.
6603    ///
6604    /// # Additional Parameters
6605    ///
6606    /// * *$.xgafv* (query-string) - V1 error format.
6607    /// * *access_token* (query-string) - OAuth access token.
6608    /// * *alt* (query-string) - Data format for response.
6609    /// * *callback* (query-string) - JSONP
6610    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6611    /// * *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.
6612    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6613    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6614    /// * *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.
6615    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6616    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6617    pub fn param<T>(
6618        mut self,
6619        name: T,
6620        value: T,
6621    ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
6622    where
6623        T: AsRef<str>,
6624    {
6625        self._additional_params
6626            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6627        self
6628    }
6629
6630    /// Identifies the authorization scope for the method you are building.
6631    ///
6632    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6633    /// [`Scope::CloudPlatform`].
6634    ///
6635    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6636    /// tokens for more than one scope.
6637    ///
6638    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6639    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6640    /// sufficient, a read-write scope will do as well.
6641    pub fn add_scope<St>(
6642        mut self,
6643        scope: St,
6644    ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
6645    where
6646        St: AsRef<str>,
6647    {
6648        self._scopes.insert(String::from(scope.as_ref()));
6649        self
6650    }
6651    /// Identifies the authorization scope(s) for the method you are building.
6652    ///
6653    /// See [`Self::add_scope()`] for details.
6654    pub fn add_scopes<I, St>(
6655        mut self,
6656        scopes: I,
6657    ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
6658    where
6659        I: IntoIterator<Item = St>,
6660        St: AsRef<str>,
6661    {
6662        self._scopes
6663            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6664        self
6665    }
6666
6667    /// Removes all scopes, and no default scope will be used either.
6668    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6669    /// for details).
6670    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
6671        self._scopes.clear();
6672        self
6673    }
6674}
6675
6676/// Creates a node pool for a cluster.
6677///
6678/// A builder for the *locations.clusters.nodePools.create* method supported by a *project* resource.
6679/// It is not used directly, but through a [`ProjectMethods`] instance.
6680///
6681/// # Example
6682///
6683/// Instantiate a resource method builder
6684///
6685/// ```test_harness,no_run
6686/// # extern crate hyper;
6687/// # extern crate hyper_rustls;
6688/// # extern crate google_container1 as container1;
6689/// use container1::api::CreateNodePoolRequest;
6690/// # async fn dox() {
6691/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
6692///
6693/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
6694/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
6695/// #     secret,
6696/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
6697/// # ).build().await.unwrap();
6698///
6699/// # let client = hyper_util::client::legacy::Client::builder(
6700/// #     hyper_util::rt::TokioExecutor::new()
6701/// # )
6702/// # .build(
6703/// #     hyper_rustls::HttpsConnectorBuilder::new()
6704/// #         .with_native_roots()
6705/// #         .unwrap()
6706/// #         .https_or_http()
6707/// #         .enable_http1()
6708/// #         .build()
6709/// # );
6710/// # let mut hub = Container::new(client, auth);
6711/// // As the method needs a request, you would usually fill it with the desired information
6712/// // into the respective structure. Some of the parts shown here might not be applicable !
6713/// // Values shown here are possibly random and not representative !
6714/// let mut req = CreateNodePoolRequest::default();
6715///
6716/// // You can configure optional parameters by calling the respective setters at will, and
6717/// // execute the final call using `doit()`.
6718/// // Values shown here are possibly random and not representative !
6719/// let result = hub.projects().locations_clusters_node_pools_create(req, "parent")
6720///              .doit().await;
6721/// # }
6722/// ```
6723pub struct ProjectLocationClusterNodePoolCreateCall<'a, C>
6724where
6725    C: 'a,
6726{
6727    hub: &'a Container<C>,
6728    _request: CreateNodePoolRequest,
6729    _parent: String,
6730    _delegate: Option<&'a mut dyn common::Delegate>,
6731    _additional_params: HashMap<String, String>,
6732    _scopes: BTreeSet<String>,
6733}
6734
6735impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolCreateCall<'a, C> {}
6736
6737impl<'a, C> ProjectLocationClusterNodePoolCreateCall<'a, C>
6738where
6739    C: common::Connector,
6740{
6741    /// Perform the operation you have build so far.
6742    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
6743        use std::borrow::Cow;
6744        use std::io::{Read, Seek};
6745
6746        use common::{url::Params, ToParts};
6747        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
6748
6749        let mut dd = common::DefaultDelegate;
6750        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
6751        dlg.begin(common::MethodInfo {
6752            id: "container.projects.locations.clusters.nodePools.create",
6753            http_method: hyper::Method::POST,
6754        });
6755
6756        for &field in ["alt", "parent"].iter() {
6757            if self._additional_params.contains_key(field) {
6758                dlg.finished(false);
6759                return Err(common::Error::FieldClash(field));
6760            }
6761        }
6762
6763        let mut params = Params::with_capacity(4 + self._additional_params.len());
6764        params.push("parent", self._parent);
6765
6766        params.extend(self._additional_params.iter());
6767
6768        params.push("alt", "json");
6769        let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
6770        if self._scopes.is_empty() {
6771            self._scopes
6772                .insert(Scope::CloudPlatform.as_ref().to_string());
6773        }
6774
6775        #[allow(clippy::single_element_loop)]
6776        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
6777            url = params.uri_replacement(url, param_name, find_this, true);
6778        }
6779        {
6780            let to_remove = ["parent"];
6781            params.remove_params(&to_remove);
6782        }
6783
6784        let url = params.parse_with_url(&url);
6785
6786        let mut json_mime_type = mime::APPLICATION_JSON;
6787        let mut request_value_reader = {
6788            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
6789            common::remove_json_null_values(&mut value);
6790            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
6791            serde_json::to_writer(&mut dst, &value).unwrap();
6792            dst
6793        };
6794        let request_size = request_value_reader
6795            .seek(std::io::SeekFrom::End(0))
6796            .unwrap();
6797        request_value_reader
6798            .seek(std::io::SeekFrom::Start(0))
6799            .unwrap();
6800
6801        loop {
6802            let token = match self
6803                .hub
6804                .auth
6805                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
6806                .await
6807            {
6808                Ok(token) => token,
6809                Err(e) => match dlg.token(e) {
6810                    Ok(token) => token,
6811                    Err(e) => {
6812                        dlg.finished(false);
6813                        return Err(common::Error::MissingToken(e));
6814                    }
6815                },
6816            };
6817            request_value_reader
6818                .seek(std::io::SeekFrom::Start(0))
6819                .unwrap();
6820            let mut req_result = {
6821                let client = &self.hub.client;
6822                dlg.pre_request();
6823                let mut req_builder = hyper::Request::builder()
6824                    .method(hyper::Method::POST)
6825                    .uri(url.as_str())
6826                    .header(USER_AGENT, self.hub._user_agent.clone());
6827
6828                if let Some(token) = token.as_ref() {
6829                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
6830                }
6831
6832                let request = req_builder
6833                    .header(CONTENT_TYPE, json_mime_type.to_string())
6834                    .header(CONTENT_LENGTH, request_size as u64)
6835                    .body(common::to_body(
6836                        request_value_reader.get_ref().clone().into(),
6837                    ));
6838
6839                client.request(request.unwrap()).await
6840            };
6841
6842            match req_result {
6843                Err(err) => {
6844                    if let common::Retry::After(d) = dlg.http_error(&err) {
6845                        sleep(d).await;
6846                        continue;
6847                    }
6848                    dlg.finished(false);
6849                    return Err(common::Error::HttpError(err));
6850                }
6851                Ok(res) => {
6852                    let (mut parts, body) = res.into_parts();
6853                    let mut body = common::Body::new(body);
6854                    if !parts.status.is_success() {
6855                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6856                        let error = serde_json::from_str(&common::to_string(&bytes));
6857                        let response = common::to_response(parts, bytes.into());
6858
6859                        if let common::Retry::After(d) =
6860                            dlg.http_failure(&response, error.as_ref().ok())
6861                        {
6862                            sleep(d).await;
6863                            continue;
6864                        }
6865
6866                        dlg.finished(false);
6867
6868                        return Err(match error {
6869                            Ok(value) => common::Error::BadRequest(value),
6870                            _ => common::Error::Failure(response),
6871                        });
6872                    }
6873                    let response = {
6874                        let bytes = common::to_bytes(body).await.unwrap_or_default();
6875                        let encoded = common::to_string(&bytes);
6876                        match serde_json::from_str(&encoded) {
6877                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
6878                            Err(error) => {
6879                                dlg.response_json_decode_error(&encoded, &error);
6880                                return Err(common::Error::JsonDecodeError(
6881                                    encoded.to_string(),
6882                                    error,
6883                                ));
6884                            }
6885                        }
6886                    };
6887
6888                    dlg.finished(true);
6889                    return Ok(response);
6890                }
6891            }
6892        }
6893    }
6894
6895    ///
6896    /// Sets the *request* property to the given value.
6897    ///
6898    /// Even though the property as already been set when instantiating this call,
6899    /// we provide this method for API completeness.
6900    pub fn request(
6901        mut self,
6902        new_value: CreateNodePoolRequest,
6903    ) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
6904        self._request = new_value;
6905        self
6906    }
6907    /// The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
6908    ///
6909    /// Sets the *parent* path property to the given value.
6910    ///
6911    /// Even though the property as already been set when instantiating this call,
6912    /// we provide this method for API completeness.
6913    pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
6914        self._parent = new_value.to_string();
6915        self
6916    }
6917    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
6918    /// while executing the actual API request.
6919    ///
6920    /// ````text
6921    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
6922    /// ````
6923    ///
6924    /// Sets the *delegate* property to the given value.
6925    pub fn delegate(
6926        mut self,
6927        new_value: &'a mut dyn common::Delegate,
6928    ) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
6929        self._delegate = Some(new_value);
6930        self
6931    }
6932
6933    /// Set any additional parameter of the query string used in the request.
6934    /// It should be used to set parameters which are not yet available through their own
6935    /// setters.
6936    ///
6937    /// Please note that this method must not be used to set any of the known parameters
6938    /// which have their own setter method. If done anyway, the request will fail.
6939    ///
6940    /// # Additional Parameters
6941    ///
6942    /// * *$.xgafv* (query-string) - V1 error format.
6943    /// * *access_token* (query-string) - OAuth access token.
6944    /// * *alt* (query-string) - Data format for response.
6945    /// * *callback* (query-string) - JSONP
6946    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
6947    /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
6948    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
6949    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
6950    /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
6951    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
6952    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
6953    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
6954    where
6955        T: AsRef<str>,
6956    {
6957        self._additional_params
6958            .insert(name.as_ref().to_string(), value.as_ref().to_string());
6959        self
6960    }
6961
6962    /// Identifies the authorization scope for the method you are building.
6963    ///
6964    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
6965    /// [`Scope::CloudPlatform`].
6966    ///
6967    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
6968    /// tokens for more than one scope.
6969    ///
6970    /// Usually there is more than one suitable scope to authorize an operation, some of which may
6971    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
6972    /// sufficient, a read-write scope will do as well.
6973    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
6974    where
6975        St: AsRef<str>,
6976    {
6977        self._scopes.insert(String::from(scope.as_ref()));
6978        self
6979    }
6980    /// Identifies the authorization scope(s) for the method you are building.
6981    ///
6982    /// See [`Self::add_scope()`] for details.
6983    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
6984    where
6985        I: IntoIterator<Item = St>,
6986        St: AsRef<str>,
6987    {
6988        self._scopes
6989            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
6990        self
6991    }
6992
6993    /// Removes all scopes, and no default scope will be used either.
6994    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
6995    /// for details).
6996    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
6997        self._scopes.clear();
6998        self
6999    }
7000}
7001
7002/// Deletes a node pool from a cluster.
7003///
7004/// A builder for the *locations.clusters.nodePools.delete* method supported by a *project* resource.
7005/// It is not used directly, but through a [`ProjectMethods`] instance.
7006///
7007/// # Example
7008///
7009/// Instantiate a resource method builder
7010///
7011/// ```test_harness,no_run
7012/// # extern crate hyper;
7013/// # extern crate hyper_rustls;
7014/// # extern crate google_container1 as container1;
7015/// # async fn dox() {
7016/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7017///
7018/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7019/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7020/// #     secret,
7021/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7022/// # ).build().await.unwrap();
7023///
7024/// # let client = hyper_util::client::legacy::Client::builder(
7025/// #     hyper_util::rt::TokioExecutor::new()
7026/// # )
7027/// # .build(
7028/// #     hyper_rustls::HttpsConnectorBuilder::new()
7029/// #         .with_native_roots()
7030/// #         .unwrap()
7031/// #         .https_or_http()
7032/// #         .enable_http1()
7033/// #         .build()
7034/// # );
7035/// # let mut hub = Container::new(client, auth);
7036/// // You can configure optional parameters by calling the respective setters at will, and
7037/// // execute the final call using `doit()`.
7038/// // Values shown here are possibly random and not representative !
7039/// let result = hub.projects().locations_clusters_node_pools_delete("name")
7040///              .zone("duo")
7041///              .project_id("ipsum")
7042///              .node_pool_id("sed")
7043///              .cluster_id("ut")
7044///              .doit().await;
7045/// # }
7046/// ```
7047pub struct ProjectLocationClusterNodePoolDeleteCall<'a, C>
7048where
7049    C: 'a,
7050{
7051    hub: &'a Container<C>,
7052    _name: String,
7053    _zone: Option<String>,
7054    _project_id: Option<String>,
7055    _node_pool_id: Option<String>,
7056    _cluster_id: Option<String>,
7057    _delegate: Option<&'a mut dyn common::Delegate>,
7058    _additional_params: HashMap<String, String>,
7059    _scopes: BTreeSet<String>,
7060}
7061
7062impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolDeleteCall<'a, C> {}
7063
7064impl<'a, C> ProjectLocationClusterNodePoolDeleteCall<'a, C>
7065where
7066    C: common::Connector,
7067{
7068    /// Perform the operation you have build so far.
7069    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
7070        use std::borrow::Cow;
7071        use std::io::{Read, Seek};
7072
7073        use common::{url::Params, ToParts};
7074        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7075
7076        let mut dd = common::DefaultDelegate;
7077        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7078        dlg.begin(common::MethodInfo {
7079            id: "container.projects.locations.clusters.nodePools.delete",
7080            http_method: hyper::Method::DELETE,
7081        });
7082
7083        for &field in [
7084            "alt",
7085            "name",
7086            "zone",
7087            "projectId",
7088            "nodePoolId",
7089            "clusterId",
7090        ]
7091        .iter()
7092        {
7093            if self._additional_params.contains_key(field) {
7094                dlg.finished(false);
7095                return Err(common::Error::FieldClash(field));
7096            }
7097        }
7098
7099        let mut params = Params::with_capacity(7 + self._additional_params.len());
7100        params.push("name", self._name);
7101        if let Some(value) = self._zone.as_ref() {
7102            params.push("zone", value);
7103        }
7104        if let Some(value) = self._project_id.as_ref() {
7105            params.push("projectId", value);
7106        }
7107        if let Some(value) = self._node_pool_id.as_ref() {
7108            params.push("nodePoolId", value);
7109        }
7110        if let Some(value) = self._cluster_id.as_ref() {
7111            params.push("clusterId", value);
7112        }
7113
7114        params.extend(self._additional_params.iter());
7115
7116        params.push("alt", "json");
7117        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7118        if self._scopes.is_empty() {
7119            self._scopes
7120                .insert(Scope::CloudPlatform.as_ref().to_string());
7121        }
7122
7123        #[allow(clippy::single_element_loop)]
7124        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7125            url = params.uri_replacement(url, param_name, find_this, true);
7126        }
7127        {
7128            let to_remove = ["name"];
7129            params.remove_params(&to_remove);
7130        }
7131
7132        let url = params.parse_with_url(&url);
7133
7134        loop {
7135            let token = match self
7136                .hub
7137                .auth
7138                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7139                .await
7140            {
7141                Ok(token) => token,
7142                Err(e) => match dlg.token(e) {
7143                    Ok(token) => token,
7144                    Err(e) => {
7145                        dlg.finished(false);
7146                        return Err(common::Error::MissingToken(e));
7147                    }
7148                },
7149            };
7150            let mut req_result = {
7151                let client = &self.hub.client;
7152                dlg.pre_request();
7153                let mut req_builder = hyper::Request::builder()
7154                    .method(hyper::Method::DELETE)
7155                    .uri(url.as_str())
7156                    .header(USER_AGENT, self.hub._user_agent.clone());
7157
7158                if let Some(token) = token.as_ref() {
7159                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7160                }
7161
7162                let request = req_builder
7163                    .header(CONTENT_LENGTH, 0_u64)
7164                    .body(common::to_body::<String>(None));
7165
7166                client.request(request.unwrap()).await
7167            };
7168
7169            match req_result {
7170                Err(err) => {
7171                    if let common::Retry::After(d) = dlg.http_error(&err) {
7172                        sleep(d).await;
7173                        continue;
7174                    }
7175                    dlg.finished(false);
7176                    return Err(common::Error::HttpError(err));
7177                }
7178                Ok(res) => {
7179                    let (mut parts, body) = res.into_parts();
7180                    let mut body = common::Body::new(body);
7181                    if !parts.status.is_success() {
7182                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7183                        let error = serde_json::from_str(&common::to_string(&bytes));
7184                        let response = common::to_response(parts, bytes.into());
7185
7186                        if let common::Retry::After(d) =
7187                            dlg.http_failure(&response, error.as_ref().ok())
7188                        {
7189                            sleep(d).await;
7190                            continue;
7191                        }
7192
7193                        dlg.finished(false);
7194
7195                        return Err(match error {
7196                            Ok(value) => common::Error::BadRequest(value),
7197                            _ => common::Error::Failure(response),
7198                        });
7199                    }
7200                    let response = {
7201                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7202                        let encoded = common::to_string(&bytes);
7203                        match serde_json::from_str(&encoded) {
7204                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7205                            Err(error) => {
7206                                dlg.response_json_decode_error(&encoded, &error);
7207                                return Err(common::Error::JsonDecodeError(
7208                                    encoded.to_string(),
7209                                    error,
7210                                ));
7211                            }
7212                        }
7213                    };
7214
7215                    dlg.finished(true);
7216                    return Ok(response);
7217                }
7218            }
7219        }
7220    }
7221
7222    /// The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
7223    ///
7224    /// Sets the *name* path property to the given value.
7225    ///
7226    /// Even though the property as already been set when instantiating this call,
7227    /// we provide this method for API completeness.
7228    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
7229        self._name = new_value.to_string();
7230        self
7231    }
7232    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
7233    ///
7234    /// Sets the *zone* query property to the given value.
7235    pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
7236        self._zone = Some(new_value.to_string());
7237        self
7238    }
7239    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
7240    ///
7241    /// Sets the *project id* query property to the given value.
7242    pub fn project_id(
7243        mut self,
7244        new_value: &str,
7245    ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
7246        self._project_id = Some(new_value.to_string());
7247        self
7248    }
7249    /// Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
7250    ///
7251    /// Sets the *node pool id* query property to the given value.
7252    pub fn node_pool_id(
7253        mut self,
7254        new_value: &str,
7255    ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
7256        self._node_pool_id = Some(new_value.to_string());
7257        self
7258    }
7259    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
7260    ///
7261    /// Sets the *cluster id* query property to the given value.
7262    pub fn cluster_id(
7263        mut self,
7264        new_value: &str,
7265    ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
7266        self._cluster_id = Some(new_value.to_string());
7267        self
7268    }
7269    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7270    /// while executing the actual API request.
7271    ///
7272    /// ````text
7273    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7274    /// ````
7275    ///
7276    /// Sets the *delegate* property to the given value.
7277    pub fn delegate(
7278        mut self,
7279        new_value: &'a mut dyn common::Delegate,
7280    ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
7281        self._delegate = Some(new_value);
7282        self
7283    }
7284
7285    /// Set any additional parameter of the query string used in the request.
7286    /// It should be used to set parameters which are not yet available through their own
7287    /// setters.
7288    ///
7289    /// Please note that this method must not be used to set any of the known parameters
7290    /// which have their own setter method. If done anyway, the request will fail.
7291    ///
7292    /// # Additional Parameters
7293    ///
7294    /// * *$.xgafv* (query-string) - V1 error format.
7295    /// * *access_token* (query-string) - OAuth access token.
7296    /// * *alt* (query-string) - Data format for response.
7297    /// * *callback* (query-string) - JSONP
7298    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7299    /// * *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.
7300    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7301    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7302    /// * *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.
7303    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7304    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7305    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
7306    where
7307        T: AsRef<str>,
7308    {
7309        self._additional_params
7310            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7311        self
7312    }
7313
7314    /// Identifies the authorization scope for the method you are building.
7315    ///
7316    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7317    /// [`Scope::CloudPlatform`].
7318    ///
7319    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7320    /// tokens for more than one scope.
7321    ///
7322    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7323    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7324    /// sufficient, a read-write scope will do as well.
7325    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
7326    where
7327        St: AsRef<str>,
7328    {
7329        self._scopes.insert(String::from(scope.as_ref()));
7330        self
7331    }
7332    /// Identifies the authorization scope(s) for the method you are building.
7333    ///
7334    /// See [`Self::add_scope()`] for details.
7335    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
7336    where
7337        I: IntoIterator<Item = St>,
7338        St: AsRef<str>,
7339    {
7340        self._scopes
7341            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7342        self
7343    }
7344
7345    /// Removes all scopes, and no default scope will be used either.
7346    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7347    /// for details).
7348    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
7349        self._scopes.clear();
7350        self
7351    }
7352}
7353
7354/// Retrieves the requested node pool.
7355///
7356/// A builder for the *locations.clusters.nodePools.get* method supported by a *project* resource.
7357/// It is not used directly, but through a [`ProjectMethods`] instance.
7358///
7359/// # Example
7360///
7361/// Instantiate a resource method builder
7362///
7363/// ```test_harness,no_run
7364/// # extern crate hyper;
7365/// # extern crate hyper_rustls;
7366/// # extern crate google_container1 as container1;
7367/// # async fn dox() {
7368/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7369///
7370/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7371/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7372/// #     secret,
7373/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7374/// # ).build().await.unwrap();
7375///
7376/// # let client = hyper_util::client::legacy::Client::builder(
7377/// #     hyper_util::rt::TokioExecutor::new()
7378/// # )
7379/// # .build(
7380/// #     hyper_rustls::HttpsConnectorBuilder::new()
7381/// #         .with_native_roots()
7382/// #         .unwrap()
7383/// #         .https_or_http()
7384/// #         .enable_http1()
7385/// #         .build()
7386/// # );
7387/// # let mut hub = Container::new(client, auth);
7388/// // You can configure optional parameters by calling the respective setters at will, and
7389/// // execute the final call using `doit()`.
7390/// // Values shown here are possibly random and not representative !
7391/// let result = hub.projects().locations_clusters_node_pools_get("name")
7392///              .zone("rebum.")
7393///              .project_id("est")
7394///              .node_pool_id("ipsum")
7395///              .cluster_id("ipsum")
7396///              .doit().await;
7397/// # }
7398/// ```
7399pub struct ProjectLocationClusterNodePoolGetCall<'a, C>
7400where
7401    C: 'a,
7402{
7403    hub: &'a Container<C>,
7404    _name: String,
7405    _zone: Option<String>,
7406    _project_id: Option<String>,
7407    _node_pool_id: Option<String>,
7408    _cluster_id: Option<String>,
7409    _delegate: Option<&'a mut dyn common::Delegate>,
7410    _additional_params: HashMap<String, String>,
7411    _scopes: BTreeSet<String>,
7412}
7413
7414impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolGetCall<'a, C> {}
7415
7416impl<'a, C> ProjectLocationClusterNodePoolGetCall<'a, C>
7417where
7418    C: common::Connector,
7419{
7420    /// Perform the operation you have build so far.
7421    pub async fn doit(mut self) -> common::Result<(common::Response, NodePool)> {
7422        use std::borrow::Cow;
7423        use std::io::{Read, Seek};
7424
7425        use common::{url::Params, ToParts};
7426        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7427
7428        let mut dd = common::DefaultDelegate;
7429        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7430        dlg.begin(common::MethodInfo {
7431            id: "container.projects.locations.clusters.nodePools.get",
7432            http_method: hyper::Method::GET,
7433        });
7434
7435        for &field in [
7436            "alt",
7437            "name",
7438            "zone",
7439            "projectId",
7440            "nodePoolId",
7441            "clusterId",
7442        ]
7443        .iter()
7444        {
7445            if self._additional_params.contains_key(field) {
7446                dlg.finished(false);
7447                return Err(common::Error::FieldClash(field));
7448            }
7449        }
7450
7451        let mut params = Params::with_capacity(7 + self._additional_params.len());
7452        params.push("name", self._name);
7453        if let Some(value) = self._zone.as_ref() {
7454            params.push("zone", value);
7455        }
7456        if let Some(value) = self._project_id.as_ref() {
7457            params.push("projectId", value);
7458        }
7459        if let Some(value) = self._node_pool_id.as_ref() {
7460            params.push("nodePoolId", value);
7461        }
7462        if let Some(value) = self._cluster_id.as_ref() {
7463            params.push("clusterId", value);
7464        }
7465
7466        params.extend(self._additional_params.iter());
7467
7468        params.push("alt", "json");
7469        let mut url = self.hub._base_url.clone() + "v1/{+name}";
7470        if self._scopes.is_empty() {
7471            self._scopes
7472                .insert(Scope::CloudPlatform.as_ref().to_string());
7473        }
7474
7475        #[allow(clippy::single_element_loop)]
7476        for &(find_this, param_name) in [("{+name}", "name")].iter() {
7477            url = params.uri_replacement(url, param_name, find_this, true);
7478        }
7479        {
7480            let to_remove = ["name"];
7481            params.remove_params(&to_remove);
7482        }
7483
7484        let url = params.parse_with_url(&url);
7485
7486        loop {
7487            let token = match self
7488                .hub
7489                .auth
7490                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7491                .await
7492            {
7493                Ok(token) => token,
7494                Err(e) => match dlg.token(e) {
7495                    Ok(token) => token,
7496                    Err(e) => {
7497                        dlg.finished(false);
7498                        return Err(common::Error::MissingToken(e));
7499                    }
7500                },
7501            };
7502            let mut req_result = {
7503                let client = &self.hub.client;
7504                dlg.pre_request();
7505                let mut req_builder = hyper::Request::builder()
7506                    .method(hyper::Method::GET)
7507                    .uri(url.as_str())
7508                    .header(USER_AGENT, self.hub._user_agent.clone());
7509
7510                if let Some(token) = token.as_ref() {
7511                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7512                }
7513
7514                let request = req_builder
7515                    .header(CONTENT_LENGTH, 0_u64)
7516                    .body(common::to_body::<String>(None));
7517
7518                client.request(request.unwrap()).await
7519            };
7520
7521            match req_result {
7522                Err(err) => {
7523                    if let common::Retry::After(d) = dlg.http_error(&err) {
7524                        sleep(d).await;
7525                        continue;
7526                    }
7527                    dlg.finished(false);
7528                    return Err(common::Error::HttpError(err));
7529                }
7530                Ok(res) => {
7531                    let (mut parts, body) = res.into_parts();
7532                    let mut body = common::Body::new(body);
7533                    if !parts.status.is_success() {
7534                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7535                        let error = serde_json::from_str(&common::to_string(&bytes));
7536                        let response = common::to_response(parts, bytes.into());
7537
7538                        if let common::Retry::After(d) =
7539                            dlg.http_failure(&response, error.as_ref().ok())
7540                        {
7541                            sleep(d).await;
7542                            continue;
7543                        }
7544
7545                        dlg.finished(false);
7546
7547                        return Err(match error {
7548                            Ok(value) => common::Error::BadRequest(value),
7549                            _ => common::Error::Failure(response),
7550                        });
7551                    }
7552                    let response = {
7553                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7554                        let encoded = common::to_string(&bytes);
7555                        match serde_json::from_str(&encoded) {
7556                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7557                            Err(error) => {
7558                                dlg.response_json_decode_error(&encoded, &error);
7559                                return Err(common::Error::JsonDecodeError(
7560                                    encoded.to_string(),
7561                                    error,
7562                                ));
7563                            }
7564                        }
7565                    };
7566
7567                    dlg.finished(true);
7568                    return Ok(response);
7569                }
7570            }
7571        }
7572    }
7573
7574    /// The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
7575    ///
7576    /// Sets the *name* path property to the given value.
7577    ///
7578    /// Even though the property as already been set when instantiating this call,
7579    /// we provide this method for API completeness.
7580    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
7581        self._name = new_value.to_string();
7582        self
7583    }
7584    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
7585    ///
7586    /// Sets the *zone* query property to the given value.
7587    pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
7588        self._zone = Some(new_value.to_string());
7589        self
7590    }
7591    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
7592    ///
7593    /// Sets the *project id* query property to the given value.
7594    pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
7595        self._project_id = Some(new_value.to_string());
7596        self
7597    }
7598    /// Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
7599    ///
7600    /// Sets the *node pool id* query property to the given value.
7601    pub fn node_pool_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
7602        self._node_pool_id = Some(new_value.to_string());
7603        self
7604    }
7605    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
7606    ///
7607    /// Sets the *cluster id* query property to the given value.
7608    pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
7609        self._cluster_id = Some(new_value.to_string());
7610        self
7611    }
7612    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7613    /// while executing the actual API request.
7614    ///
7615    /// ````text
7616    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7617    /// ````
7618    ///
7619    /// Sets the *delegate* property to the given value.
7620    pub fn delegate(
7621        mut self,
7622        new_value: &'a mut dyn common::Delegate,
7623    ) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
7624        self._delegate = Some(new_value);
7625        self
7626    }
7627
7628    /// Set any additional parameter of the query string used in the request.
7629    /// It should be used to set parameters which are not yet available through their own
7630    /// setters.
7631    ///
7632    /// Please note that this method must not be used to set any of the known parameters
7633    /// which have their own setter method. If done anyway, the request will fail.
7634    ///
7635    /// # Additional Parameters
7636    ///
7637    /// * *$.xgafv* (query-string) - V1 error format.
7638    /// * *access_token* (query-string) - OAuth access token.
7639    /// * *alt* (query-string) - Data format for response.
7640    /// * *callback* (query-string) - JSONP
7641    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7642    /// * *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.
7643    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7644    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7645    /// * *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.
7646    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7647    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7648    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolGetCall<'a, C>
7649    where
7650        T: AsRef<str>,
7651    {
7652        self._additional_params
7653            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7654        self
7655    }
7656
7657    /// Identifies the authorization scope for the method you are building.
7658    ///
7659    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7660    /// [`Scope::CloudPlatform`].
7661    ///
7662    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7663    /// tokens for more than one scope.
7664    ///
7665    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7666    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7667    /// sufficient, a read-write scope will do as well.
7668    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolGetCall<'a, C>
7669    where
7670        St: AsRef<str>,
7671    {
7672        self._scopes.insert(String::from(scope.as_ref()));
7673        self
7674    }
7675    /// Identifies the authorization scope(s) for the method you are building.
7676    ///
7677    /// See [`Self::add_scope()`] for details.
7678    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolGetCall<'a, C>
7679    where
7680        I: IntoIterator<Item = St>,
7681        St: AsRef<str>,
7682    {
7683        self._scopes
7684            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7685        self
7686    }
7687
7688    /// Removes all scopes, and no default scope will be used either.
7689    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7690    /// for details).
7691    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
7692        self._scopes.clear();
7693        self
7694    }
7695}
7696
7697/// Lists the node pools for a cluster.
7698///
7699/// A builder for the *locations.clusters.nodePools.list* method supported by a *project* resource.
7700/// It is not used directly, but through a [`ProjectMethods`] instance.
7701///
7702/// # Example
7703///
7704/// Instantiate a resource method builder
7705///
7706/// ```test_harness,no_run
7707/// # extern crate hyper;
7708/// # extern crate hyper_rustls;
7709/// # extern crate google_container1 as container1;
7710/// # async fn dox() {
7711/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7712///
7713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7714/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
7715/// #     secret,
7716/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7717/// # ).build().await.unwrap();
7718///
7719/// # let client = hyper_util::client::legacy::Client::builder(
7720/// #     hyper_util::rt::TokioExecutor::new()
7721/// # )
7722/// # .build(
7723/// #     hyper_rustls::HttpsConnectorBuilder::new()
7724/// #         .with_native_roots()
7725/// #         .unwrap()
7726/// #         .https_or_http()
7727/// #         .enable_http1()
7728/// #         .build()
7729/// # );
7730/// # let mut hub = Container::new(client, auth);
7731/// // You can configure optional parameters by calling the respective setters at will, and
7732/// // execute the final call using `doit()`.
7733/// // Values shown here are possibly random and not representative !
7734/// let result = hub.projects().locations_clusters_node_pools_list("parent")
7735///              .zone("gubergren")
7736///              .project_id("ea")
7737///              .cluster_id("dolor")
7738///              .doit().await;
7739/// # }
7740/// ```
7741pub struct ProjectLocationClusterNodePoolListCall<'a, C>
7742where
7743    C: 'a,
7744{
7745    hub: &'a Container<C>,
7746    _parent: String,
7747    _zone: Option<String>,
7748    _project_id: Option<String>,
7749    _cluster_id: Option<String>,
7750    _delegate: Option<&'a mut dyn common::Delegate>,
7751    _additional_params: HashMap<String, String>,
7752    _scopes: BTreeSet<String>,
7753}
7754
7755impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolListCall<'a, C> {}
7756
7757impl<'a, C> ProjectLocationClusterNodePoolListCall<'a, C>
7758where
7759    C: common::Connector,
7760{
7761    /// Perform the operation you have build so far.
7762    pub async fn doit(mut self) -> common::Result<(common::Response, ListNodePoolsResponse)> {
7763        use std::borrow::Cow;
7764        use std::io::{Read, Seek};
7765
7766        use common::{url::Params, ToParts};
7767        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7768
7769        let mut dd = common::DefaultDelegate;
7770        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7771        dlg.begin(common::MethodInfo {
7772            id: "container.projects.locations.clusters.nodePools.list",
7773            http_method: hyper::Method::GET,
7774        });
7775
7776        for &field in ["alt", "parent", "zone", "projectId", "clusterId"].iter() {
7777            if self._additional_params.contains_key(field) {
7778                dlg.finished(false);
7779                return Err(common::Error::FieldClash(field));
7780            }
7781        }
7782
7783        let mut params = Params::with_capacity(6 + self._additional_params.len());
7784        params.push("parent", self._parent);
7785        if let Some(value) = self._zone.as_ref() {
7786            params.push("zone", value);
7787        }
7788        if let Some(value) = self._project_id.as_ref() {
7789            params.push("projectId", value);
7790        }
7791        if let Some(value) = self._cluster_id.as_ref() {
7792            params.push("clusterId", value);
7793        }
7794
7795        params.extend(self._additional_params.iter());
7796
7797        params.push("alt", "json");
7798        let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
7799        if self._scopes.is_empty() {
7800            self._scopes
7801                .insert(Scope::CloudPlatform.as_ref().to_string());
7802        }
7803
7804        #[allow(clippy::single_element_loop)]
7805        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7806            url = params.uri_replacement(url, param_name, find_this, true);
7807        }
7808        {
7809            let to_remove = ["parent"];
7810            params.remove_params(&to_remove);
7811        }
7812
7813        let url = params.parse_with_url(&url);
7814
7815        loop {
7816            let token = match self
7817                .hub
7818                .auth
7819                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7820                .await
7821            {
7822                Ok(token) => token,
7823                Err(e) => match dlg.token(e) {
7824                    Ok(token) => token,
7825                    Err(e) => {
7826                        dlg.finished(false);
7827                        return Err(common::Error::MissingToken(e));
7828                    }
7829                },
7830            };
7831            let mut req_result = {
7832                let client = &self.hub.client;
7833                dlg.pre_request();
7834                let mut req_builder = hyper::Request::builder()
7835                    .method(hyper::Method::GET)
7836                    .uri(url.as_str())
7837                    .header(USER_AGENT, self.hub._user_agent.clone());
7838
7839                if let Some(token) = token.as_ref() {
7840                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7841                }
7842
7843                let request = req_builder
7844                    .header(CONTENT_LENGTH, 0_u64)
7845                    .body(common::to_body::<String>(None));
7846
7847                client.request(request.unwrap()).await
7848            };
7849
7850            match req_result {
7851                Err(err) => {
7852                    if let common::Retry::After(d) = dlg.http_error(&err) {
7853                        sleep(d).await;
7854                        continue;
7855                    }
7856                    dlg.finished(false);
7857                    return Err(common::Error::HttpError(err));
7858                }
7859                Ok(res) => {
7860                    let (mut parts, body) = res.into_parts();
7861                    let mut body = common::Body::new(body);
7862                    if !parts.status.is_success() {
7863                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7864                        let error = serde_json::from_str(&common::to_string(&bytes));
7865                        let response = common::to_response(parts, bytes.into());
7866
7867                        if let common::Retry::After(d) =
7868                            dlg.http_failure(&response, error.as_ref().ok())
7869                        {
7870                            sleep(d).await;
7871                            continue;
7872                        }
7873
7874                        dlg.finished(false);
7875
7876                        return Err(match error {
7877                            Ok(value) => common::Error::BadRequest(value),
7878                            _ => common::Error::Failure(response),
7879                        });
7880                    }
7881                    let response = {
7882                        let bytes = common::to_bytes(body).await.unwrap_or_default();
7883                        let encoded = common::to_string(&bytes);
7884                        match serde_json::from_str(&encoded) {
7885                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7886                            Err(error) => {
7887                                dlg.response_json_decode_error(&encoded, &error);
7888                                return Err(common::Error::JsonDecodeError(
7889                                    encoded.to_string(),
7890                                    error,
7891                                ));
7892                            }
7893                        }
7894                    };
7895
7896                    dlg.finished(true);
7897                    return Ok(response);
7898                }
7899            }
7900        }
7901    }
7902
7903    /// The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
7904    ///
7905    /// Sets the *parent* path property to the given value.
7906    ///
7907    /// Even though the property as already been set when instantiating this call,
7908    /// we provide this method for API completeness.
7909    pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
7910        self._parent = new_value.to_string();
7911        self
7912    }
7913    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
7914    ///
7915    /// Sets the *zone* query property to the given value.
7916    pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
7917        self._zone = Some(new_value.to_string());
7918        self
7919    }
7920    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
7921    ///
7922    /// Sets the *project id* query property to the given value.
7923    pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
7924        self._project_id = Some(new_value.to_string());
7925        self
7926    }
7927    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
7928    ///
7929    /// Sets the *cluster id* query property to the given value.
7930    pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
7931        self._cluster_id = Some(new_value.to_string());
7932        self
7933    }
7934    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7935    /// while executing the actual API request.
7936    ///
7937    /// ````text
7938    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
7939    /// ````
7940    ///
7941    /// Sets the *delegate* property to the given value.
7942    pub fn delegate(
7943        mut self,
7944        new_value: &'a mut dyn common::Delegate,
7945    ) -> ProjectLocationClusterNodePoolListCall<'a, C> {
7946        self._delegate = Some(new_value);
7947        self
7948    }
7949
7950    /// Set any additional parameter of the query string used in the request.
7951    /// It should be used to set parameters which are not yet available through their own
7952    /// setters.
7953    ///
7954    /// Please note that this method must not be used to set any of the known parameters
7955    /// which have their own setter method. If done anyway, the request will fail.
7956    ///
7957    /// # Additional Parameters
7958    ///
7959    /// * *$.xgafv* (query-string) - V1 error format.
7960    /// * *access_token* (query-string) - OAuth access token.
7961    /// * *alt* (query-string) - Data format for response.
7962    /// * *callback* (query-string) - JSONP
7963    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7964    /// * *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.
7965    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7966    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7967    /// * *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.
7968    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7969    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7970    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolListCall<'a, C>
7971    where
7972        T: AsRef<str>,
7973    {
7974        self._additional_params
7975            .insert(name.as_ref().to_string(), value.as_ref().to_string());
7976        self
7977    }
7978
7979    /// Identifies the authorization scope for the method you are building.
7980    ///
7981    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7982    /// [`Scope::CloudPlatform`].
7983    ///
7984    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7985    /// tokens for more than one scope.
7986    ///
7987    /// Usually there is more than one suitable scope to authorize an operation, some of which may
7988    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7989    /// sufficient, a read-write scope will do as well.
7990    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolListCall<'a, C>
7991    where
7992        St: AsRef<str>,
7993    {
7994        self._scopes.insert(String::from(scope.as_ref()));
7995        self
7996    }
7997    /// Identifies the authorization scope(s) for the method you are building.
7998    ///
7999    /// See [`Self::add_scope()`] for details.
8000    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolListCall<'a, C>
8001    where
8002        I: IntoIterator<Item = St>,
8003        St: AsRef<str>,
8004    {
8005        self._scopes
8006            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8007        self
8008    }
8009
8010    /// Removes all scopes, and no default scope will be used either.
8011    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8012    /// for details).
8013    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolListCall<'a, C> {
8014        self._scopes.clear();
8015        self
8016    }
8017}
8018
8019/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
8020///
8021/// A builder for the *locations.clusters.nodePools.rollback* method supported by a *project* resource.
8022/// It is not used directly, but through a [`ProjectMethods`] instance.
8023///
8024/// # Example
8025///
8026/// Instantiate a resource method builder
8027///
8028/// ```test_harness,no_run
8029/// # extern crate hyper;
8030/// # extern crate hyper_rustls;
8031/// # extern crate google_container1 as container1;
8032/// use container1::api::RollbackNodePoolUpgradeRequest;
8033/// # async fn dox() {
8034/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8035///
8036/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8037/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8038/// #     secret,
8039/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8040/// # ).build().await.unwrap();
8041///
8042/// # let client = hyper_util::client::legacy::Client::builder(
8043/// #     hyper_util::rt::TokioExecutor::new()
8044/// # )
8045/// # .build(
8046/// #     hyper_rustls::HttpsConnectorBuilder::new()
8047/// #         .with_native_roots()
8048/// #         .unwrap()
8049/// #         .https_or_http()
8050/// #         .enable_http1()
8051/// #         .build()
8052/// # );
8053/// # let mut hub = Container::new(client, auth);
8054/// // As the method needs a request, you would usually fill it with the desired information
8055/// // into the respective structure. Some of the parts shown here might not be applicable !
8056/// // Values shown here are possibly random and not representative !
8057/// let mut req = RollbackNodePoolUpgradeRequest::default();
8058///
8059/// // You can configure optional parameters by calling the respective setters at will, and
8060/// // execute the final call using `doit()`.
8061/// // Values shown here are possibly random and not representative !
8062/// let result = hub.projects().locations_clusters_node_pools_rollback(req, "name")
8063///              .doit().await;
8064/// # }
8065/// ```
8066pub struct ProjectLocationClusterNodePoolRollbackCall<'a, C>
8067where
8068    C: 'a,
8069{
8070    hub: &'a Container<C>,
8071    _request: RollbackNodePoolUpgradeRequest,
8072    _name: String,
8073    _delegate: Option<&'a mut dyn common::Delegate>,
8074    _additional_params: HashMap<String, String>,
8075    _scopes: BTreeSet<String>,
8076}
8077
8078impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolRollbackCall<'a, C> {}
8079
8080impl<'a, C> ProjectLocationClusterNodePoolRollbackCall<'a, C>
8081where
8082    C: common::Connector,
8083{
8084    /// Perform the operation you have build so far.
8085    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8086        use std::borrow::Cow;
8087        use std::io::{Read, Seek};
8088
8089        use common::{url::Params, ToParts};
8090        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8091
8092        let mut dd = common::DefaultDelegate;
8093        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8094        dlg.begin(common::MethodInfo {
8095            id: "container.projects.locations.clusters.nodePools.rollback",
8096            http_method: hyper::Method::POST,
8097        });
8098
8099        for &field in ["alt", "name"].iter() {
8100            if self._additional_params.contains_key(field) {
8101                dlg.finished(false);
8102                return Err(common::Error::FieldClash(field));
8103            }
8104        }
8105
8106        let mut params = Params::with_capacity(4 + self._additional_params.len());
8107        params.push("name", self._name);
8108
8109        params.extend(self._additional_params.iter());
8110
8111        params.push("alt", "json");
8112        let mut url = self.hub._base_url.clone() + "v1/{+name}:rollback";
8113        if self._scopes.is_empty() {
8114            self._scopes
8115                .insert(Scope::CloudPlatform.as_ref().to_string());
8116        }
8117
8118        #[allow(clippy::single_element_loop)]
8119        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8120            url = params.uri_replacement(url, param_name, find_this, true);
8121        }
8122        {
8123            let to_remove = ["name"];
8124            params.remove_params(&to_remove);
8125        }
8126
8127        let url = params.parse_with_url(&url);
8128
8129        let mut json_mime_type = mime::APPLICATION_JSON;
8130        let mut request_value_reader = {
8131            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8132            common::remove_json_null_values(&mut value);
8133            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8134            serde_json::to_writer(&mut dst, &value).unwrap();
8135            dst
8136        };
8137        let request_size = request_value_reader
8138            .seek(std::io::SeekFrom::End(0))
8139            .unwrap();
8140        request_value_reader
8141            .seek(std::io::SeekFrom::Start(0))
8142            .unwrap();
8143
8144        loop {
8145            let token = match self
8146                .hub
8147                .auth
8148                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8149                .await
8150            {
8151                Ok(token) => token,
8152                Err(e) => match dlg.token(e) {
8153                    Ok(token) => token,
8154                    Err(e) => {
8155                        dlg.finished(false);
8156                        return Err(common::Error::MissingToken(e));
8157                    }
8158                },
8159            };
8160            request_value_reader
8161                .seek(std::io::SeekFrom::Start(0))
8162                .unwrap();
8163            let mut req_result = {
8164                let client = &self.hub.client;
8165                dlg.pre_request();
8166                let mut req_builder = hyper::Request::builder()
8167                    .method(hyper::Method::POST)
8168                    .uri(url.as_str())
8169                    .header(USER_AGENT, self.hub._user_agent.clone());
8170
8171                if let Some(token) = token.as_ref() {
8172                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8173                }
8174
8175                let request = req_builder
8176                    .header(CONTENT_TYPE, json_mime_type.to_string())
8177                    .header(CONTENT_LENGTH, request_size as u64)
8178                    .body(common::to_body(
8179                        request_value_reader.get_ref().clone().into(),
8180                    ));
8181
8182                client.request(request.unwrap()).await
8183            };
8184
8185            match req_result {
8186                Err(err) => {
8187                    if let common::Retry::After(d) = dlg.http_error(&err) {
8188                        sleep(d).await;
8189                        continue;
8190                    }
8191                    dlg.finished(false);
8192                    return Err(common::Error::HttpError(err));
8193                }
8194                Ok(res) => {
8195                    let (mut parts, body) = res.into_parts();
8196                    let mut body = common::Body::new(body);
8197                    if !parts.status.is_success() {
8198                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8199                        let error = serde_json::from_str(&common::to_string(&bytes));
8200                        let response = common::to_response(parts, bytes.into());
8201
8202                        if let common::Retry::After(d) =
8203                            dlg.http_failure(&response, error.as_ref().ok())
8204                        {
8205                            sleep(d).await;
8206                            continue;
8207                        }
8208
8209                        dlg.finished(false);
8210
8211                        return Err(match error {
8212                            Ok(value) => common::Error::BadRequest(value),
8213                            _ => common::Error::Failure(response),
8214                        });
8215                    }
8216                    let response = {
8217                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8218                        let encoded = common::to_string(&bytes);
8219                        match serde_json::from_str(&encoded) {
8220                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8221                            Err(error) => {
8222                                dlg.response_json_decode_error(&encoded, &error);
8223                                return Err(common::Error::JsonDecodeError(
8224                                    encoded.to_string(),
8225                                    error,
8226                                ));
8227                            }
8228                        }
8229                    };
8230
8231                    dlg.finished(true);
8232                    return Ok(response);
8233                }
8234            }
8235        }
8236    }
8237
8238    ///
8239    /// Sets the *request* property to the given value.
8240    ///
8241    /// Even though the property as already been set when instantiating this call,
8242    /// we provide this method for API completeness.
8243    pub fn request(
8244        mut self,
8245        new_value: RollbackNodePoolUpgradeRequest,
8246    ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
8247        self._request = new_value;
8248        self
8249    }
8250    /// The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
8251    ///
8252    /// Sets the *name* path property to the given value.
8253    ///
8254    /// Even though the property as already been set when instantiating this call,
8255    /// we provide this method for API completeness.
8256    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
8257        self._name = new_value.to_string();
8258        self
8259    }
8260    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8261    /// while executing the actual API request.
8262    ///
8263    /// ````text
8264    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8265    /// ````
8266    ///
8267    /// Sets the *delegate* property to the given value.
8268    pub fn delegate(
8269        mut self,
8270        new_value: &'a mut dyn common::Delegate,
8271    ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
8272        self._delegate = Some(new_value);
8273        self
8274    }
8275
8276    /// Set any additional parameter of the query string used in the request.
8277    /// It should be used to set parameters which are not yet available through their own
8278    /// setters.
8279    ///
8280    /// Please note that this method must not be used to set any of the known parameters
8281    /// which have their own setter method. If done anyway, the request will fail.
8282    ///
8283    /// # Additional Parameters
8284    ///
8285    /// * *$.xgafv* (query-string) - V1 error format.
8286    /// * *access_token* (query-string) - OAuth access token.
8287    /// * *alt* (query-string) - Data format for response.
8288    /// * *callback* (query-string) - JSONP
8289    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8290    /// * *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.
8291    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8292    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8293    /// * *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.
8294    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8295    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8296    pub fn param<T>(
8297        mut self,
8298        name: T,
8299        value: T,
8300    ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
8301    where
8302        T: AsRef<str>,
8303    {
8304        self._additional_params
8305            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8306        self
8307    }
8308
8309    /// Identifies the authorization scope for the method you are building.
8310    ///
8311    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8312    /// [`Scope::CloudPlatform`].
8313    ///
8314    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8315    /// tokens for more than one scope.
8316    ///
8317    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8318    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8319    /// sufficient, a read-write scope will do as well.
8320    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
8321    where
8322        St: AsRef<str>,
8323    {
8324        self._scopes.insert(String::from(scope.as_ref()));
8325        self
8326    }
8327    /// Identifies the authorization scope(s) for the method you are building.
8328    ///
8329    /// See [`Self::add_scope()`] for details.
8330    pub fn add_scopes<I, St>(
8331        mut self,
8332        scopes: I,
8333    ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
8334    where
8335        I: IntoIterator<Item = St>,
8336        St: AsRef<str>,
8337    {
8338        self._scopes
8339            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8340        self
8341    }
8342
8343    /// Removes all scopes, and no default scope will be used either.
8344    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8345    /// for details).
8346    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
8347        self._scopes.clear();
8348        self
8349    }
8350}
8351
8352/// Sets the autoscaling settings for the specified node pool.
8353///
8354/// A builder for the *locations.clusters.nodePools.setAutoscaling* method supported by a *project* resource.
8355/// It is not used directly, but through a [`ProjectMethods`] instance.
8356///
8357/// # Example
8358///
8359/// Instantiate a resource method builder
8360///
8361/// ```test_harness,no_run
8362/// # extern crate hyper;
8363/// # extern crate hyper_rustls;
8364/// # extern crate google_container1 as container1;
8365/// use container1::api::SetNodePoolAutoscalingRequest;
8366/// # async fn dox() {
8367/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8368///
8369/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8370/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8371/// #     secret,
8372/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8373/// # ).build().await.unwrap();
8374///
8375/// # let client = hyper_util::client::legacy::Client::builder(
8376/// #     hyper_util::rt::TokioExecutor::new()
8377/// # )
8378/// # .build(
8379/// #     hyper_rustls::HttpsConnectorBuilder::new()
8380/// #         .with_native_roots()
8381/// #         .unwrap()
8382/// #         .https_or_http()
8383/// #         .enable_http1()
8384/// #         .build()
8385/// # );
8386/// # let mut hub = Container::new(client, auth);
8387/// // As the method needs a request, you would usually fill it with the desired information
8388/// // into the respective structure. Some of the parts shown here might not be applicable !
8389/// // Values shown here are possibly random and not representative !
8390/// let mut req = SetNodePoolAutoscalingRequest::default();
8391///
8392/// // You can configure optional parameters by calling the respective setters at will, and
8393/// // execute the final call using `doit()`.
8394/// // Values shown here are possibly random and not representative !
8395/// let result = hub.projects().locations_clusters_node_pools_set_autoscaling(req, "name")
8396///              .doit().await;
8397/// # }
8398/// ```
8399pub struct ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
8400where
8401    C: 'a,
8402{
8403    hub: &'a Container<C>,
8404    _request: SetNodePoolAutoscalingRequest,
8405    _name: String,
8406    _delegate: Option<&'a mut dyn common::Delegate>,
8407    _additional_params: HashMap<String, String>,
8408    _scopes: BTreeSet<String>,
8409}
8410
8411impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {}
8412
8413impl<'a, C> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
8414where
8415    C: common::Connector,
8416{
8417    /// Perform the operation you have build so far.
8418    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8419        use std::borrow::Cow;
8420        use std::io::{Read, Seek};
8421
8422        use common::{url::Params, ToParts};
8423        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8424
8425        let mut dd = common::DefaultDelegate;
8426        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8427        dlg.begin(common::MethodInfo {
8428            id: "container.projects.locations.clusters.nodePools.setAutoscaling",
8429            http_method: hyper::Method::POST,
8430        });
8431
8432        for &field in ["alt", "name"].iter() {
8433            if self._additional_params.contains_key(field) {
8434                dlg.finished(false);
8435                return Err(common::Error::FieldClash(field));
8436            }
8437        }
8438
8439        let mut params = Params::with_capacity(4 + self._additional_params.len());
8440        params.push("name", self._name);
8441
8442        params.extend(self._additional_params.iter());
8443
8444        params.push("alt", "json");
8445        let mut url = self.hub._base_url.clone() + "v1/{+name}:setAutoscaling";
8446        if self._scopes.is_empty() {
8447            self._scopes
8448                .insert(Scope::CloudPlatform.as_ref().to_string());
8449        }
8450
8451        #[allow(clippy::single_element_loop)]
8452        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8453            url = params.uri_replacement(url, param_name, find_this, true);
8454        }
8455        {
8456            let to_remove = ["name"];
8457            params.remove_params(&to_remove);
8458        }
8459
8460        let url = params.parse_with_url(&url);
8461
8462        let mut json_mime_type = mime::APPLICATION_JSON;
8463        let mut request_value_reader = {
8464            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8465            common::remove_json_null_values(&mut value);
8466            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8467            serde_json::to_writer(&mut dst, &value).unwrap();
8468            dst
8469        };
8470        let request_size = request_value_reader
8471            .seek(std::io::SeekFrom::End(0))
8472            .unwrap();
8473        request_value_reader
8474            .seek(std::io::SeekFrom::Start(0))
8475            .unwrap();
8476
8477        loop {
8478            let token = match self
8479                .hub
8480                .auth
8481                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8482                .await
8483            {
8484                Ok(token) => token,
8485                Err(e) => match dlg.token(e) {
8486                    Ok(token) => token,
8487                    Err(e) => {
8488                        dlg.finished(false);
8489                        return Err(common::Error::MissingToken(e));
8490                    }
8491                },
8492            };
8493            request_value_reader
8494                .seek(std::io::SeekFrom::Start(0))
8495                .unwrap();
8496            let mut req_result = {
8497                let client = &self.hub.client;
8498                dlg.pre_request();
8499                let mut req_builder = hyper::Request::builder()
8500                    .method(hyper::Method::POST)
8501                    .uri(url.as_str())
8502                    .header(USER_AGENT, self.hub._user_agent.clone());
8503
8504                if let Some(token) = token.as_ref() {
8505                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8506                }
8507
8508                let request = req_builder
8509                    .header(CONTENT_TYPE, json_mime_type.to_string())
8510                    .header(CONTENT_LENGTH, request_size as u64)
8511                    .body(common::to_body(
8512                        request_value_reader.get_ref().clone().into(),
8513                    ));
8514
8515                client.request(request.unwrap()).await
8516            };
8517
8518            match req_result {
8519                Err(err) => {
8520                    if let common::Retry::After(d) = dlg.http_error(&err) {
8521                        sleep(d).await;
8522                        continue;
8523                    }
8524                    dlg.finished(false);
8525                    return Err(common::Error::HttpError(err));
8526                }
8527                Ok(res) => {
8528                    let (mut parts, body) = res.into_parts();
8529                    let mut body = common::Body::new(body);
8530                    if !parts.status.is_success() {
8531                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8532                        let error = serde_json::from_str(&common::to_string(&bytes));
8533                        let response = common::to_response(parts, bytes.into());
8534
8535                        if let common::Retry::After(d) =
8536                            dlg.http_failure(&response, error.as_ref().ok())
8537                        {
8538                            sleep(d).await;
8539                            continue;
8540                        }
8541
8542                        dlg.finished(false);
8543
8544                        return Err(match error {
8545                            Ok(value) => common::Error::BadRequest(value),
8546                            _ => common::Error::Failure(response),
8547                        });
8548                    }
8549                    let response = {
8550                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8551                        let encoded = common::to_string(&bytes);
8552                        match serde_json::from_str(&encoded) {
8553                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8554                            Err(error) => {
8555                                dlg.response_json_decode_error(&encoded, &error);
8556                                return Err(common::Error::JsonDecodeError(
8557                                    encoded.to_string(),
8558                                    error,
8559                                ));
8560                            }
8561                        }
8562                    };
8563
8564                    dlg.finished(true);
8565                    return Ok(response);
8566                }
8567            }
8568        }
8569    }
8570
8571    ///
8572    /// Sets the *request* property to the given value.
8573    ///
8574    /// Even though the property as already been set when instantiating this call,
8575    /// we provide this method for API completeness.
8576    pub fn request(
8577        mut self,
8578        new_value: SetNodePoolAutoscalingRequest,
8579    ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
8580        self._request = new_value;
8581        self
8582    }
8583    /// The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
8584    ///
8585    /// Sets the *name* path property to the given value.
8586    ///
8587    /// Even though the property as already been set when instantiating this call,
8588    /// we provide this method for API completeness.
8589    pub fn name(
8590        mut self,
8591        new_value: &str,
8592    ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
8593        self._name = new_value.to_string();
8594        self
8595    }
8596    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8597    /// while executing the actual API request.
8598    ///
8599    /// ````text
8600    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8601    /// ````
8602    ///
8603    /// Sets the *delegate* property to the given value.
8604    pub fn delegate(
8605        mut self,
8606        new_value: &'a mut dyn common::Delegate,
8607    ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
8608        self._delegate = Some(new_value);
8609        self
8610    }
8611
8612    /// Set any additional parameter of the query string used in the request.
8613    /// It should be used to set parameters which are not yet available through their own
8614    /// setters.
8615    ///
8616    /// Please note that this method must not be used to set any of the known parameters
8617    /// which have their own setter method. If done anyway, the request will fail.
8618    ///
8619    /// # Additional Parameters
8620    ///
8621    /// * *$.xgafv* (query-string) - V1 error format.
8622    /// * *access_token* (query-string) - OAuth access token.
8623    /// * *alt* (query-string) - Data format for response.
8624    /// * *callback* (query-string) - JSONP
8625    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8626    /// * *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.
8627    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8628    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8629    /// * *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.
8630    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8631    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8632    pub fn param<T>(
8633        mut self,
8634        name: T,
8635        value: T,
8636    ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
8637    where
8638        T: AsRef<str>,
8639    {
8640        self._additional_params
8641            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8642        self
8643    }
8644
8645    /// Identifies the authorization scope for the method you are building.
8646    ///
8647    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8648    /// [`Scope::CloudPlatform`].
8649    ///
8650    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8651    /// tokens for more than one scope.
8652    ///
8653    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8654    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8655    /// sufficient, a read-write scope will do as well.
8656    pub fn add_scope<St>(
8657        mut self,
8658        scope: St,
8659    ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
8660    where
8661        St: AsRef<str>,
8662    {
8663        self._scopes.insert(String::from(scope.as_ref()));
8664        self
8665    }
8666    /// Identifies the authorization scope(s) for the method you are building.
8667    ///
8668    /// See [`Self::add_scope()`] for details.
8669    pub fn add_scopes<I, St>(
8670        mut self,
8671        scopes: I,
8672    ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
8673    where
8674        I: IntoIterator<Item = St>,
8675        St: AsRef<str>,
8676    {
8677        self._scopes
8678            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8679        self
8680    }
8681
8682    /// Removes all scopes, and no default scope will be used either.
8683    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8684    /// for details).
8685    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
8686        self._scopes.clear();
8687        self
8688    }
8689}
8690
8691/// Sets the NodeManagement options for a node pool.
8692///
8693/// A builder for the *locations.clusters.nodePools.setManagement* method supported by a *project* resource.
8694/// It is not used directly, but through a [`ProjectMethods`] instance.
8695///
8696/// # Example
8697///
8698/// Instantiate a resource method builder
8699///
8700/// ```test_harness,no_run
8701/// # extern crate hyper;
8702/// # extern crate hyper_rustls;
8703/// # extern crate google_container1 as container1;
8704/// use container1::api::SetNodePoolManagementRequest;
8705/// # async fn dox() {
8706/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8707///
8708/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8709/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
8710/// #     secret,
8711/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8712/// # ).build().await.unwrap();
8713///
8714/// # let client = hyper_util::client::legacy::Client::builder(
8715/// #     hyper_util::rt::TokioExecutor::new()
8716/// # )
8717/// # .build(
8718/// #     hyper_rustls::HttpsConnectorBuilder::new()
8719/// #         .with_native_roots()
8720/// #         .unwrap()
8721/// #         .https_or_http()
8722/// #         .enable_http1()
8723/// #         .build()
8724/// # );
8725/// # let mut hub = Container::new(client, auth);
8726/// // As the method needs a request, you would usually fill it with the desired information
8727/// // into the respective structure. Some of the parts shown here might not be applicable !
8728/// // Values shown here are possibly random and not representative !
8729/// let mut req = SetNodePoolManagementRequest::default();
8730///
8731/// // You can configure optional parameters by calling the respective setters at will, and
8732/// // execute the final call using `doit()`.
8733/// // Values shown here are possibly random and not representative !
8734/// let result = hub.projects().locations_clusters_node_pools_set_management(req, "name")
8735///              .doit().await;
8736/// # }
8737/// ```
8738pub struct ProjectLocationClusterNodePoolSetManagementCall<'a, C>
8739where
8740    C: 'a,
8741{
8742    hub: &'a Container<C>,
8743    _request: SetNodePoolManagementRequest,
8744    _name: String,
8745    _delegate: Option<&'a mut dyn common::Delegate>,
8746    _additional_params: HashMap<String, String>,
8747    _scopes: BTreeSet<String>,
8748}
8749
8750impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetManagementCall<'a, C> {}
8751
8752impl<'a, C> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
8753where
8754    C: common::Connector,
8755{
8756    /// Perform the operation you have build so far.
8757    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8758        use std::borrow::Cow;
8759        use std::io::{Read, Seek};
8760
8761        use common::{url::Params, ToParts};
8762        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8763
8764        let mut dd = common::DefaultDelegate;
8765        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8766        dlg.begin(common::MethodInfo {
8767            id: "container.projects.locations.clusters.nodePools.setManagement",
8768            http_method: hyper::Method::POST,
8769        });
8770
8771        for &field in ["alt", "name"].iter() {
8772            if self._additional_params.contains_key(field) {
8773                dlg.finished(false);
8774                return Err(common::Error::FieldClash(field));
8775            }
8776        }
8777
8778        let mut params = Params::with_capacity(4 + self._additional_params.len());
8779        params.push("name", self._name);
8780
8781        params.extend(self._additional_params.iter());
8782
8783        params.push("alt", "json");
8784        let mut url = self.hub._base_url.clone() + "v1/{+name}:setManagement";
8785        if self._scopes.is_empty() {
8786            self._scopes
8787                .insert(Scope::CloudPlatform.as_ref().to_string());
8788        }
8789
8790        #[allow(clippy::single_element_loop)]
8791        for &(find_this, param_name) in [("{+name}", "name")].iter() {
8792            url = params.uri_replacement(url, param_name, find_this, true);
8793        }
8794        {
8795            let to_remove = ["name"];
8796            params.remove_params(&to_remove);
8797        }
8798
8799        let url = params.parse_with_url(&url);
8800
8801        let mut json_mime_type = mime::APPLICATION_JSON;
8802        let mut request_value_reader = {
8803            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8804            common::remove_json_null_values(&mut value);
8805            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8806            serde_json::to_writer(&mut dst, &value).unwrap();
8807            dst
8808        };
8809        let request_size = request_value_reader
8810            .seek(std::io::SeekFrom::End(0))
8811            .unwrap();
8812        request_value_reader
8813            .seek(std::io::SeekFrom::Start(0))
8814            .unwrap();
8815
8816        loop {
8817            let token = match self
8818                .hub
8819                .auth
8820                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8821                .await
8822            {
8823                Ok(token) => token,
8824                Err(e) => match dlg.token(e) {
8825                    Ok(token) => token,
8826                    Err(e) => {
8827                        dlg.finished(false);
8828                        return Err(common::Error::MissingToken(e));
8829                    }
8830                },
8831            };
8832            request_value_reader
8833                .seek(std::io::SeekFrom::Start(0))
8834                .unwrap();
8835            let mut req_result = {
8836                let client = &self.hub.client;
8837                dlg.pre_request();
8838                let mut req_builder = hyper::Request::builder()
8839                    .method(hyper::Method::POST)
8840                    .uri(url.as_str())
8841                    .header(USER_AGENT, self.hub._user_agent.clone());
8842
8843                if let Some(token) = token.as_ref() {
8844                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8845                }
8846
8847                let request = req_builder
8848                    .header(CONTENT_TYPE, json_mime_type.to_string())
8849                    .header(CONTENT_LENGTH, request_size as u64)
8850                    .body(common::to_body(
8851                        request_value_reader.get_ref().clone().into(),
8852                    ));
8853
8854                client.request(request.unwrap()).await
8855            };
8856
8857            match req_result {
8858                Err(err) => {
8859                    if let common::Retry::After(d) = dlg.http_error(&err) {
8860                        sleep(d).await;
8861                        continue;
8862                    }
8863                    dlg.finished(false);
8864                    return Err(common::Error::HttpError(err));
8865                }
8866                Ok(res) => {
8867                    let (mut parts, body) = res.into_parts();
8868                    let mut body = common::Body::new(body);
8869                    if !parts.status.is_success() {
8870                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8871                        let error = serde_json::from_str(&common::to_string(&bytes));
8872                        let response = common::to_response(parts, bytes.into());
8873
8874                        if let common::Retry::After(d) =
8875                            dlg.http_failure(&response, error.as_ref().ok())
8876                        {
8877                            sleep(d).await;
8878                            continue;
8879                        }
8880
8881                        dlg.finished(false);
8882
8883                        return Err(match error {
8884                            Ok(value) => common::Error::BadRequest(value),
8885                            _ => common::Error::Failure(response),
8886                        });
8887                    }
8888                    let response = {
8889                        let bytes = common::to_bytes(body).await.unwrap_or_default();
8890                        let encoded = common::to_string(&bytes);
8891                        match serde_json::from_str(&encoded) {
8892                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8893                            Err(error) => {
8894                                dlg.response_json_decode_error(&encoded, &error);
8895                                return Err(common::Error::JsonDecodeError(
8896                                    encoded.to_string(),
8897                                    error,
8898                                ));
8899                            }
8900                        }
8901                    };
8902
8903                    dlg.finished(true);
8904                    return Ok(response);
8905                }
8906            }
8907        }
8908    }
8909
8910    ///
8911    /// Sets the *request* property to the given value.
8912    ///
8913    /// Even though the property as already been set when instantiating this call,
8914    /// we provide this method for API completeness.
8915    pub fn request(
8916        mut self,
8917        new_value: SetNodePoolManagementRequest,
8918    ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
8919        self._request = new_value;
8920        self
8921    }
8922    /// The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
8923    ///
8924    /// Sets the *name* path property to the given value.
8925    ///
8926    /// Even though the property as already been set when instantiating this call,
8927    /// we provide this method for API completeness.
8928    pub fn name(
8929        mut self,
8930        new_value: &str,
8931    ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
8932        self._name = new_value.to_string();
8933        self
8934    }
8935    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8936    /// while executing the actual API request.
8937    ///
8938    /// ````text
8939    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
8940    /// ````
8941    ///
8942    /// Sets the *delegate* property to the given value.
8943    pub fn delegate(
8944        mut self,
8945        new_value: &'a mut dyn common::Delegate,
8946    ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
8947        self._delegate = Some(new_value);
8948        self
8949    }
8950
8951    /// Set any additional parameter of the query string used in the request.
8952    /// It should be used to set parameters which are not yet available through their own
8953    /// setters.
8954    ///
8955    /// Please note that this method must not be used to set any of the known parameters
8956    /// which have their own setter method. If done anyway, the request will fail.
8957    ///
8958    /// # Additional Parameters
8959    ///
8960    /// * *$.xgafv* (query-string) - V1 error format.
8961    /// * *access_token* (query-string) - OAuth access token.
8962    /// * *alt* (query-string) - Data format for response.
8963    /// * *callback* (query-string) - JSONP
8964    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8965    /// * *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.
8966    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8967    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8968    /// * *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.
8969    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8970    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8971    pub fn param<T>(
8972        mut self,
8973        name: T,
8974        value: T,
8975    ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
8976    where
8977        T: AsRef<str>,
8978    {
8979        self._additional_params
8980            .insert(name.as_ref().to_string(), value.as_ref().to_string());
8981        self
8982    }
8983
8984    /// Identifies the authorization scope for the method you are building.
8985    ///
8986    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8987    /// [`Scope::CloudPlatform`].
8988    ///
8989    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8990    /// tokens for more than one scope.
8991    ///
8992    /// Usually there is more than one suitable scope to authorize an operation, some of which may
8993    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8994    /// sufficient, a read-write scope will do as well.
8995    pub fn add_scope<St>(
8996        mut self,
8997        scope: St,
8998    ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
8999    where
9000        St: AsRef<str>,
9001    {
9002        self._scopes.insert(String::from(scope.as_ref()));
9003        self
9004    }
9005    /// Identifies the authorization scope(s) for the method you are building.
9006    ///
9007    /// See [`Self::add_scope()`] for details.
9008    pub fn add_scopes<I, St>(
9009        mut self,
9010        scopes: I,
9011    ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
9012    where
9013        I: IntoIterator<Item = St>,
9014        St: AsRef<str>,
9015    {
9016        self._scopes
9017            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9018        self
9019    }
9020
9021    /// Removes all scopes, and no default scope will be used either.
9022    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9023    /// for details).
9024    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
9025        self._scopes.clear();
9026        self
9027    }
9028}
9029
9030/// Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
9031///
9032/// A builder for the *locations.clusters.nodePools.setSize* method supported by a *project* resource.
9033/// It is not used directly, but through a [`ProjectMethods`] instance.
9034///
9035/// # Example
9036///
9037/// Instantiate a resource method builder
9038///
9039/// ```test_harness,no_run
9040/// # extern crate hyper;
9041/// # extern crate hyper_rustls;
9042/// # extern crate google_container1 as container1;
9043/// use container1::api::SetNodePoolSizeRequest;
9044/// # async fn dox() {
9045/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9046///
9047/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9048/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9049/// #     secret,
9050/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9051/// # ).build().await.unwrap();
9052///
9053/// # let client = hyper_util::client::legacy::Client::builder(
9054/// #     hyper_util::rt::TokioExecutor::new()
9055/// # )
9056/// # .build(
9057/// #     hyper_rustls::HttpsConnectorBuilder::new()
9058/// #         .with_native_roots()
9059/// #         .unwrap()
9060/// #         .https_or_http()
9061/// #         .enable_http1()
9062/// #         .build()
9063/// # );
9064/// # let mut hub = Container::new(client, auth);
9065/// // As the method needs a request, you would usually fill it with the desired information
9066/// // into the respective structure. Some of the parts shown here might not be applicable !
9067/// // Values shown here are possibly random and not representative !
9068/// let mut req = SetNodePoolSizeRequest::default();
9069///
9070/// // You can configure optional parameters by calling the respective setters at will, and
9071/// // execute the final call using `doit()`.
9072/// // Values shown here are possibly random and not representative !
9073/// let result = hub.projects().locations_clusters_node_pools_set_size(req, "name")
9074///              .doit().await;
9075/// # }
9076/// ```
9077pub struct ProjectLocationClusterNodePoolSetSizeCall<'a, C>
9078where
9079    C: 'a,
9080{
9081    hub: &'a Container<C>,
9082    _request: SetNodePoolSizeRequest,
9083    _name: String,
9084    _delegate: Option<&'a mut dyn common::Delegate>,
9085    _additional_params: HashMap<String, String>,
9086    _scopes: BTreeSet<String>,
9087}
9088
9089impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetSizeCall<'a, C> {}
9090
9091impl<'a, C> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
9092where
9093    C: common::Connector,
9094{
9095    /// Perform the operation you have build so far.
9096    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9097        use std::borrow::Cow;
9098        use std::io::{Read, Seek};
9099
9100        use common::{url::Params, ToParts};
9101        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9102
9103        let mut dd = common::DefaultDelegate;
9104        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9105        dlg.begin(common::MethodInfo {
9106            id: "container.projects.locations.clusters.nodePools.setSize",
9107            http_method: hyper::Method::POST,
9108        });
9109
9110        for &field in ["alt", "name"].iter() {
9111            if self._additional_params.contains_key(field) {
9112                dlg.finished(false);
9113                return Err(common::Error::FieldClash(field));
9114            }
9115        }
9116
9117        let mut params = Params::with_capacity(4 + self._additional_params.len());
9118        params.push("name", self._name);
9119
9120        params.extend(self._additional_params.iter());
9121
9122        params.push("alt", "json");
9123        let mut url = self.hub._base_url.clone() + "v1/{+name}:setSize";
9124        if self._scopes.is_empty() {
9125            self._scopes
9126                .insert(Scope::CloudPlatform.as_ref().to_string());
9127        }
9128
9129        #[allow(clippy::single_element_loop)]
9130        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9131            url = params.uri_replacement(url, param_name, find_this, true);
9132        }
9133        {
9134            let to_remove = ["name"];
9135            params.remove_params(&to_remove);
9136        }
9137
9138        let url = params.parse_with_url(&url);
9139
9140        let mut json_mime_type = mime::APPLICATION_JSON;
9141        let mut request_value_reader = {
9142            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9143            common::remove_json_null_values(&mut value);
9144            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9145            serde_json::to_writer(&mut dst, &value).unwrap();
9146            dst
9147        };
9148        let request_size = request_value_reader
9149            .seek(std::io::SeekFrom::End(0))
9150            .unwrap();
9151        request_value_reader
9152            .seek(std::io::SeekFrom::Start(0))
9153            .unwrap();
9154
9155        loop {
9156            let token = match self
9157                .hub
9158                .auth
9159                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9160                .await
9161            {
9162                Ok(token) => token,
9163                Err(e) => match dlg.token(e) {
9164                    Ok(token) => token,
9165                    Err(e) => {
9166                        dlg.finished(false);
9167                        return Err(common::Error::MissingToken(e));
9168                    }
9169                },
9170            };
9171            request_value_reader
9172                .seek(std::io::SeekFrom::Start(0))
9173                .unwrap();
9174            let mut req_result = {
9175                let client = &self.hub.client;
9176                dlg.pre_request();
9177                let mut req_builder = hyper::Request::builder()
9178                    .method(hyper::Method::POST)
9179                    .uri(url.as_str())
9180                    .header(USER_AGENT, self.hub._user_agent.clone());
9181
9182                if let Some(token) = token.as_ref() {
9183                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9184                }
9185
9186                let request = req_builder
9187                    .header(CONTENT_TYPE, json_mime_type.to_string())
9188                    .header(CONTENT_LENGTH, request_size as u64)
9189                    .body(common::to_body(
9190                        request_value_reader.get_ref().clone().into(),
9191                    ));
9192
9193                client.request(request.unwrap()).await
9194            };
9195
9196            match req_result {
9197                Err(err) => {
9198                    if let common::Retry::After(d) = dlg.http_error(&err) {
9199                        sleep(d).await;
9200                        continue;
9201                    }
9202                    dlg.finished(false);
9203                    return Err(common::Error::HttpError(err));
9204                }
9205                Ok(res) => {
9206                    let (mut parts, body) = res.into_parts();
9207                    let mut body = common::Body::new(body);
9208                    if !parts.status.is_success() {
9209                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9210                        let error = serde_json::from_str(&common::to_string(&bytes));
9211                        let response = common::to_response(parts, bytes.into());
9212
9213                        if let common::Retry::After(d) =
9214                            dlg.http_failure(&response, error.as_ref().ok())
9215                        {
9216                            sleep(d).await;
9217                            continue;
9218                        }
9219
9220                        dlg.finished(false);
9221
9222                        return Err(match error {
9223                            Ok(value) => common::Error::BadRequest(value),
9224                            _ => common::Error::Failure(response),
9225                        });
9226                    }
9227                    let response = {
9228                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9229                        let encoded = common::to_string(&bytes);
9230                        match serde_json::from_str(&encoded) {
9231                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9232                            Err(error) => {
9233                                dlg.response_json_decode_error(&encoded, &error);
9234                                return Err(common::Error::JsonDecodeError(
9235                                    encoded.to_string(),
9236                                    error,
9237                                ));
9238                            }
9239                        }
9240                    };
9241
9242                    dlg.finished(true);
9243                    return Ok(response);
9244                }
9245            }
9246        }
9247    }
9248
9249    ///
9250    /// Sets the *request* property to the given value.
9251    ///
9252    /// Even though the property as already been set when instantiating this call,
9253    /// we provide this method for API completeness.
9254    pub fn request(
9255        mut self,
9256        new_value: SetNodePoolSizeRequest,
9257    ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
9258        self._request = new_value;
9259        self
9260    }
9261    /// The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
9262    ///
9263    /// Sets the *name* path property to the given value.
9264    ///
9265    /// Even though the property as already been set when instantiating this call,
9266    /// we provide this method for API completeness.
9267    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
9268        self._name = new_value.to_string();
9269        self
9270    }
9271    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9272    /// while executing the actual API request.
9273    ///
9274    /// ````text
9275    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9276    /// ````
9277    ///
9278    /// Sets the *delegate* property to the given value.
9279    pub fn delegate(
9280        mut self,
9281        new_value: &'a mut dyn common::Delegate,
9282    ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
9283        self._delegate = Some(new_value);
9284        self
9285    }
9286
9287    /// Set any additional parameter of the query string used in the request.
9288    /// It should be used to set parameters which are not yet available through their own
9289    /// setters.
9290    ///
9291    /// Please note that this method must not be used to set any of the known parameters
9292    /// which have their own setter method. If done anyway, the request will fail.
9293    ///
9294    /// # Additional Parameters
9295    ///
9296    /// * *$.xgafv* (query-string) - V1 error format.
9297    /// * *access_token* (query-string) - OAuth access token.
9298    /// * *alt* (query-string) - Data format for response.
9299    /// * *callback* (query-string) - JSONP
9300    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9301    /// * *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.
9302    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9303    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9304    /// * *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.
9305    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9306    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9307    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
9308    where
9309        T: AsRef<str>,
9310    {
9311        self._additional_params
9312            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9313        self
9314    }
9315
9316    /// Identifies the authorization scope for the method you are building.
9317    ///
9318    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9319    /// [`Scope::CloudPlatform`].
9320    ///
9321    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9322    /// tokens for more than one scope.
9323    ///
9324    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9325    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9326    /// sufficient, a read-write scope will do as well.
9327    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
9328    where
9329        St: AsRef<str>,
9330    {
9331        self._scopes.insert(String::from(scope.as_ref()));
9332        self
9333    }
9334    /// Identifies the authorization scope(s) for the method you are building.
9335    ///
9336    /// See [`Self::add_scope()`] for details.
9337    pub fn add_scopes<I, St>(
9338        mut self,
9339        scopes: I,
9340    ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
9341    where
9342        I: IntoIterator<Item = St>,
9343        St: AsRef<str>,
9344    {
9345        self._scopes
9346            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9347        self
9348    }
9349
9350    /// Removes all scopes, and no default scope will be used either.
9351    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9352    /// for details).
9353    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
9354        self._scopes.clear();
9355        self
9356    }
9357}
9358
9359/// Updates the version and/or image type for the specified node pool.
9360///
9361/// A builder for the *locations.clusters.nodePools.update* method supported by a *project* resource.
9362/// It is not used directly, but through a [`ProjectMethods`] instance.
9363///
9364/// # Example
9365///
9366/// Instantiate a resource method builder
9367///
9368/// ```test_harness,no_run
9369/// # extern crate hyper;
9370/// # extern crate hyper_rustls;
9371/// # extern crate google_container1 as container1;
9372/// use container1::api::UpdateNodePoolRequest;
9373/// # async fn dox() {
9374/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9375///
9376/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9377/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9378/// #     secret,
9379/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9380/// # ).build().await.unwrap();
9381///
9382/// # let client = hyper_util::client::legacy::Client::builder(
9383/// #     hyper_util::rt::TokioExecutor::new()
9384/// # )
9385/// # .build(
9386/// #     hyper_rustls::HttpsConnectorBuilder::new()
9387/// #         .with_native_roots()
9388/// #         .unwrap()
9389/// #         .https_or_http()
9390/// #         .enable_http1()
9391/// #         .build()
9392/// # );
9393/// # let mut hub = Container::new(client, auth);
9394/// // As the method needs a request, you would usually fill it with the desired information
9395/// // into the respective structure. Some of the parts shown here might not be applicable !
9396/// // Values shown here are possibly random and not representative !
9397/// let mut req = UpdateNodePoolRequest::default();
9398///
9399/// // You can configure optional parameters by calling the respective setters at will, and
9400/// // execute the final call using `doit()`.
9401/// // Values shown here are possibly random and not representative !
9402/// let result = hub.projects().locations_clusters_node_pools_update(req, "name")
9403///              .doit().await;
9404/// # }
9405/// ```
9406pub struct ProjectLocationClusterNodePoolUpdateCall<'a, C>
9407where
9408    C: 'a,
9409{
9410    hub: &'a Container<C>,
9411    _request: UpdateNodePoolRequest,
9412    _name: String,
9413    _delegate: Option<&'a mut dyn common::Delegate>,
9414    _additional_params: HashMap<String, String>,
9415    _scopes: BTreeSet<String>,
9416}
9417
9418impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolUpdateCall<'a, C> {}
9419
9420impl<'a, C> ProjectLocationClusterNodePoolUpdateCall<'a, C>
9421where
9422    C: common::Connector,
9423{
9424    /// Perform the operation you have build so far.
9425    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
9426        use std::borrow::Cow;
9427        use std::io::{Read, Seek};
9428
9429        use common::{url::Params, ToParts};
9430        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9431
9432        let mut dd = common::DefaultDelegate;
9433        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9434        dlg.begin(common::MethodInfo {
9435            id: "container.projects.locations.clusters.nodePools.update",
9436            http_method: hyper::Method::PUT,
9437        });
9438
9439        for &field in ["alt", "name"].iter() {
9440            if self._additional_params.contains_key(field) {
9441                dlg.finished(false);
9442                return Err(common::Error::FieldClash(field));
9443            }
9444        }
9445
9446        let mut params = Params::with_capacity(4 + self._additional_params.len());
9447        params.push("name", self._name);
9448
9449        params.extend(self._additional_params.iter());
9450
9451        params.push("alt", "json");
9452        let mut url = self.hub._base_url.clone() + "v1/{+name}";
9453        if self._scopes.is_empty() {
9454            self._scopes
9455                .insert(Scope::CloudPlatform.as_ref().to_string());
9456        }
9457
9458        #[allow(clippy::single_element_loop)]
9459        for &(find_this, param_name) in [("{+name}", "name")].iter() {
9460            url = params.uri_replacement(url, param_name, find_this, true);
9461        }
9462        {
9463            let to_remove = ["name"];
9464            params.remove_params(&to_remove);
9465        }
9466
9467        let url = params.parse_with_url(&url);
9468
9469        let mut json_mime_type = mime::APPLICATION_JSON;
9470        let mut request_value_reader = {
9471            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9472            common::remove_json_null_values(&mut value);
9473            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9474            serde_json::to_writer(&mut dst, &value).unwrap();
9475            dst
9476        };
9477        let request_size = request_value_reader
9478            .seek(std::io::SeekFrom::End(0))
9479            .unwrap();
9480        request_value_reader
9481            .seek(std::io::SeekFrom::Start(0))
9482            .unwrap();
9483
9484        loop {
9485            let token = match self
9486                .hub
9487                .auth
9488                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9489                .await
9490            {
9491                Ok(token) => token,
9492                Err(e) => match dlg.token(e) {
9493                    Ok(token) => token,
9494                    Err(e) => {
9495                        dlg.finished(false);
9496                        return Err(common::Error::MissingToken(e));
9497                    }
9498                },
9499            };
9500            request_value_reader
9501                .seek(std::io::SeekFrom::Start(0))
9502                .unwrap();
9503            let mut req_result = {
9504                let client = &self.hub.client;
9505                dlg.pre_request();
9506                let mut req_builder = hyper::Request::builder()
9507                    .method(hyper::Method::PUT)
9508                    .uri(url.as_str())
9509                    .header(USER_AGENT, self.hub._user_agent.clone());
9510
9511                if let Some(token) = token.as_ref() {
9512                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9513                }
9514
9515                let request = req_builder
9516                    .header(CONTENT_TYPE, json_mime_type.to_string())
9517                    .header(CONTENT_LENGTH, request_size as u64)
9518                    .body(common::to_body(
9519                        request_value_reader.get_ref().clone().into(),
9520                    ));
9521
9522                client.request(request.unwrap()).await
9523            };
9524
9525            match req_result {
9526                Err(err) => {
9527                    if let common::Retry::After(d) = dlg.http_error(&err) {
9528                        sleep(d).await;
9529                        continue;
9530                    }
9531                    dlg.finished(false);
9532                    return Err(common::Error::HttpError(err));
9533                }
9534                Ok(res) => {
9535                    let (mut parts, body) = res.into_parts();
9536                    let mut body = common::Body::new(body);
9537                    if !parts.status.is_success() {
9538                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9539                        let error = serde_json::from_str(&common::to_string(&bytes));
9540                        let response = common::to_response(parts, bytes.into());
9541
9542                        if let common::Retry::After(d) =
9543                            dlg.http_failure(&response, error.as_ref().ok())
9544                        {
9545                            sleep(d).await;
9546                            continue;
9547                        }
9548
9549                        dlg.finished(false);
9550
9551                        return Err(match error {
9552                            Ok(value) => common::Error::BadRequest(value),
9553                            _ => common::Error::Failure(response),
9554                        });
9555                    }
9556                    let response = {
9557                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9558                        let encoded = common::to_string(&bytes);
9559                        match serde_json::from_str(&encoded) {
9560                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9561                            Err(error) => {
9562                                dlg.response_json_decode_error(&encoded, &error);
9563                                return Err(common::Error::JsonDecodeError(
9564                                    encoded.to_string(),
9565                                    error,
9566                                ));
9567                            }
9568                        }
9569                    };
9570
9571                    dlg.finished(true);
9572                    return Ok(response);
9573                }
9574            }
9575        }
9576    }
9577
9578    ///
9579    /// Sets the *request* property to the given value.
9580    ///
9581    /// Even though the property as already been set when instantiating this call,
9582    /// we provide this method for API completeness.
9583    pub fn request(
9584        mut self,
9585        new_value: UpdateNodePoolRequest,
9586    ) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
9587        self._request = new_value;
9588        self
9589    }
9590    /// The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
9591    ///
9592    /// Sets the *name* path property to the given value.
9593    ///
9594    /// Even though the property as already been set when instantiating this call,
9595    /// we provide this method for API completeness.
9596    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
9597        self._name = new_value.to_string();
9598        self
9599    }
9600    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9601    /// while executing the actual API request.
9602    ///
9603    /// ````text
9604    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9605    /// ````
9606    ///
9607    /// Sets the *delegate* property to the given value.
9608    pub fn delegate(
9609        mut self,
9610        new_value: &'a mut dyn common::Delegate,
9611    ) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
9612        self._delegate = Some(new_value);
9613        self
9614    }
9615
9616    /// Set any additional parameter of the query string used in the request.
9617    /// It should be used to set parameters which are not yet available through their own
9618    /// setters.
9619    ///
9620    /// Please note that this method must not be used to set any of the known parameters
9621    /// which have their own setter method. If done anyway, the request will fail.
9622    ///
9623    /// # Additional Parameters
9624    ///
9625    /// * *$.xgafv* (query-string) - V1 error format.
9626    /// * *access_token* (query-string) - OAuth access token.
9627    /// * *alt* (query-string) - Data format for response.
9628    /// * *callback* (query-string) - JSONP
9629    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9630    /// * *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.
9631    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9632    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9633    /// * *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.
9634    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9635    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9636    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
9637    where
9638        T: AsRef<str>,
9639    {
9640        self._additional_params
9641            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9642        self
9643    }
9644
9645    /// Identifies the authorization scope for the method you are building.
9646    ///
9647    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9648    /// [`Scope::CloudPlatform`].
9649    ///
9650    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9651    /// tokens for more than one scope.
9652    ///
9653    /// Usually there is more than one suitable scope to authorize an operation, some of which may
9654    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9655    /// sufficient, a read-write scope will do as well.
9656    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
9657    where
9658        St: AsRef<str>,
9659    {
9660        self._scopes.insert(String::from(scope.as_ref()));
9661        self
9662    }
9663    /// Identifies the authorization scope(s) for the method you are building.
9664    ///
9665    /// See [`Self::add_scope()`] for details.
9666    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
9667    where
9668        I: IntoIterator<Item = St>,
9669        St: AsRef<str>,
9670    {
9671        self._scopes
9672            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9673        self
9674    }
9675
9676    /// Removes all scopes, and no default scope will be used either.
9677    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9678    /// for details).
9679    pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
9680        self._scopes.clear();
9681        self
9682    }
9683}
9684
9685/// Gets the OIDC discovery document for the cluster. See the [OpenID Connect Discovery 1.0 specification](https://openid.net/specs/openid-connect-discovery-1_0.html) for details.
9686///
9687/// A builder for the *locations.clusters.well-known.getOpenid-configuration* method supported by a *project* resource.
9688/// It is not used directly, but through a [`ProjectMethods`] instance.
9689///
9690/// # Example
9691///
9692/// Instantiate a resource method builder
9693///
9694/// ```test_harness,no_run
9695/// # extern crate hyper;
9696/// # extern crate hyper_rustls;
9697/// # extern crate google_container1 as container1;
9698/// # async fn dox() {
9699/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9700///
9701/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9702/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9703/// #     secret,
9704/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9705/// # ).build().await.unwrap();
9706///
9707/// # let client = hyper_util::client::legacy::Client::builder(
9708/// #     hyper_util::rt::TokioExecutor::new()
9709/// # )
9710/// # .build(
9711/// #     hyper_rustls::HttpsConnectorBuilder::new()
9712/// #         .with_native_roots()
9713/// #         .unwrap()
9714/// #         .https_or_http()
9715/// #         .enable_http1()
9716/// #         .build()
9717/// # );
9718/// # let mut hub = Container::new(client, auth);
9719/// // You can configure optional parameters by calling the respective setters at will, and
9720/// // execute the final call using `doit()`.
9721/// // Values shown here are possibly random and not representative !
9722/// let result = hub.projects().locations_clusters_well_known_get_openid_configuration("parent")
9723///              .doit().await;
9724/// # }
9725/// ```
9726pub struct ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
9727where
9728    C: 'a,
9729{
9730    hub: &'a Container<C>,
9731    _parent: String,
9732    _delegate: Option<&'a mut dyn common::Delegate>,
9733    _additional_params: HashMap<String, String>,
9734}
9735
9736impl<'a, C> common::CallBuilder
9737    for ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
9738{
9739}
9740
9741impl<'a, C> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
9742where
9743    C: common::Connector,
9744{
9745    /// Perform the operation you have build so far.
9746    pub async fn doit(mut self) -> common::Result<(common::Response, GetOpenIDConfigResponse)> {
9747        use std::borrow::Cow;
9748        use std::io::{Read, Seek};
9749
9750        use common::{url::Params, ToParts};
9751        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9752
9753        let mut dd = common::DefaultDelegate;
9754        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9755        dlg.begin(common::MethodInfo {
9756            id: "container.projects.locations.clusters.well-known.getOpenid-configuration",
9757            http_method: hyper::Method::GET,
9758        });
9759
9760        for &field in ["alt", "parent"].iter() {
9761            if self._additional_params.contains_key(field) {
9762                dlg.finished(false);
9763                return Err(common::Error::FieldClash(field));
9764            }
9765        }
9766
9767        let mut params = Params::with_capacity(3 + self._additional_params.len());
9768        params.push("parent", self._parent);
9769
9770        params.extend(self._additional_params.iter());
9771
9772        params.push("alt", "json");
9773        let mut url = self.hub._base_url.clone() + "v1/{+parent}/.well-known/openid-configuration";
9774
9775        match dlg.api_key() {
9776            Some(value) => params.push("key", value),
9777            None => {
9778                dlg.finished(false);
9779                return Err(common::Error::MissingAPIKey);
9780            }
9781        }
9782
9783        #[allow(clippy::single_element_loop)]
9784        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9785            url = params.uri_replacement(url, param_name, find_this, true);
9786        }
9787        {
9788            let to_remove = ["parent"];
9789            params.remove_params(&to_remove);
9790        }
9791
9792        let url = params.parse_with_url(&url);
9793
9794        loop {
9795            let mut req_result = {
9796                let client = &self.hub.client;
9797                dlg.pre_request();
9798                let mut req_builder = hyper::Request::builder()
9799                    .method(hyper::Method::GET)
9800                    .uri(url.as_str())
9801                    .header(USER_AGENT, self.hub._user_agent.clone());
9802
9803                let request = req_builder
9804                    .header(CONTENT_LENGTH, 0_u64)
9805                    .body(common::to_body::<String>(None));
9806
9807                client.request(request.unwrap()).await
9808            };
9809
9810            match req_result {
9811                Err(err) => {
9812                    if let common::Retry::After(d) = dlg.http_error(&err) {
9813                        sleep(d).await;
9814                        continue;
9815                    }
9816                    dlg.finished(false);
9817                    return Err(common::Error::HttpError(err));
9818                }
9819                Ok(res) => {
9820                    let (mut parts, body) = res.into_parts();
9821                    let mut body = common::Body::new(body);
9822                    if !parts.status.is_success() {
9823                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9824                        let error = serde_json::from_str(&common::to_string(&bytes));
9825                        let response = common::to_response(parts, bytes.into());
9826
9827                        if let common::Retry::After(d) =
9828                            dlg.http_failure(&response, error.as_ref().ok())
9829                        {
9830                            sleep(d).await;
9831                            continue;
9832                        }
9833
9834                        dlg.finished(false);
9835
9836                        return Err(match error {
9837                            Ok(value) => common::Error::BadRequest(value),
9838                            _ => common::Error::Failure(response),
9839                        });
9840                    }
9841                    let response = {
9842                        let bytes = common::to_bytes(body).await.unwrap_or_default();
9843                        let encoded = common::to_string(&bytes);
9844                        match serde_json::from_str(&encoded) {
9845                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9846                            Err(error) => {
9847                                dlg.response_json_decode_error(&encoded, &error);
9848                                return Err(common::Error::JsonDecodeError(
9849                                    encoded.to_string(),
9850                                    error,
9851                                ));
9852                            }
9853                        }
9854                    };
9855
9856                    dlg.finished(true);
9857                    return Ok(response);
9858                }
9859            }
9860        }
9861    }
9862
9863    /// The cluster (project, location, cluster name) to get the discovery document for. Specified in the format `projects/*/locations/*/clusters/*`.
9864    ///
9865    /// Sets the *parent* path property to the given value.
9866    ///
9867    /// Even though the property as already been set when instantiating this call,
9868    /// we provide this method for API completeness.
9869    pub fn parent(
9870        mut self,
9871        new_value: &str,
9872    ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
9873        self._parent = new_value.to_string();
9874        self
9875    }
9876    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9877    /// while executing the actual API request.
9878    ///
9879    /// ````text
9880    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
9881    /// ````
9882    ///
9883    /// Sets the *delegate* property to the given value.
9884    pub fn delegate(
9885        mut self,
9886        new_value: &'a mut dyn common::Delegate,
9887    ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
9888        self._delegate = Some(new_value);
9889        self
9890    }
9891
9892    /// Set any additional parameter of the query string used in the request.
9893    /// It should be used to set parameters which are not yet available through their own
9894    /// setters.
9895    ///
9896    /// Please note that this method must not be used to set any of the known parameters
9897    /// which have their own setter method. If done anyway, the request will fail.
9898    ///
9899    /// # Additional Parameters
9900    ///
9901    /// * *$.xgafv* (query-string) - V1 error format.
9902    /// * *access_token* (query-string) - OAuth access token.
9903    /// * *alt* (query-string) - Data format for response.
9904    /// * *callback* (query-string) - JSONP
9905    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9906    /// * *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.
9907    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9908    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9909    /// * *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.
9910    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9911    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9912    pub fn param<T>(
9913        mut self,
9914        name: T,
9915        value: T,
9916    ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
9917    where
9918        T: AsRef<str>,
9919    {
9920        self._additional_params
9921            .insert(name.as_ref().to_string(), value.as_ref().to_string());
9922        self
9923    }
9924}
9925
9926/// Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.
9927///
9928/// A builder for the *locations.clusters.checkAutopilotCompatibility* method supported by a *project* resource.
9929/// It is not used directly, but through a [`ProjectMethods`] instance.
9930///
9931/// # Example
9932///
9933/// Instantiate a resource method builder
9934///
9935/// ```test_harness,no_run
9936/// # extern crate hyper;
9937/// # extern crate hyper_rustls;
9938/// # extern crate google_container1 as container1;
9939/// # async fn dox() {
9940/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9941///
9942/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9943/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
9944/// #     secret,
9945/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
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_http1()
9957/// #         .build()
9958/// # );
9959/// # let mut hub = Container::new(client, auth);
9960/// // You can configure optional parameters by calling the respective setters at will, and
9961/// // execute the final call using `doit()`.
9962/// // Values shown here are possibly random and not representative !
9963/// let result = hub.projects().locations_clusters_check_autopilot_compatibility("name")
9964///              .doit().await;
9965/// # }
9966/// ```
9967pub struct ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
9968where
9969    C: 'a,
9970{
9971    hub: &'a Container<C>,
9972    _name: String,
9973    _delegate: Option<&'a mut dyn common::Delegate>,
9974    _additional_params: HashMap<String, String>,
9975    _scopes: BTreeSet<String>,
9976}
9977
9978impl<'a, C> common::CallBuilder for ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {}
9979
9980impl<'a, C> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
9981where
9982    C: common::Connector,
9983{
9984    /// Perform the operation you have build so far.
9985    pub async fn doit(
9986        mut self,
9987    ) -> common::Result<(common::Response, CheckAutopilotCompatibilityResponse)> {
9988        use std::borrow::Cow;
9989        use std::io::{Read, Seek};
9990
9991        use common::{url::Params, ToParts};
9992        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9993
9994        let mut dd = common::DefaultDelegate;
9995        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9996        dlg.begin(common::MethodInfo {
9997            id: "container.projects.locations.clusters.checkAutopilotCompatibility",
9998            http_method: hyper::Method::GET,
9999        });
10000
10001        for &field in ["alt", "name"].iter() {
10002            if self._additional_params.contains_key(field) {
10003                dlg.finished(false);
10004                return Err(common::Error::FieldClash(field));
10005            }
10006        }
10007
10008        let mut params = Params::with_capacity(3 + self._additional_params.len());
10009        params.push("name", self._name);
10010
10011        params.extend(self._additional_params.iter());
10012
10013        params.push("alt", "json");
10014        let mut url = self.hub._base_url.clone() + "v1/{+name}:checkAutopilotCompatibility";
10015        if self._scopes.is_empty() {
10016            self._scopes
10017                .insert(Scope::CloudPlatform.as_ref().to_string());
10018        }
10019
10020        #[allow(clippy::single_element_loop)]
10021        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10022            url = params.uri_replacement(url, param_name, find_this, true);
10023        }
10024        {
10025            let to_remove = ["name"];
10026            params.remove_params(&to_remove);
10027        }
10028
10029        let url = params.parse_with_url(&url);
10030
10031        loop {
10032            let token = match self
10033                .hub
10034                .auth
10035                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10036                .await
10037            {
10038                Ok(token) => token,
10039                Err(e) => match dlg.token(e) {
10040                    Ok(token) => token,
10041                    Err(e) => {
10042                        dlg.finished(false);
10043                        return Err(common::Error::MissingToken(e));
10044                    }
10045                },
10046            };
10047            let mut req_result = {
10048                let client = &self.hub.client;
10049                dlg.pre_request();
10050                let mut req_builder = hyper::Request::builder()
10051                    .method(hyper::Method::GET)
10052                    .uri(url.as_str())
10053                    .header(USER_AGENT, self.hub._user_agent.clone());
10054
10055                if let Some(token) = token.as_ref() {
10056                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10057                }
10058
10059                let request = req_builder
10060                    .header(CONTENT_LENGTH, 0_u64)
10061                    .body(common::to_body::<String>(None));
10062
10063                client.request(request.unwrap()).await
10064            };
10065
10066            match req_result {
10067                Err(err) => {
10068                    if let common::Retry::After(d) = dlg.http_error(&err) {
10069                        sleep(d).await;
10070                        continue;
10071                    }
10072                    dlg.finished(false);
10073                    return Err(common::Error::HttpError(err));
10074                }
10075                Ok(res) => {
10076                    let (mut parts, body) = res.into_parts();
10077                    let mut body = common::Body::new(body);
10078                    if !parts.status.is_success() {
10079                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10080                        let error = serde_json::from_str(&common::to_string(&bytes));
10081                        let response = common::to_response(parts, bytes.into());
10082
10083                        if let common::Retry::After(d) =
10084                            dlg.http_failure(&response, error.as_ref().ok())
10085                        {
10086                            sleep(d).await;
10087                            continue;
10088                        }
10089
10090                        dlg.finished(false);
10091
10092                        return Err(match error {
10093                            Ok(value) => common::Error::BadRequest(value),
10094                            _ => common::Error::Failure(response),
10095                        });
10096                    }
10097                    let response = {
10098                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10099                        let encoded = common::to_string(&bytes);
10100                        match serde_json::from_str(&encoded) {
10101                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10102                            Err(error) => {
10103                                dlg.response_json_decode_error(&encoded, &error);
10104                                return Err(common::Error::JsonDecodeError(
10105                                    encoded.to_string(),
10106                                    error,
10107                                ));
10108                            }
10109                        }
10110                    };
10111
10112                    dlg.finished(true);
10113                    return Ok(response);
10114                }
10115            }
10116        }
10117    }
10118
10119    /// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
10120    ///
10121    /// Sets the *name* path property to the given value.
10122    ///
10123    /// Even though the property as already been set when instantiating this call,
10124    /// we provide this method for API completeness.
10125    pub fn name(
10126        mut self,
10127        new_value: &str,
10128    ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
10129        self._name = new_value.to_string();
10130        self
10131    }
10132    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10133    /// while executing the actual API request.
10134    ///
10135    /// ````text
10136    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10137    /// ````
10138    ///
10139    /// Sets the *delegate* property to the given value.
10140    pub fn delegate(
10141        mut self,
10142        new_value: &'a mut dyn common::Delegate,
10143    ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
10144        self._delegate = Some(new_value);
10145        self
10146    }
10147
10148    /// Set any additional parameter of the query string used in the request.
10149    /// It should be used to set parameters which are not yet available through their own
10150    /// setters.
10151    ///
10152    /// Please note that this method must not be used to set any of the known parameters
10153    /// which have their own setter method. If done anyway, the request will fail.
10154    ///
10155    /// # Additional Parameters
10156    ///
10157    /// * *$.xgafv* (query-string) - V1 error format.
10158    /// * *access_token* (query-string) - OAuth access token.
10159    /// * *alt* (query-string) - Data format for response.
10160    /// * *callback* (query-string) - JSONP
10161    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10162    /// * *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.
10163    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10164    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10165    /// * *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.
10166    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10167    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10168    pub fn param<T>(
10169        mut self,
10170        name: T,
10171        value: T,
10172    ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
10173    where
10174        T: AsRef<str>,
10175    {
10176        self._additional_params
10177            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10178        self
10179    }
10180
10181    /// Identifies the authorization scope for the method you are building.
10182    ///
10183    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10184    /// [`Scope::CloudPlatform`].
10185    ///
10186    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10187    /// tokens for more than one scope.
10188    ///
10189    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10190    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10191    /// sufficient, a read-write scope will do as well.
10192    pub fn add_scope<St>(
10193        mut self,
10194        scope: St,
10195    ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
10196    where
10197        St: AsRef<str>,
10198    {
10199        self._scopes.insert(String::from(scope.as_ref()));
10200        self
10201    }
10202    /// Identifies the authorization scope(s) for the method you are building.
10203    ///
10204    /// See [`Self::add_scope()`] for details.
10205    pub fn add_scopes<I, St>(
10206        mut self,
10207        scopes: I,
10208    ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
10209    where
10210        I: IntoIterator<Item = St>,
10211        St: AsRef<str>,
10212    {
10213        self._scopes
10214            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10215        self
10216    }
10217
10218    /// Removes all scopes, and no default scope will be used either.
10219    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10220    /// for details).
10221    pub fn clear_scopes(mut self) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
10222        self._scopes.clear();
10223        self
10224    }
10225}
10226
10227/// Completes master IP rotation.
10228///
10229/// A builder for the *locations.clusters.completeIpRotation* method supported by a *project* resource.
10230/// It is not used directly, but through a [`ProjectMethods`] instance.
10231///
10232/// # Example
10233///
10234/// Instantiate a resource method builder
10235///
10236/// ```test_harness,no_run
10237/// # extern crate hyper;
10238/// # extern crate hyper_rustls;
10239/// # extern crate google_container1 as container1;
10240/// use container1::api::CompleteIPRotationRequest;
10241/// # async fn dox() {
10242/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10243///
10244/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10245/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10246/// #     secret,
10247/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10248/// # ).build().await.unwrap();
10249///
10250/// # let client = hyper_util::client::legacy::Client::builder(
10251/// #     hyper_util::rt::TokioExecutor::new()
10252/// # )
10253/// # .build(
10254/// #     hyper_rustls::HttpsConnectorBuilder::new()
10255/// #         .with_native_roots()
10256/// #         .unwrap()
10257/// #         .https_or_http()
10258/// #         .enable_http1()
10259/// #         .build()
10260/// # );
10261/// # let mut hub = Container::new(client, auth);
10262/// // As the method needs a request, you would usually fill it with the desired information
10263/// // into the respective structure. Some of the parts shown here might not be applicable !
10264/// // Values shown here are possibly random and not representative !
10265/// let mut req = CompleteIPRotationRequest::default();
10266///
10267/// // You can configure optional parameters by calling the respective setters at will, and
10268/// // execute the final call using `doit()`.
10269/// // Values shown here are possibly random and not representative !
10270/// let result = hub.projects().locations_clusters_complete_ip_rotation(req, "name")
10271///              .doit().await;
10272/// # }
10273/// ```
10274pub struct ProjectLocationClusterCompleteIpRotationCall<'a, C>
10275where
10276    C: 'a,
10277{
10278    hub: &'a Container<C>,
10279    _request: CompleteIPRotationRequest,
10280    _name: String,
10281    _delegate: Option<&'a mut dyn common::Delegate>,
10282    _additional_params: HashMap<String, String>,
10283    _scopes: BTreeSet<String>,
10284}
10285
10286impl<'a, C> common::CallBuilder for ProjectLocationClusterCompleteIpRotationCall<'a, C> {}
10287
10288impl<'a, C> ProjectLocationClusterCompleteIpRotationCall<'a, C>
10289where
10290    C: common::Connector,
10291{
10292    /// Perform the operation you have build so far.
10293    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10294        use std::borrow::Cow;
10295        use std::io::{Read, Seek};
10296
10297        use common::{url::Params, ToParts};
10298        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10299
10300        let mut dd = common::DefaultDelegate;
10301        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10302        dlg.begin(common::MethodInfo {
10303            id: "container.projects.locations.clusters.completeIpRotation",
10304            http_method: hyper::Method::POST,
10305        });
10306
10307        for &field in ["alt", "name"].iter() {
10308            if self._additional_params.contains_key(field) {
10309                dlg.finished(false);
10310                return Err(common::Error::FieldClash(field));
10311            }
10312        }
10313
10314        let mut params = Params::with_capacity(4 + self._additional_params.len());
10315        params.push("name", self._name);
10316
10317        params.extend(self._additional_params.iter());
10318
10319        params.push("alt", "json");
10320        let mut url = self.hub._base_url.clone() + "v1/{+name}:completeIpRotation";
10321        if self._scopes.is_empty() {
10322            self._scopes
10323                .insert(Scope::CloudPlatform.as_ref().to_string());
10324        }
10325
10326        #[allow(clippy::single_element_loop)]
10327        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10328            url = params.uri_replacement(url, param_name, find_this, true);
10329        }
10330        {
10331            let to_remove = ["name"];
10332            params.remove_params(&to_remove);
10333        }
10334
10335        let url = params.parse_with_url(&url);
10336
10337        let mut json_mime_type = mime::APPLICATION_JSON;
10338        let mut request_value_reader = {
10339            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10340            common::remove_json_null_values(&mut value);
10341            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10342            serde_json::to_writer(&mut dst, &value).unwrap();
10343            dst
10344        };
10345        let request_size = request_value_reader
10346            .seek(std::io::SeekFrom::End(0))
10347            .unwrap();
10348        request_value_reader
10349            .seek(std::io::SeekFrom::Start(0))
10350            .unwrap();
10351
10352        loop {
10353            let token = match self
10354                .hub
10355                .auth
10356                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10357                .await
10358            {
10359                Ok(token) => token,
10360                Err(e) => match dlg.token(e) {
10361                    Ok(token) => token,
10362                    Err(e) => {
10363                        dlg.finished(false);
10364                        return Err(common::Error::MissingToken(e));
10365                    }
10366                },
10367            };
10368            request_value_reader
10369                .seek(std::io::SeekFrom::Start(0))
10370                .unwrap();
10371            let mut req_result = {
10372                let client = &self.hub.client;
10373                dlg.pre_request();
10374                let mut req_builder = hyper::Request::builder()
10375                    .method(hyper::Method::POST)
10376                    .uri(url.as_str())
10377                    .header(USER_AGENT, self.hub._user_agent.clone());
10378
10379                if let Some(token) = token.as_ref() {
10380                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10381                }
10382
10383                let request = req_builder
10384                    .header(CONTENT_TYPE, json_mime_type.to_string())
10385                    .header(CONTENT_LENGTH, request_size as u64)
10386                    .body(common::to_body(
10387                        request_value_reader.get_ref().clone().into(),
10388                    ));
10389
10390                client.request(request.unwrap()).await
10391            };
10392
10393            match req_result {
10394                Err(err) => {
10395                    if let common::Retry::After(d) = dlg.http_error(&err) {
10396                        sleep(d).await;
10397                        continue;
10398                    }
10399                    dlg.finished(false);
10400                    return Err(common::Error::HttpError(err));
10401                }
10402                Ok(res) => {
10403                    let (mut parts, body) = res.into_parts();
10404                    let mut body = common::Body::new(body);
10405                    if !parts.status.is_success() {
10406                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10407                        let error = serde_json::from_str(&common::to_string(&bytes));
10408                        let response = common::to_response(parts, bytes.into());
10409
10410                        if let common::Retry::After(d) =
10411                            dlg.http_failure(&response, error.as_ref().ok())
10412                        {
10413                            sleep(d).await;
10414                            continue;
10415                        }
10416
10417                        dlg.finished(false);
10418
10419                        return Err(match error {
10420                            Ok(value) => common::Error::BadRequest(value),
10421                            _ => common::Error::Failure(response),
10422                        });
10423                    }
10424                    let response = {
10425                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10426                        let encoded = common::to_string(&bytes);
10427                        match serde_json::from_str(&encoded) {
10428                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10429                            Err(error) => {
10430                                dlg.response_json_decode_error(&encoded, &error);
10431                                return Err(common::Error::JsonDecodeError(
10432                                    encoded.to_string(),
10433                                    error,
10434                                ));
10435                            }
10436                        }
10437                    };
10438
10439                    dlg.finished(true);
10440                    return Ok(response);
10441                }
10442            }
10443        }
10444    }
10445
10446    ///
10447    /// Sets the *request* property to the given value.
10448    ///
10449    /// Even though the property as already been set when instantiating this call,
10450    /// we provide this method for API completeness.
10451    pub fn request(
10452        mut self,
10453        new_value: CompleteIPRotationRequest,
10454    ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
10455        self._request = new_value;
10456        self
10457    }
10458    /// The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
10459    ///
10460    /// Sets the *name* path property to the given value.
10461    ///
10462    /// Even though the property as already been set when instantiating this call,
10463    /// we provide this method for API completeness.
10464    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
10465        self._name = new_value.to_string();
10466        self
10467    }
10468    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10469    /// while executing the actual API request.
10470    ///
10471    /// ````text
10472    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10473    /// ````
10474    ///
10475    /// Sets the *delegate* property to the given value.
10476    pub fn delegate(
10477        mut self,
10478        new_value: &'a mut dyn common::Delegate,
10479    ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
10480        self._delegate = Some(new_value);
10481        self
10482    }
10483
10484    /// Set any additional parameter of the query string used in the request.
10485    /// It should be used to set parameters which are not yet available through their own
10486    /// setters.
10487    ///
10488    /// Please note that this method must not be used to set any of the known parameters
10489    /// which have their own setter method. If done anyway, the request will fail.
10490    ///
10491    /// # Additional Parameters
10492    ///
10493    /// * *$.xgafv* (query-string) - V1 error format.
10494    /// * *access_token* (query-string) - OAuth access token.
10495    /// * *alt* (query-string) - Data format for response.
10496    /// * *callback* (query-string) - JSONP
10497    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10498    /// * *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.
10499    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10500    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10501    /// * *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.
10502    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10503    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10504    pub fn param<T>(
10505        mut self,
10506        name: T,
10507        value: T,
10508    ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
10509    where
10510        T: AsRef<str>,
10511    {
10512        self._additional_params
10513            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10514        self
10515    }
10516
10517    /// Identifies the authorization scope for the method you are building.
10518    ///
10519    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10520    /// [`Scope::CloudPlatform`].
10521    ///
10522    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10523    /// tokens for more than one scope.
10524    ///
10525    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10526    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10527    /// sufficient, a read-write scope will do as well.
10528    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
10529    where
10530        St: AsRef<str>,
10531    {
10532        self._scopes.insert(String::from(scope.as_ref()));
10533        self
10534    }
10535    /// Identifies the authorization scope(s) for the method you are building.
10536    ///
10537    /// See [`Self::add_scope()`] for details.
10538    pub fn add_scopes<I, St>(
10539        mut self,
10540        scopes: I,
10541    ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
10542    where
10543        I: IntoIterator<Item = St>,
10544        St: AsRef<str>,
10545    {
10546        self._scopes
10547            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10548        self
10549    }
10550
10551    /// Removes all scopes, and no default scope will be used either.
10552    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10553    /// for details).
10554    pub fn clear_scopes(mut self) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
10555        self._scopes.clear();
10556        self
10557    }
10558}
10559
10560/// Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
10561///
10562/// A builder for the *locations.clusters.create* method supported by a *project* resource.
10563/// It is not used directly, but through a [`ProjectMethods`] instance.
10564///
10565/// # Example
10566///
10567/// Instantiate a resource method builder
10568///
10569/// ```test_harness,no_run
10570/// # extern crate hyper;
10571/// # extern crate hyper_rustls;
10572/// # extern crate google_container1 as container1;
10573/// use container1::api::CreateClusterRequest;
10574/// # async fn dox() {
10575/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10576///
10577/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10578/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10579/// #     secret,
10580/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10581/// # ).build().await.unwrap();
10582///
10583/// # let client = hyper_util::client::legacy::Client::builder(
10584/// #     hyper_util::rt::TokioExecutor::new()
10585/// # )
10586/// # .build(
10587/// #     hyper_rustls::HttpsConnectorBuilder::new()
10588/// #         .with_native_roots()
10589/// #         .unwrap()
10590/// #         .https_or_http()
10591/// #         .enable_http1()
10592/// #         .build()
10593/// # );
10594/// # let mut hub = Container::new(client, auth);
10595/// // As the method needs a request, you would usually fill it with the desired information
10596/// // into the respective structure. Some of the parts shown here might not be applicable !
10597/// // Values shown here are possibly random and not representative !
10598/// let mut req = CreateClusterRequest::default();
10599///
10600/// // You can configure optional parameters by calling the respective setters at will, and
10601/// // execute the final call using `doit()`.
10602/// // Values shown here are possibly random and not representative !
10603/// let result = hub.projects().locations_clusters_create(req, "parent")
10604///              .doit().await;
10605/// # }
10606/// ```
10607pub struct ProjectLocationClusterCreateCall<'a, C>
10608where
10609    C: 'a,
10610{
10611    hub: &'a Container<C>,
10612    _request: CreateClusterRequest,
10613    _parent: String,
10614    _delegate: Option<&'a mut dyn common::Delegate>,
10615    _additional_params: HashMap<String, String>,
10616    _scopes: BTreeSet<String>,
10617}
10618
10619impl<'a, C> common::CallBuilder for ProjectLocationClusterCreateCall<'a, C> {}
10620
10621impl<'a, C> ProjectLocationClusterCreateCall<'a, C>
10622where
10623    C: common::Connector,
10624{
10625    /// Perform the operation you have build so far.
10626    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10627        use std::borrow::Cow;
10628        use std::io::{Read, Seek};
10629
10630        use common::{url::Params, ToParts};
10631        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10632
10633        let mut dd = common::DefaultDelegate;
10634        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10635        dlg.begin(common::MethodInfo {
10636            id: "container.projects.locations.clusters.create",
10637            http_method: hyper::Method::POST,
10638        });
10639
10640        for &field in ["alt", "parent"].iter() {
10641            if self._additional_params.contains_key(field) {
10642                dlg.finished(false);
10643                return Err(common::Error::FieldClash(field));
10644            }
10645        }
10646
10647        let mut params = Params::with_capacity(4 + self._additional_params.len());
10648        params.push("parent", self._parent);
10649
10650        params.extend(self._additional_params.iter());
10651
10652        params.push("alt", "json");
10653        let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
10654        if self._scopes.is_empty() {
10655            self._scopes
10656                .insert(Scope::CloudPlatform.as_ref().to_string());
10657        }
10658
10659        #[allow(clippy::single_element_loop)]
10660        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
10661            url = params.uri_replacement(url, param_name, find_this, true);
10662        }
10663        {
10664            let to_remove = ["parent"];
10665            params.remove_params(&to_remove);
10666        }
10667
10668        let url = params.parse_with_url(&url);
10669
10670        let mut json_mime_type = mime::APPLICATION_JSON;
10671        let mut request_value_reader = {
10672            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10673            common::remove_json_null_values(&mut value);
10674            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10675            serde_json::to_writer(&mut dst, &value).unwrap();
10676            dst
10677        };
10678        let request_size = request_value_reader
10679            .seek(std::io::SeekFrom::End(0))
10680            .unwrap();
10681        request_value_reader
10682            .seek(std::io::SeekFrom::Start(0))
10683            .unwrap();
10684
10685        loop {
10686            let token = match self
10687                .hub
10688                .auth
10689                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10690                .await
10691            {
10692                Ok(token) => token,
10693                Err(e) => match dlg.token(e) {
10694                    Ok(token) => token,
10695                    Err(e) => {
10696                        dlg.finished(false);
10697                        return Err(common::Error::MissingToken(e));
10698                    }
10699                },
10700            };
10701            request_value_reader
10702                .seek(std::io::SeekFrom::Start(0))
10703                .unwrap();
10704            let mut req_result = {
10705                let client = &self.hub.client;
10706                dlg.pre_request();
10707                let mut req_builder = hyper::Request::builder()
10708                    .method(hyper::Method::POST)
10709                    .uri(url.as_str())
10710                    .header(USER_AGENT, self.hub._user_agent.clone());
10711
10712                if let Some(token) = token.as_ref() {
10713                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10714                }
10715
10716                let request = req_builder
10717                    .header(CONTENT_TYPE, json_mime_type.to_string())
10718                    .header(CONTENT_LENGTH, request_size as u64)
10719                    .body(common::to_body(
10720                        request_value_reader.get_ref().clone().into(),
10721                    ));
10722
10723                client.request(request.unwrap()).await
10724            };
10725
10726            match req_result {
10727                Err(err) => {
10728                    if let common::Retry::After(d) = dlg.http_error(&err) {
10729                        sleep(d).await;
10730                        continue;
10731                    }
10732                    dlg.finished(false);
10733                    return Err(common::Error::HttpError(err));
10734                }
10735                Ok(res) => {
10736                    let (mut parts, body) = res.into_parts();
10737                    let mut body = common::Body::new(body);
10738                    if !parts.status.is_success() {
10739                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10740                        let error = serde_json::from_str(&common::to_string(&bytes));
10741                        let response = common::to_response(parts, bytes.into());
10742
10743                        if let common::Retry::After(d) =
10744                            dlg.http_failure(&response, error.as_ref().ok())
10745                        {
10746                            sleep(d).await;
10747                            continue;
10748                        }
10749
10750                        dlg.finished(false);
10751
10752                        return Err(match error {
10753                            Ok(value) => common::Error::BadRequest(value),
10754                            _ => common::Error::Failure(response),
10755                        });
10756                    }
10757                    let response = {
10758                        let bytes = common::to_bytes(body).await.unwrap_or_default();
10759                        let encoded = common::to_string(&bytes);
10760                        match serde_json::from_str(&encoded) {
10761                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10762                            Err(error) => {
10763                                dlg.response_json_decode_error(&encoded, &error);
10764                                return Err(common::Error::JsonDecodeError(
10765                                    encoded.to_string(),
10766                                    error,
10767                                ));
10768                            }
10769                        }
10770                    };
10771
10772                    dlg.finished(true);
10773                    return Ok(response);
10774                }
10775            }
10776        }
10777    }
10778
10779    ///
10780    /// Sets the *request* property to the given value.
10781    ///
10782    /// Even though the property as already been set when instantiating this call,
10783    /// we provide this method for API completeness.
10784    pub fn request(
10785        mut self,
10786        new_value: CreateClusterRequest,
10787    ) -> ProjectLocationClusterCreateCall<'a, C> {
10788        self._request = new_value;
10789        self
10790    }
10791    /// The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
10792    ///
10793    /// Sets the *parent* path property to the given value.
10794    ///
10795    /// Even though the property as already been set when instantiating this call,
10796    /// we provide this method for API completeness.
10797    pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterCreateCall<'a, C> {
10798        self._parent = new_value.to_string();
10799        self
10800    }
10801    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10802    /// while executing the actual API request.
10803    ///
10804    /// ````text
10805    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
10806    /// ````
10807    ///
10808    /// Sets the *delegate* property to the given value.
10809    pub fn delegate(
10810        mut self,
10811        new_value: &'a mut dyn common::Delegate,
10812    ) -> ProjectLocationClusterCreateCall<'a, C> {
10813        self._delegate = Some(new_value);
10814        self
10815    }
10816
10817    /// Set any additional parameter of the query string used in the request.
10818    /// It should be used to set parameters which are not yet available through their own
10819    /// setters.
10820    ///
10821    /// Please note that this method must not be used to set any of the known parameters
10822    /// which have their own setter method. If done anyway, the request will fail.
10823    ///
10824    /// # Additional Parameters
10825    ///
10826    /// * *$.xgafv* (query-string) - V1 error format.
10827    /// * *access_token* (query-string) - OAuth access token.
10828    /// * *alt* (query-string) - Data format for response.
10829    /// * *callback* (query-string) - JSONP
10830    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10831    /// * *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.
10832    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10833    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10834    /// * *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.
10835    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10836    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10837    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterCreateCall<'a, C>
10838    where
10839        T: AsRef<str>,
10840    {
10841        self._additional_params
10842            .insert(name.as_ref().to_string(), value.as_ref().to_string());
10843        self
10844    }
10845
10846    /// Identifies the authorization scope for the method you are building.
10847    ///
10848    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10849    /// [`Scope::CloudPlatform`].
10850    ///
10851    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10852    /// tokens for more than one scope.
10853    ///
10854    /// Usually there is more than one suitable scope to authorize an operation, some of which may
10855    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10856    /// sufficient, a read-write scope will do as well.
10857    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterCreateCall<'a, C>
10858    where
10859        St: AsRef<str>,
10860    {
10861        self._scopes.insert(String::from(scope.as_ref()));
10862        self
10863    }
10864    /// Identifies the authorization scope(s) for the method you are building.
10865    ///
10866    /// See [`Self::add_scope()`] for details.
10867    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterCreateCall<'a, C>
10868    where
10869        I: IntoIterator<Item = St>,
10870        St: AsRef<str>,
10871    {
10872        self._scopes
10873            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10874        self
10875    }
10876
10877    /// Removes all scopes, and no default scope will be used either.
10878    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10879    /// for details).
10880    pub fn clear_scopes(mut self) -> ProjectLocationClusterCreateCall<'a, C> {
10881        self._scopes.clear();
10882        self
10883    }
10884}
10885
10886/// Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
10887///
10888/// A builder for the *locations.clusters.delete* method supported by a *project* resource.
10889/// It is not used directly, but through a [`ProjectMethods`] instance.
10890///
10891/// # Example
10892///
10893/// Instantiate a resource method builder
10894///
10895/// ```test_harness,no_run
10896/// # extern crate hyper;
10897/// # extern crate hyper_rustls;
10898/// # extern crate google_container1 as container1;
10899/// # async fn dox() {
10900/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10901///
10902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10903/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
10904/// #     secret,
10905/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10906/// # ).build().await.unwrap();
10907///
10908/// # let client = hyper_util::client::legacy::Client::builder(
10909/// #     hyper_util::rt::TokioExecutor::new()
10910/// # )
10911/// # .build(
10912/// #     hyper_rustls::HttpsConnectorBuilder::new()
10913/// #         .with_native_roots()
10914/// #         .unwrap()
10915/// #         .https_or_http()
10916/// #         .enable_http1()
10917/// #         .build()
10918/// # );
10919/// # let mut hub = Container::new(client, auth);
10920/// // You can configure optional parameters by calling the respective setters at will, and
10921/// // execute the final call using `doit()`.
10922/// // Values shown here are possibly random and not representative !
10923/// let result = hub.projects().locations_clusters_delete("name")
10924///              .zone("sed")
10925///              .project_id("et")
10926///              .cluster_id("et")
10927///              .doit().await;
10928/// # }
10929/// ```
10930pub struct ProjectLocationClusterDeleteCall<'a, C>
10931where
10932    C: 'a,
10933{
10934    hub: &'a Container<C>,
10935    _name: String,
10936    _zone: Option<String>,
10937    _project_id: Option<String>,
10938    _cluster_id: Option<String>,
10939    _delegate: Option<&'a mut dyn common::Delegate>,
10940    _additional_params: HashMap<String, String>,
10941    _scopes: BTreeSet<String>,
10942}
10943
10944impl<'a, C> common::CallBuilder for ProjectLocationClusterDeleteCall<'a, C> {}
10945
10946impl<'a, C> ProjectLocationClusterDeleteCall<'a, C>
10947where
10948    C: common::Connector,
10949{
10950    /// Perform the operation you have build so far.
10951    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10952        use std::borrow::Cow;
10953        use std::io::{Read, Seek};
10954
10955        use common::{url::Params, ToParts};
10956        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10957
10958        let mut dd = common::DefaultDelegate;
10959        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10960        dlg.begin(common::MethodInfo {
10961            id: "container.projects.locations.clusters.delete",
10962            http_method: hyper::Method::DELETE,
10963        });
10964
10965        for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
10966            if self._additional_params.contains_key(field) {
10967                dlg.finished(false);
10968                return Err(common::Error::FieldClash(field));
10969            }
10970        }
10971
10972        let mut params = Params::with_capacity(6 + self._additional_params.len());
10973        params.push("name", self._name);
10974        if let Some(value) = self._zone.as_ref() {
10975            params.push("zone", value);
10976        }
10977        if let Some(value) = self._project_id.as_ref() {
10978            params.push("projectId", value);
10979        }
10980        if let Some(value) = self._cluster_id.as_ref() {
10981            params.push("clusterId", value);
10982        }
10983
10984        params.extend(self._additional_params.iter());
10985
10986        params.push("alt", "json");
10987        let mut url = self.hub._base_url.clone() + "v1/{+name}";
10988        if self._scopes.is_empty() {
10989            self._scopes
10990                .insert(Scope::CloudPlatform.as_ref().to_string());
10991        }
10992
10993        #[allow(clippy::single_element_loop)]
10994        for &(find_this, param_name) in [("{+name}", "name")].iter() {
10995            url = params.uri_replacement(url, param_name, find_this, true);
10996        }
10997        {
10998            let to_remove = ["name"];
10999            params.remove_params(&to_remove);
11000        }
11001
11002        let url = params.parse_with_url(&url);
11003
11004        loop {
11005            let token = match self
11006                .hub
11007                .auth
11008                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11009                .await
11010            {
11011                Ok(token) => token,
11012                Err(e) => match dlg.token(e) {
11013                    Ok(token) => token,
11014                    Err(e) => {
11015                        dlg.finished(false);
11016                        return Err(common::Error::MissingToken(e));
11017                    }
11018                },
11019            };
11020            let mut req_result = {
11021                let client = &self.hub.client;
11022                dlg.pre_request();
11023                let mut req_builder = hyper::Request::builder()
11024                    .method(hyper::Method::DELETE)
11025                    .uri(url.as_str())
11026                    .header(USER_AGENT, self.hub._user_agent.clone());
11027
11028                if let Some(token) = token.as_ref() {
11029                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11030                }
11031
11032                let request = req_builder
11033                    .header(CONTENT_LENGTH, 0_u64)
11034                    .body(common::to_body::<String>(None));
11035
11036                client.request(request.unwrap()).await
11037            };
11038
11039            match req_result {
11040                Err(err) => {
11041                    if let common::Retry::After(d) = dlg.http_error(&err) {
11042                        sleep(d).await;
11043                        continue;
11044                    }
11045                    dlg.finished(false);
11046                    return Err(common::Error::HttpError(err));
11047                }
11048                Ok(res) => {
11049                    let (mut parts, body) = res.into_parts();
11050                    let mut body = common::Body::new(body);
11051                    if !parts.status.is_success() {
11052                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11053                        let error = serde_json::from_str(&common::to_string(&bytes));
11054                        let response = common::to_response(parts, bytes.into());
11055
11056                        if let common::Retry::After(d) =
11057                            dlg.http_failure(&response, error.as_ref().ok())
11058                        {
11059                            sleep(d).await;
11060                            continue;
11061                        }
11062
11063                        dlg.finished(false);
11064
11065                        return Err(match error {
11066                            Ok(value) => common::Error::BadRequest(value),
11067                            _ => common::Error::Failure(response),
11068                        });
11069                    }
11070                    let response = {
11071                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11072                        let encoded = common::to_string(&bytes);
11073                        match serde_json::from_str(&encoded) {
11074                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11075                            Err(error) => {
11076                                dlg.response_json_decode_error(&encoded, &error);
11077                                return Err(common::Error::JsonDecodeError(
11078                                    encoded.to_string(),
11079                                    error,
11080                                ));
11081                            }
11082                        }
11083                    };
11084
11085                    dlg.finished(true);
11086                    return Ok(response);
11087                }
11088            }
11089        }
11090    }
11091
11092    /// The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
11093    ///
11094    /// Sets the *name* path property to the given value.
11095    ///
11096    /// Even though the property as already been set when instantiating this call,
11097    /// we provide this method for API completeness.
11098    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
11099        self._name = new_value.to_string();
11100        self
11101    }
11102    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
11103    ///
11104    /// Sets the *zone* query property to the given value.
11105    pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
11106        self._zone = Some(new_value.to_string());
11107        self
11108    }
11109    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
11110    ///
11111    /// Sets the *project id* query property to the given value.
11112    pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
11113        self._project_id = Some(new_value.to_string());
11114        self
11115    }
11116    /// Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
11117    ///
11118    /// Sets the *cluster id* query property to the given value.
11119    pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
11120        self._cluster_id = Some(new_value.to_string());
11121        self
11122    }
11123    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11124    /// while executing the actual API request.
11125    ///
11126    /// ````text
11127    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11128    /// ````
11129    ///
11130    /// Sets the *delegate* property to the given value.
11131    pub fn delegate(
11132        mut self,
11133        new_value: &'a mut dyn common::Delegate,
11134    ) -> ProjectLocationClusterDeleteCall<'a, C> {
11135        self._delegate = Some(new_value);
11136        self
11137    }
11138
11139    /// Set any additional parameter of the query string used in the request.
11140    /// It should be used to set parameters which are not yet available through their own
11141    /// setters.
11142    ///
11143    /// Please note that this method must not be used to set any of the known parameters
11144    /// which have their own setter method. If done anyway, the request will fail.
11145    ///
11146    /// # Additional Parameters
11147    ///
11148    /// * *$.xgafv* (query-string) - V1 error format.
11149    /// * *access_token* (query-string) - OAuth access token.
11150    /// * *alt* (query-string) - Data format for response.
11151    /// * *callback* (query-string) - JSONP
11152    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11153    /// * *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.
11154    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11155    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11156    /// * *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.
11157    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11158    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11159    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterDeleteCall<'a, C>
11160    where
11161        T: AsRef<str>,
11162    {
11163        self._additional_params
11164            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11165        self
11166    }
11167
11168    /// Identifies the authorization scope for the method you are building.
11169    ///
11170    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11171    /// [`Scope::CloudPlatform`].
11172    ///
11173    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11174    /// tokens for more than one scope.
11175    ///
11176    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11177    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11178    /// sufficient, a read-write scope will do as well.
11179    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterDeleteCall<'a, C>
11180    where
11181        St: AsRef<str>,
11182    {
11183        self._scopes.insert(String::from(scope.as_ref()));
11184        self
11185    }
11186    /// Identifies the authorization scope(s) for the method you are building.
11187    ///
11188    /// See [`Self::add_scope()`] for details.
11189    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterDeleteCall<'a, C>
11190    where
11191        I: IntoIterator<Item = St>,
11192        St: AsRef<str>,
11193    {
11194        self._scopes
11195            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11196        self
11197    }
11198
11199    /// Removes all scopes, and no default scope will be used either.
11200    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11201    /// for details).
11202    pub fn clear_scopes(mut self) -> ProjectLocationClusterDeleteCall<'a, C> {
11203        self._scopes.clear();
11204        self
11205    }
11206}
11207
11208/// Gets the details of a specific cluster.
11209///
11210/// A builder for the *locations.clusters.get* method supported by a *project* resource.
11211/// It is not used directly, but through a [`ProjectMethods`] instance.
11212///
11213/// # Example
11214///
11215/// Instantiate a resource method builder
11216///
11217/// ```test_harness,no_run
11218/// # extern crate hyper;
11219/// # extern crate hyper_rustls;
11220/// # extern crate google_container1 as container1;
11221/// # async fn dox() {
11222/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11223///
11224/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11225/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11226/// #     secret,
11227/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11228/// # ).build().await.unwrap();
11229///
11230/// # let client = hyper_util::client::legacy::Client::builder(
11231/// #     hyper_util::rt::TokioExecutor::new()
11232/// # )
11233/// # .build(
11234/// #     hyper_rustls::HttpsConnectorBuilder::new()
11235/// #         .with_native_roots()
11236/// #         .unwrap()
11237/// #         .https_or_http()
11238/// #         .enable_http1()
11239/// #         .build()
11240/// # );
11241/// # let mut hub = Container::new(client, auth);
11242/// // You can configure optional parameters by calling the respective setters at will, and
11243/// // execute the final call using `doit()`.
11244/// // Values shown here are possibly random and not representative !
11245/// let result = hub.projects().locations_clusters_get("name")
11246///              .zone("erat")
11247///              .project_id("sed")
11248///              .cluster_id("duo")
11249///              .doit().await;
11250/// # }
11251/// ```
11252pub struct ProjectLocationClusterGetCall<'a, C>
11253where
11254    C: 'a,
11255{
11256    hub: &'a Container<C>,
11257    _name: String,
11258    _zone: Option<String>,
11259    _project_id: Option<String>,
11260    _cluster_id: Option<String>,
11261    _delegate: Option<&'a mut dyn common::Delegate>,
11262    _additional_params: HashMap<String, String>,
11263    _scopes: BTreeSet<String>,
11264}
11265
11266impl<'a, C> common::CallBuilder for ProjectLocationClusterGetCall<'a, C> {}
11267
11268impl<'a, C> ProjectLocationClusterGetCall<'a, C>
11269where
11270    C: common::Connector,
11271{
11272    /// Perform the operation you have build so far.
11273    pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
11274        use std::borrow::Cow;
11275        use std::io::{Read, Seek};
11276
11277        use common::{url::Params, ToParts};
11278        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11279
11280        let mut dd = common::DefaultDelegate;
11281        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11282        dlg.begin(common::MethodInfo {
11283            id: "container.projects.locations.clusters.get",
11284            http_method: hyper::Method::GET,
11285        });
11286
11287        for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
11288            if self._additional_params.contains_key(field) {
11289                dlg.finished(false);
11290                return Err(common::Error::FieldClash(field));
11291            }
11292        }
11293
11294        let mut params = Params::with_capacity(6 + self._additional_params.len());
11295        params.push("name", self._name);
11296        if let Some(value) = self._zone.as_ref() {
11297            params.push("zone", value);
11298        }
11299        if let Some(value) = self._project_id.as_ref() {
11300            params.push("projectId", value);
11301        }
11302        if let Some(value) = self._cluster_id.as_ref() {
11303            params.push("clusterId", value);
11304        }
11305
11306        params.extend(self._additional_params.iter());
11307
11308        params.push("alt", "json");
11309        let mut url = self.hub._base_url.clone() + "v1/{+name}";
11310        if self._scopes.is_empty() {
11311            self._scopes
11312                .insert(Scope::CloudPlatform.as_ref().to_string());
11313        }
11314
11315        #[allow(clippy::single_element_loop)]
11316        for &(find_this, param_name) in [("{+name}", "name")].iter() {
11317            url = params.uri_replacement(url, param_name, find_this, true);
11318        }
11319        {
11320            let to_remove = ["name"];
11321            params.remove_params(&to_remove);
11322        }
11323
11324        let url = params.parse_with_url(&url);
11325
11326        loop {
11327            let token = match self
11328                .hub
11329                .auth
11330                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11331                .await
11332            {
11333                Ok(token) => token,
11334                Err(e) => match dlg.token(e) {
11335                    Ok(token) => token,
11336                    Err(e) => {
11337                        dlg.finished(false);
11338                        return Err(common::Error::MissingToken(e));
11339                    }
11340                },
11341            };
11342            let mut req_result = {
11343                let client = &self.hub.client;
11344                dlg.pre_request();
11345                let mut req_builder = hyper::Request::builder()
11346                    .method(hyper::Method::GET)
11347                    .uri(url.as_str())
11348                    .header(USER_AGENT, self.hub._user_agent.clone());
11349
11350                if let Some(token) = token.as_ref() {
11351                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11352                }
11353
11354                let request = req_builder
11355                    .header(CONTENT_LENGTH, 0_u64)
11356                    .body(common::to_body::<String>(None));
11357
11358                client.request(request.unwrap()).await
11359            };
11360
11361            match req_result {
11362                Err(err) => {
11363                    if let common::Retry::After(d) = dlg.http_error(&err) {
11364                        sleep(d).await;
11365                        continue;
11366                    }
11367                    dlg.finished(false);
11368                    return Err(common::Error::HttpError(err));
11369                }
11370                Ok(res) => {
11371                    let (mut parts, body) = res.into_parts();
11372                    let mut body = common::Body::new(body);
11373                    if !parts.status.is_success() {
11374                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11375                        let error = serde_json::from_str(&common::to_string(&bytes));
11376                        let response = common::to_response(parts, bytes.into());
11377
11378                        if let common::Retry::After(d) =
11379                            dlg.http_failure(&response, error.as_ref().ok())
11380                        {
11381                            sleep(d).await;
11382                            continue;
11383                        }
11384
11385                        dlg.finished(false);
11386
11387                        return Err(match error {
11388                            Ok(value) => common::Error::BadRequest(value),
11389                            _ => common::Error::Failure(response),
11390                        });
11391                    }
11392                    let response = {
11393                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11394                        let encoded = common::to_string(&bytes);
11395                        match serde_json::from_str(&encoded) {
11396                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11397                            Err(error) => {
11398                                dlg.response_json_decode_error(&encoded, &error);
11399                                return Err(common::Error::JsonDecodeError(
11400                                    encoded.to_string(),
11401                                    error,
11402                                ));
11403                            }
11404                        }
11405                    };
11406
11407                    dlg.finished(true);
11408                    return Ok(response);
11409                }
11410            }
11411        }
11412    }
11413
11414    /// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
11415    ///
11416    /// Sets the *name* path property to the given value.
11417    ///
11418    /// Even though the property as already been set when instantiating this call,
11419    /// we provide this method for API completeness.
11420    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
11421        self._name = new_value.to_string();
11422        self
11423    }
11424    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
11425    ///
11426    /// Sets the *zone* query property to the given value.
11427    pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
11428        self._zone = Some(new_value.to_string());
11429        self
11430    }
11431    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
11432    ///
11433    /// Sets the *project id* query property to the given value.
11434    pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
11435        self._project_id = Some(new_value.to_string());
11436        self
11437    }
11438    /// Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
11439    ///
11440    /// Sets the *cluster id* query property to the given value.
11441    pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
11442        self._cluster_id = Some(new_value.to_string());
11443        self
11444    }
11445    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11446    /// while executing the actual API request.
11447    ///
11448    /// ````text
11449    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11450    /// ````
11451    ///
11452    /// Sets the *delegate* property to the given value.
11453    pub fn delegate(
11454        mut self,
11455        new_value: &'a mut dyn common::Delegate,
11456    ) -> ProjectLocationClusterGetCall<'a, C> {
11457        self._delegate = Some(new_value);
11458        self
11459    }
11460
11461    /// Set any additional parameter of the query string used in the request.
11462    /// It should be used to set parameters which are not yet available through their own
11463    /// setters.
11464    ///
11465    /// Please note that this method must not be used to set any of the known parameters
11466    /// which have their own setter method. If done anyway, the request will fail.
11467    ///
11468    /// # Additional Parameters
11469    ///
11470    /// * *$.xgafv* (query-string) - V1 error format.
11471    /// * *access_token* (query-string) - OAuth access token.
11472    /// * *alt* (query-string) - Data format for response.
11473    /// * *callback* (query-string) - JSONP
11474    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11475    /// * *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.
11476    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11477    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11478    /// * *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.
11479    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11480    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11481    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterGetCall<'a, C>
11482    where
11483        T: AsRef<str>,
11484    {
11485        self._additional_params
11486            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11487        self
11488    }
11489
11490    /// Identifies the authorization scope for the method you are building.
11491    ///
11492    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11493    /// [`Scope::CloudPlatform`].
11494    ///
11495    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11496    /// tokens for more than one scope.
11497    ///
11498    /// Usually there is more than one suitable scope to authorize an operation, some of which may
11499    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11500    /// sufficient, a read-write scope will do as well.
11501    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterGetCall<'a, C>
11502    where
11503        St: AsRef<str>,
11504    {
11505        self._scopes.insert(String::from(scope.as_ref()));
11506        self
11507    }
11508    /// Identifies the authorization scope(s) for the method you are building.
11509    ///
11510    /// See [`Self::add_scope()`] for details.
11511    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterGetCall<'a, C>
11512    where
11513        I: IntoIterator<Item = St>,
11514        St: AsRef<str>,
11515    {
11516        self._scopes
11517            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11518        self
11519    }
11520
11521    /// Removes all scopes, and no default scope will be used either.
11522    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11523    /// for details).
11524    pub fn clear_scopes(mut self) -> ProjectLocationClusterGetCall<'a, C> {
11525        self._scopes.clear();
11526        self
11527    }
11528}
11529
11530/// Gets the public component of the cluster signing keys in JSON Web Key format.
11531///
11532/// A builder for the *locations.clusters.getJwks* method supported by a *project* resource.
11533/// It is not used directly, but through a [`ProjectMethods`] instance.
11534///
11535/// # Example
11536///
11537/// Instantiate a resource method builder
11538///
11539/// ```test_harness,no_run
11540/// # extern crate hyper;
11541/// # extern crate hyper_rustls;
11542/// # extern crate google_container1 as container1;
11543/// # async fn dox() {
11544/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11545///
11546/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11547/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11548/// #     secret,
11549/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11550/// # ).build().await.unwrap();
11551///
11552/// # let client = hyper_util::client::legacy::Client::builder(
11553/// #     hyper_util::rt::TokioExecutor::new()
11554/// # )
11555/// # .build(
11556/// #     hyper_rustls::HttpsConnectorBuilder::new()
11557/// #         .with_native_roots()
11558/// #         .unwrap()
11559/// #         .https_or_http()
11560/// #         .enable_http1()
11561/// #         .build()
11562/// # );
11563/// # let mut hub = Container::new(client, auth);
11564/// // You can configure optional parameters by calling the respective setters at will, and
11565/// // execute the final call using `doit()`.
11566/// // Values shown here are possibly random and not representative !
11567/// let result = hub.projects().locations_clusters_get_jwks("parent")
11568///              .doit().await;
11569/// # }
11570/// ```
11571pub struct ProjectLocationClusterGetJwkCall<'a, C>
11572where
11573    C: 'a,
11574{
11575    hub: &'a Container<C>,
11576    _parent: String,
11577    _delegate: Option<&'a mut dyn common::Delegate>,
11578    _additional_params: HashMap<String, String>,
11579}
11580
11581impl<'a, C> common::CallBuilder for ProjectLocationClusterGetJwkCall<'a, C> {}
11582
11583impl<'a, C> ProjectLocationClusterGetJwkCall<'a, C>
11584where
11585    C: common::Connector,
11586{
11587    /// Perform the operation you have build so far.
11588    pub async fn doit(mut self) -> common::Result<(common::Response, GetJSONWebKeysResponse)> {
11589        use std::borrow::Cow;
11590        use std::io::{Read, Seek};
11591
11592        use common::{url::Params, ToParts};
11593        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11594
11595        let mut dd = common::DefaultDelegate;
11596        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11597        dlg.begin(common::MethodInfo {
11598            id: "container.projects.locations.clusters.getJwks",
11599            http_method: hyper::Method::GET,
11600        });
11601
11602        for &field in ["alt", "parent"].iter() {
11603            if self._additional_params.contains_key(field) {
11604                dlg.finished(false);
11605                return Err(common::Error::FieldClash(field));
11606            }
11607        }
11608
11609        let mut params = Params::with_capacity(3 + self._additional_params.len());
11610        params.push("parent", self._parent);
11611
11612        params.extend(self._additional_params.iter());
11613
11614        params.push("alt", "json");
11615        let mut url = self.hub._base_url.clone() + "v1/{+parent}/jwks";
11616
11617        match dlg.api_key() {
11618            Some(value) => params.push("key", value),
11619            None => {
11620                dlg.finished(false);
11621                return Err(common::Error::MissingAPIKey);
11622            }
11623        }
11624
11625        #[allow(clippy::single_element_loop)]
11626        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11627            url = params.uri_replacement(url, param_name, find_this, true);
11628        }
11629        {
11630            let to_remove = ["parent"];
11631            params.remove_params(&to_remove);
11632        }
11633
11634        let url = params.parse_with_url(&url);
11635
11636        loop {
11637            let mut req_result = {
11638                let client = &self.hub.client;
11639                dlg.pre_request();
11640                let mut req_builder = hyper::Request::builder()
11641                    .method(hyper::Method::GET)
11642                    .uri(url.as_str())
11643                    .header(USER_AGENT, self.hub._user_agent.clone());
11644
11645                let request = req_builder
11646                    .header(CONTENT_LENGTH, 0_u64)
11647                    .body(common::to_body::<String>(None));
11648
11649                client.request(request.unwrap()).await
11650            };
11651
11652            match req_result {
11653                Err(err) => {
11654                    if let common::Retry::After(d) = dlg.http_error(&err) {
11655                        sleep(d).await;
11656                        continue;
11657                    }
11658                    dlg.finished(false);
11659                    return Err(common::Error::HttpError(err));
11660                }
11661                Ok(res) => {
11662                    let (mut parts, body) = res.into_parts();
11663                    let mut body = common::Body::new(body);
11664                    if !parts.status.is_success() {
11665                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11666                        let error = serde_json::from_str(&common::to_string(&bytes));
11667                        let response = common::to_response(parts, bytes.into());
11668
11669                        if let common::Retry::After(d) =
11670                            dlg.http_failure(&response, error.as_ref().ok())
11671                        {
11672                            sleep(d).await;
11673                            continue;
11674                        }
11675
11676                        dlg.finished(false);
11677
11678                        return Err(match error {
11679                            Ok(value) => common::Error::BadRequest(value),
11680                            _ => common::Error::Failure(response),
11681                        });
11682                    }
11683                    let response = {
11684                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11685                        let encoded = common::to_string(&bytes);
11686                        match serde_json::from_str(&encoded) {
11687                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11688                            Err(error) => {
11689                                dlg.response_json_decode_error(&encoded, &error);
11690                                return Err(common::Error::JsonDecodeError(
11691                                    encoded.to_string(),
11692                                    error,
11693                                ));
11694                            }
11695                        }
11696                    };
11697
11698                    dlg.finished(true);
11699                    return Ok(response);
11700                }
11701            }
11702        }
11703    }
11704
11705    /// The cluster (project, location, cluster name) to get keys for. Specified in the format `projects/*/locations/*/clusters/*`.
11706    ///
11707    /// Sets the *parent* path property to the given value.
11708    ///
11709    /// Even though the property as already been set when instantiating this call,
11710    /// we provide this method for API completeness.
11711    pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterGetJwkCall<'a, C> {
11712        self._parent = new_value.to_string();
11713        self
11714    }
11715    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11716    /// while executing the actual API request.
11717    ///
11718    /// ````text
11719    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11720    /// ````
11721    ///
11722    /// Sets the *delegate* property to the given value.
11723    pub fn delegate(
11724        mut self,
11725        new_value: &'a mut dyn common::Delegate,
11726    ) -> ProjectLocationClusterGetJwkCall<'a, C> {
11727        self._delegate = Some(new_value);
11728        self
11729    }
11730
11731    /// Set any additional parameter of the query string used in the request.
11732    /// It should be used to set parameters which are not yet available through their own
11733    /// setters.
11734    ///
11735    /// Please note that this method must not be used to set any of the known parameters
11736    /// which have their own setter method. If done anyway, the request will fail.
11737    ///
11738    /// # Additional Parameters
11739    ///
11740    /// * *$.xgafv* (query-string) - V1 error format.
11741    /// * *access_token* (query-string) - OAuth access token.
11742    /// * *alt* (query-string) - Data format for response.
11743    /// * *callback* (query-string) - JSONP
11744    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11745    /// * *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.
11746    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11747    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11748    /// * *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.
11749    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11750    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11751    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterGetJwkCall<'a, C>
11752    where
11753        T: AsRef<str>,
11754    {
11755        self._additional_params
11756            .insert(name.as_ref().to_string(), value.as_ref().to_string());
11757        self
11758    }
11759}
11760
11761/// Lists all clusters owned by a project in either the specified zone or all zones.
11762///
11763/// A builder for the *locations.clusters.list* method supported by a *project* resource.
11764/// It is not used directly, but through a [`ProjectMethods`] instance.
11765///
11766/// # Example
11767///
11768/// Instantiate a resource method builder
11769///
11770/// ```test_harness,no_run
11771/// # extern crate hyper;
11772/// # extern crate hyper_rustls;
11773/// # extern crate google_container1 as container1;
11774/// # async fn dox() {
11775/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11776///
11777/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11778/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
11779/// #     secret,
11780/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11781/// # ).build().await.unwrap();
11782///
11783/// # let client = hyper_util::client::legacy::Client::builder(
11784/// #     hyper_util::rt::TokioExecutor::new()
11785/// # )
11786/// # .build(
11787/// #     hyper_rustls::HttpsConnectorBuilder::new()
11788/// #         .with_native_roots()
11789/// #         .unwrap()
11790/// #         .https_or_http()
11791/// #         .enable_http1()
11792/// #         .build()
11793/// # );
11794/// # let mut hub = Container::new(client, auth);
11795/// // You can configure optional parameters by calling the respective setters at will, and
11796/// // execute the final call using `doit()`.
11797/// // Values shown here are possibly random and not representative !
11798/// let result = hub.projects().locations_clusters_list("parent")
11799///              .zone("voluptua.")
11800///              .project_id("amet.")
11801///              .doit().await;
11802/// # }
11803/// ```
11804pub struct ProjectLocationClusterListCall<'a, C>
11805where
11806    C: 'a,
11807{
11808    hub: &'a Container<C>,
11809    _parent: String,
11810    _zone: Option<String>,
11811    _project_id: Option<String>,
11812    _delegate: Option<&'a mut dyn common::Delegate>,
11813    _additional_params: HashMap<String, String>,
11814    _scopes: BTreeSet<String>,
11815}
11816
11817impl<'a, C> common::CallBuilder for ProjectLocationClusterListCall<'a, C> {}
11818
11819impl<'a, C> ProjectLocationClusterListCall<'a, C>
11820where
11821    C: common::Connector,
11822{
11823    /// Perform the operation you have build so far.
11824    pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
11825        use std::borrow::Cow;
11826        use std::io::{Read, Seek};
11827
11828        use common::{url::Params, ToParts};
11829        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11830
11831        let mut dd = common::DefaultDelegate;
11832        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11833        dlg.begin(common::MethodInfo {
11834            id: "container.projects.locations.clusters.list",
11835            http_method: hyper::Method::GET,
11836        });
11837
11838        for &field in ["alt", "parent", "zone", "projectId"].iter() {
11839            if self._additional_params.contains_key(field) {
11840                dlg.finished(false);
11841                return Err(common::Error::FieldClash(field));
11842            }
11843        }
11844
11845        let mut params = Params::with_capacity(5 + self._additional_params.len());
11846        params.push("parent", self._parent);
11847        if let Some(value) = self._zone.as_ref() {
11848            params.push("zone", value);
11849        }
11850        if let Some(value) = self._project_id.as_ref() {
11851            params.push("projectId", value);
11852        }
11853
11854        params.extend(self._additional_params.iter());
11855
11856        params.push("alt", "json");
11857        let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
11858        if self._scopes.is_empty() {
11859            self._scopes
11860                .insert(Scope::CloudPlatform.as_ref().to_string());
11861        }
11862
11863        #[allow(clippy::single_element_loop)]
11864        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11865            url = params.uri_replacement(url, param_name, find_this, true);
11866        }
11867        {
11868            let to_remove = ["parent"];
11869            params.remove_params(&to_remove);
11870        }
11871
11872        let url = params.parse_with_url(&url);
11873
11874        loop {
11875            let token = match self
11876                .hub
11877                .auth
11878                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11879                .await
11880            {
11881                Ok(token) => token,
11882                Err(e) => match dlg.token(e) {
11883                    Ok(token) => token,
11884                    Err(e) => {
11885                        dlg.finished(false);
11886                        return Err(common::Error::MissingToken(e));
11887                    }
11888                },
11889            };
11890            let mut req_result = {
11891                let client = &self.hub.client;
11892                dlg.pre_request();
11893                let mut req_builder = hyper::Request::builder()
11894                    .method(hyper::Method::GET)
11895                    .uri(url.as_str())
11896                    .header(USER_AGENT, self.hub._user_agent.clone());
11897
11898                if let Some(token) = token.as_ref() {
11899                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11900                }
11901
11902                let request = req_builder
11903                    .header(CONTENT_LENGTH, 0_u64)
11904                    .body(common::to_body::<String>(None));
11905
11906                client.request(request.unwrap()).await
11907            };
11908
11909            match req_result {
11910                Err(err) => {
11911                    if let common::Retry::After(d) = dlg.http_error(&err) {
11912                        sleep(d).await;
11913                        continue;
11914                    }
11915                    dlg.finished(false);
11916                    return Err(common::Error::HttpError(err));
11917                }
11918                Ok(res) => {
11919                    let (mut parts, body) = res.into_parts();
11920                    let mut body = common::Body::new(body);
11921                    if !parts.status.is_success() {
11922                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11923                        let error = serde_json::from_str(&common::to_string(&bytes));
11924                        let response = common::to_response(parts, bytes.into());
11925
11926                        if let common::Retry::After(d) =
11927                            dlg.http_failure(&response, error.as_ref().ok())
11928                        {
11929                            sleep(d).await;
11930                            continue;
11931                        }
11932
11933                        dlg.finished(false);
11934
11935                        return Err(match error {
11936                            Ok(value) => common::Error::BadRequest(value),
11937                            _ => common::Error::Failure(response),
11938                        });
11939                    }
11940                    let response = {
11941                        let bytes = common::to_bytes(body).await.unwrap_or_default();
11942                        let encoded = common::to_string(&bytes);
11943                        match serde_json::from_str(&encoded) {
11944                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11945                            Err(error) => {
11946                                dlg.response_json_decode_error(&encoded, &error);
11947                                return Err(common::Error::JsonDecodeError(
11948                                    encoded.to_string(),
11949                                    error,
11950                                ));
11951                            }
11952                        }
11953                    };
11954
11955                    dlg.finished(true);
11956                    return Ok(response);
11957                }
11958            }
11959        }
11960    }
11961
11962    /// The parent (project and location) where the clusters will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
11963    ///
11964    /// Sets the *parent* path property to the given value.
11965    ///
11966    /// Even though the property as already been set when instantiating this call,
11967    /// we provide this method for API completeness.
11968    pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
11969        self._parent = new_value.to_string();
11970        self
11971    }
11972    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides, or "-" for all zones. This field has been deprecated and replaced by the parent field.
11973    ///
11974    /// Sets the *zone* query property to the given value.
11975    pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
11976        self._zone = Some(new_value.to_string());
11977        self
11978    }
11979    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
11980    ///
11981    /// Sets the *project id* query property to the given value.
11982    pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
11983        self._project_id = Some(new_value.to_string());
11984        self
11985    }
11986    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11987    /// while executing the actual API request.
11988    ///
11989    /// ````text
11990    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
11991    /// ````
11992    ///
11993    /// Sets the *delegate* property to the given value.
11994    pub fn delegate(
11995        mut self,
11996        new_value: &'a mut dyn common::Delegate,
11997    ) -> ProjectLocationClusterListCall<'a, C> {
11998        self._delegate = Some(new_value);
11999        self
12000    }
12001
12002    /// Set any additional parameter of the query string used in the request.
12003    /// It should be used to set parameters which are not yet available through their own
12004    /// setters.
12005    ///
12006    /// Please note that this method must not be used to set any of the known parameters
12007    /// which have their own setter method. If done anyway, the request will fail.
12008    ///
12009    /// # Additional Parameters
12010    ///
12011    /// * *$.xgafv* (query-string) - V1 error format.
12012    /// * *access_token* (query-string) - OAuth access token.
12013    /// * *alt* (query-string) - Data format for response.
12014    /// * *callback* (query-string) - JSONP
12015    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12016    /// * *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.
12017    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12018    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12019    /// * *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.
12020    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12021    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12022    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterListCall<'a, C>
12023    where
12024        T: AsRef<str>,
12025    {
12026        self._additional_params
12027            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12028        self
12029    }
12030
12031    /// Identifies the authorization scope for the method you are building.
12032    ///
12033    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12034    /// [`Scope::CloudPlatform`].
12035    ///
12036    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12037    /// tokens for more than one scope.
12038    ///
12039    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12040    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12041    /// sufficient, a read-write scope will do as well.
12042    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterListCall<'a, C>
12043    where
12044        St: AsRef<str>,
12045    {
12046        self._scopes.insert(String::from(scope.as_ref()));
12047        self
12048    }
12049    /// Identifies the authorization scope(s) for the method you are building.
12050    ///
12051    /// See [`Self::add_scope()`] for details.
12052    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterListCall<'a, C>
12053    where
12054        I: IntoIterator<Item = St>,
12055        St: AsRef<str>,
12056    {
12057        self._scopes
12058            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12059        self
12060    }
12061
12062    /// Removes all scopes, and no default scope will be used either.
12063    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12064    /// for details).
12065    pub fn clear_scopes(mut self) -> ProjectLocationClusterListCall<'a, C> {
12066        self._scopes.clear();
12067        self
12068    }
12069}
12070
12071/// Sets the addons for a specific cluster.
12072///
12073/// A builder for the *locations.clusters.setAddons* method supported by a *project* resource.
12074/// It is not used directly, but through a [`ProjectMethods`] instance.
12075///
12076/// # Example
12077///
12078/// Instantiate a resource method builder
12079///
12080/// ```test_harness,no_run
12081/// # extern crate hyper;
12082/// # extern crate hyper_rustls;
12083/// # extern crate google_container1 as container1;
12084/// use container1::api::SetAddonsConfigRequest;
12085/// # async fn dox() {
12086/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12087///
12088/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12089/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12090/// #     secret,
12091/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12092/// # ).build().await.unwrap();
12093///
12094/// # let client = hyper_util::client::legacy::Client::builder(
12095/// #     hyper_util::rt::TokioExecutor::new()
12096/// # )
12097/// # .build(
12098/// #     hyper_rustls::HttpsConnectorBuilder::new()
12099/// #         .with_native_roots()
12100/// #         .unwrap()
12101/// #         .https_or_http()
12102/// #         .enable_http1()
12103/// #         .build()
12104/// # );
12105/// # let mut hub = Container::new(client, auth);
12106/// // As the method needs a request, you would usually fill it with the desired information
12107/// // into the respective structure. Some of the parts shown here might not be applicable !
12108/// // Values shown here are possibly random and not representative !
12109/// let mut req = SetAddonsConfigRequest::default();
12110///
12111/// // You can configure optional parameters by calling the respective setters at will, and
12112/// // execute the final call using `doit()`.
12113/// // Values shown here are possibly random and not representative !
12114/// let result = hub.projects().locations_clusters_set_addons(req, "name")
12115///              .doit().await;
12116/// # }
12117/// ```
12118pub struct ProjectLocationClusterSetAddonCall<'a, C>
12119where
12120    C: 'a,
12121{
12122    hub: &'a Container<C>,
12123    _request: SetAddonsConfigRequest,
12124    _name: String,
12125    _delegate: Option<&'a mut dyn common::Delegate>,
12126    _additional_params: HashMap<String, String>,
12127    _scopes: BTreeSet<String>,
12128}
12129
12130impl<'a, C> common::CallBuilder for ProjectLocationClusterSetAddonCall<'a, C> {}
12131
12132impl<'a, C> ProjectLocationClusterSetAddonCall<'a, C>
12133where
12134    C: common::Connector,
12135{
12136    /// Perform the operation you have build so far.
12137    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12138        use std::borrow::Cow;
12139        use std::io::{Read, Seek};
12140
12141        use common::{url::Params, ToParts};
12142        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12143
12144        let mut dd = common::DefaultDelegate;
12145        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12146        dlg.begin(common::MethodInfo {
12147            id: "container.projects.locations.clusters.setAddons",
12148            http_method: hyper::Method::POST,
12149        });
12150
12151        for &field in ["alt", "name"].iter() {
12152            if self._additional_params.contains_key(field) {
12153                dlg.finished(false);
12154                return Err(common::Error::FieldClash(field));
12155            }
12156        }
12157
12158        let mut params = Params::with_capacity(4 + self._additional_params.len());
12159        params.push("name", self._name);
12160
12161        params.extend(self._additional_params.iter());
12162
12163        params.push("alt", "json");
12164        let mut url = self.hub._base_url.clone() + "v1/{+name}:setAddons";
12165        if self._scopes.is_empty() {
12166            self._scopes
12167                .insert(Scope::CloudPlatform.as_ref().to_string());
12168        }
12169
12170        #[allow(clippy::single_element_loop)]
12171        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12172            url = params.uri_replacement(url, param_name, find_this, true);
12173        }
12174        {
12175            let to_remove = ["name"];
12176            params.remove_params(&to_remove);
12177        }
12178
12179        let url = params.parse_with_url(&url);
12180
12181        let mut json_mime_type = mime::APPLICATION_JSON;
12182        let mut request_value_reader = {
12183            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12184            common::remove_json_null_values(&mut value);
12185            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12186            serde_json::to_writer(&mut dst, &value).unwrap();
12187            dst
12188        };
12189        let request_size = request_value_reader
12190            .seek(std::io::SeekFrom::End(0))
12191            .unwrap();
12192        request_value_reader
12193            .seek(std::io::SeekFrom::Start(0))
12194            .unwrap();
12195
12196        loop {
12197            let token = match self
12198                .hub
12199                .auth
12200                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12201                .await
12202            {
12203                Ok(token) => token,
12204                Err(e) => match dlg.token(e) {
12205                    Ok(token) => token,
12206                    Err(e) => {
12207                        dlg.finished(false);
12208                        return Err(common::Error::MissingToken(e));
12209                    }
12210                },
12211            };
12212            request_value_reader
12213                .seek(std::io::SeekFrom::Start(0))
12214                .unwrap();
12215            let mut req_result = {
12216                let client = &self.hub.client;
12217                dlg.pre_request();
12218                let mut req_builder = hyper::Request::builder()
12219                    .method(hyper::Method::POST)
12220                    .uri(url.as_str())
12221                    .header(USER_AGENT, self.hub._user_agent.clone());
12222
12223                if let Some(token) = token.as_ref() {
12224                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12225                }
12226
12227                let request = req_builder
12228                    .header(CONTENT_TYPE, json_mime_type.to_string())
12229                    .header(CONTENT_LENGTH, request_size as u64)
12230                    .body(common::to_body(
12231                        request_value_reader.get_ref().clone().into(),
12232                    ));
12233
12234                client.request(request.unwrap()).await
12235            };
12236
12237            match req_result {
12238                Err(err) => {
12239                    if let common::Retry::After(d) = dlg.http_error(&err) {
12240                        sleep(d).await;
12241                        continue;
12242                    }
12243                    dlg.finished(false);
12244                    return Err(common::Error::HttpError(err));
12245                }
12246                Ok(res) => {
12247                    let (mut parts, body) = res.into_parts();
12248                    let mut body = common::Body::new(body);
12249                    if !parts.status.is_success() {
12250                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12251                        let error = serde_json::from_str(&common::to_string(&bytes));
12252                        let response = common::to_response(parts, bytes.into());
12253
12254                        if let common::Retry::After(d) =
12255                            dlg.http_failure(&response, error.as_ref().ok())
12256                        {
12257                            sleep(d).await;
12258                            continue;
12259                        }
12260
12261                        dlg.finished(false);
12262
12263                        return Err(match error {
12264                            Ok(value) => common::Error::BadRequest(value),
12265                            _ => common::Error::Failure(response),
12266                        });
12267                    }
12268                    let response = {
12269                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12270                        let encoded = common::to_string(&bytes);
12271                        match serde_json::from_str(&encoded) {
12272                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12273                            Err(error) => {
12274                                dlg.response_json_decode_error(&encoded, &error);
12275                                return Err(common::Error::JsonDecodeError(
12276                                    encoded.to_string(),
12277                                    error,
12278                                ));
12279                            }
12280                        }
12281                    };
12282
12283                    dlg.finished(true);
12284                    return Ok(response);
12285                }
12286            }
12287        }
12288    }
12289
12290    ///
12291    /// Sets the *request* property to the given value.
12292    ///
12293    /// Even though the property as already been set when instantiating this call,
12294    /// we provide this method for API completeness.
12295    pub fn request(
12296        mut self,
12297        new_value: SetAddonsConfigRequest,
12298    ) -> ProjectLocationClusterSetAddonCall<'a, C> {
12299        self._request = new_value;
12300        self
12301    }
12302    /// The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
12303    ///
12304    /// Sets the *name* path property to the given value.
12305    ///
12306    /// Even though the property as already been set when instantiating this call,
12307    /// we provide this method for API completeness.
12308    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetAddonCall<'a, C> {
12309        self._name = new_value.to_string();
12310        self
12311    }
12312    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12313    /// while executing the actual API request.
12314    ///
12315    /// ````text
12316    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12317    /// ````
12318    ///
12319    /// Sets the *delegate* property to the given value.
12320    pub fn delegate(
12321        mut self,
12322        new_value: &'a mut dyn common::Delegate,
12323    ) -> ProjectLocationClusterSetAddonCall<'a, C> {
12324        self._delegate = Some(new_value);
12325        self
12326    }
12327
12328    /// Set any additional parameter of the query string used in the request.
12329    /// It should be used to set parameters which are not yet available through their own
12330    /// setters.
12331    ///
12332    /// Please note that this method must not be used to set any of the known parameters
12333    /// which have their own setter method. If done anyway, the request will fail.
12334    ///
12335    /// # Additional Parameters
12336    ///
12337    /// * *$.xgafv* (query-string) - V1 error format.
12338    /// * *access_token* (query-string) - OAuth access token.
12339    /// * *alt* (query-string) - Data format for response.
12340    /// * *callback* (query-string) - JSONP
12341    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12342    /// * *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.
12343    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12344    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12345    /// * *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.
12346    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12347    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12348    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetAddonCall<'a, C>
12349    where
12350        T: AsRef<str>,
12351    {
12352        self._additional_params
12353            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12354        self
12355    }
12356
12357    /// Identifies the authorization scope for the method you are building.
12358    ///
12359    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12360    /// [`Scope::CloudPlatform`].
12361    ///
12362    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12363    /// tokens for more than one scope.
12364    ///
12365    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12366    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12367    /// sufficient, a read-write scope will do as well.
12368    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetAddonCall<'a, C>
12369    where
12370        St: AsRef<str>,
12371    {
12372        self._scopes.insert(String::from(scope.as_ref()));
12373        self
12374    }
12375    /// Identifies the authorization scope(s) for the method you are building.
12376    ///
12377    /// See [`Self::add_scope()`] for details.
12378    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetAddonCall<'a, C>
12379    where
12380        I: IntoIterator<Item = St>,
12381        St: AsRef<str>,
12382    {
12383        self._scopes
12384            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12385        self
12386    }
12387
12388    /// Removes all scopes, and no default scope will be used either.
12389    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12390    /// for details).
12391    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetAddonCall<'a, C> {
12392        self._scopes.clear();
12393        self
12394    }
12395}
12396
12397/// Enables or disables the ABAC authorization mechanism on a cluster.
12398///
12399/// A builder for the *locations.clusters.setLegacyAbac* method supported by a *project* resource.
12400/// It is not used directly, but through a [`ProjectMethods`] instance.
12401///
12402/// # Example
12403///
12404/// Instantiate a resource method builder
12405///
12406/// ```test_harness,no_run
12407/// # extern crate hyper;
12408/// # extern crate hyper_rustls;
12409/// # extern crate google_container1 as container1;
12410/// use container1::api::SetLegacyAbacRequest;
12411/// # async fn dox() {
12412/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12413///
12414/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12415/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12416/// #     secret,
12417/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12418/// # ).build().await.unwrap();
12419///
12420/// # let client = hyper_util::client::legacy::Client::builder(
12421/// #     hyper_util::rt::TokioExecutor::new()
12422/// # )
12423/// # .build(
12424/// #     hyper_rustls::HttpsConnectorBuilder::new()
12425/// #         .with_native_roots()
12426/// #         .unwrap()
12427/// #         .https_or_http()
12428/// #         .enable_http1()
12429/// #         .build()
12430/// # );
12431/// # let mut hub = Container::new(client, auth);
12432/// // As the method needs a request, you would usually fill it with the desired information
12433/// // into the respective structure. Some of the parts shown here might not be applicable !
12434/// // Values shown here are possibly random and not representative !
12435/// let mut req = SetLegacyAbacRequest::default();
12436///
12437/// // You can configure optional parameters by calling the respective setters at will, and
12438/// // execute the final call using `doit()`.
12439/// // Values shown here are possibly random and not representative !
12440/// let result = hub.projects().locations_clusters_set_legacy_abac(req, "name")
12441///              .doit().await;
12442/// # }
12443/// ```
12444pub struct ProjectLocationClusterSetLegacyAbacCall<'a, C>
12445where
12446    C: 'a,
12447{
12448    hub: &'a Container<C>,
12449    _request: SetLegacyAbacRequest,
12450    _name: String,
12451    _delegate: Option<&'a mut dyn common::Delegate>,
12452    _additional_params: HashMap<String, String>,
12453    _scopes: BTreeSet<String>,
12454}
12455
12456impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLegacyAbacCall<'a, C> {}
12457
12458impl<'a, C> ProjectLocationClusterSetLegacyAbacCall<'a, C>
12459where
12460    C: common::Connector,
12461{
12462    /// Perform the operation you have build so far.
12463    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12464        use std::borrow::Cow;
12465        use std::io::{Read, Seek};
12466
12467        use common::{url::Params, ToParts};
12468        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12469
12470        let mut dd = common::DefaultDelegate;
12471        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12472        dlg.begin(common::MethodInfo {
12473            id: "container.projects.locations.clusters.setLegacyAbac",
12474            http_method: hyper::Method::POST,
12475        });
12476
12477        for &field in ["alt", "name"].iter() {
12478            if self._additional_params.contains_key(field) {
12479                dlg.finished(false);
12480                return Err(common::Error::FieldClash(field));
12481            }
12482        }
12483
12484        let mut params = Params::with_capacity(4 + self._additional_params.len());
12485        params.push("name", self._name);
12486
12487        params.extend(self._additional_params.iter());
12488
12489        params.push("alt", "json");
12490        let mut url = self.hub._base_url.clone() + "v1/{+name}:setLegacyAbac";
12491        if self._scopes.is_empty() {
12492            self._scopes
12493                .insert(Scope::CloudPlatform.as_ref().to_string());
12494        }
12495
12496        #[allow(clippy::single_element_loop)]
12497        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12498            url = params.uri_replacement(url, param_name, find_this, true);
12499        }
12500        {
12501            let to_remove = ["name"];
12502            params.remove_params(&to_remove);
12503        }
12504
12505        let url = params.parse_with_url(&url);
12506
12507        let mut json_mime_type = mime::APPLICATION_JSON;
12508        let mut request_value_reader = {
12509            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12510            common::remove_json_null_values(&mut value);
12511            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12512            serde_json::to_writer(&mut dst, &value).unwrap();
12513            dst
12514        };
12515        let request_size = request_value_reader
12516            .seek(std::io::SeekFrom::End(0))
12517            .unwrap();
12518        request_value_reader
12519            .seek(std::io::SeekFrom::Start(0))
12520            .unwrap();
12521
12522        loop {
12523            let token = match self
12524                .hub
12525                .auth
12526                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12527                .await
12528            {
12529                Ok(token) => token,
12530                Err(e) => match dlg.token(e) {
12531                    Ok(token) => token,
12532                    Err(e) => {
12533                        dlg.finished(false);
12534                        return Err(common::Error::MissingToken(e));
12535                    }
12536                },
12537            };
12538            request_value_reader
12539                .seek(std::io::SeekFrom::Start(0))
12540                .unwrap();
12541            let mut req_result = {
12542                let client = &self.hub.client;
12543                dlg.pre_request();
12544                let mut req_builder = hyper::Request::builder()
12545                    .method(hyper::Method::POST)
12546                    .uri(url.as_str())
12547                    .header(USER_AGENT, self.hub._user_agent.clone());
12548
12549                if let Some(token) = token.as_ref() {
12550                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12551                }
12552
12553                let request = req_builder
12554                    .header(CONTENT_TYPE, json_mime_type.to_string())
12555                    .header(CONTENT_LENGTH, request_size as u64)
12556                    .body(common::to_body(
12557                        request_value_reader.get_ref().clone().into(),
12558                    ));
12559
12560                client.request(request.unwrap()).await
12561            };
12562
12563            match req_result {
12564                Err(err) => {
12565                    if let common::Retry::After(d) = dlg.http_error(&err) {
12566                        sleep(d).await;
12567                        continue;
12568                    }
12569                    dlg.finished(false);
12570                    return Err(common::Error::HttpError(err));
12571                }
12572                Ok(res) => {
12573                    let (mut parts, body) = res.into_parts();
12574                    let mut body = common::Body::new(body);
12575                    if !parts.status.is_success() {
12576                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12577                        let error = serde_json::from_str(&common::to_string(&bytes));
12578                        let response = common::to_response(parts, bytes.into());
12579
12580                        if let common::Retry::After(d) =
12581                            dlg.http_failure(&response, error.as_ref().ok())
12582                        {
12583                            sleep(d).await;
12584                            continue;
12585                        }
12586
12587                        dlg.finished(false);
12588
12589                        return Err(match error {
12590                            Ok(value) => common::Error::BadRequest(value),
12591                            _ => common::Error::Failure(response),
12592                        });
12593                    }
12594                    let response = {
12595                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12596                        let encoded = common::to_string(&bytes);
12597                        match serde_json::from_str(&encoded) {
12598                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12599                            Err(error) => {
12600                                dlg.response_json_decode_error(&encoded, &error);
12601                                return Err(common::Error::JsonDecodeError(
12602                                    encoded.to_string(),
12603                                    error,
12604                                ));
12605                            }
12606                        }
12607                    };
12608
12609                    dlg.finished(true);
12610                    return Ok(response);
12611                }
12612            }
12613        }
12614    }
12615
12616    ///
12617    /// Sets the *request* property to the given value.
12618    ///
12619    /// Even though the property as already been set when instantiating this call,
12620    /// we provide this method for API completeness.
12621    pub fn request(
12622        mut self,
12623        new_value: SetLegacyAbacRequest,
12624    ) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
12625        self._request = new_value;
12626        self
12627    }
12628    /// The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
12629    ///
12630    /// Sets the *name* path property to the given value.
12631    ///
12632    /// Even though the property as already been set when instantiating this call,
12633    /// we provide this method for API completeness.
12634    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
12635        self._name = new_value.to_string();
12636        self
12637    }
12638    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12639    /// while executing the actual API request.
12640    ///
12641    /// ````text
12642    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12643    /// ````
12644    ///
12645    /// Sets the *delegate* property to the given value.
12646    pub fn delegate(
12647        mut self,
12648        new_value: &'a mut dyn common::Delegate,
12649    ) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
12650        self._delegate = Some(new_value);
12651        self
12652    }
12653
12654    /// Set any additional parameter of the query string used in the request.
12655    /// It should be used to set parameters which are not yet available through their own
12656    /// setters.
12657    ///
12658    /// Please note that this method must not be used to set any of the known parameters
12659    /// which have their own setter method. If done anyway, the request will fail.
12660    ///
12661    /// # Additional Parameters
12662    ///
12663    /// * *$.xgafv* (query-string) - V1 error format.
12664    /// * *access_token* (query-string) - OAuth access token.
12665    /// * *alt* (query-string) - Data format for response.
12666    /// * *callback* (query-string) - JSONP
12667    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12668    /// * *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.
12669    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12670    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12671    /// * *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.
12672    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12673    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12674    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
12675    where
12676        T: AsRef<str>,
12677    {
12678        self._additional_params
12679            .insert(name.as_ref().to_string(), value.as_ref().to_string());
12680        self
12681    }
12682
12683    /// Identifies the authorization scope for the method you are building.
12684    ///
12685    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12686    /// [`Scope::CloudPlatform`].
12687    ///
12688    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12689    /// tokens for more than one scope.
12690    ///
12691    /// Usually there is more than one suitable scope to authorize an operation, some of which may
12692    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12693    /// sufficient, a read-write scope will do as well.
12694    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
12695    where
12696        St: AsRef<str>,
12697    {
12698        self._scopes.insert(String::from(scope.as_ref()));
12699        self
12700    }
12701    /// Identifies the authorization scope(s) for the method you are building.
12702    ///
12703    /// See [`Self::add_scope()`] for details.
12704    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
12705    where
12706        I: IntoIterator<Item = St>,
12707        St: AsRef<str>,
12708    {
12709        self._scopes
12710            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12711        self
12712    }
12713
12714    /// Removes all scopes, and no default scope will be used either.
12715    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12716    /// for details).
12717    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
12718        self._scopes.clear();
12719        self
12720    }
12721}
12722
12723/// Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) instead.
12724///
12725/// A builder for the *locations.clusters.setLocations* method supported by a *project* resource.
12726/// It is not used directly, but through a [`ProjectMethods`] instance.
12727///
12728/// # Example
12729///
12730/// Instantiate a resource method builder
12731///
12732/// ```test_harness,no_run
12733/// # extern crate hyper;
12734/// # extern crate hyper_rustls;
12735/// # extern crate google_container1 as container1;
12736/// use container1::api::SetLocationsRequest;
12737/// # async fn dox() {
12738/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12739///
12740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12741/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
12742/// #     secret,
12743/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12744/// # ).build().await.unwrap();
12745///
12746/// # let client = hyper_util::client::legacy::Client::builder(
12747/// #     hyper_util::rt::TokioExecutor::new()
12748/// # )
12749/// # .build(
12750/// #     hyper_rustls::HttpsConnectorBuilder::new()
12751/// #         .with_native_roots()
12752/// #         .unwrap()
12753/// #         .https_or_http()
12754/// #         .enable_http1()
12755/// #         .build()
12756/// # );
12757/// # let mut hub = Container::new(client, auth);
12758/// // As the method needs a request, you would usually fill it with the desired information
12759/// // into the respective structure. Some of the parts shown here might not be applicable !
12760/// // Values shown here are possibly random and not representative !
12761/// let mut req = SetLocationsRequest::default();
12762///
12763/// // You can configure optional parameters by calling the respective setters at will, and
12764/// // execute the final call using `doit()`.
12765/// // Values shown here are possibly random and not representative !
12766/// let result = hub.projects().locations_clusters_set_locations(req, "name")
12767///              .doit().await;
12768/// # }
12769/// ```
12770pub struct ProjectLocationClusterSetLocationCall<'a, C>
12771where
12772    C: 'a,
12773{
12774    hub: &'a Container<C>,
12775    _request: SetLocationsRequest,
12776    _name: String,
12777    _delegate: Option<&'a mut dyn common::Delegate>,
12778    _additional_params: HashMap<String, String>,
12779    _scopes: BTreeSet<String>,
12780}
12781
12782impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLocationCall<'a, C> {}
12783
12784impl<'a, C> ProjectLocationClusterSetLocationCall<'a, C>
12785where
12786    C: common::Connector,
12787{
12788    /// Perform the operation you have build so far.
12789    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12790        use std::borrow::Cow;
12791        use std::io::{Read, Seek};
12792
12793        use common::{url::Params, ToParts};
12794        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12795
12796        let mut dd = common::DefaultDelegate;
12797        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12798        dlg.begin(common::MethodInfo {
12799            id: "container.projects.locations.clusters.setLocations",
12800            http_method: hyper::Method::POST,
12801        });
12802
12803        for &field in ["alt", "name"].iter() {
12804            if self._additional_params.contains_key(field) {
12805                dlg.finished(false);
12806                return Err(common::Error::FieldClash(field));
12807            }
12808        }
12809
12810        let mut params = Params::with_capacity(4 + self._additional_params.len());
12811        params.push("name", self._name);
12812
12813        params.extend(self._additional_params.iter());
12814
12815        params.push("alt", "json");
12816        let mut url = self.hub._base_url.clone() + "v1/{+name}:setLocations";
12817        if self._scopes.is_empty() {
12818            self._scopes
12819                .insert(Scope::CloudPlatform.as_ref().to_string());
12820        }
12821
12822        #[allow(clippy::single_element_loop)]
12823        for &(find_this, param_name) in [("{+name}", "name")].iter() {
12824            url = params.uri_replacement(url, param_name, find_this, true);
12825        }
12826        {
12827            let to_remove = ["name"];
12828            params.remove_params(&to_remove);
12829        }
12830
12831        let url = params.parse_with_url(&url);
12832
12833        let mut json_mime_type = mime::APPLICATION_JSON;
12834        let mut request_value_reader = {
12835            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12836            common::remove_json_null_values(&mut value);
12837            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12838            serde_json::to_writer(&mut dst, &value).unwrap();
12839            dst
12840        };
12841        let request_size = request_value_reader
12842            .seek(std::io::SeekFrom::End(0))
12843            .unwrap();
12844        request_value_reader
12845            .seek(std::io::SeekFrom::Start(0))
12846            .unwrap();
12847
12848        loop {
12849            let token = match self
12850                .hub
12851                .auth
12852                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12853                .await
12854            {
12855                Ok(token) => token,
12856                Err(e) => match dlg.token(e) {
12857                    Ok(token) => token,
12858                    Err(e) => {
12859                        dlg.finished(false);
12860                        return Err(common::Error::MissingToken(e));
12861                    }
12862                },
12863            };
12864            request_value_reader
12865                .seek(std::io::SeekFrom::Start(0))
12866                .unwrap();
12867            let mut req_result = {
12868                let client = &self.hub.client;
12869                dlg.pre_request();
12870                let mut req_builder = hyper::Request::builder()
12871                    .method(hyper::Method::POST)
12872                    .uri(url.as_str())
12873                    .header(USER_AGENT, self.hub._user_agent.clone());
12874
12875                if let Some(token) = token.as_ref() {
12876                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12877                }
12878
12879                let request = req_builder
12880                    .header(CONTENT_TYPE, json_mime_type.to_string())
12881                    .header(CONTENT_LENGTH, request_size as u64)
12882                    .body(common::to_body(
12883                        request_value_reader.get_ref().clone().into(),
12884                    ));
12885
12886                client.request(request.unwrap()).await
12887            };
12888
12889            match req_result {
12890                Err(err) => {
12891                    if let common::Retry::After(d) = dlg.http_error(&err) {
12892                        sleep(d).await;
12893                        continue;
12894                    }
12895                    dlg.finished(false);
12896                    return Err(common::Error::HttpError(err));
12897                }
12898                Ok(res) => {
12899                    let (mut parts, body) = res.into_parts();
12900                    let mut body = common::Body::new(body);
12901                    if !parts.status.is_success() {
12902                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12903                        let error = serde_json::from_str(&common::to_string(&bytes));
12904                        let response = common::to_response(parts, bytes.into());
12905
12906                        if let common::Retry::After(d) =
12907                            dlg.http_failure(&response, error.as_ref().ok())
12908                        {
12909                            sleep(d).await;
12910                            continue;
12911                        }
12912
12913                        dlg.finished(false);
12914
12915                        return Err(match error {
12916                            Ok(value) => common::Error::BadRequest(value),
12917                            _ => common::Error::Failure(response),
12918                        });
12919                    }
12920                    let response = {
12921                        let bytes = common::to_bytes(body).await.unwrap_or_default();
12922                        let encoded = common::to_string(&bytes);
12923                        match serde_json::from_str(&encoded) {
12924                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12925                            Err(error) => {
12926                                dlg.response_json_decode_error(&encoded, &error);
12927                                return Err(common::Error::JsonDecodeError(
12928                                    encoded.to_string(),
12929                                    error,
12930                                ));
12931                            }
12932                        }
12933                    };
12934
12935                    dlg.finished(true);
12936                    return Ok(response);
12937                }
12938            }
12939        }
12940    }
12941
12942    ///
12943    /// Sets the *request* property to the given value.
12944    ///
12945    /// Even though the property as already been set when instantiating this call,
12946    /// we provide this method for API completeness.
12947    pub fn request(
12948        mut self,
12949        new_value: SetLocationsRequest,
12950    ) -> ProjectLocationClusterSetLocationCall<'a, C> {
12951        self._request = new_value;
12952        self
12953    }
12954    /// The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
12955    ///
12956    /// Sets the *name* path property to the given value.
12957    ///
12958    /// Even though the property as already been set when instantiating this call,
12959    /// we provide this method for API completeness.
12960    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLocationCall<'a, C> {
12961        self._name = new_value.to_string();
12962        self
12963    }
12964    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12965    /// while executing the actual API request.
12966    ///
12967    /// ````text
12968    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
12969    /// ````
12970    ///
12971    /// Sets the *delegate* property to the given value.
12972    pub fn delegate(
12973        mut self,
12974        new_value: &'a mut dyn common::Delegate,
12975    ) -> ProjectLocationClusterSetLocationCall<'a, C> {
12976        self._delegate = Some(new_value);
12977        self
12978    }
12979
12980    /// Set any additional parameter of the query string used in the request.
12981    /// It should be used to set parameters which are not yet available through their own
12982    /// setters.
12983    ///
12984    /// Please note that this method must not be used to set any of the known parameters
12985    /// which have their own setter method. If done anyway, the request will fail.
12986    ///
12987    /// # Additional Parameters
12988    ///
12989    /// * *$.xgafv* (query-string) - V1 error format.
12990    /// * *access_token* (query-string) - OAuth access token.
12991    /// * *alt* (query-string) - Data format for response.
12992    /// * *callback* (query-string) - JSONP
12993    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12994    /// * *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.
12995    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12996    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12997    /// * *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.
12998    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12999    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13000    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLocationCall<'a, C>
13001    where
13002        T: AsRef<str>,
13003    {
13004        self._additional_params
13005            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13006        self
13007    }
13008
13009    /// Identifies the authorization scope for the method you are building.
13010    ///
13011    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13012    /// [`Scope::CloudPlatform`].
13013    ///
13014    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13015    /// tokens for more than one scope.
13016    ///
13017    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13018    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13019    /// sufficient, a read-write scope will do as well.
13020    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLocationCall<'a, C>
13021    where
13022        St: AsRef<str>,
13023    {
13024        self._scopes.insert(String::from(scope.as_ref()));
13025        self
13026    }
13027    /// Identifies the authorization scope(s) for the method you are building.
13028    ///
13029    /// See [`Self::add_scope()`] for details.
13030    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLocationCall<'a, C>
13031    where
13032        I: IntoIterator<Item = St>,
13033        St: AsRef<str>,
13034    {
13035        self._scopes
13036            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13037        self
13038    }
13039
13040    /// Removes all scopes, and no default scope will be used either.
13041    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13042    /// for details).
13043    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLocationCall<'a, C> {
13044        self._scopes.clear();
13045        self
13046    }
13047}
13048
13049/// Sets the logging service for a specific cluster.
13050///
13051/// A builder for the *locations.clusters.setLogging* method supported by a *project* resource.
13052/// It is not used directly, but through a [`ProjectMethods`] instance.
13053///
13054/// # Example
13055///
13056/// Instantiate a resource method builder
13057///
13058/// ```test_harness,no_run
13059/// # extern crate hyper;
13060/// # extern crate hyper_rustls;
13061/// # extern crate google_container1 as container1;
13062/// use container1::api::SetLoggingServiceRequest;
13063/// # async fn dox() {
13064/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13065///
13066/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13067/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13068/// #     secret,
13069/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13070/// # ).build().await.unwrap();
13071///
13072/// # let client = hyper_util::client::legacy::Client::builder(
13073/// #     hyper_util::rt::TokioExecutor::new()
13074/// # )
13075/// # .build(
13076/// #     hyper_rustls::HttpsConnectorBuilder::new()
13077/// #         .with_native_roots()
13078/// #         .unwrap()
13079/// #         .https_or_http()
13080/// #         .enable_http1()
13081/// #         .build()
13082/// # );
13083/// # let mut hub = Container::new(client, auth);
13084/// // As the method needs a request, you would usually fill it with the desired information
13085/// // into the respective structure. Some of the parts shown here might not be applicable !
13086/// // Values shown here are possibly random and not representative !
13087/// let mut req = SetLoggingServiceRequest::default();
13088///
13089/// // You can configure optional parameters by calling the respective setters at will, and
13090/// // execute the final call using `doit()`.
13091/// // Values shown here are possibly random and not representative !
13092/// let result = hub.projects().locations_clusters_set_logging(req, "name")
13093///              .doit().await;
13094/// # }
13095/// ```
13096pub struct ProjectLocationClusterSetLoggingCall<'a, C>
13097where
13098    C: 'a,
13099{
13100    hub: &'a Container<C>,
13101    _request: SetLoggingServiceRequest,
13102    _name: String,
13103    _delegate: Option<&'a mut dyn common::Delegate>,
13104    _additional_params: HashMap<String, String>,
13105    _scopes: BTreeSet<String>,
13106}
13107
13108impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLoggingCall<'a, C> {}
13109
13110impl<'a, C> ProjectLocationClusterSetLoggingCall<'a, C>
13111where
13112    C: common::Connector,
13113{
13114    /// Perform the operation you have build so far.
13115    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13116        use std::borrow::Cow;
13117        use std::io::{Read, Seek};
13118
13119        use common::{url::Params, ToParts};
13120        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13121
13122        let mut dd = common::DefaultDelegate;
13123        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13124        dlg.begin(common::MethodInfo {
13125            id: "container.projects.locations.clusters.setLogging",
13126            http_method: hyper::Method::POST,
13127        });
13128
13129        for &field in ["alt", "name"].iter() {
13130            if self._additional_params.contains_key(field) {
13131                dlg.finished(false);
13132                return Err(common::Error::FieldClash(field));
13133            }
13134        }
13135
13136        let mut params = Params::with_capacity(4 + self._additional_params.len());
13137        params.push("name", self._name);
13138
13139        params.extend(self._additional_params.iter());
13140
13141        params.push("alt", "json");
13142        let mut url = self.hub._base_url.clone() + "v1/{+name}:setLogging";
13143        if self._scopes.is_empty() {
13144            self._scopes
13145                .insert(Scope::CloudPlatform.as_ref().to_string());
13146        }
13147
13148        #[allow(clippy::single_element_loop)]
13149        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13150            url = params.uri_replacement(url, param_name, find_this, true);
13151        }
13152        {
13153            let to_remove = ["name"];
13154            params.remove_params(&to_remove);
13155        }
13156
13157        let url = params.parse_with_url(&url);
13158
13159        let mut json_mime_type = mime::APPLICATION_JSON;
13160        let mut request_value_reader = {
13161            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13162            common::remove_json_null_values(&mut value);
13163            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13164            serde_json::to_writer(&mut dst, &value).unwrap();
13165            dst
13166        };
13167        let request_size = request_value_reader
13168            .seek(std::io::SeekFrom::End(0))
13169            .unwrap();
13170        request_value_reader
13171            .seek(std::io::SeekFrom::Start(0))
13172            .unwrap();
13173
13174        loop {
13175            let token = match self
13176                .hub
13177                .auth
13178                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13179                .await
13180            {
13181                Ok(token) => token,
13182                Err(e) => match dlg.token(e) {
13183                    Ok(token) => token,
13184                    Err(e) => {
13185                        dlg.finished(false);
13186                        return Err(common::Error::MissingToken(e));
13187                    }
13188                },
13189            };
13190            request_value_reader
13191                .seek(std::io::SeekFrom::Start(0))
13192                .unwrap();
13193            let mut req_result = {
13194                let client = &self.hub.client;
13195                dlg.pre_request();
13196                let mut req_builder = hyper::Request::builder()
13197                    .method(hyper::Method::POST)
13198                    .uri(url.as_str())
13199                    .header(USER_AGENT, self.hub._user_agent.clone());
13200
13201                if let Some(token) = token.as_ref() {
13202                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13203                }
13204
13205                let request = req_builder
13206                    .header(CONTENT_TYPE, json_mime_type.to_string())
13207                    .header(CONTENT_LENGTH, request_size as u64)
13208                    .body(common::to_body(
13209                        request_value_reader.get_ref().clone().into(),
13210                    ));
13211
13212                client.request(request.unwrap()).await
13213            };
13214
13215            match req_result {
13216                Err(err) => {
13217                    if let common::Retry::After(d) = dlg.http_error(&err) {
13218                        sleep(d).await;
13219                        continue;
13220                    }
13221                    dlg.finished(false);
13222                    return Err(common::Error::HttpError(err));
13223                }
13224                Ok(res) => {
13225                    let (mut parts, body) = res.into_parts();
13226                    let mut body = common::Body::new(body);
13227                    if !parts.status.is_success() {
13228                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13229                        let error = serde_json::from_str(&common::to_string(&bytes));
13230                        let response = common::to_response(parts, bytes.into());
13231
13232                        if let common::Retry::After(d) =
13233                            dlg.http_failure(&response, error.as_ref().ok())
13234                        {
13235                            sleep(d).await;
13236                            continue;
13237                        }
13238
13239                        dlg.finished(false);
13240
13241                        return Err(match error {
13242                            Ok(value) => common::Error::BadRequest(value),
13243                            _ => common::Error::Failure(response),
13244                        });
13245                    }
13246                    let response = {
13247                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13248                        let encoded = common::to_string(&bytes);
13249                        match serde_json::from_str(&encoded) {
13250                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13251                            Err(error) => {
13252                                dlg.response_json_decode_error(&encoded, &error);
13253                                return Err(common::Error::JsonDecodeError(
13254                                    encoded.to_string(),
13255                                    error,
13256                                ));
13257                            }
13258                        }
13259                    };
13260
13261                    dlg.finished(true);
13262                    return Ok(response);
13263                }
13264            }
13265        }
13266    }
13267
13268    ///
13269    /// Sets the *request* property to the given value.
13270    ///
13271    /// Even though the property as already been set when instantiating this call,
13272    /// we provide this method for API completeness.
13273    pub fn request(
13274        mut self,
13275        new_value: SetLoggingServiceRequest,
13276    ) -> ProjectLocationClusterSetLoggingCall<'a, C> {
13277        self._request = new_value;
13278        self
13279    }
13280    /// The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
13281    ///
13282    /// Sets the *name* path property to the given value.
13283    ///
13284    /// Even though the property as already been set when instantiating this call,
13285    /// we provide this method for API completeness.
13286    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLoggingCall<'a, C> {
13287        self._name = new_value.to_string();
13288        self
13289    }
13290    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13291    /// while executing the actual API request.
13292    ///
13293    /// ````text
13294    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13295    /// ````
13296    ///
13297    /// Sets the *delegate* property to the given value.
13298    pub fn delegate(
13299        mut self,
13300        new_value: &'a mut dyn common::Delegate,
13301    ) -> ProjectLocationClusterSetLoggingCall<'a, C> {
13302        self._delegate = Some(new_value);
13303        self
13304    }
13305
13306    /// Set any additional parameter of the query string used in the request.
13307    /// It should be used to set parameters which are not yet available through their own
13308    /// setters.
13309    ///
13310    /// Please note that this method must not be used to set any of the known parameters
13311    /// which have their own setter method. If done anyway, the request will fail.
13312    ///
13313    /// # Additional Parameters
13314    ///
13315    /// * *$.xgafv* (query-string) - V1 error format.
13316    /// * *access_token* (query-string) - OAuth access token.
13317    /// * *alt* (query-string) - Data format for response.
13318    /// * *callback* (query-string) - JSONP
13319    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13320    /// * *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.
13321    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13322    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13323    /// * *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.
13324    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13325    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13326    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLoggingCall<'a, C>
13327    where
13328        T: AsRef<str>,
13329    {
13330        self._additional_params
13331            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13332        self
13333    }
13334
13335    /// Identifies the authorization scope for the method you are building.
13336    ///
13337    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13338    /// [`Scope::CloudPlatform`].
13339    ///
13340    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13341    /// tokens for more than one scope.
13342    ///
13343    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13344    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13345    /// sufficient, a read-write scope will do as well.
13346    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLoggingCall<'a, C>
13347    where
13348        St: AsRef<str>,
13349    {
13350        self._scopes.insert(String::from(scope.as_ref()));
13351        self
13352    }
13353    /// Identifies the authorization scope(s) for the method you are building.
13354    ///
13355    /// See [`Self::add_scope()`] for details.
13356    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLoggingCall<'a, C>
13357    where
13358        I: IntoIterator<Item = St>,
13359        St: AsRef<str>,
13360    {
13361        self._scopes
13362            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13363        self
13364    }
13365
13366    /// Removes all scopes, and no default scope will be used either.
13367    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13368    /// for details).
13369    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLoggingCall<'a, C> {
13370        self._scopes.clear();
13371        self
13372    }
13373}
13374
13375/// Sets the maintenance policy for a cluster.
13376///
13377/// A builder for the *locations.clusters.setMaintenancePolicy* method supported by a *project* resource.
13378/// It is not used directly, but through a [`ProjectMethods`] instance.
13379///
13380/// # Example
13381///
13382/// Instantiate a resource method builder
13383///
13384/// ```test_harness,no_run
13385/// # extern crate hyper;
13386/// # extern crate hyper_rustls;
13387/// # extern crate google_container1 as container1;
13388/// use container1::api::SetMaintenancePolicyRequest;
13389/// # async fn dox() {
13390/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13391///
13392/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13393/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13394/// #     secret,
13395/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13396/// # ).build().await.unwrap();
13397///
13398/// # let client = hyper_util::client::legacy::Client::builder(
13399/// #     hyper_util::rt::TokioExecutor::new()
13400/// # )
13401/// # .build(
13402/// #     hyper_rustls::HttpsConnectorBuilder::new()
13403/// #         .with_native_roots()
13404/// #         .unwrap()
13405/// #         .https_or_http()
13406/// #         .enable_http1()
13407/// #         .build()
13408/// # );
13409/// # let mut hub = Container::new(client, auth);
13410/// // As the method needs a request, you would usually fill it with the desired information
13411/// // into the respective structure. Some of the parts shown here might not be applicable !
13412/// // Values shown here are possibly random and not representative !
13413/// let mut req = SetMaintenancePolicyRequest::default();
13414///
13415/// // You can configure optional parameters by calling the respective setters at will, and
13416/// // execute the final call using `doit()`.
13417/// // Values shown here are possibly random and not representative !
13418/// let result = hub.projects().locations_clusters_set_maintenance_policy(req, "name")
13419///              .doit().await;
13420/// # }
13421/// ```
13422pub struct ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
13423where
13424    C: 'a,
13425{
13426    hub: &'a Container<C>,
13427    _request: SetMaintenancePolicyRequest,
13428    _name: String,
13429    _delegate: Option<&'a mut dyn common::Delegate>,
13430    _additional_params: HashMap<String, String>,
13431    _scopes: BTreeSet<String>,
13432}
13433
13434impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {}
13435
13436impl<'a, C> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
13437where
13438    C: common::Connector,
13439{
13440    /// Perform the operation you have build so far.
13441    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13442        use std::borrow::Cow;
13443        use std::io::{Read, Seek};
13444
13445        use common::{url::Params, ToParts};
13446        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13447
13448        let mut dd = common::DefaultDelegate;
13449        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13450        dlg.begin(common::MethodInfo {
13451            id: "container.projects.locations.clusters.setMaintenancePolicy",
13452            http_method: hyper::Method::POST,
13453        });
13454
13455        for &field in ["alt", "name"].iter() {
13456            if self._additional_params.contains_key(field) {
13457                dlg.finished(false);
13458                return Err(common::Error::FieldClash(field));
13459            }
13460        }
13461
13462        let mut params = Params::with_capacity(4 + self._additional_params.len());
13463        params.push("name", self._name);
13464
13465        params.extend(self._additional_params.iter());
13466
13467        params.push("alt", "json");
13468        let mut url = self.hub._base_url.clone() + "v1/{+name}:setMaintenancePolicy";
13469        if self._scopes.is_empty() {
13470            self._scopes
13471                .insert(Scope::CloudPlatform.as_ref().to_string());
13472        }
13473
13474        #[allow(clippy::single_element_loop)]
13475        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13476            url = params.uri_replacement(url, param_name, find_this, true);
13477        }
13478        {
13479            let to_remove = ["name"];
13480            params.remove_params(&to_remove);
13481        }
13482
13483        let url = params.parse_with_url(&url);
13484
13485        let mut json_mime_type = mime::APPLICATION_JSON;
13486        let mut request_value_reader = {
13487            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13488            common::remove_json_null_values(&mut value);
13489            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13490            serde_json::to_writer(&mut dst, &value).unwrap();
13491            dst
13492        };
13493        let request_size = request_value_reader
13494            .seek(std::io::SeekFrom::End(0))
13495            .unwrap();
13496        request_value_reader
13497            .seek(std::io::SeekFrom::Start(0))
13498            .unwrap();
13499
13500        loop {
13501            let token = match self
13502                .hub
13503                .auth
13504                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13505                .await
13506            {
13507                Ok(token) => token,
13508                Err(e) => match dlg.token(e) {
13509                    Ok(token) => token,
13510                    Err(e) => {
13511                        dlg.finished(false);
13512                        return Err(common::Error::MissingToken(e));
13513                    }
13514                },
13515            };
13516            request_value_reader
13517                .seek(std::io::SeekFrom::Start(0))
13518                .unwrap();
13519            let mut req_result = {
13520                let client = &self.hub.client;
13521                dlg.pre_request();
13522                let mut req_builder = hyper::Request::builder()
13523                    .method(hyper::Method::POST)
13524                    .uri(url.as_str())
13525                    .header(USER_AGENT, self.hub._user_agent.clone());
13526
13527                if let Some(token) = token.as_ref() {
13528                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13529                }
13530
13531                let request = req_builder
13532                    .header(CONTENT_TYPE, json_mime_type.to_string())
13533                    .header(CONTENT_LENGTH, request_size as u64)
13534                    .body(common::to_body(
13535                        request_value_reader.get_ref().clone().into(),
13536                    ));
13537
13538                client.request(request.unwrap()).await
13539            };
13540
13541            match req_result {
13542                Err(err) => {
13543                    if let common::Retry::After(d) = dlg.http_error(&err) {
13544                        sleep(d).await;
13545                        continue;
13546                    }
13547                    dlg.finished(false);
13548                    return Err(common::Error::HttpError(err));
13549                }
13550                Ok(res) => {
13551                    let (mut parts, body) = res.into_parts();
13552                    let mut body = common::Body::new(body);
13553                    if !parts.status.is_success() {
13554                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13555                        let error = serde_json::from_str(&common::to_string(&bytes));
13556                        let response = common::to_response(parts, bytes.into());
13557
13558                        if let common::Retry::After(d) =
13559                            dlg.http_failure(&response, error.as_ref().ok())
13560                        {
13561                            sleep(d).await;
13562                            continue;
13563                        }
13564
13565                        dlg.finished(false);
13566
13567                        return Err(match error {
13568                            Ok(value) => common::Error::BadRequest(value),
13569                            _ => common::Error::Failure(response),
13570                        });
13571                    }
13572                    let response = {
13573                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13574                        let encoded = common::to_string(&bytes);
13575                        match serde_json::from_str(&encoded) {
13576                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13577                            Err(error) => {
13578                                dlg.response_json_decode_error(&encoded, &error);
13579                                return Err(common::Error::JsonDecodeError(
13580                                    encoded.to_string(),
13581                                    error,
13582                                ));
13583                            }
13584                        }
13585                    };
13586
13587                    dlg.finished(true);
13588                    return Ok(response);
13589                }
13590            }
13591        }
13592    }
13593
13594    ///
13595    /// Sets the *request* property to the given value.
13596    ///
13597    /// Even though the property as already been set when instantiating this call,
13598    /// we provide this method for API completeness.
13599    pub fn request(
13600        mut self,
13601        new_value: SetMaintenancePolicyRequest,
13602    ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
13603        self._request = new_value;
13604        self
13605    }
13606    /// The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
13607    ///
13608    /// Sets the *name* path property to the given value.
13609    ///
13610    /// Even though the property as already been set when instantiating this call,
13611    /// we provide this method for API completeness.
13612    pub fn name(
13613        mut self,
13614        new_value: &str,
13615    ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
13616        self._name = new_value.to_string();
13617        self
13618    }
13619    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13620    /// while executing the actual API request.
13621    ///
13622    /// ````text
13623    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13624    /// ````
13625    ///
13626    /// Sets the *delegate* property to the given value.
13627    pub fn delegate(
13628        mut self,
13629        new_value: &'a mut dyn common::Delegate,
13630    ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
13631        self._delegate = Some(new_value);
13632        self
13633    }
13634
13635    /// Set any additional parameter of the query string used in the request.
13636    /// It should be used to set parameters which are not yet available through their own
13637    /// setters.
13638    ///
13639    /// Please note that this method must not be used to set any of the known parameters
13640    /// which have their own setter method. If done anyway, the request will fail.
13641    ///
13642    /// # Additional Parameters
13643    ///
13644    /// * *$.xgafv* (query-string) - V1 error format.
13645    /// * *access_token* (query-string) - OAuth access token.
13646    /// * *alt* (query-string) - Data format for response.
13647    /// * *callback* (query-string) - JSONP
13648    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13649    /// * *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.
13650    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13651    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13652    /// * *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.
13653    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13654    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13655    pub fn param<T>(
13656        mut self,
13657        name: T,
13658        value: T,
13659    ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
13660    where
13661        T: AsRef<str>,
13662    {
13663        self._additional_params
13664            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13665        self
13666    }
13667
13668    /// Identifies the authorization scope for the method you are building.
13669    ///
13670    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13671    /// [`Scope::CloudPlatform`].
13672    ///
13673    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13674    /// tokens for more than one scope.
13675    ///
13676    /// Usually there is more than one suitable scope to authorize an operation, some of which may
13677    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13678    /// sufficient, a read-write scope will do as well.
13679    pub fn add_scope<St>(
13680        mut self,
13681        scope: St,
13682    ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
13683    where
13684        St: AsRef<str>,
13685    {
13686        self._scopes.insert(String::from(scope.as_ref()));
13687        self
13688    }
13689    /// Identifies the authorization scope(s) for the method you are building.
13690    ///
13691    /// See [`Self::add_scope()`] for details.
13692    pub fn add_scopes<I, St>(
13693        mut self,
13694        scopes: I,
13695    ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
13696    where
13697        I: IntoIterator<Item = St>,
13698        St: AsRef<str>,
13699    {
13700        self._scopes
13701            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13702        self
13703    }
13704
13705    /// Removes all scopes, and no default scope will be used either.
13706    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13707    /// for details).
13708    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
13709        self._scopes.clear();
13710        self
13711    }
13712}
13713
13714/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
13715///
13716/// A builder for the *locations.clusters.setMasterAuth* method supported by a *project* resource.
13717/// It is not used directly, but through a [`ProjectMethods`] instance.
13718///
13719/// # Example
13720///
13721/// Instantiate a resource method builder
13722///
13723/// ```test_harness,no_run
13724/// # extern crate hyper;
13725/// # extern crate hyper_rustls;
13726/// # extern crate google_container1 as container1;
13727/// use container1::api::SetMasterAuthRequest;
13728/// # async fn dox() {
13729/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13730///
13731/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13732/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
13733/// #     secret,
13734/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13735/// # ).build().await.unwrap();
13736///
13737/// # let client = hyper_util::client::legacy::Client::builder(
13738/// #     hyper_util::rt::TokioExecutor::new()
13739/// # )
13740/// # .build(
13741/// #     hyper_rustls::HttpsConnectorBuilder::new()
13742/// #         .with_native_roots()
13743/// #         .unwrap()
13744/// #         .https_or_http()
13745/// #         .enable_http1()
13746/// #         .build()
13747/// # );
13748/// # let mut hub = Container::new(client, auth);
13749/// // As the method needs a request, you would usually fill it with the desired information
13750/// // into the respective structure. Some of the parts shown here might not be applicable !
13751/// // Values shown here are possibly random and not representative !
13752/// let mut req = SetMasterAuthRequest::default();
13753///
13754/// // You can configure optional parameters by calling the respective setters at will, and
13755/// // execute the final call using `doit()`.
13756/// // Values shown here are possibly random and not representative !
13757/// let result = hub.projects().locations_clusters_set_master_auth(req, "name")
13758///              .doit().await;
13759/// # }
13760/// ```
13761pub struct ProjectLocationClusterSetMasterAuthCall<'a, C>
13762where
13763    C: 'a,
13764{
13765    hub: &'a Container<C>,
13766    _request: SetMasterAuthRequest,
13767    _name: String,
13768    _delegate: Option<&'a mut dyn common::Delegate>,
13769    _additional_params: HashMap<String, String>,
13770    _scopes: BTreeSet<String>,
13771}
13772
13773impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMasterAuthCall<'a, C> {}
13774
13775impl<'a, C> ProjectLocationClusterSetMasterAuthCall<'a, C>
13776where
13777    C: common::Connector,
13778{
13779    /// Perform the operation you have build so far.
13780    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
13781        use std::borrow::Cow;
13782        use std::io::{Read, Seek};
13783
13784        use common::{url::Params, ToParts};
13785        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13786
13787        let mut dd = common::DefaultDelegate;
13788        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13789        dlg.begin(common::MethodInfo {
13790            id: "container.projects.locations.clusters.setMasterAuth",
13791            http_method: hyper::Method::POST,
13792        });
13793
13794        for &field in ["alt", "name"].iter() {
13795            if self._additional_params.contains_key(field) {
13796                dlg.finished(false);
13797                return Err(common::Error::FieldClash(field));
13798            }
13799        }
13800
13801        let mut params = Params::with_capacity(4 + self._additional_params.len());
13802        params.push("name", self._name);
13803
13804        params.extend(self._additional_params.iter());
13805
13806        params.push("alt", "json");
13807        let mut url = self.hub._base_url.clone() + "v1/{+name}:setMasterAuth";
13808        if self._scopes.is_empty() {
13809            self._scopes
13810                .insert(Scope::CloudPlatform.as_ref().to_string());
13811        }
13812
13813        #[allow(clippy::single_element_loop)]
13814        for &(find_this, param_name) in [("{+name}", "name")].iter() {
13815            url = params.uri_replacement(url, param_name, find_this, true);
13816        }
13817        {
13818            let to_remove = ["name"];
13819            params.remove_params(&to_remove);
13820        }
13821
13822        let url = params.parse_with_url(&url);
13823
13824        let mut json_mime_type = mime::APPLICATION_JSON;
13825        let mut request_value_reader = {
13826            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
13827            common::remove_json_null_values(&mut value);
13828            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
13829            serde_json::to_writer(&mut dst, &value).unwrap();
13830            dst
13831        };
13832        let request_size = request_value_reader
13833            .seek(std::io::SeekFrom::End(0))
13834            .unwrap();
13835        request_value_reader
13836            .seek(std::io::SeekFrom::Start(0))
13837            .unwrap();
13838
13839        loop {
13840            let token = match self
13841                .hub
13842                .auth
13843                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13844                .await
13845            {
13846                Ok(token) => token,
13847                Err(e) => match dlg.token(e) {
13848                    Ok(token) => token,
13849                    Err(e) => {
13850                        dlg.finished(false);
13851                        return Err(common::Error::MissingToken(e));
13852                    }
13853                },
13854            };
13855            request_value_reader
13856                .seek(std::io::SeekFrom::Start(0))
13857                .unwrap();
13858            let mut req_result = {
13859                let client = &self.hub.client;
13860                dlg.pre_request();
13861                let mut req_builder = hyper::Request::builder()
13862                    .method(hyper::Method::POST)
13863                    .uri(url.as_str())
13864                    .header(USER_AGENT, self.hub._user_agent.clone());
13865
13866                if let Some(token) = token.as_ref() {
13867                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13868                }
13869
13870                let request = req_builder
13871                    .header(CONTENT_TYPE, json_mime_type.to_string())
13872                    .header(CONTENT_LENGTH, request_size as u64)
13873                    .body(common::to_body(
13874                        request_value_reader.get_ref().clone().into(),
13875                    ));
13876
13877                client.request(request.unwrap()).await
13878            };
13879
13880            match req_result {
13881                Err(err) => {
13882                    if let common::Retry::After(d) = dlg.http_error(&err) {
13883                        sleep(d).await;
13884                        continue;
13885                    }
13886                    dlg.finished(false);
13887                    return Err(common::Error::HttpError(err));
13888                }
13889                Ok(res) => {
13890                    let (mut parts, body) = res.into_parts();
13891                    let mut body = common::Body::new(body);
13892                    if !parts.status.is_success() {
13893                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13894                        let error = serde_json::from_str(&common::to_string(&bytes));
13895                        let response = common::to_response(parts, bytes.into());
13896
13897                        if let common::Retry::After(d) =
13898                            dlg.http_failure(&response, error.as_ref().ok())
13899                        {
13900                            sleep(d).await;
13901                            continue;
13902                        }
13903
13904                        dlg.finished(false);
13905
13906                        return Err(match error {
13907                            Ok(value) => common::Error::BadRequest(value),
13908                            _ => common::Error::Failure(response),
13909                        });
13910                    }
13911                    let response = {
13912                        let bytes = common::to_bytes(body).await.unwrap_or_default();
13913                        let encoded = common::to_string(&bytes);
13914                        match serde_json::from_str(&encoded) {
13915                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13916                            Err(error) => {
13917                                dlg.response_json_decode_error(&encoded, &error);
13918                                return Err(common::Error::JsonDecodeError(
13919                                    encoded.to_string(),
13920                                    error,
13921                                ));
13922                            }
13923                        }
13924                    };
13925
13926                    dlg.finished(true);
13927                    return Ok(response);
13928                }
13929            }
13930        }
13931    }
13932
13933    ///
13934    /// Sets the *request* property to the given value.
13935    ///
13936    /// Even though the property as already been set when instantiating this call,
13937    /// we provide this method for API completeness.
13938    pub fn request(
13939        mut self,
13940        new_value: SetMasterAuthRequest,
13941    ) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
13942        self._request = new_value;
13943        self
13944    }
13945    /// The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
13946    ///
13947    /// Sets the *name* path property to the given value.
13948    ///
13949    /// Even though the property as already been set when instantiating this call,
13950    /// we provide this method for API completeness.
13951    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
13952        self._name = new_value.to_string();
13953        self
13954    }
13955    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13956    /// while executing the actual API request.
13957    ///
13958    /// ````text
13959    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
13960    /// ````
13961    ///
13962    /// Sets the *delegate* property to the given value.
13963    pub fn delegate(
13964        mut self,
13965        new_value: &'a mut dyn common::Delegate,
13966    ) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
13967        self._delegate = Some(new_value);
13968        self
13969    }
13970
13971    /// Set any additional parameter of the query string used in the request.
13972    /// It should be used to set parameters which are not yet available through their own
13973    /// setters.
13974    ///
13975    /// Please note that this method must not be used to set any of the known parameters
13976    /// which have their own setter method. If done anyway, the request will fail.
13977    ///
13978    /// # Additional Parameters
13979    ///
13980    /// * *$.xgafv* (query-string) - V1 error format.
13981    /// * *access_token* (query-string) - OAuth access token.
13982    /// * *alt* (query-string) - Data format for response.
13983    /// * *callback* (query-string) - JSONP
13984    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13985    /// * *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.
13986    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13987    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13988    /// * *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.
13989    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13990    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13991    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
13992    where
13993        T: AsRef<str>,
13994    {
13995        self._additional_params
13996            .insert(name.as_ref().to_string(), value.as_ref().to_string());
13997        self
13998    }
13999
14000    /// Identifies the authorization scope for the method you are building.
14001    ///
14002    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14003    /// [`Scope::CloudPlatform`].
14004    ///
14005    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14006    /// tokens for more than one scope.
14007    ///
14008    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14009    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14010    /// sufficient, a read-write scope will do as well.
14011    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
14012    where
14013        St: AsRef<str>,
14014    {
14015        self._scopes.insert(String::from(scope.as_ref()));
14016        self
14017    }
14018    /// Identifies the authorization scope(s) for the method you are building.
14019    ///
14020    /// See [`Self::add_scope()`] for details.
14021    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
14022    where
14023        I: IntoIterator<Item = St>,
14024        St: AsRef<str>,
14025    {
14026        self._scopes
14027            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14028        self
14029    }
14030
14031    /// Removes all scopes, and no default scope will be used either.
14032    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14033    /// for details).
14034    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
14035        self._scopes.clear();
14036        self
14037    }
14038}
14039
14040/// Sets the monitoring service for a specific cluster.
14041///
14042/// A builder for the *locations.clusters.setMonitoring* method supported by a *project* resource.
14043/// It is not used directly, but through a [`ProjectMethods`] instance.
14044///
14045/// # Example
14046///
14047/// Instantiate a resource method builder
14048///
14049/// ```test_harness,no_run
14050/// # extern crate hyper;
14051/// # extern crate hyper_rustls;
14052/// # extern crate google_container1 as container1;
14053/// use container1::api::SetMonitoringServiceRequest;
14054/// # async fn dox() {
14055/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14056///
14057/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14058/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14059/// #     secret,
14060/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14061/// # ).build().await.unwrap();
14062///
14063/// # let client = hyper_util::client::legacy::Client::builder(
14064/// #     hyper_util::rt::TokioExecutor::new()
14065/// # )
14066/// # .build(
14067/// #     hyper_rustls::HttpsConnectorBuilder::new()
14068/// #         .with_native_roots()
14069/// #         .unwrap()
14070/// #         .https_or_http()
14071/// #         .enable_http1()
14072/// #         .build()
14073/// # );
14074/// # let mut hub = Container::new(client, auth);
14075/// // As the method needs a request, you would usually fill it with the desired information
14076/// // into the respective structure. Some of the parts shown here might not be applicable !
14077/// // Values shown here are possibly random and not representative !
14078/// let mut req = SetMonitoringServiceRequest::default();
14079///
14080/// // You can configure optional parameters by calling the respective setters at will, and
14081/// // execute the final call using `doit()`.
14082/// // Values shown here are possibly random and not representative !
14083/// let result = hub.projects().locations_clusters_set_monitoring(req, "name")
14084///              .doit().await;
14085/// # }
14086/// ```
14087pub struct ProjectLocationClusterSetMonitoringCall<'a, C>
14088where
14089    C: 'a,
14090{
14091    hub: &'a Container<C>,
14092    _request: SetMonitoringServiceRequest,
14093    _name: String,
14094    _delegate: Option<&'a mut dyn common::Delegate>,
14095    _additional_params: HashMap<String, String>,
14096    _scopes: BTreeSet<String>,
14097}
14098
14099impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMonitoringCall<'a, C> {}
14100
14101impl<'a, C> ProjectLocationClusterSetMonitoringCall<'a, C>
14102where
14103    C: common::Connector,
14104{
14105    /// Perform the operation you have build so far.
14106    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14107        use std::borrow::Cow;
14108        use std::io::{Read, Seek};
14109
14110        use common::{url::Params, ToParts};
14111        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14112
14113        let mut dd = common::DefaultDelegate;
14114        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14115        dlg.begin(common::MethodInfo {
14116            id: "container.projects.locations.clusters.setMonitoring",
14117            http_method: hyper::Method::POST,
14118        });
14119
14120        for &field in ["alt", "name"].iter() {
14121            if self._additional_params.contains_key(field) {
14122                dlg.finished(false);
14123                return Err(common::Error::FieldClash(field));
14124            }
14125        }
14126
14127        let mut params = Params::with_capacity(4 + self._additional_params.len());
14128        params.push("name", self._name);
14129
14130        params.extend(self._additional_params.iter());
14131
14132        params.push("alt", "json");
14133        let mut url = self.hub._base_url.clone() + "v1/{+name}:setMonitoring";
14134        if self._scopes.is_empty() {
14135            self._scopes
14136                .insert(Scope::CloudPlatform.as_ref().to_string());
14137        }
14138
14139        #[allow(clippy::single_element_loop)]
14140        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14141            url = params.uri_replacement(url, param_name, find_this, true);
14142        }
14143        {
14144            let to_remove = ["name"];
14145            params.remove_params(&to_remove);
14146        }
14147
14148        let url = params.parse_with_url(&url);
14149
14150        let mut json_mime_type = mime::APPLICATION_JSON;
14151        let mut request_value_reader = {
14152            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14153            common::remove_json_null_values(&mut value);
14154            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14155            serde_json::to_writer(&mut dst, &value).unwrap();
14156            dst
14157        };
14158        let request_size = request_value_reader
14159            .seek(std::io::SeekFrom::End(0))
14160            .unwrap();
14161        request_value_reader
14162            .seek(std::io::SeekFrom::Start(0))
14163            .unwrap();
14164
14165        loop {
14166            let token = match self
14167                .hub
14168                .auth
14169                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14170                .await
14171            {
14172                Ok(token) => token,
14173                Err(e) => match dlg.token(e) {
14174                    Ok(token) => token,
14175                    Err(e) => {
14176                        dlg.finished(false);
14177                        return Err(common::Error::MissingToken(e));
14178                    }
14179                },
14180            };
14181            request_value_reader
14182                .seek(std::io::SeekFrom::Start(0))
14183                .unwrap();
14184            let mut req_result = {
14185                let client = &self.hub.client;
14186                dlg.pre_request();
14187                let mut req_builder = hyper::Request::builder()
14188                    .method(hyper::Method::POST)
14189                    .uri(url.as_str())
14190                    .header(USER_AGENT, self.hub._user_agent.clone());
14191
14192                if let Some(token) = token.as_ref() {
14193                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14194                }
14195
14196                let request = req_builder
14197                    .header(CONTENT_TYPE, json_mime_type.to_string())
14198                    .header(CONTENT_LENGTH, request_size as u64)
14199                    .body(common::to_body(
14200                        request_value_reader.get_ref().clone().into(),
14201                    ));
14202
14203                client.request(request.unwrap()).await
14204            };
14205
14206            match req_result {
14207                Err(err) => {
14208                    if let common::Retry::After(d) = dlg.http_error(&err) {
14209                        sleep(d).await;
14210                        continue;
14211                    }
14212                    dlg.finished(false);
14213                    return Err(common::Error::HttpError(err));
14214                }
14215                Ok(res) => {
14216                    let (mut parts, body) = res.into_parts();
14217                    let mut body = common::Body::new(body);
14218                    if !parts.status.is_success() {
14219                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14220                        let error = serde_json::from_str(&common::to_string(&bytes));
14221                        let response = common::to_response(parts, bytes.into());
14222
14223                        if let common::Retry::After(d) =
14224                            dlg.http_failure(&response, error.as_ref().ok())
14225                        {
14226                            sleep(d).await;
14227                            continue;
14228                        }
14229
14230                        dlg.finished(false);
14231
14232                        return Err(match error {
14233                            Ok(value) => common::Error::BadRequest(value),
14234                            _ => common::Error::Failure(response),
14235                        });
14236                    }
14237                    let response = {
14238                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14239                        let encoded = common::to_string(&bytes);
14240                        match serde_json::from_str(&encoded) {
14241                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14242                            Err(error) => {
14243                                dlg.response_json_decode_error(&encoded, &error);
14244                                return Err(common::Error::JsonDecodeError(
14245                                    encoded.to_string(),
14246                                    error,
14247                                ));
14248                            }
14249                        }
14250                    };
14251
14252                    dlg.finished(true);
14253                    return Ok(response);
14254                }
14255            }
14256        }
14257    }
14258
14259    ///
14260    /// Sets the *request* property to the given value.
14261    ///
14262    /// Even though the property as already been set when instantiating this call,
14263    /// we provide this method for API completeness.
14264    pub fn request(
14265        mut self,
14266        new_value: SetMonitoringServiceRequest,
14267    ) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
14268        self._request = new_value;
14269        self
14270    }
14271    /// The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
14272    ///
14273    /// Sets the *name* path property to the given value.
14274    ///
14275    /// Even though the property as already been set when instantiating this call,
14276    /// we provide this method for API completeness.
14277    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
14278        self._name = new_value.to_string();
14279        self
14280    }
14281    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14282    /// while executing the actual API request.
14283    ///
14284    /// ````text
14285    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14286    /// ````
14287    ///
14288    /// Sets the *delegate* property to the given value.
14289    pub fn delegate(
14290        mut self,
14291        new_value: &'a mut dyn common::Delegate,
14292    ) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
14293        self._delegate = Some(new_value);
14294        self
14295    }
14296
14297    /// Set any additional parameter of the query string used in the request.
14298    /// It should be used to set parameters which are not yet available through their own
14299    /// setters.
14300    ///
14301    /// Please note that this method must not be used to set any of the known parameters
14302    /// which have their own setter method. If done anyway, the request will fail.
14303    ///
14304    /// # Additional Parameters
14305    ///
14306    /// * *$.xgafv* (query-string) - V1 error format.
14307    /// * *access_token* (query-string) - OAuth access token.
14308    /// * *alt* (query-string) - Data format for response.
14309    /// * *callback* (query-string) - JSONP
14310    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14311    /// * *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.
14312    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14313    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14314    /// * *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.
14315    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14316    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14317    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetMonitoringCall<'a, C>
14318    where
14319        T: AsRef<str>,
14320    {
14321        self._additional_params
14322            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14323        self
14324    }
14325
14326    /// Identifies the authorization scope for the method you are building.
14327    ///
14328    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14329    /// [`Scope::CloudPlatform`].
14330    ///
14331    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14332    /// tokens for more than one scope.
14333    ///
14334    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14335    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14336    /// sufficient, a read-write scope will do as well.
14337    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetMonitoringCall<'a, C>
14338    where
14339        St: AsRef<str>,
14340    {
14341        self._scopes.insert(String::from(scope.as_ref()));
14342        self
14343    }
14344    /// Identifies the authorization scope(s) for the method you are building.
14345    ///
14346    /// See [`Self::add_scope()`] for details.
14347    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetMonitoringCall<'a, C>
14348    where
14349        I: IntoIterator<Item = St>,
14350        St: AsRef<str>,
14351    {
14352        self._scopes
14353            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14354        self
14355    }
14356
14357    /// Removes all scopes, and no default scope will be used either.
14358    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14359    /// for details).
14360    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
14361        self._scopes.clear();
14362        self
14363    }
14364}
14365
14366/// Enables or disables Network Policy for a cluster.
14367///
14368/// A builder for the *locations.clusters.setNetworkPolicy* method supported by a *project* resource.
14369/// It is not used directly, but through a [`ProjectMethods`] instance.
14370///
14371/// # Example
14372///
14373/// Instantiate a resource method builder
14374///
14375/// ```test_harness,no_run
14376/// # extern crate hyper;
14377/// # extern crate hyper_rustls;
14378/// # extern crate google_container1 as container1;
14379/// use container1::api::SetNetworkPolicyRequest;
14380/// # async fn dox() {
14381/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14382///
14383/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14384/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14385/// #     secret,
14386/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14387/// # ).build().await.unwrap();
14388///
14389/// # let client = hyper_util::client::legacy::Client::builder(
14390/// #     hyper_util::rt::TokioExecutor::new()
14391/// # )
14392/// # .build(
14393/// #     hyper_rustls::HttpsConnectorBuilder::new()
14394/// #         .with_native_roots()
14395/// #         .unwrap()
14396/// #         .https_or_http()
14397/// #         .enable_http1()
14398/// #         .build()
14399/// # );
14400/// # let mut hub = Container::new(client, auth);
14401/// // As the method needs a request, you would usually fill it with the desired information
14402/// // into the respective structure. Some of the parts shown here might not be applicable !
14403/// // Values shown here are possibly random and not representative !
14404/// let mut req = SetNetworkPolicyRequest::default();
14405///
14406/// // You can configure optional parameters by calling the respective setters at will, and
14407/// // execute the final call using `doit()`.
14408/// // Values shown here are possibly random and not representative !
14409/// let result = hub.projects().locations_clusters_set_network_policy(req, "name")
14410///              .doit().await;
14411/// # }
14412/// ```
14413pub struct ProjectLocationClusterSetNetworkPolicyCall<'a, C>
14414where
14415    C: 'a,
14416{
14417    hub: &'a Container<C>,
14418    _request: SetNetworkPolicyRequest,
14419    _name: String,
14420    _delegate: Option<&'a mut dyn common::Delegate>,
14421    _additional_params: HashMap<String, String>,
14422    _scopes: BTreeSet<String>,
14423}
14424
14425impl<'a, C> common::CallBuilder for ProjectLocationClusterSetNetworkPolicyCall<'a, C> {}
14426
14427impl<'a, C> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
14428where
14429    C: common::Connector,
14430{
14431    /// Perform the operation you have build so far.
14432    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14433        use std::borrow::Cow;
14434        use std::io::{Read, Seek};
14435
14436        use common::{url::Params, ToParts};
14437        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14438
14439        let mut dd = common::DefaultDelegate;
14440        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14441        dlg.begin(common::MethodInfo {
14442            id: "container.projects.locations.clusters.setNetworkPolicy",
14443            http_method: hyper::Method::POST,
14444        });
14445
14446        for &field in ["alt", "name"].iter() {
14447            if self._additional_params.contains_key(field) {
14448                dlg.finished(false);
14449                return Err(common::Error::FieldClash(field));
14450            }
14451        }
14452
14453        let mut params = Params::with_capacity(4 + self._additional_params.len());
14454        params.push("name", self._name);
14455
14456        params.extend(self._additional_params.iter());
14457
14458        params.push("alt", "json");
14459        let mut url = self.hub._base_url.clone() + "v1/{+name}:setNetworkPolicy";
14460        if self._scopes.is_empty() {
14461            self._scopes
14462                .insert(Scope::CloudPlatform.as_ref().to_string());
14463        }
14464
14465        #[allow(clippy::single_element_loop)]
14466        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14467            url = params.uri_replacement(url, param_name, find_this, true);
14468        }
14469        {
14470            let to_remove = ["name"];
14471            params.remove_params(&to_remove);
14472        }
14473
14474        let url = params.parse_with_url(&url);
14475
14476        let mut json_mime_type = mime::APPLICATION_JSON;
14477        let mut request_value_reader = {
14478            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14479            common::remove_json_null_values(&mut value);
14480            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14481            serde_json::to_writer(&mut dst, &value).unwrap();
14482            dst
14483        };
14484        let request_size = request_value_reader
14485            .seek(std::io::SeekFrom::End(0))
14486            .unwrap();
14487        request_value_reader
14488            .seek(std::io::SeekFrom::Start(0))
14489            .unwrap();
14490
14491        loop {
14492            let token = match self
14493                .hub
14494                .auth
14495                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14496                .await
14497            {
14498                Ok(token) => token,
14499                Err(e) => match dlg.token(e) {
14500                    Ok(token) => token,
14501                    Err(e) => {
14502                        dlg.finished(false);
14503                        return Err(common::Error::MissingToken(e));
14504                    }
14505                },
14506            };
14507            request_value_reader
14508                .seek(std::io::SeekFrom::Start(0))
14509                .unwrap();
14510            let mut req_result = {
14511                let client = &self.hub.client;
14512                dlg.pre_request();
14513                let mut req_builder = hyper::Request::builder()
14514                    .method(hyper::Method::POST)
14515                    .uri(url.as_str())
14516                    .header(USER_AGENT, self.hub._user_agent.clone());
14517
14518                if let Some(token) = token.as_ref() {
14519                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14520                }
14521
14522                let request = req_builder
14523                    .header(CONTENT_TYPE, json_mime_type.to_string())
14524                    .header(CONTENT_LENGTH, request_size as u64)
14525                    .body(common::to_body(
14526                        request_value_reader.get_ref().clone().into(),
14527                    ));
14528
14529                client.request(request.unwrap()).await
14530            };
14531
14532            match req_result {
14533                Err(err) => {
14534                    if let common::Retry::After(d) = dlg.http_error(&err) {
14535                        sleep(d).await;
14536                        continue;
14537                    }
14538                    dlg.finished(false);
14539                    return Err(common::Error::HttpError(err));
14540                }
14541                Ok(res) => {
14542                    let (mut parts, body) = res.into_parts();
14543                    let mut body = common::Body::new(body);
14544                    if !parts.status.is_success() {
14545                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14546                        let error = serde_json::from_str(&common::to_string(&bytes));
14547                        let response = common::to_response(parts, bytes.into());
14548
14549                        if let common::Retry::After(d) =
14550                            dlg.http_failure(&response, error.as_ref().ok())
14551                        {
14552                            sleep(d).await;
14553                            continue;
14554                        }
14555
14556                        dlg.finished(false);
14557
14558                        return Err(match error {
14559                            Ok(value) => common::Error::BadRequest(value),
14560                            _ => common::Error::Failure(response),
14561                        });
14562                    }
14563                    let response = {
14564                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14565                        let encoded = common::to_string(&bytes);
14566                        match serde_json::from_str(&encoded) {
14567                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14568                            Err(error) => {
14569                                dlg.response_json_decode_error(&encoded, &error);
14570                                return Err(common::Error::JsonDecodeError(
14571                                    encoded.to_string(),
14572                                    error,
14573                                ));
14574                            }
14575                        }
14576                    };
14577
14578                    dlg.finished(true);
14579                    return Ok(response);
14580                }
14581            }
14582        }
14583    }
14584
14585    ///
14586    /// Sets the *request* property to the given value.
14587    ///
14588    /// Even though the property as already been set when instantiating this call,
14589    /// we provide this method for API completeness.
14590    pub fn request(
14591        mut self,
14592        new_value: SetNetworkPolicyRequest,
14593    ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
14594        self._request = new_value;
14595        self
14596    }
14597    /// The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
14598    ///
14599    /// Sets the *name* path property to the given value.
14600    ///
14601    /// Even though the property as already been set when instantiating this call,
14602    /// we provide this method for API completeness.
14603    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
14604        self._name = new_value.to_string();
14605        self
14606    }
14607    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14608    /// while executing the actual API request.
14609    ///
14610    /// ````text
14611    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14612    /// ````
14613    ///
14614    /// Sets the *delegate* property to the given value.
14615    pub fn delegate(
14616        mut self,
14617        new_value: &'a mut dyn common::Delegate,
14618    ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
14619        self._delegate = Some(new_value);
14620        self
14621    }
14622
14623    /// Set any additional parameter of the query string used in the request.
14624    /// It should be used to set parameters which are not yet available through their own
14625    /// setters.
14626    ///
14627    /// Please note that this method must not be used to set any of the known parameters
14628    /// which have their own setter method. If done anyway, the request will fail.
14629    ///
14630    /// # Additional Parameters
14631    ///
14632    /// * *$.xgafv* (query-string) - V1 error format.
14633    /// * *access_token* (query-string) - OAuth access token.
14634    /// * *alt* (query-string) - Data format for response.
14635    /// * *callback* (query-string) - JSONP
14636    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14637    /// * *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.
14638    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14639    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14640    /// * *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.
14641    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14642    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14643    pub fn param<T>(
14644        mut self,
14645        name: T,
14646        value: T,
14647    ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
14648    where
14649        T: AsRef<str>,
14650    {
14651        self._additional_params
14652            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14653        self
14654    }
14655
14656    /// Identifies the authorization scope for the method you are building.
14657    ///
14658    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14659    /// [`Scope::CloudPlatform`].
14660    ///
14661    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14662    /// tokens for more than one scope.
14663    ///
14664    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14665    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14666    /// sufficient, a read-write scope will do as well.
14667    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
14668    where
14669        St: AsRef<str>,
14670    {
14671        self._scopes.insert(String::from(scope.as_ref()));
14672        self
14673    }
14674    /// Identifies the authorization scope(s) for the method you are building.
14675    ///
14676    /// See [`Self::add_scope()`] for details.
14677    pub fn add_scopes<I, St>(
14678        mut self,
14679        scopes: I,
14680    ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
14681    where
14682        I: IntoIterator<Item = St>,
14683        St: AsRef<str>,
14684    {
14685        self._scopes
14686            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14687        self
14688    }
14689
14690    /// Removes all scopes, and no default scope will be used either.
14691    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14692    /// for details).
14693    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
14694        self._scopes.clear();
14695        self
14696    }
14697}
14698
14699/// Sets labels on a cluster.
14700///
14701/// A builder for the *locations.clusters.setResourceLabels* method supported by a *project* resource.
14702/// It is not used directly, but through a [`ProjectMethods`] instance.
14703///
14704/// # Example
14705///
14706/// Instantiate a resource method builder
14707///
14708/// ```test_harness,no_run
14709/// # extern crate hyper;
14710/// # extern crate hyper_rustls;
14711/// # extern crate google_container1 as container1;
14712/// use container1::api::SetLabelsRequest;
14713/// # async fn dox() {
14714/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14715///
14716/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14717/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
14718/// #     secret,
14719/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14720/// # ).build().await.unwrap();
14721///
14722/// # let client = hyper_util::client::legacy::Client::builder(
14723/// #     hyper_util::rt::TokioExecutor::new()
14724/// # )
14725/// # .build(
14726/// #     hyper_rustls::HttpsConnectorBuilder::new()
14727/// #         .with_native_roots()
14728/// #         .unwrap()
14729/// #         .https_or_http()
14730/// #         .enable_http1()
14731/// #         .build()
14732/// # );
14733/// # let mut hub = Container::new(client, auth);
14734/// // As the method needs a request, you would usually fill it with the desired information
14735/// // into the respective structure. Some of the parts shown here might not be applicable !
14736/// // Values shown here are possibly random and not representative !
14737/// let mut req = SetLabelsRequest::default();
14738///
14739/// // You can configure optional parameters by calling the respective setters at will, and
14740/// // execute the final call using `doit()`.
14741/// // Values shown here are possibly random and not representative !
14742/// let result = hub.projects().locations_clusters_set_resource_labels(req, "name")
14743///              .doit().await;
14744/// # }
14745/// ```
14746pub struct ProjectLocationClusterSetResourceLabelCall<'a, C>
14747where
14748    C: 'a,
14749{
14750    hub: &'a Container<C>,
14751    _request: SetLabelsRequest,
14752    _name: String,
14753    _delegate: Option<&'a mut dyn common::Delegate>,
14754    _additional_params: HashMap<String, String>,
14755    _scopes: BTreeSet<String>,
14756}
14757
14758impl<'a, C> common::CallBuilder for ProjectLocationClusterSetResourceLabelCall<'a, C> {}
14759
14760impl<'a, C> ProjectLocationClusterSetResourceLabelCall<'a, C>
14761where
14762    C: common::Connector,
14763{
14764    /// Perform the operation you have build so far.
14765    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14766        use std::borrow::Cow;
14767        use std::io::{Read, Seek};
14768
14769        use common::{url::Params, ToParts};
14770        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14771
14772        let mut dd = common::DefaultDelegate;
14773        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14774        dlg.begin(common::MethodInfo {
14775            id: "container.projects.locations.clusters.setResourceLabels",
14776            http_method: hyper::Method::POST,
14777        });
14778
14779        for &field in ["alt", "name"].iter() {
14780            if self._additional_params.contains_key(field) {
14781                dlg.finished(false);
14782                return Err(common::Error::FieldClash(field));
14783            }
14784        }
14785
14786        let mut params = Params::with_capacity(4 + self._additional_params.len());
14787        params.push("name", self._name);
14788
14789        params.extend(self._additional_params.iter());
14790
14791        params.push("alt", "json");
14792        let mut url = self.hub._base_url.clone() + "v1/{+name}:setResourceLabels";
14793        if self._scopes.is_empty() {
14794            self._scopes
14795                .insert(Scope::CloudPlatform.as_ref().to_string());
14796        }
14797
14798        #[allow(clippy::single_element_loop)]
14799        for &(find_this, param_name) in [("{+name}", "name")].iter() {
14800            url = params.uri_replacement(url, param_name, find_this, true);
14801        }
14802        {
14803            let to_remove = ["name"];
14804            params.remove_params(&to_remove);
14805        }
14806
14807        let url = params.parse_with_url(&url);
14808
14809        let mut json_mime_type = mime::APPLICATION_JSON;
14810        let mut request_value_reader = {
14811            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14812            common::remove_json_null_values(&mut value);
14813            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14814            serde_json::to_writer(&mut dst, &value).unwrap();
14815            dst
14816        };
14817        let request_size = request_value_reader
14818            .seek(std::io::SeekFrom::End(0))
14819            .unwrap();
14820        request_value_reader
14821            .seek(std::io::SeekFrom::Start(0))
14822            .unwrap();
14823
14824        loop {
14825            let token = match self
14826                .hub
14827                .auth
14828                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14829                .await
14830            {
14831                Ok(token) => token,
14832                Err(e) => match dlg.token(e) {
14833                    Ok(token) => token,
14834                    Err(e) => {
14835                        dlg.finished(false);
14836                        return Err(common::Error::MissingToken(e));
14837                    }
14838                },
14839            };
14840            request_value_reader
14841                .seek(std::io::SeekFrom::Start(0))
14842                .unwrap();
14843            let mut req_result = {
14844                let client = &self.hub.client;
14845                dlg.pre_request();
14846                let mut req_builder = hyper::Request::builder()
14847                    .method(hyper::Method::POST)
14848                    .uri(url.as_str())
14849                    .header(USER_AGENT, self.hub._user_agent.clone());
14850
14851                if let Some(token) = token.as_ref() {
14852                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14853                }
14854
14855                let request = req_builder
14856                    .header(CONTENT_TYPE, json_mime_type.to_string())
14857                    .header(CONTENT_LENGTH, request_size as u64)
14858                    .body(common::to_body(
14859                        request_value_reader.get_ref().clone().into(),
14860                    ));
14861
14862                client.request(request.unwrap()).await
14863            };
14864
14865            match req_result {
14866                Err(err) => {
14867                    if let common::Retry::After(d) = dlg.http_error(&err) {
14868                        sleep(d).await;
14869                        continue;
14870                    }
14871                    dlg.finished(false);
14872                    return Err(common::Error::HttpError(err));
14873                }
14874                Ok(res) => {
14875                    let (mut parts, body) = res.into_parts();
14876                    let mut body = common::Body::new(body);
14877                    if !parts.status.is_success() {
14878                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14879                        let error = serde_json::from_str(&common::to_string(&bytes));
14880                        let response = common::to_response(parts, bytes.into());
14881
14882                        if let common::Retry::After(d) =
14883                            dlg.http_failure(&response, error.as_ref().ok())
14884                        {
14885                            sleep(d).await;
14886                            continue;
14887                        }
14888
14889                        dlg.finished(false);
14890
14891                        return Err(match error {
14892                            Ok(value) => common::Error::BadRequest(value),
14893                            _ => common::Error::Failure(response),
14894                        });
14895                    }
14896                    let response = {
14897                        let bytes = common::to_bytes(body).await.unwrap_or_default();
14898                        let encoded = common::to_string(&bytes);
14899                        match serde_json::from_str(&encoded) {
14900                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14901                            Err(error) => {
14902                                dlg.response_json_decode_error(&encoded, &error);
14903                                return Err(common::Error::JsonDecodeError(
14904                                    encoded.to_string(),
14905                                    error,
14906                                ));
14907                            }
14908                        }
14909                    };
14910
14911                    dlg.finished(true);
14912                    return Ok(response);
14913                }
14914            }
14915        }
14916    }
14917
14918    ///
14919    /// Sets the *request* property to the given value.
14920    ///
14921    /// Even though the property as already been set when instantiating this call,
14922    /// we provide this method for API completeness.
14923    pub fn request(
14924        mut self,
14925        new_value: SetLabelsRequest,
14926    ) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
14927        self._request = new_value;
14928        self
14929    }
14930    /// The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
14931    ///
14932    /// Sets the *name* path property to the given value.
14933    ///
14934    /// Even though the property as already been set when instantiating this call,
14935    /// we provide this method for API completeness.
14936    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
14937        self._name = new_value.to_string();
14938        self
14939    }
14940    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14941    /// while executing the actual API request.
14942    ///
14943    /// ````text
14944    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
14945    /// ````
14946    ///
14947    /// Sets the *delegate* property to the given value.
14948    pub fn delegate(
14949        mut self,
14950        new_value: &'a mut dyn common::Delegate,
14951    ) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
14952        self._delegate = Some(new_value);
14953        self
14954    }
14955
14956    /// Set any additional parameter of the query string used in the request.
14957    /// It should be used to set parameters which are not yet available through their own
14958    /// setters.
14959    ///
14960    /// Please note that this method must not be used to set any of the known parameters
14961    /// which have their own setter method. If done anyway, the request will fail.
14962    ///
14963    /// # Additional Parameters
14964    ///
14965    /// * *$.xgafv* (query-string) - V1 error format.
14966    /// * *access_token* (query-string) - OAuth access token.
14967    /// * *alt* (query-string) - Data format for response.
14968    /// * *callback* (query-string) - JSONP
14969    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14970    /// * *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.
14971    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14972    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14973    /// * *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.
14974    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14975    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14976    pub fn param<T>(
14977        mut self,
14978        name: T,
14979        value: T,
14980    ) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
14981    where
14982        T: AsRef<str>,
14983    {
14984        self._additional_params
14985            .insert(name.as_ref().to_string(), value.as_ref().to_string());
14986        self
14987    }
14988
14989    /// Identifies the authorization scope for the method you are building.
14990    ///
14991    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14992    /// [`Scope::CloudPlatform`].
14993    ///
14994    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14995    /// tokens for more than one scope.
14996    ///
14997    /// Usually there is more than one suitable scope to authorize an operation, some of which may
14998    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14999    /// sufficient, a read-write scope will do as well.
15000    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
15001    where
15002        St: AsRef<str>,
15003    {
15004        self._scopes.insert(String::from(scope.as_ref()));
15005        self
15006    }
15007    /// Identifies the authorization scope(s) for the method you are building.
15008    ///
15009    /// See [`Self::add_scope()`] for details.
15010    pub fn add_scopes<I, St>(
15011        mut self,
15012        scopes: I,
15013    ) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
15014    where
15015        I: IntoIterator<Item = St>,
15016        St: AsRef<str>,
15017    {
15018        self._scopes
15019            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15020        self
15021    }
15022
15023    /// Removes all scopes, and no default scope will be used either.
15024    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15025    /// for details).
15026    pub fn clear_scopes(mut self) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
15027        self._scopes.clear();
15028        self
15029    }
15030}
15031
15032/// Starts master IP rotation.
15033///
15034/// A builder for the *locations.clusters.startIpRotation* method supported by a *project* resource.
15035/// It is not used directly, but through a [`ProjectMethods`] instance.
15036///
15037/// # Example
15038///
15039/// Instantiate a resource method builder
15040///
15041/// ```test_harness,no_run
15042/// # extern crate hyper;
15043/// # extern crate hyper_rustls;
15044/// # extern crate google_container1 as container1;
15045/// use container1::api::StartIPRotationRequest;
15046/// # async fn dox() {
15047/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15048///
15049/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15050/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15051/// #     secret,
15052/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15053/// # ).build().await.unwrap();
15054///
15055/// # let client = hyper_util::client::legacy::Client::builder(
15056/// #     hyper_util::rt::TokioExecutor::new()
15057/// # )
15058/// # .build(
15059/// #     hyper_rustls::HttpsConnectorBuilder::new()
15060/// #         .with_native_roots()
15061/// #         .unwrap()
15062/// #         .https_or_http()
15063/// #         .enable_http1()
15064/// #         .build()
15065/// # );
15066/// # let mut hub = Container::new(client, auth);
15067/// // As the method needs a request, you would usually fill it with the desired information
15068/// // into the respective structure. Some of the parts shown here might not be applicable !
15069/// // Values shown here are possibly random and not representative !
15070/// let mut req = StartIPRotationRequest::default();
15071///
15072/// // You can configure optional parameters by calling the respective setters at will, and
15073/// // execute the final call using `doit()`.
15074/// // Values shown here are possibly random and not representative !
15075/// let result = hub.projects().locations_clusters_start_ip_rotation(req, "name")
15076///              .doit().await;
15077/// # }
15078/// ```
15079pub struct ProjectLocationClusterStartIpRotationCall<'a, C>
15080where
15081    C: 'a,
15082{
15083    hub: &'a Container<C>,
15084    _request: StartIPRotationRequest,
15085    _name: String,
15086    _delegate: Option<&'a mut dyn common::Delegate>,
15087    _additional_params: HashMap<String, String>,
15088    _scopes: BTreeSet<String>,
15089}
15090
15091impl<'a, C> common::CallBuilder for ProjectLocationClusterStartIpRotationCall<'a, C> {}
15092
15093impl<'a, C> ProjectLocationClusterStartIpRotationCall<'a, C>
15094where
15095    C: common::Connector,
15096{
15097    /// Perform the operation you have build so far.
15098    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15099        use std::borrow::Cow;
15100        use std::io::{Read, Seek};
15101
15102        use common::{url::Params, ToParts};
15103        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15104
15105        let mut dd = common::DefaultDelegate;
15106        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15107        dlg.begin(common::MethodInfo {
15108            id: "container.projects.locations.clusters.startIpRotation",
15109            http_method: hyper::Method::POST,
15110        });
15111
15112        for &field in ["alt", "name"].iter() {
15113            if self._additional_params.contains_key(field) {
15114                dlg.finished(false);
15115                return Err(common::Error::FieldClash(field));
15116            }
15117        }
15118
15119        let mut params = Params::with_capacity(4 + self._additional_params.len());
15120        params.push("name", self._name);
15121
15122        params.extend(self._additional_params.iter());
15123
15124        params.push("alt", "json");
15125        let mut url = self.hub._base_url.clone() + "v1/{+name}:startIpRotation";
15126        if self._scopes.is_empty() {
15127            self._scopes
15128                .insert(Scope::CloudPlatform.as_ref().to_string());
15129        }
15130
15131        #[allow(clippy::single_element_loop)]
15132        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15133            url = params.uri_replacement(url, param_name, find_this, true);
15134        }
15135        {
15136            let to_remove = ["name"];
15137            params.remove_params(&to_remove);
15138        }
15139
15140        let url = params.parse_with_url(&url);
15141
15142        let mut json_mime_type = mime::APPLICATION_JSON;
15143        let mut request_value_reader = {
15144            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15145            common::remove_json_null_values(&mut value);
15146            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15147            serde_json::to_writer(&mut dst, &value).unwrap();
15148            dst
15149        };
15150        let request_size = request_value_reader
15151            .seek(std::io::SeekFrom::End(0))
15152            .unwrap();
15153        request_value_reader
15154            .seek(std::io::SeekFrom::Start(0))
15155            .unwrap();
15156
15157        loop {
15158            let token = match self
15159                .hub
15160                .auth
15161                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15162                .await
15163            {
15164                Ok(token) => token,
15165                Err(e) => match dlg.token(e) {
15166                    Ok(token) => token,
15167                    Err(e) => {
15168                        dlg.finished(false);
15169                        return Err(common::Error::MissingToken(e));
15170                    }
15171                },
15172            };
15173            request_value_reader
15174                .seek(std::io::SeekFrom::Start(0))
15175                .unwrap();
15176            let mut req_result = {
15177                let client = &self.hub.client;
15178                dlg.pre_request();
15179                let mut req_builder = hyper::Request::builder()
15180                    .method(hyper::Method::POST)
15181                    .uri(url.as_str())
15182                    .header(USER_AGENT, self.hub._user_agent.clone());
15183
15184                if let Some(token) = token.as_ref() {
15185                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15186                }
15187
15188                let request = req_builder
15189                    .header(CONTENT_TYPE, json_mime_type.to_string())
15190                    .header(CONTENT_LENGTH, request_size as u64)
15191                    .body(common::to_body(
15192                        request_value_reader.get_ref().clone().into(),
15193                    ));
15194
15195                client.request(request.unwrap()).await
15196            };
15197
15198            match req_result {
15199                Err(err) => {
15200                    if let common::Retry::After(d) = dlg.http_error(&err) {
15201                        sleep(d).await;
15202                        continue;
15203                    }
15204                    dlg.finished(false);
15205                    return Err(common::Error::HttpError(err));
15206                }
15207                Ok(res) => {
15208                    let (mut parts, body) = res.into_parts();
15209                    let mut body = common::Body::new(body);
15210                    if !parts.status.is_success() {
15211                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15212                        let error = serde_json::from_str(&common::to_string(&bytes));
15213                        let response = common::to_response(parts, bytes.into());
15214
15215                        if let common::Retry::After(d) =
15216                            dlg.http_failure(&response, error.as_ref().ok())
15217                        {
15218                            sleep(d).await;
15219                            continue;
15220                        }
15221
15222                        dlg.finished(false);
15223
15224                        return Err(match error {
15225                            Ok(value) => common::Error::BadRequest(value),
15226                            _ => common::Error::Failure(response),
15227                        });
15228                    }
15229                    let response = {
15230                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15231                        let encoded = common::to_string(&bytes);
15232                        match serde_json::from_str(&encoded) {
15233                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15234                            Err(error) => {
15235                                dlg.response_json_decode_error(&encoded, &error);
15236                                return Err(common::Error::JsonDecodeError(
15237                                    encoded.to_string(),
15238                                    error,
15239                                ));
15240                            }
15241                        }
15242                    };
15243
15244                    dlg.finished(true);
15245                    return Ok(response);
15246                }
15247            }
15248        }
15249    }
15250
15251    ///
15252    /// Sets the *request* property to the given value.
15253    ///
15254    /// Even though the property as already been set when instantiating this call,
15255    /// we provide this method for API completeness.
15256    pub fn request(
15257        mut self,
15258        new_value: StartIPRotationRequest,
15259    ) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
15260        self._request = new_value;
15261        self
15262    }
15263    /// The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
15264    ///
15265    /// Sets the *name* path property to the given value.
15266    ///
15267    /// Even though the property as already been set when instantiating this call,
15268    /// we provide this method for API completeness.
15269    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
15270        self._name = new_value.to_string();
15271        self
15272    }
15273    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15274    /// while executing the actual API request.
15275    ///
15276    /// ````text
15277    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15278    /// ````
15279    ///
15280    /// Sets the *delegate* property to the given value.
15281    pub fn delegate(
15282        mut self,
15283        new_value: &'a mut dyn common::Delegate,
15284    ) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
15285        self._delegate = Some(new_value);
15286        self
15287    }
15288
15289    /// Set any additional parameter of the query string used in the request.
15290    /// It should be used to set parameters which are not yet available through their own
15291    /// setters.
15292    ///
15293    /// Please note that this method must not be used to set any of the known parameters
15294    /// which have their own setter method. If done anyway, the request will fail.
15295    ///
15296    /// # Additional Parameters
15297    ///
15298    /// * *$.xgafv* (query-string) - V1 error format.
15299    /// * *access_token* (query-string) - OAuth access token.
15300    /// * *alt* (query-string) - Data format for response.
15301    /// * *callback* (query-string) - JSONP
15302    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15303    /// * *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.
15304    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15305    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15306    /// * *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.
15307    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15308    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15309    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterStartIpRotationCall<'a, C>
15310    where
15311        T: AsRef<str>,
15312    {
15313        self._additional_params
15314            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15315        self
15316    }
15317
15318    /// Identifies the authorization scope for the method you are building.
15319    ///
15320    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15321    /// [`Scope::CloudPlatform`].
15322    ///
15323    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15324    /// tokens for more than one scope.
15325    ///
15326    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15327    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15328    /// sufficient, a read-write scope will do as well.
15329    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterStartIpRotationCall<'a, C>
15330    where
15331        St: AsRef<str>,
15332    {
15333        self._scopes.insert(String::from(scope.as_ref()));
15334        self
15335    }
15336    /// Identifies the authorization scope(s) for the method you are building.
15337    ///
15338    /// See [`Self::add_scope()`] for details.
15339    pub fn add_scopes<I, St>(
15340        mut self,
15341        scopes: I,
15342    ) -> ProjectLocationClusterStartIpRotationCall<'a, C>
15343    where
15344        I: IntoIterator<Item = St>,
15345        St: AsRef<str>,
15346    {
15347        self._scopes
15348            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15349        self
15350    }
15351
15352    /// Removes all scopes, and no default scope will be used either.
15353    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15354    /// for details).
15355    pub fn clear_scopes(mut self) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
15356        self._scopes.clear();
15357        self
15358    }
15359}
15360
15361/// Updates the settings of a specific cluster.
15362///
15363/// A builder for the *locations.clusters.update* method supported by a *project* resource.
15364/// It is not used directly, but through a [`ProjectMethods`] instance.
15365///
15366/// # Example
15367///
15368/// Instantiate a resource method builder
15369///
15370/// ```test_harness,no_run
15371/// # extern crate hyper;
15372/// # extern crate hyper_rustls;
15373/// # extern crate google_container1 as container1;
15374/// use container1::api::UpdateClusterRequest;
15375/// # async fn dox() {
15376/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15377///
15378/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15379/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15380/// #     secret,
15381/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15382/// # ).build().await.unwrap();
15383///
15384/// # let client = hyper_util::client::legacy::Client::builder(
15385/// #     hyper_util::rt::TokioExecutor::new()
15386/// # )
15387/// # .build(
15388/// #     hyper_rustls::HttpsConnectorBuilder::new()
15389/// #         .with_native_roots()
15390/// #         .unwrap()
15391/// #         .https_or_http()
15392/// #         .enable_http1()
15393/// #         .build()
15394/// # );
15395/// # let mut hub = Container::new(client, auth);
15396/// // As the method needs a request, you would usually fill it with the desired information
15397/// // into the respective structure. Some of the parts shown here might not be applicable !
15398/// // Values shown here are possibly random and not representative !
15399/// let mut req = UpdateClusterRequest::default();
15400///
15401/// // You can configure optional parameters by calling the respective setters at will, and
15402/// // execute the final call using `doit()`.
15403/// // Values shown here are possibly random and not representative !
15404/// let result = hub.projects().locations_clusters_update(req, "name")
15405///              .doit().await;
15406/// # }
15407/// ```
15408pub struct ProjectLocationClusterUpdateCall<'a, C>
15409where
15410    C: 'a,
15411{
15412    hub: &'a Container<C>,
15413    _request: UpdateClusterRequest,
15414    _name: String,
15415    _delegate: Option<&'a mut dyn common::Delegate>,
15416    _additional_params: HashMap<String, String>,
15417    _scopes: BTreeSet<String>,
15418}
15419
15420impl<'a, C> common::CallBuilder for ProjectLocationClusterUpdateCall<'a, C> {}
15421
15422impl<'a, C> ProjectLocationClusterUpdateCall<'a, C>
15423where
15424    C: common::Connector,
15425{
15426    /// Perform the operation you have build so far.
15427    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15428        use std::borrow::Cow;
15429        use std::io::{Read, Seek};
15430
15431        use common::{url::Params, ToParts};
15432        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15433
15434        let mut dd = common::DefaultDelegate;
15435        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15436        dlg.begin(common::MethodInfo {
15437            id: "container.projects.locations.clusters.update",
15438            http_method: hyper::Method::PUT,
15439        });
15440
15441        for &field in ["alt", "name"].iter() {
15442            if self._additional_params.contains_key(field) {
15443                dlg.finished(false);
15444                return Err(common::Error::FieldClash(field));
15445            }
15446        }
15447
15448        let mut params = Params::with_capacity(4 + self._additional_params.len());
15449        params.push("name", self._name);
15450
15451        params.extend(self._additional_params.iter());
15452
15453        params.push("alt", "json");
15454        let mut url = self.hub._base_url.clone() + "v1/{+name}";
15455        if self._scopes.is_empty() {
15456            self._scopes
15457                .insert(Scope::CloudPlatform.as_ref().to_string());
15458        }
15459
15460        #[allow(clippy::single_element_loop)]
15461        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15462            url = params.uri_replacement(url, param_name, find_this, true);
15463        }
15464        {
15465            let to_remove = ["name"];
15466            params.remove_params(&to_remove);
15467        }
15468
15469        let url = params.parse_with_url(&url);
15470
15471        let mut json_mime_type = mime::APPLICATION_JSON;
15472        let mut request_value_reader = {
15473            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15474            common::remove_json_null_values(&mut value);
15475            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15476            serde_json::to_writer(&mut dst, &value).unwrap();
15477            dst
15478        };
15479        let request_size = request_value_reader
15480            .seek(std::io::SeekFrom::End(0))
15481            .unwrap();
15482        request_value_reader
15483            .seek(std::io::SeekFrom::Start(0))
15484            .unwrap();
15485
15486        loop {
15487            let token = match self
15488                .hub
15489                .auth
15490                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15491                .await
15492            {
15493                Ok(token) => token,
15494                Err(e) => match dlg.token(e) {
15495                    Ok(token) => token,
15496                    Err(e) => {
15497                        dlg.finished(false);
15498                        return Err(common::Error::MissingToken(e));
15499                    }
15500                },
15501            };
15502            request_value_reader
15503                .seek(std::io::SeekFrom::Start(0))
15504                .unwrap();
15505            let mut req_result = {
15506                let client = &self.hub.client;
15507                dlg.pre_request();
15508                let mut req_builder = hyper::Request::builder()
15509                    .method(hyper::Method::PUT)
15510                    .uri(url.as_str())
15511                    .header(USER_AGENT, self.hub._user_agent.clone());
15512
15513                if let Some(token) = token.as_ref() {
15514                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15515                }
15516
15517                let request = req_builder
15518                    .header(CONTENT_TYPE, json_mime_type.to_string())
15519                    .header(CONTENT_LENGTH, request_size as u64)
15520                    .body(common::to_body(
15521                        request_value_reader.get_ref().clone().into(),
15522                    ));
15523
15524                client.request(request.unwrap()).await
15525            };
15526
15527            match req_result {
15528                Err(err) => {
15529                    if let common::Retry::After(d) = dlg.http_error(&err) {
15530                        sleep(d).await;
15531                        continue;
15532                    }
15533                    dlg.finished(false);
15534                    return Err(common::Error::HttpError(err));
15535                }
15536                Ok(res) => {
15537                    let (mut parts, body) = res.into_parts();
15538                    let mut body = common::Body::new(body);
15539                    if !parts.status.is_success() {
15540                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15541                        let error = serde_json::from_str(&common::to_string(&bytes));
15542                        let response = common::to_response(parts, bytes.into());
15543
15544                        if let common::Retry::After(d) =
15545                            dlg.http_failure(&response, error.as_ref().ok())
15546                        {
15547                            sleep(d).await;
15548                            continue;
15549                        }
15550
15551                        dlg.finished(false);
15552
15553                        return Err(match error {
15554                            Ok(value) => common::Error::BadRequest(value),
15555                            _ => common::Error::Failure(response),
15556                        });
15557                    }
15558                    let response = {
15559                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15560                        let encoded = common::to_string(&bytes);
15561                        match serde_json::from_str(&encoded) {
15562                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15563                            Err(error) => {
15564                                dlg.response_json_decode_error(&encoded, &error);
15565                                return Err(common::Error::JsonDecodeError(
15566                                    encoded.to_string(),
15567                                    error,
15568                                ));
15569                            }
15570                        }
15571                    };
15572
15573                    dlg.finished(true);
15574                    return Ok(response);
15575                }
15576            }
15577        }
15578    }
15579
15580    ///
15581    /// Sets the *request* property to the given value.
15582    ///
15583    /// Even though the property as already been set when instantiating this call,
15584    /// we provide this method for API completeness.
15585    pub fn request(
15586        mut self,
15587        new_value: UpdateClusterRequest,
15588    ) -> ProjectLocationClusterUpdateCall<'a, C> {
15589        self._request = new_value;
15590        self
15591    }
15592    /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
15593    ///
15594    /// Sets the *name* path property to the given value.
15595    ///
15596    /// Even though the property as already been set when instantiating this call,
15597    /// we provide this method for API completeness.
15598    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterUpdateCall<'a, C> {
15599        self._name = new_value.to_string();
15600        self
15601    }
15602    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15603    /// while executing the actual API request.
15604    ///
15605    /// ````text
15606    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15607    /// ````
15608    ///
15609    /// Sets the *delegate* property to the given value.
15610    pub fn delegate(
15611        mut self,
15612        new_value: &'a mut dyn common::Delegate,
15613    ) -> ProjectLocationClusterUpdateCall<'a, C> {
15614        self._delegate = Some(new_value);
15615        self
15616    }
15617
15618    /// Set any additional parameter of the query string used in the request.
15619    /// It should be used to set parameters which are not yet available through their own
15620    /// setters.
15621    ///
15622    /// Please note that this method must not be used to set any of the known parameters
15623    /// which have their own setter method. If done anyway, the request will fail.
15624    ///
15625    /// # Additional Parameters
15626    ///
15627    /// * *$.xgafv* (query-string) - V1 error format.
15628    /// * *access_token* (query-string) - OAuth access token.
15629    /// * *alt* (query-string) - Data format for response.
15630    /// * *callback* (query-string) - JSONP
15631    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15632    /// * *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.
15633    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15634    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15635    /// * *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.
15636    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15637    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15638    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterUpdateCall<'a, C>
15639    where
15640        T: AsRef<str>,
15641    {
15642        self._additional_params
15643            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15644        self
15645    }
15646
15647    /// Identifies the authorization scope for the method you are building.
15648    ///
15649    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15650    /// [`Scope::CloudPlatform`].
15651    ///
15652    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15653    /// tokens for more than one scope.
15654    ///
15655    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15656    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15657    /// sufficient, a read-write scope will do as well.
15658    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterUpdateCall<'a, C>
15659    where
15660        St: AsRef<str>,
15661    {
15662        self._scopes.insert(String::from(scope.as_ref()));
15663        self
15664    }
15665    /// Identifies the authorization scope(s) for the method you are building.
15666    ///
15667    /// See [`Self::add_scope()`] for details.
15668    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterUpdateCall<'a, C>
15669    where
15670        I: IntoIterator<Item = St>,
15671        St: AsRef<str>,
15672    {
15673        self._scopes
15674            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15675        self
15676    }
15677
15678    /// Removes all scopes, and no default scope will be used either.
15679    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15680    /// for details).
15681    pub fn clear_scopes(mut self) -> ProjectLocationClusterUpdateCall<'a, C> {
15682        self._scopes.clear();
15683        self
15684    }
15685}
15686
15687/// Updates the master for a specific cluster.
15688///
15689/// A builder for the *locations.clusters.updateMaster* method supported by a *project* resource.
15690/// It is not used directly, but through a [`ProjectMethods`] instance.
15691///
15692/// # Example
15693///
15694/// Instantiate a resource method builder
15695///
15696/// ```test_harness,no_run
15697/// # extern crate hyper;
15698/// # extern crate hyper_rustls;
15699/// # extern crate google_container1 as container1;
15700/// use container1::api::UpdateMasterRequest;
15701/// # async fn dox() {
15702/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15703///
15704/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15705/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
15706/// #     secret,
15707/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15708/// # ).build().await.unwrap();
15709///
15710/// # let client = hyper_util::client::legacy::Client::builder(
15711/// #     hyper_util::rt::TokioExecutor::new()
15712/// # )
15713/// # .build(
15714/// #     hyper_rustls::HttpsConnectorBuilder::new()
15715/// #         .with_native_roots()
15716/// #         .unwrap()
15717/// #         .https_or_http()
15718/// #         .enable_http1()
15719/// #         .build()
15720/// # );
15721/// # let mut hub = Container::new(client, auth);
15722/// // As the method needs a request, you would usually fill it with the desired information
15723/// // into the respective structure. Some of the parts shown here might not be applicable !
15724/// // Values shown here are possibly random and not representative !
15725/// let mut req = UpdateMasterRequest::default();
15726///
15727/// // You can configure optional parameters by calling the respective setters at will, and
15728/// // execute the final call using `doit()`.
15729/// // Values shown here are possibly random and not representative !
15730/// let result = hub.projects().locations_clusters_update_master(req, "name")
15731///              .doit().await;
15732/// # }
15733/// ```
15734pub struct ProjectLocationClusterUpdateMasterCall<'a, C>
15735where
15736    C: 'a,
15737{
15738    hub: &'a Container<C>,
15739    _request: UpdateMasterRequest,
15740    _name: String,
15741    _delegate: Option<&'a mut dyn common::Delegate>,
15742    _additional_params: HashMap<String, String>,
15743    _scopes: BTreeSet<String>,
15744}
15745
15746impl<'a, C> common::CallBuilder for ProjectLocationClusterUpdateMasterCall<'a, C> {}
15747
15748impl<'a, C> ProjectLocationClusterUpdateMasterCall<'a, C>
15749where
15750    C: common::Connector,
15751{
15752    /// Perform the operation you have build so far.
15753    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15754        use std::borrow::Cow;
15755        use std::io::{Read, Seek};
15756
15757        use common::{url::Params, ToParts};
15758        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15759
15760        let mut dd = common::DefaultDelegate;
15761        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15762        dlg.begin(common::MethodInfo {
15763            id: "container.projects.locations.clusters.updateMaster",
15764            http_method: hyper::Method::POST,
15765        });
15766
15767        for &field in ["alt", "name"].iter() {
15768            if self._additional_params.contains_key(field) {
15769                dlg.finished(false);
15770                return Err(common::Error::FieldClash(field));
15771            }
15772        }
15773
15774        let mut params = Params::with_capacity(4 + self._additional_params.len());
15775        params.push("name", self._name);
15776
15777        params.extend(self._additional_params.iter());
15778
15779        params.push("alt", "json");
15780        let mut url = self.hub._base_url.clone() + "v1/{+name}:updateMaster";
15781        if self._scopes.is_empty() {
15782            self._scopes
15783                .insert(Scope::CloudPlatform.as_ref().to_string());
15784        }
15785
15786        #[allow(clippy::single_element_loop)]
15787        for &(find_this, param_name) in [("{+name}", "name")].iter() {
15788            url = params.uri_replacement(url, param_name, find_this, true);
15789        }
15790        {
15791            let to_remove = ["name"];
15792            params.remove_params(&to_remove);
15793        }
15794
15795        let url = params.parse_with_url(&url);
15796
15797        let mut json_mime_type = mime::APPLICATION_JSON;
15798        let mut request_value_reader = {
15799            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15800            common::remove_json_null_values(&mut value);
15801            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15802            serde_json::to_writer(&mut dst, &value).unwrap();
15803            dst
15804        };
15805        let request_size = request_value_reader
15806            .seek(std::io::SeekFrom::End(0))
15807            .unwrap();
15808        request_value_reader
15809            .seek(std::io::SeekFrom::Start(0))
15810            .unwrap();
15811
15812        loop {
15813            let token = match self
15814                .hub
15815                .auth
15816                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15817                .await
15818            {
15819                Ok(token) => token,
15820                Err(e) => match dlg.token(e) {
15821                    Ok(token) => token,
15822                    Err(e) => {
15823                        dlg.finished(false);
15824                        return Err(common::Error::MissingToken(e));
15825                    }
15826                },
15827            };
15828            request_value_reader
15829                .seek(std::io::SeekFrom::Start(0))
15830                .unwrap();
15831            let mut req_result = {
15832                let client = &self.hub.client;
15833                dlg.pre_request();
15834                let mut req_builder = hyper::Request::builder()
15835                    .method(hyper::Method::POST)
15836                    .uri(url.as_str())
15837                    .header(USER_AGENT, self.hub._user_agent.clone());
15838
15839                if let Some(token) = token.as_ref() {
15840                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15841                }
15842
15843                let request = req_builder
15844                    .header(CONTENT_TYPE, json_mime_type.to_string())
15845                    .header(CONTENT_LENGTH, request_size as u64)
15846                    .body(common::to_body(
15847                        request_value_reader.get_ref().clone().into(),
15848                    ));
15849
15850                client.request(request.unwrap()).await
15851            };
15852
15853            match req_result {
15854                Err(err) => {
15855                    if let common::Retry::After(d) = dlg.http_error(&err) {
15856                        sleep(d).await;
15857                        continue;
15858                    }
15859                    dlg.finished(false);
15860                    return Err(common::Error::HttpError(err));
15861                }
15862                Ok(res) => {
15863                    let (mut parts, body) = res.into_parts();
15864                    let mut body = common::Body::new(body);
15865                    if !parts.status.is_success() {
15866                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15867                        let error = serde_json::from_str(&common::to_string(&bytes));
15868                        let response = common::to_response(parts, bytes.into());
15869
15870                        if let common::Retry::After(d) =
15871                            dlg.http_failure(&response, error.as_ref().ok())
15872                        {
15873                            sleep(d).await;
15874                            continue;
15875                        }
15876
15877                        dlg.finished(false);
15878
15879                        return Err(match error {
15880                            Ok(value) => common::Error::BadRequest(value),
15881                            _ => common::Error::Failure(response),
15882                        });
15883                    }
15884                    let response = {
15885                        let bytes = common::to_bytes(body).await.unwrap_or_default();
15886                        let encoded = common::to_string(&bytes);
15887                        match serde_json::from_str(&encoded) {
15888                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15889                            Err(error) => {
15890                                dlg.response_json_decode_error(&encoded, &error);
15891                                return Err(common::Error::JsonDecodeError(
15892                                    encoded.to_string(),
15893                                    error,
15894                                ));
15895                            }
15896                        }
15897                    };
15898
15899                    dlg.finished(true);
15900                    return Ok(response);
15901                }
15902            }
15903        }
15904    }
15905
15906    ///
15907    /// Sets the *request* property to the given value.
15908    ///
15909    /// Even though the property as already been set when instantiating this call,
15910    /// we provide this method for API completeness.
15911    pub fn request(
15912        mut self,
15913        new_value: UpdateMasterRequest,
15914    ) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
15915        self._request = new_value;
15916        self
15917    }
15918    /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
15919    ///
15920    /// Sets the *name* path property to the given value.
15921    ///
15922    /// Even though the property as already been set when instantiating this call,
15923    /// we provide this method for API completeness.
15924    pub fn name(mut self, new_value: &str) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
15925        self._name = new_value.to_string();
15926        self
15927    }
15928    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15929    /// while executing the actual API request.
15930    ///
15931    /// ````text
15932    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
15933    /// ````
15934    ///
15935    /// Sets the *delegate* property to the given value.
15936    pub fn delegate(
15937        mut self,
15938        new_value: &'a mut dyn common::Delegate,
15939    ) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
15940        self._delegate = Some(new_value);
15941        self
15942    }
15943
15944    /// Set any additional parameter of the query string used in the request.
15945    /// It should be used to set parameters which are not yet available through their own
15946    /// setters.
15947    ///
15948    /// Please note that this method must not be used to set any of the known parameters
15949    /// which have their own setter method. If done anyway, the request will fail.
15950    ///
15951    /// # Additional Parameters
15952    ///
15953    /// * *$.xgafv* (query-string) - V1 error format.
15954    /// * *access_token* (query-string) - OAuth access token.
15955    /// * *alt* (query-string) - Data format for response.
15956    /// * *callback* (query-string) - JSONP
15957    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15958    /// * *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.
15959    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15960    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15961    /// * *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.
15962    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15963    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15964    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterUpdateMasterCall<'a, C>
15965    where
15966        T: AsRef<str>,
15967    {
15968        self._additional_params
15969            .insert(name.as_ref().to_string(), value.as_ref().to_string());
15970        self
15971    }
15972
15973    /// Identifies the authorization scope for the method you are building.
15974    ///
15975    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15976    /// [`Scope::CloudPlatform`].
15977    ///
15978    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15979    /// tokens for more than one scope.
15980    ///
15981    /// Usually there is more than one suitable scope to authorize an operation, some of which may
15982    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15983    /// sufficient, a read-write scope will do as well.
15984    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterUpdateMasterCall<'a, C>
15985    where
15986        St: AsRef<str>,
15987    {
15988        self._scopes.insert(String::from(scope.as_ref()));
15989        self
15990    }
15991    /// Identifies the authorization scope(s) for the method you are building.
15992    ///
15993    /// See [`Self::add_scope()`] for details.
15994    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterUpdateMasterCall<'a, C>
15995    where
15996        I: IntoIterator<Item = St>,
15997        St: AsRef<str>,
15998    {
15999        self._scopes
16000            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16001        self
16002    }
16003
16004    /// Removes all scopes, and no default scope will be used either.
16005    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16006    /// for details).
16007    pub fn clear_scopes(mut self) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
16008        self._scopes.clear();
16009        self
16010    }
16011}
16012
16013/// Cancels the specified operation.
16014///
16015/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
16016/// It is not used directly, but through a [`ProjectMethods`] instance.
16017///
16018/// # Example
16019///
16020/// Instantiate a resource method builder
16021///
16022/// ```test_harness,no_run
16023/// # extern crate hyper;
16024/// # extern crate hyper_rustls;
16025/// # extern crate google_container1 as container1;
16026/// use container1::api::CancelOperationRequest;
16027/// # async fn dox() {
16028/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16029///
16030/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16032/// #     secret,
16033/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16034/// # ).build().await.unwrap();
16035///
16036/// # let client = hyper_util::client::legacy::Client::builder(
16037/// #     hyper_util::rt::TokioExecutor::new()
16038/// # )
16039/// # .build(
16040/// #     hyper_rustls::HttpsConnectorBuilder::new()
16041/// #         .with_native_roots()
16042/// #         .unwrap()
16043/// #         .https_or_http()
16044/// #         .enable_http1()
16045/// #         .build()
16046/// # );
16047/// # let mut hub = Container::new(client, auth);
16048/// // As the method needs a request, you would usually fill it with the desired information
16049/// // into the respective structure. Some of the parts shown here might not be applicable !
16050/// // Values shown here are possibly random and not representative !
16051/// let mut req = CancelOperationRequest::default();
16052///
16053/// // You can configure optional parameters by calling the respective setters at will, and
16054/// // execute the final call using `doit()`.
16055/// // Values shown here are possibly random and not representative !
16056/// let result = hub.projects().locations_operations_cancel(req, "name")
16057///              .doit().await;
16058/// # }
16059/// ```
16060pub struct ProjectLocationOperationCancelCall<'a, C>
16061where
16062    C: 'a,
16063{
16064    hub: &'a Container<C>,
16065    _request: CancelOperationRequest,
16066    _name: String,
16067    _delegate: Option<&'a mut dyn common::Delegate>,
16068    _additional_params: HashMap<String, String>,
16069    _scopes: BTreeSet<String>,
16070}
16071
16072impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
16073
16074impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
16075where
16076    C: common::Connector,
16077{
16078    /// Perform the operation you have build so far.
16079    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
16080        use std::borrow::Cow;
16081        use std::io::{Read, Seek};
16082
16083        use common::{url::Params, ToParts};
16084        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16085
16086        let mut dd = common::DefaultDelegate;
16087        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16088        dlg.begin(common::MethodInfo {
16089            id: "container.projects.locations.operations.cancel",
16090            http_method: hyper::Method::POST,
16091        });
16092
16093        for &field in ["alt", "name"].iter() {
16094            if self._additional_params.contains_key(field) {
16095                dlg.finished(false);
16096                return Err(common::Error::FieldClash(field));
16097            }
16098        }
16099
16100        let mut params = Params::with_capacity(4 + self._additional_params.len());
16101        params.push("name", self._name);
16102
16103        params.extend(self._additional_params.iter());
16104
16105        params.push("alt", "json");
16106        let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
16107        if self._scopes.is_empty() {
16108            self._scopes
16109                .insert(Scope::CloudPlatform.as_ref().to_string());
16110        }
16111
16112        #[allow(clippy::single_element_loop)]
16113        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16114            url = params.uri_replacement(url, param_name, find_this, true);
16115        }
16116        {
16117            let to_remove = ["name"];
16118            params.remove_params(&to_remove);
16119        }
16120
16121        let url = params.parse_with_url(&url);
16122
16123        let mut json_mime_type = mime::APPLICATION_JSON;
16124        let mut request_value_reader = {
16125            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16126            common::remove_json_null_values(&mut value);
16127            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16128            serde_json::to_writer(&mut dst, &value).unwrap();
16129            dst
16130        };
16131        let request_size = request_value_reader
16132            .seek(std::io::SeekFrom::End(0))
16133            .unwrap();
16134        request_value_reader
16135            .seek(std::io::SeekFrom::Start(0))
16136            .unwrap();
16137
16138        loop {
16139            let token = match self
16140                .hub
16141                .auth
16142                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16143                .await
16144            {
16145                Ok(token) => token,
16146                Err(e) => match dlg.token(e) {
16147                    Ok(token) => token,
16148                    Err(e) => {
16149                        dlg.finished(false);
16150                        return Err(common::Error::MissingToken(e));
16151                    }
16152                },
16153            };
16154            request_value_reader
16155                .seek(std::io::SeekFrom::Start(0))
16156                .unwrap();
16157            let mut req_result = {
16158                let client = &self.hub.client;
16159                dlg.pre_request();
16160                let mut req_builder = hyper::Request::builder()
16161                    .method(hyper::Method::POST)
16162                    .uri(url.as_str())
16163                    .header(USER_AGENT, self.hub._user_agent.clone());
16164
16165                if let Some(token) = token.as_ref() {
16166                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16167                }
16168
16169                let request = req_builder
16170                    .header(CONTENT_TYPE, json_mime_type.to_string())
16171                    .header(CONTENT_LENGTH, request_size as u64)
16172                    .body(common::to_body(
16173                        request_value_reader.get_ref().clone().into(),
16174                    ));
16175
16176                client.request(request.unwrap()).await
16177            };
16178
16179            match req_result {
16180                Err(err) => {
16181                    if let common::Retry::After(d) = dlg.http_error(&err) {
16182                        sleep(d).await;
16183                        continue;
16184                    }
16185                    dlg.finished(false);
16186                    return Err(common::Error::HttpError(err));
16187                }
16188                Ok(res) => {
16189                    let (mut parts, body) = res.into_parts();
16190                    let mut body = common::Body::new(body);
16191                    if !parts.status.is_success() {
16192                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16193                        let error = serde_json::from_str(&common::to_string(&bytes));
16194                        let response = common::to_response(parts, bytes.into());
16195
16196                        if let common::Retry::After(d) =
16197                            dlg.http_failure(&response, error.as_ref().ok())
16198                        {
16199                            sleep(d).await;
16200                            continue;
16201                        }
16202
16203                        dlg.finished(false);
16204
16205                        return Err(match error {
16206                            Ok(value) => common::Error::BadRequest(value),
16207                            _ => common::Error::Failure(response),
16208                        });
16209                    }
16210                    let response = {
16211                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16212                        let encoded = common::to_string(&bytes);
16213                        match serde_json::from_str(&encoded) {
16214                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16215                            Err(error) => {
16216                                dlg.response_json_decode_error(&encoded, &error);
16217                                return Err(common::Error::JsonDecodeError(
16218                                    encoded.to_string(),
16219                                    error,
16220                                ));
16221                            }
16222                        }
16223                    };
16224
16225                    dlg.finished(true);
16226                    return Ok(response);
16227                }
16228            }
16229        }
16230    }
16231
16232    ///
16233    /// Sets the *request* property to the given value.
16234    ///
16235    /// Even though the property as already been set when instantiating this call,
16236    /// we provide this method for API completeness.
16237    pub fn request(
16238        mut self,
16239        new_value: CancelOperationRequest,
16240    ) -> ProjectLocationOperationCancelCall<'a, C> {
16241        self._request = new_value;
16242        self
16243    }
16244    /// The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
16245    ///
16246    /// Sets the *name* path property to the given value.
16247    ///
16248    /// Even though the property as already been set when instantiating this call,
16249    /// we provide this method for API completeness.
16250    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
16251        self._name = new_value.to_string();
16252        self
16253    }
16254    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16255    /// while executing the actual API request.
16256    ///
16257    /// ````text
16258    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16259    /// ````
16260    ///
16261    /// Sets the *delegate* property to the given value.
16262    pub fn delegate(
16263        mut self,
16264        new_value: &'a mut dyn common::Delegate,
16265    ) -> ProjectLocationOperationCancelCall<'a, C> {
16266        self._delegate = Some(new_value);
16267        self
16268    }
16269
16270    /// Set any additional parameter of the query string used in the request.
16271    /// It should be used to set parameters which are not yet available through their own
16272    /// setters.
16273    ///
16274    /// Please note that this method must not be used to set any of the known parameters
16275    /// which have their own setter method. If done anyway, the request will fail.
16276    ///
16277    /// # Additional Parameters
16278    ///
16279    /// * *$.xgafv* (query-string) - V1 error format.
16280    /// * *access_token* (query-string) - OAuth access token.
16281    /// * *alt* (query-string) - Data format for response.
16282    /// * *callback* (query-string) - JSONP
16283    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16284    /// * *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.
16285    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16286    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16287    /// * *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.
16288    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16289    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16290    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
16291    where
16292        T: AsRef<str>,
16293    {
16294        self._additional_params
16295            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16296        self
16297    }
16298
16299    /// Identifies the authorization scope for the method you are building.
16300    ///
16301    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16302    /// [`Scope::CloudPlatform`].
16303    ///
16304    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16305    /// tokens for more than one scope.
16306    ///
16307    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16308    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16309    /// sufficient, a read-write scope will do as well.
16310    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
16311    where
16312        St: AsRef<str>,
16313    {
16314        self._scopes.insert(String::from(scope.as_ref()));
16315        self
16316    }
16317    /// Identifies the authorization scope(s) for the method you are building.
16318    ///
16319    /// See [`Self::add_scope()`] for details.
16320    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
16321    where
16322        I: IntoIterator<Item = St>,
16323        St: AsRef<str>,
16324    {
16325        self._scopes
16326            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16327        self
16328    }
16329
16330    /// Removes all scopes, and no default scope will be used either.
16331    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16332    /// for details).
16333    pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
16334        self._scopes.clear();
16335        self
16336    }
16337}
16338
16339/// Gets the specified operation.
16340///
16341/// A builder for the *locations.operations.get* method supported by a *project* resource.
16342/// It is not used directly, but through a [`ProjectMethods`] instance.
16343///
16344/// # Example
16345///
16346/// Instantiate a resource method builder
16347///
16348/// ```test_harness,no_run
16349/// # extern crate hyper;
16350/// # extern crate hyper_rustls;
16351/// # extern crate google_container1 as container1;
16352/// # async fn dox() {
16353/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16354///
16355/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16356/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16357/// #     secret,
16358/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16359/// # ).build().await.unwrap();
16360///
16361/// # let client = hyper_util::client::legacy::Client::builder(
16362/// #     hyper_util::rt::TokioExecutor::new()
16363/// # )
16364/// # .build(
16365/// #     hyper_rustls::HttpsConnectorBuilder::new()
16366/// #         .with_native_roots()
16367/// #         .unwrap()
16368/// #         .https_or_http()
16369/// #         .enable_http1()
16370/// #         .build()
16371/// # );
16372/// # let mut hub = Container::new(client, auth);
16373/// // You can configure optional parameters by calling the respective setters at will, and
16374/// // execute the final call using `doit()`.
16375/// // Values shown here are possibly random and not representative !
16376/// let result = hub.projects().locations_operations_get("name")
16377///              .zone("elitr")
16378///              .project_id("Lorem")
16379///              .operation_id("diam")
16380///              .doit().await;
16381/// # }
16382/// ```
16383pub struct ProjectLocationOperationGetCall<'a, C>
16384where
16385    C: 'a,
16386{
16387    hub: &'a Container<C>,
16388    _name: String,
16389    _zone: Option<String>,
16390    _project_id: Option<String>,
16391    _operation_id: Option<String>,
16392    _delegate: Option<&'a mut dyn common::Delegate>,
16393    _additional_params: HashMap<String, String>,
16394    _scopes: BTreeSet<String>,
16395}
16396
16397impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
16398
16399impl<'a, C> ProjectLocationOperationGetCall<'a, C>
16400where
16401    C: common::Connector,
16402{
16403    /// Perform the operation you have build so far.
16404    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16405        use std::borrow::Cow;
16406        use std::io::{Read, Seek};
16407
16408        use common::{url::Params, ToParts};
16409        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16410
16411        let mut dd = common::DefaultDelegate;
16412        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16413        dlg.begin(common::MethodInfo {
16414            id: "container.projects.locations.operations.get",
16415            http_method: hyper::Method::GET,
16416        });
16417
16418        for &field in ["alt", "name", "zone", "projectId", "operationId"].iter() {
16419            if self._additional_params.contains_key(field) {
16420                dlg.finished(false);
16421                return Err(common::Error::FieldClash(field));
16422            }
16423        }
16424
16425        let mut params = Params::with_capacity(6 + self._additional_params.len());
16426        params.push("name", self._name);
16427        if let Some(value) = self._zone.as_ref() {
16428            params.push("zone", value);
16429        }
16430        if let Some(value) = self._project_id.as_ref() {
16431            params.push("projectId", value);
16432        }
16433        if let Some(value) = self._operation_id.as_ref() {
16434            params.push("operationId", value);
16435        }
16436
16437        params.extend(self._additional_params.iter());
16438
16439        params.push("alt", "json");
16440        let mut url = self.hub._base_url.clone() + "v1/{+name}";
16441        if self._scopes.is_empty() {
16442            self._scopes
16443                .insert(Scope::CloudPlatform.as_ref().to_string());
16444        }
16445
16446        #[allow(clippy::single_element_loop)]
16447        for &(find_this, param_name) in [("{+name}", "name")].iter() {
16448            url = params.uri_replacement(url, param_name, find_this, true);
16449        }
16450        {
16451            let to_remove = ["name"];
16452            params.remove_params(&to_remove);
16453        }
16454
16455        let url = params.parse_with_url(&url);
16456
16457        loop {
16458            let token = match self
16459                .hub
16460                .auth
16461                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16462                .await
16463            {
16464                Ok(token) => token,
16465                Err(e) => match dlg.token(e) {
16466                    Ok(token) => token,
16467                    Err(e) => {
16468                        dlg.finished(false);
16469                        return Err(common::Error::MissingToken(e));
16470                    }
16471                },
16472            };
16473            let mut req_result = {
16474                let client = &self.hub.client;
16475                dlg.pre_request();
16476                let mut req_builder = hyper::Request::builder()
16477                    .method(hyper::Method::GET)
16478                    .uri(url.as_str())
16479                    .header(USER_AGENT, self.hub._user_agent.clone());
16480
16481                if let Some(token) = token.as_ref() {
16482                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16483                }
16484
16485                let request = req_builder
16486                    .header(CONTENT_LENGTH, 0_u64)
16487                    .body(common::to_body::<String>(None));
16488
16489                client.request(request.unwrap()).await
16490            };
16491
16492            match req_result {
16493                Err(err) => {
16494                    if let common::Retry::After(d) = dlg.http_error(&err) {
16495                        sleep(d).await;
16496                        continue;
16497                    }
16498                    dlg.finished(false);
16499                    return Err(common::Error::HttpError(err));
16500                }
16501                Ok(res) => {
16502                    let (mut parts, body) = res.into_parts();
16503                    let mut body = common::Body::new(body);
16504                    if !parts.status.is_success() {
16505                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16506                        let error = serde_json::from_str(&common::to_string(&bytes));
16507                        let response = common::to_response(parts, bytes.into());
16508
16509                        if let common::Retry::After(d) =
16510                            dlg.http_failure(&response, error.as_ref().ok())
16511                        {
16512                            sleep(d).await;
16513                            continue;
16514                        }
16515
16516                        dlg.finished(false);
16517
16518                        return Err(match error {
16519                            Ok(value) => common::Error::BadRequest(value),
16520                            _ => common::Error::Failure(response),
16521                        });
16522                    }
16523                    let response = {
16524                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16525                        let encoded = common::to_string(&bytes);
16526                        match serde_json::from_str(&encoded) {
16527                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16528                            Err(error) => {
16529                                dlg.response_json_decode_error(&encoded, &error);
16530                                return Err(common::Error::JsonDecodeError(
16531                                    encoded.to_string(),
16532                                    error,
16533                                ));
16534                            }
16535                        }
16536                    };
16537
16538                    dlg.finished(true);
16539                    return Ok(response);
16540                }
16541            }
16542        }
16543    }
16544
16545    /// The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
16546    ///
16547    /// Sets the *name* path property to the given value.
16548    ///
16549    /// Even though the property as already been set when instantiating this call,
16550    /// we provide this method for API completeness.
16551    pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
16552        self._name = new_value.to_string();
16553        self
16554    }
16555    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
16556    ///
16557    /// Sets the *zone* query property to the given value.
16558    pub fn zone(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
16559        self._zone = Some(new_value.to_string());
16560        self
16561    }
16562    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
16563    ///
16564    /// Sets the *project id* query property to the given value.
16565    pub fn project_id(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
16566        self._project_id = Some(new_value.to_string());
16567        self
16568    }
16569    /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
16570    ///
16571    /// Sets the *operation id* query property to the given value.
16572    pub fn operation_id(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
16573        self._operation_id = Some(new_value.to_string());
16574        self
16575    }
16576    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16577    /// while executing the actual API request.
16578    ///
16579    /// ````text
16580    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16581    /// ````
16582    ///
16583    /// Sets the *delegate* property to the given value.
16584    pub fn delegate(
16585        mut self,
16586        new_value: &'a mut dyn common::Delegate,
16587    ) -> ProjectLocationOperationGetCall<'a, C> {
16588        self._delegate = Some(new_value);
16589        self
16590    }
16591
16592    /// Set any additional parameter of the query string used in the request.
16593    /// It should be used to set parameters which are not yet available through their own
16594    /// setters.
16595    ///
16596    /// Please note that this method must not be used to set any of the known parameters
16597    /// which have their own setter method. If done anyway, the request will fail.
16598    ///
16599    /// # Additional Parameters
16600    ///
16601    /// * *$.xgafv* (query-string) - V1 error format.
16602    /// * *access_token* (query-string) - OAuth access token.
16603    /// * *alt* (query-string) - Data format for response.
16604    /// * *callback* (query-string) - JSONP
16605    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16606    /// * *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.
16607    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16608    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16609    /// * *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.
16610    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16611    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16612    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
16613    where
16614        T: AsRef<str>,
16615    {
16616        self._additional_params
16617            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16618        self
16619    }
16620
16621    /// Identifies the authorization scope for the method you are building.
16622    ///
16623    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16624    /// [`Scope::CloudPlatform`].
16625    ///
16626    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16627    /// tokens for more than one scope.
16628    ///
16629    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16630    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16631    /// sufficient, a read-write scope will do as well.
16632    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
16633    where
16634        St: AsRef<str>,
16635    {
16636        self._scopes.insert(String::from(scope.as_ref()));
16637        self
16638    }
16639    /// Identifies the authorization scope(s) for the method you are building.
16640    ///
16641    /// See [`Self::add_scope()`] for details.
16642    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
16643    where
16644        I: IntoIterator<Item = St>,
16645        St: AsRef<str>,
16646    {
16647        self._scopes
16648            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16649        self
16650    }
16651
16652    /// Removes all scopes, and no default scope will be used either.
16653    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16654    /// for details).
16655    pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
16656        self._scopes.clear();
16657        self
16658    }
16659}
16660
16661/// Lists all operations in a project in a specific zone or all zones.
16662///
16663/// A builder for the *locations.operations.list* method supported by a *project* resource.
16664/// It is not used directly, but through a [`ProjectMethods`] instance.
16665///
16666/// # Example
16667///
16668/// Instantiate a resource method builder
16669///
16670/// ```test_harness,no_run
16671/// # extern crate hyper;
16672/// # extern crate hyper_rustls;
16673/// # extern crate google_container1 as container1;
16674/// # async fn dox() {
16675/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16676///
16677/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16678/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16679/// #     secret,
16680/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16681/// # ).build().await.unwrap();
16682///
16683/// # let client = hyper_util::client::legacy::Client::builder(
16684/// #     hyper_util::rt::TokioExecutor::new()
16685/// # )
16686/// # .build(
16687/// #     hyper_rustls::HttpsConnectorBuilder::new()
16688/// #         .with_native_roots()
16689/// #         .unwrap()
16690/// #         .https_or_http()
16691/// #         .enable_http1()
16692/// #         .build()
16693/// # );
16694/// # let mut hub = Container::new(client, auth);
16695/// // You can configure optional parameters by calling the respective setters at will, and
16696/// // execute the final call using `doit()`.
16697/// // Values shown here are possibly random and not representative !
16698/// let result = hub.projects().locations_operations_list("parent")
16699///              .zone("ipsum")
16700///              .project_id("accusam")
16701///              .doit().await;
16702/// # }
16703/// ```
16704pub struct ProjectLocationOperationListCall<'a, C>
16705where
16706    C: 'a,
16707{
16708    hub: &'a Container<C>,
16709    _parent: String,
16710    _zone: Option<String>,
16711    _project_id: Option<String>,
16712    _delegate: Option<&'a mut dyn common::Delegate>,
16713    _additional_params: HashMap<String, String>,
16714    _scopes: BTreeSet<String>,
16715}
16716
16717impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
16718
16719impl<'a, C> ProjectLocationOperationListCall<'a, C>
16720where
16721    C: common::Connector,
16722{
16723    /// Perform the operation you have build so far.
16724    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
16725        use std::borrow::Cow;
16726        use std::io::{Read, Seek};
16727
16728        use common::{url::Params, ToParts};
16729        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16730
16731        let mut dd = common::DefaultDelegate;
16732        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16733        dlg.begin(common::MethodInfo {
16734            id: "container.projects.locations.operations.list",
16735            http_method: hyper::Method::GET,
16736        });
16737
16738        for &field in ["alt", "parent", "zone", "projectId"].iter() {
16739            if self._additional_params.contains_key(field) {
16740                dlg.finished(false);
16741                return Err(common::Error::FieldClash(field));
16742            }
16743        }
16744
16745        let mut params = Params::with_capacity(5 + self._additional_params.len());
16746        params.push("parent", self._parent);
16747        if let Some(value) = self._zone.as_ref() {
16748            params.push("zone", value);
16749        }
16750        if let Some(value) = self._project_id.as_ref() {
16751            params.push("projectId", value);
16752        }
16753
16754        params.extend(self._additional_params.iter());
16755
16756        params.push("alt", "json");
16757        let mut url = self.hub._base_url.clone() + "v1/{+parent}/operations";
16758        if self._scopes.is_empty() {
16759            self._scopes
16760                .insert(Scope::CloudPlatform.as_ref().to_string());
16761        }
16762
16763        #[allow(clippy::single_element_loop)]
16764        for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
16765            url = params.uri_replacement(url, param_name, find_this, true);
16766        }
16767        {
16768            let to_remove = ["parent"];
16769            params.remove_params(&to_remove);
16770        }
16771
16772        let url = params.parse_with_url(&url);
16773
16774        loop {
16775            let token = match self
16776                .hub
16777                .auth
16778                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16779                .await
16780            {
16781                Ok(token) => token,
16782                Err(e) => match dlg.token(e) {
16783                    Ok(token) => token,
16784                    Err(e) => {
16785                        dlg.finished(false);
16786                        return Err(common::Error::MissingToken(e));
16787                    }
16788                },
16789            };
16790            let mut req_result = {
16791                let client = &self.hub.client;
16792                dlg.pre_request();
16793                let mut req_builder = hyper::Request::builder()
16794                    .method(hyper::Method::GET)
16795                    .uri(url.as_str())
16796                    .header(USER_AGENT, self.hub._user_agent.clone());
16797
16798                if let Some(token) = token.as_ref() {
16799                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16800                }
16801
16802                let request = req_builder
16803                    .header(CONTENT_LENGTH, 0_u64)
16804                    .body(common::to_body::<String>(None));
16805
16806                client.request(request.unwrap()).await
16807            };
16808
16809            match req_result {
16810                Err(err) => {
16811                    if let common::Retry::After(d) = dlg.http_error(&err) {
16812                        sleep(d).await;
16813                        continue;
16814                    }
16815                    dlg.finished(false);
16816                    return Err(common::Error::HttpError(err));
16817                }
16818                Ok(res) => {
16819                    let (mut parts, body) = res.into_parts();
16820                    let mut body = common::Body::new(body);
16821                    if !parts.status.is_success() {
16822                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16823                        let error = serde_json::from_str(&common::to_string(&bytes));
16824                        let response = common::to_response(parts, bytes.into());
16825
16826                        if let common::Retry::After(d) =
16827                            dlg.http_failure(&response, error.as_ref().ok())
16828                        {
16829                            sleep(d).await;
16830                            continue;
16831                        }
16832
16833                        dlg.finished(false);
16834
16835                        return Err(match error {
16836                            Ok(value) => common::Error::BadRequest(value),
16837                            _ => common::Error::Failure(response),
16838                        });
16839                    }
16840                    let response = {
16841                        let bytes = common::to_bytes(body).await.unwrap_or_default();
16842                        let encoded = common::to_string(&bytes);
16843                        match serde_json::from_str(&encoded) {
16844                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16845                            Err(error) => {
16846                                dlg.response_json_decode_error(&encoded, &error);
16847                                return Err(common::Error::JsonDecodeError(
16848                                    encoded.to_string(),
16849                                    error,
16850                                ));
16851                            }
16852                        }
16853                    };
16854
16855                    dlg.finished(true);
16856                    return Ok(response);
16857                }
16858            }
16859        }
16860    }
16861
16862    /// The parent (project and location) where the operations will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
16863    ///
16864    /// Sets the *parent* path property to the given value.
16865    ///
16866    /// Even though the property as already been set when instantiating this call,
16867    /// we provide this method for API completeness.
16868    pub fn parent(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
16869        self._parent = new_value.to_string();
16870        self
16871    }
16872    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) to return operations for, or `-` for all zones. This field has been deprecated and replaced by the parent field.
16873    ///
16874    /// Sets the *zone* query property to the given value.
16875    pub fn zone(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
16876        self._zone = Some(new_value.to_string());
16877        self
16878    }
16879    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
16880    ///
16881    /// Sets the *project id* query property to the given value.
16882    pub fn project_id(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
16883        self._project_id = Some(new_value.to_string());
16884        self
16885    }
16886    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16887    /// while executing the actual API request.
16888    ///
16889    /// ````text
16890    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
16891    /// ````
16892    ///
16893    /// Sets the *delegate* property to the given value.
16894    pub fn delegate(
16895        mut self,
16896        new_value: &'a mut dyn common::Delegate,
16897    ) -> ProjectLocationOperationListCall<'a, C> {
16898        self._delegate = Some(new_value);
16899        self
16900    }
16901
16902    /// Set any additional parameter of the query string used in the request.
16903    /// It should be used to set parameters which are not yet available through their own
16904    /// setters.
16905    ///
16906    /// Please note that this method must not be used to set any of the known parameters
16907    /// which have their own setter method. If done anyway, the request will fail.
16908    ///
16909    /// # Additional Parameters
16910    ///
16911    /// * *$.xgafv* (query-string) - V1 error format.
16912    /// * *access_token* (query-string) - OAuth access token.
16913    /// * *alt* (query-string) - Data format for response.
16914    /// * *callback* (query-string) - JSONP
16915    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16916    /// * *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.
16917    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16918    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16919    /// * *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.
16920    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16921    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16922    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
16923    where
16924        T: AsRef<str>,
16925    {
16926        self._additional_params
16927            .insert(name.as_ref().to_string(), value.as_ref().to_string());
16928        self
16929    }
16930
16931    /// Identifies the authorization scope for the method you are building.
16932    ///
16933    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16934    /// [`Scope::CloudPlatform`].
16935    ///
16936    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16937    /// tokens for more than one scope.
16938    ///
16939    /// Usually there is more than one suitable scope to authorize an operation, some of which may
16940    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16941    /// sufficient, a read-write scope will do as well.
16942    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
16943    where
16944        St: AsRef<str>,
16945    {
16946        self._scopes.insert(String::from(scope.as_ref()));
16947        self
16948    }
16949    /// Identifies the authorization scope(s) for the method you are building.
16950    ///
16951    /// See [`Self::add_scope()`] for details.
16952    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
16953    where
16954        I: IntoIterator<Item = St>,
16955        St: AsRef<str>,
16956    {
16957        self._scopes
16958            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16959        self
16960    }
16961
16962    /// Removes all scopes, and no default scope will be used either.
16963    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16964    /// for details).
16965    pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
16966        self._scopes.clear();
16967        self
16968    }
16969}
16970
16971/// Returns configuration info about the Google Kubernetes Engine service.
16972///
16973/// A builder for the *locations.getServerConfig* method supported by a *project* resource.
16974/// It is not used directly, but through a [`ProjectMethods`] instance.
16975///
16976/// # Example
16977///
16978/// Instantiate a resource method builder
16979///
16980/// ```test_harness,no_run
16981/// # extern crate hyper;
16982/// # extern crate hyper_rustls;
16983/// # extern crate google_container1 as container1;
16984/// # async fn dox() {
16985/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16986///
16987/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16988/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
16989/// #     secret,
16990/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16991/// # ).build().await.unwrap();
16992///
16993/// # let client = hyper_util::client::legacy::Client::builder(
16994/// #     hyper_util::rt::TokioExecutor::new()
16995/// # )
16996/// # .build(
16997/// #     hyper_rustls::HttpsConnectorBuilder::new()
16998/// #         .with_native_roots()
16999/// #         .unwrap()
17000/// #         .https_or_http()
17001/// #         .enable_http1()
17002/// #         .build()
17003/// # );
17004/// # let mut hub = Container::new(client, auth);
17005/// // You can configure optional parameters by calling the respective setters at will, and
17006/// // execute the final call using `doit()`.
17007/// // Values shown here are possibly random and not representative !
17008/// let result = hub.projects().locations_get_server_config("name")
17009///              .zone("consetetur")
17010///              .project_id("voluptua.")
17011///              .doit().await;
17012/// # }
17013/// ```
17014pub struct ProjectLocationGetServerConfigCall<'a, C>
17015where
17016    C: 'a,
17017{
17018    hub: &'a Container<C>,
17019    _name: String,
17020    _zone: Option<String>,
17021    _project_id: Option<String>,
17022    _delegate: Option<&'a mut dyn common::Delegate>,
17023    _additional_params: HashMap<String, String>,
17024    _scopes: BTreeSet<String>,
17025}
17026
17027impl<'a, C> common::CallBuilder for ProjectLocationGetServerConfigCall<'a, C> {}
17028
17029impl<'a, C> ProjectLocationGetServerConfigCall<'a, C>
17030where
17031    C: common::Connector,
17032{
17033    /// Perform the operation you have build so far.
17034    pub async fn doit(mut self) -> common::Result<(common::Response, ServerConfig)> {
17035        use std::borrow::Cow;
17036        use std::io::{Read, Seek};
17037
17038        use common::{url::Params, ToParts};
17039        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17040
17041        let mut dd = common::DefaultDelegate;
17042        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17043        dlg.begin(common::MethodInfo {
17044            id: "container.projects.locations.getServerConfig",
17045            http_method: hyper::Method::GET,
17046        });
17047
17048        for &field in ["alt", "name", "zone", "projectId"].iter() {
17049            if self._additional_params.contains_key(field) {
17050                dlg.finished(false);
17051                return Err(common::Error::FieldClash(field));
17052            }
17053        }
17054
17055        let mut params = Params::with_capacity(5 + self._additional_params.len());
17056        params.push("name", self._name);
17057        if let Some(value) = self._zone.as_ref() {
17058            params.push("zone", value);
17059        }
17060        if let Some(value) = self._project_id.as_ref() {
17061            params.push("projectId", value);
17062        }
17063
17064        params.extend(self._additional_params.iter());
17065
17066        params.push("alt", "json");
17067        let mut url = self.hub._base_url.clone() + "v1/{+name}/serverConfig";
17068        if self._scopes.is_empty() {
17069            self._scopes
17070                .insert(Scope::CloudPlatform.as_ref().to_string());
17071        }
17072
17073        #[allow(clippy::single_element_loop)]
17074        for &(find_this, param_name) in [("{+name}", "name")].iter() {
17075            url = params.uri_replacement(url, param_name, find_this, true);
17076        }
17077        {
17078            let to_remove = ["name"];
17079            params.remove_params(&to_remove);
17080        }
17081
17082        let url = params.parse_with_url(&url);
17083
17084        loop {
17085            let token = match self
17086                .hub
17087                .auth
17088                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17089                .await
17090            {
17091                Ok(token) => token,
17092                Err(e) => match dlg.token(e) {
17093                    Ok(token) => token,
17094                    Err(e) => {
17095                        dlg.finished(false);
17096                        return Err(common::Error::MissingToken(e));
17097                    }
17098                },
17099            };
17100            let mut req_result = {
17101                let client = &self.hub.client;
17102                dlg.pre_request();
17103                let mut req_builder = hyper::Request::builder()
17104                    .method(hyper::Method::GET)
17105                    .uri(url.as_str())
17106                    .header(USER_AGENT, self.hub._user_agent.clone());
17107
17108                if let Some(token) = token.as_ref() {
17109                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17110                }
17111
17112                let request = req_builder
17113                    .header(CONTENT_LENGTH, 0_u64)
17114                    .body(common::to_body::<String>(None));
17115
17116                client.request(request.unwrap()).await
17117            };
17118
17119            match req_result {
17120                Err(err) => {
17121                    if let common::Retry::After(d) = dlg.http_error(&err) {
17122                        sleep(d).await;
17123                        continue;
17124                    }
17125                    dlg.finished(false);
17126                    return Err(common::Error::HttpError(err));
17127                }
17128                Ok(res) => {
17129                    let (mut parts, body) = res.into_parts();
17130                    let mut body = common::Body::new(body);
17131                    if !parts.status.is_success() {
17132                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17133                        let error = serde_json::from_str(&common::to_string(&bytes));
17134                        let response = common::to_response(parts, bytes.into());
17135
17136                        if let common::Retry::After(d) =
17137                            dlg.http_failure(&response, error.as_ref().ok())
17138                        {
17139                            sleep(d).await;
17140                            continue;
17141                        }
17142
17143                        dlg.finished(false);
17144
17145                        return Err(match error {
17146                            Ok(value) => common::Error::BadRequest(value),
17147                            _ => common::Error::Failure(response),
17148                        });
17149                    }
17150                    let response = {
17151                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17152                        let encoded = common::to_string(&bytes);
17153                        match serde_json::from_str(&encoded) {
17154                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17155                            Err(error) => {
17156                                dlg.response_json_decode_error(&encoded, &error);
17157                                return Err(common::Error::JsonDecodeError(
17158                                    encoded.to_string(),
17159                                    error,
17160                                ));
17161                            }
17162                        }
17163                    };
17164
17165                    dlg.finished(true);
17166                    return Ok(response);
17167                }
17168            }
17169        }
17170    }
17171
17172    /// The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
17173    ///
17174    /// Sets the *name* path property to the given value.
17175    ///
17176    /// Even though the property as already been set when instantiating this call,
17177    /// we provide this method for API completeness.
17178    pub fn name(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
17179        self._name = new_value.to_string();
17180        self
17181    }
17182    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) to return operations for. This field has been deprecated and replaced by the name field.
17183    ///
17184    /// Sets the *zone* query property to the given value.
17185    pub fn zone(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
17186        self._zone = Some(new_value.to_string());
17187        self
17188    }
17189    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
17190    ///
17191    /// Sets the *project id* query property to the given value.
17192    pub fn project_id(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
17193        self._project_id = Some(new_value.to_string());
17194        self
17195    }
17196    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17197    /// while executing the actual API request.
17198    ///
17199    /// ````text
17200    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17201    /// ````
17202    ///
17203    /// Sets the *delegate* property to the given value.
17204    pub fn delegate(
17205        mut self,
17206        new_value: &'a mut dyn common::Delegate,
17207    ) -> ProjectLocationGetServerConfigCall<'a, C> {
17208        self._delegate = Some(new_value);
17209        self
17210    }
17211
17212    /// Set any additional parameter of the query string used in the request.
17213    /// It should be used to set parameters which are not yet available through their own
17214    /// setters.
17215    ///
17216    /// Please note that this method must not be used to set any of the known parameters
17217    /// which have their own setter method. If done anyway, the request will fail.
17218    ///
17219    /// # Additional Parameters
17220    ///
17221    /// * *$.xgafv* (query-string) - V1 error format.
17222    /// * *access_token* (query-string) - OAuth access token.
17223    /// * *alt* (query-string) - Data format for response.
17224    /// * *callback* (query-string) - JSONP
17225    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17226    /// * *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.
17227    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17228    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17229    /// * *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.
17230    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17231    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17232    pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetServerConfigCall<'a, C>
17233    where
17234        T: AsRef<str>,
17235    {
17236        self._additional_params
17237            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17238        self
17239    }
17240
17241    /// Identifies the authorization scope for the method you are building.
17242    ///
17243    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17244    /// [`Scope::CloudPlatform`].
17245    ///
17246    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17247    /// tokens for more than one scope.
17248    ///
17249    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17250    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17251    /// sufficient, a read-write scope will do as well.
17252    pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetServerConfigCall<'a, C>
17253    where
17254        St: AsRef<str>,
17255    {
17256        self._scopes.insert(String::from(scope.as_ref()));
17257        self
17258    }
17259    /// Identifies the authorization scope(s) for the method you are building.
17260    ///
17261    /// See [`Self::add_scope()`] for details.
17262    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetServerConfigCall<'a, C>
17263    where
17264        I: IntoIterator<Item = St>,
17265        St: AsRef<str>,
17266    {
17267        self._scopes
17268            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17269        self
17270    }
17271
17272    /// Removes all scopes, and no default scope will be used either.
17273    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17274    /// for details).
17275    pub fn clear_scopes(mut self) -> ProjectLocationGetServerConfigCall<'a, C> {
17276        self._scopes.clear();
17277        self
17278    }
17279}
17280
17281/// Sets the autoscaling settings for the specified node pool.
17282///
17283/// A builder for the *zones.clusters.nodePools.autoscaling* method supported by a *project* resource.
17284/// It is not used directly, but through a [`ProjectMethods`] instance.
17285///
17286/// # Example
17287///
17288/// Instantiate a resource method builder
17289///
17290/// ```test_harness,no_run
17291/// # extern crate hyper;
17292/// # extern crate hyper_rustls;
17293/// # extern crate google_container1 as container1;
17294/// use container1::api::SetNodePoolAutoscalingRequest;
17295/// # async fn dox() {
17296/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17297///
17298/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17299/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17300/// #     secret,
17301/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17302/// # ).build().await.unwrap();
17303///
17304/// # let client = hyper_util::client::legacy::Client::builder(
17305/// #     hyper_util::rt::TokioExecutor::new()
17306/// # )
17307/// # .build(
17308/// #     hyper_rustls::HttpsConnectorBuilder::new()
17309/// #         .with_native_roots()
17310/// #         .unwrap()
17311/// #         .https_or_http()
17312/// #         .enable_http1()
17313/// #         .build()
17314/// # );
17315/// # let mut hub = Container::new(client, auth);
17316/// // As the method needs a request, you would usually fill it with the desired information
17317/// // into the respective structure. Some of the parts shown here might not be applicable !
17318/// // Values shown here are possibly random and not representative !
17319/// let mut req = SetNodePoolAutoscalingRequest::default();
17320///
17321/// // You can configure optional parameters by calling the respective setters at will, and
17322/// // execute the final call using `doit()`.
17323/// // Values shown here are possibly random and not representative !
17324/// let result = hub.projects().zones_clusters_node_pools_autoscaling(req, "projectId", "zone", "clusterId", "nodePoolId")
17325///              .doit().await;
17326/// # }
17327/// ```
17328pub struct ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
17329where
17330    C: 'a,
17331{
17332    hub: &'a Container<C>,
17333    _request: SetNodePoolAutoscalingRequest,
17334    _project_id: String,
17335    _zone: String,
17336    _cluster_id: String,
17337    _node_pool_id: String,
17338    _delegate: Option<&'a mut dyn common::Delegate>,
17339    _additional_params: HashMap<String, String>,
17340    _scopes: BTreeSet<String>,
17341}
17342
17343impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {}
17344
17345impl<'a, C> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
17346where
17347    C: common::Connector,
17348{
17349    /// Perform the operation you have build so far.
17350    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17351        use std::borrow::Cow;
17352        use std::io::{Read, Seek};
17353
17354        use common::{url::Params, ToParts};
17355        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17356
17357        let mut dd = common::DefaultDelegate;
17358        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17359        dlg.begin(common::MethodInfo {
17360            id: "container.projects.zones.clusters.nodePools.autoscaling",
17361            http_method: hyper::Method::POST,
17362        });
17363
17364        for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
17365            if self._additional_params.contains_key(field) {
17366                dlg.finished(false);
17367                return Err(common::Error::FieldClash(field));
17368            }
17369        }
17370
17371        let mut params = Params::with_capacity(7 + self._additional_params.len());
17372        params.push("projectId", self._project_id);
17373        params.push("zone", self._zone);
17374        params.push("clusterId", self._cluster_id);
17375        params.push("nodePoolId", self._node_pool_id);
17376
17377        params.extend(self._additional_params.iter());
17378
17379        params.push("alt", "json");
17380        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/autoscaling";
17381        if self._scopes.is_empty() {
17382            self._scopes
17383                .insert(Scope::CloudPlatform.as_ref().to_string());
17384        }
17385
17386        #[allow(clippy::single_element_loop)]
17387        for &(find_this, param_name) in [
17388            ("{projectId}", "projectId"),
17389            ("{zone}", "zone"),
17390            ("{clusterId}", "clusterId"),
17391            ("{nodePoolId}", "nodePoolId"),
17392        ]
17393        .iter()
17394        {
17395            url = params.uri_replacement(url, param_name, find_this, false);
17396        }
17397        {
17398            let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
17399            params.remove_params(&to_remove);
17400        }
17401
17402        let url = params.parse_with_url(&url);
17403
17404        let mut json_mime_type = mime::APPLICATION_JSON;
17405        let mut request_value_reader = {
17406            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17407            common::remove_json_null_values(&mut value);
17408            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17409            serde_json::to_writer(&mut dst, &value).unwrap();
17410            dst
17411        };
17412        let request_size = request_value_reader
17413            .seek(std::io::SeekFrom::End(0))
17414            .unwrap();
17415        request_value_reader
17416            .seek(std::io::SeekFrom::Start(0))
17417            .unwrap();
17418
17419        loop {
17420            let token = match self
17421                .hub
17422                .auth
17423                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17424                .await
17425            {
17426                Ok(token) => token,
17427                Err(e) => match dlg.token(e) {
17428                    Ok(token) => token,
17429                    Err(e) => {
17430                        dlg.finished(false);
17431                        return Err(common::Error::MissingToken(e));
17432                    }
17433                },
17434            };
17435            request_value_reader
17436                .seek(std::io::SeekFrom::Start(0))
17437                .unwrap();
17438            let mut req_result = {
17439                let client = &self.hub.client;
17440                dlg.pre_request();
17441                let mut req_builder = hyper::Request::builder()
17442                    .method(hyper::Method::POST)
17443                    .uri(url.as_str())
17444                    .header(USER_AGENT, self.hub._user_agent.clone());
17445
17446                if let Some(token) = token.as_ref() {
17447                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17448                }
17449
17450                let request = req_builder
17451                    .header(CONTENT_TYPE, json_mime_type.to_string())
17452                    .header(CONTENT_LENGTH, request_size as u64)
17453                    .body(common::to_body(
17454                        request_value_reader.get_ref().clone().into(),
17455                    ));
17456
17457                client.request(request.unwrap()).await
17458            };
17459
17460            match req_result {
17461                Err(err) => {
17462                    if let common::Retry::After(d) = dlg.http_error(&err) {
17463                        sleep(d).await;
17464                        continue;
17465                    }
17466                    dlg.finished(false);
17467                    return Err(common::Error::HttpError(err));
17468                }
17469                Ok(res) => {
17470                    let (mut parts, body) = res.into_parts();
17471                    let mut body = common::Body::new(body);
17472                    if !parts.status.is_success() {
17473                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17474                        let error = serde_json::from_str(&common::to_string(&bytes));
17475                        let response = common::to_response(parts, bytes.into());
17476
17477                        if let common::Retry::After(d) =
17478                            dlg.http_failure(&response, error.as_ref().ok())
17479                        {
17480                            sleep(d).await;
17481                            continue;
17482                        }
17483
17484                        dlg.finished(false);
17485
17486                        return Err(match error {
17487                            Ok(value) => common::Error::BadRequest(value),
17488                            _ => common::Error::Failure(response),
17489                        });
17490                    }
17491                    let response = {
17492                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17493                        let encoded = common::to_string(&bytes);
17494                        match serde_json::from_str(&encoded) {
17495                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17496                            Err(error) => {
17497                                dlg.response_json_decode_error(&encoded, &error);
17498                                return Err(common::Error::JsonDecodeError(
17499                                    encoded.to_string(),
17500                                    error,
17501                                ));
17502                            }
17503                        }
17504                    };
17505
17506                    dlg.finished(true);
17507                    return Ok(response);
17508                }
17509            }
17510        }
17511    }
17512
17513    ///
17514    /// Sets the *request* property to the given value.
17515    ///
17516    /// Even though the property as already been set when instantiating this call,
17517    /// we provide this method for API completeness.
17518    pub fn request(
17519        mut self,
17520        new_value: SetNodePoolAutoscalingRequest,
17521    ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
17522        self._request = new_value;
17523        self
17524    }
17525    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
17526    ///
17527    /// Sets the *project id* path property to the given value.
17528    ///
17529    /// Even though the property as already been set when instantiating this call,
17530    /// we provide this method for API completeness.
17531    pub fn project_id(
17532        mut self,
17533        new_value: &str,
17534    ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
17535        self._project_id = new_value.to_string();
17536        self
17537    }
17538    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
17539    ///
17540    /// Sets the *zone* path property to the given value.
17541    ///
17542    /// Even though the property as already been set when instantiating this call,
17543    /// we provide this method for API completeness.
17544    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
17545        self._zone = new_value.to_string();
17546        self
17547    }
17548    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
17549    ///
17550    /// Sets the *cluster id* path property to the given value.
17551    ///
17552    /// Even though the property as already been set when instantiating this call,
17553    /// we provide this method for API completeness.
17554    pub fn cluster_id(
17555        mut self,
17556        new_value: &str,
17557    ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
17558        self._cluster_id = new_value.to_string();
17559        self
17560    }
17561    /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
17562    ///
17563    /// Sets the *node pool id* path property to the given value.
17564    ///
17565    /// Even though the property as already been set when instantiating this call,
17566    /// we provide this method for API completeness.
17567    pub fn node_pool_id(
17568        mut self,
17569        new_value: &str,
17570    ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
17571        self._node_pool_id = new_value.to_string();
17572        self
17573    }
17574    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17575    /// while executing the actual API request.
17576    ///
17577    /// ````text
17578    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17579    /// ````
17580    ///
17581    /// Sets the *delegate* property to the given value.
17582    pub fn delegate(
17583        mut self,
17584        new_value: &'a mut dyn common::Delegate,
17585    ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
17586        self._delegate = Some(new_value);
17587        self
17588    }
17589
17590    /// Set any additional parameter of the query string used in the request.
17591    /// It should be used to set parameters which are not yet available through their own
17592    /// setters.
17593    ///
17594    /// Please note that this method must not be used to set any of the known parameters
17595    /// which have their own setter method. If done anyway, the request will fail.
17596    ///
17597    /// # Additional Parameters
17598    ///
17599    /// * *$.xgafv* (query-string) - V1 error format.
17600    /// * *access_token* (query-string) - OAuth access token.
17601    /// * *alt* (query-string) - Data format for response.
17602    /// * *callback* (query-string) - JSONP
17603    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17604    /// * *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.
17605    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17606    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17607    /// * *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.
17608    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17609    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17610    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
17611    where
17612        T: AsRef<str>,
17613    {
17614        self._additional_params
17615            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17616        self
17617    }
17618
17619    /// Identifies the authorization scope for the method you are building.
17620    ///
17621    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17622    /// [`Scope::CloudPlatform`].
17623    ///
17624    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17625    /// tokens for more than one scope.
17626    ///
17627    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17628    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17629    /// sufficient, a read-write scope will do as well.
17630    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
17631    where
17632        St: AsRef<str>,
17633    {
17634        self._scopes.insert(String::from(scope.as_ref()));
17635        self
17636    }
17637    /// Identifies the authorization scope(s) for the method you are building.
17638    ///
17639    /// See [`Self::add_scope()`] for details.
17640    pub fn add_scopes<I, St>(
17641        mut self,
17642        scopes: I,
17643    ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
17644    where
17645        I: IntoIterator<Item = St>,
17646        St: AsRef<str>,
17647    {
17648        self._scopes
17649            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17650        self
17651    }
17652
17653    /// Removes all scopes, and no default scope will be used either.
17654    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17655    /// for details).
17656    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
17657        self._scopes.clear();
17658        self
17659    }
17660}
17661
17662/// Creates a node pool for a cluster.
17663///
17664/// A builder for the *zones.clusters.nodePools.create* method supported by a *project* resource.
17665/// It is not used directly, but through a [`ProjectMethods`] instance.
17666///
17667/// # Example
17668///
17669/// Instantiate a resource method builder
17670///
17671/// ```test_harness,no_run
17672/// # extern crate hyper;
17673/// # extern crate hyper_rustls;
17674/// # extern crate google_container1 as container1;
17675/// use container1::api::CreateNodePoolRequest;
17676/// # async fn dox() {
17677/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17678///
17679/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17680/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
17681/// #     secret,
17682/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17683/// # ).build().await.unwrap();
17684///
17685/// # let client = hyper_util::client::legacy::Client::builder(
17686/// #     hyper_util::rt::TokioExecutor::new()
17687/// # )
17688/// # .build(
17689/// #     hyper_rustls::HttpsConnectorBuilder::new()
17690/// #         .with_native_roots()
17691/// #         .unwrap()
17692/// #         .https_or_http()
17693/// #         .enable_http1()
17694/// #         .build()
17695/// # );
17696/// # let mut hub = Container::new(client, auth);
17697/// // As the method needs a request, you would usually fill it with the desired information
17698/// // into the respective structure. Some of the parts shown here might not be applicable !
17699/// // Values shown here are possibly random and not representative !
17700/// let mut req = CreateNodePoolRequest::default();
17701///
17702/// // You can configure optional parameters by calling the respective setters at will, and
17703/// // execute the final call using `doit()`.
17704/// // Values shown here are possibly random and not representative !
17705/// let result = hub.projects().zones_clusters_node_pools_create(req, "projectId", "zone", "clusterId")
17706///              .doit().await;
17707/// # }
17708/// ```
17709pub struct ProjectZoneClusterNodePoolCreateCall<'a, C>
17710where
17711    C: 'a,
17712{
17713    hub: &'a Container<C>,
17714    _request: CreateNodePoolRequest,
17715    _project_id: String,
17716    _zone: String,
17717    _cluster_id: String,
17718    _delegate: Option<&'a mut dyn common::Delegate>,
17719    _additional_params: HashMap<String, String>,
17720    _scopes: BTreeSet<String>,
17721}
17722
17723impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolCreateCall<'a, C> {}
17724
17725impl<'a, C> ProjectZoneClusterNodePoolCreateCall<'a, C>
17726where
17727    C: common::Connector,
17728{
17729    /// Perform the operation you have build so far.
17730    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17731        use std::borrow::Cow;
17732        use std::io::{Read, Seek};
17733
17734        use common::{url::Params, ToParts};
17735        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17736
17737        let mut dd = common::DefaultDelegate;
17738        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17739        dlg.begin(common::MethodInfo {
17740            id: "container.projects.zones.clusters.nodePools.create",
17741            http_method: hyper::Method::POST,
17742        });
17743
17744        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
17745            if self._additional_params.contains_key(field) {
17746                dlg.finished(false);
17747                return Err(common::Error::FieldClash(field));
17748            }
17749        }
17750
17751        let mut params = Params::with_capacity(6 + self._additional_params.len());
17752        params.push("projectId", self._project_id);
17753        params.push("zone", self._zone);
17754        params.push("clusterId", self._cluster_id);
17755
17756        params.extend(self._additional_params.iter());
17757
17758        params.push("alt", "json");
17759        let mut url = self.hub._base_url.clone()
17760            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
17761        if self._scopes.is_empty() {
17762            self._scopes
17763                .insert(Scope::CloudPlatform.as_ref().to_string());
17764        }
17765
17766        #[allow(clippy::single_element_loop)]
17767        for &(find_this, param_name) in [
17768            ("{projectId}", "projectId"),
17769            ("{zone}", "zone"),
17770            ("{clusterId}", "clusterId"),
17771        ]
17772        .iter()
17773        {
17774            url = params.uri_replacement(url, param_name, find_this, false);
17775        }
17776        {
17777            let to_remove = ["clusterId", "zone", "projectId"];
17778            params.remove_params(&to_remove);
17779        }
17780
17781        let url = params.parse_with_url(&url);
17782
17783        let mut json_mime_type = mime::APPLICATION_JSON;
17784        let mut request_value_reader = {
17785            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17786            common::remove_json_null_values(&mut value);
17787            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17788            serde_json::to_writer(&mut dst, &value).unwrap();
17789            dst
17790        };
17791        let request_size = request_value_reader
17792            .seek(std::io::SeekFrom::End(0))
17793            .unwrap();
17794        request_value_reader
17795            .seek(std::io::SeekFrom::Start(0))
17796            .unwrap();
17797
17798        loop {
17799            let token = match self
17800                .hub
17801                .auth
17802                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17803                .await
17804            {
17805                Ok(token) => token,
17806                Err(e) => match dlg.token(e) {
17807                    Ok(token) => token,
17808                    Err(e) => {
17809                        dlg.finished(false);
17810                        return Err(common::Error::MissingToken(e));
17811                    }
17812                },
17813            };
17814            request_value_reader
17815                .seek(std::io::SeekFrom::Start(0))
17816                .unwrap();
17817            let mut req_result = {
17818                let client = &self.hub.client;
17819                dlg.pre_request();
17820                let mut req_builder = hyper::Request::builder()
17821                    .method(hyper::Method::POST)
17822                    .uri(url.as_str())
17823                    .header(USER_AGENT, self.hub._user_agent.clone());
17824
17825                if let Some(token) = token.as_ref() {
17826                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17827                }
17828
17829                let request = req_builder
17830                    .header(CONTENT_TYPE, json_mime_type.to_string())
17831                    .header(CONTENT_LENGTH, request_size as u64)
17832                    .body(common::to_body(
17833                        request_value_reader.get_ref().clone().into(),
17834                    ));
17835
17836                client.request(request.unwrap()).await
17837            };
17838
17839            match req_result {
17840                Err(err) => {
17841                    if let common::Retry::After(d) = dlg.http_error(&err) {
17842                        sleep(d).await;
17843                        continue;
17844                    }
17845                    dlg.finished(false);
17846                    return Err(common::Error::HttpError(err));
17847                }
17848                Ok(res) => {
17849                    let (mut parts, body) = res.into_parts();
17850                    let mut body = common::Body::new(body);
17851                    if !parts.status.is_success() {
17852                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17853                        let error = serde_json::from_str(&common::to_string(&bytes));
17854                        let response = common::to_response(parts, bytes.into());
17855
17856                        if let common::Retry::After(d) =
17857                            dlg.http_failure(&response, error.as_ref().ok())
17858                        {
17859                            sleep(d).await;
17860                            continue;
17861                        }
17862
17863                        dlg.finished(false);
17864
17865                        return Err(match error {
17866                            Ok(value) => common::Error::BadRequest(value),
17867                            _ => common::Error::Failure(response),
17868                        });
17869                    }
17870                    let response = {
17871                        let bytes = common::to_bytes(body).await.unwrap_or_default();
17872                        let encoded = common::to_string(&bytes);
17873                        match serde_json::from_str(&encoded) {
17874                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17875                            Err(error) => {
17876                                dlg.response_json_decode_error(&encoded, &error);
17877                                return Err(common::Error::JsonDecodeError(
17878                                    encoded.to_string(),
17879                                    error,
17880                                ));
17881                            }
17882                        }
17883                    };
17884
17885                    dlg.finished(true);
17886                    return Ok(response);
17887                }
17888            }
17889        }
17890    }
17891
17892    ///
17893    /// Sets the *request* property to the given value.
17894    ///
17895    /// Even though the property as already been set when instantiating this call,
17896    /// we provide this method for API completeness.
17897    pub fn request(
17898        mut self,
17899        new_value: CreateNodePoolRequest,
17900    ) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
17901        self._request = new_value;
17902        self
17903    }
17904    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
17905    ///
17906    /// Sets the *project id* path property to the given value.
17907    ///
17908    /// Even though the property as already been set when instantiating this call,
17909    /// we provide this method for API completeness.
17910    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
17911        self._project_id = new_value.to_string();
17912        self
17913    }
17914    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
17915    ///
17916    /// Sets the *zone* path property to the given value.
17917    ///
17918    /// Even though the property as already been set when instantiating this call,
17919    /// we provide this method for API completeness.
17920    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
17921        self._zone = new_value.to_string();
17922        self
17923    }
17924    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
17925    ///
17926    /// Sets the *cluster id* path property to the given value.
17927    ///
17928    /// Even though the property as already been set when instantiating this call,
17929    /// we provide this method for API completeness.
17930    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
17931        self._cluster_id = new_value.to_string();
17932        self
17933    }
17934    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17935    /// while executing the actual API request.
17936    ///
17937    /// ````text
17938    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
17939    /// ````
17940    ///
17941    /// Sets the *delegate* property to the given value.
17942    pub fn delegate(
17943        mut self,
17944        new_value: &'a mut dyn common::Delegate,
17945    ) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
17946        self._delegate = Some(new_value);
17947        self
17948    }
17949
17950    /// Set any additional parameter of the query string used in the request.
17951    /// It should be used to set parameters which are not yet available through their own
17952    /// setters.
17953    ///
17954    /// Please note that this method must not be used to set any of the known parameters
17955    /// which have their own setter method. If done anyway, the request will fail.
17956    ///
17957    /// # Additional Parameters
17958    ///
17959    /// * *$.xgafv* (query-string) - V1 error format.
17960    /// * *access_token* (query-string) - OAuth access token.
17961    /// * *alt* (query-string) - Data format for response.
17962    /// * *callback* (query-string) - JSONP
17963    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17964    /// * *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.
17965    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17966    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17967    /// * *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.
17968    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17969    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17970    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
17971    where
17972        T: AsRef<str>,
17973    {
17974        self._additional_params
17975            .insert(name.as_ref().to_string(), value.as_ref().to_string());
17976        self
17977    }
17978
17979    /// Identifies the authorization scope for the method you are building.
17980    ///
17981    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17982    /// [`Scope::CloudPlatform`].
17983    ///
17984    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17985    /// tokens for more than one scope.
17986    ///
17987    /// Usually there is more than one suitable scope to authorize an operation, some of which may
17988    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17989    /// sufficient, a read-write scope will do as well.
17990    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
17991    where
17992        St: AsRef<str>,
17993    {
17994        self._scopes.insert(String::from(scope.as_ref()));
17995        self
17996    }
17997    /// Identifies the authorization scope(s) for the method you are building.
17998    ///
17999    /// See [`Self::add_scope()`] for details.
18000    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
18001    where
18002        I: IntoIterator<Item = St>,
18003        St: AsRef<str>,
18004    {
18005        self._scopes
18006            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18007        self
18008    }
18009
18010    /// Removes all scopes, and no default scope will be used either.
18011    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18012    /// for details).
18013    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
18014        self._scopes.clear();
18015        self
18016    }
18017}
18018
18019/// Deletes a node pool from a cluster.
18020///
18021/// A builder for the *zones.clusters.nodePools.delete* method supported by a *project* resource.
18022/// It is not used directly, but through a [`ProjectMethods`] instance.
18023///
18024/// # Example
18025///
18026/// Instantiate a resource method builder
18027///
18028/// ```test_harness,no_run
18029/// # extern crate hyper;
18030/// # extern crate hyper_rustls;
18031/// # extern crate google_container1 as container1;
18032/// # async fn dox() {
18033/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18034///
18035/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18036/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18037/// #     secret,
18038/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18039/// # ).build().await.unwrap();
18040///
18041/// # let client = hyper_util::client::legacy::Client::builder(
18042/// #     hyper_util::rt::TokioExecutor::new()
18043/// # )
18044/// # .build(
18045/// #     hyper_rustls::HttpsConnectorBuilder::new()
18046/// #         .with_native_roots()
18047/// #         .unwrap()
18048/// #         .https_or_http()
18049/// #         .enable_http1()
18050/// #         .build()
18051/// # );
18052/// # let mut hub = Container::new(client, auth);
18053/// // You can configure optional parameters by calling the respective setters at will, and
18054/// // execute the final call using `doit()`.
18055/// // Values shown here are possibly random and not representative !
18056/// let result = hub.projects().zones_clusters_node_pools_delete("projectId", "zone", "clusterId", "nodePoolId")
18057///              .name("dolore")
18058///              .doit().await;
18059/// # }
18060/// ```
18061pub struct ProjectZoneClusterNodePoolDeleteCall<'a, C>
18062where
18063    C: 'a,
18064{
18065    hub: &'a Container<C>,
18066    _project_id: String,
18067    _zone: String,
18068    _cluster_id: String,
18069    _node_pool_id: String,
18070    _name: Option<String>,
18071    _delegate: Option<&'a mut dyn common::Delegate>,
18072    _additional_params: HashMap<String, String>,
18073    _scopes: BTreeSet<String>,
18074}
18075
18076impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolDeleteCall<'a, C> {}
18077
18078impl<'a, C> ProjectZoneClusterNodePoolDeleteCall<'a, C>
18079where
18080    C: common::Connector,
18081{
18082    /// Perform the operation you have build so far.
18083    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18084        use std::borrow::Cow;
18085        use std::io::{Read, Seek};
18086
18087        use common::{url::Params, ToParts};
18088        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18089
18090        let mut dd = common::DefaultDelegate;
18091        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18092        dlg.begin(common::MethodInfo {
18093            id: "container.projects.zones.clusters.nodePools.delete",
18094            http_method: hyper::Method::DELETE,
18095        });
18096
18097        for &field in [
18098            "alt",
18099            "projectId",
18100            "zone",
18101            "clusterId",
18102            "nodePoolId",
18103            "name",
18104        ]
18105        .iter()
18106        {
18107            if self._additional_params.contains_key(field) {
18108                dlg.finished(false);
18109                return Err(common::Error::FieldClash(field));
18110            }
18111        }
18112
18113        let mut params = Params::with_capacity(7 + self._additional_params.len());
18114        params.push("projectId", self._project_id);
18115        params.push("zone", self._zone);
18116        params.push("clusterId", self._cluster_id);
18117        params.push("nodePoolId", self._node_pool_id);
18118        if let Some(value) = self._name.as_ref() {
18119            params.push("name", value);
18120        }
18121
18122        params.extend(self._additional_params.iter());
18123
18124        params.push("alt", "json");
18125        let mut url = self.hub._base_url.clone()
18126            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
18127        if self._scopes.is_empty() {
18128            self._scopes
18129                .insert(Scope::CloudPlatform.as_ref().to_string());
18130        }
18131
18132        #[allow(clippy::single_element_loop)]
18133        for &(find_this, param_name) in [
18134            ("{projectId}", "projectId"),
18135            ("{zone}", "zone"),
18136            ("{clusterId}", "clusterId"),
18137            ("{nodePoolId}", "nodePoolId"),
18138        ]
18139        .iter()
18140        {
18141            url = params.uri_replacement(url, param_name, find_this, false);
18142        }
18143        {
18144            let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
18145            params.remove_params(&to_remove);
18146        }
18147
18148        let url = params.parse_with_url(&url);
18149
18150        loop {
18151            let token = match self
18152                .hub
18153                .auth
18154                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18155                .await
18156            {
18157                Ok(token) => token,
18158                Err(e) => match dlg.token(e) {
18159                    Ok(token) => token,
18160                    Err(e) => {
18161                        dlg.finished(false);
18162                        return Err(common::Error::MissingToken(e));
18163                    }
18164                },
18165            };
18166            let mut req_result = {
18167                let client = &self.hub.client;
18168                dlg.pre_request();
18169                let mut req_builder = hyper::Request::builder()
18170                    .method(hyper::Method::DELETE)
18171                    .uri(url.as_str())
18172                    .header(USER_AGENT, self.hub._user_agent.clone());
18173
18174                if let Some(token) = token.as_ref() {
18175                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18176                }
18177
18178                let request = req_builder
18179                    .header(CONTENT_LENGTH, 0_u64)
18180                    .body(common::to_body::<String>(None));
18181
18182                client.request(request.unwrap()).await
18183            };
18184
18185            match req_result {
18186                Err(err) => {
18187                    if let common::Retry::After(d) = dlg.http_error(&err) {
18188                        sleep(d).await;
18189                        continue;
18190                    }
18191                    dlg.finished(false);
18192                    return Err(common::Error::HttpError(err));
18193                }
18194                Ok(res) => {
18195                    let (mut parts, body) = res.into_parts();
18196                    let mut body = common::Body::new(body);
18197                    if !parts.status.is_success() {
18198                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18199                        let error = serde_json::from_str(&common::to_string(&bytes));
18200                        let response = common::to_response(parts, bytes.into());
18201
18202                        if let common::Retry::After(d) =
18203                            dlg.http_failure(&response, error.as_ref().ok())
18204                        {
18205                            sleep(d).await;
18206                            continue;
18207                        }
18208
18209                        dlg.finished(false);
18210
18211                        return Err(match error {
18212                            Ok(value) => common::Error::BadRequest(value),
18213                            _ => common::Error::Failure(response),
18214                        });
18215                    }
18216                    let response = {
18217                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18218                        let encoded = common::to_string(&bytes);
18219                        match serde_json::from_str(&encoded) {
18220                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18221                            Err(error) => {
18222                                dlg.response_json_decode_error(&encoded, &error);
18223                                return Err(common::Error::JsonDecodeError(
18224                                    encoded.to_string(),
18225                                    error,
18226                                ));
18227                            }
18228                        }
18229                    };
18230
18231                    dlg.finished(true);
18232                    return Ok(response);
18233                }
18234            }
18235        }
18236    }
18237
18238    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
18239    ///
18240    /// Sets the *project id* path property to the given value.
18241    ///
18242    /// Even though the property as already been set when instantiating this call,
18243    /// we provide this method for API completeness.
18244    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
18245        self._project_id = new_value.to_string();
18246        self
18247    }
18248    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
18249    ///
18250    /// Sets the *zone* path property to the given value.
18251    ///
18252    /// Even though the property as already been set when instantiating this call,
18253    /// we provide this method for API completeness.
18254    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
18255        self._zone = new_value.to_string();
18256        self
18257    }
18258    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
18259    ///
18260    /// Sets the *cluster id* path property to the given value.
18261    ///
18262    /// Even though the property as already been set when instantiating this call,
18263    /// we provide this method for API completeness.
18264    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
18265        self._cluster_id = new_value.to_string();
18266        self
18267    }
18268    /// Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
18269    ///
18270    /// Sets the *node pool id* path property to the given value.
18271    ///
18272    /// Even though the property as already been set when instantiating this call,
18273    /// we provide this method for API completeness.
18274    pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
18275        self._node_pool_id = new_value.to_string();
18276        self
18277    }
18278    /// The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
18279    ///
18280    /// Sets the *name* query property to the given value.
18281    pub fn name(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
18282        self._name = Some(new_value.to_string());
18283        self
18284    }
18285    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18286    /// while executing the actual API request.
18287    ///
18288    /// ````text
18289    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18290    /// ````
18291    ///
18292    /// Sets the *delegate* property to the given value.
18293    pub fn delegate(
18294        mut self,
18295        new_value: &'a mut dyn common::Delegate,
18296    ) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
18297        self._delegate = Some(new_value);
18298        self
18299    }
18300
18301    /// Set any additional parameter of the query string used in the request.
18302    /// It should be used to set parameters which are not yet available through their own
18303    /// setters.
18304    ///
18305    /// Please note that this method must not be used to set any of the known parameters
18306    /// which have their own setter method. If done anyway, the request will fail.
18307    ///
18308    /// # Additional Parameters
18309    ///
18310    /// * *$.xgafv* (query-string) - V1 error format.
18311    /// * *access_token* (query-string) - OAuth access token.
18312    /// * *alt* (query-string) - Data format for response.
18313    /// * *callback* (query-string) - JSONP
18314    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18315    /// * *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.
18316    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18317    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18318    /// * *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.
18319    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18320    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18321    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
18322    where
18323        T: AsRef<str>,
18324    {
18325        self._additional_params
18326            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18327        self
18328    }
18329
18330    /// Identifies the authorization scope for the method you are building.
18331    ///
18332    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18333    /// [`Scope::CloudPlatform`].
18334    ///
18335    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18336    /// tokens for more than one scope.
18337    ///
18338    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18339    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18340    /// sufficient, a read-write scope will do as well.
18341    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
18342    where
18343        St: AsRef<str>,
18344    {
18345        self._scopes.insert(String::from(scope.as_ref()));
18346        self
18347    }
18348    /// Identifies the authorization scope(s) for the method you are building.
18349    ///
18350    /// See [`Self::add_scope()`] for details.
18351    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
18352    where
18353        I: IntoIterator<Item = St>,
18354        St: AsRef<str>,
18355    {
18356        self._scopes
18357            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18358        self
18359    }
18360
18361    /// Removes all scopes, and no default scope will be used either.
18362    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18363    /// for details).
18364    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
18365        self._scopes.clear();
18366        self
18367    }
18368}
18369
18370/// Retrieves the requested node pool.
18371///
18372/// A builder for the *zones.clusters.nodePools.get* method supported by a *project* resource.
18373/// It is not used directly, but through a [`ProjectMethods`] instance.
18374///
18375/// # Example
18376///
18377/// Instantiate a resource method builder
18378///
18379/// ```test_harness,no_run
18380/// # extern crate hyper;
18381/// # extern crate hyper_rustls;
18382/// # extern crate google_container1 as container1;
18383/// # async fn dox() {
18384/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18385///
18386/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18387/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18388/// #     secret,
18389/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18390/// # ).build().await.unwrap();
18391///
18392/// # let client = hyper_util::client::legacy::Client::builder(
18393/// #     hyper_util::rt::TokioExecutor::new()
18394/// # )
18395/// # .build(
18396/// #     hyper_rustls::HttpsConnectorBuilder::new()
18397/// #         .with_native_roots()
18398/// #         .unwrap()
18399/// #         .https_or_http()
18400/// #         .enable_http1()
18401/// #         .build()
18402/// # );
18403/// # let mut hub = Container::new(client, auth);
18404/// // You can configure optional parameters by calling the respective setters at will, and
18405/// // execute the final call using `doit()`.
18406/// // Values shown here are possibly random and not representative !
18407/// let result = hub.projects().zones_clusters_node_pools_get("projectId", "zone", "clusterId", "nodePoolId")
18408///              .name("ea")
18409///              .doit().await;
18410/// # }
18411/// ```
18412pub struct ProjectZoneClusterNodePoolGetCall<'a, C>
18413where
18414    C: 'a,
18415{
18416    hub: &'a Container<C>,
18417    _project_id: String,
18418    _zone: String,
18419    _cluster_id: String,
18420    _node_pool_id: String,
18421    _name: Option<String>,
18422    _delegate: Option<&'a mut dyn common::Delegate>,
18423    _additional_params: HashMap<String, String>,
18424    _scopes: BTreeSet<String>,
18425}
18426
18427impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolGetCall<'a, C> {}
18428
18429impl<'a, C> ProjectZoneClusterNodePoolGetCall<'a, C>
18430where
18431    C: common::Connector,
18432{
18433    /// Perform the operation you have build so far.
18434    pub async fn doit(mut self) -> common::Result<(common::Response, NodePool)> {
18435        use std::borrow::Cow;
18436        use std::io::{Read, Seek};
18437
18438        use common::{url::Params, ToParts};
18439        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18440
18441        let mut dd = common::DefaultDelegate;
18442        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18443        dlg.begin(common::MethodInfo {
18444            id: "container.projects.zones.clusters.nodePools.get",
18445            http_method: hyper::Method::GET,
18446        });
18447
18448        for &field in [
18449            "alt",
18450            "projectId",
18451            "zone",
18452            "clusterId",
18453            "nodePoolId",
18454            "name",
18455        ]
18456        .iter()
18457        {
18458            if self._additional_params.contains_key(field) {
18459                dlg.finished(false);
18460                return Err(common::Error::FieldClash(field));
18461            }
18462        }
18463
18464        let mut params = Params::with_capacity(7 + self._additional_params.len());
18465        params.push("projectId", self._project_id);
18466        params.push("zone", self._zone);
18467        params.push("clusterId", self._cluster_id);
18468        params.push("nodePoolId", self._node_pool_id);
18469        if let Some(value) = self._name.as_ref() {
18470            params.push("name", value);
18471        }
18472
18473        params.extend(self._additional_params.iter());
18474
18475        params.push("alt", "json");
18476        let mut url = self.hub._base_url.clone()
18477            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
18478        if self._scopes.is_empty() {
18479            self._scopes
18480                .insert(Scope::CloudPlatform.as_ref().to_string());
18481        }
18482
18483        #[allow(clippy::single_element_loop)]
18484        for &(find_this, param_name) in [
18485            ("{projectId}", "projectId"),
18486            ("{zone}", "zone"),
18487            ("{clusterId}", "clusterId"),
18488            ("{nodePoolId}", "nodePoolId"),
18489        ]
18490        .iter()
18491        {
18492            url = params.uri_replacement(url, param_name, find_this, false);
18493        }
18494        {
18495            let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
18496            params.remove_params(&to_remove);
18497        }
18498
18499        let url = params.parse_with_url(&url);
18500
18501        loop {
18502            let token = match self
18503                .hub
18504                .auth
18505                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18506                .await
18507            {
18508                Ok(token) => token,
18509                Err(e) => match dlg.token(e) {
18510                    Ok(token) => token,
18511                    Err(e) => {
18512                        dlg.finished(false);
18513                        return Err(common::Error::MissingToken(e));
18514                    }
18515                },
18516            };
18517            let mut req_result = {
18518                let client = &self.hub.client;
18519                dlg.pre_request();
18520                let mut req_builder = hyper::Request::builder()
18521                    .method(hyper::Method::GET)
18522                    .uri(url.as_str())
18523                    .header(USER_AGENT, self.hub._user_agent.clone());
18524
18525                if let Some(token) = token.as_ref() {
18526                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18527                }
18528
18529                let request = req_builder
18530                    .header(CONTENT_LENGTH, 0_u64)
18531                    .body(common::to_body::<String>(None));
18532
18533                client.request(request.unwrap()).await
18534            };
18535
18536            match req_result {
18537                Err(err) => {
18538                    if let common::Retry::After(d) = dlg.http_error(&err) {
18539                        sleep(d).await;
18540                        continue;
18541                    }
18542                    dlg.finished(false);
18543                    return Err(common::Error::HttpError(err));
18544                }
18545                Ok(res) => {
18546                    let (mut parts, body) = res.into_parts();
18547                    let mut body = common::Body::new(body);
18548                    if !parts.status.is_success() {
18549                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18550                        let error = serde_json::from_str(&common::to_string(&bytes));
18551                        let response = common::to_response(parts, bytes.into());
18552
18553                        if let common::Retry::After(d) =
18554                            dlg.http_failure(&response, error.as_ref().ok())
18555                        {
18556                            sleep(d).await;
18557                            continue;
18558                        }
18559
18560                        dlg.finished(false);
18561
18562                        return Err(match error {
18563                            Ok(value) => common::Error::BadRequest(value),
18564                            _ => common::Error::Failure(response),
18565                        });
18566                    }
18567                    let response = {
18568                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18569                        let encoded = common::to_string(&bytes);
18570                        match serde_json::from_str(&encoded) {
18571                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18572                            Err(error) => {
18573                                dlg.response_json_decode_error(&encoded, &error);
18574                                return Err(common::Error::JsonDecodeError(
18575                                    encoded.to_string(),
18576                                    error,
18577                                ));
18578                            }
18579                        }
18580                    };
18581
18582                    dlg.finished(true);
18583                    return Ok(response);
18584                }
18585            }
18586        }
18587    }
18588
18589    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
18590    ///
18591    /// Sets the *project id* path property to the given value.
18592    ///
18593    /// Even though the property as already been set when instantiating this call,
18594    /// we provide this method for API completeness.
18595    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
18596        self._project_id = new_value.to_string();
18597        self
18598    }
18599    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
18600    ///
18601    /// Sets the *zone* path property to the given value.
18602    ///
18603    /// Even though the property as already been set when instantiating this call,
18604    /// we provide this method for API completeness.
18605    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
18606        self._zone = new_value.to_string();
18607        self
18608    }
18609    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
18610    ///
18611    /// Sets the *cluster id* path property to the given value.
18612    ///
18613    /// Even though the property as already been set when instantiating this call,
18614    /// we provide this method for API completeness.
18615    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
18616        self._cluster_id = new_value.to_string();
18617        self
18618    }
18619    /// Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
18620    ///
18621    /// Sets the *node pool id* path property to the given value.
18622    ///
18623    /// Even though the property as already been set when instantiating this call,
18624    /// we provide this method for API completeness.
18625    pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
18626        self._node_pool_id = new_value.to_string();
18627        self
18628    }
18629    /// The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
18630    ///
18631    /// Sets the *name* query property to the given value.
18632    pub fn name(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
18633        self._name = Some(new_value.to_string());
18634        self
18635    }
18636    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18637    /// while executing the actual API request.
18638    ///
18639    /// ````text
18640    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18641    /// ````
18642    ///
18643    /// Sets the *delegate* property to the given value.
18644    pub fn delegate(
18645        mut self,
18646        new_value: &'a mut dyn common::Delegate,
18647    ) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
18648        self._delegate = Some(new_value);
18649        self
18650    }
18651
18652    /// Set any additional parameter of the query string used in the request.
18653    /// It should be used to set parameters which are not yet available through their own
18654    /// setters.
18655    ///
18656    /// Please note that this method must not be used to set any of the known parameters
18657    /// which have their own setter method. If done anyway, the request will fail.
18658    ///
18659    /// # Additional Parameters
18660    ///
18661    /// * *$.xgafv* (query-string) - V1 error format.
18662    /// * *access_token* (query-string) - OAuth access token.
18663    /// * *alt* (query-string) - Data format for response.
18664    /// * *callback* (query-string) - JSONP
18665    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18666    /// * *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.
18667    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18668    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18669    /// * *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.
18670    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18671    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18672    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolGetCall<'a, C>
18673    where
18674        T: AsRef<str>,
18675    {
18676        self._additional_params
18677            .insert(name.as_ref().to_string(), value.as_ref().to_string());
18678        self
18679    }
18680
18681    /// Identifies the authorization scope for the method you are building.
18682    ///
18683    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18684    /// [`Scope::CloudPlatform`].
18685    ///
18686    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18687    /// tokens for more than one scope.
18688    ///
18689    /// Usually there is more than one suitable scope to authorize an operation, some of which may
18690    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18691    /// sufficient, a read-write scope will do as well.
18692    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolGetCall<'a, C>
18693    where
18694        St: AsRef<str>,
18695    {
18696        self._scopes.insert(String::from(scope.as_ref()));
18697        self
18698    }
18699    /// Identifies the authorization scope(s) for the method you are building.
18700    ///
18701    /// See [`Self::add_scope()`] for details.
18702    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolGetCall<'a, C>
18703    where
18704        I: IntoIterator<Item = St>,
18705        St: AsRef<str>,
18706    {
18707        self._scopes
18708            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18709        self
18710    }
18711
18712    /// Removes all scopes, and no default scope will be used either.
18713    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18714    /// for details).
18715    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
18716        self._scopes.clear();
18717        self
18718    }
18719}
18720
18721/// Lists the node pools for a cluster.
18722///
18723/// A builder for the *zones.clusters.nodePools.list* method supported by a *project* resource.
18724/// It is not used directly, but through a [`ProjectMethods`] instance.
18725///
18726/// # Example
18727///
18728/// Instantiate a resource method builder
18729///
18730/// ```test_harness,no_run
18731/// # extern crate hyper;
18732/// # extern crate hyper_rustls;
18733/// # extern crate google_container1 as container1;
18734/// # async fn dox() {
18735/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18736///
18737/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18738/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
18739/// #     secret,
18740/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18741/// # ).build().await.unwrap();
18742///
18743/// # let client = hyper_util::client::legacy::Client::builder(
18744/// #     hyper_util::rt::TokioExecutor::new()
18745/// # )
18746/// # .build(
18747/// #     hyper_rustls::HttpsConnectorBuilder::new()
18748/// #         .with_native_roots()
18749/// #         .unwrap()
18750/// #         .https_or_http()
18751/// #         .enable_http1()
18752/// #         .build()
18753/// # );
18754/// # let mut hub = Container::new(client, auth);
18755/// // You can configure optional parameters by calling the respective setters at will, and
18756/// // execute the final call using `doit()`.
18757/// // Values shown here are possibly random and not representative !
18758/// let result = hub.projects().zones_clusters_node_pools_list("projectId", "zone", "clusterId")
18759///              .parent("no")
18760///              .doit().await;
18761/// # }
18762/// ```
18763pub struct ProjectZoneClusterNodePoolListCall<'a, C>
18764where
18765    C: 'a,
18766{
18767    hub: &'a Container<C>,
18768    _project_id: String,
18769    _zone: String,
18770    _cluster_id: String,
18771    _parent: Option<String>,
18772    _delegate: Option<&'a mut dyn common::Delegate>,
18773    _additional_params: HashMap<String, String>,
18774    _scopes: BTreeSet<String>,
18775}
18776
18777impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolListCall<'a, C> {}
18778
18779impl<'a, C> ProjectZoneClusterNodePoolListCall<'a, C>
18780where
18781    C: common::Connector,
18782{
18783    /// Perform the operation you have build so far.
18784    pub async fn doit(mut self) -> common::Result<(common::Response, ListNodePoolsResponse)> {
18785        use std::borrow::Cow;
18786        use std::io::{Read, Seek};
18787
18788        use common::{url::Params, ToParts};
18789        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18790
18791        let mut dd = common::DefaultDelegate;
18792        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18793        dlg.begin(common::MethodInfo {
18794            id: "container.projects.zones.clusters.nodePools.list",
18795            http_method: hyper::Method::GET,
18796        });
18797
18798        for &field in ["alt", "projectId", "zone", "clusterId", "parent"].iter() {
18799            if self._additional_params.contains_key(field) {
18800                dlg.finished(false);
18801                return Err(common::Error::FieldClash(field));
18802            }
18803        }
18804
18805        let mut params = Params::with_capacity(6 + self._additional_params.len());
18806        params.push("projectId", self._project_id);
18807        params.push("zone", self._zone);
18808        params.push("clusterId", self._cluster_id);
18809        if let Some(value) = self._parent.as_ref() {
18810            params.push("parent", value);
18811        }
18812
18813        params.extend(self._additional_params.iter());
18814
18815        params.push("alt", "json");
18816        let mut url = self.hub._base_url.clone()
18817            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
18818        if self._scopes.is_empty() {
18819            self._scopes
18820                .insert(Scope::CloudPlatform.as_ref().to_string());
18821        }
18822
18823        #[allow(clippy::single_element_loop)]
18824        for &(find_this, param_name) in [
18825            ("{projectId}", "projectId"),
18826            ("{zone}", "zone"),
18827            ("{clusterId}", "clusterId"),
18828        ]
18829        .iter()
18830        {
18831            url = params.uri_replacement(url, param_name, find_this, false);
18832        }
18833        {
18834            let to_remove = ["clusterId", "zone", "projectId"];
18835            params.remove_params(&to_remove);
18836        }
18837
18838        let url = params.parse_with_url(&url);
18839
18840        loop {
18841            let token = match self
18842                .hub
18843                .auth
18844                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18845                .await
18846            {
18847                Ok(token) => token,
18848                Err(e) => match dlg.token(e) {
18849                    Ok(token) => token,
18850                    Err(e) => {
18851                        dlg.finished(false);
18852                        return Err(common::Error::MissingToken(e));
18853                    }
18854                },
18855            };
18856            let mut req_result = {
18857                let client = &self.hub.client;
18858                dlg.pre_request();
18859                let mut req_builder = hyper::Request::builder()
18860                    .method(hyper::Method::GET)
18861                    .uri(url.as_str())
18862                    .header(USER_AGENT, self.hub._user_agent.clone());
18863
18864                if let Some(token) = token.as_ref() {
18865                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18866                }
18867
18868                let request = req_builder
18869                    .header(CONTENT_LENGTH, 0_u64)
18870                    .body(common::to_body::<String>(None));
18871
18872                client.request(request.unwrap()).await
18873            };
18874
18875            match req_result {
18876                Err(err) => {
18877                    if let common::Retry::After(d) = dlg.http_error(&err) {
18878                        sleep(d).await;
18879                        continue;
18880                    }
18881                    dlg.finished(false);
18882                    return Err(common::Error::HttpError(err));
18883                }
18884                Ok(res) => {
18885                    let (mut parts, body) = res.into_parts();
18886                    let mut body = common::Body::new(body);
18887                    if !parts.status.is_success() {
18888                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18889                        let error = serde_json::from_str(&common::to_string(&bytes));
18890                        let response = common::to_response(parts, bytes.into());
18891
18892                        if let common::Retry::After(d) =
18893                            dlg.http_failure(&response, error.as_ref().ok())
18894                        {
18895                            sleep(d).await;
18896                            continue;
18897                        }
18898
18899                        dlg.finished(false);
18900
18901                        return Err(match error {
18902                            Ok(value) => common::Error::BadRequest(value),
18903                            _ => common::Error::Failure(response),
18904                        });
18905                    }
18906                    let response = {
18907                        let bytes = common::to_bytes(body).await.unwrap_or_default();
18908                        let encoded = common::to_string(&bytes);
18909                        match serde_json::from_str(&encoded) {
18910                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18911                            Err(error) => {
18912                                dlg.response_json_decode_error(&encoded, &error);
18913                                return Err(common::Error::JsonDecodeError(
18914                                    encoded.to_string(),
18915                                    error,
18916                                ));
18917                            }
18918                        }
18919                    };
18920
18921                    dlg.finished(true);
18922                    return Ok(response);
18923                }
18924            }
18925        }
18926    }
18927
18928    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
18929    ///
18930    /// Sets the *project id* path property to the given value.
18931    ///
18932    /// Even though the property as already been set when instantiating this call,
18933    /// we provide this method for API completeness.
18934    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
18935        self._project_id = new_value.to_string();
18936        self
18937    }
18938    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
18939    ///
18940    /// Sets the *zone* path property to the given value.
18941    ///
18942    /// Even though the property as already been set when instantiating this call,
18943    /// we provide this method for API completeness.
18944    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
18945        self._zone = new_value.to_string();
18946        self
18947    }
18948    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
18949    ///
18950    /// Sets the *cluster id* path property to the given value.
18951    ///
18952    /// Even though the property as already been set when instantiating this call,
18953    /// we provide this method for API completeness.
18954    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
18955        self._cluster_id = new_value.to_string();
18956        self
18957    }
18958    /// The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
18959    ///
18960    /// Sets the *parent* query property to the given value.
18961    pub fn parent(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
18962        self._parent = Some(new_value.to_string());
18963        self
18964    }
18965    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18966    /// while executing the actual API request.
18967    ///
18968    /// ````text
18969    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
18970    /// ````
18971    ///
18972    /// Sets the *delegate* property to the given value.
18973    pub fn delegate(
18974        mut self,
18975        new_value: &'a mut dyn common::Delegate,
18976    ) -> ProjectZoneClusterNodePoolListCall<'a, C> {
18977        self._delegate = Some(new_value);
18978        self
18979    }
18980
18981    /// Set any additional parameter of the query string used in the request.
18982    /// It should be used to set parameters which are not yet available through their own
18983    /// setters.
18984    ///
18985    /// Please note that this method must not be used to set any of the known parameters
18986    /// which have their own setter method. If done anyway, the request will fail.
18987    ///
18988    /// # Additional Parameters
18989    ///
18990    /// * *$.xgafv* (query-string) - V1 error format.
18991    /// * *access_token* (query-string) - OAuth access token.
18992    /// * *alt* (query-string) - Data format for response.
18993    /// * *callback* (query-string) - JSONP
18994    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18995    /// * *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.
18996    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18997    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18998    /// * *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.
18999    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19000    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19001    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolListCall<'a, C>
19002    where
19003        T: AsRef<str>,
19004    {
19005        self._additional_params
19006            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19007        self
19008    }
19009
19010    /// Identifies the authorization scope for the method you are building.
19011    ///
19012    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19013    /// [`Scope::CloudPlatform`].
19014    ///
19015    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19016    /// tokens for more than one scope.
19017    ///
19018    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19019    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19020    /// sufficient, a read-write scope will do as well.
19021    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolListCall<'a, C>
19022    where
19023        St: AsRef<str>,
19024    {
19025        self._scopes.insert(String::from(scope.as_ref()));
19026        self
19027    }
19028    /// Identifies the authorization scope(s) for the method you are building.
19029    ///
19030    /// See [`Self::add_scope()`] for details.
19031    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolListCall<'a, C>
19032    where
19033        I: IntoIterator<Item = St>,
19034        St: AsRef<str>,
19035    {
19036        self._scopes
19037            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19038        self
19039    }
19040
19041    /// Removes all scopes, and no default scope will be used either.
19042    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19043    /// for details).
19044    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolListCall<'a, C> {
19045        self._scopes.clear();
19046        self
19047    }
19048}
19049
19050/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
19051///
19052/// A builder for the *zones.clusters.nodePools.rollback* method supported by a *project* resource.
19053/// It is not used directly, but through a [`ProjectMethods`] instance.
19054///
19055/// # Example
19056///
19057/// Instantiate a resource method builder
19058///
19059/// ```test_harness,no_run
19060/// # extern crate hyper;
19061/// # extern crate hyper_rustls;
19062/// # extern crate google_container1 as container1;
19063/// use container1::api::RollbackNodePoolUpgradeRequest;
19064/// # async fn dox() {
19065/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19066///
19067/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19068/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19069/// #     secret,
19070/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19071/// # ).build().await.unwrap();
19072///
19073/// # let client = hyper_util::client::legacy::Client::builder(
19074/// #     hyper_util::rt::TokioExecutor::new()
19075/// # )
19076/// # .build(
19077/// #     hyper_rustls::HttpsConnectorBuilder::new()
19078/// #         .with_native_roots()
19079/// #         .unwrap()
19080/// #         .https_or_http()
19081/// #         .enable_http1()
19082/// #         .build()
19083/// # );
19084/// # let mut hub = Container::new(client, auth);
19085/// // As the method needs a request, you would usually fill it with the desired information
19086/// // into the respective structure. Some of the parts shown here might not be applicable !
19087/// // Values shown here are possibly random and not representative !
19088/// let mut req = RollbackNodePoolUpgradeRequest::default();
19089///
19090/// // You can configure optional parameters by calling the respective setters at will, and
19091/// // execute the final call using `doit()`.
19092/// // Values shown here are possibly random and not representative !
19093/// let result = hub.projects().zones_clusters_node_pools_rollback(req, "projectId", "zone", "clusterId", "nodePoolId")
19094///              .doit().await;
19095/// # }
19096/// ```
19097pub struct ProjectZoneClusterNodePoolRollbackCall<'a, C>
19098where
19099    C: 'a,
19100{
19101    hub: &'a Container<C>,
19102    _request: RollbackNodePoolUpgradeRequest,
19103    _project_id: String,
19104    _zone: String,
19105    _cluster_id: String,
19106    _node_pool_id: String,
19107    _delegate: Option<&'a mut dyn common::Delegate>,
19108    _additional_params: HashMap<String, String>,
19109    _scopes: BTreeSet<String>,
19110}
19111
19112impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolRollbackCall<'a, C> {}
19113
19114impl<'a, C> ProjectZoneClusterNodePoolRollbackCall<'a, C>
19115where
19116    C: common::Connector,
19117{
19118    /// Perform the operation you have build so far.
19119    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19120        use std::borrow::Cow;
19121        use std::io::{Read, Seek};
19122
19123        use common::{url::Params, ToParts};
19124        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19125
19126        let mut dd = common::DefaultDelegate;
19127        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19128        dlg.begin(common::MethodInfo {
19129            id: "container.projects.zones.clusters.nodePools.rollback",
19130            http_method: hyper::Method::POST,
19131        });
19132
19133        for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
19134            if self._additional_params.contains_key(field) {
19135                dlg.finished(false);
19136                return Err(common::Error::FieldClash(field));
19137            }
19138        }
19139
19140        let mut params = Params::with_capacity(7 + self._additional_params.len());
19141        params.push("projectId", self._project_id);
19142        params.push("zone", self._zone);
19143        params.push("clusterId", self._cluster_id);
19144        params.push("nodePoolId", self._node_pool_id);
19145
19146        params.extend(self._additional_params.iter());
19147
19148        params.push("alt", "json");
19149        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}:rollback";
19150        if self._scopes.is_empty() {
19151            self._scopes
19152                .insert(Scope::CloudPlatform.as_ref().to_string());
19153        }
19154
19155        #[allow(clippy::single_element_loop)]
19156        for &(find_this, param_name) in [
19157            ("{projectId}", "projectId"),
19158            ("{zone}", "zone"),
19159            ("{clusterId}", "clusterId"),
19160            ("{nodePoolId}", "nodePoolId"),
19161        ]
19162        .iter()
19163        {
19164            url = params.uri_replacement(url, param_name, find_this, false);
19165        }
19166        {
19167            let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
19168            params.remove_params(&to_remove);
19169        }
19170
19171        let url = params.parse_with_url(&url);
19172
19173        let mut json_mime_type = mime::APPLICATION_JSON;
19174        let mut request_value_reader = {
19175            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19176            common::remove_json_null_values(&mut value);
19177            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19178            serde_json::to_writer(&mut dst, &value).unwrap();
19179            dst
19180        };
19181        let request_size = request_value_reader
19182            .seek(std::io::SeekFrom::End(0))
19183            .unwrap();
19184        request_value_reader
19185            .seek(std::io::SeekFrom::Start(0))
19186            .unwrap();
19187
19188        loop {
19189            let token = match self
19190                .hub
19191                .auth
19192                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19193                .await
19194            {
19195                Ok(token) => token,
19196                Err(e) => match dlg.token(e) {
19197                    Ok(token) => token,
19198                    Err(e) => {
19199                        dlg.finished(false);
19200                        return Err(common::Error::MissingToken(e));
19201                    }
19202                },
19203            };
19204            request_value_reader
19205                .seek(std::io::SeekFrom::Start(0))
19206                .unwrap();
19207            let mut req_result = {
19208                let client = &self.hub.client;
19209                dlg.pre_request();
19210                let mut req_builder = hyper::Request::builder()
19211                    .method(hyper::Method::POST)
19212                    .uri(url.as_str())
19213                    .header(USER_AGENT, self.hub._user_agent.clone());
19214
19215                if let Some(token) = token.as_ref() {
19216                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19217                }
19218
19219                let request = req_builder
19220                    .header(CONTENT_TYPE, json_mime_type.to_string())
19221                    .header(CONTENT_LENGTH, request_size as u64)
19222                    .body(common::to_body(
19223                        request_value_reader.get_ref().clone().into(),
19224                    ));
19225
19226                client.request(request.unwrap()).await
19227            };
19228
19229            match req_result {
19230                Err(err) => {
19231                    if let common::Retry::After(d) = dlg.http_error(&err) {
19232                        sleep(d).await;
19233                        continue;
19234                    }
19235                    dlg.finished(false);
19236                    return Err(common::Error::HttpError(err));
19237                }
19238                Ok(res) => {
19239                    let (mut parts, body) = res.into_parts();
19240                    let mut body = common::Body::new(body);
19241                    if !parts.status.is_success() {
19242                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19243                        let error = serde_json::from_str(&common::to_string(&bytes));
19244                        let response = common::to_response(parts, bytes.into());
19245
19246                        if let common::Retry::After(d) =
19247                            dlg.http_failure(&response, error.as_ref().ok())
19248                        {
19249                            sleep(d).await;
19250                            continue;
19251                        }
19252
19253                        dlg.finished(false);
19254
19255                        return Err(match error {
19256                            Ok(value) => common::Error::BadRequest(value),
19257                            _ => common::Error::Failure(response),
19258                        });
19259                    }
19260                    let response = {
19261                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19262                        let encoded = common::to_string(&bytes);
19263                        match serde_json::from_str(&encoded) {
19264                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19265                            Err(error) => {
19266                                dlg.response_json_decode_error(&encoded, &error);
19267                                return Err(common::Error::JsonDecodeError(
19268                                    encoded.to_string(),
19269                                    error,
19270                                ));
19271                            }
19272                        }
19273                    };
19274
19275                    dlg.finished(true);
19276                    return Ok(response);
19277                }
19278            }
19279        }
19280    }
19281
19282    ///
19283    /// Sets the *request* property to the given value.
19284    ///
19285    /// Even though the property as already been set when instantiating this call,
19286    /// we provide this method for API completeness.
19287    pub fn request(
19288        mut self,
19289        new_value: RollbackNodePoolUpgradeRequest,
19290    ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
19291        self._request = new_value;
19292        self
19293    }
19294    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
19295    ///
19296    /// Sets the *project id* path property to the given value.
19297    ///
19298    /// Even though the property as already been set when instantiating this call,
19299    /// we provide this method for API completeness.
19300    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
19301        self._project_id = new_value.to_string();
19302        self
19303    }
19304    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
19305    ///
19306    /// Sets the *zone* path property to the given value.
19307    ///
19308    /// Even though the property as already been set when instantiating this call,
19309    /// we provide this method for API completeness.
19310    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
19311        self._zone = new_value.to_string();
19312        self
19313    }
19314    /// Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
19315    ///
19316    /// Sets the *cluster id* path property to the given value.
19317    ///
19318    /// Even though the property as already been set when instantiating this call,
19319    /// we provide this method for API completeness.
19320    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
19321        self._cluster_id = new_value.to_string();
19322        self
19323    }
19324    /// Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
19325    ///
19326    /// Sets the *node pool id* path property to the given value.
19327    ///
19328    /// Even though the property as already been set when instantiating this call,
19329    /// we provide this method for API completeness.
19330    pub fn node_pool_id(
19331        mut self,
19332        new_value: &str,
19333    ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
19334        self._node_pool_id = new_value.to_string();
19335        self
19336    }
19337    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19338    /// while executing the actual API request.
19339    ///
19340    /// ````text
19341    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19342    /// ````
19343    ///
19344    /// Sets the *delegate* property to the given value.
19345    pub fn delegate(
19346        mut self,
19347        new_value: &'a mut dyn common::Delegate,
19348    ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
19349        self._delegate = Some(new_value);
19350        self
19351    }
19352
19353    /// Set any additional parameter of the query string used in the request.
19354    /// It should be used to set parameters which are not yet available through their own
19355    /// setters.
19356    ///
19357    /// Please note that this method must not be used to set any of the known parameters
19358    /// which have their own setter method. If done anyway, the request will fail.
19359    ///
19360    /// # Additional Parameters
19361    ///
19362    /// * *$.xgafv* (query-string) - V1 error format.
19363    /// * *access_token* (query-string) - OAuth access token.
19364    /// * *alt* (query-string) - Data format for response.
19365    /// * *callback* (query-string) - JSONP
19366    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19367    /// * *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.
19368    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19369    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19370    /// * *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.
19371    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19372    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19373    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
19374    where
19375        T: AsRef<str>,
19376    {
19377        self._additional_params
19378            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19379        self
19380    }
19381
19382    /// Identifies the authorization scope for the method you are building.
19383    ///
19384    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19385    /// [`Scope::CloudPlatform`].
19386    ///
19387    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19388    /// tokens for more than one scope.
19389    ///
19390    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19391    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19392    /// sufficient, a read-write scope will do as well.
19393    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
19394    where
19395        St: AsRef<str>,
19396    {
19397        self._scopes.insert(String::from(scope.as_ref()));
19398        self
19399    }
19400    /// Identifies the authorization scope(s) for the method you are building.
19401    ///
19402    /// See [`Self::add_scope()`] for details.
19403    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
19404    where
19405        I: IntoIterator<Item = St>,
19406        St: AsRef<str>,
19407    {
19408        self._scopes
19409            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19410        self
19411    }
19412
19413    /// Removes all scopes, and no default scope will be used either.
19414    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19415    /// for details).
19416    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
19417        self._scopes.clear();
19418        self
19419    }
19420}
19421
19422/// Sets the NodeManagement options for a node pool.
19423///
19424/// A builder for the *zones.clusters.nodePools.setManagement* method supported by a *project* resource.
19425/// It is not used directly, but through a [`ProjectMethods`] instance.
19426///
19427/// # Example
19428///
19429/// Instantiate a resource method builder
19430///
19431/// ```test_harness,no_run
19432/// # extern crate hyper;
19433/// # extern crate hyper_rustls;
19434/// # extern crate google_container1 as container1;
19435/// use container1::api::SetNodePoolManagementRequest;
19436/// # async fn dox() {
19437/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19438///
19439/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19440/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19441/// #     secret,
19442/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19443/// # ).build().await.unwrap();
19444///
19445/// # let client = hyper_util::client::legacy::Client::builder(
19446/// #     hyper_util::rt::TokioExecutor::new()
19447/// # )
19448/// # .build(
19449/// #     hyper_rustls::HttpsConnectorBuilder::new()
19450/// #         .with_native_roots()
19451/// #         .unwrap()
19452/// #         .https_or_http()
19453/// #         .enable_http1()
19454/// #         .build()
19455/// # );
19456/// # let mut hub = Container::new(client, auth);
19457/// // As the method needs a request, you would usually fill it with the desired information
19458/// // into the respective structure. Some of the parts shown here might not be applicable !
19459/// // Values shown here are possibly random and not representative !
19460/// let mut req = SetNodePoolManagementRequest::default();
19461///
19462/// // You can configure optional parameters by calling the respective setters at will, and
19463/// // execute the final call using `doit()`.
19464/// // Values shown here are possibly random and not representative !
19465/// let result = hub.projects().zones_clusters_node_pools_set_management(req, "projectId", "zone", "clusterId", "nodePoolId")
19466///              .doit().await;
19467/// # }
19468/// ```
19469pub struct ProjectZoneClusterNodePoolSetManagementCall<'a, C>
19470where
19471    C: 'a,
19472{
19473    hub: &'a Container<C>,
19474    _request: SetNodePoolManagementRequest,
19475    _project_id: String,
19476    _zone: String,
19477    _cluster_id: String,
19478    _node_pool_id: String,
19479    _delegate: Option<&'a mut dyn common::Delegate>,
19480    _additional_params: HashMap<String, String>,
19481    _scopes: BTreeSet<String>,
19482}
19483
19484impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolSetManagementCall<'a, C> {}
19485
19486impl<'a, C> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
19487where
19488    C: common::Connector,
19489{
19490    /// Perform the operation you have build so far.
19491    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19492        use std::borrow::Cow;
19493        use std::io::{Read, Seek};
19494
19495        use common::{url::Params, ToParts};
19496        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19497
19498        let mut dd = common::DefaultDelegate;
19499        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19500        dlg.begin(common::MethodInfo {
19501            id: "container.projects.zones.clusters.nodePools.setManagement",
19502            http_method: hyper::Method::POST,
19503        });
19504
19505        for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
19506            if self._additional_params.contains_key(field) {
19507                dlg.finished(false);
19508                return Err(common::Error::FieldClash(field));
19509            }
19510        }
19511
19512        let mut params = Params::with_capacity(7 + self._additional_params.len());
19513        params.push("projectId", self._project_id);
19514        params.push("zone", self._zone);
19515        params.push("clusterId", self._cluster_id);
19516        params.push("nodePoolId", self._node_pool_id);
19517
19518        params.extend(self._additional_params.iter());
19519
19520        params.push("alt", "json");
19521        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setManagement";
19522        if self._scopes.is_empty() {
19523            self._scopes
19524                .insert(Scope::CloudPlatform.as_ref().to_string());
19525        }
19526
19527        #[allow(clippy::single_element_loop)]
19528        for &(find_this, param_name) in [
19529            ("{projectId}", "projectId"),
19530            ("{zone}", "zone"),
19531            ("{clusterId}", "clusterId"),
19532            ("{nodePoolId}", "nodePoolId"),
19533        ]
19534        .iter()
19535        {
19536            url = params.uri_replacement(url, param_name, find_this, false);
19537        }
19538        {
19539            let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
19540            params.remove_params(&to_remove);
19541        }
19542
19543        let url = params.parse_with_url(&url);
19544
19545        let mut json_mime_type = mime::APPLICATION_JSON;
19546        let mut request_value_reader = {
19547            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19548            common::remove_json_null_values(&mut value);
19549            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19550            serde_json::to_writer(&mut dst, &value).unwrap();
19551            dst
19552        };
19553        let request_size = request_value_reader
19554            .seek(std::io::SeekFrom::End(0))
19555            .unwrap();
19556        request_value_reader
19557            .seek(std::io::SeekFrom::Start(0))
19558            .unwrap();
19559
19560        loop {
19561            let token = match self
19562                .hub
19563                .auth
19564                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19565                .await
19566            {
19567                Ok(token) => token,
19568                Err(e) => match dlg.token(e) {
19569                    Ok(token) => token,
19570                    Err(e) => {
19571                        dlg.finished(false);
19572                        return Err(common::Error::MissingToken(e));
19573                    }
19574                },
19575            };
19576            request_value_reader
19577                .seek(std::io::SeekFrom::Start(0))
19578                .unwrap();
19579            let mut req_result = {
19580                let client = &self.hub.client;
19581                dlg.pre_request();
19582                let mut req_builder = hyper::Request::builder()
19583                    .method(hyper::Method::POST)
19584                    .uri(url.as_str())
19585                    .header(USER_AGENT, self.hub._user_agent.clone());
19586
19587                if let Some(token) = token.as_ref() {
19588                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19589                }
19590
19591                let request = req_builder
19592                    .header(CONTENT_TYPE, json_mime_type.to_string())
19593                    .header(CONTENT_LENGTH, request_size as u64)
19594                    .body(common::to_body(
19595                        request_value_reader.get_ref().clone().into(),
19596                    ));
19597
19598                client.request(request.unwrap()).await
19599            };
19600
19601            match req_result {
19602                Err(err) => {
19603                    if let common::Retry::After(d) = dlg.http_error(&err) {
19604                        sleep(d).await;
19605                        continue;
19606                    }
19607                    dlg.finished(false);
19608                    return Err(common::Error::HttpError(err));
19609                }
19610                Ok(res) => {
19611                    let (mut parts, body) = res.into_parts();
19612                    let mut body = common::Body::new(body);
19613                    if !parts.status.is_success() {
19614                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19615                        let error = serde_json::from_str(&common::to_string(&bytes));
19616                        let response = common::to_response(parts, bytes.into());
19617
19618                        if let common::Retry::After(d) =
19619                            dlg.http_failure(&response, error.as_ref().ok())
19620                        {
19621                            sleep(d).await;
19622                            continue;
19623                        }
19624
19625                        dlg.finished(false);
19626
19627                        return Err(match error {
19628                            Ok(value) => common::Error::BadRequest(value),
19629                            _ => common::Error::Failure(response),
19630                        });
19631                    }
19632                    let response = {
19633                        let bytes = common::to_bytes(body).await.unwrap_or_default();
19634                        let encoded = common::to_string(&bytes);
19635                        match serde_json::from_str(&encoded) {
19636                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19637                            Err(error) => {
19638                                dlg.response_json_decode_error(&encoded, &error);
19639                                return Err(common::Error::JsonDecodeError(
19640                                    encoded.to_string(),
19641                                    error,
19642                                ));
19643                            }
19644                        }
19645                    };
19646
19647                    dlg.finished(true);
19648                    return Ok(response);
19649                }
19650            }
19651        }
19652    }
19653
19654    ///
19655    /// Sets the *request* property to the given value.
19656    ///
19657    /// Even though the property as already been set when instantiating this call,
19658    /// we provide this method for API completeness.
19659    pub fn request(
19660        mut self,
19661        new_value: SetNodePoolManagementRequest,
19662    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
19663        self._request = new_value;
19664        self
19665    }
19666    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
19667    ///
19668    /// Sets the *project id* path property to the given value.
19669    ///
19670    /// Even though the property as already been set when instantiating this call,
19671    /// we provide this method for API completeness.
19672    pub fn project_id(
19673        mut self,
19674        new_value: &str,
19675    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
19676        self._project_id = new_value.to_string();
19677        self
19678    }
19679    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
19680    ///
19681    /// Sets the *zone* path property to the given value.
19682    ///
19683    /// Even though the property as already been set when instantiating this call,
19684    /// we provide this method for API completeness.
19685    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
19686        self._zone = new_value.to_string();
19687        self
19688    }
19689    /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
19690    ///
19691    /// Sets the *cluster id* path property to the given value.
19692    ///
19693    /// Even though the property as already been set when instantiating this call,
19694    /// we provide this method for API completeness.
19695    pub fn cluster_id(
19696        mut self,
19697        new_value: &str,
19698    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
19699        self._cluster_id = new_value.to_string();
19700        self
19701    }
19702    /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
19703    ///
19704    /// Sets the *node pool id* path property to the given value.
19705    ///
19706    /// Even though the property as already been set when instantiating this call,
19707    /// we provide this method for API completeness.
19708    pub fn node_pool_id(
19709        mut self,
19710        new_value: &str,
19711    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
19712        self._node_pool_id = new_value.to_string();
19713        self
19714    }
19715    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19716    /// while executing the actual API request.
19717    ///
19718    /// ````text
19719    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
19720    /// ````
19721    ///
19722    /// Sets the *delegate* property to the given value.
19723    pub fn delegate(
19724        mut self,
19725        new_value: &'a mut dyn common::Delegate,
19726    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
19727        self._delegate = Some(new_value);
19728        self
19729    }
19730
19731    /// Set any additional parameter of the query string used in the request.
19732    /// It should be used to set parameters which are not yet available through their own
19733    /// setters.
19734    ///
19735    /// Please note that this method must not be used to set any of the known parameters
19736    /// which have their own setter method. If done anyway, the request will fail.
19737    ///
19738    /// # Additional Parameters
19739    ///
19740    /// * *$.xgafv* (query-string) - V1 error format.
19741    /// * *access_token* (query-string) - OAuth access token.
19742    /// * *alt* (query-string) - Data format for response.
19743    /// * *callback* (query-string) - JSONP
19744    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19745    /// * *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.
19746    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19747    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19748    /// * *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.
19749    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19750    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19751    pub fn param<T>(
19752        mut self,
19753        name: T,
19754        value: T,
19755    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
19756    where
19757        T: AsRef<str>,
19758    {
19759        self._additional_params
19760            .insert(name.as_ref().to_string(), value.as_ref().to_string());
19761        self
19762    }
19763
19764    /// Identifies the authorization scope for the method you are building.
19765    ///
19766    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19767    /// [`Scope::CloudPlatform`].
19768    ///
19769    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19770    /// tokens for more than one scope.
19771    ///
19772    /// Usually there is more than one suitable scope to authorize an operation, some of which may
19773    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19774    /// sufficient, a read-write scope will do as well.
19775    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
19776    where
19777        St: AsRef<str>,
19778    {
19779        self._scopes.insert(String::from(scope.as_ref()));
19780        self
19781    }
19782    /// Identifies the authorization scope(s) for the method you are building.
19783    ///
19784    /// See [`Self::add_scope()`] for details.
19785    pub fn add_scopes<I, St>(
19786        mut self,
19787        scopes: I,
19788    ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
19789    where
19790        I: IntoIterator<Item = St>,
19791        St: AsRef<str>,
19792    {
19793        self._scopes
19794            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19795        self
19796    }
19797
19798    /// Removes all scopes, and no default scope will be used either.
19799    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19800    /// for details).
19801    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
19802        self._scopes.clear();
19803        self
19804    }
19805}
19806
19807/// Sets the size for a specific node pool. The new size will be used for all replicas, including future replicas created by modifying NodePool.locations.
19808///
19809/// A builder for the *zones.clusters.nodePools.setSize* method supported by a *project* resource.
19810/// It is not used directly, but through a [`ProjectMethods`] instance.
19811///
19812/// # Example
19813///
19814/// Instantiate a resource method builder
19815///
19816/// ```test_harness,no_run
19817/// # extern crate hyper;
19818/// # extern crate hyper_rustls;
19819/// # extern crate google_container1 as container1;
19820/// use container1::api::SetNodePoolSizeRequest;
19821/// # async fn dox() {
19822/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19823///
19824/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19825/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
19826/// #     secret,
19827/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19828/// # ).build().await.unwrap();
19829///
19830/// # let client = hyper_util::client::legacy::Client::builder(
19831/// #     hyper_util::rt::TokioExecutor::new()
19832/// # )
19833/// # .build(
19834/// #     hyper_rustls::HttpsConnectorBuilder::new()
19835/// #         .with_native_roots()
19836/// #         .unwrap()
19837/// #         .https_or_http()
19838/// #         .enable_http1()
19839/// #         .build()
19840/// # );
19841/// # let mut hub = Container::new(client, auth);
19842/// // As the method needs a request, you would usually fill it with the desired information
19843/// // into the respective structure. Some of the parts shown here might not be applicable !
19844/// // Values shown here are possibly random and not representative !
19845/// let mut req = SetNodePoolSizeRequest::default();
19846///
19847/// // You can configure optional parameters by calling the respective setters at will, and
19848/// // execute the final call using `doit()`.
19849/// // Values shown here are possibly random and not representative !
19850/// let result = hub.projects().zones_clusters_node_pools_set_size(req, "projectId", "zone", "clusterId", "nodePoolId")
19851///              .doit().await;
19852/// # }
19853/// ```
19854pub struct ProjectZoneClusterNodePoolSetSizeCall<'a, C>
19855where
19856    C: 'a,
19857{
19858    hub: &'a Container<C>,
19859    _request: SetNodePoolSizeRequest,
19860    _project_id: String,
19861    _zone: String,
19862    _cluster_id: String,
19863    _node_pool_id: String,
19864    _delegate: Option<&'a mut dyn common::Delegate>,
19865    _additional_params: HashMap<String, String>,
19866    _scopes: BTreeSet<String>,
19867}
19868
19869impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolSetSizeCall<'a, C> {}
19870
19871impl<'a, C> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
19872where
19873    C: common::Connector,
19874{
19875    /// Perform the operation you have build so far.
19876    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19877        use std::borrow::Cow;
19878        use std::io::{Read, Seek};
19879
19880        use common::{url::Params, ToParts};
19881        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19882
19883        let mut dd = common::DefaultDelegate;
19884        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19885        dlg.begin(common::MethodInfo {
19886            id: "container.projects.zones.clusters.nodePools.setSize",
19887            http_method: hyper::Method::POST,
19888        });
19889
19890        for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
19891            if self._additional_params.contains_key(field) {
19892                dlg.finished(false);
19893                return Err(common::Error::FieldClash(field));
19894            }
19895        }
19896
19897        let mut params = Params::with_capacity(7 + self._additional_params.len());
19898        params.push("projectId", self._project_id);
19899        params.push("zone", self._zone);
19900        params.push("clusterId", self._cluster_id);
19901        params.push("nodePoolId", self._node_pool_id);
19902
19903        params.extend(self._additional_params.iter());
19904
19905        params.push("alt", "json");
19906        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setSize";
19907        if self._scopes.is_empty() {
19908            self._scopes
19909                .insert(Scope::CloudPlatform.as_ref().to_string());
19910        }
19911
19912        #[allow(clippy::single_element_loop)]
19913        for &(find_this, param_name) in [
19914            ("{projectId}", "projectId"),
19915            ("{zone}", "zone"),
19916            ("{clusterId}", "clusterId"),
19917            ("{nodePoolId}", "nodePoolId"),
19918        ]
19919        .iter()
19920        {
19921            url = params.uri_replacement(url, param_name, find_this, false);
19922        }
19923        {
19924            let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
19925            params.remove_params(&to_remove);
19926        }
19927
19928        let url = params.parse_with_url(&url);
19929
19930        let mut json_mime_type = mime::APPLICATION_JSON;
19931        let mut request_value_reader = {
19932            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19933            common::remove_json_null_values(&mut value);
19934            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19935            serde_json::to_writer(&mut dst, &value).unwrap();
19936            dst
19937        };
19938        let request_size = request_value_reader
19939            .seek(std::io::SeekFrom::End(0))
19940            .unwrap();
19941        request_value_reader
19942            .seek(std::io::SeekFrom::Start(0))
19943            .unwrap();
19944
19945        loop {
19946            let token = match self
19947                .hub
19948                .auth
19949                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19950                .await
19951            {
19952                Ok(token) => token,
19953                Err(e) => match dlg.token(e) {
19954                    Ok(token) => token,
19955                    Err(e) => {
19956                        dlg.finished(false);
19957                        return Err(common::Error::MissingToken(e));
19958                    }
19959                },
19960            };
19961            request_value_reader
19962                .seek(std::io::SeekFrom::Start(0))
19963                .unwrap();
19964            let mut req_result = {
19965                let client = &self.hub.client;
19966                dlg.pre_request();
19967                let mut req_builder = hyper::Request::builder()
19968                    .method(hyper::Method::POST)
19969                    .uri(url.as_str())
19970                    .header(USER_AGENT, self.hub._user_agent.clone());
19971
19972                if let Some(token) = token.as_ref() {
19973                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19974                }
19975
19976                let request = req_builder
19977                    .header(CONTENT_TYPE, json_mime_type.to_string())
19978                    .header(CONTENT_LENGTH, request_size as u64)
19979                    .body(common::to_body(
19980                        request_value_reader.get_ref().clone().into(),
19981                    ));
19982
19983                client.request(request.unwrap()).await
19984            };
19985
19986            match req_result {
19987                Err(err) => {
19988                    if let common::Retry::After(d) = dlg.http_error(&err) {
19989                        sleep(d).await;
19990                        continue;
19991                    }
19992                    dlg.finished(false);
19993                    return Err(common::Error::HttpError(err));
19994                }
19995                Ok(res) => {
19996                    let (mut parts, body) = res.into_parts();
19997                    let mut body = common::Body::new(body);
19998                    if !parts.status.is_success() {
19999                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20000                        let error = serde_json::from_str(&common::to_string(&bytes));
20001                        let response = common::to_response(parts, bytes.into());
20002
20003                        if let common::Retry::After(d) =
20004                            dlg.http_failure(&response, error.as_ref().ok())
20005                        {
20006                            sleep(d).await;
20007                            continue;
20008                        }
20009
20010                        dlg.finished(false);
20011
20012                        return Err(match error {
20013                            Ok(value) => common::Error::BadRequest(value),
20014                            _ => common::Error::Failure(response),
20015                        });
20016                    }
20017                    let response = {
20018                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20019                        let encoded = common::to_string(&bytes);
20020                        match serde_json::from_str(&encoded) {
20021                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20022                            Err(error) => {
20023                                dlg.response_json_decode_error(&encoded, &error);
20024                                return Err(common::Error::JsonDecodeError(
20025                                    encoded.to_string(),
20026                                    error,
20027                                ));
20028                            }
20029                        }
20030                    };
20031
20032                    dlg.finished(true);
20033                    return Ok(response);
20034                }
20035            }
20036        }
20037    }
20038
20039    ///
20040    /// Sets the *request* property to the given value.
20041    ///
20042    /// Even though the property as already been set when instantiating this call,
20043    /// we provide this method for API completeness.
20044    pub fn request(
20045        mut self,
20046        new_value: SetNodePoolSizeRequest,
20047    ) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
20048        self._request = new_value;
20049        self
20050    }
20051    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
20052    ///
20053    /// Sets the *project id* path property to the given value.
20054    ///
20055    /// Even though the property as already been set when instantiating this call,
20056    /// we provide this method for API completeness.
20057    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
20058        self._project_id = new_value.to_string();
20059        self
20060    }
20061    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
20062    ///
20063    /// Sets the *zone* path property to the given value.
20064    ///
20065    /// Even though the property as already been set when instantiating this call,
20066    /// we provide this method for API completeness.
20067    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
20068        self._zone = new_value.to_string();
20069        self
20070    }
20071    /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
20072    ///
20073    /// Sets the *cluster id* path property to the given value.
20074    ///
20075    /// Even though the property as already been set when instantiating this call,
20076    /// we provide this method for API completeness.
20077    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
20078        self._cluster_id = new_value.to_string();
20079        self
20080    }
20081    /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
20082    ///
20083    /// Sets the *node pool id* path property to the given value.
20084    ///
20085    /// Even though the property as already been set when instantiating this call,
20086    /// we provide this method for API completeness.
20087    pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
20088        self._node_pool_id = new_value.to_string();
20089        self
20090    }
20091    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20092    /// while executing the actual API request.
20093    ///
20094    /// ````text
20095    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20096    /// ````
20097    ///
20098    /// Sets the *delegate* property to the given value.
20099    pub fn delegate(
20100        mut self,
20101        new_value: &'a mut dyn common::Delegate,
20102    ) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
20103        self._delegate = Some(new_value);
20104        self
20105    }
20106
20107    /// Set any additional parameter of the query string used in the request.
20108    /// It should be used to set parameters which are not yet available through their own
20109    /// setters.
20110    ///
20111    /// Please note that this method must not be used to set any of the known parameters
20112    /// which have their own setter method. If done anyway, the request will fail.
20113    ///
20114    /// # Additional Parameters
20115    ///
20116    /// * *$.xgafv* (query-string) - V1 error format.
20117    /// * *access_token* (query-string) - OAuth access token.
20118    /// * *alt* (query-string) - Data format for response.
20119    /// * *callback* (query-string) - JSONP
20120    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20121    /// * *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.
20122    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20123    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20124    /// * *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.
20125    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20126    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20127    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
20128    where
20129        T: AsRef<str>,
20130    {
20131        self._additional_params
20132            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20133        self
20134    }
20135
20136    /// Identifies the authorization scope for the method you are building.
20137    ///
20138    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20139    /// [`Scope::CloudPlatform`].
20140    ///
20141    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20142    /// tokens for more than one scope.
20143    ///
20144    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20145    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20146    /// sufficient, a read-write scope will do as well.
20147    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
20148    where
20149        St: AsRef<str>,
20150    {
20151        self._scopes.insert(String::from(scope.as_ref()));
20152        self
20153    }
20154    /// Identifies the authorization scope(s) for the method you are building.
20155    ///
20156    /// See [`Self::add_scope()`] for details.
20157    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
20158    where
20159        I: IntoIterator<Item = St>,
20160        St: AsRef<str>,
20161    {
20162        self._scopes
20163            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20164        self
20165    }
20166
20167    /// Removes all scopes, and no default scope will be used either.
20168    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20169    /// for details).
20170    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
20171        self._scopes.clear();
20172        self
20173    }
20174}
20175
20176/// Updates the version and/or image type for the specified node pool.
20177///
20178/// A builder for the *zones.clusters.nodePools.update* method supported by a *project* resource.
20179/// It is not used directly, but through a [`ProjectMethods`] instance.
20180///
20181/// # Example
20182///
20183/// Instantiate a resource method builder
20184///
20185/// ```test_harness,no_run
20186/// # extern crate hyper;
20187/// # extern crate hyper_rustls;
20188/// # extern crate google_container1 as container1;
20189/// use container1::api::UpdateNodePoolRequest;
20190/// # async fn dox() {
20191/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20192///
20193/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20194/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20195/// #     secret,
20196/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20197/// # ).build().await.unwrap();
20198///
20199/// # let client = hyper_util::client::legacy::Client::builder(
20200/// #     hyper_util::rt::TokioExecutor::new()
20201/// # )
20202/// # .build(
20203/// #     hyper_rustls::HttpsConnectorBuilder::new()
20204/// #         .with_native_roots()
20205/// #         .unwrap()
20206/// #         .https_or_http()
20207/// #         .enable_http1()
20208/// #         .build()
20209/// # );
20210/// # let mut hub = Container::new(client, auth);
20211/// // As the method needs a request, you would usually fill it with the desired information
20212/// // into the respective structure. Some of the parts shown here might not be applicable !
20213/// // Values shown here are possibly random and not representative !
20214/// let mut req = UpdateNodePoolRequest::default();
20215///
20216/// // You can configure optional parameters by calling the respective setters at will, and
20217/// // execute the final call using `doit()`.
20218/// // Values shown here are possibly random and not representative !
20219/// let result = hub.projects().zones_clusters_node_pools_update(req, "projectId", "zone", "clusterId", "nodePoolId")
20220///              .doit().await;
20221/// # }
20222/// ```
20223pub struct ProjectZoneClusterNodePoolUpdateCall<'a, C>
20224where
20225    C: 'a,
20226{
20227    hub: &'a Container<C>,
20228    _request: UpdateNodePoolRequest,
20229    _project_id: String,
20230    _zone: String,
20231    _cluster_id: String,
20232    _node_pool_id: String,
20233    _delegate: Option<&'a mut dyn common::Delegate>,
20234    _additional_params: HashMap<String, String>,
20235    _scopes: BTreeSet<String>,
20236}
20237
20238impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolUpdateCall<'a, C> {}
20239
20240impl<'a, C> ProjectZoneClusterNodePoolUpdateCall<'a, C>
20241where
20242    C: common::Connector,
20243{
20244    /// Perform the operation you have build so far.
20245    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20246        use std::borrow::Cow;
20247        use std::io::{Read, Seek};
20248
20249        use common::{url::Params, ToParts};
20250        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20251
20252        let mut dd = common::DefaultDelegate;
20253        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20254        dlg.begin(common::MethodInfo {
20255            id: "container.projects.zones.clusters.nodePools.update",
20256            http_method: hyper::Method::POST,
20257        });
20258
20259        for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
20260            if self._additional_params.contains_key(field) {
20261                dlg.finished(false);
20262                return Err(common::Error::FieldClash(field));
20263            }
20264        }
20265
20266        let mut params = Params::with_capacity(7 + self._additional_params.len());
20267        params.push("projectId", self._project_id);
20268        params.push("zone", self._zone);
20269        params.push("clusterId", self._cluster_id);
20270        params.push("nodePoolId", self._node_pool_id);
20271
20272        params.extend(self._additional_params.iter());
20273
20274        params.push("alt", "json");
20275        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/update";
20276        if self._scopes.is_empty() {
20277            self._scopes
20278                .insert(Scope::CloudPlatform.as_ref().to_string());
20279        }
20280
20281        #[allow(clippy::single_element_loop)]
20282        for &(find_this, param_name) in [
20283            ("{projectId}", "projectId"),
20284            ("{zone}", "zone"),
20285            ("{clusterId}", "clusterId"),
20286            ("{nodePoolId}", "nodePoolId"),
20287        ]
20288        .iter()
20289        {
20290            url = params.uri_replacement(url, param_name, find_this, false);
20291        }
20292        {
20293            let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
20294            params.remove_params(&to_remove);
20295        }
20296
20297        let url = params.parse_with_url(&url);
20298
20299        let mut json_mime_type = mime::APPLICATION_JSON;
20300        let mut request_value_reader = {
20301            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20302            common::remove_json_null_values(&mut value);
20303            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20304            serde_json::to_writer(&mut dst, &value).unwrap();
20305            dst
20306        };
20307        let request_size = request_value_reader
20308            .seek(std::io::SeekFrom::End(0))
20309            .unwrap();
20310        request_value_reader
20311            .seek(std::io::SeekFrom::Start(0))
20312            .unwrap();
20313
20314        loop {
20315            let token = match self
20316                .hub
20317                .auth
20318                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20319                .await
20320            {
20321                Ok(token) => token,
20322                Err(e) => match dlg.token(e) {
20323                    Ok(token) => token,
20324                    Err(e) => {
20325                        dlg.finished(false);
20326                        return Err(common::Error::MissingToken(e));
20327                    }
20328                },
20329            };
20330            request_value_reader
20331                .seek(std::io::SeekFrom::Start(0))
20332                .unwrap();
20333            let mut req_result = {
20334                let client = &self.hub.client;
20335                dlg.pre_request();
20336                let mut req_builder = hyper::Request::builder()
20337                    .method(hyper::Method::POST)
20338                    .uri(url.as_str())
20339                    .header(USER_AGENT, self.hub._user_agent.clone());
20340
20341                if let Some(token) = token.as_ref() {
20342                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20343                }
20344
20345                let request = req_builder
20346                    .header(CONTENT_TYPE, json_mime_type.to_string())
20347                    .header(CONTENT_LENGTH, request_size as u64)
20348                    .body(common::to_body(
20349                        request_value_reader.get_ref().clone().into(),
20350                    ));
20351
20352                client.request(request.unwrap()).await
20353            };
20354
20355            match req_result {
20356                Err(err) => {
20357                    if let common::Retry::After(d) = dlg.http_error(&err) {
20358                        sleep(d).await;
20359                        continue;
20360                    }
20361                    dlg.finished(false);
20362                    return Err(common::Error::HttpError(err));
20363                }
20364                Ok(res) => {
20365                    let (mut parts, body) = res.into_parts();
20366                    let mut body = common::Body::new(body);
20367                    if !parts.status.is_success() {
20368                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20369                        let error = serde_json::from_str(&common::to_string(&bytes));
20370                        let response = common::to_response(parts, bytes.into());
20371
20372                        if let common::Retry::After(d) =
20373                            dlg.http_failure(&response, error.as_ref().ok())
20374                        {
20375                            sleep(d).await;
20376                            continue;
20377                        }
20378
20379                        dlg.finished(false);
20380
20381                        return Err(match error {
20382                            Ok(value) => common::Error::BadRequest(value),
20383                            _ => common::Error::Failure(response),
20384                        });
20385                    }
20386                    let response = {
20387                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20388                        let encoded = common::to_string(&bytes);
20389                        match serde_json::from_str(&encoded) {
20390                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20391                            Err(error) => {
20392                                dlg.response_json_decode_error(&encoded, &error);
20393                                return Err(common::Error::JsonDecodeError(
20394                                    encoded.to_string(),
20395                                    error,
20396                                ));
20397                            }
20398                        }
20399                    };
20400
20401                    dlg.finished(true);
20402                    return Ok(response);
20403                }
20404            }
20405        }
20406    }
20407
20408    ///
20409    /// Sets the *request* property to the given value.
20410    ///
20411    /// Even though the property as already been set when instantiating this call,
20412    /// we provide this method for API completeness.
20413    pub fn request(
20414        mut self,
20415        new_value: UpdateNodePoolRequest,
20416    ) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
20417        self._request = new_value;
20418        self
20419    }
20420    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
20421    ///
20422    /// Sets the *project id* path property to the given value.
20423    ///
20424    /// Even though the property as already been set when instantiating this call,
20425    /// we provide this method for API completeness.
20426    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
20427        self._project_id = new_value.to_string();
20428        self
20429    }
20430    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
20431    ///
20432    /// Sets the *zone* path property to the given value.
20433    ///
20434    /// Even though the property as already been set when instantiating this call,
20435    /// we provide this method for API completeness.
20436    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
20437        self._zone = new_value.to_string();
20438        self
20439    }
20440    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
20441    ///
20442    /// Sets the *cluster id* path property to the given value.
20443    ///
20444    /// Even though the property as already been set when instantiating this call,
20445    /// we provide this method for API completeness.
20446    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
20447        self._cluster_id = new_value.to_string();
20448        self
20449    }
20450    /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
20451    ///
20452    /// Sets the *node pool id* path property to the given value.
20453    ///
20454    /// Even though the property as already been set when instantiating this call,
20455    /// we provide this method for API completeness.
20456    pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
20457        self._node_pool_id = new_value.to_string();
20458        self
20459    }
20460    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20461    /// while executing the actual API request.
20462    ///
20463    /// ````text
20464    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20465    /// ````
20466    ///
20467    /// Sets the *delegate* property to the given value.
20468    pub fn delegate(
20469        mut self,
20470        new_value: &'a mut dyn common::Delegate,
20471    ) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
20472        self._delegate = Some(new_value);
20473        self
20474    }
20475
20476    /// Set any additional parameter of the query string used in the request.
20477    /// It should be used to set parameters which are not yet available through their own
20478    /// setters.
20479    ///
20480    /// Please note that this method must not be used to set any of the known parameters
20481    /// which have their own setter method. If done anyway, the request will fail.
20482    ///
20483    /// # Additional Parameters
20484    ///
20485    /// * *$.xgafv* (query-string) - V1 error format.
20486    /// * *access_token* (query-string) - OAuth access token.
20487    /// * *alt* (query-string) - Data format for response.
20488    /// * *callback* (query-string) - JSONP
20489    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20490    /// * *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.
20491    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20492    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20493    /// * *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.
20494    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20495    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20496    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
20497    where
20498        T: AsRef<str>,
20499    {
20500        self._additional_params
20501            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20502        self
20503    }
20504
20505    /// Identifies the authorization scope for the method you are building.
20506    ///
20507    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20508    /// [`Scope::CloudPlatform`].
20509    ///
20510    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20511    /// tokens for more than one scope.
20512    ///
20513    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20514    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20515    /// sufficient, a read-write scope will do as well.
20516    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
20517    where
20518        St: AsRef<str>,
20519    {
20520        self._scopes.insert(String::from(scope.as_ref()));
20521        self
20522    }
20523    /// Identifies the authorization scope(s) for the method you are building.
20524    ///
20525    /// See [`Self::add_scope()`] for details.
20526    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
20527    where
20528        I: IntoIterator<Item = St>,
20529        St: AsRef<str>,
20530    {
20531        self._scopes
20532            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20533        self
20534    }
20535
20536    /// Removes all scopes, and no default scope will be used either.
20537    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20538    /// for details).
20539    pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
20540        self._scopes.clear();
20541        self
20542    }
20543}
20544
20545/// Sets the addons for a specific cluster.
20546///
20547/// A builder for the *zones.clusters.addons* method supported by a *project* resource.
20548/// It is not used directly, but through a [`ProjectMethods`] instance.
20549///
20550/// # Example
20551///
20552/// Instantiate a resource method builder
20553///
20554/// ```test_harness,no_run
20555/// # extern crate hyper;
20556/// # extern crate hyper_rustls;
20557/// # extern crate google_container1 as container1;
20558/// use container1::api::SetAddonsConfigRequest;
20559/// # async fn dox() {
20560/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20561///
20562/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20563/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20564/// #     secret,
20565/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20566/// # ).build().await.unwrap();
20567///
20568/// # let client = hyper_util::client::legacy::Client::builder(
20569/// #     hyper_util::rt::TokioExecutor::new()
20570/// # )
20571/// # .build(
20572/// #     hyper_rustls::HttpsConnectorBuilder::new()
20573/// #         .with_native_roots()
20574/// #         .unwrap()
20575/// #         .https_or_http()
20576/// #         .enable_http1()
20577/// #         .build()
20578/// # );
20579/// # let mut hub = Container::new(client, auth);
20580/// // As the method needs a request, you would usually fill it with the desired information
20581/// // into the respective structure. Some of the parts shown here might not be applicable !
20582/// // Values shown here are possibly random and not representative !
20583/// let mut req = SetAddonsConfigRequest::default();
20584///
20585/// // You can configure optional parameters by calling the respective setters at will, and
20586/// // execute the final call using `doit()`.
20587/// // Values shown here are possibly random and not representative !
20588/// let result = hub.projects().zones_clusters_addons(req, "projectId", "zone", "clusterId")
20589///              .doit().await;
20590/// # }
20591/// ```
20592pub struct ProjectZoneClusterAddonCall<'a, C>
20593where
20594    C: 'a,
20595{
20596    hub: &'a Container<C>,
20597    _request: SetAddonsConfigRequest,
20598    _project_id: String,
20599    _zone: String,
20600    _cluster_id: String,
20601    _delegate: Option<&'a mut dyn common::Delegate>,
20602    _additional_params: HashMap<String, String>,
20603    _scopes: BTreeSet<String>,
20604}
20605
20606impl<'a, C> common::CallBuilder for ProjectZoneClusterAddonCall<'a, C> {}
20607
20608impl<'a, C> ProjectZoneClusterAddonCall<'a, C>
20609where
20610    C: common::Connector,
20611{
20612    /// Perform the operation you have build so far.
20613    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20614        use std::borrow::Cow;
20615        use std::io::{Read, Seek};
20616
20617        use common::{url::Params, ToParts};
20618        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20619
20620        let mut dd = common::DefaultDelegate;
20621        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20622        dlg.begin(common::MethodInfo {
20623            id: "container.projects.zones.clusters.addons",
20624            http_method: hyper::Method::POST,
20625        });
20626
20627        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
20628            if self._additional_params.contains_key(field) {
20629                dlg.finished(false);
20630                return Err(common::Error::FieldClash(field));
20631            }
20632        }
20633
20634        let mut params = Params::with_capacity(6 + self._additional_params.len());
20635        params.push("projectId", self._project_id);
20636        params.push("zone", self._zone);
20637        params.push("clusterId", self._cluster_id);
20638
20639        params.extend(self._additional_params.iter());
20640
20641        params.push("alt", "json");
20642        let mut url = self.hub._base_url.clone()
20643            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/addons";
20644        if self._scopes.is_empty() {
20645            self._scopes
20646                .insert(Scope::CloudPlatform.as_ref().to_string());
20647        }
20648
20649        #[allow(clippy::single_element_loop)]
20650        for &(find_this, param_name) in [
20651            ("{projectId}", "projectId"),
20652            ("{zone}", "zone"),
20653            ("{clusterId}", "clusterId"),
20654        ]
20655        .iter()
20656        {
20657            url = params.uri_replacement(url, param_name, find_this, false);
20658        }
20659        {
20660            let to_remove = ["clusterId", "zone", "projectId"];
20661            params.remove_params(&to_remove);
20662        }
20663
20664        let url = params.parse_with_url(&url);
20665
20666        let mut json_mime_type = mime::APPLICATION_JSON;
20667        let mut request_value_reader = {
20668            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20669            common::remove_json_null_values(&mut value);
20670            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20671            serde_json::to_writer(&mut dst, &value).unwrap();
20672            dst
20673        };
20674        let request_size = request_value_reader
20675            .seek(std::io::SeekFrom::End(0))
20676            .unwrap();
20677        request_value_reader
20678            .seek(std::io::SeekFrom::Start(0))
20679            .unwrap();
20680
20681        loop {
20682            let token = match self
20683                .hub
20684                .auth
20685                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20686                .await
20687            {
20688                Ok(token) => token,
20689                Err(e) => match dlg.token(e) {
20690                    Ok(token) => token,
20691                    Err(e) => {
20692                        dlg.finished(false);
20693                        return Err(common::Error::MissingToken(e));
20694                    }
20695                },
20696            };
20697            request_value_reader
20698                .seek(std::io::SeekFrom::Start(0))
20699                .unwrap();
20700            let mut req_result = {
20701                let client = &self.hub.client;
20702                dlg.pre_request();
20703                let mut req_builder = hyper::Request::builder()
20704                    .method(hyper::Method::POST)
20705                    .uri(url.as_str())
20706                    .header(USER_AGENT, self.hub._user_agent.clone());
20707
20708                if let Some(token) = token.as_ref() {
20709                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20710                }
20711
20712                let request = req_builder
20713                    .header(CONTENT_TYPE, json_mime_type.to_string())
20714                    .header(CONTENT_LENGTH, request_size as u64)
20715                    .body(common::to_body(
20716                        request_value_reader.get_ref().clone().into(),
20717                    ));
20718
20719                client.request(request.unwrap()).await
20720            };
20721
20722            match req_result {
20723                Err(err) => {
20724                    if let common::Retry::After(d) = dlg.http_error(&err) {
20725                        sleep(d).await;
20726                        continue;
20727                    }
20728                    dlg.finished(false);
20729                    return Err(common::Error::HttpError(err));
20730                }
20731                Ok(res) => {
20732                    let (mut parts, body) = res.into_parts();
20733                    let mut body = common::Body::new(body);
20734                    if !parts.status.is_success() {
20735                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20736                        let error = serde_json::from_str(&common::to_string(&bytes));
20737                        let response = common::to_response(parts, bytes.into());
20738
20739                        if let common::Retry::After(d) =
20740                            dlg.http_failure(&response, error.as_ref().ok())
20741                        {
20742                            sleep(d).await;
20743                            continue;
20744                        }
20745
20746                        dlg.finished(false);
20747
20748                        return Err(match error {
20749                            Ok(value) => common::Error::BadRequest(value),
20750                            _ => common::Error::Failure(response),
20751                        });
20752                    }
20753                    let response = {
20754                        let bytes = common::to_bytes(body).await.unwrap_or_default();
20755                        let encoded = common::to_string(&bytes);
20756                        match serde_json::from_str(&encoded) {
20757                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20758                            Err(error) => {
20759                                dlg.response_json_decode_error(&encoded, &error);
20760                                return Err(common::Error::JsonDecodeError(
20761                                    encoded.to_string(),
20762                                    error,
20763                                ));
20764                            }
20765                        }
20766                    };
20767
20768                    dlg.finished(true);
20769                    return Ok(response);
20770                }
20771            }
20772        }
20773    }
20774
20775    ///
20776    /// Sets the *request* property to the given value.
20777    ///
20778    /// Even though the property as already been set when instantiating this call,
20779    /// we provide this method for API completeness.
20780    pub fn request(
20781        mut self,
20782        new_value: SetAddonsConfigRequest,
20783    ) -> ProjectZoneClusterAddonCall<'a, C> {
20784        self._request = new_value;
20785        self
20786    }
20787    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
20788    ///
20789    /// Sets the *project id* path property to the given value.
20790    ///
20791    /// Even though the property as already been set when instantiating this call,
20792    /// we provide this method for API completeness.
20793    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
20794        self._project_id = new_value.to_string();
20795        self
20796    }
20797    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
20798    ///
20799    /// Sets the *zone* path property to the given value.
20800    ///
20801    /// Even though the property as already been set when instantiating this call,
20802    /// we provide this method for API completeness.
20803    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
20804        self._zone = new_value.to_string();
20805        self
20806    }
20807    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
20808    ///
20809    /// Sets the *cluster id* path property to the given value.
20810    ///
20811    /// Even though the property as already been set when instantiating this call,
20812    /// we provide this method for API completeness.
20813    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
20814        self._cluster_id = new_value.to_string();
20815        self
20816    }
20817    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20818    /// while executing the actual API request.
20819    ///
20820    /// ````text
20821    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
20822    /// ````
20823    ///
20824    /// Sets the *delegate* property to the given value.
20825    pub fn delegate(
20826        mut self,
20827        new_value: &'a mut dyn common::Delegate,
20828    ) -> ProjectZoneClusterAddonCall<'a, C> {
20829        self._delegate = Some(new_value);
20830        self
20831    }
20832
20833    /// Set any additional parameter of the query string used in the request.
20834    /// It should be used to set parameters which are not yet available through their own
20835    /// setters.
20836    ///
20837    /// Please note that this method must not be used to set any of the known parameters
20838    /// which have their own setter method. If done anyway, the request will fail.
20839    ///
20840    /// # Additional Parameters
20841    ///
20842    /// * *$.xgafv* (query-string) - V1 error format.
20843    /// * *access_token* (query-string) - OAuth access token.
20844    /// * *alt* (query-string) - Data format for response.
20845    /// * *callback* (query-string) - JSONP
20846    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20847    /// * *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.
20848    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20849    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20850    /// * *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.
20851    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20852    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20853    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterAddonCall<'a, C>
20854    where
20855        T: AsRef<str>,
20856    {
20857        self._additional_params
20858            .insert(name.as_ref().to_string(), value.as_ref().to_string());
20859        self
20860    }
20861
20862    /// Identifies the authorization scope for the method you are building.
20863    ///
20864    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20865    /// [`Scope::CloudPlatform`].
20866    ///
20867    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20868    /// tokens for more than one scope.
20869    ///
20870    /// Usually there is more than one suitable scope to authorize an operation, some of which may
20871    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20872    /// sufficient, a read-write scope will do as well.
20873    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterAddonCall<'a, C>
20874    where
20875        St: AsRef<str>,
20876    {
20877        self._scopes.insert(String::from(scope.as_ref()));
20878        self
20879    }
20880    /// Identifies the authorization scope(s) for the method you are building.
20881    ///
20882    /// See [`Self::add_scope()`] for details.
20883    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterAddonCall<'a, C>
20884    where
20885        I: IntoIterator<Item = St>,
20886        St: AsRef<str>,
20887    {
20888        self._scopes
20889            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20890        self
20891    }
20892
20893    /// Removes all scopes, and no default scope will be used either.
20894    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20895    /// for details).
20896    pub fn clear_scopes(mut self) -> ProjectZoneClusterAddonCall<'a, C> {
20897        self._scopes.clear();
20898        self
20899    }
20900}
20901
20902/// Completes master IP rotation.
20903///
20904/// A builder for the *zones.clusters.completeIpRotation* method supported by a *project* resource.
20905/// It is not used directly, but through a [`ProjectMethods`] instance.
20906///
20907/// # Example
20908///
20909/// Instantiate a resource method builder
20910///
20911/// ```test_harness,no_run
20912/// # extern crate hyper;
20913/// # extern crate hyper_rustls;
20914/// # extern crate google_container1 as container1;
20915/// use container1::api::CompleteIPRotationRequest;
20916/// # async fn dox() {
20917/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20918///
20919/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20920/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
20921/// #     secret,
20922/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20923/// # ).build().await.unwrap();
20924///
20925/// # let client = hyper_util::client::legacy::Client::builder(
20926/// #     hyper_util::rt::TokioExecutor::new()
20927/// # )
20928/// # .build(
20929/// #     hyper_rustls::HttpsConnectorBuilder::new()
20930/// #         .with_native_roots()
20931/// #         .unwrap()
20932/// #         .https_or_http()
20933/// #         .enable_http1()
20934/// #         .build()
20935/// # );
20936/// # let mut hub = Container::new(client, auth);
20937/// // As the method needs a request, you would usually fill it with the desired information
20938/// // into the respective structure. Some of the parts shown here might not be applicable !
20939/// // Values shown here are possibly random and not representative !
20940/// let mut req = CompleteIPRotationRequest::default();
20941///
20942/// // You can configure optional parameters by calling the respective setters at will, and
20943/// // execute the final call using `doit()`.
20944/// // Values shown here are possibly random and not representative !
20945/// let result = hub.projects().zones_clusters_complete_ip_rotation(req, "projectId", "zone", "clusterId")
20946///              .doit().await;
20947/// # }
20948/// ```
20949pub struct ProjectZoneClusterCompleteIpRotationCall<'a, C>
20950where
20951    C: 'a,
20952{
20953    hub: &'a Container<C>,
20954    _request: CompleteIPRotationRequest,
20955    _project_id: String,
20956    _zone: String,
20957    _cluster_id: String,
20958    _delegate: Option<&'a mut dyn common::Delegate>,
20959    _additional_params: HashMap<String, String>,
20960    _scopes: BTreeSet<String>,
20961}
20962
20963impl<'a, C> common::CallBuilder for ProjectZoneClusterCompleteIpRotationCall<'a, C> {}
20964
20965impl<'a, C> ProjectZoneClusterCompleteIpRotationCall<'a, C>
20966where
20967    C: common::Connector,
20968{
20969    /// Perform the operation you have build so far.
20970    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20971        use std::borrow::Cow;
20972        use std::io::{Read, Seek};
20973
20974        use common::{url::Params, ToParts};
20975        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20976
20977        let mut dd = common::DefaultDelegate;
20978        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20979        dlg.begin(common::MethodInfo {
20980            id: "container.projects.zones.clusters.completeIpRotation",
20981            http_method: hyper::Method::POST,
20982        });
20983
20984        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
20985            if self._additional_params.contains_key(field) {
20986                dlg.finished(false);
20987                return Err(common::Error::FieldClash(field));
20988            }
20989        }
20990
20991        let mut params = Params::with_capacity(6 + self._additional_params.len());
20992        params.push("projectId", self._project_id);
20993        params.push("zone", self._zone);
20994        params.push("clusterId", self._cluster_id);
20995
20996        params.extend(self._additional_params.iter());
20997
20998        params.push("alt", "json");
20999        let mut url = self.hub._base_url.clone()
21000            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:completeIpRotation";
21001        if self._scopes.is_empty() {
21002            self._scopes
21003                .insert(Scope::CloudPlatform.as_ref().to_string());
21004        }
21005
21006        #[allow(clippy::single_element_loop)]
21007        for &(find_this, param_name) in [
21008            ("{projectId}", "projectId"),
21009            ("{zone}", "zone"),
21010            ("{clusterId}", "clusterId"),
21011        ]
21012        .iter()
21013        {
21014            url = params.uri_replacement(url, param_name, find_this, false);
21015        }
21016        {
21017            let to_remove = ["clusterId", "zone", "projectId"];
21018            params.remove_params(&to_remove);
21019        }
21020
21021        let url = params.parse_with_url(&url);
21022
21023        let mut json_mime_type = mime::APPLICATION_JSON;
21024        let mut request_value_reader = {
21025            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21026            common::remove_json_null_values(&mut value);
21027            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21028            serde_json::to_writer(&mut dst, &value).unwrap();
21029            dst
21030        };
21031        let request_size = request_value_reader
21032            .seek(std::io::SeekFrom::End(0))
21033            .unwrap();
21034        request_value_reader
21035            .seek(std::io::SeekFrom::Start(0))
21036            .unwrap();
21037
21038        loop {
21039            let token = match self
21040                .hub
21041                .auth
21042                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21043                .await
21044            {
21045                Ok(token) => token,
21046                Err(e) => match dlg.token(e) {
21047                    Ok(token) => token,
21048                    Err(e) => {
21049                        dlg.finished(false);
21050                        return Err(common::Error::MissingToken(e));
21051                    }
21052                },
21053            };
21054            request_value_reader
21055                .seek(std::io::SeekFrom::Start(0))
21056                .unwrap();
21057            let mut req_result = {
21058                let client = &self.hub.client;
21059                dlg.pre_request();
21060                let mut req_builder = hyper::Request::builder()
21061                    .method(hyper::Method::POST)
21062                    .uri(url.as_str())
21063                    .header(USER_AGENT, self.hub._user_agent.clone());
21064
21065                if let Some(token) = token.as_ref() {
21066                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21067                }
21068
21069                let request = req_builder
21070                    .header(CONTENT_TYPE, json_mime_type.to_string())
21071                    .header(CONTENT_LENGTH, request_size as u64)
21072                    .body(common::to_body(
21073                        request_value_reader.get_ref().clone().into(),
21074                    ));
21075
21076                client.request(request.unwrap()).await
21077            };
21078
21079            match req_result {
21080                Err(err) => {
21081                    if let common::Retry::After(d) = dlg.http_error(&err) {
21082                        sleep(d).await;
21083                        continue;
21084                    }
21085                    dlg.finished(false);
21086                    return Err(common::Error::HttpError(err));
21087                }
21088                Ok(res) => {
21089                    let (mut parts, body) = res.into_parts();
21090                    let mut body = common::Body::new(body);
21091                    if !parts.status.is_success() {
21092                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21093                        let error = serde_json::from_str(&common::to_string(&bytes));
21094                        let response = common::to_response(parts, bytes.into());
21095
21096                        if let common::Retry::After(d) =
21097                            dlg.http_failure(&response, error.as_ref().ok())
21098                        {
21099                            sleep(d).await;
21100                            continue;
21101                        }
21102
21103                        dlg.finished(false);
21104
21105                        return Err(match error {
21106                            Ok(value) => common::Error::BadRequest(value),
21107                            _ => common::Error::Failure(response),
21108                        });
21109                    }
21110                    let response = {
21111                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21112                        let encoded = common::to_string(&bytes);
21113                        match serde_json::from_str(&encoded) {
21114                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21115                            Err(error) => {
21116                                dlg.response_json_decode_error(&encoded, &error);
21117                                return Err(common::Error::JsonDecodeError(
21118                                    encoded.to_string(),
21119                                    error,
21120                                ));
21121                            }
21122                        }
21123                    };
21124
21125                    dlg.finished(true);
21126                    return Ok(response);
21127                }
21128            }
21129        }
21130    }
21131
21132    ///
21133    /// Sets the *request* property to the given value.
21134    ///
21135    /// Even though the property as already been set when instantiating this call,
21136    /// we provide this method for API completeness.
21137    pub fn request(
21138        mut self,
21139        new_value: CompleteIPRotationRequest,
21140    ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
21141        self._request = new_value;
21142        self
21143    }
21144    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
21145    ///
21146    /// Sets the *project id* path property to the given value.
21147    ///
21148    /// Even though the property as already been set when instantiating this call,
21149    /// we provide this method for API completeness.
21150    pub fn project_id(
21151        mut self,
21152        new_value: &str,
21153    ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
21154        self._project_id = new_value.to_string();
21155        self
21156    }
21157    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
21158    ///
21159    /// Sets the *zone* path property to the given value.
21160    ///
21161    /// Even though the property as already been set when instantiating this call,
21162    /// we provide this method for API completeness.
21163    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
21164        self._zone = new_value.to_string();
21165        self
21166    }
21167    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
21168    ///
21169    /// Sets the *cluster id* path property to the given value.
21170    ///
21171    /// Even though the property as already been set when instantiating this call,
21172    /// we provide this method for API completeness.
21173    pub fn cluster_id(
21174        mut self,
21175        new_value: &str,
21176    ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
21177        self._cluster_id = new_value.to_string();
21178        self
21179    }
21180    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21181    /// while executing the actual API request.
21182    ///
21183    /// ````text
21184    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21185    /// ````
21186    ///
21187    /// Sets the *delegate* property to the given value.
21188    pub fn delegate(
21189        mut self,
21190        new_value: &'a mut dyn common::Delegate,
21191    ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
21192        self._delegate = Some(new_value);
21193        self
21194    }
21195
21196    /// Set any additional parameter of the query string used in the request.
21197    /// It should be used to set parameters which are not yet available through their own
21198    /// setters.
21199    ///
21200    /// Please note that this method must not be used to set any of the known parameters
21201    /// which have their own setter method. If done anyway, the request will fail.
21202    ///
21203    /// # Additional Parameters
21204    ///
21205    /// * *$.xgafv* (query-string) - V1 error format.
21206    /// * *access_token* (query-string) - OAuth access token.
21207    /// * *alt* (query-string) - Data format for response.
21208    /// * *callback* (query-string) - JSONP
21209    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21210    /// * *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.
21211    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21212    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21213    /// * *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.
21214    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21215    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21216    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
21217    where
21218        T: AsRef<str>,
21219    {
21220        self._additional_params
21221            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21222        self
21223    }
21224
21225    /// Identifies the authorization scope for the method you are building.
21226    ///
21227    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21228    /// [`Scope::CloudPlatform`].
21229    ///
21230    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21231    /// tokens for more than one scope.
21232    ///
21233    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21234    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21235    /// sufficient, a read-write scope will do as well.
21236    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
21237    where
21238        St: AsRef<str>,
21239    {
21240        self._scopes.insert(String::from(scope.as_ref()));
21241        self
21242    }
21243    /// Identifies the authorization scope(s) for the method you are building.
21244    ///
21245    /// See [`Self::add_scope()`] for details.
21246    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
21247    where
21248        I: IntoIterator<Item = St>,
21249        St: AsRef<str>,
21250    {
21251        self._scopes
21252            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21253        self
21254    }
21255
21256    /// Removes all scopes, and no default scope will be used either.
21257    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21258    /// for details).
21259    pub fn clear_scopes(mut self) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
21260        self._scopes.clear();
21261        self
21262    }
21263}
21264
21265/// Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. By default, the cluster is created in the project's [default network](https://cloud.google.com/compute/docs/networks-and-firewalls#networks). One firewall is added for the cluster. After cluster creation, the Kubelet creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. Finally, an entry is added to the project's global metadata indicating which CIDR range the cluster is using.
21266///
21267/// A builder for the *zones.clusters.create* method supported by a *project* resource.
21268/// It is not used directly, but through a [`ProjectMethods`] instance.
21269///
21270/// # Example
21271///
21272/// Instantiate a resource method builder
21273///
21274/// ```test_harness,no_run
21275/// # extern crate hyper;
21276/// # extern crate hyper_rustls;
21277/// # extern crate google_container1 as container1;
21278/// use container1::api::CreateClusterRequest;
21279/// # async fn dox() {
21280/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21281///
21282/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21283/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21284/// #     secret,
21285/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21286/// # ).build().await.unwrap();
21287///
21288/// # let client = hyper_util::client::legacy::Client::builder(
21289/// #     hyper_util::rt::TokioExecutor::new()
21290/// # )
21291/// # .build(
21292/// #     hyper_rustls::HttpsConnectorBuilder::new()
21293/// #         .with_native_roots()
21294/// #         .unwrap()
21295/// #         .https_or_http()
21296/// #         .enable_http1()
21297/// #         .build()
21298/// # );
21299/// # let mut hub = Container::new(client, auth);
21300/// // As the method needs a request, you would usually fill it with the desired information
21301/// // into the respective structure. Some of the parts shown here might not be applicable !
21302/// // Values shown here are possibly random and not representative !
21303/// let mut req = CreateClusterRequest::default();
21304///
21305/// // You can configure optional parameters by calling the respective setters at will, and
21306/// // execute the final call using `doit()`.
21307/// // Values shown here are possibly random and not representative !
21308/// let result = hub.projects().zones_clusters_create(req, "projectId", "zone")
21309///              .doit().await;
21310/// # }
21311/// ```
21312pub struct ProjectZoneClusterCreateCall<'a, C>
21313where
21314    C: 'a,
21315{
21316    hub: &'a Container<C>,
21317    _request: CreateClusterRequest,
21318    _project_id: String,
21319    _zone: String,
21320    _delegate: Option<&'a mut dyn common::Delegate>,
21321    _additional_params: HashMap<String, String>,
21322    _scopes: BTreeSet<String>,
21323}
21324
21325impl<'a, C> common::CallBuilder for ProjectZoneClusterCreateCall<'a, C> {}
21326
21327impl<'a, C> ProjectZoneClusterCreateCall<'a, C>
21328where
21329    C: common::Connector,
21330{
21331    /// Perform the operation you have build so far.
21332    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21333        use std::borrow::Cow;
21334        use std::io::{Read, Seek};
21335
21336        use common::{url::Params, ToParts};
21337        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21338
21339        let mut dd = common::DefaultDelegate;
21340        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21341        dlg.begin(common::MethodInfo {
21342            id: "container.projects.zones.clusters.create",
21343            http_method: hyper::Method::POST,
21344        });
21345
21346        for &field in ["alt", "projectId", "zone"].iter() {
21347            if self._additional_params.contains_key(field) {
21348                dlg.finished(false);
21349                return Err(common::Error::FieldClash(field));
21350            }
21351        }
21352
21353        let mut params = Params::with_capacity(5 + self._additional_params.len());
21354        params.push("projectId", self._project_id);
21355        params.push("zone", self._zone);
21356
21357        params.extend(self._additional_params.iter());
21358
21359        params.push("alt", "json");
21360        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
21361        if self._scopes.is_empty() {
21362            self._scopes
21363                .insert(Scope::CloudPlatform.as_ref().to_string());
21364        }
21365
21366        #[allow(clippy::single_element_loop)]
21367        for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
21368            url = params.uri_replacement(url, param_name, find_this, false);
21369        }
21370        {
21371            let to_remove = ["zone", "projectId"];
21372            params.remove_params(&to_remove);
21373        }
21374
21375        let url = params.parse_with_url(&url);
21376
21377        let mut json_mime_type = mime::APPLICATION_JSON;
21378        let mut request_value_reader = {
21379            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21380            common::remove_json_null_values(&mut value);
21381            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21382            serde_json::to_writer(&mut dst, &value).unwrap();
21383            dst
21384        };
21385        let request_size = request_value_reader
21386            .seek(std::io::SeekFrom::End(0))
21387            .unwrap();
21388        request_value_reader
21389            .seek(std::io::SeekFrom::Start(0))
21390            .unwrap();
21391
21392        loop {
21393            let token = match self
21394                .hub
21395                .auth
21396                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21397                .await
21398            {
21399                Ok(token) => token,
21400                Err(e) => match dlg.token(e) {
21401                    Ok(token) => token,
21402                    Err(e) => {
21403                        dlg.finished(false);
21404                        return Err(common::Error::MissingToken(e));
21405                    }
21406                },
21407            };
21408            request_value_reader
21409                .seek(std::io::SeekFrom::Start(0))
21410                .unwrap();
21411            let mut req_result = {
21412                let client = &self.hub.client;
21413                dlg.pre_request();
21414                let mut req_builder = hyper::Request::builder()
21415                    .method(hyper::Method::POST)
21416                    .uri(url.as_str())
21417                    .header(USER_AGENT, self.hub._user_agent.clone());
21418
21419                if let Some(token) = token.as_ref() {
21420                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21421                }
21422
21423                let request = req_builder
21424                    .header(CONTENT_TYPE, json_mime_type.to_string())
21425                    .header(CONTENT_LENGTH, request_size as u64)
21426                    .body(common::to_body(
21427                        request_value_reader.get_ref().clone().into(),
21428                    ));
21429
21430                client.request(request.unwrap()).await
21431            };
21432
21433            match req_result {
21434                Err(err) => {
21435                    if let common::Retry::After(d) = dlg.http_error(&err) {
21436                        sleep(d).await;
21437                        continue;
21438                    }
21439                    dlg.finished(false);
21440                    return Err(common::Error::HttpError(err));
21441                }
21442                Ok(res) => {
21443                    let (mut parts, body) = res.into_parts();
21444                    let mut body = common::Body::new(body);
21445                    if !parts.status.is_success() {
21446                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21447                        let error = serde_json::from_str(&common::to_string(&bytes));
21448                        let response = common::to_response(parts, bytes.into());
21449
21450                        if let common::Retry::After(d) =
21451                            dlg.http_failure(&response, error.as_ref().ok())
21452                        {
21453                            sleep(d).await;
21454                            continue;
21455                        }
21456
21457                        dlg.finished(false);
21458
21459                        return Err(match error {
21460                            Ok(value) => common::Error::BadRequest(value),
21461                            _ => common::Error::Failure(response),
21462                        });
21463                    }
21464                    let response = {
21465                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21466                        let encoded = common::to_string(&bytes);
21467                        match serde_json::from_str(&encoded) {
21468                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21469                            Err(error) => {
21470                                dlg.response_json_decode_error(&encoded, &error);
21471                                return Err(common::Error::JsonDecodeError(
21472                                    encoded.to_string(),
21473                                    error,
21474                                ));
21475                            }
21476                        }
21477                    };
21478
21479                    dlg.finished(true);
21480                    return Ok(response);
21481                }
21482            }
21483        }
21484    }
21485
21486    ///
21487    /// Sets the *request* property to the given value.
21488    ///
21489    /// Even though the property as already been set when instantiating this call,
21490    /// we provide this method for API completeness.
21491    pub fn request(
21492        mut self,
21493        new_value: CreateClusterRequest,
21494    ) -> ProjectZoneClusterCreateCall<'a, C> {
21495        self._request = new_value;
21496        self
21497    }
21498    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
21499    ///
21500    /// Sets the *project id* path property to the given value.
21501    ///
21502    /// Even though the property as already been set when instantiating this call,
21503    /// we provide this method for API completeness.
21504    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterCreateCall<'a, C> {
21505        self._project_id = new_value.to_string();
21506        self
21507    }
21508    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the parent field.
21509    ///
21510    /// Sets the *zone* path property to the given value.
21511    ///
21512    /// Even though the property as already been set when instantiating this call,
21513    /// we provide this method for API completeness.
21514    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterCreateCall<'a, C> {
21515        self._zone = new_value.to_string();
21516        self
21517    }
21518    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21519    /// while executing the actual API request.
21520    ///
21521    /// ````text
21522    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21523    /// ````
21524    ///
21525    /// Sets the *delegate* property to the given value.
21526    pub fn delegate(
21527        mut self,
21528        new_value: &'a mut dyn common::Delegate,
21529    ) -> ProjectZoneClusterCreateCall<'a, C> {
21530        self._delegate = Some(new_value);
21531        self
21532    }
21533
21534    /// Set any additional parameter of the query string used in the request.
21535    /// It should be used to set parameters which are not yet available through their own
21536    /// setters.
21537    ///
21538    /// Please note that this method must not be used to set any of the known parameters
21539    /// which have their own setter method. If done anyway, the request will fail.
21540    ///
21541    /// # Additional Parameters
21542    ///
21543    /// * *$.xgafv* (query-string) - V1 error format.
21544    /// * *access_token* (query-string) - OAuth access token.
21545    /// * *alt* (query-string) - Data format for response.
21546    /// * *callback* (query-string) - JSONP
21547    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21548    /// * *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.
21549    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21550    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21551    /// * *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.
21552    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21553    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21554    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterCreateCall<'a, C>
21555    where
21556        T: AsRef<str>,
21557    {
21558        self._additional_params
21559            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21560        self
21561    }
21562
21563    /// Identifies the authorization scope for the method you are building.
21564    ///
21565    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21566    /// [`Scope::CloudPlatform`].
21567    ///
21568    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21569    /// tokens for more than one scope.
21570    ///
21571    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21572    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21573    /// sufficient, a read-write scope will do as well.
21574    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterCreateCall<'a, C>
21575    where
21576        St: AsRef<str>,
21577    {
21578        self._scopes.insert(String::from(scope.as_ref()));
21579        self
21580    }
21581    /// Identifies the authorization scope(s) for the method you are building.
21582    ///
21583    /// See [`Self::add_scope()`] for details.
21584    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterCreateCall<'a, C>
21585    where
21586        I: IntoIterator<Item = St>,
21587        St: AsRef<str>,
21588    {
21589        self._scopes
21590            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21591        self
21592    }
21593
21594    /// Removes all scopes, and no default scope will be used either.
21595    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21596    /// for details).
21597    pub fn clear_scopes(mut self) -> ProjectZoneClusterCreateCall<'a, C> {
21598        self._scopes.clear();
21599        self
21600    }
21601}
21602
21603/// Deletes the cluster, including the Kubernetes endpoint and all worker nodes. Firewalls and routes that were configured during cluster creation are also deleted. Other Google Compute Engine resources that might be in use by the cluster, such as load balancer resources, are not deleted if they weren't present when the cluster was initially created.
21604///
21605/// A builder for the *zones.clusters.delete* method supported by a *project* resource.
21606/// It is not used directly, but through a [`ProjectMethods`] instance.
21607///
21608/// # Example
21609///
21610/// Instantiate a resource method builder
21611///
21612/// ```test_harness,no_run
21613/// # extern crate hyper;
21614/// # extern crate hyper_rustls;
21615/// # extern crate google_container1 as container1;
21616/// # async fn dox() {
21617/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21618///
21619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21620/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21621/// #     secret,
21622/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21623/// # ).build().await.unwrap();
21624///
21625/// # let client = hyper_util::client::legacy::Client::builder(
21626/// #     hyper_util::rt::TokioExecutor::new()
21627/// # )
21628/// # .build(
21629/// #     hyper_rustls::HttpsConnectorBuilder::new()
21630/// #         .with_native_roots()
21631/// #         .unwrap()
21632/// #         .https_or_http()
21633/// #         .enable_http1()
21634/// #         .build()
21635/// # );
21636/// # let mut hub = Container::new(client, auth);
21637/// // You can configure optional parameters by calling the respective setters at will, and
21638/// // execute the final call using `doit()`.
21639/// // Values shown here are possibly random and not representative !
21640/// let result = hub.projects().zones_clusters_delete("projectId", "zone", "clusterId")
21641///              .name("dolores")
21642///              .doit().await;
21643/// # }
21644/// ```
21645pub struct ProjectZoneClusterDeleteCall<'a, C>
21646where
21647    C: 'a,
21648{
21649    hub: &'a Container<C>,
21650    _project_id: String,
21651    _zone: String,
21652    _cluster_id: String,
21653    _name: Option<String>,
21654    _delegate: Option<&'a mut dyn common::Delegate>,
21655    _additional_params: HashMap<String, String>,
21656    _scopes: BTreeSet<String>,
21657}
21658
21659impl<'a, C> common::CallBuilder for ProjectZoneClusterDeleteCall<'a, C> {}
21660
21661impl<'a, C> ProjectZoneClusterDeleteCall<'a, C>
21662where
21663    C: common::Connector,
21664{
21665    /// Perform the operation you have build so far.
21666    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21667        use std::borrow::Cow;
21668        use std::io::{Read, Seek};
21669
21670        use common::{url::Params, ToParts};
21671        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21672
21673        let mut dd = common::DefaultDelegate;
21674        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21675        dlg.begin(common::MethodInfo {
21676            id: "container.projects.zones.clusters.delete",
21677            http_method: hyper::Method::DELETE,
21678        });
21679
21680        for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
21681            if self._additional_params.contains_key(field) {
21682                dlg.finished(false);
21683                return Err(common::Error::FieldClash(field));
21684            }
21685        }
21686
21687        let mut params = Params::with_capacity(6 + self._additional_params.len());
21688        params.push("projectId", self._project_id);
21689        params.push("zone", self._zone);
21690        params.push("clusterId", self._cluster_id);
21691        if let Some(value) = self._name.as_ref() {
21692            params.push("name", value);
21693        }
21694
21695        params.extend(self._additional_params.iter());
21696
21697        params.push("alt", "json");
21698        let mut url = self.hub._base_url.clone()
21699            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
21700        if self._scopes.is_empty() {
21701            self._scopes
21702                .insert(Scope::CloudPlatform.as_ref().to_string());
21703        }
21704
21705        #[allow(clippy::single_element_loop)]
21706        for &(find_this, param_name) in [
21707            ("{projectId}", "projectId"),
21708            ("{zone}", "zone"),
21709            ("{clusterId}", "clusterId"),
21710        ]
21711        .iter()
21712        {
21713            url = params.uri_replacement(url, param_name, find_this, false);
21714        }
21715        {
21716            let to_remove = ["clusterId", "zone", "projectId"];
21717            params.remove_params(&to_remove);
21718        }
21719
21720        let url = params.parse_with_url(&url);
21721
21722        loop {
21723            let token = match self
21724                .hub
21725                .auth
21726                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21727                .await
21728            {
21729                Ok(token) => token,
21730                Err(e) => match dlg.token(e) {
21731                    Ok(token) => token,
21732                    Err(e) => {
21733                        dlg.finished(false);
21734                        return Err(common::Error::MissingToken(e));
21735                    }
21736                },
21737            };
21738            let mut req_result = {
21739                let client = &self.hub.client;
21740                dlg.pre_request();
21741                let mut req_builder = hyper::Request::builder()
21742                    .method(hyper::Method::DELETE)
21743                    .uri(url.as_str())
21744                    .header(USER_AGENT, self.hub._user_agent.clone());
21745
21746                if let Some(token) = token.as_ref() {
21747                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21748                }
21749
21750                let request = req_builder
21751                    .header(CONTENT_LENGTH, 0_u64)
21752                    .body(common::to_body::<String>(None));
21753
21754                client.request(request.unwrap()).await
21755            };
21756
21757            match req_result {
21758                Err(err) => {
21759                    if let common::Retry::After(d) = dlg.http_error(&err) {
21760                        sleep(d).await;
21761                        continue;
21762                    }
21763                    dlg.finished(false);
21764                    return Err(common::Error::HttpError(err));
21765                }
21766                Ok(res) => {
21767                    let (mut parts, body) = res.into_parts();
21768                    let mut body = common::Body::new(body);
21769                    if !parts.status.is_success() {
21770                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21771                        let error = serde_json::from_str(&common::to_string(&bytes));
21772                        let response = common::to_response(parts, bytes.into());
21773
21774                        if let common::Retry::After(d) =
21775                            dlg.http_failure(&response, error.as_ref().ok())
21776                        {
21777                            sleep(d).await;
21778                            continue;
21779                        }
21780
21781                        dlg.finished(false);
21782
21783                        return Err(match error {
21784                            Ok(value) => common::Error::BadRequest(value),
21785                            _ => common::Error::Failure(response),
21786                        });
21787                    }
21788                    let response = {
21789                        let bytes = common::to_bytes(body).await.unwrap_or_default();
21790                        let encoded = common::to_string(&bytes);
21791                        match serde_json::from_str(&encoded) {
21792                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21793                            Err(error) => {
21794                                dlg.response_json_decode_error(&encoded, &error);
21795                                return Err(common::Error::JsonDecodeError(
21796                                    encoded.to_string(),
21797                                    error,
21798                                ));
21799                            }
21800                        }
21801                    };
21802
21803                    dlg.finished(true);
21804                    return Ok(response);
21805                }
21806            }
21807        }
21808    }
21809
21810    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
21811    ///
21812    /// Sets the *project id* path property to the given value.
21813    ///
21814    /// Even though the property as already been set when instantiating this call,
21815    /// we provide this method for API completeness.
21816    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
21817        self._project_id = new_value.to_string();
21818        self
21819    }
21820    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
21821    ///
21822    /// Sets the *zone* path property to the given value.
21823    ///
21824    /// Even though the property as already been set when instantiating this call,
21825    /// we provide this method for API completeness.
21826    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
21827        self._zone = new_value.to_string();
21828        self
21829    }
21830    /// Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
21831    ///
21832    /// Sets the *cluster id* path property to the given value.
21833    ///
21834    /// Even though the property as already been set when instantiating this call,
21835    /// we provide this method for API completeness.
21836    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
21837        self._cluster_id = new_value.to_string();
21838        self
21839    }
21840    /// The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
21841    ///
21842    /// Sets the *name* query property to the given value.
21843    pub fn name(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
21844        self._name = Some(new_value.to_string());
21845        self
21846    }
21847    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21848    /// while executing the actual API request.
21849    ///
21850    /// ````text
21851    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
21852    /// ````
21853    ///
21854    /// Sets the *delegate* property to the given value.
21855    pub fn delegate(
21856        mut self,
21857        new_value: &'a mut dyn common::Delegate,
21858    ) -> ProjectZoneClusterDeleteCall<'a, C> {
21859        self._delegate = Some(new_value);
21860        self
21861    }
21862
21863    /// Set any additional parameter of the query string used in the request.
21864    /// It should be used to set parameters which are not yet available through their own
21865    /// setters.
21866    ///
21867    /// Please note that this method must not be used to set any of the known parameters
21868    /// which have their own setter method. If done anyway, the request will fail.
21869    ///
21870    /// # Additional Parameters
21871    ///
21872    /// * *$.xgafv* (query-string) - V1 error format.
21873    /// * *access_token* (query-string) - OAuth access token.
21874    /// * *alt* (query-string) - Data format for response.
21875    /// * *callback* (query-string) - JSONP
21876    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21877    /// * *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.
21878    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21879    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21880    /// * *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.
21881    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21882    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21883    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterDeleteCall<'a, C>
21884    where
21885        T: AsRef<str>,
21886    {
21887        self._additional_params
21888            .insert(name.as_ref().to_string(), value.as_ref().to_string());
21889        self
21890    }
21891
21892    /// Identifies the authorization scope for the method you are building.
21893    ///
21894    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21895    /// [`Scope::CloudPlatform`].
21896    ///
21897    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21898    /// tokens for more than one scope.
21899    ///
21900    /// Usually there is more than one suitable scope to authorize an operation, some of which may
21901    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21902    /// sufficient, a read-write scope will do as well.
21903    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterDeleteCall<'a, C>
21904    where
21905        St: AsRef<str>,
21906    {
21907        self._scopes.insert(String::from(scope.as_ref()));
21908        self
21909    }
21910    /// Identifies the authorization scope(s) for the method you are building.
21911    ///
21912    /// See [`Self::add_scope()`] for details.
21913    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterDeleteCall<'a, C>
21914    where
21915        I: IntoIterator<Item = St>,
21916        St: AsRef<str>,
21917    {
21918        self._scopes
21919            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21920        self
21921    }
21922
21923    /// Removes all scopes, and no default scope will be used either.
21924    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21925    /// for details).
21926    pub fn clear_scopes(mut self) -> ProjectZoneClusterDeleteCall<'a, C> {
21927        self._scopes.clear();
21928        self
21929    }
21930}
21931
21932/// Gets the details of a specific cluster.
21933///
21934/// A builder for the *zones.clusters.get* method supported by a *project* resource.
21935/// It is not used directly, but through a [`ProjectMethods`] instance.
21936///
21937/// # Example
21938///
21939/// Instantiate a resource method builder
21940///
21941/// ```test_harness,no_run
21942/// # extern crate hyper;
21943/// # extern crate hyper_rustls;
21944/// # extern crate google_container1 as container1;
21945/// # async fn dox() {
21946/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21947///
21948/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21949/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
21950/// #     secret,
21951/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21952/// # ).build().await.unwrap();
21953///
21954/// # let client = hyper_util::client::legacy::Client::builder(
21955/// #     hyper_util::rt::TokioExecutor::new()
21956/// # )
21957/// # .build(
21958/// #     hyper_rustls::HttpsConnectorBuilder::new()
21959/// #         .with_native_roots()
21960/// #         .unwrap()
21961/// #         .https_or_http()
21962/// #         .enable_http1()
21963/// #         .build()
21964/// # );
21965/// # let mut hub = Container::new(client, auth);
21966/// // You can configure optional parameters by calling the respective setters at will, and
21967/// // execute the final call using `doit()`.
21968/// // Values shown here are possibly random and not representative !
21969/// let result = hub.projects().zones_clusters_get("projectId", "zone", "clusterId")
21970///              .name("amet")
21971///              .doit().await;
21972/// # }
21973/// ```
21974pub struct ProjectZoneClusterGetCall<'a, C>
21975where
21976    C: 'a,
21977{
21978    hub: &'a Container<C>,
21979    _project_id: String,
21980    _zone: String,
21981    _cluster_id: String,
21982    _name: Option<String>,
21983    _delegate: Option<&'a mut dyn common::Delegate>,
21984    _additional_params: HashMap<String, String>,
21985    _scopes: BTreeSet<String>,
21986}
21987
21988impl<'a, C> common::CallBuilder for ProjectZoneClusterGetCall<'a, C> {}
21989
21990impl<'a, C> ProjectZoneClusterGetCall<'a, C>
21991where
21992    C: common::Connector,
21993{
21994    /// Perform the operation you have build so far.
21995    pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
21996        use std::borrow::Cow;
21997        use std::io::{Read, Seek};
21998
21999        use common::{url::Params, ToParts};
22000        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22001
22002        let mut dd = common::DefaultDelegate;
22003        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22004        dlg.begin(common::MethodInfo {
22005            id: "container.projects.zones.clusters.get",
22006            http_method: hyper::Method::GET,
22007        });
22008
22009        for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
22010            if self._additional_params.contains_key(field) {
22011                dlg.finished(false);
22012                return Err(common::Error::FieldClash(field));
22013            }
22014        }
22015
22016        let mut params = Params::with_capacity(6 + self._additional_params.len());
22017        params.push("projectId", self._project_id);
22018        params.push("zone", self._zone);
22019        params.push("clusterId", self._cluster_id);
22020        if let Some(value) = self._name.as_ref() {
22021            params.push("name", value);
22022        }
22023
22024        params.extend(self._additional_params.iter());
22025
22026        params.push("alt", "json");
22027        let mut url = self.hub._base_url.clone()
22028            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
22029        if self._scopes.is_empty() {
22030            self._scopes
22031                .insert(Scope::CloudPlatform.as_ref().to_string());
22032        }
22033
22034        #[allow(clippy::single_element_loop)]
22035        for &(find_this, param_name) in [
22036            ("{projectId}", "projectId"),
22037            ("{zone}", "zone"),
22038            ("{clusterId}", "clusterId"),
22039        ]
22040        .iter()
22041        {
22042            url = params.uri_replacement(url, param_name, find_this, false);
22043        }
22044        {
22045            let to_remove = ["clusterId", "zone", "projectId"];
22046            params.remove_params(&to_remove);
22047        }
22048
22049        let url = params.parse_with_url(&url);
22050
22051        loop {
22052            let token = match self
22053                .hub
22054                .auth
22055                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22056                .await
22057            {
22058                Ok(token) => token,
22059                Err(e) => match dlg.token(e) {
22060                    Ok(token) => token,
22061                    Err(e) => {
22062                        dlg.finished(false);
22063                        return Err(common::Error::MissingToken(e));
22064                    }
22065                },
22066            };
22067            let mut req_result = {
22068                let client = &self.hub.client;
22069                dlg.pre_request();
22070                let mut req_builder = hyper::Request::builder()
22071                    .method(hyper::Method::GET)
22072                    .uri(url.as_str())
22073                    .header(USER_AGENT, self.hub._user_agent.clone());
22074
22075                if let Some(token) = token.as_ref() {
22076                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22077                }
22078
22079                let request = req_builder
22080                    .header(CONTENT_LENGTH, 0_u64)
22081                    .body(common::to_body::<String>(None));
22082
22083                client.request(request.unwrap()).await
22084            };
22085
22086            match req_result {
22087                Err(err) => {
22088                    if let common::Retry::After(d) = dlg.http_error(&err) {
22089                        sleep(d).await;
22090                        continue;
22091                    }
22092                    dlg.finished(false);
22093                    return Err(common::Error::HttpError(err));
22094                }
22095                Ok(res) => {
22096                    let (mut parts, body) = res.into_parts();
22097                    let mut body = common::Body::new(body);
22098                    if !parts.status.is_success() {
22099                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22100                        let error = serde_json::from_str(&common::to_string(&bytes));
22101                        let response = common::to_response(parts, bytes.into());
22102
22103                        if let common::Retry::After(d) =
22104                            dlg.http_failure(&response, error.as_ref().ok())
22105                        {
22106                            sleep(d).await;
22107                            continue;
22108                        }
22109
22110                        dlg.finished(false);
22111
22112                        return Err(match error {
22113                            Ok(value) => common::Error::BadRequest(value),
22114                            _ => common::Error::Failure(response),
22115                        });
22116                    }
22117                    let response = {
22118                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22119                        let encoded = common::to_string(&bytes);
22120                        match serde_json::from_str(&encoded) {
22121                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22122                            Err(error) => {
22123                                dlg.response_json_decode_error(&encoded, &error);
22124                                return Err(common::Error::JsonDecodeError(
22125                                    encoded.to_string(),
22126                                    error,
22127                                ));
22128                            }
22129                        }
22130                    };
22131
22132                    dlg.finished(true);
22133                    return Ok(response);
22134                }
22135            }
22136        }
22137    }
22138
22139    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
22140    ///
22141    /// Sets the *project id* path property to the given value.
22142    ///
22143    /// Even though the property as already been set when instantiating this call,
22144    /// we provide this method for API completeness.
22145    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
22146        self._project_id = new_value.to_string();
22147        self
22148    }
22149    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
22150    ///
22151    /// Sets the *zone* path property to the given value.
22152    ///
22153    /// Even though the property as already been set when instantiating this call,
22154    /// we provide this method for API completeness.
22155    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
22156        self._zone = new_value.to_string();
22157        self
22158    }
22159    /// Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
22160    ///
22161    /// Sets the *cluster id* path property to the given value.
22162    ///
22163    /// Even though the property as already been set when instantiating this call,
22164    /// we provide this method for API completeness.
22165    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
22166        self._cluster_id = new_value.to_string();
22167        self
22168    }
22169    /// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
22170    ///
22171    /// Sets the *name* query property to the given value.
22172    pub fn name(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
22173        self._name = Some(new_value.to_string());
22174        self
22175    }
22176    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22177    /// while executing the actual API request.
22178    ///
22179    /// ````text
22180    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22181    /// ````
22182    ///
22183    /// Sets the *delegate* property to the given value.
22184    pub fn delegate(
22185        mut self,
22186        new_value: &'a mut dyn common::Delegate,
22187    ) -> ProjectZoneClusterGetCall<'a, C> {
22188        self._delegate = Some(new_value);
22189        self
22190    }
22191
22192    /// Set any additional parameter of the query string used in the request.
22193    /// It should be used to set parameters which are not yet available through their own
22194    /// setters.
22195    ///
22196    /// Please note that this method must not be used to set any of the known parameters
22197    /// which have their own setter method. If done anyway, the request will fail.
22198    ///
22199    /// # Additional Parameters
22200    ///
22201    /// * *$.xgafv* (query-string) - V1 error format.
22202    /// * *access_token* (query-string) - OAuth access token.
22203    /// * *alt* (query-string) - Data format for response.
22204    /// * *callback* (query-string) - JSONP
22205    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22206    /// * *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.
22207    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22208    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22209    /// * *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.
22210    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22211    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22212    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterGetCall<'a, C>
22213    where
22214        T: AsRef<str>,
22215    {
22216        self._additional_params
22217            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22218        self
22219    }
22220
22221    /// Identifies the authorization scope for the method you are building.
22222    ///
22223    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22224    /// [`Scope::CloudPlatform`].
22225    ///
22226    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22227    /// tokens for more than one scope.
22228    ///
22229    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22230    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22231    /// sufficient, a read-write scope will do as well.
22232    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterGetCall<'a, C>
22233    where
22234        St: AsRef<str>,
22235    {
22236        self._scopes.insert(String::from(scope.as_ref()));
22237        self
22238    }
22239    /// Identifies the authorization scope(s) for the method you are building.
22240    ///
22241    /// See [`Self::add_scope()`] for details.
22242    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterGetCall<'a, C>
22243    where
22244        I: IntoIterator<Item = St>,
22245        St: AsRef<str>,
22246    {
22247        self._scopes
22248            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22249        self
22250    }
22251
22252    /// Removes all scopes, and no default scope will be used either.
22253    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22254    /// for details).
22255    pub fn clear_scopes(mut self) -> ProjectZoneClusterGetCall<'a, C> {
22256        self._scopes.clear();
22257        self
22258    }
22259}
22260
22261/// Enables or disables the ABAC authorization mechanism on a cluster.
22262///
22263/// A builder for the *zones.clusters.legacyAbac* method supported by a *project* resource.
22264/// It is not used directly, but through a [`ProjectMethods`] instance.
22265///
22266/// # Example
22267///
22268/// Instantiate a resource method builder
22269///
22270/// ```test_harness,no_run
22271/// # extern crate hyper;
22272/// # extern crate hyper_rustls;
22273/// # extern crate google_container1 as container1;
22274/// use container1::api::SetLegacyAbacRequest;
22275/// # async fn dox() {
22276/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22277///
22278/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22279/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22280/// #     secret,
22281/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22282/// # ).build().await.unwrap();
22283///
22284/// # let client = hyper_util::client::legacy::Client::builder(
22285/// #     hyper_util::rt::TokioExecutor::new()
22286/// # )
22287/// # .build(
22288/// #     hyper_rustls::HttpsConnectorBuilder::new()
22289/// #         .with_native_roots()
22290/// #         .unwrap()
22291/// #         .https_or_http()
22292/// #         .enable_http1()
22293/// #         .build()
22294/// # );
22295/// # let mut hub = Container::new(client, auth);
22296/// // As the method needs a request, you would usually fill it with the desired information
22297/// // into the respective structure. Some of the parts shown here might not be applicable !
22298/// // Values shown here are possibly random and not representative !
22299/// let mut req = SetLegacyAbacRequest::default();
22300///
22301/// // You can configure optional parameters by calling the respective setters at will, and
22302/// // execute the final call using `doit()`.
22303/// // Values shown here are possibly random and not representative !
22304/// let result = hub.projects().zones_clusters_legacy_abac(req, "projectId", "zone", "clusterId")
22305///              .doit().await;
22306/// # }
22307/// ```
22308pub struct ProjectZoneClusterLegacyAbacCall<'a, C>
22309where
22310    C: 'a,
22311{
22312    hub: &'a Container<C>,
22313    _request: SetLegacyAbacRequest,
22314    _project_id: String,
22315    _zone: String,
22316    _cluster_id: String,
22317    _delegate: Option<&'a mut dyn common::Delegate>,
22318    _additional_params: HashMap<String, String>,
22319    _scopes: BTreeSet<String>,
22320}
22321
22322impl<'a, C> common::CallBuilder for ProjectZoneClusterLegacyAbacCall<'a, C> {}
22323
22324impl<'a, C> ProjectZoneClusterLegacyAbacCall<'a, C>
22325where
22326    C: common::Connector,
22327{
22328    /// Perform the operation you have build so far.
22329    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22330        use std::borrow::Cow;
22331        use std::io::{Read, Seek};
22332
22333        use common::{url::Params, ToParts};
22334        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22335
22336        let mut dd = common::DefaultDelegate;
22337        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22338        dlg.begin(common::MethodInfo {
22339            id: "container.projects.zones.clusters.legacyAbac",
22340            http_method: hyper::Method::POST,
22341        });
22342
22343        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
22344            if self._additional_params.contains_key(field) {
22345                dlg.finished(false);
22346                return Err(common::Error::FieldClash(field));
22347            }
22348        }
22349
22350        let mut params = Params::with_capacity(6 + self._additional_params.len());
22351        params.push("projectId", self._project_id);
22352        params.push("zone", self._zone);
22353        params.push("clusterId", self._cluster_id);
22354
22355        params.extend(self._additional_params.iter());
22356
22357        params.push("alt", "json");
22358        let mut url = self.hub._base_url.clone()
22359            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/legacyAbac";
22360        if self._scopes.is_empty() {
22361            self._scopes
22362                .insert(Scope::CloudPlatform.as_ref().to_string());
22363        }
22364
22365        #[allow(clippy::single_element_loop)]
22366        for &(find_this, param_name) in [
22367            ("{projectId}", "projectId"),
22368            ("{zone}", "zone"),
22369            ("{clusterId}", "clusterId"),
22370        ]
22371        .iter()
22372        {
22373            url = params.uri_replacement(url, param_name, find_this, false);
22374        }
22375        {
22376            let to_remove = ["clusterId", "zone", "projectId"];
22377            params.remove_params(&to_remove);
22378        }
22379
22380        let url = params.parse_with_url(&url);
22381
22382        let mut json_mime_type = mime::APPLICATION_JSON;
22383        let mut request_value_reader = {
22384            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22385            common::remove_json_null_values(&mut value);
22386            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22387            serde_json::to_writer(&mut dst, &value).unwrap();
22388            dst
22389        };
22390        let request_size = request_value_reader
22391            .seek(std::io::SeekFrom::End(0))
22392            .unwrap();
22393        request_value_reader
22394            .seek(std::io::SeekFrom::Start(0))
22395            .unwrap();
22396
22397        loop {
22398            let token = match self
22399                .hub
22400                .auth
22401                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22402                .await
22403            {
22404                Ok(token) => token,
22405                Err(e) => match dlg.token(e) {
22406                    Ok(token) => token,
22407                    Err(e) => {
22408                        dlg.finished(false);
22409                        return Err(common::Error::MissingToken(e));
22410                    }
22411                },
22412            };
22413            request_value_reader
22414                .seek(std::io::SeekFrom::Start(0))
22415                .unwrap();
22416            let mut req_result = {
22417                let client = &self.hub.client;
22418                dlg.pre_request();
22419                let mut req_builder = hyper::Request::builder()
22420                    .method(hyper::Method::POST)
22421                    .uri(url.as_str())
22422                    .header(USER_AGENT, self.hub._user_agent.clone());
22423
22424                if let Some(token) = token.as_ref() {
22425                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22426                }
22427
22428                let request = req_builder
22429                    .header(CONTENT_TYPE, json_mime_type.to_string())
22430                    .header(CONTENT_LENGTH, request_size as u64)
22431                    .body(common::to_body(
22432                        request_value_reader.get_ref().clone().into(),
22433                    ));
22434
22435                client.request(request.unwrap()).await
22436            };
22437
22438            match req_result {
22439                Err(err) => {
22440                    if let common::Retry::After(d) = dlg.http_error(&err) {
22441                        sleep(d).await;
22442                        continue;
22443                    }
22444                    dlg.finished(false);
22445                    return Err(common::Error::HttpError(err));
22446                }
22447                Ok(res) => {
22448                    let (mut parts, body) = res.into_parts();
22449                    let mut body = common::Body::new(body);
22450                    if !parts.status.is_success() {
22451                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22452                        let error = serde_json::from_str(&common::to_string(&bytes));
22453                        let response = common::to_response(parts, bytes.into());
22454
22455                        if let common::Retry::After(d) =
22456                            dlg.http_failure(&response, error.as_ref().ok())
22457                        {
22458                            sleep(d).await;
22459                            continue;
22460                        }
22461
22462                        dlg.finished(false);
22463
22464                        return Err(match error {
22465                            Ok(value) => common::Error::BadRequest(value),
22466                            _ => common::Error::Failure(response),
22467                        });
22468                    }
22469                    let response = {
22470                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22471                        let encoded = common::to_string(&bytes);
22472                        match serde_json::from_str(&encoded) {
22473                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22474                            Err(error) => {
22475                                dlg.response_json_decode_error(&encoded, &error);
22476                                return Err(common::Error::JsonDecodeError(
22477                                    encoded.to_string(),
22478                                    error,
22479                                ));
22480                            }
22481                        }
22482                    };
22483
22484                    dlg.finished(true);
22485                    return Ok(response);
22486                }
22487            }
22488        }
22489    }
22490
22491    ///
22492    /// Sets the *request* property to the given value.
22493    ///
22494    /// Even though the property as already been set when instantiating this call,
22495    /// we provide this method for API completeness.
22496    pub fn request(
22497        mut self,
22498        new_value: SetLegacyAbacRequest,
22499    ) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
22500        self._request = new_value;
22501        self
22502    }
22503    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
22504    ///
22505    /// Sets the *project id* path property to the given value.
22506    ///
22507    /// Even though the property as already been set when instantiating this call,
22508    /// we provide this method for API completeness.
22509    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
22510        self._project_id = new_value.to_string();
22511        self
22512    }
22513    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
22514    ///
22515    /// Sets the *zone* path property to the given value.
22516    ///
22517    /// Even though the property as already been set when instantiating this call,
22518    /// we provide this method for API completeness.
22519    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
22520        self._zone = new_value.to_string();
22521        self
22522    }
22523    /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
22524    ///
22525    /// Sets the *cluster id* path property to the given value.
22526    ///
22527    /// Even though the property as already been set when instantiating this call,
22528    /// we provide this method for API completeness.
22529    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
22530        self._cluster_id = new_value.to_string();
22531        self
22532    }
22533    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22534    /// while executing the actual API request.
22535    ///
22536    /// ````text
22537    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22538    /// ````
22539    ///
22540    /// Sets the *delegate* property to the given value.
22541    pub fn delegate(
22542        mut self,
22543        new_value: &'a mut dyn common::Delegate,
22544    ) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
22545        self._delegate = Some(new_value);
22546        self
22547    }
22548
22549    /// Set any additional parameter of the query string used in the request.
22550    /// It should be used to set parameters which are not yet available through their own
22551    /// setters.
22552    ///
22553    /// Please note that this method must not be used to set any of the known parameters
22554    /// which have their own setter method. If done anyway, the request will fail.
22555    ///
22556    /// # Additional Parameters
22557    ///
22558    /// * *$.xgafv* (query-string) - V1 error format.
22559    /// * *access_token* (query-string) - OAuth access token.
22560    /// * *alt* (query-string) - Data format for response.
22561    /// * *callback* (query-string) - JSONP
22562    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22563    /// * *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.
22564    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22565    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22566    /// * *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.
22567    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22568    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22569    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLegacyAbacCall<'a, C>
22570    where
22571        T: AsRef<str>,
22572    {
22573        self._additional_params
22574            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22575        self
22576    }
22577
22578    /// Identifies the authorization scope for the method you are building.
22579    ///
22580    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22581    /// [`Scope::CloudPlatform`].
22582    ///
22583    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22584    /// tokens for more than one scope.
22585    ///
22586    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22587    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22588    /// sufficient, a read-write scope will do as well.
22589    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLegacyAbacCall<'a, C>
22590    where
22591        St: AsRef<str>,
22592    {
22593        self._scopes.insert(String::from(scope.as_ref()));
22594        self
22595    }
22596    /// Identifies the authorization scope(s) for the method you are building.
22597    ///
22598    /// See [`Self::add_scope()`] for details.
22599    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLegacyAbacCall<'a, C>
22600    where
22601        I: IntoIterator<Item = St>,
22602        St: AsRef<str>,
22603    {
22604        self._scopes
22605            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22606        self
22607    }
22608
22609    /// Removes all scopes, and no default scope will be used either.
22610    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22611    /// for details).
22612    pub fn clear_scopes(mut self) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
22613        self._scopes.clear();
22614        self
22615    }
22616}
22617
22618/// Lists all clusters owned by a project in either the specified zone or all zones.
22619///
22620/// A builder for the *zones.clusters.list* method supported by a *project* resource.
22621/// It is not used directly, but through a [`ProjectMethods`] instance.
22622///
22623/// # Example
22624///
22625/// Instantiate a resource method builder
22626///
22627/// ```test_harness,no_run
22628/// # extern crate hyper;
22629/// # extern crate hyper_rustls;
22630/// # extern crate google_container1 as container1;
22631/// # async fn dox() {
22632/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22633///
22634/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22635/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22636/// #     secret,
22637/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22638/// # ).build().await.unwrap();
22639///
22640/// # let client = hyper_util::client::legacy::Client::builder(
22641/// #     hyper_util::rt::TokioExecutor::new()
22642/// # )
22643/// # .build(
22644/// #     hyper_rustls::HttpsConnectorBuilder::new()
22645/// #         .with_native_roots()
22646/// #         .unwrap()
22647/// #         .https_or_http()
22648/// #         .enable_http1()
22649/// #         .build()
22650/// # );
22651/// # let mut hub = Container::new(client, auth);
22652/// // You can configure optional parameters by calling the respective setters at will, and
22653/// // execute the final call using `doit()`.
22654/// // Values shown here are possibly random and not representative !
22655/// let result = hub.projects().zones_clusters_list("projectId", "zone")
22656///              .parent("Stet")
22657///              .doit().await;
22658/// # }
22659/// ```
22660pub struct ProjectZoneClusterListCall<'a, C>
22661where
22662    C: 'a,
22663{
22664    hub: &'a Container<C>,
22665    _project_id: String,
22666    _zone: String,
22667    _parent: Option<String>,
22668    _delegate: Option<&'a mut dyn common::Delegate>,
22669    _additional_params: HashMap<String, String>,
22670    _scopes: BTreeSet<String>,
22671}
22672
22673impl<'a, C> common::CallBuilder for ProjectZoneClusterListCall<'a, C> {}
22674
22675impl<'a, C> ProjectZoneClusterListCall<'a, C>
22676where
22677    C: common::Connector,
22678{
22679    /// Perform the operation you have build so far.
22680    pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
22681        use std::borrow::Cow;
22682        use std::io::{Read, Seek};
22683
22684        use common::{url::Params, ToParts};
22685        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22686
22687        let mut dd = common::DefaultDelegate;
22688        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22689        dlg.begin(common::MethodInfo {
22690            id: "container.projects.zones.clusters.list",
22691            http_method: hyper::Method::GET,
22692        });
22693
22694        for &field in ["alt", "projectId", "zone", "parent"].iter() {
22695            if self._additional_params.contains_key(field) {
22696                dlg.finished(false);
22697                return Err(common::Error::FieldClash(field));
22698            }
22699        }
22700
22701        let mut params = Params::with_capacity(5 + self._additional_params.len());
22702        params.push("projectId", self._project_id);
22703        params.push("zone", self._zone);
22704        if let Some(value) = self._parent.as_ref() {
22705            params.push("parent", value);
22706        }
22707
22708        params.extend(self._additional_params.iter());
22709
22710        params.push("alt", "json");
22711        let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
22712        if self._scopes.is_empty() {
22713            self._scopes
22714                .insert(Scope::CloudPlatform.as_ref().to_string());
22715        }
22716
22717        #[allow(clippy::single_element_loop)]
22718        for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
22719            url = params.uri_replacement(url, param_name, find_this, false);
22720        }
22721        {
22722            let to_remove = ["zone", "projectId"];
22723            params.remove_params(&to_remove);
22724        }
22725
22726        let url = params.parse_with_url(&url);
22727
22728        loop {
22729            let token = match self
22730                .hub
22731                .auth
22732                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22733                .await
22734            {
22735                Ok(token) => token,
22736                Err(e) => match dlg.token(e) {
22737                    Ok(token) => token,
22738                    Err(e) => {
22739                        dlg.finished(false);
22740                        return Err(common::Error::MissingToken(e));
22741                    }
22742                },
22743            };
22744            let mut req_result = {
22745                let client = &self.hub.client;
22746                dlg.pre_request();
22747                let mut req_builder = hyper::Request::builder()
22748                    .method(hyper::Method::GET)
22749                    .uri(url.as_str())
22750                    .header(USER_AGENT, self.hub._user_agent.clone());
22751
22752                if let Some(token) = token.as_ref() {
22753                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22754                }
22755
22756                let request = req_builder
22757                    .header(CONTENT_LENGTH, 0_u64)
22758                    .body(common::to_body::<String>(None));
22759
22760                client.request(request.unwrap()).await
22761            };
22762
22763            match req_result {
22764                Err(err) => {
22765                    if let common::Retry::After(d) = dlg.http_error(&err) {
22766                        sleep(d).await;
22767                        continue;
22768                    }
22769                    dlg.finished(false);
22770                    return Err(common::Error::HttpError(err));
22771                }
22772                Ok(res) => {
22773                    let (mut parts, body) = res.into_parts();
22774                    let mut body = common::Body::new(body);
22775                    if !parts.status.is_success() {
22776                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22777                        let error = serde_json::from_str(&common::to_string(&bytes));
22778                        let response = common::to_response(parts, bytes.into());
22779
22780                        if let common::Retry::After(d) =
22781                            dlg.http_failure(&response, error.as_ref().ok())
22782                        {
22783                            sleep(d).await;
22784                            continue;
22785                        }
22786
22787                        dlg.finished(false);
22788
22789                        return Err(match error {
22790                            Ok(value) => common::Error::BadRequest(value),
22791                            _ => common::Error::Failure(response),
22792                        });
22793                    }
22794                    let response = {
22795                        let bytes = common::to_bytes(body).await.unwrap_or_default();
22796                        let encoded = common::to_string(&bytes);
22797                        match serde_json::from_str(&encoded) {
22798                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22799                            Err(error) => {
22800                                dlg.response_json_decode_error(&encoded, &error);
22801                                return Err(common::Error::JsonDecodeError(
22802                                    encoded.to_string(),
22803                                    error,
22804                                ));
22805                            }
22806                        }
22807                    };
22808
22809                    dlg.finished(true);
22810                    return Ok(response);
22811                }
22812            }
22813        }
22814    }
22815
22816    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
22817    ///
22818    /// Sets the *project id* path property to the given value.
22819    ///
22820    /// Even though the property as already been set when instantiating this call,
22821    /// we provide this method for API completeness.
22822    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
22823        self._project_id = new_value.to_string();
22824        self
22825    }
22826    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides, or "-" for all zones. This field has been deprecated and replaced by the parent field.
22827    ///
22828    /// Sets the *zone* path property to the given value.
22829    ///
22830    /// Even though the property as already been set when instantiating this call,
22831    /// we provide this method for API completeness.
22832    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
22833        self._zone = new_value.to_string();
22834        self
22835    }
22836    /// The parent (project and location) where the clusters will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
22837    ///
22838    /// Sets the *parent* query property to the given value.
22839    pub fn parent(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
22840        self._parent = Some(new_value.to_string());
22841        self
22842    }
22843    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22844    /// while executing the actual API request.
22845    ///
22846    /// ````text
22847    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
22848    /// ````
22849    ///
22850    /// Sets the *delegate* property to the given value.
22851    pub fn delegate(
22852        mut self,
22853        new_value: &'a mut dyn common::Delegate,
22854    ) -> ProjectZoneClusterListCall<'a, C> {
22855        self._delegate = Some(new_value);
22856        self
22857    }
22858
22859    /// Set any additional parameter of the query string used in the request.
22860    /// It should be used to set parameters which are not yet available through their own
22861    /// setters.
22862    ///
22863    /// Please note that this method must not be used to set any of the known parameters
22864    /// which have their own setter method. If done anyway, the request will fail.
22865    ///
22866    /// # Additional Parameters
22867    ///
22868    /// * *$.xgafv* (query-string) - V1 error format.
22869    /// * *access_token* (query-string) - OAuth access token.
22870    /// * *alt* (query-string) - Data format for response.
22871    /// * *callback* (query-string) - JSONP
22872    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22873    /// * *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.
22874    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22875    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22876    /// * *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.
22877    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22878    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22879    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterListCall<'a, C>
22880    where
22881        T: AsRef<str>,
22882    {
22883        self._additional_params
22884            .insert(name.as_ref().to_string(), value.as_ref().to_string());
22885        self
22886    }
22887
22888    /// Identifies the authorization scope for the method you are building.
22889    ///
22890    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22891    /// [`Scope::CloudPlatform`].
22892    ///
22893    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22894    /// tokens for more than one scope.
22895    ///
22896    /// Usually there is more than one suitable scope to authorize an operation, some of which may
22897    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22898    /// sufficient, a read-write scope will do as well.
22899    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterListCall<'a, C>
22900    where
22901        St: AsRef<str>,
22902    {
22903        self._scopes.insert(String::from(scope.as_ref()));
22904        self
22905    }
22906    /// Identifies the authorization scope(s) for the method you are building.
22907    ///
22908    /// See [`Self::add_scope()`] for details.
22909    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterListCall<'a, C>
22910    where
22911        I: IntoIterator<Item = St>,
22912        St: AsRef<str>,
22913    {
22914        self._scopes
22915            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22916        self
22917    }
22918
22919    /// Removes all scopes, and no default scope will be used either.
22920    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22921    /// for details).
22922    pub fn clear_scopes(mut self) -> ProjectZoneClusterListCall<'a, C> {
22923        self._scopes.clear();
22924        self
22925    }
22926}
22927
22928/// Sets the locations for a specific cluster. Deprecated. Use [projects.locations.clusters.update](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/update) instead.
22929///
22930/// A builder for the *zones.clusters.locations* method supported by a *project* resource.
22931/// It is not used directly, but through a [`ProjectMethods`] instance.
22932///
22933/// # Example
22934///
22935/// Instantiate a resource method builder
22936///
22937/// ```test_harness,no_run
22938/// # extern crate hyper;
22939/// # extern crate hyper_rustls;
22940/// # extern crate google_container1 as container1;
22941/// use container1::api::SetLocationsRequest;
22942/// # async fn dox() {
22943/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22944///
22945/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22946/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
22947/// #     secret,
22948/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22949/// # ).build().await.unwrap();
22950///
22951/// # let client = hyper_util::client::legacy::Client::builder(
22952/// #     hyper_util::rt::TokioExecutor::new()
22953/// # )
22954/// # .build(
22955/// #     hyper_rustls::HttpsConnectorBuilder::new()
22956/// #         .with_native_roots()
22957/// #         .unwrap()
22958/// #         .https_or_http()
22959/// #         .enable_http1()
22960/// #         .build()
22961/// # );
22962/// # let mut hub = Container::new(client, auth);
22963/// // As the method needs a request, you would usually fill it with the desired information
22964/// // into the respective structure. Some of the parts shown here might not be applicable !
22965/// // Values shown here are possibly random and not representative !
22966/// let mut req = SetLocationsRequest::default();
22967///
22968/// // You can configure optional parameters by calling the respective setters at will, and
22969/// // execute the final call using `doit()`.
22970/// // Values shown here are possibly random and not representative !
22971/// let result = hub.projects().zones_clusters_locations(req, "projectId", "zone", "clusterId")
22972///              .doit().await;
22973/// # }
22974/// ```
22975pub struct ProjectZoneClusterLocationCall<'a, C>
22976where
22977    C: 'a,
22978{
22979    hub: &'a Container<C>,
22980    _request: SetLocationsRequest,
22981    _project_id: String,
22982    _zone: String,
22983    _cluster_id: String,
22984    _delegate: Option<&'a mut dyn common::Delegate>,
22985    _additional_params: HashMap<String, String>,
22986    _scopes: BTreeSet<String>,
22987}
22988
22989impl<'a, C> common::CallBuilder for ProjectZoneClusterLocationCall<'a, C> {}
22990
22991impl<'a, C> ProjectZoneClusterLocationCall<'a, C>
22992where
22993    C: common::Connector,
22994{
22995    /// Perform the operation you have build so far.
22996    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22997        use std::borrow::Cow;
22998        use std::io::{Read, Seek};
22999
23000        use common::{url::Params, ToParts};
23001        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23002
23003        let mut dd = common::DefaultDelegate;
23004        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23005        dlg.begin(common::MethodInfo {
23006            id: "container.projects.zones.clusters.locations",
23007            http_method: hyper::Method::POST,
23008        });
23009
23010        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
23011            if self._additional_params.contains_key(field) {
23012                dlg.finished(false);
23013                return Err(common::Error::FieldClash(field));
23014            }
23015        }
23016
23017        let mut params = Params::with_capacity(6 + self._additional_params.len());
23018        params.push("projectId", self._project_id);
23019        params.push("zone", self._zone);
23020        params.push("clusterId", self._cluster_id);
23021
23022        params.extend(self._additional_params.iter());
23023
23024        params.push("alt", "json");
23025        let mut url = self.hub._base_url.clone()
23026            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/locations";
23027        if self._scopes.is_empty() {
23028            self._scopes
23029                .insert(Scope::CloudPlatform.as_ref().to_string());
23030        }
23031
23032        #[allow(clippy::single_element_loop)]
23033        for &(find_this, param_name) in [
23034            ("{projectId}", "projectId"),
23035            ("{zone}", "zone"),
23036            ("{clusterId}", "clusterId"),
23037        ]
23038        .iter()
23039        {
23040            url = params.uri_replacement(url, param_name, find_this, false);
23041        }
23042        {
23043            let to_remove = ["clusterId", "zone", "projectId"];
23044            params.remove_params(&to_remove);
23045        }
23046
23047        let url = params.parse_with_url(&url);
23048
23049        let mut json_mime_type = mime::APPLICATION_JSON;
23050        let mut request_value_reader = {
23051            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23052            common::remove_json_null_values(&mut value);
23053            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23054            serde_json::to_writer(&mut dst, &value).unwrap();
23055            dst
23056        };
23057        let request_size = request_value_reader
23058            .seek(std::io::SeekFrom::End(0))
23059            .unwrap();
23060        request_value_reader
23061            .seek(std::io::SeekFrom::Start(0))
23062            .unwrap();
23063
23064        loop {
23065            let token = match self
23066                .hub
23067                .auth
23068                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23069                .await
23070            {
23071                Ok(token) => token,
23072                Err(e) => match dlg.token(e) {
23073                    Ok(token) => token,
23074                    Err(e) => {
23075                        dlg.finished(false);
23076                        return Err(common::Error::MissingToken(e));
23077                    }
23078                },
23079            };
23080            request_value_reader
23081                .seek(std::io::SeekFrom::Start(0))
23082                .unwrap();
23083            let mut req_result = {
23084                let client = &self.hub.client;
23085                dlg.pre_request();
23086                let mut req_builder = hyper::Request::builder()
23087                    .method(hyper::Method::POST)
23088                    .uri(url.as_str())
23089                    .header(USER_AGENT, self.hub._user_agent.clone());
23090
23091                if let Some(token) = token.as_ref() {
23092                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23093                }
23094
23095                let request = req_builder
23096                    .header(CONTENT_TYPE, json_mime_type.to_string())
23097                    .header(CONTENT_LENGTH, request_size as u64)
23098                    .body(common::to_body(
23099                        request_value_reader.get_ref().clone().into(),
23100                    ));
23101
23102                client.request(request.unwrap()).await
23103            };
23104
23105            match req_result {
23106                Err(err) => {
23107                    if let common::Retry::After(d) = dlg.http_error(&err) {
23108                        sleep(d).await;
23109                        continue;
23110                    }
23111                    dlg.finished(false);
23112                    return Err(common::Error::HttpError(err));
23113                }
23114                Ok(res) => {
23115                    let (mut parts, body) = res.into_parts();
23116                    let mut body = common::Body::new(body);
23117                    if !parts.status.is_success() {
23118                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23119                        let error = serde_json::from_str(&common::to_string(&bytes));
23120                        let response = common::to_response(parts, bytes.into());
23121
23122                        if let common::Retry::After(d) =
23123                            dlg.http_failure(&response, error.as_ref().ok())
23124                        {
23125                            sleep(d).await;
23126                            continue;
23127                        }
23128
23129                        dlg.finished(false);
23130
23131                        return Err(match error {
23132                            Ok(value) => common::Error::BadRequest(value),
23133                            _ => common::Error::Failure(response),
23134                        });
23135                    }
23136                    let response = {
23137                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23138                        let encoded = common::to_string(&bytes);
23139                        match serde_json::from_str(&encoded) {
23140                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23141                            Err(error) => {
23142                                dlg.response_json_decode_error(&encoded, &error);
23143                                return Err(common::Error::JsonDecodeError(
23144                                    encoded.to_string(),
23145                                    error,
23146                                ));
23147                            }
23148                        }
23149                    };
23150
23151                    dlg.finished(true);
23152                    return Ok(response);
23153                }
23154            }
23155        }
23156    }
23157
23158    ///
23159    /// Sets the *request* property to the given value.
23160    ///
23161    /// Even though the property as already been set when instantiating this call,
23162    /// we provide this method for API completeness.
23163    pub fn request(
23164        mut self,
23165        new_value: SetLocationsRequest,
23166    ) -> ProjectZoneClusterLocationCall<'a, C> {
23167        self._request = new_value;
23168        self
23169    }
23170    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
23171    ///
23172    /// Sets the *project id* path property to the given value.
23173    ///
23174    /// Even though the property as already been set when instantiating this call,
23175    /// we provide this method for API completeness.
23176    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
23177        self._project_id = new_value.to_string();
23178        self
23179    }
23180    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
23181    ///
23182    /// Sets the *zone* path property to the given value.
23183    ///
23184    /// Even though the property as already been set when instantiating this call,
23185    /// we provide this method for API completeness.
23186    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
23187        self._zone = new_value.to_string();
23188        self
23189    }
23190    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
23191    ///
23192    /// Sets the *cluster id* path property to the given value.
23193    ///
23194    /// Even though the property as already been set when instantiating this call,
23195    /// we provide this method for API completeness.
23196    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
23197        self._cluster_id = new_value.to_string();
23198        self
23199    }
23200    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23201    /// while executing the actual API request.
23202    ///
23203    /// ````text
23204    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23205    /// ````
23206    ///
23207    /// Sets the *delegate* property to the given value.
23208    pub fn delegate(
23209        mut self,
23210        new_value: &'a mut dyn common::Delegate,
23211    ) -> ProjectZoneClusterLocationCall<'a, C> {
23212        self._delegate = Some(new_value);
23213        self
23214    }
23215
23216    /// Set any additional parameter of the query string used in the request.
23217    /// It should be used to set parameters which are not yet available through their own
23218    /// setters.
23219    ///
23220    /// Please note that this method must not be used to set any of the known parameters
23221    /// which have their own setter method. If done anyway, the request will fail.
23222    ///
23223    /// # Additional Parameters
23224    ///
23225    /// * *$.xgafv* (query-string) - V1 error format.
23226    /// * *access_token* (query-string) - OAuth access token.
23227    /// * *alt* (query-string) - Data format for response.
23228    /// * *callback* (query-string) - JSONP
23229    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23230    /// * *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.
23231    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23232    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23233    /// * *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.
23234    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23235    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23236    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLocationCall<'a, C>
23237    where
23238        T: AsRef<str>,
23239    {
23240        self._additional_params
23241            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23242        self
23243    }
23244
23245    /// Identifies the authorization scope for the method you are building.
23246    ///
23247    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23248    /// [`Scope::CloudPlatform`].
23249    ///
23250    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23251    /// tokens for more than one scope.
23252    ///
23253    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23254    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23255    /// sufficient, a read-write scope will do as well.
23256    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLocationCall<'a, C>
23257    where
23258        St: AsRef<str>,
23259    {
23260        self._scopes.insert(String::from(scope.as_ref()));
23261        self
23262    }
23263    /// Identifies the authorization scope(s) for the method you are building.
23264    ///
23265    /// See [`Self::add_scope()`] for details.
23266    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLocationCall<'a, C>
23267    where
23268        I: IntoIterator<Item = St>,
23269        St: AsRef<str>,
23270    {
23271        self._scopes
23272            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23273        self
23274    }
23275
23276    /// Removes all scopes, and no default scope will be used either.
23277    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23278    /// for details).
23279    pub fn clear_scopes(mut self) -> ProjectZoneClusterLocationCall<'a, C> {
23280        self._scopes.clear();
23281        self
23282    }
23283}
23284
23285/// Sets the logging service for a specific cluster.
23286///
23287/// A builder for the *zones.clusters.logging* method supported by a *project* resource.
23288/// It is not used directly, but through a [`ProjectMethods`] instance.
23289///
23290/// # Example
23291///
23292/// Instantiate a resource method builder
23293///
23294/// ```test_harness,no_run
23295/// # extern crate hyper;
23296/// # extern crate hyper_rustls;
23297/// # extern crate google_container1 as container1;
23298/// use container1::api::SetLoggingServiceRequest;
23299/// # async fn dox() {
23300/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23301///
23302/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23303/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23304/// #     secret,
23305/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23306/// # ).build().await.unwrap();
23307///
23308/// # let client = hyper_util::client::legacy::Client::builder(
23309/// #     hyper_util::rt::TokioExecutor::new()
23310/// # )
23311/// # .build(
23312/// #     hyper_rustls::HttpsConnectorBuilder::new()
23313/// #         .with_native_roots()
23314/// #         .unwrap()
23315/// #         .https_or_http()
23316/// #         .enable_http1()
23317/// #         .build()
23318/// # );
23319/// # let mut hub = Container::new(client, auth);
23320/// // As the method needs a request, you would usually fill it with the desired information
23321/// // into the respective structure. Some of the parts shown here might not be applicable !
23322/// // Values shown here are possibly random and not representative !
23323/// let mut req = SetLoggingServiceRequest::default();
23324///
23325/// // You can configure optional parameters by calling the respective setters at will, and
23326/// // execute the final call using `doit()`.
23327/// // Values shown here are possibly random and not representative !
23328/// let result = hub.projects().zones_clusters_logging(req, "projectId", "zone", "clusterId")
23329///              .doit().await;
23330/// # }
23331/// ```
23332pub struct ProjectZoneClusterLoggingCall<'a, C>
23333where
23334    C: 'a,
23335{
23336    hub: &'a Container<C>,
23337    _request: SetLoggingServiceRequest,
23338    _project_id: String,
23339    _zone: String,
23340    _cluster_id: String,
23341    _delegate: Option<&'a mut dyn common::Delegate>,
23342    _additional_params: HashMap<String, String>,
23343    _scopes: BTreeSet<String>,
23344}
23345
23346impl<'a, C> common::CallBuilder for ProjectZoneClusterLoggingCall<'a, C> {}
23347
23348impl<'a, C> ProjectZoneClusterLoggingCall<'a, C>
23349where
23350    C: common::Connector,
23351{
23352    /// Perform the operation you have build so far.
23353    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23354        use std::borrow::Cow;
23355        use std::io::{Read, Seek};
23356
23357        use common::{url::Params, ToParts};
23358        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23359
23360        let mut dd = common::DefaultDelegate;
23361        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23362        dlg.begin(common::MethodInfo {
23363            id: "container.projects.zones.clusters.logging",
23364            http_method: hyper::Method::POST,
23365        });
23366
23367        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
23368            if self._additional_params.contains_key(field) {
23369                dlg.finished(false);
23370                return Err(common::Error::FieldClash(field));
23371            }
23372        }
23373
23374        let mut params = Params::with_capacity(6 + self._additional_params.len());
23375        params.push("projectId", self._project_id);
23376        params.push("zone", self._zone);
23377        params.push("clusterId", self._cluster_id);
23378
23379        params.extend(self._additional_params.iter());
23380
23381        params.push("alt", "json");
23382        let mut url = self.hub._base_url.clone()
23383            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/logging";
23384        if self._scopes.is_empty() {
23385            self._scopes
23386                .insert(Scope::CloudPlatform.as_ref().to_string());
23387        }
23388
23389        #[allow(clippy::single_element_loop)]
23390        for &(find_this, param_name) in [
23391            ("{projectId}", "projectId"),
23392            ("{zone}", "zone"),
23393            ("{clusterId}", "clusterId"),
23394        ]
23395        .iter()
23396        {
23397            url = params.uri_replacement(url, param_name, find_this, false);
23398        }
23399        {
23400            let to_remove = ["clusterId", "zone", "projectId"];
23401            params.remove_params(&to_remove);
23402        }
23403
23404        let url = params.parse_with_url(&url);
23405
23406        let mut json_mime_type = mime::APPLICATION_JSON;
23407        let mut request_value_reader = {
23408            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23409            common::remove_json_null_values(&mut value);
23410            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23411            serde_json::to_writer(&mut dst, &value).unwrap();
23412            dst
23413        };
23414        let request_size = request_value_reader
23415            .seek(std::io::SeekFrom::End(0))
23416            .unwrap();
23417        request_value_reader
23418            .seek(std::io::SeekFrom::Start(0))
23419            .unwrap();
23420
23421        loop {
23422            let token = match self
23423                .hub
23424                .auth
23425                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23426                .await
23427            {
23428                Ok(token) => token,
23429                Err(e) => match dlg.token(e) {
23430                    Ok(token) => token,
23431                    Err(e) => {
23432                        dlg.finished(false);
23433                        return Err(common::Error::MissingToken(e));
23434                    }
23435                },
23436            };
23437            request_value_reader
23438                .seek(std::io::SeekFrom::Start(0))
23439                .unwrap();
23440            let mut req_result = {
23441                let client = &self.hub.client;
23442                dlg.pre_request();
23443                let mut req_builder = hyper::Request::builder()
23444                    .method(hyper::Method::POST)
23445                    .uri(url.as_str())
23446                    .header(USER_AGENT, self.hub._user_agent.clone());
23447
23448                if let Some(token) = token.as_ref() {
23449                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23450                }
23451
23452                let request = req_builder
23453                    .header(CONTENT_TYPE, json_mime_type.to_string())
23454                    .header(CONTENT_LENGTH, request_size as u64)
23455                    .body(common::to_body(
23456                        request_value_reader.get_ref().clone().into(),
23457                    ));
23458
23459                client.request(request.unwrap()).await
23460            };
23461
23462            match req_result {
23463                Err(err) => {
23464                    if let common::Retry::After(d) = dlg.http_error(&err) {
23465                        sleep(d).await;
23466                        continue;
23467                    }
23468                    dlg.finished(false);
23469                    return Err(common::Error::HttpError(err));
23470                }
23471                Ok(res) => {
23472                    let (mut parts, body) = res.into_parts();
23473                    let mut body = common::Body::new(body);
23474                    if !parts.status.is_success() {
23475                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23476                        let error = serde_json::from_str(&common::to_string(&bytes));
23477                        let response = common::to_response(parts, bytes.into());
23478
23479                        if let common::Retry::After(d) =
23480                            dlg.http_failure(&response, error.as_ref().ok())
23481                        {
23482                            sleep(d).await;
23483                            continue;
23484                        }
23485
23486                        dlg.finished(false);
23487
23488                        return Err(match error {
23489                            Ok(value) => common::Error::BadRequest(value),
23490                            _ => common::Error::Failure(response),
23491                        });
23492                    }
23493                    let response = {
23494                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23495                        let encoded = common::to_string(&bytes);
23496                        match serde_json::from_str(&encoded) {
23497                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23498                            Err(error) => {
23499                                dlg.response_json_decode_error(&encoded, &error);
23500                                return Err(common::Error::JsonDecodeError(
23501                                    encoded.to_string(),
23502                                    error,
23503                                ));
23504                            }
23505                        }
23506                    };
23507
23508                    dlg.finished(true);
23509                    return Ok(response);
23510                }
23511            }
23512        }
23513    }
23514
23515    ///
23516    /// Sets the *request* property to the given value.
23517    ///
23518    /// Even though the property as already been set when instantiating this call,
23519    /// we provide this method for API completeness.
23520    pub fn request(
23521        mut self,
23522        new_value: SetLoggingServiceRequest,
23523    ) -> ProjectZoneClusterLoggingCall<'a, C> {
23524        self._request = new_value;
23525        self
23526    }
23527    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
23528    ///
23529    /// Sets the *project id* path property to the given value.
23530    ///
23531    /// Even though the property as already been set when instantiating this call,
23532    /// we provide this method for API completeness.
23533    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
23534        self._project_id = new_value.to_string();
23535        self
23536    }
23537    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
23538    ///
23539    /// Sets the *zone* path property to the given value.
23540    ///
23541    /// Even though the property as already been set when instantiating this call,
23542    /// we provide this method for API completeness.
23543    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
23544        self._zone = new_value.to_string();
23545        self
23546    }
23547    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
23548    ///
23549    /// Sets the *cluster id* path property to the given value.
23550    ///
23551    /// Even though the property as already been set when instantiating this call,
23552    /// we provide this method for API completeness.
23553    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
23554        self._cluster_id = new_value.to_string();
23555        self
23556    }
23557    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23558    /// while executing the actual API request.
23559    ///
23560    /// ````text
23561    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23562    /// ````
23563    ///
23564    /// Sets the *delegate* property to the given value.
23565    pub fn delegate(
23566        mut self,
23567        new_value: &'a mut dyn common::Delegate,
23568    ) -> ProjectZoneClusterLoggingCall<'a, C> {
23569        self._delegate = Some(new_value);
23570        self
23571    }
23572
23573    /// Set any additional parameter of the query string used in the request.
23574    /// It should be used to set parameters which are not yet available through their own
23575    /// setters.
23576    ///
23577    /// Please note that this method must not be used to set any of the known parameters
23578    /// which have their own setter method. If done anyway, the request will fail.
23579    ///
23580    /// # Additional Parameters
23581    ///
23582    /// * *$.xgafv* (query-string) - V1 error format.
23583    /// * *access_token* (query-string) - OAuth access token.
23584    /// * *alt* (query-string) - Data format for response.
23585    /// * *callback* (query-string) - JSONP
23586    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23587    /// * *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.
23588    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23589    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23590    /// * *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.
23591    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23592    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23593    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLoggingCall<'a, C>
23594    where
23595        T: AsRef<str>,
23596    {
23597        self._additional_params
23598            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23599        self
23600    }
23601
23602    /// Identifies the authorization scope for the method you are building.
23603    ///
23604    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23605    /// [`Scope::CloudPlatform`].
23606    ///
23607    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23608    /// tokens for more than one scope.
23609    ///
23610    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23611    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23612    /// sufficient, a read-write scope will do as well.
23613    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLoggingCall<'a, C>
23614    where
23615        St: AsRef<str>,
23616    {
23617        self._scopes.insert(String::from(scope.as_ref()));
23618        self
23619    }
23620    /// Identifies the authorization scope(s) for the method you are building.
23621    ///
23622    /// See [`Self::add_scope()`] for details.
23623    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLoggingCall<'a, C>
23624    where
23625        I: IntoIterator<Item = St>,
23626        St: AsRef<str>,
23627    {
23628        self._scopes
23629            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23630        self
23631    }
23632
23633    /// Removes all scopes, and no default scope will be used either.
23634    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23635    /// for details).
23636    pub fn clear_scopes(mut self) -> ProjectZoneClusterLoggingCall<'a, C> {
23637        self._scopes.clear();
23638        self
23639    }
23640}
23641
23642/// Updates the master for a specific cluster.
23643///
23644/// A builder for the *zones.clusters.master* method supported by a *project* resource.
23645/// It is not used directly, but through a [`ProjectMethods`] instance.
23646///
23647/// # Example
23648///
23649/// Instantiate a resource method builder
23650///
23651/// ```test_harness,no_run
23652/// # extern crate hyper;
23653/// # extern crate hyper_rustls;
23654/// # extern crate google_container1 as container1;
23655/// use container1::api::UpdateMasterRequest;
23656/// # async fn dox() {
23657/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23658///
23659/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23660/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
23661/// #     secret,
23662/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23663/// # ).build().await.unwrap();
23664///
23665/// # let client = hyper_util::client::legacy::Client::builder(
23666/// #     hyper_util::rt::TokioExecutor::new()
23667/// # )
23668/// # .build(
23669/// #     hyper_rustls::HttpsConnectorBuilder::new()
23670/// #         .with_native_roots()
23671/// #         .unwrap()
23672/// #         .https_or_http()
23673/// #         .enable_http1()
23674/// #         .build()
23675/// # );
23676/// # let mut hub = Container::new(client, auth);
23677/// // As the method needs a request, you would usually fill it with the desired information
23678/// // into the respective structure. Some of the parts shown here might not be applicable !
23679/// // Values shown here are possibly random and not representative !
23680/// let mut req = UpdateMasterRequest::default();
23681///
23682/// // You can configure optional parameters by calling the respective setters at will, and
23683/// // execute the final call using `doit()`.
23684/// // Values shown here are possibly random and not representative !
23685/// let result = hub.projects().zones_clusters_master(req, "projectId", "zone", "clusterId")
23686///              .doit().await;
23687/// # }
23688/// ```
23689pub struct ProjectZoneClusterMasterCall<'a, C>
23690where
23691    C: 'a,
23692{
23693    hub: &'a Container<C>,
23694    _request: UpdateMasterRequest,
23695    _project_id: String,
23696    _zone: String,
23697    _cluster_id: String,
23698    _delegate: Option<&'a mut dyn common::Delegate>,
23699    _additional_params: HashMap<String, String>,
23700    _scopes: BTreeSet<String>,
23701}
23702
23703impl<'a, C> common::CallBuilder for ProjectZoneClusterMasterCall<'a, C> {}
23704
23705impl<'a, C> ProjectZoneClusterMasterCall<'a, C>
23706where
23707    C: common::Connector,
23708{
23709    /// Perform the operation you have build so far.
23710    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23711        use std::borrow::Cow;
23712        use std::io::{Read, Seek};
23713
23714        use common::{url::Params, ToParts};
23715        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23716
23717        let mut dd = common::DefaultDelegate;
23718        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23719        dlg.begin(common::MethodInfo {
23720            id: "container.projects.zones.clusters.master",
23721            http_method: hyper::Method::POST,
23722        });
23723
23724        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
23725            if self._additional_params.contains_key(field) {
23726                dlg.finished(false);
23727                return Err(common::Error::FieldClash(field));
23728            }
23729        }
23730
23731        let mut params = Params::with_capacity(6 + self._additional_params.len());
23732        params.push("projectId", self._project_id);
23733        params.push("zone", self._zone);
23734        params.push("clusterId", self._cluster_id);
23735
23736        params.extend(self._additional_params.iter());
23737
23738        params.push("alt", "json");
23739        let mut url = self.hub._base_url.clone()
23740            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/master";
23741        if self._scopes.is_empty() {
23742            self._scopes
23743                .insert(Scope::CloudPlatform.as_ref().to_string());
23744        }
23745
23746        #[allow(clippy::single_element_loop)]
23747        for &(find_this, param_name) in [
23748            ("{projectId}", "projectId"),
23749            ("{zone}", "zone"),
23750            ("{clusterId}", "clusterId"),
23751        ]
23752        .iter()
23753        {
23754            url = params.uri_replacement(url, param_name, find_this, false);
23755        }
23756        {
23757            let to_remove = ["clusterId", "zone", "projectId"];
23758            params.remove_params(&to_remove);
23759        }
23760
23761        let url = params.parse_with_url(&url);
23762
23763        let mut json_mime_type = mime::APPLICATION_JSON;
23764        let mut request_value_reader = {
23765            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23766            common::remove_json_null_values(&mut value);
23767            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23768            serde_json::to_writer(&mut dst, &value).unwrap();
23769            dst
23770        };
23771        let request_size = request_value_reader
23772            .seek(std::io::SeekFrom::End(0))
23773            .unwrap();
23774        request_value_reader
23775            .seek(std::io::SeekFrom::Start(0))
23776            .unwrap();
23777
23778        loop {
23779            let token = match self
23780                .hub
23781                .auth
23782                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23783                .await
23784            {
23785                Ok(token) => token,
23786                Err(e) => match dlg.token(e) {
23787                    Ok(token) => token,
23788                    Err(e) => {
23789                        dlg.finished(false);
23790                        return Err(common::Error::MissingToken(e));
23791                    }
23792                },
23793            };
23794            request_value_reader
23795                .seek(std::io::SeekFrom::Start(0))
23796                .unwrap();
23797            let mut req_result = {
23798                let client = &self.hub.client;
23799                dlg.pre_request();
23800                let mut req_builder = hyper::Request::builder()
23801                    .method(hyper::Method::POST)
23802                    .uri(url.as_str())
23803                    .header(USER_AGENT, self.hub._user_agent.clone());
23804
23805                if let Some(token) = token.as_ref() {
23806                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23807                }
23808
23809                let request = req_builder
23810                    .header(CONTENT_TYPE, json_mime_type.to_string())
23811                    .header(CONTENT_LENGTH, request_size as u64)
23812                    .body(common::to_body(
23813                        request_value_reader.get_ref().clone().into(),
23814                    ));
23815
23816                client.request(request.unwrap()).await
23817            };
23818
23819            match req_result {
23820                Err(err) => {
23821                    if let common::Retry::After(d) = dlg.http_error(&err) {
23822                        sleep(d).await;
23823                        continue;
23824                    }
23825                    dlg.finished(false);
23826                    return Err(common::Error::HttpError(err));
23827                }
23828                Ok(res) => {
23829                    let (mut parts, body) = res.into_parts();
23830                    let mut body = common::Body::new(body);
23831                    if !parts.status.is_success() {
23832                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23833                        let error = serde_json::from_str(&common::to_string(&bytes));
23834                        let response = common::to_response(parts, bytes.into());
23835
23836                        if let common::Retry::After(d) =
23837                            dlg.http_failure(&response, error.as_ref().ok())
23838                        {
23839                            sleep(d).await;
23840                            continue;
23841                        }
23842
23843                        dlg.finished(false);
23844
23845                        return Err(match error {
23846                            Ok(value) => common::Error::BadRequest(value),
23847                            _ => common::Error::Failure(response),
23848                        });
23849                    }
23850                    let response = {
23851                        let bytes = common::to_bytes(body).await.unwrap_or_default();
23852                        let encoded = common::to_string(&bytes);
23853                        match serde_json::from_str(&encoded) {
23854                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23855                            Err(error) => {
23856                                dlg.response_json_decode_error(&encoded, &error);
23857                                return Err(common::Error::JsonDecodeError(
23858                                    encoded.to_string(),
23859                                    error,
23860                                ));
23861                            }
23862                        }
23863                    };
23864
23865                    dlg.finished(true);
23866                    return Ok(response);
23867                }
23868            }
23869        }
23870    }
23871
23872    ///
23873    /// Sets the *request* property to the given value.
23874    ///
23875    /// Even though the property as already been set when instantiating this call,
23876    /// we provide this method for API completeness.
23877    pub fn request(
23878        mut self,
23879        new_value: UpdateMasterRequest,
23880    ) -> ProjectZoneClusterMasterCall<'a, C> {
23881        self._request = new_value;
23882        self
23883    }
23884    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
23885    ///
23886    /// Sets the *project id* path property to the given value.
23887    ///
23888    /// Even though the property as already been set when instantiating this call,
23889    /// we provide this method for API completeness.
23890    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
23891        self._project_id = new_value.to_string();
23892        self
23893    }
23894    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
23895    ///
23896    /// Sets the *zone* path property to the given value.
23897    ///
23898    /// Even though the property as already been set when instantiating this call,
23899    /// we provide this method for API completeness.
23900    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
23901        self._zone = new_value.to_string();
23902        self
23903    }
23904    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
23905    ///
23906    /// Sets the *cluster id* path property to the given value.
23907    ///
23908    /// Even though the property as already been set when instantiating this call,
23909    /// we provide this method for API completeness.
23910    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
23911        self._cluster_id = new_value.to_string();
23912        self
23913    }
23914    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23915    /// while executing the actual API request.
23916    ///
23917    /// ````text
23918    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
23919    /// ````
23920    ///
23921    /// Sets the *delegate* property to the given value.
23922    pub fn delegate(
23923        mut self,
23924        new_value: &'a mut dyn common::Delegate,
23925    ) -> ProjectZoneClusterMasterCall<'a, C> {
23926        self._delegate = Some(new_value);
23927        self
23928    }
23929
23930    /// Set any additional parameter of the query string used in the request.
23931    /// It should be used to set parameters which are not yet available through their own
23932    /// setters.
23933    ///
23934    /// Please note that this method must not be used to set any of the known parameters
23935    /// which have their own setter method. If done anyway, the request will fail.
23936    ///
23937    /// # Additional Parameters
23938    ///
23939    /// * *$.xgafv* (query-string) - V1 error format.
23940    /// * *access_token* (query-string) - OAuth access token.
23941    /// * *alt* (query-string) - Data format for response.
23942    /// * *callback* (query-string) - JSONP
23943    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23944    /// * *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.
23945    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23946    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23947    /// * *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.
23948    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23949    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23950    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterMasterCall<'a, C>
23951    where
23952        T: AsRef<str>,
23953    {
23954        self._additional_params
23955            .insert(name.as_ref().to_string(), value.as_ref().to_string());
23956        self
23957    }
23958
23959    /// Identifies the authorization scope for the method you are building.
23960    ///
23961    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23962    /// [`Scope::CloudPlatform`].
23963    ///
23964    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23965    /// tokens for more than one scope.
23966    ///
23967    /// Usually there is more than one suitable scope to authorize an operation, some of which may
23968    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23969    /// sufficient, a read-write scope will do as well.
23970    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterMasterCall<'a, C>
23971    where
23972        St: AsRef<str>,
23973    {
23974        self._scopes.insert(String::from(scope.as_ref()));
23975        self
23976    }
23977    /// Identifies the authorization scope(s) for the method you are building.
23978    ///
23979    /// See [`Self::add_scope()`] for details.
23980    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterMasterCall<'a, C>
23981    where
23982        I: IntoIterator<Item = St>,
23983        St: AsRef<str>,
23984    {
23985        self._scopes
23986            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23987        self
23988    }
23989
23990    /// Removes all scopes, and no default scope will be used either.
23991    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23992    /// for details).
23993    pub fn clear_scopes(mut self) -> ProjectZoneClusterMasterCall<'a, C> {
23994        self._scopes.clear();
23995        self
23996    }
23997}
23998
23999/// Sets the monitoring service for a specific cluster.
24000///
24001/// A builder for the *zones.clusters.monitoring* method supported by a *project* resource.
24002/// It is not used directly, but through a [`ProjectMethods`] instance.
24003///
24004/// # Example
24005///
24006/// Instantiate a resource method builder
24007///
24008/// ```test_harness,no_run
24009/// # extern crate hyper;
24010/// # extern crate hyper_rustls;
24011/// # extern crate google_container1 as container1;
24012/// use container1::api::SetMonitoringServiceRequest;
24013/// # async fn dox() {
24014/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24015///
24016/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24017/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24018/// #     secret,
24019/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24020/// # ).build().await.unwrap();
24021///
24022/// # let client = hyper_util::client::legacy::Client::builder(
24023/// #     hyper_util::rt::TokioExecutor::new()
24024/// # )
24025/// # .build(
24026/// #     hyper_rustls::HttpsConnectorBuilder::new()
24027/// #         .with_native_roots()
24028/// #         .unwrap()
24029/// #         .https_or_http()
24030/// #         .enable_http1()
24031/// #         .build()
24032/// # );
24033/// # let mut hub = Container::new(client, auth);
24034/// // As the method needs a request, you would usually fill it with the desired information
24035/// // into the respective structure. Some of the parts shown here might not be applicable !
24036/// // Values shown here are possibly random and not representative !
24037/// let mut req = SetMonitoringServiceRequest::default();
24038///
24039/// // You can configure optional parameters by calling the respective setters at will, and
24040/// // execute the final call using `doit()`.
24041/// // Values shown here are possibly random and not representative !
24042/// let result = hub.projects().zones_clusters_monitoring(req, "projectId", "zone", "clusterId")
24043///              .doit().await;
24044/// # }
24045/// ```
24046pub struct ProjectZoneClusterMonitoringCall<'a, C>
24047where
24048    C: 'a,
24049{
24050    hub: &'a Container<C>,
24051    _request: SetMonitoringServiceRequest,
24052    _project_id: String,
24053    _zone: String,
24054    _cluster_id: String,
24055    _delegate: Option<&'a mut dyn common::Delegate>,
24056    _additional_params: HashMap<String, String>,
24057    _scopes: BTreeSet<String>,
24058}
24059
24060impl<'a, C> common::CallBuilder for ProjectZoneClusterMonitoringCall<'a, C> {}
24061
24062impl<'a, C> ProjectZoneClusterMonitoringCall<'a, C>
24063where
24064    C: common::Connector,
24065{
24066    /// Perform the operation you have build so far.
24067    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24068        use std::borrow::Cow;
24069        use std::io::{Read, Seek};
24070
24071        use common::{url::Params, ToParts};
24072        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24073
24074        let mut dd = common::DefaultDelegate;
24075        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24076        dlg.begin(common::MethodInfo {
24077            id: "container.projects.zones.clusters.monitoring",
24078            http_method: hyper::Method::POST,
24079        });
24080
24081        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
24082            if self._additional_params.contains_key(field) {
24083                dlg.finished(false);
24084                return Err(common::Error::FieldClash(field));
24085            }
24086        }
24087
24088        let mut params = Params::with_capacity(6 + self._additional_params.len());
24089        params.push("projectId", self._project_id);
24090        params.push("zone", self._zone);
24091        params.push("clusterId", self._cluster_id);
24092
24093        params.extend(self._additional_params.iter());
24094
24095        params.push("alt", "json");
24096        let mut url = self.hub._base_url.clone()
24097            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/monitoring";
24098        if self._scopes.is_empty() {
24099            self._scopes
24100                .insert(Scope::CloudPlatform.as_ref().to_string());
24101        }
24102
24103        #[allow(clippy::single_element_loop)]
24104        for &(find_this, param_name) in [
24105            ("{projectId}", "projectId"),
24106            ("{zone}", "zone"),
24107            ("{clusterId}", "clusterId"),
24108        ]
24109        .iter()
24110        {
24111            url = params.uri_replacement(url, param_name, find_this, false);
24112        }
24113        {
24114            let to_remove = ["clusterId", "zone", "projectId"];
24115            params.remove_params(&to_remove);
24116        }
24117
24118        let url = params.parse_with_url(&url);
24119
24120        let mut json_mime_type = mime::APPLICATION_JSON;
24121        let mut request_value_reader = {
24122            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24123            common::remove_json_null_values(&mut value);
24124            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24125            serde_json::to_writer(&mut dst, &value).unwrap();
24126            dst
24127        };
24128        let request_size = request_value_reader
24129            .seek(std::io::SeekFrom::End(0))
24130            .unwrap();
24131        request_value_reader
24132            .seek(std::io::SeekFrom::Start(0))
24133            .unwrap();
24134
24135        loop {
24136            let token = match self
24137                .hub
24138                .auth
24139                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24140                .await
24141            {
24142                Ok(token) => token,
24143                Err(e) => match dlg.token(e) {
24144                    Ok(token) => token,
24145                    Err(e) => {
24146                        dlg.finished(false);
24147                        return Err(common::Error::MissingToken(e));
24148                    }
24149                },
24150            };
24151            request_value_reader
24152                .seek(std::io::SeekFrom::Start(0))
24153                .unwrap();
24154            let mut req_result = {
24155                let client = &self.hub.client;
24156                dlg.pre_request();
24157                let mut req_builder = hyper::Request::builder()
24158                    .method(hyper::Method::POST)
24159                    .uri(url.as_str())
24160                    .header(USER_AGENT, self.hub._user_agent.clone());
24161
24162                if let Some(token) = token.as_ref() {
24163                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24164                }
24165
24166                let request = req_builder
24167                    .header(CONTENT_TYPE, json_mime_type.to_string())
24168                    .header(CONTENT_LENGTH, request_size as u64)
24169                    .body(common::to_body(
24170                        request_value_reader.get_ref().clone().into(),
24171                    ));
24172
24173                client.request(request.unwrap()).await
24174            };
24175
24176            match req_result {
24177                Err(err) => {
24178                    if let common::Retry::After(d) = dlg.http_error(&err) {
24179                        sleep(d).await;
24180                        continue;
24181                    }
24182                    dlg.finished(false);
24183                    return Err(common::Error::HttpError(err));
24184                }
24185                Ok(res) => {
24186                    let (mut parts, body) = res.into_parts();
24187                    let mut body = common::Body::new(body);
24188                    if !parts.status.is_success() {
24189                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24190                        let error = serde_json::from_str(&common::to_string(&bytes));
24191                        let response = common::to_response(parts, bytes.into());
24192
24193                        if let common::Retry::After(d) =
24194                            dlg.http_failure(&response, error.as_ref().ok())
24195                        {
24196                            sleep(d).await;
24197                            continue;
24198                        }
24199
24200                        dlg.finished(false);
24201
24202                        return Err(match error {
24203                            Ok(value) => common::Error::BadRequest(value),
24204                            _ => common::Error::Failure(response),
24205                        });
24206                    }
24207                    let response = {
24208                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24209                        let encoded = common::to_string(&bytes);
24210                        match serde_json::from_str(&encoded) {
24211                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24212                            Err(error) => {
24213                                dlg.response_json_decode_error(&encoded, &error);
24214                                return Err(common::Error::JsonDecodeError(
24215                                    encoded.to_string(),
24216                                    error,
24217                                ));
24218                            }
24219                        }
24220                    };
24221
24222                    dlg.finished(true);
24223                    return Ok(response);
24224                }
24225            }
24226        }
24227    }
24228
24229    ///
24230    /// Sets the *request* property to the given value.
24231    ///
24232    /// Even though the property as already been set when instantiating this call,
24233    /// we provide this method for API completeness.
24234    pub fn request(
24235        mut self,
24236        new_value: SetMonitoringServiceRequest,
24237    ) -> ProjectZoneClusterMonitoringCall<'a, C> {
24238        self._request = new_value;
24239        self
24240    }
24241    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
24242    ///
24243    /// Sets the *project id* path property to the given value.
24244    ///
24245    /// Even though the property as already been set when instantiating this call,
24246    /// we provide this method for API completeness.
24247    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
24248        self._project_id = new_value.to_string();
24249        self
24250    }
24251    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
24252    ///
24253    /// Sets the *zone* path property to the given value.
24254    ///
24255    /// Even though the property as already been set when instantiating this call,
24256    /// we provide this method for API completeness.
24257    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
24258        self._zone = new_value.to_string();
24259        self
24260    }
24261    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
24262    ///
24263    /// Sets the *cluster id* path property to the given value.
24264    ///
24265    /// Even though the property as already been set when instantiating this call,
24266    /// we provide this method for API completeness.
24267    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
24268        self._cluster_id = new_value.to_string();
24269        self
24270    }
24271    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24272    /// while executing the actual API request.
24273    ///
24274    /// ````text
24275    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24276    /// ````
24277    ///
24278    /// Sets the *delegate* property to the given value.
24279    pub fn delegate(
24280        mut self,
24281        new_value: &'a mut dyn common::Delegate,
24282    ) -> ProjectZoneClusterMonitoringCall<'a, C> {
24283        self._delegate = Some(new_value);
24284        self
24285    }
24286
24287    /// Set any additional parameter of the query string used in the request.
24288    /// It should be used to set parameters which are not yet available through their own
24289    /// setters.
24290    ///
24291    /// Please note that this method must not be used to set any of the known parameters
24292    /// which have their own setter method. If done anyway, the request will fail.
24293    ///
24294    /// # Additional Parameters
24295    ///
24296    /// * *$.xgafv* (query-string) - V1 error format.
24297    /// * *access_token* (query-string) - OAuth access token.
24298    /// * *alt* (query-string) - Data format for response.
24299    /// * *callback* (query-string) - JSONP
24300    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24301    /// * *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.
24302    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24303    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24304    /// * *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.
24305    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24306    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24307    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterMonitoringCall<'a, C>
24308    where
24309        T: AsRef<str>,
24310    {
24311        self._additional_params
24312            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24313        self
24314    }
24315
24316    /// Identifies the authorization scope for the method you are building.
24317    ///
24318    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24319    /// [`Scope::CloudPlatform`].
24320    ///
24321    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24322    /// tokens for more than one scope.
24323    ///
24324    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24325    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24326    /// sufficient, a read-write scope will do as well.
24327    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterMonitoringCall<'a, C>
24328    where
24329        St: AsRef<str>,
24330    {
24331        self._scopes.insert(String::from(scope.as_ref()));
24332        self
24333    }
24334    /// Identifies the authorization scope(s) for the method you are building.
24335    ///
24336    /// See [`Self::add_scope()`] for details.
24337    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterMonitoringCall<'a, C>
24338    where
24339        I: IntoIterator<Item = St>,
24340        St: AsRef<str>,
24341    {
24342        self._scopes
24343            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24344        self
24345    }
24346
24347    /// Removes all scopes, and no default scope will be used either.
24348    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24349    /// for details).
24350    pub fn clear_scopes(mut self) -> ProjectZoneClusterMonitoringCall<'a, C> {
24351        self._scopes.clear();
24352        self
24353    }
24354}
24355
24356/// Sets labels on a cluster.
24357///
24358/// A builder for the *zones.clusters.resourceLabels* method supported by a *project* resource.
24359/// It is not used directly, but through a [`ProjectMethods`] instance.
24360///
24361/// # Example
24362///
24363/// Instantiate a resource method builder
24364///
24365/// ```test_harness,no_run
24366/// # extern crate hyper;
24367/// # extern crate hyper_rustls;
24368/// # extern crate google_container1 as container1;
24369/// use container1::api::SetLabelsRequest;
24370/// # async fn dox() {
24371/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24372///
24373/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24374/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24375/// #     secret,
24376/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24377/// # ).build().await.unwrap();
24378///
24379/// # let client = hyper_util::client::legacy::Client::builder(
24380/// #     hyper_util::rt::TokioExecutor::new()
24381/// # )
24382/// # .build(
24383/// #     hyper_rustls::HttpsConnectorBuilder::new()
24384/// #         .with_native_roots()
24385/// #         .unwrap()
24386/// #         .https_or_http()
24387/// #         .enable_http1()
24388/// #         .build()
24389/// # );
24390/// # let mut hub = Container::new(client, auth);
24391/// // As the method needs a request, you would usually fill it with the desired information
24392/// // into the respective structure. Some of the parts shown here might not be applicable !
24393/// // Values shown here are possibly random and not representative !
24394/// let mut req = SetLabelsRequest::default();
24395///
24396/// // You can configure optional parameters by calling the respective setters at will, and
24397/// // execute the final call using `doit()`.
24398/// // Values shown here are possibly random and not representative !
24399/// let result = hub.projects().zones_clusters_resource_labels(req, "projectId", "zone", "clusterId")
24400///              .doit().await;
24401/// # }
24402/// ```
24403pub struct ProjectZoneClusterResourceLabelCall<'a, C>
24404where
24405    C: 'a,
24406{
24407    hub: &'a Container<C>,
24408    _request: SetLabelsRequest,
24409    _project_id: String,
24410    _zone: String,
24411    _cluster_id: String,
24412    _delegate: Option<&'a mut dyn common::Delegate>,
24413    _additional_params: HashMap<String, String>,
24414    _scopes: BTreeSet<String>,
24415}
24416
24417impl<'a, C> common::CallBuilder for ProjectZoneClusterResourceLabelCall<'a, C> {}
24418
24419impl<'a, C> ProjectZoneClusterResourceLabelCall<'a, C>
24420where
24421    C: common::Connector,
24422{
24423    /// Perform the operation you have build so far.
24424    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24425        use std::borrow::Cow;
24426        use std::io::{Read, Seek};
24427
24428        use common::{url::Params, ToParts};
24429        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24430
24431        let mut dd = common::DefaultDelegate;
24432        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24433        dlg.begin(common::MethodInfo {
24434            id: "container.projects.zones.clusters.resourceLabels",
24435            http_method: hyper::Method::POST,
24436        });
24437
24438        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
24439            if self._additional_params.contains_key(field) {
24440                dlg.finished(false);
24441                return Err(common::Error::FieldClash(field));
24442            }
24443        }
24444
24445        let mut params = Params::with_capacity(6 + self._additional_params.len());
24446        params.push("projectId", self._project_id);
24447        params.push("zone", self._zone);
24448        params.push("clusterId", self._cluster_id);
24449
24450        params.extend(self._additional_params.iter());
24451
24452        params.push("alt", "json");
24453        let mut url = self.hub._base_url.clone()
24454            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/resourceLabels";
24455        if self._scopes.is_empty() {
24456            self._scopes
24457                .insert(Scope::CloudPlatform.as_ref().to_string());
24458        }
24459
24460        #[allow(clippy::single_element_loop)]
24461        for &(find_this, param_name) in [
24462            ("{projectId}", "projectId"),
24463            ("{zone}", "zone"),
24464            ("{clusterId}", "clusterId"),
24465        ]
24466        .iter()
24467        {
24468            url = params.uri_replacement(url, param_name, find_this, false);
24469        }
24470        {
24471            let to_remove = ["clusterId", "zone", "projectId"];
24472            params.remove_params(&to_remove);
24473        }
24474
24475        let url = params.parse_with_url(&url);
24476
24477        let mut json_mime_type = mime::APPLICATION_JSON;
24478        let mut request_value_reader = {
24479            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24480            common::remove_json_null_values(&mut value);
24481            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24482            serde_json::to_writer(&mut dst, &value).unwrap();
24483            dst
24484        };
24485        let request_size = request_value_reader
24486            .seek(std::io::SeekFrom::End(0))
24487            .unwrap();
24488        request_value_reader
24489            .seek(std::io::SeekFrom::Start(0))
24490            .unwrap();
24491
24492        loop {
24493            let token = match self
24494                .hub
24495                .auth
24496                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24497                .await
24498            {
24499                Ok(token) => token,
24500                Err(e) => match dlg.token(e) {
24501                    Ok(token) => token,
24502                    Err(e) => {
24503                        dlg.finished(false);
24504                        return Err(common::Error::MissingToken(e));
24505                    }
24506                },
24507            };
24508            request_value_reader
24509                .seek(std::io::SeekFrom::Start(0))
24510                .unwrap();
24511            let mut req_result = {
24512                let client = &self.hub.client;
24513                dlg.pre_request();
24514                let mut req_builder = hyper::Request::builder()
24515                    .method(hyper::Method::POST)
24516                    .uri(url.as_str())
24517                    .header(USER_AGENT, self.hub._user_agent.clone());
24518
24519                if let Some(token) = token.as_ref() {
24520                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24521                }
24522
24523                let request = req_builder
24524                    .header(CONTENT_TYPE, json_mime_type.to_string())
24525                    .header(CONTENT_LENGTH, request_size as u64)
24526                    .body(common::to_body(
24527                        request_value_reader.get_ref().clone().into(),
24528                    ));
24529
24530                client.request(request.unwrap()).await
24531            };
24532
24533            match req_result {
24534                Err(err) => {
24535                    if let common::Retry::After(d) = dlg.http_error(&err) {
24536                        sleep(d).await;
24537                        continue;
24538                    }
24539                    dlg.finished(false);
24540                    return Err(common::Error::HttpError(err));
24541                }
24542                Ok(res) => {
24543                    let (mut parts, body) = res.into_parts();
24544                    let mut body = common::Body::new(body);
24545                    if !parts.status.is_success() {
24546                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24547                        let error = serde_json::from_str(&common::to_string(&bytes));
24548                        let response = common::to_response(parts, bytes.into());
24549
24550                        if let common::Retry::After(d) =
24551                            dlg.http_failure(&response, error.as_ref().ok())
24552                        {
24553                            sleep(d).await;
24554                            continue;
24555                        }
24556
24557                        dlg.finished(false);
24558
24559                        return Err(match error {
24560                            Ok(value) => common::Error::BadRequest(value),
24561                            _ => common::Error::Failure(response),
24562                        });
24563                    }
24564                    let response = {
24565                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24566                        let encoded = common::to_string(&bytes);
24567                        match serde_json::from_str(&encoded) {
24568                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24569                            Err(error) => {
24570                                dlg.response_json_decode_error(&encoded, &error);
24571                                return Err(common::Error::JsonDecodeError(
24572                                    encoded.to_string(),
24573                                    error,
24574                                ));
24575                            }
24576                        }
24577                    };
24578
24579                    dlg.finished(true);
24580                    return Ok(response);
24581                }
24582            }
24583        }
24584    }
24585
24586    ///
24587    /// Sets the *request* property to the given value.
24588    ///
24589    /// Even though the property as already been set when instantiating this call,
24590    /// we provide this method for API completeness.
24591    pub fn request(
24592        mut self,
24593        new_value: SetLabelsRequest,
24594    ) -> ProjectZoneClusterResourceLabelCall<'a, C> {
24595        self._request = new_value;
24596        self
24597    }
24598    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
24599    ///
24600    /// Sets the *project id* path property to the given value.
24601    ///
24602    /// Even though the property as already been set when instantiating this call,
24603    /// we provide this method for API completeness.
24604    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
24605        self._project_id = new_value.to_string();
24606        self
24607    }
24608    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
24609    ///
24610    /// Sets the *zone* path property to the given value.
24611    ///
24612    /// Even though the property as already been set when instantiating this call,
24613    /// we provide this method for API completeness.
24614    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
24615        self._zone = new_value.to_string();
24616        self
24617    }
24618    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
24619    ///
24620    /// Sets the *cluster id* path property to the given value.
24621    ///
24622    /// Even though the property as already been set when instantiating this call,
24623    /// we provide this method for API completeness.
24624    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
24625        self._cluster_id = new_value.to_string();
24626        self
24627    }
24628    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24629    /// while executing the actual API request.
24630    ///
24631    /// ````text
24632    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24633    /// ````
24634    ///
24635    /// Sets the *delegate* property to the given value.
24636    pub fn delegate(
24637        mut self,
24638        new_value: &'a mut dyn common::Delegate,
24639    ) -> ProjectZoneClusterResourceLabelCall<'a, C> {
24640        self._delegate = Some(new_value);
24641        self
24642    }
24643
24644    /// Set any additional parameter of the query string used in the request.
24645    /// It should be used to set parameters which are not yet available through their own
24646    /// setters.
24647    ///
24648    /// Please note that this method must not be used to set any of the known parameters
24649    /// which have their own setter method. If done anyway, the request will fail.
24650    ///
24651    /// # Additional Parameters
24652    ///
24653    /// * *$.xgafv* (query-string) - V1 error format.
24654    /// * *access_token* (query-string) - OAuth access token.
24655    /// * *alt* (query-string) - Data format for response.
24656    /// * *callback* (query-string) - JSONP
24657    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24658    /// * *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.
24659    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24660    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24661    /// * *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.
24662    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24663    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24664    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterResourceLabelCall<'a, C>
24665    where
24666        T: AsRef<str>,
24667    {
24668        self._additional_params
24669            .insert(name.as_ref().to_string(), value.as_ref().to_string());
24670        self
24671    }
24672
24673    /// Identifies the authorization scope for the method you are building.
24674    ///
24675    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24676    /// [`Scope::CloudPlatform`].
24677    ///
24678    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24679    /// tokens for more than one scope.
24680    ///
24681    /// Usually there is more than one suitable scope to authorize an operation, some of which may
24682    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24683    /// sufficient, a read-write scope will do as well.
24684    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterResourceLabelCall<'a, C>
24685    where
24686        St: AsRef<str>,
24687    {
24688        self._scopes.insert(String::from(scope.as_ref()));
24689        self
24690    }
24691    /// Identifies the authorization scope(s) for the method you are building.
24692    ///
24693    /// See [`Self::add_scope()`] for details.
24694    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterResourceLabelCall<'a, C>
24695    where
24696        I: IntoIterator<Item = St>,
24697        St: AsRef<str>,
24698    {
24699        self._scopes
24700            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24701        self
24702    }
24703
24704    /// Removes all scopes, and no default scope will be used either.
24705    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24706    /// for details).
24707    pub fn clear_scopes(mut self) -> ProjectZoneClusterResourceLabelCall<'a, C> {
24708        self._scopes.clear();
24709        self
24710    }
24711}
24712
24713/// Sets the maintenance policy for a cluster.
24714///
24715/// A builder for the *zones.clusters.setMaintenancePolicy* method supported by a *project* resource.
24716/// It is not used directly, but through a [`ProjectMethods`] instance.
24717///
24718/// # Example
24719///
24720/// Instantiate a resource method builder
24721///
24722/// ```test_harness,no_run
24723/// # extern crate hyper;
24724/// # extern crate hyper_rustls;
24725/// # extern crate google_container1 as container1;
24726/// use container1::api::SetMaintenancePolicyRequest;
24727/// # async fn dox() {
24728/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24729///
24730/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24731/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
24732/// #     secret,
24733/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24734/// # ).build().await.unwrap();
24735///
24736/// # let client = hyper_util::client::legacy::Client::builder(
24737/// #     hyper_util::rt::TokioExecutor::new()
24738/// # )
24739/// # .build(
24740/// #     hyper_rustls::HttpsConnectorBuilder::new()
24741/// #         .with_native_roots()
24742/// #         .unwrap()
24743/// #         .https_or_http()
24744/// #         .enable_http1()
24745/// #         .build()
24746/// # );
24747/// # let mut hub = Container::new(client, auth);
24748/// // As the method needs a request, you would usually fill it with the desired information
24749/// // into the respective structure. Some of the parts shown here might not be applicable !
24750/// // Values shown here are possibly random and not representative !
24751/// let mut req = SetMaintenancePolicyRequest::default();
24752///
24753/// // You can configure optional parameters by calling the respective setters at will, and
24754/// // execute the final call using `doit()`.
24755/// // Values shown here are possibly random and not representative !
24756/// let result = hub.projects().zones_clusters_set_maintenance_policy(req, "projectId", "zone", "clusterId")
24757///              .doit().await;
24758/// # }
24759/// ```
24760pub struct ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
24761where
24762    C: 'a,
24763{
24764    hub: &'a Container<C>,
24765    _request: SetMaintenancePolicyRequest,
24766    _project_id: String,
24767    _zone: String,
24768    _cluster_id: String,
24769    _delegate: Option<&'a mut dyn common::Delegate>,
24770    _additional_params: HashMap<String, String>,
24771    _scopes: BTreeSet<String>,
24772}
24773
24774impl<'a, C> common::CallBuilder for ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {}
24775
24776impl<'a, C> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
24777where
24778    C: common::Connector,
24779{
24780    /// Perform the operation you have build so far.
24781    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24782        use std::borrow::Cow;
24783        use std::io::{Read, Seek};
24784
24785        use common::{url::Params, ToParts};
24786        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24787
24788        let mut dd = common::DefaultDelegate;
24789        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24790        dlg.begin(common::MethodInfo {
24791            id: "container.projects.zones.clusters.setMaintenancePolicy",
24792            http_method: hyper::Method::POST,
24793        });
24794
24795        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
24796            if self._additional_params.contains_key(field) {
24797                dlg.finished(false);
24798                return Err(common::Error::FieldClash(field));
24799            }
24800        }
24801
24802        let mut params = Params::with_capacity(6 + self._additional_params.len());
24803        params.push("projectId", self._project_id);
24804        params.push("zone", self._zone);
24805        params.push("clusterId", self._cluster_id);
24806
24807        params.extend(self._additional_params.iter());
24808
24809        params.push("alt", "json");
24810        let mut url = self.hub._base_url.clone()
24811            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMaintenancePolicy";
24812        if self._scopes.is_empty() {
24813            self._scopes
24814                .insert(Scope::CloudPlatform.as_ref().to_string());
24815        }
24816
24817        #[allow(clippy::single_element_loop)]
24818        for &(find_this, param_name) in [
24819            ("{projectId}", "projectId"),
24820            ("{zone}", "zone"),
24821            ("{clusterId}", "clusterId"),
24822        ]
24823        .iter()
24824        {
24825            url = params.uri_replacement(url, param_name, find_this, false);
24826        }
24827        {
24828            let to_remove = ["clusterId", "zone", "projectId"];
24829            params.remove_params(&to_remove);
24830        }
24831
24832        let url = params.parse_with_url(&url);
24833
24834        let mut json_mime_type = mime::APPLICATION_JSON;
24835        let mut request_value_reader = {
24836            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24837            common::remove_json_null_values(&mut value);
24838            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24839            serde_json::to_writer(&mut dst, &value).unwrap();
24840            dst
24841        };
24842        let request_size = request_value_reader
24843            .seek(std::io::SeekFrom::End(0))
24844            .unwrap();
24845        request_value_reader
24846            .seek(std::io::SeekFrom::Start(0))
24847            .unwrap();
24848
24849        loop {
24850            let token = match self
24851                .hub
24852                .auth
24853                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24854                .await
24855            {
24856                Ok(token) => token,
24857                Err(e) => match dlg.token(e) {
24858                    Ok(token) => token,
24859                    Err(e) => {
24860                        dlg.finished(false);
24861                        return Err(common::Error::MissingToken(e));
24862                    }
24863                },
24864            };
24865            request_value_reader
24866                .seek(std::io::SeekFrom::Start(0))
24867                .unwrap();
24868            let mut req_result = {
24869                let client = &self.hub.client;
24870                dlg.pre_request();
24871                let mut req_builder = hyper::Request::builder()
24872                    .method(hyper::Method::POST)
24873                    .uri(url.as_str())
24874                    .header(USER_AGENT, self.hub._user_agent.clone());
24875
24876                if let Some(token) = token.as_ref() {
24877                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24878                }
24879
24880                let request = req_builder
24881                    .header(CONTENT_TYPE, json_mime_type.to_string())
24882                    .header(CONTENT_LENGTH, request_size as u64)
24883                    .body(common::to_body(
24884                        request_value_reader.get_ref().clone().into(),
24885                    ));
24886
24887                client.request(request.unwrap()).await
24888            };
24889
24890            match req_result {
24891                Err(err) => {
24892                    if let common::Retry::After(d) = dlg.http_error(&err) {
24893                        sleep(d).await;
24894                        continue;
24895                    }
24896                    dlg.finished(false);
24897                    return Err(common::Error::HttpError(err));
24898                }
24899                Ok(res) => {
24900                    let (mut parts, body) = res.into_parts();
24901                    let mut body = common::Body::new(body);
24902                    if !parts.status.is_success() {
24903                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24904                        let error = serde_json::from_str(&common::to_string(&bytes));
24905                        let response = common::to_response(parts, bytes.into());
24906
24907                        if let common::Retry::After(d) =
24908                            dlg.http_failure(&response, error.as_ref().ok())
24909                        {
24910                            sleep(d).await;
24911                            continue;
24912                        }
24913
24914                        dlg.finished(false);
24915
24916                        return Err(match error {
24917                            Ok(value) => common::Error::BadRequest(value),
24918                            _ => common::Error::Failure(response),
24919                        });
24920                    }
24921                    let response = {
24922                        let bytes = common::to_bytes(body).await.unwrap_or_default();
24923                        let encoded = common::to_string(&bytes);
24924                        match serde_json::from_str(&encoded) {
24925                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24926                            Err(error) => {
24927                                dlg.response_json_decode_error(&encoded, &error);
24928                                return Err(common::Error::JsonDecodeError(
24929                                    encoded.to_string(),
24930                                    error,
24931                                ));
24932                            }
24933                        }
24934                    };
24935
24936                    dlg.finished(true);
24937                    return Ok(response);
24938                }
24939            }
24940        }
24941    }
24942
24943    ///
24944    /// Sets the *request* property to the given value.
24945    ///
24946    /// Even though the property as already been set when instantiating this call,
24947    /// we provide this method for API completeness.
24948    pub fn request(
24949        mut self,
24950        new_value: SetMaintenancePolicyRequest,
24951    ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
24952        self._request = new_value;
24953        self
24954    }
24955    /// Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
24956    ///
24957    /// Sets the *project id* path property to the given value.
24958    ///
24959    /// Even though the property as already been set when instantiating this call,
24960    /// we provide this method for API completeness.
24961    pub fn project_id(
24962        mut self,
24963        new_value: &str,
24964    ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
24965        self._project_id = new_value.to_string();
24966        self
24967    }
24968    /// Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
24969    ///
24970    /// Sets the *zone* path property to the given value.
24971    ///
24972    /// Even though the property as already been set when instantiating this call,
24973    /// we provide this method for API completeness.
24974    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
24975        self._zone = new_value.to_string();
24976        self
24977    }
24978    /// Required. The name of the cluster to update.
24979    ///
24980    /// Sets the *cluster id* path property to the given value.
24981    ///
24982    /// Even though the property as already been set when instantiating this call,
24983    /// we provide this method for API completeness.
24984    pub fn cluster_id(
24985        mut self,
24986        new_value: &str,
24987    ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
24988        self._cluster_id = new_value.to_string();
24989        self
24990    }
24991    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24992    /// while executing the actual API request.
24993    ///
24994    /// ````text
24995    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
24996    /// ````
24997    ///
24998    /// Sets the *delegate* property to the given value.
24999    pub fn delegate(
25000        mut self,
25001        new_value: &'a mut dyn common::Delegate,
25002    ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
25003        self._delegate = Some(new_value);
25004        self
25005    }
25006
25007    /// Set any additional parameter of the query string used in the request.
25008    /// It should be used to set parameters which are not yet available through their own
25009    /// setters.
25010    ///
25011    /// Please note that this method must not be used to set any of the known parameters
25012    /// which have their own setter method. If done anyway, the request will fail.
25013    ///
25014    /// # Additional Parameters
25015    ///
25016    /// * *$.xgafv* (query-string) - V1 error format.
25017    /// * *access_token* (query-string) - OAuth access token.
25018    /// * *alt* (query-string) - Data format for response.
25019    /// * *callback* (query-string) - JSONP
25020    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25021    /// * *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.
25022    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25023    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25024    /// * *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.
25025    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25026    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25027    pub fn param<T>(
25028        mut self,
25029        name: T,
25030        value: T,
25031    ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
25032    where
25033        T: AsRef<str>,
25034    {
25035        self._additional_params
25036            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25037        self
25038    }
25039
25040    /// Identifies the authorization scope for the method you are building.
25041    ///
25042    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25043    /// [`Scope::CloudPlatform`].
25044    ///
25045    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25046    /// tokens for more than one scope.
25047    ///
25048    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25049    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25050    /// sufficient, a read-write scope will do as well.
25051    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
25052    where
25053        St: AsRef<str>,
25054    {
25055        self._scopes.insert(String::from(scope.as_ref()));
25056        self
25057    }
25058    /// Identifies the authorization scope(s) for the method you are building.
25059    ///
25060    /// See [`Self::add_scope()`] for details.
25061    pub fn add_scopes<I, St>(
25062        mut self,
25063        scopes: I,
25064    ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
25065    where
25066        I: IntoIterator<Item = St>,
25067        St: AsRef<str>,
25068    {
25069        self._scopes
25070            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25071        self
25072    }
25073
25074    /// Removes all scopes, and no default scope will be used either.
25075    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25076    /// for details).
25077    pub fn clear_scopes(mut self) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
25078        self._scopes.clear();
25079        self
25080    }
25081}
25082
25083/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
25084///
25085/// A builder for the *zones.clusters.setMasterAuth* method supported by a *project* resource.
25086/// It is not used directly, but through a [`ProjectMethods`] instance.
25087///
25088/// # Example
25089///
25090/// Instantiate a resource method builder
25091///
25092/// ```test_harness,no_run
25093/// # extern crate hyper;
25094/// # extern crate hyper_rustls;
25095/// # extern crate google_container1 as container1;
25096/// use container1::api::SetMasterAuthRequest;
25097/// # async fn dox() {
25098/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25099///
25100/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25101/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25102/// #     secret,
25103/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25104/// # ).build().await.unwrap();
25105///
25106/// # let client = hyper_util::client::legacy::Client::builder(
25107/// #     hyper_util::rt::TokioExecutor::new()
25108/// # )
25109/// # .build(
25110/// #     hyper_rustls::HttpsConnectorBuilder::new()
25111/// #         .with_native_roots()
25112/// #         .unwrap()
25113/// #         .https_or_http()
25114/// #         .enable_http1()
25115/// #         .build()
25116/// # );
25117/// # let mut hub = Container::new(client, auth);
25118/// // As the method needs a request, you would usually fill it with the desired information
25119/// // into the respective structure. Some of the parts shown here might not be applicable !
25120/// // Values shown here are possibly random and not representative !
25121/// let mut req = SetMasterAuthRequest::default();
25122///
25123/// // You can configure optional parameters by calling the respective setters at will, and
25124/// // execute the final call using `doit()`.
25125/// // Values shown here are possibly random and not representative !
25126/// let result = hub.projects().zones_clusters_set_master_auth(req, "projectId", "zone", "clusterId")
25127///              .doit().await;
25128/// # }
25129/// ```
25130pub struct ProjectZoneClusterSetMasterAuthCall<'a, C>
25131where
25132    C: 'a,
25133{
25134    hub: &'a Container<C>,
25135    _request: SetMasterAuthRequest,
25136    _project_id: String,
25137    _zone: String,
25138    _cluster_id: String,
25139    _delegate: Option<&'a mut dyn common::Delegate>,
25140    _additional_params: HashMap<String, String>,
25141    _scopes: BTreeSet<String>,
25142}
25143
25144impl<'a, C> common::CallBuilder for ProjectZoneClusterSetMasterAuthCall<'a, C> {}
25145
25146impl<'a, C> ProjectZoneClusterSetMasterAuthCall<'a, C>
25147where
25148    C: common::Connector,
25149{
25150    /// Perform the operation you have build so far.
25151    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25152        use std::borrow::Cow;
25153        use std::io::{Read, Seek};
25154
25155        use common::{url::Params, ToParts};
25156        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25157
25158        let mut dd = common::DefaultDelegate;
25159        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25160        dlg.begin(common::MethodInfo {
25161            id: "container.projects.zones.clusters.setMasterAuth",
25162            http_method: hyper::Method::POST,
25163        });
25164
25165        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
25166            if self._additional_params.contains_key(field) {
25167                dlg.finished(false);
25168                return Err(common::Error::FieldClash(field));
25169            }
25170        }
25171
25172        let mut params = Params::with_capacity(6 + self._additional_params.len());
25173        params.push("projectId", self._project_id);
25174        params.push("zone", self._zone);
25175        params.push("clusterId", self._cluster_id);
25176
25177        params.extend(self._additional_params.iter());
25178
25179        params.push("alt", "json");
25180        let mut url = self.hub._base_url.clone()
25181            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMasterAuth";
25182        if self._scopes.is_empty() {
25183            self._scopes
25184                .insert(Scope::CloudPlatform.as_ref().to_string());
25185        }
25186
25187        #[allow(clippy::single_element_loop)]
25188        for &(find_this, param_name) in [
25189            ("{projectId}", "projectId"),
25190            ("{zone}", "zone"),
25191            ("{clusterId}", "clusterId"),
25192        ]
25193        .iter()
25194        {
25195            url = params.uri_replacement(url, param_name, find_this, false);
25196        }
25197        {
25198            let to_remove = ["clusterId", "zone", "projectId"];
25199            params.remove_params(&to_remove);
25200        }
25201
25202        let url = params.parse_with_url(&url);
25203
25204        let mut json_mime_type = mime::APPLICATION_JSON;
25205        let mut request_value_reader = {
25206            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25207            common::remove_json_null_values(&mut value);
25208            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25209            serde_json::to_writer(&mut dst, &value).unwrap();
25210            dst
25211        };
25212        let request_size = request_value_reader
25213            .seek(std::io::SeekFrom::End(0))
25214            .unwrap();
25215        request_value_reader
25216            .seek(std::io::SeekFrom::Start(0))
25217            .unwrap();
25218
25219        loop {
25220            let token = match self
25221                .hub
25222                .auth
25223                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25224                .await
25225            {
25226                Ok(token) => token,
25227                Err(e) => match dlg.token(e) {
25228                    Ok(token) => token,
25229                    Err(e) => {
25230                        dlg.finished(false);
25231                        return Err(common::Error::MissingToken(e));
25232                    }
25233                },
25234            };
25235            request_value_reader
25236                .seek(std::io::SeekFrom::Start(0))
25237                .unwrap();
25238            let mut req_result = {
25239                let client = &self.hub.client;
25240                dlg.pre_request();
25241                let mut req_builder = hyper::Request::builder()
25242                    .method(hyper::Method::POST)
25243                    .uri(url.as_str())
25244                    .header(USER_AGENT, self.hub._user_agent.clone());
25245
25246                if let Some(token) = token.as_ref() {
25247                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25248                }
25249
25250                let request = req_builder
25251                    .header(CONTENT_TYPE, json_mime_type.to_string())
25252                    .header(CONTENT_LENGTH, request_size as u64)
25253                    .body(common::to_body(
25254                        request_value_reader.get_ref().clone().into(),
25255                    ));
25256
25257                client.request(request.unwrap()).await
25258            };
25259
25260            match req_result {
25261                Err(err) => {
25262                    if let common::Retry::After(d) = dlg.http_error(&err) {
25263                        sleep(d).await;
25264                        continue;
25265                    }
25266                    dlg.finished(false);
25267                    return Err(common::Error::HttpError(err));
25268                }
25269                Ok(res) => {
25270                    let (mut parts, body) = res.into_parts();
25271                    let mut body = common::Body::new(body);
25272                    if !parts.status.is_success() {
25273                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25274                        let error = serde_json::from_str(&common::to_string(&bytes));
25275                        let response = common::to_response(parts, bytes.into());
25276
25277                        if let common::Retry::After(d) =
25278                            dlg.http_failure(&response, error.as_ref().ok())
25279                        {
25280                            sleep(d).await;
25281                            continue;
25282                        }
25283
25284                        dlg.finished(false);
25285
25286                        return Err(match error {
25287                            Ok(value) => common::Error::BadRequest(value),
25288                            _ => common::Error::Failure(response),
25289                        });
25290                    }
25291                    let response = {
25292                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25293                        let encoded = common::to_string(&bytes);
25294                        match serde_json::from_str(&encoded) {
25295                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25296                            Err(error) => {
25297                                dlg.response_json_decode_error(&encoded, &error);
25298                                return Err(common::Error::JsonDecodeError(
25299                                    encoded.to_string(),
25300                                    error,
25301                                ));
25302                            }
25303                        }
25304                    };
25305
25306                    dlg.finished(true);
25307                    return Ok(response);
25308                }
25309            }
25310        }
25311    }
25312
25313    ///
25314    /// Sets the *request* property to the given value.
25315    ///
25316    /// Even though the property as already been set when instantiating this call,
25317    /// we provide this method for API completeness.
25318    pub fn request(
25319        mut self,
25320        new_value: SetMasterAuthRequest,
25321    ) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
25322        self._request = new_value;
25323        self
25324    }
25325    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
25326    ///
25327    /// Sets the *project id* path property to the given value.
25328    ///
25329    /// Even though the property as already been set when instantiating this call,
25330    /// we provide this method for API completeness.
25331    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
25332        self._project_id = new_value.to_string();
25333        self
25334    }
25335    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
25336    ///
25337    /// Sets the *zone* path property to the given value.
25338    ///
25339    /// Even though the property as already been set when instantiating this call,
25340    /// we provide this method for API completeness.
25341    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
25342        self._zone = new_value.to_string();
25343        self
25344    }
25345    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
25346    ///
25347    /// Sets the *cluster id* path property to the given value.
25348    ///
25349    /// Even though the property as already been set when instantiating this call,
25350    /// we provide this method for API completeness.
25351    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
25352        self._cluster_id = new_value.to_string();
25353        self
25354    }
25355    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25356    /// while executing the actual API request.
25357    ///
25358    /// ````text
25359    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25360    /// ````
25361    ///
25362    /// Sets the *delegate* property to the given value.
25363    pub fn delegate(
25364        mut self,
25365        new_value: &'a mut dyn common::Delegate,
25366    ) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
25367        self._delegate = Some(new_value);
25368        self
25369    }
25370
25371    /// Set any additional parameter of the query string used in the request.
25372    /// It should be used to set parameters which are not yet available through their own
25373    /// setters.
25374    ///
25375    /// Please note that this method must not be used to set any of the known parameters
25376    /// which have their own setter method. If done anyway, the request will fail.
25377    ///
25378    /// # Additional Parameters
25379    ///
25380    /// * *$.xgafv* (query-string) - V1 error format.
25381    /// * *access_token* (query-string) - OAuth access token.
25382    /// * *alt* (query-string) - Data format for response.
25383    /// * *callback* (query-string) - JSONP
25384    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25385    /// * *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.
25386    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25387    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25388    /// * *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.
25389    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25390    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25391    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
25392    where
25393        T: AsRef<str>,
25394    {
25395        self._additional_params
25396            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25397        self
25398    }
25399
25400    /// Identifies the authorization scope for the method you are building.
25401    ///
25402    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25403    /// [`Scope::CloudPlatform`].
25404    ///
25405    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25406    /// tokens for more than one scope.
25407    ///
25408    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25409    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25410    /// sufficient, a read-write scope will do as well.
25411    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
25412    where
25413        St: AsRef<str>,
25414    {
25415        self._scopes.insert(String::from(scope.as_ref()));
25416        self
25417    }
25418    /// Identifies the authorization scope(s) for the method you are building.
25419    ///
25420    /// See [`Self::add_scope()`] for details.
25421    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
25422    where
25423        I: IntoIterator<Item = St>,
25424        St: AsRef<str>,
25425    {
25426        self._scopes
25427            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25428        self
25429    }
25430
25431    /// Removes all scopes, and no default scope will be used either.
25432    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25433    /// for details).
25434    pub fn clear_scopes(mut self) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
25435        self._scopes.clear();
25436        self
25437    }
25438}
25439
25440/// Enables or disables Network Policy for a cluster.
25441///
25442/// A builder for the *zones.clusters.setNetworkPolicy* method supported by a *project* resource.
25443/// It is not used directly, but through a [`ProjectMethods`] instance.
25444///
25445/// # Example
25446///
25447/// Instantiate a resource method builder
25448///
25449/// ```test_harness,no_run
25450/// # extern crate hyper;
25451/// # extern crate hyper_rustls;
25452/// # extern crate google_container1 as container1;
25453/// use container1::api::SetNetworkPolicyRequest;
25454/// # async fn dox() {
25455/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25456///
25457/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25458/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25459/// #     secret,
25460/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25461/// # ).build().await.unwrap();
25462///
25463/// # let client = hyper_util::client::legacy::Client::builder(
25464/// #     hyper_util::rt::TokioExecutor::new()
25465/// # )
25466/// # .build(
25467/// #     hyper_rustls::HttpsConnectorBuilder::new()
25468/// #         .with_native_roots()
25469/// #         .unwrap()
25470/// #         .https_or_http()
25471/// #         .enable_http1()
25472/// #         .build()
25473/// # );
25474/// # let mut hub = Container::new(client, auth);
25475/// // As the method needs a request, you would usually fill it with the desired information
25476/// // into the respective structure. Some of the parts shown here might not be applicable !
25477/// // Values shown here are possibly random and not representative !
25478/// let mut req = SetNetworkPolicyRequest::default();
25479///
25480/// // You can configure optional parameters by calling the respective setters at will, and
25481/// // execute the final call using `doit()`.
25482/// // Values shown here are possibly random and not representative !
25483/// let result = hub.projects().zones_clusters_set_network_policy(req, "projectId", "zone", "clusterId")
25484///              .doit().await;
25485/// # }
25486/// ```
25487pub struct ProjectZoneClusterSetNetworkPolicyCall<'a, C>
25488where
25489    C: 'a,
25490{
25491    hub: &'a Container<C>,
25492    _request: SetNetworkPolicyRequest,
25493    _project_id: String,
25494    _zone: String,
25495    _cluster_id: String,
25496    _delegate: Option<&'a mut dyn common::Delegate>,
25497    _additional_params: HashMap<String, String>,
25498    _scopes: BTreeSet<String>,
25499}
25500
25501impl<'a, C> common::CallBuilder for ProjectZoneClusterSetNetworkPolicyCall<'a, C> {}
25502
25503impl<'a, C> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
25504where
25505    C: common::Connector,
25506{
25507    /// Perform the operation you have build so far.
25508    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25509        use std::borrow::Cow;
25510        use std::io::{Read, Seek};
25511
25512        use common::{url::Params, ToParts};
25513        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25514
25515        let mut dd = common::DefaultDelegate;
25516        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25517        dlg.begin(common::MethodInfo {
25518            id: "container.projects.zones.clusters.setNetworkPolicy",
25519            http_method: hyper::Method::POST,
25520        });
25521
25522        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
25523            if self._additional_params.contains_key(field) {
25524                dlg.finished(false);
25525                return Err(common::Error::FieldClash(field));
25526            }
25527        }
25528
25529        let mut params = Params::with_capacity(6 + self._additional_params.len());
25530        params.push("projectId", self._project_id);
25531        params.push("zone", self._zone);
25532        params.push("clusterId", self._cluster_id);
25533
25534        params.extend(self._additional_params.iter());
25535
25536        params.push("alt", "json");
25537        let mut url = self.hub._base_url.clone()
25538            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setNetworkPolicy";
25539        if self._scopes.is_empty() {
25540            self._scopes
25541                .insert(Scope::CloudPlatform.as_ref().to_string());
25542        }
25543
25544        #[allow(clippy::single_element_loop)]
25545        for &(find_this, param_name) in [
25546            ("{projectId}", "projectId"),
25547            ("{zone}", "zone"),
25548            ("{clusterId}", "clusterId"),
25549        ]
25550        .iter()
25551        {
25552            url = params.uri_replacement(url, param_name, find_this, false);
25553        }
25554        {
25555            let to_remove = ["clusterId", "zone", "projectId"];
25556            params.remove_params(&to_remove);
25557        }
25558
25559        let url = params.parse_with_url(&url);
25560
25561        let mut json_mime_type = mime::APPLICATION_JSON;
25562        let mut request_value_reader = {
25563            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25564            common::remove_json_null_values(&mut value);
25565            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25566            serde_json::to_writer(&mut dst, &value).unwrap();
25567            dst
25568        };
25569        let request_size = request_value_reader
25570            .seek(std::io::SeekFrom::End(0))
25571            .unwrap();
25572        request_value_reader
25573            .seek(std::io::SeekFrom::Start(0))
25574            .unwrap();
25575
25576        loop {
25577            let token = match self
25578                .hub
25579                .auth
25580                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25581                .await
25582            {
25583                Ok(token) => token,
25584                Err(e) => match dlg.token(e) {
25585                    Ok(token) => token,
25586                    Err(e) => {
25587                        dlg.finished(false);
25588                        return Err(common::Error::MissingToken(e));
25589                    }
25590                },
25591            };
25592            request_value_reader
25593                .seek(std::io::SeekFrom::Start(0))
25594                .unwrap();
25595            let mut req_result = {
25596                let client = &self.hub.client;
25597                dlg.pre_request();
25598                let mut req_builder = hyper::Request::builder()
25599                    .method(hyper::Method::POST)
25600                    .uri(url.as_str())
25601                    .header(USER_AGENT, self.hub._user_agent.clone());
25602
25603                if let Some(token) = token.as_ref() {
25604                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25605                }
25606
25607                let request = req_builder
25608                    .header(CONTENT_TYPE, json_mime_type.to_string())
25609                    .header(CONTENT_LENGTH, request_size as u64)
25610                    .body(common::to_body(
25611                        request_value_reader.get_ref().clone().into(),
25612                    ));
25613
25614                client.request(request.unwrap()).await
25615            };
25616
25617            match req_result {
25618                Err(err) => {
25619                    if let common::Retry::After(d) = dlg.http_error(&err) {
25620                        sleep(d).await;
25621                        continue;
25622                    }
25623                    dlg.finished(false);
25624                    return Err(common::Error::HttpError(err));
25625                }
25626                Ok(res) => {
25627                    let (mut parts, body) = res.into_parts();
25628                    let mut body = common::Body::new(body);
25629                    if !parts.status.is_success() {
25630                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25631                        let error = serde_json::from_str(&common::to_string(&bytes));
25632                        let response = common::to_response(parts, bytes.into());
25633
25634                        if let common::Retry::After(d) =
25635                            dlg.http_failure(&response, error.as_ref().ok())
25636                        {
25637                            sleep(d).await;
25638                            continue;
25639                        }
25640
25641                        dlg.finished(false);
25642
25643                        return Err(match error {
25644                            Ok(value) => common::Error::BadRequest(value),
25645                            _ => common::Error::Failure(response),
25646                        });
25647                    }
25648                    let response = {
25649                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25650                        let encoded = common::to_string(&bytes);
25651                        match serde_json::from_str(&encoded) {
25652                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25653                            Err(error) => {
25654                                dlg.response_json_decode_error(&encoded, &error);
25655                                return Err(common::Error::JsonDecodeError(
25656                                    encoded.to_string(),
25657                                    error,
25658                                ));
25659                            }
25660                        }
25661                    };
25662
25663                    dlg.finished(true);
25664                    return Ok(response);
25665                }
25666            }
25667        }
25668    }
25669
25670    ///
25671    /// Sets the *request* property to the given value.
25672    ///
25673    /// Even though the property as already been set when instantiating this call,
25674    /// we provide this method for API completeness.
25675    pub fn request(
25676        mut self,
25677        new_value: SetNetworkPolicyRequest,
25678    ) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
25679        self._request = new_value;
25680        self
25681    }
25682    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
25683    ///
25684    /// Sets the *project id* path property to the given value.
25685    ///
25686    /// Even though the property as already been set when instantiating this call,
25687    /// we provide this method for API completeness.
25688    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
25689        self._project_id = new_value.to_string();
25690        self
25691    }
25692    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
25693    ///
25694    /// Sets the *zone* path property to the given value.
25695    ///
25696    /// Even though the property as already been set when instantiating this call,
25697    /// we provide this method for API completeness.
25698    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
25699        self._zone = new_value.to_string();
25700        self
25701    }
25702    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
25703    ///
25704    /// Sets the *cluster id* path property to the given value.
25705    ///
25706    /// Even though the property as already been set when instantiating this call,
25707    /// we provide this method for API completeness.
25708    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
25709        self._cluster_id = new_value.to_string();
25710        self
25711    }
25712    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25713    /// while executing the actual API request.
25714    ///
25715    /// ````text
25716    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
25717    /// ````
25718    ///
25719    /// Sets the *delegate* property to the given value.
25720    pub fn delegate(
25721        mut self,
25722        new_value: &'a mut dyn common::Delegate,
25723    ) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
25724        self._delegate = Some(new_value);
25725        self
25726    }
25727
25728    /// Set any additional parameter of the query string used in the request.
25729    /// It should be used to set parameters which are not yet available through their own
25730    /// setters.
25731    ///
25732    /// Please note that this method must not be used to set any of the known parameters
25733    /// which have their own setter method. If done anyway, the request will fail.
25734    ///
25735    /// # Additional Parameters
25736    ///
25737    /// * *$.xgafv* (query-string) - V1 error format.
25738    /// * *access_token* (query-string) - OAuth access token.
25739    /// * *alt* (query-string) - Data format for response.
25740    /// * *callback* (query-string) - JSONP
25741    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25742    /// * *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.
25743    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25744    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25745    /// * *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.
25746    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25747    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25748    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
25749    where
25750        T: AsRef<str>,
25751    {
25752        self._additional_params
25753            .insert(name.as_ref().to_string(), value.as_ref().to_string());
25754        self
25755    }
25756
25757    /// Identifies the authorization scope for the method you are building.
25758    ///
25759    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25760    /// [`Scope::CloudPlatform`].
25761    ///
25762    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25763    /// tokens for more than one scope.
25764    ///
25765    /// Usually there is more than one suitable scope to authorize an operation, some of which may
25766    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25767    /// sufficient, a read-write scope will do as well.
25768    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
25769    where
25770        St: AsRef<str>,
25771    {
25772        self._scopes.insert(String::from(scope.as_ref()));
25773        self
25774    }
25775    /// Identifies the authorization scope(s) for the method you are building.
25776    ///
25777    /// See [`Self::add_scope()`] for details.
25778    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
25779    where
25780        I: IntoIterator<Item = St>,
25781        St: AsRef<str>,
25782    {
25783        self._scopes
25784            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25785        self
25786    }
25787
25788    /// Removes all scopes, and no default scope will be used either.
25789    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25790    /// for details).
25791    pub fn clear_scopes(mut self) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
25792        self._scopes.clear();
25793        self
25794    }
25795}
25796
25797/// Starts master IP rotation.
25798///
25799/// A builder for the *zones.clusters.startIpRotation* method supported by a *project* resource.
25800/// It is not used directly, but through a [`ProjectMethods`] instance.
25801///
25802/// # Example
25803///
25804/// Instantiate a resource method builder
25805///
25806/// ```test_harness,no_run
25807/// # extern crate hyper;
25808/// # extern crate hyper_rustls;
25809/// # extern crate google_container1 as container1;
25810/// use container1::api::StartIPRotationRequest;
25811/// # async fn dox() {
25812/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25813///
25814/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25815/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
25816/// #     secret,
25817/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25818/// # ).build().await.unwrap();
25819///
25820/// # let client = hyper_util::client::legacy::Client::builder(
25821/// #     hyper_util::rt::TokioExecutor::new()
25822/// # )
25823/// # .build(
25824/// #     hyper_rustls::HttpsConnectorBuilder::new()
25825/// #         .with_native_roots()
25826/// #         .unwrap()
25827/// #         .https_or_http()
25828/// #         .enable_http1()
25829/// #         .build()
25830/// # );
25831/// # let mut hub = Container::new(client, auth);
25832/// // As the method needs a request, you would usually fill it with the desired information
25833/// // into the respective structure. Some of the parts shown here might not be applicable !
25834/// // Values shown here are possibly random and not representative !
25835/// let mut req = StartIPRotationRequest::default();
25836///
25837/// // You can configure optional parameters by calling the respective setters at will, and
25838/// // execute the final call using `doit()`.
25839/// // Values shown here are possibly random and not representative !
25840/// let result = hub.projects().zones_clusters_start_ip_rotation(req, "projectId", "zone", "clusterId")
25841///              .doit().await;
25842/// # }
25843/// ```
25844pub struct ProjectZoneClusterStartIpRotationCall<'a, C>
25845where
25846    C: 'a,
25847{
25848    hub: &'a Container<C>,
25849    _request: StartIPRotationRequest,
25850    _project_id: String,
25851    _zone: String,
25852    _cluster_id: String,
25853    _delegate: Option<&'a mut dyn common::Delegate>,
25854    _additional_params: HashMap<String, String>,
25855    _scopes: BTreeSet<String>,
25856}
25857
25858impl<'a, C> common::CallBuilder for ProjectZoneClusterStartIpRotationCall<'a, C> {}
25859
25860impl<'a, C> ProjectZoneClusterStartIpRotationCall<'a, C>
25861where
25862    C: common::Connector,
25863{
25864    /// Perform the operation you have build so far.
25865    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25866        use std::borrow::Cow;
25867        use std::io::{Read, Seek};
25868
25869        use common::{url::Params, ToParts};
25870        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25871
25872        let mut dd = common::DefaultDelegate;
25873        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25874        dlg.begin(common::MethodInfo {
25875            id: "container.projects.zones.clusters.startIpRotation",
25876            http_method: hyper::Method::POST,
25877        });
25878
25879        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
25880            if self._additional_params.contains_key(field) {
25881                dlg.finished(false);
25882                return Err(common::Error::FieldClash(field));
25883            }
25884        }
25885
25886        let mut params = Params::with_capacity(6 + self._additional_params.len());
25887        params.push("projectId", self._project_id);
25888        params.push("zone", self._zone);
25889        params.push("clusterId", self._cluster_id);
25890
25891        params.extend(self._additional_params.iter());
25892
25893        params.push("alt", "json");
25894        let mut url = self.hub._base_url.clone()
25895            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:startIpRotation";
25896        if self._scopes.is_empty() {
25897            self._scopes
25898                .insert(Scope::CloudPlatform.as_ref().to_string());
25899        }
25900
25901        #[allow(clippy::single_element_loop)]
25902        for &(find_this, param_name) in [
25903            ("{projectId}", "projectId"),
25904            ("{zone}", "zone"),
25905            ("{clusterId}", "clusterId"),
25906        ]
25907        .iter()
25908        {
25909            url = params.uri_replacement(url, param_name, find_this, false);
25910        }
25911        {
25912            let to_remove = ["clusterId", "zone", "projectId"];
25913            params.remove_params(&to_remove);
25914        }
25915
25916        let url = params.parse_with_url(&url);
25917
25918        let mut json_mime_type = mime::APPLICATION_JSON;
25919        let mut request_value_reader = {
25920            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25921            common::remove_json_null_values(&mut value);
25922            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25923            serde_json::to_writer(&mut dst, &value).unwrap();
25924            dst
25925        };
25926        let request_size = request_value_reader
25927            .seek(std::io::SeekFrom::End(0))
25928            .unwrap();
25929        request_value_reader
25930            .seek(std::io::SeekFrom::Start(0))
25931            .unwrap();
25932
25933        loop {
25934            let token = match self
25935                .hub
25936                .auth
25937                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25938                .await
25939            {
25940                Ok(token) => token,
25941                Err(e) => match dlg.token(e) {
25942                    Ok(token) => token,
25943                    Err(e) => {
25944                        dlg.finished(false);
25945                        return Err(common::Error::MissingToken(e));
25946                    }
25947                },
25948            };
25949            request_value_reader
25950                .seek(std::io::SeekFrom::Start(0))
25951                .unwrap();
25952            let mut req_result = {
25953                let client = &self.hub.client;
25954                dlg.pre_request();
25955                let mut req_builder = hyper::Request::builder()
25956                    .method(hyper::Method::POST)
25957                    .uri(url.as_str())
25958                    .header(USER_AGENT, self.hub._user_agent.clone());
25959
25960                if let Some(token) = token.as_ref() {
25961                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25962                }
25963
25964                let request = req_builder
25965                    .header(CONTENT_TYPE, json_mime_type.to_string())
25966                    .header(CONTENT_LENGTH, request_size as u64)
25967                    .body(common::to_body(
25968                        request_value_reader.get_ref().clone().into(),
25969                    ));
25970
25971                client.request(request.unwrap()).await
25972            };
25973
25974            match req_result {
25975                Err(err) => {
25976                    if let common::Retry::After(d) = dlg.http_error(&err) {
25977                        sleep(d).await;
25978                        continue;
25979                    }
25980                    dlg.finished(false);
25981                    return Err(common::Error::HttpError(err));
25982                }
25983                Ok(res) => {
25984                    let (mut parts, body) = res.into_parts();
25985                    let mut body = common::Body::new(body);
25986                    if !parts.status.is_success() {
25987                        let bytes = common::to_bytes(body).await.unwrap_or_default();
25988                        let error = serde_json::from_str(&common::to_string(&bytes));
25989                        let response = common::to_response(parts, bytes.into());
25990
25991                        if let common::Retry::After(d) =
25992                            dlg.http_failure(&response, error.as_ref().ok())
25993                        {
25994                            sleep(d).await;
25995                            continue;
25996                        }
25997
25998                        dlg.finished(false);
25999
26000                        return Err(match error {
26001                            Ok(value) => common::Error::BadRequest(value),
26002                            _ => common::Error::Failure(response),
26003                        });
26004                    }
26005                    let response = {
26006                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26007                        let encoded = common::to_string(&bytes);
26008                        match serde_json::from_str(&encoded) {
26009                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26010                            Err(error) => {
26011                                dlg.response_json_decode_error(&encoded, &error);
26012                                return Err(common::Error::JsonDecodeError(
26013                                    encoded.to_string(),
26014                                    error,
26015                                ));
26016                            }
26017                        }
26018                    };
26019
26020                    dlg.finished(true);
26021                    return Ok(response);
26022                }
26023            }
26024        }
26025    }
26026
26027    ///
26028    /// Sets the *request* property to the given value.
26029    ///
26030    /// Even though the property as already been set when instantiating this call,
26031    /// we provide this method for API completeness.
26032    pub fn request(
26033        mut self,
26034        new_value: StartIPRotationRequest,
26035    ) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
26036        self._request = new_value;
26037        self
26038    }
26039    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
26040    ///
26041    /// Sets the *project id* path property to the given value.
26042    ///
26043    /// Even though the property as already been set when instantiating this call,
26044    /// we provide this method for API completeness.
26045    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
26046        self._project_id = new_value.to_string();
26047        self
26048    }
26049    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
26050    ///
26051    /// Sets the *zone* path property to the given value.
26052    ///
26053    /// Even though the property as already been set when instantiating this call,
26054    /// we provide this method for API completeness.
26055    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
26056        self._zone = new_value.to_string();
26057        self
26058    }
26059    /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
26060    ///
26061    /// Sets the *cluster id* path property to the given value.
26062    ///
26063    /// Even though the property as already been set when instantiating this call,
26064    /// we provide this method for API completeness.
26065    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
26066        self._cluster_id = new_value.to_string();
26067        self
26068    }
26069    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26070    /// while executing the actual API request.
26071    ///
26072    /// ````text
26073    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26074    /// ````
26075    ///
26076    /// Sets the *delegate* property to the given value.
26077    pub fn delegate(
26078        mut self,
26079        new_value: &'a mut dyn common::Delegate,
26080    ) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
26081        self._delegate = Some(new_value);
26082        self
26083    }
26084
26085    /// Set any additional parameter of the query string used in the request.
26086    /// It should be used to set parameters which are not yet available through their own
26087    /// setters.
26088    ///
26089    /// Please note that this method must not be used to set any of the known parameters
26090    /// which have their own setter method. If done anyway, the request will fail.
26091    ///
26092    /// # Additional Parameters
26093    ///
26094    /// * *$.xgafv* (query-string) - V1 error format.
26095    /// * *access_token* (query-string) - OAuth access token.
26096    /// * *alt* (query-string) - Data format for response.
26097    /// * *callback* (query-string) - JSONP
26098    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26099    /// * *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.
26100    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26101    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26102    /// * *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.
26103    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26104    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26105    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterStartIpRotationCall<'a, C>
26106    where
26107        T: AsRef<str>,
26108    {
26109        self._additional_params
26110            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26111        self
26112    }
26113
26114    /// Identifies the authorization scope for the method you are building.
26115    ///
26116    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26117    /// [`Scope::CloudPlatform`].
26118    ///
26119    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26120    /// tokens for more than one scope.
26121    ///
26122    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26123    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26124    /// sufficient, a read-write scope will do as well.
26125    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterStartIpRotationCall<'a, C>
26126    where
26127        St: AsRef<str>,
26128    {
26129        self._scopes.insert(String::from(scope.as_ref()));
26130        self
26131    }
26132    /// Identifies the authorization scope(s) for the method you are building.
26133    ///
26134    /// See [`Self::add_scope()`] for details.
26135    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterStartIpRotationCall<'a, C>
26136    where
26137        I: IntoIterator<Item = St>,
26138        St: AsRef<str>,
26139    {
26140        self._scopes
26141            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26142        self
26143    }
26144
26145    /// Removes all scopes, and no default scope will be used either.
26146    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26147    /// for details).
26148    pub fn clear_scopes(mut self) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
26149        self._scopes.clear();
26150        self
26151    }
26152}
26153
26154/// Updates the settings of a specific cluster.
26155///
26156/// A builder for the *zones.clusters.update* method supported by a *project* resource.
26157/// It is not used directly, but through a [`ProjectMethods`] instance.
26158///
26159/// # Example
26160///
26161/// Instantiate a resource method builder
26162///
26163/// ```test_harness,no_run
26164/// # extern crate hyper;
26165/// # extern crate hyper_rustls;
26166/// # extern crate google_container1 as container1;
26167/// use container1::api::UpdateClusterRequest;
26168/// # async fn dox() {
26169/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26170///
26171/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26172/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26173/// #     secret,
26174/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26175/// # ).build().await.unwrap();
26176///
26177/// # let client = hyper_util::client::legacy::Client::builder(
26178/// #     hyper_util::rt::TokioExecutor::new()
26179/// # )
26180/// # .build(
26181/// #     hyper_rustls::HttpsConnectorBuilder::new()
26182/// #         .with_native_roots()
26183/// #         .unwrap()
26184/// #         .https_or_http()
26185/// #         .enable_http1()
26186/// #         .build()
26187/// # );
26188/// # let mut hub = Container::new(client, auth);
26189/// // As the method needs a request, you would usually fill it with the desired information
26190/// // into the respective structure. Some of the parts shown here might not be applicable !
26191/// // Values shown here are possibly random and not representative !
26192/// let mut req = UpdateClusterRequest::default();
26193///
26194/// // You can configure optional parameters by calling the respective setters at will, and
26195/// // execute the final call using `doit()`.
26196/// // Values shown here are possibly random and not representative !
26197/// let result = hub.projects().zones_clusters_update(req, "projectId", "zone", "clusterId")
26198///              .doit().await;
26199/// # }
26200/// ```
26201pub struct ProjectZoneClusterUpdateCall<'a, C>
26202where
26203    C: 'a,
26204{
26205    hub: &'a Container<C>,
26206    _request: UpdateClusterRequest,
26207    _project_id: String,
26208    _zone: String,
26209    _cluster_id: String,
26210    _delegate: Option<&'a mut dyn common::Delegate>,
26211    _additional_params: HashMap<String, String>,
26212    _scopes: BTreeSet<String>,
26213}
26214
26215impl<'a, C> common::CallBuilder for ProjectZoneClusterUpdateCall<'a, C> {}
26216
26217impl<'a, C> ProjectZoneClusterUpdateCall<'a, C>
26218where
26219    C: common::Connector,
26220{
26221    /// Perform the operation you have build so far.
26222    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26223        use std::borrow::Cow;
26224        use std::io::{Read, Seek};
26225
26226        use common::{url::Params, ToParts};
26227        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26228
26229        let mut dd = common::DefaultDelegate;
26230        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26231        dlg.begin(common::MethodInfo {
26232            id: "container.projects.zones.clusters.update",
26233            http_method: hyper::Method::PUT,
26234        });
26235
26236        for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
26237            if self._additional_params.contains_key(field) {
26238                dlg.finished(false);
26239                return Err(common::Error::FieldClash(field));
26240            }
26241        }
26242
26243        let mut params = Params::with_capacity(6 + self._additional_params.len());
26244        params.push("projectId", self._project_id);
26245        params.push("zone", self._zone);
26246        params.push("clusterId", self._cluster_id);
26247
26248        params.extend(self._additional_params.iter());
26249
26250        params.push("alt", "json");
26251        let mut url = self.hub._base_url.clone()
26252            + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
26253        if self._scopes.is_empty() {
26254            self._scopes
26255                .insert(Scope::CloudPlatform.as_ref().to_string());
26256        }
26257
26258        #[allow(clippy::single_element_loop)]
26259        for &(find_this, param_name) in [
26260            ("{projectId}", "projectId"),
26261            ("{zone}", "zone"),
26262            ("{clusterId}", "clusterId"),
26263        ]
26264        .iter()
26265        {
26266            url = params.uri_replacement(url, param_name, find_this, false);
26267        }
26268        {
26269            let to_remove = ["clusterId", "zone", "projectId"];
26270            params.remove_params(&to_remove);
26271        }
26272
26273        let url = params.parse_with_url(&url);
26274
26275        let mut json_mime_type = mime::APPLICATION_JSON;
26276        let mut request_value_reader = {
26277            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26278            common::remove_json_null_values(&mut value);
26279            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26280            serde_json::to_writer(&mut dst, &value).unwrap();
26281            dst
26282        };
26283        let request_size = request_value_reader
26284            .seek(std::io::SeekFrom::End(0))
26285            .unwrap();
26286        request_value_reader
26287            .seek(std::io::SeekFrom::Start(0))
26288            .unwrap();
26289
26290        loop {
26291            let token = match self
26292                .hub
26293                .auth
26294                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26295                .await
26296            {
26297                Ok(token) => token,
26298                Err(e) => match dlg.token(e) {
26299                    Ok(token) => token,
26300                    Err(e) => {
26301                        dlg.finished(false);
26302                        return Err(common::Error::MissingToken(e));
26303                    }
26304                },
26305            };
26306            request_value_reader
26307                .seek(std::io::SeekFrom::Start(0))
26308                .unwrap();
26309            let mut req_result = {
26310                let client = &self.hub.client;
26311                dlg.pre_request();
26312                let mut req_builder = hyper::Request::builder()
26313                    .method(hyper::Method::PUT)
26314                    .uri(url.as_str())
26315                    .header(USER_AGENT, self.hub._user_agent.clone());
26316
26317                if let Some(token) = token.as_ref() {
26318                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26319                }
26320
26321                let request = req_builder
26322                    .header(CONTENT_TYPE, json_mime_type.to_string())
26323                    .header(CONTENT_LENGTH, request_size as u64)
26324                    .body(common::to_body(
26325                        request_value_reader.get_ref().clone().into(),
26326                    ));
26327
26328                client.request(request.unwrap()).await
26329            };
26330
26331            match req_result {
26332                Err(err) => {
26333                    if let common::Retry::After(d) = dlg.http_error(&err) {
26334                        sleep(d).await;
26335                        continue;
26336                    }
26337                    dlg.finished(false);
26338                    return Err(common::Error::HttpError(err));
26339                }
26340                Ok(res) => {
26341                    let (mut parts, body) = res.into_parts();
26342                    let mut body = common::Body::new(body);
26343                    if !parts.status.is_success() {
26344                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26345                        let error = serde_json::from_str(&common::to_string(&bytes));
26346                        let response = common::to_response(parts, bytes.into());
26347
26348                        if let common::Retry::After(d) =
26349                            dlg.http_failure(&response, error.as_ref().ok())
26350                        {
26351                            sleep(d).await;
26352                            continue;
26353                        }
26354
26355                        dlg.finished(false);
26356
26357                        return Err(match error {
26358                            Ok(value) => common::Error::BadRequest(value),
26359                            _ => common::Error::Failure(response),
26360                        });
26361                    }
26362                    let response = {
26363                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26364                        let encoded = common::to_string(&bytes);
26365                        match serde_json::from_str(&encoded) {
26366                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26367                            Err(error) => {
26368                                dlg.response_json_decode_error(&encoded, &error);
26369                                return Err(common::Error::JsonDecodeError(
26370                                    encoded.to_string(),
26371                                    error,
26372                                ));
26373                            }
26374                        }
26375                    };
26376
26377                    dlg.finished(true);
26378                    return Ok(response);
26379                }
26380            }
26381        }
26382    }
26383
26384    ///
26385    /// Sets the *request* property to the given value.
26386    ///
26387    /// Even though the property as already been set when instantiating this call,
26388    /// we provide this method for API completeness.
26389    pub fn request(
26390        mut self,
26391        new_value: UpdateClusterRequest,
26392    ) -> ProjectZoneClusterUpdateCall<'a, C> {
26393        self._request = new_value;
26394        self
26395    }
26396    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
26397    ///
26398    /// Sets the *project id* path property to the given value.
26399    ///
26400    /// Even though the property as already been set when instantiating this call,
26401    /// we provide this method for API completeness.
26402    pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
26403        self._project_id = new_value.to_string();
26404        self
26405    }
26406    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
26407    ///
26408    /// Sets the *zone* path property to the given value.
26409    ///
26410    /// Even though the property as already been set when instantiating this call,
26411    /// we provide this method for API completeness.
26412    pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
26413        self._zone = new_value.to_string();
26414        self
26415    }
26416    /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
26417    ///
26418    /// Sets the *cluster id* path property to the given value.
26419    ///
26420    /// Even though the property as already been set when instantiating this call,
26421    /// we provide this method for API completeness.
26422    pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
26423        self._cluster_id = new_value.to_string();
26424        self
26425    }
26426    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26427    /// while executing the actual API request.
26428    ///
26429    /// ````text
26430    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26431    /// ````
26432    ///
26433    /// Sets the *delegate* property to the given value.
26434    pub fn delegate(
26435        mut self,
26436        new_value: &'a mut dyn common::Delegate,
26437    ) -> ProjectZoneClusterUpdateCall<'a, C> {
26438        self._delegate = Some(new_value);
26439        self
26440    }
26441
26442    /// Set any additional parameter of the query string used in the request.
26443    /// It should be used to set parameters which are not yet available through their own
26444    /// setters.
26445    ///
26446    /// Please note that this method must not be used to set any of the known parameters
26447    /// which have their own setter method. If done anyway, the request will fail.
26448    ///
26449    /// # Additional Parameters
26450    ///
26451    /// * *$.xgafv* (query-string) - V1 error format.
26452    /// * *access_token* (query-string) - OAuth access token.
26453    /// * *alt* (query-string) - Data format for response.
26454    /// * *callback* (query-string) - JSONP
26455    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26456    /// * *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.
26457    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26458    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26459    /// * *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.
26460    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26461    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26462    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterUpdateCall<'a, C>
26463    where
26464        T: AsRef<str>,
26465    {
26466        self._additional_params
26467            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26468        self
26469    }
26470
26471    /// Identifies the authorization scope for the method you are building.
26472    ///
26473    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26474    /// [`Scope::CloudPlatform`].
26475    ///
26476    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26477    /// tokens for more than one scope.
26478    ///
26479    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26480    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26481    /// sufficient, a read-write scope will do as well.
26482    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterUpdateCall<'a, C>
26483    where
26484        St: AsRef<str>,
26485    {
26486        self._scopes.insert(String::from(scope.as_ref()));
26487        self
26488    }
26489    /// Identifies the authorization scope(s) for the method you are building.
26490    ///
26491    /// See [`Self::add_scope()`] for details.
26492    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterUpdateCall<'a, C>
26493    where
26494        I: IntoIterator<Item = St>,
26495        St: AsRef<str>,
26496    {
26497        self._scopes
26498            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26499        self
26500    }
26501
26502    /// Removes all scopes, and no default scope will be used either.
26503    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26504    /// for details).
26505    pub fn clear_scopes(mut self) -> ProjectZoneClusterUpdateCall<'a, C> {
26506        self._scopes.clear();
26507        self
26508    }
26509}
26510
26511/// Cancels the specified operation.
26512///
26513/// A builder for the *zones.operations.cancel* method supported by a *project* resource.
26514/// It is not used directly, but through a [`ProjectMethods`] instance.
26515///
26516/// # Example
26517///
26518/// Instantiate a resource method builder
26519///
26520/// ```test_harness,no_run
26521/// # extern crate hyper;
26522/// # extern crate hyper_rustls;
26523/// # extern crate google_container1 as container1;
26524/// use container1::api::CancelOperationRequest;
26525/// # async fn dox() {
26526/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26527///
26528/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26529/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26530/// #     secret,
26531/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26532/// # ).build().await.unwrap();
26533///
26534/// # let client = hyper_util::client::legacy::Client::builder(
26535/// #     hyper_util::rt::TokioExecutor::new()
26536/// # )
26537/// # .build(
26538/// #     hyper_rustls::HttpsConnectorBuilder::new()
26539/// #         .with_native_roots()
26540/// #         .unwrap()
26541/// #         .https_or_http()
26542/// #         .enable_http1()
26543/// #         .build()
26544/// # );
26545/// # let mut hub = Container::new(client, auth);
26546/// // As the method needs a request, you would usually fill it with the desired information
26547/// // into the respective structure. Some of the parts shown here might not be applicable !
26548/// // Values shown here are possibly random and not representative !
26549/// let mut req = CancelOperationRequest::default();
26550///
26551/// // You can configure optional parameters by calling the respective setters at will, and
26552/// // execute the final call using `doit()`.
26553/// // Values shown here are possibly random and not representative !
26554/// let result = hub.projects().zones_operations_cancel(req, "projectId", "zone", "operationId")
26555///              .doit().await;
26556/// # }
26557/// ```
26558pub struct ProjectZoneOperationCancelCall<'a, C>
26559where
26560    C: 'a,
26561{
26562    hub: &'a Container<C>,
26563    _request: CancelOperationRequest,
26564    _project_id: String,
26565    _zone: String,
26566    _operation_id: String,
26567    _delegate: Option<&'a mut dyn common::Delegate>,
26568    _additional_params: HashMap<String, String>,
26569    _scopes: BTreeSet<String>,
26570}
26571
26572impl<'a, C> common::CallBuilder for ProjectZoneOperationCancelCall<'a, C> {}
26573
26574impl<'a, C> ProjectZoneOperationCancelCall<'a, C>
26575where
26576    C: common::Connector,
26577{
26578    /// Perform the operation you have build so far.
26579    pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
26580        use std::borrow::Cow;
26581        use std::io::{Read, Seek};
26582
26583        use common::{url::Params, ToParts};
26584        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26585
26586        let mut dd = common::DefaultDelegate;
26587        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26588        dlg.begin(common::MethodInfo {
26589            id: "container.projects.zones.operations.cancel",
26590            http_method: hyper::Method::POST,
26591        });
26592
26593        for &field in ["alt", "projectId", "zone", "operationId"].iter() {
26594            if self._additional_params.contains_key(field) {
26595                dlg.finished(false);
26596                return Err(common::Error::FieldClash(field));
26597            }
26598        }
26599
26600        let mut params = Params::with_capacity(6 + self._additional_params.len());
26601        params.push("projectId", self._project_id);
26602        params.push("zone", self._zone);
26603        params.push("operationId", self._operation_id);
26604
26605        params.extend(self._additional_params.iter());
26606
26607        params.push("alt", "json");
26608        let mut url = self.hub._base_url.clone()
26609            + "v1/projects/{projectId}/zones/{zone}/operations/{operationId}:cancel";
26610        if self._scopes.is_empty() {
26611            self._scopes
26612                .insert(Scope::CloudPlatform.as_ref().to_string());
26613        }
26614
26615        #[allow(clippy::single_element_loop)]
26616        for &(find_this, param_name) in [
26617            ("{projectId}", "projectId"),
26618            ("{zone}", "zone"),
26619            ("{operationId}", "operationId"),
26620        ]
26621        .iter()
26622        {
26623            url = params.uri_replacement(url, param_name, find_this, false);
26624        }
26625        {
26626            let to_remove = ["operationId", "zone", "projectId"];
26627            params.remove_params(&to_remove);
26628        }
26629
26630        let url = params.parse_with_url(&url);
26631
26632        let mut json_mime_type = mime::APPLICATION_JSON;
26633        let mut request_value_reader = {
26634            let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26635            common::remove_json_null_values(&mut value);
26636            let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26637            serde_json::to_writer(&mut dst, &value).unwrap();
26638            dst
26639        };
26640        let request_size = request_value_reader
26641            .seek(std::io::SeekFrom::End(0))
26642            .unwrap();
26643        request_value_reader
26644            .seek(std::io::SeekFrom::Start(0))
26645            .unwrap();
26646
26647        loop {
26648            let token = match self
26649                .hub
26650                .auth
26651                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26652                .await
26653            {
26654                Ok(token) => token,
26655                Err(e) => match dlg.token(e) {
26656                    Ok(token) => token,
26657                    Err(e) => {
26658                        dlg.finished(false);
26659                        return Err(common::Error::MissingToken(e));
26660                    }
26661                },
26662            };
26663            request_value_reader
26664                .seek(std::io::SeekFrom::Start(0))
26665                .unwrap();
26666            let mut req_result = {
26667                let client = &self.hub.client;
26668                dlg.pre_request();
26669                let mut req_builder = hyper::Request::builder()
26670                    .method(hyper::Method::POST)
26671                    .uri(url.as_str())
26672                    .header(USER_AGENT, self.hub._user_agent.clone());
26673
26674                if let Some(token) = token.as_ref() {
26675                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26676                }
26677
26678                let request = req_builder
26679                    .header(CONTENT_TYPE, json_mime_type.to_string())
26680                    .header(CONTENT_LENGTH, request_size as u64)
26681                    .body(common::to_body(
26682                        request_value_reader.get_ref().clone().into(),
26683                    ));
26684
26685                client.request(request.unwrap()).await
26686            };
26687
26688            match req_result {
26689                Err(err) => {
26690                    if let common::Retry::After(d) = dlg.http_error(&err) {
26691                        sleep(d).await;
26692                        continue;
26693                    }
26694                    dlg.finished(false);
26695                    return Err(common::Error::HttpError(err));
26696                }
26697                Ok(res) => {
26698                    let (mut parts, body) = res.into_parts();
26699                    let mut body = common::Body::new(body);
26700                    if !parts.status.is_success() {
26701                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26702                        let error = serde_json::from_str(&common::to_string(&bytes));
26703                        let response = common::to_response(parts, bytes.into());
26704
26705                        if let common::Retry::After(d) =
26706                            dlg.http_failure(&response, error.as_ref().ok())
26707                        {
26708                            sleep(d).await;
26709                            continue;
26710                        }
26711
26712                        dlg.finished(false);
26713
26714                        return Err(match error {
26715                            Ok(value) => common::Error::BadRequest(value),
26716                            _ => common::Error::Failure(response),
26717                        });
26718                    }
26719                    let response = {
26720                        let bytes = common::to_bytes(body).await.unwrap_or_default();
26721                        let encoded = common::to_string(&bytes);
26722                        match serde_json::from_str(&encoded) {
26723                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26724                            Err(error) => {
26725                                dlg.response_json_decode_error(&encoded, &error);
26726                                return Err(common::Error::JsonDecodeError(
26727                                    encoded.to_string(),
26728                                    error,
26729                                ));
26730                            }
26731                        }
26732                    };
26733
26734                    dlg.finished(true);
26735                    return Ok(response);
26736                }
26737            }
26738        }
26739    }
26740
26741    ///
26742    /// Sets the *request* property to the given value.
26743    ///
26744    /// Even though the property as already been set when instantiating this call,
26745    /// we provide this method for API completeness.
26746    pub fn request(
26747        mut self,
26748        new_value: CancelOperationRequest,
26749    ) -> ProjectZoneOperationCancelCall<'a, C> {
26750        self._request = new_value;
26751        self
26752    }
26753    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
26754    ///
26755    /// Sets the *project id* path property to the given value.
26756    ///
26757    /// Even though the property as already been set when instantiating this call,
26758    /// we provide this method for API completeness.
26759    pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
26760        self._project_id = new_value.to_string();
26761        self
26762    }
26763    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the operation resides. This field has been deprecated and replaced by the name field.
26764    ///
26765    /// Sets the *zone* path property to the given value.
26766    ///
26767    /// Even though the property as already been set when instantiating this call,
26768    /// we provide this method for API completeness.
26769    pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
26770        self._zone = new_value.to_string();
26771        self
26772    }
26773    /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
26774    ///
26775    /// Sets the *operation id* path property to the given value.
26776    ///
26777    /// Even though the property as already been set when instantiating this call,
26778    /// we provide this method for API completeness.
26779    pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
26780        self._operation_id = new_value.to_string();
26781        self
26782    }
26783    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26784    /// while executing the actual API request.
26785    ///
26786    /// ````text
26787    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
26788    /// ````
26789    ///
26790    /// Sets the *delegate* property to the given value.
26791    pub fn delegate(
26792        mut self,
26793        new_value: &'a mut dyn common::Delegate,
26794    ) -> ProjectZoneOperationCancelCall<'a, C> {
26795        self._delegate = Some(new_value);
26796        self
26797    }
26798
26799    /// Set any additional parameter of the query string used in the request.
26800    /// It should be used to set parameters which are not yet available through their own
26801    /// setters.
26802    ///
26803    /// Please note that this method must not be used to set any of the known parameters
26804    /// which have their own setter method. If done anyway, the request will fail.
26805    ///
26806    /// # Additional Parameters
26807    ///
26808    /// * *$.xgafv* (query-string) - V1 error format.
26809    /// * *access_token* (query-string) - OAuth access token.
26810    /// * *alt* (query-string) - Data format for response.
26811    /// * *callback* (query-string) - JSONP
26812    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26813    /// * *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.
26814    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26815    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26816    /// * *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.
26817    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26818    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26819    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationCancelCall<'a, C>
26820    where
26821        T: AsRef<str>,
26822    {
26823        self._additional_params
26824            .insert(name.as_ref().to_string(), value.as_ref().to_string());
26825        self
26826    }
26827
26828    /// Identifies the authorization scope for the method you are building.
26829    ///
26830    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26831    /// [`Scope::CloudPlatform`].
26832    ///
26833    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26834    /// tokens for more than one scope.
26835    ///
26836    /// Usually there is more than one suitable scope to authorize an operation, some of which may
26837    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26838    /// sufficient, a read-write scope will do as well.
26839    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationCancelCall<'a, C>
26840    where
26841        St: AsRef<str>,
26842    {
26843        self._scopes.insert(String::from(scope.as_ref()));
26844        self
26845    }
26846    /// Identifies the authorization scope(s) for the method you are building.
26847    ///
26848    /// See [`Self::add_scope()`] for details.
26849    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationCancelCall<'a, C>
26850    where
26851        I: IntoIterator<Item = St>,
26852        St: AsRef<str>,
26853    {
26854        self._scopes
26855            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26856        self
26857    }
26858
26859    /// Removes all scopes, and no default scope will be used either.
26860    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26861    /// for details).
26862    pub fn clear_scopes(mut self) -> ProjectZoneOperationCancelCall<'a, C> {
26863        self._scopes.clear();
26864        self
26865    }
26866}
26867
26868/// Gets the specified operation.
26869///
26870/// A builder for the *zones.operations.get* method supported by a *project* resource.
26871/// It is not used directly, but through a [`ProjectMethods`] instance.
26872///
26873/// # Example
26874///
26875/// Instantiate a resource method builder
26876///
26877/// ```test_harness,no_run
26878/// # extern crate hyper;
26879/// # extern crate hyper_rustls;
26880/// # extern crate google_container1 as container1;
26881/// # async fn dox() {
26882/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26883///
26884/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26885/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
26886/// #     secret,
26887/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26888/// # ).build().await.unwrap();
26889///
26890/// # let client = hyper_util::client::legacy::Client::builder(
26891/// #     hyper_util::rt::TokioExecutor::new()
26892/// # )
26893/// # .build(
26894/// #     hyper_rustls::HttpsConnectorBuilder::new()
26895/// #         .with_native_roots()
26896/// #         .unwrap()
26897/// #         .https_or_http()
26898/// #         .enable_http1()
26899/// #         .build()
26900/// # );
26901/// # let mut hub = Container::new(client, auth);
26902/// // You can configure optional parameters by calling the respective setters at will, and
26903/// // execute the final call using `doit()`.
26904/// // Values shown here are possibly random and not representative !
26905/// let result = hub.projects().zones_operations_get("projectId", "zone", "operationId")
26906///              .name("sea")
26907///              .doit().await;
26908/// # }
26909/// ```
26910pub struct ProjectZoneOperationGetCall<'a, C>
26911where
26912    C: 'a,
26913{
26914    hub: &'a Container<C>,
26915    _project_id: String,
26916    _zone: String,
26917    _operation_id: String,
26918    _name: Option<String>,
26919    _delegate: Option<&'a mut dyn common::Delegate>,
26920    _additional_params: HashMap<String, String>,
26921    _scopes: BTreeSet<String>,
26922}
26923
26924impl<'a, C> common::CallBuilder for ProjectZoneOperationGetCall<'a, C> {}
26925
26926impl<'a, C> ProjectZoneOperationGetCall<'a, C>
26927where
26928    C: common::Connector,
26929{
26930    /// Perform the operation you have build so far.
26931    pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26932        use std::borrow::Cow;
26933        use std::io::{Read, Seek};
26934
26935        use common::{url::Params, ToParts};
26936        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26937
26938        let mut dd = common::DefaultDelegate;
26939        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26940        dlg.begin(common::MethodInfo {
26941            id: "container.projects.zones.operations.get",
26942            http_method: hyper::Method::GET,
26943        });
26944
26945        for &field in ["alt", "projectId", "zone", "operationId", "name"].iter() {
26946            if self._additional_params.contains_key(field) {
26947                dlg.finished(false);
26948                return Err(common::Error::FieldClash(field));
26949            }
26950        }
26951
26952        let mut params = Params::with_capacity(6 + self._additional_params.len());
26953        params.push("projectId", self._project_id);
26954        params.push("zone", self._zone);
26955        params.push("operationId", self._operation_id);
26956        if let Some(value) = self._name.as_ref() {
26957            params.push("name", value);
26958        }
26959
26960        params.extend(self._additional_params.iter());
26961
26962        params.push("alt", "json");
26963        let mut url = self.hub._base_url.clone()
26964            + "v1/projects/{projectId}/zones/{zone}/operations/{operationId}";
26965        if self._scopes.is_empty() {
26966            self._scopes
26967                .insert(Scope::CloudPlatform.as_ref().to_string());
26968        }
26969
26970        #[allow(clippy::single_element_loop)]
26971        for &(find_this, param_name) in [
26972            ("{projectId}", "projectId"),
26973            ("{zone}", "zone"),
26974            ("{operationId}", "operationId"),
26975        ]
26976        .iter()
26977        {
26978            url = params.uri_replacement(url, param_name, find_this, false);
26979        }
26980        {
26981            let to_remove = ["operationId", "zone", "projectId"];
26982            params.remove_params(&to_remove);
26983        }
26984
26985        let url = params.parse_with_url(&url);
26986
26987        loop {
26988            let token = match self
26989                .hub
26990                .auth
26991                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26992                .await
26993            {
26994                Ok(token) => token,
26995                Err(e) => match dlg.token(e) {
26996                    Ok(token) => token,
26997                    Err(e) => {
26998                        dlg.finished(false);
26999                        return Err(common::Error::MissingToken(e));
27000                    }
27001                },
27002            };
27003            let mut req_result = {
27004                let client = &self.hub.client;
27005                dlg.pre_request();
27006                let mut req_builder = hyper::Request::builder()
27007                    .method(hyper::Method::GET)
27008                    .uri(url.as_str())
27009                    .header(USER_AGENT, self.hub._user_agent.clone());
27010
27011                if let Some(token) = token.as_ref() {
27012                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27013                }
27014
27015                let request = req_builder
27016                    .header(CONTENT_LENGTH, 0_u64)
27017                    .body(common::to_body::<String>(None));
27018
27019                client.request(request.unwrap()).await
27020            };
27021
27022            match req_result {
27023                Err(err) => {
27024                    if let common::Retry::After(d) = dlg.http_error(&err) {
27025                        sleep(d).await;
27026                        continue;
27027                    }
27028                    dlg.finished(false);
27029                    return Err(common::Error::HttpError(err));
27030                }
27031                Ok(res) => {
27032                    let (mut parts, body) = res.into_parts();
27033                    let mut body = common::Body::new(body);
27034                    if !parts.status.is_success() {
27035                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27036                        let error = serde_json::from_str(&common::to_string(&bytes));
27037                        let response = common::to_response(parts, bytes.into());
27038
27039                        if let common::Retry::After(d) =
27040                            dlg.http_failure(&response, error.as_ref().ok())
27041                        {
27042                            sleep(d).await;
27043                            continue;
27044                        }
27045
27046                        dlg.finished(false);
27047
27048                        return Err(match error {
27049                            Ok(value) => common::Error::BadRequest(value),
27050                            _ => common::Error::Failure(response),
27051                        });
27052                    }
27053                    let response = {
27054                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27055                        let encoded = common::to_string(&bytes);
27056                        match serde_json::from_str(&encoded) {
27057                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27058                            Err(error) => {
27059                                dlg.response_json_decode_error(&encoded, &error);
27060                                return Err(common::Error::JsonDecodeError(
27061                                    encoded.to_string(),
27062                                    error,
27063                                ));
27064                            }
27065                        }
27066                    };
27067
27068                    dlg.finished(true);
27069                    return Ok(response);
27070                }
27071            }
27072        }
27073    }
27074
27075    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
27076    ///
27077    /// Sets the *project id* path property to the given value.
27078    ///
27079    /// Even though the property as already been set when instantiating this call,
27080    /// we provide this method for API completeness.
27081    pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
27082        self._project_id = new_value.to_string();
27083        self
27084    }
27085    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field.
27086    ///
27087    /// Sets the *zone* path property to the given value.
27088    ///
27089    /// Even though the property as already been set when instantiating this call,
27090    /// we provide this method for API completeness.
27091    pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
27092        self._zone = new_value.to_string();
27093        self
27094    }
27095    /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
27096    ///
27097    /// Sets the *operation id* path property to the given value.
27098    ///
27099    /// Even though the property as already been set when instantiating this call,
27100    /// we provide this method for API completeness.
27101    pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
27102        self._operation_id = new_value.to_string();
27103        self
27104    }
27105    /// The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
27106    ///
27107    /// Sets the *name* query property to the given value.
27108    pub fn name(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
27109        self._name = Some(new_value.to_string());
27110        self
27111    }
27112    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27113    /// while executing the actual API request.
27114    ///
27115    /// ````text
27116    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27117    /// ````
27118    ///
27119    /// Sets the *delegate* property to the given value.
27120    pub fn delegate(
27121        mut self,
27122        new_value: &'a mut dyn common::Delegate,
27123    ) -> ProjectZoneOperationGetCall<'a, C> {
27124        self._delegate = Some(new_value);
27125        self
27126    }
27127
27128    /// Set any additional parameter of the query string used in the request.
27129    /// It should be used to set parameters which are not yet available through their own
27130    /// setters.
27131    ///
27132    /// Please note that this method must not be used to set any of the known parameters
27133    /// which have their own setter method. If done anyway, the request will fail.
27134    ///
27135    /// # Additional Parameters
27136    ///
27137    /// * *$.xgafv* (query-string) - V1 error format.
27138    /// * *access_token* (query-string) - OAuth access token.
27139    /// * *alt* (query-string) - Data format for response.
27140    /// * *callback* (query-string) - JSONP
27141    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27142    /// * *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.
27143    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27144    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27145    /// * *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.
27146    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27147    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27148    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationGetCall<'a, C>
27149    where
27150        T: AsRef<str>,
27151    {
27152        self._additional_params
27153            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27154        self
27155    }
27156
27157    /// Identifies the authorization scope for the method you are building.
27158    ///
27159    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27160    /// [`Scope::CloudPlatform`].
27161    ///
27162    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27163    /// tokens for more than one scope.
27164    ///
27165    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27166    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27167    /// sufficient, a read-write scope will do as well.
27168    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationGetCall<'a, C>
27169    where
27170        St: AsRef<str>,
27171    {
27172        self._scopes.insert(String::from(scope.as_ref()));
27173        self
27174    }
27175    /// Identifies the authorization scope(s) for the method you are building.
27176    ///
27177    /// See [`Self::add_scope()`] for details.
27178    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationGetCall<'a, C>
27179    where
27180        I: IntoIterator<Item = St>,
27181        St: AsRef<str>,
27182    {
27183        self._scopes
27184            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27185        self
27186    }
27187
27188    /// Removes all scopes, and no default scope will be used either.
27189    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27190    /// for details).
27191    pub fn clear_scopes(mut self) -> ProjectZoneOperationGetCall<'a, C> {
27192        self._scopes.clear();
27193        self
27194    }
27195}
27196
27197/// Lists all operations in a project in a specific zone or all zones.
27198///
27199/// A builder for the *zones.operations.list* method supported by a *project* resource.
27200/// It is not used directly, but through a [`ProjectMethods`] instance.
27201///
27202/// # Example
27203///
27204/// Instantiate a resource method builder
27205///
27206/// ```test_harness,no_run
27207/// # extern crate hyper;
27208/// # extern crate hyper_rustls;
27209/// # extern crate google_container1 as container1;
27210/// # async fn dox() {
27211/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27212///
27213/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27214/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27215/// #     secret,
27216/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27217/// # ).build().await.unwrap();
27218///
27219/// # let client = hyper_util::client::legacy::Client::builder(
27220/// #     hyper_util::rt::TokioExecutor::new()
27221/// # )
27222/// # .build(
27223/// #     hyper_rustls::HttpsConnectorBuilder::new()
27224/// #         .with_native_roots()
27225/// #         .unwrap()
27226/// #         .https_or_http()
27227/// #         .enable_http1()
27228/// #         .build()
27229/// # );
27230/// # let mut hub = Container::new(client, auth);
27231/// // You can configure optional parameters by calling the respective setters at will, and
27232/// // execute the final call using `doit()`.
27233/// // Values shown here are possibly random and not representative !
27234/// let result = hub.projects().zones_operations_list("projectId", "zone")
27235///              .parent("gubergren")
27236///              .doit().await;
27237/// # }
27238/// ```
27239pub struct ProjectZoneOperationListCall<'a, C>
27240where
27241    C: 'a,
27242{
27243    hub: &'a Container<C>,
27244    _project_id: String,
27245    _zone: String,
27246    _parent: Option<String>,
27247    _delegate: Option<&'a mut dyn common::Delegate>,
27248    _additional_params: HashMap<String, String>,
27249    _scopes: BTreeSet<String>,
27250}
27251
27252impl<'a, C> common::CallBuilder for ProjectZoneOperationListCall<'a, C> {}
27253
27254impl<'a, C> ProjectZoneOperationListCall<'a, C>
27255where
27256    C: common::Connector,
27257{
27258    /// Perform the operation you have build so far.
27259    pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
27260        use std::borrow::Cow;
27261        use std::io::{Read, Seek};
27262
27263        use common::{url::Params, ToParts};
27264        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27265
27266        let mut dd = common::DefaultDelegate;
27267        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27268        dlg.begin(common::MethodInfo {
27269            id: "container.projects.zones.operations.list",
27270            http_method: hyper::Method::GET,
27271        });
27272
27273        for &field in ["alt", "projectId", "zone", "parent"].iter() {
27274            if self._additional_params.contains_key(field) {
27275                dlg.finished(false);
27276                return Err(common::Error::FieldClash(field));
27277            }
27278        }
27279
27280        let mut params = Params::with_capacity(5 + self._additional_params.len());
27281        params.push("projectId", self._project_id);
27282        params.push("zone", self._zone);
27283        if let Some(value) = self._parent.as_ref() {
27284            params.push("parent", value);
27285        }
27286
27287        params.extend(self._additional_params.iter());
27288
27289        params.push("alt", "json");
27290        let mut url =
27291            self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/operations";
27292        if self._scopes.is_empty() {
27293            self._scopes
27294                .insert(Scope::CloudPlatform.as_ref().to_string());
27295        }
27296
27297        #[allow(clippy::single_element_loop)]
27298        for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
27299            url = params.uri_replacement(url, param_name, find_this, false);
27300        }
27301        {
27302            let to_remove = ["zone", "projectId"];
27303            params.remove_params(&to_remove);
27304        }
27305
27306        let url = params.parse_with_url(&url);
27307
27308        loop {
27309            let token = match self
27310                .hub
27311                .auth
27312                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27313                .await
27314            {
27315                Ok(token) => token,
27316                Err(e) => match dlg.token(e) {
27317                    Ok(token) => token,
27318                    Err(e) => {
27319                        dlg.finished(false);
27320                        return Err(common::Error::MissingToken(e));
27321                    }
27322                },
27323            };
27324            let mut req_result = {
27325                let client = &self.hub.client;
27326                dlg.pre_request();
27327                let mut req_builder = hyper::Request::builder()
27328                    .method(hyper::Method::GET)
27329                    .uri(url.as_str())
27330                    .header(USER_AGENT, self.hub._user_agent.clone());
27331
27332                if let Some(token) = token.as_ref() {
27333                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27334                }
27335
27336                let request = req_builder
27337                    .header(CONTENT_LENGTH, 0_u64)
27338                    .body(common::to_body::<String>(None));
27339
27340                client.request(request.unwrap()).await
27341            };
27342
27343            match req_result {
27344                Err(err) => {
27345                    if let common::Retry::After(d) = dlg.http_error(&err) {
27346                        sleep(d).await;
27347                        continue;
27348                    }
27349                    dlg.finished(false);
27350                    return Err(common::Error::HttpError(err));
27351                }
27352                Ok(res) => {
27353                    let (mut parts, body) = res.into_parts();
27354                    let mut body = common::Body::new(body);
27355                    if !parts.status.is_success() {
27356                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27357                        let error = serde_json::from_str(&common::to_string(&bytes));
27358                        let response = common::to_response(parts, bytes.into());
27359
27360                        if let common::Retry::After(d) =
27361                            dlg.http_failure(&response, error.as_ref().ok())
27362                        {
27363                            sleep(d).await;
27364                            continue;
27365                        }
27366
27367                        dlg.finished(false);
27368
27369                        return Err(match error {
27370                            Ok(value) => common::Error::BadRequest(value),
27371                            _ => common::Error::Failure(response),
27372                        });
27373                    }
27374                    let response = {
27375                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27376                        let encoded = common::to_string(&bytes);
27377                        match serde_json::from_str(&encoded) {
27378                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27379                            Err(error) => {
27380                                dlg.response_json_decode_error(&encoded, &error);
27381                                return Err(common::Error::JsonDecodeError(
27382                                    encoded.to_string(),
27383                                    error,
27384                                ));
27385                            }
27386                        }
27387                    };
27388
27389                    dlg.finished(true);
27390                    return Ok(response);
27391                }
27392            }
27393        }
27394    }
27395
27396    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the parent field.
27397    ///
27398    /// Sets the *project id* path property to the given value.
27399    ///
27400    /// Even though the property as already been set when instantiating this call,
27401    /// we provide this method for API completeness.
27402    pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
27403        self._project_id = new_value.to_string();
27404        self
27405    }
27406    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) to return operations for, or `-` for all zones. This field has been deprecated and replaced by the parent field.
27407    ///
27408    /// Sets the *zone* path property to the given value.
27409    ///
27410    /// Even though the property as already been set when instantiating this call,
27411    /// we provide this method for API completeness.
27412    pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
27413        self._zone = new_value.to_string();
27414        self
27415    }
27416    /// The parent (project and location) where the operations will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
27417    ///
27418    /// Sets the *parent* query property to the given value.
27419    pub fn parent(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
27420        self._parent = Some(new_value.to_string());
27421        self
27422    }
27423    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27424    /// while executing the actual API request.
27425    ///
27426    /// ````text
27427    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27428    /// ````
27429    ///
27430    /// Sets the *delegate* property to the given value.
27431    pub fn delegate(
27432        mut self,
27433        new_value: &'a mut dyn common::Delegate,
27434    ) -> ProjectZoneOperationListCall<'a, C> {
27435        self._delegate = Some(new_value);
27436        self
27437    }
27438
27439    /// Set any additional parameter of the query string used in the request.
27440    /// It should be used to set parameters which are not yet available through their own
27441    /// setters.
27442    ///
27443    /// Please note that this method must not be used to set any of the known parameters
27444    /// which have their own setter method. If done anyway, the request will fail.
27445    ///
27446    /// # Additional Parameters
27447    ///
27448    /// * *$.xgafv* (query-string) - V1 error format.
27449    /// * *access_token* (query-string) - OAuth access token.
27450    /// * *alt* (query-string) - Data format for response.
27451    /// * *callback* (query-string) - JSONP
27452    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27453    /// * *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.
27454    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27455    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27456    /// * *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.
27457    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27458    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27459    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationListCall<'a, C>
27460    where
27461        T: AsRef<str>,
27462    {
27463        self._additional_params
27464            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27465        self
27466    }
27467
27468    /// Identifies the authorization scope for the method you are building.
27469    ///
27470    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27471    /// [`Scope::CloudPlatform`].
27472    ///
27473    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27474    /// tokens for more than one scope.
27475    ///
27476    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27477    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27478    /// sufficient, a read-write scope will do as well.
27479    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationListCall<'a, C>
27480    where
27481        St: AsRef<str>,
27482    {
27483        self._scopes.insert(String::from(scope.as_ref()));
27484        self
27485    }
27486    /// Identifies the authorization scope(s) for the method you are building.
27487    ///
27488    /// See [`Self::add_scope()`] for details.
27489    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationListCall<'a, C>
27490    where
27491        I: IntoIterator<Item = St>,
27492        St: AsRef<str>,
27493    {
27494        self._scopes
27495            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27496        self
27497    }
27498
27499    /// Removes all scopes, and no default scope will be used either.
27500    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27501    /// for details).
27502    pub fn clear_scopes(mut self) -> ProjectZoneOperationListCall<'a, C> {
27503        self._scopes.clear();
27504        self
27505    }
27506}
27507
27508/// Returns configuration info about the Google Kubernetes Engine service.
27509///
27510/// A builder for the *zones.getServerconfig* method supported by a *project* resource.
27511/// It is not used directly, but through a [`ProjectMethods`] instance.
27512///
27513/// # Example
27514///
27515/// Instantiate a resource method builder
27516///
27517/// ```test_harness,no_run
27518/// # extern crate hyper;
27519/// # extern crate hyper_rustls;
27520/// # extern crate google_container1 as container1;
27521/// # async fn dox() {
27522/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27523///
27524/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27525/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
27526/// #     secret,
27527/// #     yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27528/// # ).build().await.unwrap();
27529///
27530/// # let client = hyper_util::client::legacy::Client::builder(
27531/// #     hyper_util::rt::TokioExecutor::new()
27532/// # )
27533/// # .build(
27534/// #     hyper_rustls::HttpsConnectorBuilder::new()
27535/// #         .with_native_roots()
27536/// #         .unwrap()
27537/// #         .https_or_http()
27538/// #         .enable_http1()
27539/// #         .build()
27540/// # );
27541/// # let mut hub = Container::new(client, auth);
27542/// // You can configure optional parameters by calling the respective setters at will, and
27543/// // execute the final call using `doit()`.
27544/// // Values shown here are possibly random and not representative !
27545/// let result = hub.projects().zones_get_serverconfig("projectId", "zone")
27546///              .name("consetetur")
27547///              .doit().await;
27548/// # }
27549/// ```
27550pub struct ProjectZoneGetServerconfigCall<'a, C>
27551where
27552    C: 'a,
27553{
27554    hub: &'a Container<C>,
27555    _project_id: String,
27556    _zone: String,
27557    _name: Option<String>,
27558    _delegate: Option<&'a mut dyn common::Delegate>,
27559    _additional_params: HashMap<String, String>,
27560    _scopes: BTreeSet<String>,
27561}
27562
27563impl<'a, C> common::CallBuilder for ProjectZoneGetServerconfigCall<'a, C> {}
27564
27565impl<'a, C> ProjectZoneGetServerconfigCall<'a, C>
27566where
27567    C: common::Connector,
27568{
27569    /// Perform the operation you have build so far.
27570    pub async fn doit(mut self) -> common::Result<(common::Response, ServerConfig)> {
27571        use std::borrow::Cow;
27572        use std::io::{Read, Seek};
27573
27574        use common::{url::Params, ToParts};
27575        use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27576
27577        let mut dd = common::DefaultDelegate;
27578        let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27579        dlg.begin(common::MethodInfo {
27580            id: "container.projects.zones.getServerconfig",
27581            http_method: hyper::Method::GET,
27582        });
27583
27584        for &field in ["alt", "projectId", "zone", "name"].iter() {
27585            if self._additional_params.contains_key(field) {
27586                dlg.finished(false);
27587                return Err(common::Error::FieldClash(field));
27588            }
27589        }
27590
27591        let mut params = Params::with_capacity(5 + self._additional_params.len());
27592        params.push("projectId", self._project_id);
27593        params.push("zone", self._zone);
27594        if let Some(value) = self._name.as_ref() {
27595            params.push("name", value);
27596        }
27597
27598        params.extend(self._additional_params.iter());
27599
27600        params.push("alt", "json");
27601        let mut url =
27602            self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/serverconfig";
27603        if self._scopes.is_empty() {
27604            self._scopes
27605                .insert(Scope::CloudPlatform.as_ref().to_string());
27606        }
27607
27608        #[allow(clippy::single_element_loop)]
27609        for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
27610            url = params.uri_replacement(url, param_name, find_this, false);
27611        }
27612        {
27613            let to_remove = ["zone", "projectId"];
27614            params.remove_params(&to_remove);
27615        }
27616
27617        let url = params.parse_with_url(&url);
27618
27619        loop {
27620            let token = match self
27621                .hub
27622                .auth
27623                .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27624                .await
27625            {
27626                Ok(token) => token,
27627                Err(e) => match dlg.token(e) {
27628                    Ok(token) => token,
27629                    Err(e) => {
27630                        dlg.finished(false);
27631                        return Err(common::Error::MissingToken(e));
27632                    }
27633                },
27634            };
27635            let mut req_result = {
27636                let client = &self.hub.client;
27637                dlg.pre_request();
27638                let mut req_builder = hyper::Request::builder()
27639                    .method(hyper::Method::GET)
27640                    .uri(url.as_str())
27641                    .header(USER_AGENT, self.hub._user_agent.clone());
27642
27643                if let Some(token) = token.as_ref() {
27644                    req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27645                }
27646
27647                let request = req_builder
27648                    .header(CONTENT_LENGTH, 0_u64)
27649                    .body(common::to_body::<String>(None));
27650
27651                client.request(request.unwrap()).await
27652            };
27653
27654            match req_result {
27655                Err(err) => {
27656                    if let common::Retry::After(d) = dlg.http_error(&err) {
27657                        sleep(d).await;
27658                        continue;
27659                    }
27660                    dlg.finished(false);
27661                    return Err(common::Error::HttpError(err));
27662                }
27663                Ok(res) => {
27664                    let (mut parts, body) = res.into_parts();
27665                    let mut body = common::Body::new(body);
27666                    if !parts.status.is_success() {
27667                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27668                        let error = serde_json::from_str(&common::to_string(&bytes));
27669                        let response = common::to_response(parts, bytes.into());
27670
27671                        if let common::Retry::After(d) =
27672                            dlg.http_failure(&response, error.as_ref().ok())
27673                        {
27674                            sleep(d).await;
27675                            continue;
27676                        }
27677
27678                        dlg.finished(false);
27679
27680                        return Err(match error {
27681                            Ok(value) => common::Error::BadRequest(value),
27682                            _ => common::Error::Failure(response),
27683                        });
27684                    }
27685                    let response = {
27686                        let bytes = common::to_bytes(body).await.unwrap_or_default();
27687                        let encoded = common::to_string(&bytes);
27688                        match serde_json::from_str(&encoded) {
27689                            Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27690                            Err(error) => {
27691                                dlg.response_json_decode_error(&encoded, &error);
27692                                return Err(common::Error::JsonDecodeError(
27693                                    encoded.to_string(),
27694                                    error,
27695                                ));
27696                            }
27697                        }
27698                    };
27699
27700                    dlg.finished(true);
27701                    return Ok(response);
27702                }
27703            }
27704        }
27705    }
27706
27707    /// Deprecated. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects). This field has been deprecated and replaced by the name field.
27708    ///
27709    /// Sets the *project id* path property to the given value.
27710    ///
27711    /// Even though the property as already been set when instantiating this call,
27712    /// we provide this method for API completeness.
27713    pub fn project_id(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
27714        self._project_id = new_value.to_string();
27715        self
27716    }
27717    /// Deprecated. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) to return operations for. This field has been deprecated and replaced by the name field.
27718    ///
27719    /// Sets the *zone* path property to the given value.
27720    ///
27721    /// Even though the property as already been set when instantiating this call,
27722    /// we provide this method for API completeness.
27723    pub fn zone(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
27724        self._zone = new_value.to_string();
27725        self
27726    }
27727    /// The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
27728    ///
27729    /// Sets the *name* query property to the given value.
27730    pub fn name(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
27731        self._name = Some(new_value.to_string());
27732        self
27733    }
27734    /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27735    /// while executing the actual API request.
27736    ///
27737    /// ````text
27738    ///                   It should be used to handle progress information, and to implement a certain level of resilience.
27739    /// ````
27740    ///
27741    /// Sets the *delegate* property to the given value.
27742    pub fn delegate(
27743        mut self,
27744        new_value: &'a mut dyn common::Delegate,
27745    ) -> ProjectZoneGetServerconfigCall<'a, C> {
27746        self._delegate = Some(new_value);
27747        self
27748    }
27749
27750    /// Set any additional parameter of the query string used in the request.
27751    /// It should be used to set parameters which are not yet available through their own
27752    /// setters.
27753    ///
27754    /// Please note that this method must not be used to set any of the known parameters
27755    /// which have their own setter method. If done anyway, the request will fail.
27756    ///
27757    /// # Additional Parameters
27758    ///
27759    /// * *$.xgafv* (query-string) - V1 error format.
27760    /// * *access_token* (query-string) - OAuth access token.
27761    /// * *alt* (query-string) - Data format for response.
27762    /// * *callback* (query-string) - JSONP
27763    /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27764    /// * *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.
27765    /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27766    /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27767    /// * *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.
27768    /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27769    /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27770    pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneGetServerconfigCall<'a, C>
27771    where
27772        T: AsRef<str>,
27773    {
27774        self._additional_params
27775            .insert(name.as_ref().to_string(), value.as_ref().to_string());
27776        self
27777    }
27778
27779    /// Identifies the authorization scope for the method you are building.
27780    ///
27781    /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27782    /// [`Scope::CloudPlatform`].
27783    ///
27784    /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27785    /// tokens for more than one scope.
27786    ///
27787    /// Usually there is more than one suitable scope to authorize an operation, some of which may
27788    /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27789    /// sufficient, a read-write scope will do as well.
27790    pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneGetServerconfigCall<'a, C>
27791    where
27792        St: AsRef<str>,
27793    {
27794        self._scopes.insert(String::from(scope.as_ref()));
27795        self
27796    }
27797    /// Identifies the authorization scope(s) for the method you are building.
27798    ///
27799    /// See [`Self::add_scope()`] for details.
27800    pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneGetServerconfigCall<'a, C>
27801    where
27802        I: IntoIterator<Item = St>,
27803        St: AsRef<str>,
27804    {
27805        self._scopes
27806            .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27807        self
27808    }
27809
27810    /// Removes all scopes, and no default scope will be used either.
27811    /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27812    /// for details).
27813    pub fn clear_scopes(mut self) -> ProjectZoneGetServerconfigCall<'a, C> {
27814        self._scopes.clear();
27815        self
27816    }
27817}