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 connector = hyper_rustls::HttpsConnectorBuilder::new()
62/// .with_native_roots()
63/// .unwrap()
64/// .https_only()
65/// .enable_http2()
66/// .build();
67///
68/// let executor = hyper_util::rt::TokioExecutor::new();
69/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
70/// secret,
71/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
72/// yup_oauth2::client::CustomHyperClientBuilder::from(
73/// hyper_util::client::legacy::Client::builder(executor).build(connector),
74/// ),
75/// ).build().await.unwrap();
76///
77/// let client = hyper_util::client::legacy::Client::builder(
78/// hyper_util::rt::TokioExecutor::new()
79/// )
80/// .build(
81/// hyper_rustls::HttpsConnectorBuilder::new()
82/// .with_native_roots()
83/// .unwrap()
84/// .https_or_http()
85/// .enable_http2()
86/// .build()
87/// );
88/// let mut hub = Container::new(client, auth);
89/// // You can configure optional parameters by calling the respective setters at will, and
90/// // execute the final call using `doit()`.
91/// // Values shown here are possibly random and not representative !
92/// let result = hub.projects().locations_clusters_node_pools_delete("name")
93/// .zone("duo")
94/// .project_id("ipsum")
95/// .node_pool_id("gubergren")
96/// .cluster_id("Lorem")
97/// .doit().await;
98///
99/// match result {
100/// Err(e) => match e {
101/// // The Error enum provides details about what exactly happened.
102/// // You can also just use its `Debug`, `Display` or `Error` traits
103/// Error::HttpError(_)
104/// |Error::Io(_)
105/// |Error::MissingAPIKey
106/// |Error::MissingToken(_)
107/// |Error::Cancelled
108/// |Error::UploadSizeLimitExceeded(_, _)
109/// |Error::Failure(_)
110/// |Error::BadRequest(_)
111/// |Error::FieldClash(_)
112/// |Error::JsonDecodeError(_, _) => println!("{}", e),
113/// },
114/// Ok(res) => println!("Success: {:?}", res),
115/// }
116/// # }
117/// ```
118#[derive(Clone)]
119pub struct Container<C> {
120 pub client: common::Client<C>,
121 pub auth: Box<dyn common::GetToken>,
122 _user_agent: String,
123 _base_url: String,
124 _root_url: String,
125}
126
127impl<C> common::Hub for Container<C> {}
128
129impl<'a, C> Container<C> {
130 pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Container<C> {
131 Container {
132 client,
133 auth: Box::new(auth),
134 _user_agent: "google-api-rust-client/7.0.0".to_string(),
135 _base_url: "https://container.googleapis.com/".to_string(),
136 _root_url: "https://container.googleapis.com/".to_string(),
137 }
138 }
139
140 pub fn projects(&'a self) -> ProjectMethods<'a, C> {
141 ProjectMethods { hub: self }
142 }
143
144 /// Set the user-agent header field to use in all requests to the server.
145 /// It defaults to `google-api-rust-client/7.0.0`.
146 ///
147 /// Returns the previously set user-agent.
148 pub fn user_agent(&mut self, agent_name: String) -> String {
149 std::mem::replace(&mut self._user_agent, agent_name)
150 }
151
152 /// Set the base url to use in all requests to the server.
153 /// It defaults to `https://container.googleapis.com/`.
154 ///
155 /// Returns the previously set base url.
156 pub fn base_url(&mut self, new_base_url: String) -> String {
157 std::mem::replace(&mut self._base_url, new_base_url)
158 }
159
160 /// Set the root url to use in all requests to the server.
161 /// It defaults to `https://container.googleapis.com/`.
162 ///
163 /// Returns the previously set root url.
164 pub fn root_url(&mut self, new_root_url: String) -> String {
165 std::mem::replace(&mut self._root_url, new_root_url)
166 }
167}
168
169// ############
170// SCHEMAS ###
171// ##########
172/// AcceleratorConfig represents a Hardware Accelerator request.
173///
174/// This type is not used in any activity, and only used as *part* of another schema.
175///
176#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
177#[serde_with::serde_as]
178#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
179pub struct AcceleratorConfig {
180 /// The number of the accelerator cards exposed to an instance.
181 #[serde(rename = "acceleratorCount")]
182 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
183 pub accelerator_count: Option<i64>,
184 /// The accelerator type resource name. List of supported accelerators [here](https://cloud.google.com/compute/docs/gpus)
185 #[serde(rename = "acceleratorType")]
186 pub accelerator_type: Option<String>,
187 /// The configuration for auto installation of GPU driver.
188 #[serde(rename = "gpuDriverInstallationConfig")]
189 pub gpu_driver_installation_config: Option<GPUDriverInstallationConfig>,
190 /// 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).
191 #[serde(rename = "gpuPartitionSize")]
192 pub gpu_partition_size: Option<String>,
193 /// The configuration for GPU sharing options.
194 #[serde(rename = "gpuSharingConfig")]
195 pub gpu_sharing_config: Option<GPUSharingConfig>,
196}
197
198impl common::Part for AcceleratorConfig {}
199
200/// AdditionalIPRangesConfig is the configuration for individual additional subnetwork attached to the cluster
201///
202/// This type is not used in any activity, and only used as *part* of another schema.
203///
204#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
205#[serde_with::serde_as]
206#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
207pub struct AdditionalIPRangesConfig {
208 /// List of secondary ranges names within this subnetwork that can be used for pod IPs. Example1: gke-pod-range1 Example2: gke-pod-range1,gke-pod-range2
209 #[serde(rename = "podIpv4RangeNames")]
210 pub pod_ipv4_range_names: Option<Vec<String>>,
211 /// Name of the subnetwork. This can be the full path of the subnetwork or just the name. Example1: my-subnet Example2: projects/gke-project/regions/us-central1/subnetworks/my-subnet
212 pub subnetwork: Option<String>,
213}
214
215impl common::Part for AdditionalIPRangesConfig {}
216
217/// AdditionalNodeNetworkConfig is the configuration for additional node networks within the NodeNetworkConfig message
218///
219/// This type is not used in any activity, and only used as *part* of another schema.
220///
221#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
222#[serde_with::serde_as]
223#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
224pub struct AdditionalNodeNetworkConfig {
225 /// Name of the VPC where the additional interface belongs
226 pub network: Option<String>,
227 /// Name of the subnetwork where the additional interface belongs
228 pub subnetwork: Option<String>,
229}
230
231impl common::Part for AdditionalNodeNetworkConfig {}
232
233/// AdditionalPodNetworkConfig is the configuration for additional pod networks within the NodeNetworkConfig message
234///
235/// This type is not used in any activity, and only used as *part* of another schema.
236///
237#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
238#[serde_with::serde_as]
239#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
240pub struct AdditionalPodNetworkConfig {
241 /// The maximum number of pods per node which use this pod network.
242 #[serde(rename = "maxPodsPerNode")]
243 pub max_pods_per_node: Option<MaxPodsConstraint>,
244 /// The name of the network attachment for pods to communicate to; cannot be specified along with subnetwork or secondary_pod_range.
245 #[serde(rename = "networkAttachment")]
246 pub network_attachment: Option<String>,
247 /// The name of the secondary range on the subnet which provides IP address for this pod range.
248 #[serde(rename = "secondaryPodRange")]
249 pub secondary_pod_range: Option<String>,
250 /// Name of the subnetwork where the additional pod network belongs.
251 pub subnetwork: Option<String>,
252}
253
254impl common::Part for AdditionalPodNetworkConfig {}
255
256/// AdditionalPodRangesConfig is the configuration for additional pod secondary ranges supporting the ClusterUpdate message.
257///
258/// This type is not used in any activity, and only used as *part* of another schema.
259///
260#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
261#[serde_with::serde_as]
262#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
263pub struct AdditionalPodRangesConfig {
264 /// Output only. Information for additional pod range.
265 #[serde(rename = "podRangeInfo")]
266 pub pod_range_info: Option<Vec<RangeInfo>>,
267 /// Name for pod secondary ipv4 range which has the actual range defined ahead.
268 #[serde(rename = "podRangeNames")]
269 pub pod_range_names: Option<Vec<String>>,
270}
271
272impl common::Part for AdditionalPodRangesConfig {}
273
274/// Configuration for the addons that can be automatically spun up in the cluster, enabling additional functionality.
275///
276/// This type is not used in any activity, and only used as *part* of another schema.
277///
278#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
279#[serde_with::serde_as]
280#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
281pub struct AddonsConfig {
282 /// Configuration for the Cloud Run addon, which allows the user to use a managed Knative service.
283 #[serde(rename = "cloudRunConfig")]
284 pub cloud_run_config: Option<CloudRunConfig>,
285 /// Configuration for the ConfigConnector add-on, a Kubernetes extension to manage hosted Google Cloud services through the Kubernetes API.
286 #[serde(rename = "configConnectorConfig")]
287 pub config_connector_config: Option<ConfigConnectorConfig>,
288 /// Configuration for NodeLocalDNS, a dns cache running on cluster nodes
289 #[serde(rename = "dnsCacheConfig")]
290 pub dns_cache_config: Option<DnsCacheConfig>,
291 /// Configuration for the Compute Engine Persistent Disk CSI driver.
292 #[serde(rename = "gcePersistentDiskCsiDriverConfig")]
293 pub gce_persistent_disk_csi_driver_config: Option<GcePersistentDiskCsiDriverConfig>,
294 /// Configuration for the Filestore CSI driver.
295 #[serde(rename = "gcpFilestoreCsiDriverConfig")]
296 pub gcp_filestore_csi_driver_config: Option<GcpFilestoreCsiDriverConfig>,
297 /// Configuration for the Cloud Storage Fuse CSI driver.
298 #[serde(rename = "gcsFuseCsiDriverConfig")]
299 pub gcs_fuse_csi_driver_config: Option<GcsFuseCsiDriverConfig>,
300 /// Configuration for the Backup for GKE agent addon.
301 #[serde(rename = "gkeBackupAgentConfig")]
302 pub gke_backup_agent_config: Option<GkeBackupAgentConfig>,
303 /// Configuration for the High Scale Checkpointing add-on.
304 #[serde(rename = "highScaleCheckpointingConfig")]
305 pub high_scale_checkpointing_config: Option<HighScaleCheckpointingConfig>,
306 /// 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.
307 #[serde(rename = "horizontalPodAutoscaling")]
308 pub horizontal_pod_autoscaling: Option<HorizontalPodAutoscaling>,
309 /// Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.
310 #[serde(rename = "httpLoadBalancing")]
311 pub http_load_balancing: Option<HttpLoadBalancing>,
312 /// 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
313 #[serde(rename = "kubernetesDashboard")]
314 pub kubernetes_dashboard: Option<KubernetesDashboard>,
315 /// Configuration for the Lustre CSI driver.
316 #[serde(rename = "lustreCsiDriverConfig")]
317 pub lustre_csi_driver_config: Option<LustreCsiDriverConfig>,
318 /// 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.
319 #[serde(rename = "networkPolicyConfig")]
320 pub network_policy_config: Option<NetworkPolicyConfig>,
321 /// Configuration for the Cloud Storage Parallelstore CSI driver.
322 #[serde(rename = "parallelstoreCsiDriverConfig")]
323 pub parallelstore_csi_driver_config: Option<ParallelstoreCsiDriverConfig>,
324 /// Optional. Configuration for Ray Operator addon.
325 #[serde(rename = "rayOperatorConfig")]
326 pub ray_operator_config: Option<RayOperatorConfig>,
327 /// Optional. Configuration for the StatefulHA add-on.
328 #[serde(rename = "statefulHaConfig")]
329 pub stateful_ha_config: Option<StatefulHAConfig>,
330}
331
332impl common::Part for AddonsConfig {}
333
334/// AdvancedDatapathObservabilityConfig specifies configuration of observability features of advanced datapath.
335///
336/// This type is not used in any activity, and only used as *part* of another schema.
337///
338#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
339#[serde_with::serde_as]
340#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
341pub struct AdvancedDatapathObservabilityConfig {
342 /// Expose flow metrics on nodes
343 #[serde(rename = "enableMetrics")]
344 pub enable_metrics: Option<bool>,
345 /// Enable Relay component
346 #[serde(rename = "enableRelay")]
347 pub enable_relay: Option<bool>,
348 /// Method used to make Relay available
349 #[serde(rename = "relayMode")]
350 pub relay_mode: Option<String>,
351}
352
353impl common::Part for AdvancedDatapathObservabilityConfig {}
354
355/// Specifies options for controlling advanced machine features.
356///
357/// This type is not used in any activity, and only used as *part* of another schema.
358///
359#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
360#[serde_with::serde_as]
361#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
362pub struct AdvancedMachineFeatures {
363 /// Whether or not to enable nested virtualization (defaults to false).
364 #[serde(rename = "enableNestedVirtualization")]
365 pub enable_nested_virtualization: Option<bool>,
366 /// Type of Performance Monitoring Unit (PMU) requested on node pool instances. If unset, PMU will not be available to the node.
367 #[serde(rename = "performanceMonitoringUnit")]
368 pub performance_monitoring_unit: Option<String>,
369 /// 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.
370 #[serde(rename = "threadsPerCore")]
371 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
372 pub threads_per_core: Option<i64>,
373}
374
375impl common::Part for AdvancedMachineFeatures {}
376
377/// AnonymousAuthenticationConfig defines the settings needed to limit endpoints that allow anonymous authentication.
378///
379/// This type is not used in any activity, and only used as *part* of another schema.
380///
381#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
382#[serde_with::serde_as]
383#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
384pub struct AnonymousAuthenticationConfig {
385 /// Defines the mode of limiting anonymous access in the cluster.
386 pub mode: Option<String>,
387}
388
389impl common::Part for AnonymousAuthenticationConfig {}
390
391/// Configuration for returning group information from authenticators.
392///
393/// This type is not used in any activity, and only used as *part* of another schema.
394///
395#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
396#[serde_with::serde_as]
397#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
398pub struct AuthenticatorGroupsConfig {
399 /// Whether this cluster should return group membership lookups during authentication using a group of security groups.
400 pub enabled: Option<bool>,
401 /// The name of the security group-of-groups to be used. Only relevant if enabled = true.
402 #[serde(rename = "securityGroup")]
403 pub security_group: Option<String>,
404}
405
406impl common::Part for AuthenticatorGroupsConfig {}
407
408/// AutoIpamConfig contains all information related to Auto IPAM
409///
410/// This type is not used in any activity, and only used as *part* of another schema.
411///
412#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
413#[serde_with::serde_as]
414#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
415pub struct AutoIpamConfig {
416 /// The flag that enables Auto IPAM on this cluster
417 pub enabled: Option<bool>,
418}
419
420impl common::Part for AutoIpamConfig {}
421
422/// AutoMonitoringConfig defines the configuration for GKE Workload Auto-Monitoring.
423///
424/// This type is not used in any activity, and only used as *part* of another schema.
425///
426#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
427#[serde_with::serde_as]
428#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
429pub struct AutoMonitoringConfig {
430 /// Scope for GKE Workload Auto-Monitoring.
431 pub scope: Option<String>,
432}
433
434impl common::Part for AutoMonitoringConfig {}
435
436/// AutoUpgradeOptions defines the set of options for the user to control how the Auto Upgrades will proceed.
437///
438/// This type is not used in any activity, and only used as *part* of another schema.
439///
440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
441#[serde_with::serde_as]
442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
443pub struct AutoUpgradeOptions {
444 /// 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.
445 #[serde(rename = "autoUpgradeStartTime")]
446 pub auto_upgrade_start_time: Option<String>,
447 /// Output only. This field is set when upgrades are about to commence with the description of the upgrade.
448 pub description: Option<String>,
449}
450
451impl common::Part for AutoUpgradeOptions {}
452
453/// Autopilot is the configuration for Autopilot settings on the cluster.
454///
455/// This type is not used in any activity, and only used as *part* of another schema.
456///
457#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
458#[serde_with::serde_as]
459#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
460pub struct Autopilot {
461 /// Enable Autopilot
462 pub enabled: Option<bool>,
463 /// PrivilegedAdmissionConfig is the configuration related to privileged admission control.
464 #[serde(rename = "privilegedAdmissionConfig")]
465 pub privileged_admission_config: Option<PrivilegedAdmissionConfig>,
466 /// WorkloadPolicyConfig is the configuration related to GCW workload policy
467 #[serde(rename = "workloadPolicyConfig")]
468 pub workload_policy_config: Option<WorkloadPolicyConfig>,
469}
470
471impl common::Part for Autopilot {}
472
473/// AutopilotCompatibilityIssue contains information about a specific compatibility issue with Autopilot mode.
474///
475/// This type is not used in any activity, and only used as *part* of another schema.
476///
477#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
478#[serde_with::serde_as]
479#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
480pub struct AutopilotCompatibilityIssue {
481 /// The constraint type of the issue.
482 #[serde(rename = "constraintType")]
483 pub constraint_type: Option<String>,
484 /// The description of the issue.
485 pub description: Option<String>,
486 /// A URL to a public documentation, which addresses resolving this issue.
487 #[serde(rename = "documentationUrl")]
488 pub documentation_url: Option<String>,
489 /// The incompatibility type of this issue.
490 #[serde(rename = "incompatibilityType")]
491 pub incompatibility_type: Option<String>,
492 /// The last time when this issue was observed.
493 #[serde(rename = "lastObservation")]
494 pub last_observation: Option<chrono::DateTime<chrono::offset::Utc>>,
495 /// The name of the resources which are subject to this issue.
496 pub subjects: Option<Vec<String>>,
497}
498
499impl common::Part for AutopilotCompatibilityIssue {}
500
501/// AutopilotConfig contains configuration of autopilot feature for this nodepool.
502///
503/// This type is not used in any activity, and only used as *part* of another schema.
504///
505#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
506#[serde_with::serde_as]
507#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
508pub struct AutopilotConfig {
509 /// Denotes that nodes belonging to this node pool are Autopilot nodes.
510 pub enabled: Option<bool>,
511}
512
513impl common::Part for AutopilotConfig {}
514
515/// AutoprovisioningNodePoolDefaults contains defaults for a node pool created by NAP.
516///
517/// This type is not used in any activity, and only used as *part* of another schema.
518///
519#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
520#[serde_with::serde_as]
521#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
522pub struct AutoprovisioningNodePoolDefaults {
523 /// 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
524 #[serde(rename = "bootDiskKmsKey")]
525 pub boot_disk_kms_key: Option<String>,
526 /// 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.
527 #[serde(rename = "diskSizeGb")]
528 pub disk_size_gb: Option<i32>,
529 /// 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'
530 #[serde(rename = "diskType")]
531 pub disk_type: Option<String>,
532 /// 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.
533 #[serde(rename = "imageType")]
534 pub image_type: Option<String>,
535 /// DEPRECATED. Use NodePoolAutoConfig.NodeKubeletConfig instead.
536 #[serde(rename = "insecureKubeletReadonlyPortEnabled")]
537 pub insecure_kubelet_readonly_port_enabled: Option<bool>,
538 /// Specifies the node management options for NAP created node-pools.
539 pub management: Option<NodeManagement>,
540 /// 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.
541 #[serde(rename = "minCpuPlatform")]
542 pub min_cpu_platform: Option<String>,
543 /// Scopes that are used by NAP when creating node pools.
544 #[serde(rename = "oauthScopes")]
545 pub oauth_scopes: Option<Vec<String>>,
546 /// The Google Cloud Platform Service Account to be used by the node VMs.
547 #[serde(rename = "serviceAccount")]
548 pub service_account: Option<String>,
549 /// Shielded Instance options.
550 #[serde(rename = "shieldedInstanceConfig")]
551 pub shielded_instance_config: Option<ShieldedInstanceConfig>,
552 /// Specifies the upgrade settings for NAP created node pools
553 #[serde(rename = "upgradeSettings")]
554 pub upgrade_settings: Option<UpgradeSettings>,
555}
556
557impl common::Part for AutoprovisioningNodePoolDefaults {}
558
559/// Autoscaled rollout policy utilizes the cluster autoscaler during blue-green upgrade to scale both the blue and green pools.
560///
561/// This type is not used in any activity, and only used as *part* of another schema.
562///
563#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
564#[serde_with::serde_as]
565#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
566pub struct AutoscaledRolloutPolicy {
567 /// Optional. Time to wait after cordoning the blue pool before draining the nodes. Defaults to 3 days. The value can be set between 0 and 7 days, inclusive.
568 #[serde(rename = "waitForDrainDuration")]
569 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
570 pub wait_for_drain_duration: Option<chrono::Duration>,
571}
572
573impl common::Part for AutoscaledRolloutPolicy {}
574
575/// Best effort provisioning.
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 BestEffortProvisioning {
583 /// 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
584 pub enabled: Option<bool>,
585 /// 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.
586 #[serde(rename = "minProvisionNodes")]
587 pub min_provision_nodes: Option<i32>,
588}
589
590impl common::Part for BestEffortProvisioning {}
591
592/// Parameters for using BigQuery as the destination of resource usage export.
593///
594/// This type is not used in any activity, and only used as *part* of another schema.
595///
596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
597#[serde_with::serde_as]
598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
599pub struct BigQueryDestination {
600 /// The ID of a BigQuery Dataset.
601 #[serde(rename = "datasetId")]
602 pub dataset_id: Option<String>,
603}
604
605impl common::Part for BigQueryDestination {}
606
607/// Configuration for Binary Authorization.
608///
609/// This type is not used in any activity, and only used as *part* of another schema.
610///
611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
612#[serde_with::serde_as]
613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
614pub struct BinaryAuthorization {
615 /// 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.
616 pub enabled: Option<bool>,
617 /// Mode of operation for binauthz policy evaluation. If unspecified, defaults to DISABLED.
618 #[serde(rename = "evaluationMode")]
619 pub evaluation_mode: Option<String>,
620}
621
622impl common::Part for BinaryAuthorization {}
623
624/// Information relevant to blue-green upgrade.
625///
626/// This type is not used in any activity, and only used as *part* of another schema.
627///
628#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
629#[serde_with::serde_as]
630#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
631pub struct BlueGreenInfo {
632 /// The resource URLs of the \[managed instance groups\] (/compute/docs/instance-groups/creating-groups-of-managed-instances) associated with blue pool.
633 #[serde(rename = "blueInstanceGroupUrls")]
634 pub blue_instance_group_urls: Option<Vec<String>>,
635 /// Time to start deleting blue pool to complete blue-green upgrade, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
636 #[serde(rename = "bluePoolDeletionStartTime")]
637 pub blue_pool_deletion_start_time: Option<String>,
638 /// The resource URLs of the \[managed instance groups\] (/compute/docs/instance-groups/creating-groups-of-managed-instances) associated with green pool.
639 #[serde(rename = "greenInstanceGroupUrls")]
640 pub green_instance_group_urls: Option<Vec<String>>,
641 /// Version of green pool.
642 #[serde(rename = "greenPoolVersion")]
643 pub green_pool_version: Option<String>,
644 /// Current blue-green upgrade phase.
645 pub phase: Option<String>,
646}
647
648impl common::Part for BlueGreenInfo {}
649
650/// Settings for blue-green upgrade.
651///
652/// This type is not used in any activity, and only used as *part* of another schema.
653///
654#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
655#[serde_with::serde_as]
656#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
657pub struct BlueGreenSettings {
658 /// Autoscaled policy for cluster autoscaler enabled blue-green upgrade.
659 #[serde(rename = "autoscaledRolloutPolicy")]
660 pub autoscaled_rollout_policy: Option<AutoscaledRolloutPolicy>,
661 /// Time needed after draining entire blue pool. After this period, blue pool will be cleaned up.
662 #[serde(rename = "nodePoolSoakDuration")]
663 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
664 pub node_pool_soak_duration: Option<chrono::Duration>,
665 /// Standard policy for the blue-green upgrade.
666 #[serde(rename = "standardRolloutPolicy")]
667 pub standard_rollout_policy: Option<StandardRolloutPolicy>,
668}
669
670impl common::Part for BlueGreenSettings {}
671
672/// BootDisk specifies the boot disk configuration for nodepools.
673///
674/// This type is not used in any activity, and only used as *part* of another schema.
675///
676#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
677#[serde_with::serde_as]
678#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
679pub struct BootDisk {
680 /// Disk type of the boot disk. (i.e. Hyperdisk-Balanced, PD-Balanced, etc.)
681 #[serde(rename = "diskType")]
682 pub disk_type: Option<String>,
683 /// For Hyperdisk-Balanced only, the provisioned IOPS config value.
684 #[serde(rename = "provisionedIops")]
685 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
686 pub provisioned_iops: Option<i64>,
687 /// For Hyperdisk-Balanced only, the provisioned throughput config value.
688 #[serde(rename = "provisionedThroughput")]
689 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
690 pub provisioned_throughput: Option<i64>,
691 /// Disk size in GB. Replaces NodeConfig.disk_size_gb
692 #[serde(rename = "sizeGb")]
693 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
694 pub size_gb: Option<i64>,
695}
696
697impl common::Part for BootDisk {}
698
699/// CancelOperationRequest cancels a single operation.
700///
701/// # Activities
702///
703/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
704/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
705///
706/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
707/// * [zones operations cancel projects](ProjectZoneOperationCancelCall) (request)
708#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
709#[serde_with::serde_as]
710#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
711pub struct CancelOperationRequest {
712 /// The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
713 pub name: Option<String>,
714 /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
715 #[serde(rename = "operationId")]
716 pub operation_id: Option<String>,
717 /// 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.
718 #[serde(rename = "projectId")]
719 pub project_id: Option<String>,
720 /// 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.
721 pub zone: Option<String>,
722}
723
724impl common::RequestValue for CancelOperationRequest {}
725
726/// CertificateAuthorityDomainConfig configures one or more fully qualified domain names (FQDN) to a specific certificate.
727///
728/// This type is not used in any activity, and only used as *part* of another schema.
729///
730#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
731#[serde_with::serde_as]
732#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
733pub struct CertificateAuthorityDomainConfig {
734 /// List of fully qualified domain names (FQDN). Specifying port is supported. Wildcards are NOT supported. Examples: - my.customdomain.com - 10.0.1.2:5000
735 pub fqdns: Option<Vec<String>>,
736 /// Secret Manager certificate configuration.
737 #[serde(rename = "gcpSecretManagerCertificateConfig")]
738 pub gcp_secret_manager_certificate_config: Option<GCPSecretManagerCertificateConfig>,
739}
740
741impl common::Part for CertificateAuthorityDomainConfig {}
742
743/// CertificateConfig configures certificate for the registry.
744///
745/// This type is not used in any activity, and only used as *part* of another schema.
746///
747#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
748#[serde_with::serde_as]
749#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
750pub struct CertificateConfig {
751 /// The URI configures a secret from [Secret Manager](https://cloud.google.com/secret-manager) in the format "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION" for global secret or "projects/$PROJECT_ID/locations/$REGION/secrets/$SECRET_NAME/versions/$VERSION" for regional secret. Version can be fixed (e.g. "2") or "latest"
752 #[serde(rename = "gcpSecretManagerSecretUri")]
753 pub gcp_secret_manager_secret_uri: Option<String>,
754}
755
756impl common::Part for CertificateConfig {}
757
758/// CertificateConfigPair configures pairs of certificates, which is used for client certificate and key pairs under a registry.
759///
760/// This type is not used in any activity, and only used as *part* of another schema.
761///
762#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
763#[serde_with::serde_as]
764#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
765pub struct CertificateConfigPair {
766 /// Cert configures the client certificate.
767 pub cert: Option<CertificateConfig>,
768 /// Key configures the client private key. Optional.
769 pub key: Option<CertificateConfig>,
770}
771
772impl common::Part for CertificateConfigPair {}
773
774/// CheckAutopilotCompatibilityResponse has a list of compatibility issues.
775///
776/// # Activities
777///
778/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
779/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
780///
781/// * [locations clusters check autopilot compatibility projects](ProjectLocationClusterCheckAutopilotCompatibilityCall) (response)
782#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
783#[serde_with::serde_as]
784#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
785pub struct CheckAutopilotCompatibilityResponse {
786 /// The list of issues for the given operation.
787 pub issues: Option<Vec<AutopilotCompatibilityIssue>>,
788 /// The summary of the autopilot compatibility response.
789 pub summary: Option<String>,
790}
791
792impl common::ResponseResult for CheckAutopilotCompatibilityResponse {}
793
794/// CidrBlock contains an optional name and one CIDR block.
795///
796/// This type is not used in any activity, and only used as *part* of another schema.
797///
798#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
799#[serde_with::serde_as]
800#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
801pub struct CidrBlock {
802 /// cidr_block must be specified in CIDR notation.
803 #[serde(rename = "cidrBlock")]
804 pub cidr_block: Option<String>,
805 /// display_name is an optional field for users to identify CIDR blocks.
806 #[serde(rename = "displayName")]
807 pub display_name: Option<String>,
808}
809
810impl common::Part for CidrBlock {}
811
812/// Configuration for client certificates on the cluster.
813///
814/// This type is not used in any activity, and only used as *part* of another schema.
815///
816#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
817#[serde_with::serde_as]
818#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
819pub struct ClientCertificateConfig {
820 /// Issue a client certificate.
821 #[serde(rename = "issueClientCertificate")]
822 pub issue_client_certificate: Option<bool>,
823}
824
825impl common::Part for ClientCertificateConfig {}
826
827/// Configuration options for the Cloud Run feature.
828///
829/// This type is not used in any activity, and only used as *part* of another schema.
830///
831#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
832#[serde_with::serde_as]
833#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
834pub struct CloudRunConfig {
835 /// Whether Cloud Run addon is enabled for this cluster.
836 pub disabled: Option<bool>,
837 /// Which load balancer type is installed for Cloud Run.
838 #[serde(rename = "loadBalancerType")]
839 pub load_balancer_type: Option<String>,
840}
841
842impl common::Part for CloudRunConfig {}
843
844/// A Google Kubernetes Engine cluster.
845///
846/// # Activities
847///
848/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
849/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
850///
851/// * [locations clusters get projects](ProjectLocationClusterGetCall) (response)
852/// * [zones clusters get projects](ProjectZoneClusterGetCall) (response)
853#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
854#[serde_with::serde_as]
855#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
856pub struct Cluster {
857 /// Configurations for the various addons available to run in the cluster.
858 #[serde(rename = "addonsConfig")]
859 pub addons_config: Option<AddonsConfig>,
860 /// The list of user specified Kubernetes feature gates. Each string represents the activation status of a feature gate (e.g. "featureX=true" or "featureX=false")
861 #[serde(rename = "alphaClusterFeatureGates")]
862 pub alpha_cluster_feature_gates: Option<Vec<String>>,
863 /// Configuration for limiting anonymous access to all endpoints except the health checks.
864 #[serde(rename = "anonymousAuthenticationConfig")]
865 pub anonymous_authentication_config: Option<AnonymousAuthenticationConfig>,
866 /// Configuration controlling RBAC group membership information.
867 #[serde(rename = "authenticatorGroupsConfig")]
868 pub authenticator_groups_config: Option<AuthenticatorGroupsConfig>,
869 /// Autopilot configuration for the cluster.
870 pub autopilot: Option<Autopilot>,
871 /// Cluster-level autoscaling configuration.
872 pub autoscaling: Option<ClusterAutoscaling>,
873 /// Configuration for Binary Authorization.
874 #[serde(rename = "binaryAuthorization")]
875 pub binary_authorization: Option<BinaryAuthorization>,
876 /// 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`.
877 #[serde(rename = "clusterIpv4Cidr")]
878 pub cluster_ipv4_cidr: Option<String>,
879 /// Enable/Disable Compliance Posture features for the cluster.
880 #[serde(rename = "compliancePostureConfig")]
881 pub compliance_posture_config: Option<CompliancePostureConfig>,
882 /// Which conditions caused the current cluster state.
883 pub conditions: Option<Vec<StatusCondition>>,
884 /// Configuration of Confidential Nodes. All the nodes in the cluster will be Confidential VM once enabled.
885 #[serde(rename = "confidentialNodes")]
886 pub confidential_nodes: Option<ConfidentialNodes>,
887 /// Configuration for all cluster's control plane endpoints.
888 #[serde(rename = "controlPlaneEndpointsConfig")]
889 pub control_plane_endpoints_config: Option<ControlPlaneEndpointsConfig>,
890 /// Configuration for the fine-grained cost management feature.
891 #[serde(rename = "costManagementConfig")]
892 pub cost_management_config: Option<CostManagementConfig>,
893 /// Output only. The time the cluster was created, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
894 #[serde(rename = "createTime")]
895 pub create_time: Option<String>,
896 /// Output only. The current software version of the master endpoint.
897 #[serde(rename = "currentMasterVersion")]
898 pub current_master_version: Option<String>,
899 /// Output only. The number of nodes currently in the cluster. Deprecated. Call Kubernetes API directly to retrieve node information.
900 #[serde(rename = "currentNodeCount")]
901 pub current_node_count: Option<i32>,
902 /// 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.
903 #[serde(rename = "currentNodeVersion")]
904 pub current_node_version: Option<String>,
905 /// Configuration of etcd encryption.
906 #[serde(rename = "databaseEncryption")]
907 pub database_encryption: Option<DatabaseEncryption>,
908 /// 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.
909 #[serde(rename = "defaultMaxPodsConstraint")]
910 pub default_max_pods_constraint: Option<MaxPodsConstraint>,
911 /// An optional description of this cluster.
912 pub description: Option<String>,
913 /// Beta APIs Config
914 #[serde(rename = "enableK8sBetaApis")]
915 pub enable_k8s_beta_apis: Option<K8sBetaAPIConfig>,
916 /// 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.
917 #[serde(rename = "enableKubernetesAlpha")]
918 pub enable_kubernetes_alpha: Option<bool>,
919 /// Enable the ability to use Cloud TPUs in this cluster. This field is deprecated due to the deprecation of 2VM TPU. The end of life date for 2VM TPU is 2025-04-25.
920 #[serde(rename = "enableTpu")]
921 pub enable_tpu: Option<bool>,
922 /// 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.
923 pub endpoint: Option<String>,
924 /// GKE Enterprise Configuration. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
925 #[serde(rename = "enterpriseConfig")]
926 pub enterprise_config: Option<EnterpriseConfig>,
927 /// 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.
928 pub etag: Option<String>,
929 /// Output only. The time the cluster will be automatically deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
930 #[serde(rename = "expireTime")]
931 pub expire_time: Option<String>,
932 /// Fleet information for the cluster.
933 pub fleet: Option<Fleet>,
934 /// Configuration for GKE auto upgrades.
935 #[serde(rename = "gkeAutoUpgradeConfig")]
936 pub gke_auto_upgrade_config: Option<GkeAutoUpgradeConfig>,
937 /// Output only. Unique id for the cluster.
938 pub id: Option<String>,
939 /// Configuration for Identity Service component.
940 #[serde(rename = "identityServiceConfig")]
941 pub identity_service_config: Option<IdentityServiceConfig>,
942 /// 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
943 #[serde(rename = "initialClusterVersion")]
944 pub initial_cluster_version: Option<String>,
945 /// 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.
946 #[serde(rename = "initialNodeCount")]
947 pub initial_node_count: Option<i32>,
948 /// Output only. Deprecated. Use node_pools.instance_group_urls.
949 #[serde(rename = "instanceGroupUrls")]
950 pub instance_group_urls: Option<Vec<String>>,
951 /// Configuration for cluster IP allocation.
952 #[serde(rename = "ipAllocationPolicy")]
953 pub ip_allocation_policy: Option<IPAllocationPolicy>,
954 /// The fingerprint of the set of labels for this cluster.
955 #[serde(rename = "labelFingerprint")]
956 pub label_fingerprint: Option<String>,
957 /// Configuration for the legacy ABAC authorization mode.
958 #[serde(rename = "legacyAbac")]
959 pub legacy_abac: Option<LegacyAbac>,
960 /// 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.
961 pub location: Option<String>,
962 /// 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.
963 pub locations: Option<Vec<String>>,
964 /// Logging configuration for the cluster.
965 #[serde(rename = "loggingConfig")]
966 pub logging_config: Option<LoggingConfig>,
967 /// 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.
968 #[serde(rename = "loggingService")]
969 pub logging_service: Option<String>,
970 /// Configure the maintenance policy for this cluster.
971 #[serde(rename = "maintenancePolicy")]
972 pub maintenance_policy: Option<MaintenancePolicy>,
973 /// Configuration for Managed OpenTelemetry pipeline.
974 #[serde(rename = "managedOpentelemetryConfig")]
975 pub managed_opentelemetry_config: Option<ManagedOpenTelemetryConfig>,
976 /// 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.
977 #[serde(rename = "masterAuth")]
978 pub master_auth: Option<MasterAuth>,
979 /// The configuration options for master authorized networks feature. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.authorized_networks_config instead.
980 #[serde(rename = "masterAuthorizedNetworksConfig")]
981 pub master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
982 /// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
983 #[serde(rename = "meshCertificates")]
984 pub mesh_certificates: Option<MeshCertificates>,
985 /// Monitoring configuration for the cluster.
986 #[serde(rename = "monitoringConfig")]
987 pub monitoring_config: Option<MonitoringConfig>,
988 /// 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.
989 #[serde(rename = "monitoringService")]
990 pub monitoring_service: Option<String>,
991 /// 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.
992 pub name: Option<String>,
993 /// 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.
994 pub network: Option<String>,
995 /// Configuration for cluster networking.
996 #[serde(rename = "networkConfig")]
997 pub network_config: Option<NetworkConfig>,
998 /// Configuration options for the NetworkPolicy feature.
999 #[serde(rename = "networkPolicy")]
1000 pub network_policy: Option<NetworkPolicy>,
1001 /// 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.
1002 #[serde(rename = "nodeConfig")]
1003 pub node_config: Option<NodeConfig>,
1004 /// 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.
1005 #[serde(rename = "nodeIpv4CidrSize")]
1006 pub node_ipv4_cidr_size: Option<i32>,
1007 /// Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
1008 #[serde(rename = "nodePoolAutoConfig")]
1009 pub node_pool_auto_config: Option<NodePoolAutoConfig>,
1010 /// Default NodePool settings for the entire cluster. These settings are overridden if specified on the specific NodePool object.
1011 #[serde(rename = "nodePoolDefaults")]
1012 pub node_pool_defaults: Option<NodePoolDefaults>,
1013 /// The node pools associated with this cluster. This field should not be set if "node_config" or "initial_node_count" are specified.
1014 #[serde(rename = "nodePools")]
1015 pub node_pools: Option<Vec<NodePool>>,
1016 /// Notification configuration of the cluster.
1017 #[serde(rename = "notificationConfig")]
1018 pub notification_config: Option<NotificationConfig>,
1019 /// 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.
1020 #[serde(rename = "parentProductConfig")]
1021 pub parent_product_config: Option<ParentProductConfig>,
1022 /// The config for pod autoscaling.
1023 #[serde(rename = "podAutoscaling")]
1024 pub pod_autoscaling: Option<PodAutoscaling>,
1025 /// Configuration for private cluster.
1026 #[serde(rename = "privateClusterConfig")]
1027 pub private_cluster_config: Option<PrivateClusterConfig>,
1028 /// RBACBindingConfig allows user to restrict ClusterRoleBindings an RoleBindings that can be created.
1029 #[serde(rename = "rbacBindingConfig")]
1030 pub rbac_binding_config: Option<RBACBindingConfig>,
1031 /// 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.
1032 #[serde(rename = "releaseChannel")]
1033 pub release_channel: Option<ReleaseChannel>,
1034 /// The resource labels for the cluster to use to annotate any related Google Compute Engine resources.
1035 #[serde(rename = "resourceLabels")]
1036 pub resource_labels: Option<HashMap<String, String>>,
1037 /// Configuration for exporting resource usages. Resource usage export is disabled when this config is unspecified.
1038 #[serde(rename = "resourceUsageExportConfig")]
1039 pub resource_usage_export_config: Option<ResourceUsageExportConfig>,
1040 /// Output only. Reserved for future use.
1041 #[serde(rename = "satisfiesPzi")]
1042 pub satisfies_pzi: Option<bool>,
1043 /// Output only. Reserved for future use.
1044 #[serde(rename = "satisfiesPzs")]
1045 pub satisfies_pzs: Option<bool>,
1046 /// Secret CSI driver configuration.
1047 #[serde(rename = "secretManagerConfig")]
1048 pub secret_manager_config: Option<SecretManagerConfig>,
1049 /// Enable/Disable Security Posture API features for the cluster.
1050 #[serde(rename = "securityPostureConfig")]
1051 pub security_posture_config: Option<SecurityPostureConfig>,
1052 /// Output only. Server-defined URL for the resource.
1053 #[serde(rename = "selfLink")]
1054 pub self_link: Option<String>,
1055 /// 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.
1056 #[serde(rename = "servicesIpv4Cidr")]
1057 pub services_ipv4_cidr: Option<String>,
1058 /// Shielded Nodes configuration.
1059 #[serde(rename = "shieldedNodes")]
1060 pub shielded_nodes: Option<ShieldedNodes>,
1061 /// Output only. The current status of this cluster.
1062 pub status: Option<String>,
1063 /// Output only. Deprecated. Use conditions instead. Additional information about the current status of this cluster, if available.
1064 #[serde(rename = "statusMessage")]
1065 pub status_message: Option<String>,
1066 /// The name of the Google Compute Engine [subnetwork](https://cloud.google.com/compute/docs/subnetworks) to which the cluster is connected.
1067 pub subnetwork: Option<String>,
1068 /// 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`). This field is deprecated due to the deprecation of 2VM TPU. The end of life date for 2VM TPU is 2025-04-25.
1069 #[serde(rename = "tpuIpv4CidrBlock")]
1070 pub tpu_ipv4_cidr_block: Option<String>,
1071 /// The Custom keys configuration for the cluster.
1072 #[serde(rename = "userManagedKeysConfig")]
1073 pub user_managed_keys_config: Option<UserManagedKeysConfig>,
1074 /// Cluster-level Vertical Pod Autoscaling configuration.
1075 #[serde(rename = "verticalPodAutoscaling")]
1076 pub vertical_pod_autoscaling: Option<VerticalPodAutoscaling>,
1077 /// Configuration for the use of Kubernetes Service Accounts in IAM policies.
1078 #[serde(rename = "workloadIdentityConfig")]
1079 pub workload_identity_config: Option<WorkloadIdentityConfig>,
1080 /// 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.
1081 pub zone: Option<String>,
1082}
1083
1084impl common::ResponseResult for Cluster {}
1085
1086/// 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.
1087///
1088/// This type is not used in any activity, and only used as *part* of another schema.
1089///
1090#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1091#[serde_with::serde_as]
1092#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1093pub struct ClusterAutoscaling {
1094 /// 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.
1095 #[serde(rename = "autoprovisioningLocations")]
1096 pub autoprovisioning_locations: Option<Vec<String>>,
1097 /// AutoprovisioningNodePoolDefaults contains defaults for a node pool created by NAP.
1098 #[serde(rename = "autoprovisioningNodePoolDefaults")]
1099 pub autoprovisioning_node_pool_defaults: Option<AutoprovisioningNodePoolDefaults>,
1100 /// Defines autoscaling behaviour.
1101 #[serde(rename = "autoscalingProfile")]
1102 pub autoscaling_profile: Option<String>,
1103 /// Default compute class is a configuration for default compute class.
1104 #[serde(rename = "defaultComputeClassConfig")]
1105 pub default_compute_class_config: Option<DefaultComputeClassConfig>,
1106 /// Enables automatic node pool creation and deletion.
1107 #[serde(rename = "enableNodeAutoprovisioning")]
1108 pub enable_node_autoprovisioning: Option<bool>,
1109 /// Contains global constraints regarding minimum and maximum amount of resources in the cluster.
1110 #[serde(rename = "resourceLimits")]
1111 pub resource_limits: Option<Vec<ResourceLimit>>,
1112}
1113
1114impl common::Part for ClusterAutoscaling {}
1115
1116/// Configuration of network bandwidth tiers
1117///
1118/// This type is not used in any activity, and only used as *part* of another schema.
1119///
1120#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1121#[serde_with::serde_as]
1122#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1123pub struct ClusterNetworkPerformanceConfig {
1124 /// Specifies the total network bandwidth tier for NodePools in the cluster.
1125 #[serde(rename = "totalEgressBandwidthTier")]
1126 pub total_egress_bandwidth_tier: Option<String>,
1127}
1128
1129impl common::Part for ClusterNetworkPerformanceConfig {}
1130
1131/// 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.
1132///
1133/// This type is not used in any activity, and only used as *part* of another schema.
1134///
1135#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1136#[serde_with::serde_as]
1137#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1138pub struct ClusterUpdate {
1139 /// The additional pod ranges to be added to the cluster. These pod ranges can be used by node pools to allocate pod IPs.
1140 #[serde(rename = "additionalPodRangesConfig")]
1141 pub additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
1142 /// The desired config for additional subnetworks attached to the cluster.
1143 #[serde(rename = "desiredAdditionalIpRangesConfig")]
1144 pub desired_additional_ip_ranges_config: Option<DesiredAdditionalIPRangesConfig>,
1145 /// Configurations for the various addons available to run in the cluster.
1146 #[serde(rename = "desiredAddonsConfig")]
1147 pub desired_addons_config: Option<AddonsConfig>,
1148 /// Configuration for limiting anonymous access to all endpoints except the health checks.
1149 #[serde(rename = "desiredAnonymousAuthenticationConfig")]
1150 pub desired_anonymous_authentication_config: Option<AnonymousAuthenticationConfig>,
1151 /// The desired authenticator groups config for the cluster.
1152 #[serde(rename = "desiredAuthenticatorGroupsConfig")]
1153 pub desired_authenticator_groups_config: Option<AuthenticatorGroupsConfig>,
1154 /// AutoIpamConfig contains all information related to Auto IPAM
1155 #[serde(rename = "desiredAutoIpamConfig")]
1156 pub desired_auto_ipam_config: Option<AutoIpamConfig>,
1157 /// WorkloadPolicyConfig is the configuration related to GCW workload policy
1158 #[serde(rename = "desiredAutopilotWorkloadPolicyConfig")]
1159 pub desired_autopilot_workload_policy_config: Option<WorkloadPolicyConfig>,
1160 /// The desired configuration options for the Binary Authorization feature.
1161 #[serde(rename = "desiredBinaryAuthorization")]
1162 pub desired_binary_authorization: Option<BinaryAuthorization>,
1163 /// Cluster-level autoscaling configuration.
1164 #[serde(rename = "desiredClusterAutoscaling")]
1165 pub desired_cluster_autoscaling: Option<ClusterAutoscaling>,
1166 /// Enable/Disable Compliance Posture features for the cluster.
1167 #[serde(rename = "desiredCompliancePostureConfig")]
1168 pub desired_compliance_posture_config: Option<CompliancePostureConfig>,
1169 /// The desired containerd config for the cluster.
1170 #[serde(rename = "desiredContainerdConfig")]
1171 pub desired_containerd_config: Option<ContainerdConfig>,
1172 /// Control plane endpoints configuration.
1173 #[serde(rename = "desiredControlPlaneEndpointsConfig")]
1174 pub desired_control_plane_endpoints_config: Option<ControlPlaneEndpointsConfig>,
1175 /// The desired configuration for the fine-grained cost management feature.
1176 #[serde(rename = "desiredCostManagementConfig")]
1177 pub desired_cost_management_config: Option<CostManagementConfig>,
1178 /// Configuration of etcd encryption.
1179 #[serde(rename = "desiredDatabaseEncryption")]
1180 pub desired_database_encryption: Option<DatabaseEncryption>,
1181 /// The desired datapath provider for the cluster.
1182 #[serde(rename = "desiredDatapathProvider")]
1183 pub desired_datapath_provider: Option<String>,
1184 /// Override the default setting of whether future created nodes have private IP addresses only, namely NetworkConfig.default_enable_private_nodes
1185 #[serde(rename = "desiredDefaultEnablePrivateNodes")]
1186 pub desired_default_enable_private_nodes: Option<bool>,
1187 /// The desired status of whether to disable default sNAT for this cluster.
1188 #[serde(rename = "desiredDefaultSnatStatus")]
1189 pub desired_default_snat_status: Option<DefaultSnatStatus>,
1190 /// Enable/Disable L4 LB VPC firewall reconciliation for the cluster.
1191 #[serde(rename = "desiredDisableL4LbFirewallReconciliation")]
1192 pub desired_disable_l4_lb_firewall_reconciliation: Option<bool>,
1193 /// DNSConfig contains clusterDNS config for this cluster.
1194 #[serde(rename = "desiredDnsConfig")]
1195 pub desired_dns_config: Option<DNSConfig>,
1196 /// Enable/Disable Cilium Clusterwide Network Policy for the cluster.
1197 #[serde(rename = "desiredEnableCiliumClusterwideNetworkPolicy")]
1198 pub desired_enable_cilium_clusterwide_network_policy: Option<bool>,
1199 /// Enable/Disable FQDN Network Policy for the cluster.
1200 #[serde(rename = "desiredEnableFqdnNetworkPolicy")]
1201 pub desired_enable_fqdn_network_policy: Option<bool>,
1202 /// Enable/Disable Multi-Networking for the cluster
1203 #[serde(rename = "desiredEnableMultiNetworking")]
1204 pub desired_enable_multi_networking: Option<bool>,
1205 /// Enable/Disable private endpoint for the cluster's master. Deprecated: Use desired_control_plane_endpoints_config.ip_endpoints_config.enable_public_endpoint instead. Note that the value of enable_public_endpoint is reversed: if enable_private_endpoint is false, then enable_public_endpoint will be true.
1206 #[serde(rename = "desiredEnablePrivateEndpoint")]
1207 pub desired_enable_private_endpoint: Option<bool>,
1208 /// The desired enterprise configuration for the cluster. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
1209 #[serde(rename = "desiredEnterpriseConfig")]
1210 pub desired_enterprise_config: Option<DesiredEnterpriseConfig>,
1211 /// The desired fleet configuration for the cluster.
1212 #[serde(rename = "desiredFleet")]
1213 pub desired_fleet: Option<Fleet>,
1214 /// The desired config of Gateway API on this cluster.
1215 #[serde(rename = "desiredGatewayApiConfig")]
1216 pub desired_gateway_api_config: Option<GatewayAPIConfig>,
1217 /// The desired GCFS config for the cluster
1218 #[serde(rename = "desiredGcfsConfig")]
1219 pub desired_gcfs_config: Option<GcfsConfig>,
1220 /// The desired Identity Service component configuration.
1221 #[serde(rename = "desiredIdentityServiceConfig")]
1222 pub desired_identity_service_config: Option<IdentityServiceConfig>,
1223 /// The desired image type for the node pool. NOTE: Set the "desired_node_pool" field as well.
1224 #[serde(rename = "desiredImageType")]
1225 pub desired_image_type: Option<String>,
1226 /// Specify the details of in-transit encryption.
1227 #[serde(rename = "desiredInTransitEncryptionConfig")]
1228 pub desired_in_transit_encryption_config: Option<String>,
1229 /// The desired config of Intra-node visibility.
1230 #[serde(rename = "desiredIntraNodeVisibilityConfig")]
1231 pub desired_intra_node_visibility_config: Option<IntraNodeVisibilityConfig>,
1232 /// Desired Beta APIs to be enabled for cluster.
1233 #[serde(rename = "desiredK8sBetaApis")]
1234 pub desired_k8s_beta_apis: Option<K8sBetaAPIConfig>,
1235 /// The desired L4 Internal Load Balancer Subsetting configuration.
1236 #[serde(rename = "desiredL4ilbSubsettingConfig")]
1237 pub desired_l4ilb_subsetting_config: Option<ILBSubsettingConfig>,
1238 /// 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.
1239 #[serde(rename = "desiredLocations")]
1240 pub desired_locations: Option<Vec<String>>,
1241 /// The desired logging configuration.
1242 #[serde(rename = "desiredLoggingConfig")]
1243 pub desired_logging_config: Option<LoggingConfig>,
1244 /// 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.
1245 #[serde(rename = "desiredLoggingService")]
1246 pub desired_logging_service: Option<String>,
1247 /// The desired managed open telemetry configuration.
1248 #[serde(rename = "desiredManagedOpentelemetryConfig")]
1249 pub desired_managed_opentelemetry_config: Option<ManagedOpenTelemetryConfig>,
1250 /// The desired configuration options for master authorized networks feature. Deprecated: Use desired_control_plane_endpoints_config.ip_endpoints_config.authorized_networks_config instead.
1251 #[serde(rename = "desiredMasterAuthorizedNetworksConfig")]
1252 pub desired_master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
1253 /// 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
1254 #[serde(rename = "desiredMasterVersion")]
1255 pub desired_master_version: Option<String>,
1256 /// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
1257 #[serde(rename = "desiredMeshCertificates")]
1258 pub desired_mesh_certificates: Option<MeshCertificates>,
1259 /// The desired monitoring configuration.
1260 #[serde(rename = "desiredMonitoringConfig")]
1261 pub desired_monitoring_config: Option<MonitoringConfig>,
1262 /// 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.
1263 #[serde(rename = "desiredMonitoringService")]
1264 pub desired_monitoring_service: Option<String>,
1265 /// The desired network performance config.
1266 #[serde(rename = "desiredNetworkPerformanceConfig")]
1267 pub desired_network_performance_config: Option<ClusterNetworkPerformanceConfig>,
1268 /// The desired network tier configuration for the cluster.
1269 #[serde(rename = "desiredNetworkTierConfig")]
1270 pub desired_network_tier_config: Option<NetworkTierConfig>,
1271 /// The desired node kubelet config for the cluster.
1272 #[serde(rename = "desiredNodeKubeletConfig")]
1273 pub desired_node_kubelet_config: Option<NodeKubeletConfig>,
1274 /// The desired node kubelet config for all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
1275 #[serde(rename = "desiredNodePoolAutoConfigKubeletConfig")]
1276 pub desired_node_pool_auto_config_kubelet_config: Option<NodeKubeletConfig>,
1277 /// The desired Linux node config for all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters. Currently only `cgroup_mode` can be set here.
1278 #[serde(rename = "desiredNodePoolAutoConfigLinuxNodeConfig")]
1279 pub desired_node_pool_auto_config_linux_node_config: Option<LinuxNodeConfig>,
1280 /// The desired network tags that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
1281 #[serde(rename = "desiredNodePoolAutoConfigNetworkTags")]
1282 pub desired_node_pool_auto_config_network_tags: Option<NetworkTags>,
1283 /// The desired resource manager tags that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
1284 #[serde(rename = "desiredNodePoolAutoConfigResourceManagerTags")]
1285 pub desired_node_pool_auto_config_resource_manager_tags: Option<ResourceManagerTags>,
1286 /// 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.
1287 #[serde(rename = "desiredNodePoolAutoscaling")]
1288 pub desired_node_pool_autoscaling: Option<NodePoolAutoscaling>,
1289 /// 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.
1290 #[serde(rename = "desiredNodePoolId")]
1291 pub desired_node_pool_id: Option<String>,
1292 /// The desired node pool logging configuration defaults for the cluster.
1293 #[serde(rename = "desiredNodePoolLoggingConfig")]
1294 pub desired_node_pool_logging_config: Option<NodePoolLoggingConfig>,
1295 /// 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
1296 #[serde(rename = "desiredNodeVersion")]
1297 pub desired_node_version: Option<String>,
1298 /// The desired notification configuration.
1299 #[serde(rename = "desiredNotificationConfig")]
1300 pub desired_notification_config: Option<NotificationConfig>,
1301 /// The desired parent product config for the cluster.
1302 #[serde(rename = "desiredParentProductConfig")]
1303 pub desired_parent_product_config: Option<ParentProductConfig>,
1304 /// The desired config for pod autoscaling.
1305 #[serde(rename = "desiredPodAutoscaling")]
1306 pub desired_pod_autoscaling: Option<PodAutoscaling>,
1307 /// 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. Deprecated: Use desired_control_plane_endpoints_config.ip_endpoints_config.global_access instead.
1308 #[serde(rename = "desiredPrivateClusterConfig")]
1309 pub desired_private_cluster_config: Option<PrivateClusterConfig>,
1310 /// The desired state of IPv6 connectivity to Google Services.
1311 #[serde(rename = "desiredPrivateIpv6GoogleAccess")]
1312 pub desired_private_ipv6_google_access: Option<String>,
1313 /// The desired privileged admission config for the cluster.
1314 #[serde(rename = "desiredPrivilegedAdmissionConfig")]
1315 pub desired_privileged_admission_config: Option<PrivilegedAdmissionConfig>,
1316 /// RBACBindingConfig allows user to restrict ClusterRoleBindings an RoleBindings that can be created.
1317 #[serde(rename = "desiredRbacBindingConfig")]
1318 pub desired_rbac_binding_config: Option<RBACBindingConfig>,
1319 /// The desired release channel configuration.
1320 #[serde(rename = "desiredReleaseChannel")]
1321 pub desired_release_channel: Option<ReleaseChannel>,
1322 /// The desired configuration for exporting resource usage.
1323 #[serde(rename = "desiredResourceUsageExportConfig")]
1324 pub desired_resource_usage_export_config: Option<ResourceUsageExportConfig>,
1325 /// Enable/Disable Secret Manager Config.
1326 #[serde(rename = "desiredSecretManagerConfig")]
1327 pub desired_secret_manager_config: Option<SecretManagerConfig>,
1328 /// Enable/Disable Security Posture API features for the cluster.
1329 #[serde(rename = "desiredSecurityPostureConfig")]
1330 pub desired_security_posture_config: Option<SecurityPostureConfig>,
1331 /// ServiceExternalIPsConfig specifies the config for the use of Services with ExternalIPs field.
1332 #[serde(rename = "desiredServiceExternalIpsConfig")]
1333 pub desired_service_external_ips_config: Option<ServiceExternalIPsConfig>,
1334 /// Configuration for Shielded Nodes.
1335 #[serde(rename = "desiredShieldedNodes")]
1336 pub desired_shielded_nodes: Option<ShieldedNodes>,
1337 /// 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.
1338 #[serde(rename = "desiredStackType")]
1339 pub desired_stack_type: Option<String>,
1340 /// The desired user managed keys config for the cluster.
1341 #[serde(rename = "desiredUserManagedKeysConfig")]
1342 pub desired_user_managed_keys_config: Option<UserManagedKeysConfig>,
1343 /// Cluster-level Vertical Pod Autoscaling configuration.
1344 #[serde(rename = "desiredVerticalPodAutoscaling")]
1345 pub desired_vertical_pod_autoscaling: Option<VerticalPodAutoscaling>,
1346 /// Configuration for Workload Identity.
1347 #[serde(rename = "desiredWorkloadIdentityConfig")]
1348 pub desired_workload_identity_config: Option<WorkloadIdentityConfig>,
1349 /// Kubernetes open source beta apis enabled on the cluster. Only beta apis
1350 #[serde(rename = "enableK8sBetaApis")]
1351 pub enable_k8s_beta_apis: Option<K8sBetaAPIConfig>,
1352 /// 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.
1353 pub etag: Option<String>,
1354 /// Configuration for GKE auto upgrade.
1355 #[serde(rename = "gkeAutoUpgradeConfig")]
1356 pub gke_auto_upgrade_config: Option<GkeAutoUpgradeConfig>,
1357 /// 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.
1358 #[serde(rename = "removedAdditionalPodRangesConfig")]
1359 pub removed_additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
1360 /// The Custom keys configuration for the cluster. This field is deprecated. Use ClusterUpdate.desired_user_managed_keys_config instead.
1361 #[serde(rename = "userManagedKeysConfig")]
1362 pub user_managed_keys_config: Option<UserManagedKeysConfig>,
1363}
1364
1365impl common::Part for ClusterUpdate {}
1366
1367/// ClusterUpgradeInfo contains the upgrade information of a cluster.
1368///
1369/// # Activities
1370///
1371/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1372/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1373///
1374/// * [locations clusters fetch cluster upgrade info projects](ProjectLocationClusterFetchClusterUpgradeInfoCall) (response)
1375/// * [zones clusters fetch cluster upgrade info projects](ProjectZoneClusterFetchClusterUpgradeInfoCall) (response)
1376#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1377#[serde_with::serde_as]
1378#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1379pub struct ClusterUpgradeInfo {
1380 /// The auto upgrade status.
1381 #[serde(rename = "autoUpgradeStatus")]
1382 pub auto_upgrade_status: Option<Vec<String>>,
1383 /// The cluster's current minor version's end of extended support timestamp.
1384 #[serde(rename = "endOfExtendedSupportTimestamp")]
1385 pub end_of_extended_support_timestamp: Option<String>,
1386 /// The cluster's current minor version's end of standard support timestamp.
1387 #[serde(rename = "endOfStandardSupportTimestamp")]
1388 pub end_of_standard_support_timestamp: Option<String>,
1389 /// minor_target_version indicates the target version for minor upgrade.
1390 #[serde(rename = "minorTargetVersion")]
1391 pub minor_target_version: Option<String>,
1392 /// patch_target_version indicates the target version for patch upgrade.
1393 #[serde(rename = "patchTargetVersion")]
1394 pub patch_target_version: Option<String>,
1395 /// The auto upgrade paused reason.
1396 #[serde(rename = "pausedReason")]
1397 pub paused_reason: Option<Vec<String>>,
1398 /// The list of past auto upgrades.
1399 #[serde(rename = "upgradeDetails")]
1400 pub upgrade_details: Option<Vec<UpgradeDetails>>,
1401}
1402
1403impl common::ResponseResult for ClusterUpgradeInfo {}
1404
1405/// CompleteIPRotationRequest moves the cluster master back into single-IP mode.
1406///
1407/// # Activities
1408///
1409/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1410/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1411///
1412/// * [locations clusters complete ip rotation projects](ProjectLocationClusterCompleteIpRotationCall) (request)
1413/// * [zones clusters complete ip rotation projects](ProjectZoneClusterCompleteIpRotationCall) (request)
1414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1415#[serde_with::serde_as]
1416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1417pub struct CompleteIPRotationRequest {
1418 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
1419 #[serde(rename = "clusterId")]
1420 pub cluster_id: Option<String>,
1421 /// The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
1422 pub name: Option<String>,
1423 /// 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.
1424 #[serde(rename = "projectId")]
1425 pub project_id: Option<String>,
1426 /// 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.
1427 pub zone: Option<String>,
1428}
1429
1430impl common::RequestValue for CompleteIPRotationRequest {}
1431
1432/// CompleteNodePoolUpgradeRequest sets the name of target node pool to complete upgrade.
1433///
1434/// # Activities
1435///
1436/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1437/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1438///
1439/// * [locations clusters node pools complete upgrade projects](ProjectLocationClusterNodePoolCompleteUpgradeCall) (request)
1440#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1441#[serde_with::serde_as]
1442#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1443pub struct CompleteNodePoolUpgradeRequest {
1444 _never_set: Option<bool>,
1445}
1446
1447impl common::RequestValue for CompleteNodePoolUpgradeRequest {}
1448
1449/// CompliancePostureConfig defines the settings needed to enable/disable features for the Compliance Posture.
1450///
1451/// This type is not used in any activity, and only used as *part* of another schema.
1452///
1453#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1454#[serde_with::serde_as]
1455#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1456pub struct CompliancePostureConfig {
1457 /// List of enabled compliance standards.
1458 #[serde(rename = "complianceStandards")]
1459 pub compliance_standards: Option<Vec<ComplianceStandard>>,
1460 /// Defines the enablement mode for Compliance Posture.
1461 pub mode: Option<String>,
1462}
1463
1464impl common::Part for CompliancePostureConfig {}
1465
1466/// Defines the details of a compliance standard.
1467///
1468/// This type is not used in any activity, and only used as *part* of another schema.
1469///
1470#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1471#[serde_with::serde_as]
1472#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1473pub struct ComplianceStandard {
1474 /// Name of the compliance standard.
1475 pub standard: Option<String>,
1476}
1477
1478impl common::Part for ComplianceStandard {}
1479
1480/// ConfidentialNodes is configuration for the confidential nodes feature, which makes nodes run on confidential VMs.
1481///
1482/// This type is not used in any activity, and only used as *part* of another schema.
1483///
1484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1485#[serde_with::serde_as]
1486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1487pub struct ConfidentialNodes {
1488 /// Defines the type of technology used by the confidential node.
1489 #[serde(rename = "confidentialInstanceType")]
1490 pub confidential_instance_type: Option<String>,
1491 /// Whether Confidential Nodes feature is enabled.
1492 pub enabled: Option<bool>,
1493}
1494
1495impl common::Part for ConfidentialNodes {}
1496
1497/// Configuration options for the Config Connector add-on.
1498///
1499/// This type is not used in any activity, and only used as *part* of another schema.
1500///
1501#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1502#[serde_with::serde_as]
1503#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1504pub struct ConfigConnectorConfig {
1505 /// Whether Cloud Connector is enabled for this cluster.
1506 pub enabled: Option<bool>,
1507}
1508
1509impl common::Part for ConfigConnectorConfig {}
1510
1511/// Parameters for controlling consumption metering.
1512///
1513/// This type is not used in any activity, and only used as *part* of another schema.
1514///
1515#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1516#[serde_with::serde_as]
1517#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1518pub struct ConsumptionMeteringConfig {
1519 /// Whether to enable consumption metering for this cluster. If enabled, a second BigQuery table will be created to hold resource consumption records.
1520 pub enabled: Option<bool>,
1521}
1522
1523impl common::Part for ConsumptionMeteringConfig {}
1524
1525/// ContainerdConfig contains configuration to customize containerd.
1526///
1527/// This type is not used in any activity, and only used as *part* of another schema.
1528///
1529#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1530#[serde_with::serde_as]
1531#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1532pub struct ContainerdConfig {
1533 /// PrivateRegistryAccessConfig is used to configure access configuration for private container registries.
1534 #[serde(rename = "privateRegistryAccessConfig")]
1535 pub private_registry_access_config: Option<PrivateRegistryAccessConfig>,
1536 /// RegistryHostConfig configures containerd registry host configuration. Each registry_hosts represents a hosts.toml file. At most 25 registry_hosts are allowed.
1537 #[serde(rename = "registryHosts")]
1538 pub registry_hosts: Option<Vec<RegistryHostConfig>>,
1539 /// Optional. WritableCgroups defines writable cgroups configuration for the node pool.
1540 #[serde(rename = "writableCgroups")]
1541 pub writable_cgroups: Option<WritableCgroups>,
1542}
1543
1544impl common::Part for ContainerdConfig {}
1545
1546/// Configuration for all of the cluster's control plane endpoints.
1547///
1548/// This type is not used in any activity, and only used as *part* of another schema.
1549///
1550#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1551#[serde_with::serde_as]
1552#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1553pub struct ControlPlaneEndpointsConfig {
1554 /// DNS endpoint configuration.
1555 #[serde(rename = "dnsEndpointConfig")]
1556 pub dns_endpoint_config: Option<DNSEndpointConfig>,
1557 /// IP endpoints configuration.
1558 #[serde(rename = "ipEndpointsConfig")]
1559 pub ip_endpoints_config: Option<IPEndpointsConfig>,
1560}
1561
1562impl common::Part for ControlPlaneEndpointsConfig {}
1563
1564/// Configuration for fine-grained cost management feature.
1565///
1566/// This type is not used in any activity, and only used as *part* of another schema.
1567///
1568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1569#[serde_with::serde_as]
1570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1571pub struct CostManagementConfig {
1572 /// Whether the feature is enabled or not.
1573 pub enabled: Option<bool>,
1574}
1575
1576impl common::Part for CostManagementConfig {}
1577
1578/// CreateClusterRequest creates a cluster.
1579///
1580/// # Activities
1581///
1582/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1583/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1584///
1585/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (request)
1586/// * [zones clusters create projects](ProjectZoneClusterCreateCall) (request)
1587#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1588#[serde_with::serde_as]
1589#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1590pub struct CreateClusterRequest {
1591 /// Required. A [cluster resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters)
1592 pub cluster: Option<Cluster>,
1593 /// The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
1594 pub parent: Option<String>,
1595 /// 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.
1596 #[serde(rename = "projectId")]
1597 pub project_id: Option<String>,
1598 /// 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.
1599 pub zone: Option<String>,
1600}
1601
1602impl common::RequestValue for CreateClusterRequest {}
1603
1604/// CreateNodePoolRequest creates a node pool for a cluster.
1605///
1606/// # Activities
1607///
1608/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1609/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1610///
1611/// * [locations clusters node pools create projects](ProjectLocationClusterNodePoolCreateCall) (request)
1612/// * [zones clusters node pools create projects](ProjectZoneClusterNodePoolCreateCall) (request)
1613#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1614#[serde_with::serde_as]
1615#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1616pub struct CreateNodePoolRequest {
1617 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
1618 #[serde(rename = "clusterId")]
1619 pub cluster_id: Option<String>,
1620 /// Required. The node pool to create.
1621 #[serde(rename = "nodePool")]
1622 pub node_pool: Option<NodePool>,
1623 /// The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
1624 pub parent: Option<String>,
1625 /// 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.
1626 #[serde(rename = "projectId")]
1627 pub project_id: Option<String>,
1628 /// 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.
1629 pub zone: Option<String>,
1630}
1631
1632impl common::RequestValue for CreateNodePoolRequest {}
1633
1634/// DNSConfig contains the desired set of options for configuring clusterDNS.
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 DNSConfig {
1642 /// Optional. The domain used in Additive VPC scope.
1643 #[serde(rename = "additiveVpcScopeDnsDomain")]
1644 pub additive_vpc_scope_dns_domain: Option<String>,
1645 /// cluster_dns indicates which in-cluster DNS provider should be used.
1646 #[serde(rename = "clusterDns")]
1647 pub cluster_dns: Option<String>,
1648 /// cluster_dns_domain is the suffix used for all cluster service records.
1649 #[serde(rename = "clusterDnsDomain")]
1650 pub cluster_dns_domain: Option<String>,
1651 /// cluster_dns_scope indicates the scope of access to cluster DNS records.
1652 #[serde(rename = "clusterDnsScope")]
1653 pub cluster_dns_scope: Option<String>,
1654}
1655
1656impl common::Part for DNSConfig {}
1657
1658/// Describes the configuration of a DNS endpoint.
1659///
1660/// This type is not used in any activity, and only used as *part* of another schema.
1661///
1662#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1663#[serde_with::serde_as]
1664#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1665pub struct DNSEndpointConfig {
1666 /// Controls whether user traffic is allowed over this endpoint. Note that Google-managed services may still use the endpoint even if this is false.
1667 #[serde(rename = "allowExternalTraffic")]
1668 pub allow_external_traffic: Option<bool>,
1669 /// Controls whether the k8s certs auth is allowed via DNS.
1670 #[serde(rename = "enableK8sCertsViaDns")]
1671 pub enable_k8s_certs_via_dns: Option<bool>,
1672 /// Controls whether the k8s token auth is allowed via DNS.
1673 #[serde(rename = "enableK8sTokensViaDns")]
1674 pub enable_k8s_tokens_via_dns: Option<bool>,
1675 /// Output only. The cluster's DNS endpoint configuration. A DNS format address. This is accessible from the public internet. Ex: uid.us-central1.gke.goog. Always present, but the behavior may change according to the value of DNSEndpointConfig.allow_external_traffic.
1676 pub endpoint: Option<String>,
1677}
1678
1679impl common::Part for DNSEndpointConfig {}
1680
1681/// Time window specified for daily maintenance operations.
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 DailyMaintenanceWindow {
1689 /// 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".
1690 pub duration: Option<String>,
1691 /// 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.
1692 #[serde(rename = "startTime")]
1693 pub start_time: Option<String>,
1694}
1695
1696impl common::Part for DailyMaintenanceWindow {}
1697
1698/// Configuration of etcd encryption.
1699///
1700/// This type is not used in any activity, and only used as *part* of another schema.
1701///
1702#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1703#[serde_with::serde_as]
1704#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1705pub struct DatabaseEncryption {
1706 /// Output only. The current state of etcd encryption.
1707 #[serde(rename = "currentState")]
1708 pub current_state: Option<String>,
1709 /// 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.
1710 #[serde(rename = "decryptionKeys")]
1711 pub decryption_keys: Option<Vec<String>>,
1712 /// 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
1713 #[serde(rename = "keyName")]
1714 pub key_name: Option<String>,
1715 /// Output only. Records errors seen during DatabaseEncryption update operations.
1716 #[serde(rename = "lastOperationErrors")]
1717 pub last_operation_errors: Option<Vec<OperationError>>,
1718 /// The desired state of etcd encryption.
1719 pub state: Option<String>,
1720}
1721
1722impl common::Part for DatabaseEncryption {}
1723
1724/// DefaultComputeClassConfig defines default compute class configuration.
1725///
1726/// This type is not used in any activity, and only used as *part* of another schema.
1727///
1728#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1729#[serde_with::serde_as]
1730#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1731pub struct DefaultComputeClassConfig {
1732 /// Enables default compute class.
1733 pub enabled: Option<bool>,
1734}
1735
1736impl common::Part for DefaultComputeClassConfig {}
1737
1738/// DefaultSnatStatus contains the desired state of whether default sNAT should be disabled on the cluster.
1739///
1740/// This type is not used in any activity, and only used as *part* of another schema.
1741///
1742#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1743#[serde_with::serde_as]
1744#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1745pub struct DefaultSnatStatus {
1746 /// Disables cluster default sNAT rules.
1747 pub disabled: Option<bool>,
1748}
1749
1750impl common::Part for DefaultSnatStatus {}
1751
1752/// DesiredAdditionalIPRangesConfig is a wrapper used for cluster update operation and contains multiple AdditionalIPRangesConfigs.
1753///
1754/// This type is not used in any activity, and only used as *part* of another schema.
1755///
1756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1757#[serde_with::serde_as]
1758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1759pub struct DesiredAdditionalIPRangesConfig {
1760 /// List of additional IP ranges configs where each AdditionalIPRangesConfig corresponds to one subnetwork's IP ranges
1761 #[serde(rename = "additionalIpRangesConfigs")]
1762 pub additional_ip_ranges_configs: Option<Vec<AdditionalIPRangesConfig>>,
1763}
1764
1765impl common::Part for DesiredAdditionalIPRangesConfig {}
1766
1767/// DesiredEnterpriseConfig is a wrapper used for updating enterprise_config. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
1768///
1769/// This type is not used in any activity, and only used as *part* of another schema.
1770///
1771#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1772#[serde_with::serde_as]
1773#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1774pub struct DesiredEnterpriseConfig {
1775 /// desired_tier specifies the desired tier of the cluster.
1776 #[serde(rename = "desiredTier")]
1777 pub desired_tier: Option<String>,
1778}
1779
1780impl common::Part for DesiredEnterpriseConfig {}
1781
1782/// Configuration for NodeLocal DNSCache
1783///
1784/// This type is not used in any activity, and only used as *part* of another schema.
1785///
1786#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1787#[serde_with::serde_as]
1788#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1789pub struct DnsCacheConfig {
1790 /// Whether NodeLocal DNSCache is enabled for this cluster.
1791 pub enabled: Option<bool>,
1792}
1793
1794impl common::Part for DnsCacheConfig {}
1795
1796/// 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); }
1797///
1798/// # Activities
1799///
1800/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
1801/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
1802///
1803/// * [locations clusters node pools complete upgrade projects](ProjectLocationClusterNodePoolCompleteUpgradeCall) (response)
1804/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
1805/// * [zones operations cancel projects](ProjectZoneOperationCancelCall) (response)
1806#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1807#[serde_with::serde_as]
1808#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1809pub struct Empty {
1810 _never_set: Option<bool>,
1811}
1812
1813impl common::ResponseResult for Empty {}
1814
1815/// EnterpriseConfig is the cluster enterprise configuration. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
1816///
1817/// This type is not used in any activity, and only used as *part* of another schema.
1818///
1819#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1820#[serde_with::serde_as]
1821#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1822pub struct EnterpriseConfig {
1823 /// Output only. cluster_tier indicates the effective tier of the cluster.
1824 #[serde(rename = "clusterTier")]
1825 pub cluster_tier: Option<String>,
1826 /// desired_tier specifies the desired tier of the cluster.
1827 #[serde(rename = "desiredTier")]
1828 pub desired_tier: Option<String>,
1829}
1830
1831impl common::Part for EnterpriseConfig {}
1832
1833/// EphemeralStorageLocalSsdConfig contains configuration for the node ephemeral storage using Local SSDs.
1834///
1835/// This type is not used in any activity, and only used as *part* of another schema.
1836///
1837#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1838#[serde_with::serde_as]
1839#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1840pub struct EphemeralStorageLocalSsdConfig {
1841 /// Number of local SSDs to use for GKE Data Cache.
1842 #[serde(rename = "dataCacheCount")]
1843 pub data_cache_count: Option<i32>,
1844 /// 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.
1845 #[serde(rename = "localSsdCount")]
1846 pub local_ssd_count: Option<i32>,
1847}
1848
1849impl common::Part for EphemeralStorageLocalSsdConfig {}
1850
1851/// Eviction grace periods are grace periods for each eviction signal.
1852///
1853/// This type is not used in any activity, and only used as *part* of another schema.
1854///
1855#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1856#[serde_with::serde_as]
1857#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1858pub struct EvictionGracePeriod {
1859 /// Optional. Grace period for eviction due to imagefs available signal. Sample format: "10s". Must be >= 0. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1860 #[serde(rename = "imagefsAvailable")]
1861 pub imagefs_available: Option<String>,
1862 /// Optional. Grace period for eviction due to imagefs inodes free signal. Sample format: "10s". Must be >= 0. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1863 #[serde(rename = "imagefsInodesFree")]
1864 pub imagefs_inodes_free: Option<String>,
1865 /// Optional. Grace period for eviction due to memory available signal. Sample format: "10s". Must be >= 0. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1866 #[serde(rename = "memoryAvailable")]
1867 pub memory_available: Option<String>,
1868 /// Optional. Grace period for eviction due to nodefs available signal. Sample format: "10s". Must be >= 0. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1869 #[serde(rename = "nodefsAvailable")]
1870 pub nodefs_available: Option<String>,
1871 /// Optional. Grace period for eviction due to nodefs inodes free signal. Sample format: "10s". Must be >= 0. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1872 #[serde(rename = "nodefsInodesFree")]
1873 pub nodefs_inodes_free: Option<String>,
1874 /// Optional. Grace period for eviction due to pid available signal. Sample format: "10s". Must be >= 0. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1875 #[serde(rename = "pidAvailable")]
1876 pub pid_available: Option<String>,
1877}
1878
1879impl common::Part for EvictionGracePeriod {}
1880
1881/// Eviction minimum reclaims are the resource amounts of minimum reclaims for each eviction signal.
1882///
1883/// This type is not used in any activity, and only used as *part* of another schema.
1884///
1885#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1886#[serde_with::serde_as]
1887#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1888pub struct EvictionMinimumReclaim {
1889 /// Optional. Minimum reclaim for eviction due to imagefs available signal. Only take percentage value for now. Sample format: "10%". Must be <=10%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1890 #[serde(rename = "imagefsAvailable")]
1891 pub imagefs_available: Option<String>,
1892 /// Optional. Minimum reclaim for eviction due to imagefs inodes free signal. Only take percentage value for now. Sample format: "10%". Must be <=10%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1893 #[serde(rename = "imagefsInodesFree")]
1894 pub imagefs_inodes_free: Option<String>,
1895 /// Optional. Minimum reclaim for eviction due to memory available signal. Only take percentage value for now. Sample format: "10%". Must be <=10%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1896 #[serde(rename = "memoryAvailable")]
1897 pub memory_available: Option<String>,
1898 /// Optional. Minimum reclaim for eviction due to nodefs available signal. Only take percentage value for now. Sample format: "10%". Must be <=10%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1899 #[serde(rename = "nodefsAvailable")]
1900 pub nodefs_available: Option<String>,
1901 /// Optional. Minimum reclaim for eviction due to nodefs inodes free signal. Only take percentage value for now. Sample format: "10%". Must be <=10%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1902 #[serde(rename = "nodefsInodesFree")]
1903 pub nodefs_inodes_free: Option<String>,
1904 /// Optional. Minimum reclaim for eviction due to pid available signal. Only take percentage value for now. Sample format: "10%". Must be <=10%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1905 #[serde(rename = "pidAvailable")]
1906 pub pid_available: Option<String>,
1907}
1908
1909impl common::Part for EvictionMinimumReclaim {}
1910
1911/// Eviction signals are the current state of a particular resource at a specific point in time. The kubelet uses eviction signals to make eviction decisions by comparing the signals to eviction thresholds, which are the minimum amount of the resource that should be available on the node.
1912///
1913/// This type is not used in any activity, and only used as *part* of another schema.
1914///
1915#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1916#[serde_with::serde_as]
1917#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1918pub struct EvictionSignals {
1919 /// Optional. Amount of storage available on filesystem that container runtime uses for storing images layers. If the container filesystem and image filesystem are not separate, then imagefs can store both image layers and writeable layers. Defines the amount of "imagefs.available" signal in kubelet. Default is unset, if not specified in the kubelet config. It takses percentage value for now. Sample format: "30%". Must be >= 15% and <= 50%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1920 #[serde(rename = "imagefsAvailable")]
1921 pub imagefs_available: Option<String>,
1922 /// Optional. Amount of inodes available on filesystem that container runtime uses for storing images layers. Defines the amount of "imagefs.inodesFree" signal in kubelet. Default is unset, if not specified in the kubelet config. Linux only. It takses percentage value for now. Sample format: "30%". Must be >= 5% and <= 50%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1923 #[serde(rename = "imagefsInodesFree")]
1924 pub imagefs_inodes_free: Option<String>,
1925 /// Optional. Memory available (i.e. capacity - workingSet), in bytes. Defines the amount of "memory.available" signal in kubelet. Default is unset, if not specified in the kubelet config. Format: positive number + unit, e.g. 100Ki, 10Mi, 5Gi. Valid units are Ki, Mi, Gi. Must be >= 100Mi and <= 50% of the node's memory. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1926 #[serde(rename = "memoryAvailable")]
1927 pub memory_available: Option<String>,
1928 /// Optional. Amount of storage available on filesystem that kubelet uses for volumes, daemon logs, etc. Defines the amount of "nodefs.available" signal in kubelet. Default is unset, if not specified in the kubelet config. It takses percentage value for now. Sample format: "30%". Must be >= 10% and <= 50%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1929 #[serde(rename = "nodefsAvailable")]
1930 pub nodefs_available: Option<String>,
1931 /// Optional. Amount of inodes available on filesystem that kubelet uses for volumes, daemon logs, etc. Defines the amount of "nodefs.inodesFree" signal in kubelet. Default is unset, if not specified in the kubelet config. Linux only. It takses percentage value for now. Sample format: "30%". Must be >= 5% and <= 50%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1932 #[serde(rename = "nodefsInodesFree")]
1933 pub nodefs_inodes_free: Option<String>,
1934 /// Optional. Amount of PID available for pod allocation. Defines the amount of "pid.available" signal in kubelet. Default is unset, if not specified in the kubelet config. It takses percentage value for now. Sample format: "30%". Must be >= 10% and <= 50%. See https://kubernetes.io/docs/concepts/scheduling-eviction/node-pressure-eviction/#eviction-signals
1935 #[serde(rename = "pidAvailable")]
1936 pub pid_available: Option<String>,
1937}
1938
1939impl common::Part for EvictionSignals {}
1940
1941/// Configuration of Fast Socket feature.
1942///
1943/// This type is not used in any activity, and only used as *part* of another schema.
1944///
1945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1946#[serde_with::serde_as]
1947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1948pub struct FastSocket {
1949 /// Whether Fast Socket features are enabled in the node pool.
1950 pub enabled: Option<bool>,
1951}
1952
1953impl common::Part for FastSocket {}
1954
1955/// 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
1956///
1957/// This type is not used in any activity, and only used as *part* of another schema.
1958///
1959#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1960#[serde_with::serde_as]
1961#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1962pub struct Filter {
1963 /// Event types to allowlist.
1964 #[serde(rename = "eventType")]
1965 pub event_type: Option<Vec<String>>,
1966}
1967
1968impl common::Part for Filter {}
1969
1970/// Fleet is the fleet configuration for the cluster.
1971///
1972/// This type is not used in any activity, and only used as *part* of another schema.
1973///
1974#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1975#[serde_with::serde_as]
1976#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1977pub struct Fleet {
1978 /// Output only. The full resource name of the registered fleet membership of the cluster, in the format `//gkehub.googleapis.com/projects/*/locations/*/memberships/*`.
1979 pub membership: Option<String>,
1980 /// The type of the cluster's fleet membership.
1981 #[serde(rename = "membershipType")]
1982 pub membership_type: Option<String>,
1983 /// Output only. Whether the cluster has been registered through the fleet API.
1984 #[serde(rename = "preRegistered")]
1985 pub pre_registered: Option<bool>,
1986 /// 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.
1987 pub project: Option<String>,
1988}
1989
1990impl common::Part for Fleet {}
1991
1992/// GCPSecretManagerCertificateConfig configures a secret from [Secret Manager](https://cloud.google.com/secret-manager).
1993///
1994/// This type is not used in any activity, and only used as *part* of another schema.
1995///
1996#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
1997#[serde_with::serde_as]
1998#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
1999pub struct GCPSecretManagerCertificateConfig {
2000 /// Secret URI, in the form "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION". Version can be fixed (e.g. "2") or "latest"
2001 #[serde(rename = "secretUri")]
2002 pub secret_uri: Option<String>,
2003}
2004
2005impl common::Part for GCPSecretManagerCertificateConfig {}
2006
2007/// GPUDriverInstallationConfig specifies the version of GPU driver to be auto installed.
2008///
2009/// This type is not used in any activity, and only used as *part* of another schema.
2010///
2011#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2012#[serde_with::serde_as]
2013#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2014pub struct GPUDriverInstallationConfig {
2015 /// Mode for how the GPU driver is installed.
2016 #[serde(rename = "gpuDriverVersion")]
2017 pub gpu_driver_version: Option<String>,
2018}
2019
2020impl common::Part for GPUDriverInstallationConfig {}
2021
2022/// GPUSharingConfig represents the GPU sharing configuration for Hardware Accelerators.
2023///
2024/// This type is not used in any activity, and only used as *part* of another schema.
2025///
2026#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2027#[serde_with::serde_as]
2028#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2029pub struct GPUSharingConfig {
2030 /// The type of GPU sharing strategy to enable on the GPU node.
2031 #[serde(rename = "gpuSharingStrategy")]
2032 pub gpu_sharing_strategy: Option<String>,
2033 /// The max number of containers that can share a physical GPU.
2034 #[serde(rename = "maxSharedClientsPerGpu")]
2035 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2036 pub max_shared_clients_per_gpu: Option<i64>,
2037}
2038
2039impl common::Part for GPUSharingConfig {}
2040
2041/// GatewayAPIConfig contains the desired config of Gateway API on this cluster.
2042///
2043/// This type is not used in any activity, and only used as *part* of another schema.
2044///
2045#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2046#[serde_with::serde_as]
2047#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2048pub struct GatewayAPIConfig {
2049 /// The Gateway API release channel to use for Gateway API.
2050 pub channel: Option<String>,
2051}
2052
2053impl common::Part for GatewayAPIConfig {}
2054
2055/// Configuration for the Compute Engine PD CSI driver.
2056///
2057/// This type is not used in any activity, and only used as *part* of another schema.
2058///
2059#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2060#[serde_with::serde_as]
2061#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2062pub struct GcePersistentDiskCsiDriverConfig {
2063 /// Whether the Compute Engine PD CSI driver is enabled for this cluster.
2064 pub enabled: Option<bool>,
2065}
2066
2067impl common::Part for GcePersistentDiskCsiDriverConfig {}
2068
2069/// GcfsConfig contains configurations of Google Container File System (image streaming).
2070///
2071/// This type is not used in any activity, and only used as *part* of another schema.
2072///
2073#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2074#[serde_with::serde_as]
2075#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2076pub struct GcfsConfig {
2077 /// Whether to use GCFS.
2078 pub enabled: Option<bool>,
2079}
2080
2081impl common::Part for GcfsConfig {}
2082
2083/// Configuration for the Filestore CSI driver.
2084///
2085/// This type is not used in any activity, and only used as *part* of another schema.
2086///
2087#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2088#[serde_with::serde_as]
2089#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2090pub struct GcpFilestoreCsiDriverConfig {
2091 /// Whether the Filestore CSI driver is enabled for this cluster.
2092 pub enabled: Option<bool>,
2093}
2094
2095impl common::Part for GcpFilestoreCsiDriverConfig {}
2096
2097/// Configuration for the Cloud Storage Fuse CSI driver.
2098///
2099/// This type is not used in any activity, and only used as *part* of another schema.
2100///
2101#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2102#[serde_with::serde_as]
2103#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2104pub struct GcsFuseCsiDriverConfig {
2105 /// Whether the Cloud Storage Fuse CSI driver is enabled for this cluster.
2106 pub enabled: Option<bool>,
2107}
2108
2109impl common::Part for GcsFuseCsiDriverConfig {}
2110
2111/// GetJSONWebKeysResponse is a valid JSON Web Key Set as specified in rfc 7517
2112///
2113/// # Activities
2114///
2115/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2116/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2117///
2118/// * [locations clusters get jwks projects](ProjectLocationClusterGetJwkCall) (response)
2119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2120#[serde_with::serde_as]
2121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2122pub struct GetJSONWebKeysResponse {
2123 /// For HTTP requests, this field is automatically extracted into the Cache-Control HTTP header.
2124 #[serde(rename = "cacheHeader")]
2125 pub cache_header: Option<HttpCacheControlResponseHeader>,
2126 /// The public component of the keys used by the cluster to sign token requests.
2127 pub keys: Option<Vec<Jwk>>,
2128}
2129
2130impl common::ResponseResult for GetJSONWebKeysResponse {}
2131
2132/// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. See the OpenID Connect Discovery 1.0 specification for details.
2133///
2134/// # Activities
2135///
2136/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2137/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2138///
2139/// * [locations clusters well-known get openid-configuration projects](ProjectLocationClusterWellKnownGetOpenidConfigurationCall) (response)
2140#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2141#[serde_with::serde_as]
2142#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2143pub struct GetOpenIDConfigResponse {
2144 /// For HTTP requests, this field is automatically extracted into the Cache-Control HTTP header.
2145 #[serde(rename = "cacheHeader")]
2146 pub cache_header: Option<HttpCacheControlResponseHeader>,
2147 /// Supported claims.
2148 pub claims_supported: Option<Vec<String>>,
2149 /// Supported grant types.
2150 pub grant_types: Option<Vec<String>>,
2151 /// supported ID Token signing Algorithms.
2152 pub id_token_signing_alg_values_supported: Option<Vec<String>>,
2153 /// OIDC Issuer.
2154 pub issuer: Option<String>,
2155 /// JSON Web Key uri.
2156 pub jwks_uri: Option<String>,
2157 /// Supported response types.
2158 pub response_types_supported: Option<Vec<String>>,
2159 /// Supported subject types.
2160 pub subject_types_supported: Option<Vec<String>>,
2161}
2162
2163impl common::ResponseResult for GetOpenIDConfigResponse {}
2164
2165/// GkeAutoUpgradeConfig is the configuration for GKE auto upgrades.
2166///
2167/// This type is not used in any activity, and only used as *part* of another schema.
2168///
2169#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2170#[serde_with::serde_as]
2171#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2172pub struct GkeAutoUpgradeConfig {
2173 /// PatchMode specifies how auto upgrade patch builds should be selected.
2174 #[serde(rename = "patchMode")]
2175 pub patch_mode: Option<String>,
2176}
2177
2178impl common::Part for GkeAutoUpgradeConfig {}
2179
2180/// Configuration for the Backup for GKE Agent.
2181///
2182/// This type is not used in any activity, and only used as *part* of another schema.
2183///
2184#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2185#[serde_with::serde_as]
2186#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2187pub struct GkeBackupAgentConfig {
2188 /// Whether the Backup for GKE agent is enabled for this cluster.
2189 pub enabled: Option<bool>,
2190}
2191
2192impl common::Part for GkeBackupAgentConfig {}
2193
2194/// Configuration for the High Scale Checkpointing.
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 HighScaleCheckpointingConfig {
2202 /// Whether the High Scale Checkpointing is enabled for this cluster.
2203 pub enabled: Option<bool>,
2204}
2205
2206impl common::Part for HighScaleCheckpointingConfig {}
2207
2208/// 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.
2209///
2210/// This type is not used in any activity, and only used as *part* of another schema.
2211///
2212#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2213#[serde_with::serde_as]
2214#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2215pub struct HorizontalPodAutoscaling {
2216 /// Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, it ensures that metrics are collected into Stackdriver Monitoring.
2217 pub disabled: Option<bool>,
2218}
2219
2220impl common::Part for HorizontalPodAutoscaling {}
2221
2222/// HostConfig configures the registry host under a given Server.
2223///
2224/// This type is not used in any activity, and only used as *part* of another schema.
2225///
2226#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2227#[serde_with::serde_as]
2228#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2229pub struct HostConfig {
2230 /// CA configures the registry host certificate.
2231 pub ca: Option<Vec<CertificateConfig>>,
2232 /// Capabilities represent the capabilities of the registry host, specifying what operations a host is capable of performing. If not set, containerd enables all capabilities by default.
2233 pub capabilities: Option<Vec<String>>,
2234 /// Client configures the registry host client certificate and key.
2235 pub client: Option<Vec<CertificateConfigPair>>,
2236 /// Specifies the maximum duration allowed for a connection attempt to complete. A shorter timeout helps reduce delays when falling back to the original registry if the mirror is unreachable. Maximum allowed value is 180s. If not set, containerd sets default 30s. The value should be a decimal number of seconds with an `s` suffix.
2237 #[serde(rename = "dialTimeout")]
2238 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
2239 pub dial_timeout: Option<chrono::Duration>,
2240 /// Header configures the registry host headers.
2241 pub header: Option<Vec<RegistryHeader>>,
2242 /// Host configures the registry host/mirror. It supports fully qualified domain names (FQDN) and IP addresses: Specifying port is supported. Wildcards are NOT supported. Examples: - my.customdomain.com - 10.0.1.2:5000
2243 pub host: Option<String>,
2244 /// OverridePath is used to indicate the host's API root endpoint is defined in the URL path rather than by the API specification. This may be used with non-compliant OCI registries which are missing the /v2 prefix. If not set, containerd sets default false.
2245 #[serde(rename = "overridePath")]
2246 pub override_path: Option<bool>,
2247}
2248
2249impl common::Part for HostConfig {}
2250
2251/// RFC-2616: cache control support
2252///
2253/// This type is not used in any activity, and only used as *part* of another schema.
2254///
2255#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2256#[serde_with::serde_as]
2257#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2258pub struct HttpCacheControlResponseHeader {
2259 /// 14.6 response cache age, in seconds since the response is generated
2260 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2261 pub age: Option<i64>,
2262 /// 14.9 request and response directives
2263 pub directive: Option<String>,
2264 /// 14.21 response cache expires, in RFC 1123 date format
2265 pub expires: Option<String>,
2266}
2267
2268impl common::Part for HttpCacheControlResponseHeader {}
2269
2270/// 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.
2271///
2272/// This type is not used in any activity, and only used as *part* of another schema.
2273///
2274#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2275#[serde_with::serde_as]
2276#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2277pub struct HttpLoadBalancing {
2278 /// 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.
2279 pub disabled: Option<bool>,
2280}
2281
2282impl common::Part for HttpLoadBalancing {}
2283
2284/// Hugepages amount in both 2m and 1g size
2285///
2286/// This type is not used in any activity, and only used as *part* of another schema.
2287///
2288#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2289#[serde_with::serde_as]
2290#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2291pub struct HugepagesConfig {
2292 /// Optional. Amount of 1G hugepages
2293 #[serde(rename = "hugepageSize1g")]
2294 pub hugepage_size1g: Option<i32>,
2295 /// Optional. Amount of 2M hugepages
2296 #[serde(rename = "hugepageSize2m")]
2297 pub hugepage_size2m: Option<i32>,
2298}
2299
2300impl common::Part for HugepagesConfig {}
2301
2302/// ILBSubsettingConfig contains the desired config of L4 Internal LoadBalancer subsetting on this cluster.
2303///
2304/// This type is not used in any activity, and only used as *part* of another schema.
2305///
2306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2307#[serde_with::serde_as]
2308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2309pub struct ILBSubsettingConfig {
2310 /// Enables l4 ILB subsetting for this cluster.
2311 pub enabled: Option<bool>,
2312}
2313
2314impl common::Part for ILBSubsettingConfig {}
2315
2316/// Configuration for controlling how IPs are allocated in the cluster.
2317///
2318/// This type is not used in any activity, and only used as *part* of another schema.
2319///
2320#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2321#[serde_with::serde_as]
2322#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2323pub struct IPAllocationPolicy {
2324 /// Output only. The additional IP ranges that are added to the cluster. These IP ranges can be used by new node pools to allocate node and pod IPs automatically. Each AdditionalIPRangesConfig corresponds to a single subnetwork. Once a range is removed it will not show up in IPAllocationPolicy.
2325 #[serde(rename = "additionalIpRangesConfigs")]
2326 pub additional_ip_ranges_configs: Option<Vec<AdditionalIPRangesConfig>>,
2327 /// 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.
2328 #[serde(rename = "additionalPodRangesConfig")]
2329 pub additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
2330 /// Optional. AutoIpamConfig contains all information related to Auto IPAM
2331 #[serde(rename = "autoIpamConfig")]
2332 pub auto_ipam_config: Option<AutoIpamConfig>,
2333 /// This field is deprecated, use cluster_ipv4_cidr_block.
2334 #[serde(rename = "clusterIpv4Cidr")]
2335 pub cluster_ipv4_cidr: Option<String>,
2336 /// 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.
2337 #[serde(rename = "clusterIpv4CidrBlock")]
2338 pub cluster_ipv4_cidr_block: Option<String>,
2339 /// 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.
2340 #[serde(rename = "clusterSecondaryRangeName")]
2341 pub cluster_secondary_range_name: Option<String>,
2342 /// Whether a new subnetwork will be created automatically for the cluster. This field is only applicable when `use_ip_aliases` is true.
2343 #[serde(rename = "createSubnetwork")]
2344 pub create_subnetwork: Option<bool>,
2345 /// 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.
2346 #[serde(rename = "defaultPodIpv4RangeUtilization")]
2347 pub default_pod_ipv4_range_utilization: Option<f64>,
2348 /// The ipv6 access type (internal or external) when create_subnetwork is true
2349 #[serde(rename = "ipv6AccessType")]
2350 pub ipv6_access_type: Option<String>,
2351 /// Cluster-level network tier configuration is used to determine the default network tier for external IP addresses on cluster resources, such as node pools and load balancers.
2352 #[serde(rename = "networkTierConfig")]
2353 pub network_tier_config: Option<NetworkTierConfig>,
2354 /// This field is deprecated, use node_ipv4_cidr_block.
2355 #[serde(rename = "nodeIpv4Cidr")]
2356 pub node_ipv4_cidr: Option<String>,
2357 /// 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.
2358 #[serde(rename = "nodeIpv4CidrBlock")]
2359 pub node_ipv4_cidr_block: Option<String>,
2360 /// [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.
2361 #[serde(rename = "podCidrOverprovisionConfig")]
2362 pub pod_cidr_overprovision_config: Option<PodCIDROverprovisionConfig>,
2363 /// This field is deprecated, use services_ipv4_cidr_block.
2364 #[serde(rename = "servicesIpv4Cidr")]
2365 pub services_ipv4_cidr: Option<String>,
2366 /// 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.
2367 #[serde(rename = "servicesIpv4CidrBlock")]
2368 pub services_ipv4_cidr_block: Option<String>,
2369 /// Output only. The services IPv6 CIDR block for the cluster.
2370 #[serde(rename = "servicesIpv6CidrBlock")]
2371 pub services_ipv6_cidr_block: Option<String>,
2372 /// 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.
2373 #[serde(rename = "servicesSecondaryRangeName")]
2374 pub services_secondary_range_name: Option<String>,
2375 /// The IP stack type of the cluster
2376 #[serde(rename = "stackType")]
2377 pub stack_type: Option<String>,
2378 /// Output only. The subnet's IPv6 CIDR block used by nodes and pods.
2379 #[serde(rename = "subnetIpv6CidrBlock")]
2380 pub subnet_ipv6_cidr_block: Option<String>,
2381 /// 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.
2382 #[serde(rename = "subnetworkName")]
2383 pub subnetwork_name: Option<String>,
2384 /// 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. This field is deprecated due to the deprecation of 2VM TPU. The end of life date for 2VM TPU is 2025-04-25.
2385 #[serde(rename = "tpuIpv4CidrBlock")]
2386 pub tpu_ipv4_cidr_block: Option<String>,
2387 /// 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
2388 #[serde(rename = "useIpAliases")]
2389 pub use_ip_aliases: Option<bool>,
2390 /// 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
2391 #[serde(rename = "useRoutes")]
2392 pub use_routes: Option<bool>,
2393}
2394
2395impl common::Part for IPAllocationPolicy {}
2396
2397/// IP endpoints configuration.
2398///
2399/// This type is not used in any activity, and only used as *part* of another schema.
2400///
2401#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2402#[serde_with::serde_as]
2403#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2404pub struct IPEndpointsConfig {
2405 /// Configuration of authorized networks. If enabled, restricts access to the control plane based on source IP. It is invalid to specify both Cluster.masterAuthorizedNetworksConfig and this field at the same time.
2406 #[serde(rename = "authorizedNetworksConfig")]
2407 pub authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
2408 /// Controls whether the control plane allows access through a public IP. It is invalid to specify both PrivateClusterConfig.enablePrivateEndpoint and this field at the same time.
2409 #[serde(rename = "enablePublicEndpoint")]
2410 pub enable_public_endpoint: Option<bool>,
2411 /// Controls whether to allow direct IP access.
2412 pub enabled: Option<bool>,
2413 /// Controls whether the control plane's private endpoint is accessible from sources in other regions. It is invalid to specify both PrivateClusterMasterGlobalAccessConfig.enabled and this field at the same time.
2414 #[serde(rename = "globalAccess")]
2415 pub global_access: Option<bool>,
2416 /// Output only. The internal IP address of this cluster's control plane. Only populated if enabled.
2417 #[serde(rename = "privateEndpoint")]
2418 pub private_endpoint: Option<String>,
2419 /// Subnet to provision the master's private endpoint during cluster creation. Specified in projects/*/regions/*/subnetworks/* format. It is invalid to specify both PrivateClusterConfig.privateEndpointSubnetwork and this field at the same time.
2420 #[serde(rename = "privateEndpointSubnetwork")]
2421 pub private_endpoint_subnetwork: Option<String>,
2422 /// Output only. The external IP address of this cluster's control plane. Only populated if enabled.
2423 #[serde(rename = "publicEndpoint")]
2424 pub public_endpoint: Option<String>,
2425}
2426
2427impl common::Part for IPEndpointsConfig {}
2428
2429/// IdentityServiceConfig is configuration for Identity Service which allows customers to use external identity providers with the K8S API
2430///
2431/// This type is not used in any activity, and only used as *part* of another schema.
2432///
2433#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2434#[serde_with::serde_as]
2435#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2436pub struct IdentityServiceConfig {
2437 /// Whether to enable the Identity Service component
2438 pub enabled: Option<bool>,
2439}
2440
2441impl common::Part for IdentityServiceConfig {}
2442
2443/// IntraNodeVisibilityConfig contains the desired config of the intra-node visibility on this cluster.
2444///
2445/// This type is not used in any activity, and only used as *part* of another schema.
2446///
2447#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2448#[serde_with::serde_as]
2449#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2450pub struct IntraNodeVisibilityConfig {
2451 /// Enables intra node visibility for this cluster.
2452 pub enabled: Option<bool>,
2453}
2454
2455impl common::Part for IntraNodeVisibilityConfig {}
2456
2457/// Jwk is a JSON Web Key as specified in RFC 7517
2458///
2459/// This type is not used in any activity, and only used as *part* of another schema.
2460///
2461#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2462#[serde_with::serde_as]
2463#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2464pub struct Jwk {
2465 /// Algorithm.
2466 pub alg: Option<String>,
2467 /// Used for ECDSA keys.
2468 pub crv: Option<String>,
2469 /// Used for RSA keys.
2470 pub e: Option<String>,
2471 /// Key ID.
2472 pub kid: Option<String>,
2473 /// Key Type.
2474 pub kty: Option<String>,
2475 /// Used for RSA keys.
2476 pub n: Option<String>,
2477 /// Permitted uses for the public keys.
2478 #[serde(rename = "use")]
2479 pub use_: Option<String>,
2480 /// Used for ECDSA keys.
2481 pub x: Option<String>,
2482 /// Used for ECDSA keys.
2483 pub y: Option<String>,
2484}
2485
2486impl common::Part for Jwk {}
2487
2488/// K8sBetaAPIConfig , configuration for beta APIs
2489///
2490/// This type is not used in any activity, and only used as *part* of another schema.
2491///
2492#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2493#[serde_with::serde_as]
2494#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2495pub struct K8sBetaAPIConfig {
2496 /// Enabled k8s beta APIs.
2497 #[serde(rename = "enabledApis")]
2498 pub enabled_apis: Option<Vec<String>>,
2499}
2500
2501impl common::Part for K8sBetaAPIConfig {}
2502
2503/// Configuration for the Kubernetes Dashboard.
2504///
2505/// This type is not used in any activity, and only used as *part* of another schema.
2506///
2507#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2508#[serde_with::serde_as]
2509#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2510pub struct KubernetesDashboard {
2511 /// Whether the Kubernetes Dashboard is enabled for this cluster.
2512 pub disabled: Option<bool>,
2513}
2514
2515impl common::Part for KubernetesDashboard {}
2516
2517/// Configuration for the legacy Attribute Based Access Control authorization mode.
2518///
2519/// This type is not used in any activity, and only used as *part* of another schema.
2520///
2521#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2522#[serde_with::serde_as]
2523#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2524pub struct LegacyAbac {
2525 /// 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.
2526 pub enabled: Option<bool>,
2527}
2528
2529impl common::Part for LegacyAbac {}
2530
2531/// Parameters that can be configured on Linux nodes.
2532///
2533/// This type is not used in any activity, and only used as *part* of another schema.
2534///
2535#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2536#[serde_with::serde_as]
2537#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2538pub struct LinuxNodeConfig {
2539 /// cgroup_mode specifies the cgroup mode to be used on the node.
2540 #[serde(rename = "cgroupMode")]
2541 pub cgroup_mode: Option<String>,
2542 /// Optional. Amounts for 2M and 1G hugepages
2543 pub hugepages: Option<HugepagesConfig>,
2544 /// Optional. Configuration for kernel module loading on nodes. When enabled, the node pool will be provisioned with a Container-Optimized OS image that enforces kernel module signature verification.
2545 #[serde(rename = "nodeKernelModuleLoading")]
2546 pub node_kernel_module_loading: Option<NodeKernelModuleLoading>,
2547 /// 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.rmem_default 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 net.ipv4.tcp_mtu_probing net.ipv4.tcp_max_orphans net.ipv4.tcp_max_tw_buckets net.ipv4.tcp_syn_retries net.ipv4.tcp_ecn net.ipv4.tcp_congestion_control net.netfilter.nf_conntrack_max net.netfilter.nf_conntrack_buckets net.netfilter.nf_conntrack_tcp_timeout_close_wait net.netfilter.nf_conntrack_tcp_timeout_time_wait net.netfilter.nf_conntrack_tcp_timeout_established net.netfilter.nf_conntrack_acct kernel.shmmni kernel.shmmax kernel.shmall kernel.perf_event_paranoid kernel.sched_rt_runtime_us kernel.softlockup_panic kernel.yama.ptrace_scope kernel.kptr_restrict kernel.dmesg_restrict kernel.sysrq fs.aio-max-nr fs.file-max fs.inotify.max_user_instances fs.inotify.max_user_watches fs.nr_open vm.dirty_background_ratio vm.dirty_background_bytes vm.dirty_expire_centisecs vm.dirty_ratio vm.dirty_bytes vm.dirty_writeback_centisecs vm.max_map_count vm.overcommit_memory vm.overcommit_ratio vm.vfs_cache_pressure vm.swappiness vm.watermark_scale_factor vm.min_free_kbytes
2548 pub sysctls: Option<HashMap<String, String>>,
2549 /// Optional. Defines the transparent hugepage defrag configuration on the node. VM hugepage allocation can be managed by either limiting defragmentation for delayed allocation or skipping it entirely for immediate allocation only. See https://docs.kernel.org/admin-guide/mm/transhuge.html for more details.
2550 #[serde(rename = "transparentHugepageDefrag")]
2551 pub transparent_hugepage_defrag: Option<String>,
2552 /// Optional. Transparent hugepage support for anonymous memory can be entirely disabled (mostly for debugging purposes) or only enabled inside MADV_HUGEPAGE regions (to avoid the risk of consuming more memory resources) or enabled system wide. See https://docs.kernel.org/admin-guide/mm/transhuge.html for more details.
2553 #[serde(rename = "transparentHugepageEnabled")]
2554 pub transparent_hugepage_enabled: Option<String>,
2555}
2556
2557impl common::Part for LinuxNodeConfig {}
2558
2559/// ListClustersResponse is the result of ListClustersRequest.
2560///
2561/// # Activities
2562///
2563/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2564/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2565///
2566/// * [locations clusters list projects](ProjectLocationClusterListCall) (response)
2567/// * [zones clusters list projects](ProjectZoneClusterListCall) (response)
2568#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2569#[serde_with::serde_as]
2570#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2571pub struct ListClustersResponse {
2572 /// A list of clusters in the project in the specified zone, or across all ones.
2573 pub clusters: Option<Vec<Cluster>>,
2574 /// If any zones are listed here, the list of clusters returned may be missing those zones.
2575 #[serde(rename = "missingZones")]
2576 pub missing_zones: Option<Vec<String>>,
2577}
2578
2579impl common::ResponseResult for ListClustersResponse {}
2580
2581/// ListNodePoolsResponse is the result of ListNodePoolsRequest.
2582///
2583/// # Activities
2584///
2585/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2586/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2587///
2588/// * [locations clusters node pools list projects](ProjectLocationClusterNodePoolListCall) (response)
2589/// * [zones clusters node pools list projects](ProjectZoneClusterNodePoolListCall) (response)
2590#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2591#[serde_with::serde_as]
2592#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2593pub struct ListNodePoolsResponse {
2594 /// A list of node pools for a cluster.
2595 #[serde(rename = "nodePools")]
2596 pub node_pools: Option<Vec<NodePool>>,
2597}
2598
2599impl common::ResponseResult for ListNodePoolsResponse {}
2600
2601/// ListOperationsResponse is the result of ListOperationsRequest.
2602///
2603/// # Activities
2604///
2605/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2606/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2607///
2608/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
2609/// * [zones operations list projects](ProjectZoneOperationListCall) (response)
2610#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2611#[serde_with::serde_as]
2612#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2613pub struct ListOperationsResponse {
2614 /// If any zones are listed here, the list of operations returned may be missing the operations from those zones.
2615 #[serde(rename = "missingZones")]
2616 pub missing_zones: Option<Vec<String>>,
2617 /// A list of operations in the project in the specified zone.
2618 pub operations: Option<Vec<Operation>>,
2619}
2620
2621impl common::ResponseResult for ListOperationsResponse {}
2622
2623/// ListUsableSubnetworksResponse is the response of ListUsableSubnetworksRequest.
2624///
2625/// # Activities
2626///
2627/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
2628/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
2629///
2630/// * [aggregated usable subnetworks list projects](ProjectAggregatedUsableSubnetworkListCall) (response)
2631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2632#[serde_with::serde_as]
2633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2634pub struct ListUsableSubnetworksResponse {
2635 /// 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.
2636 #[serde(rename = "nextPageToken")]
2637 pub next_page_token: Option<String>,
2638 /// A list of usable subnetworks in the specified network project.
2639 pub subnetworks: Option<Vec<UsableSubnetwork>>,
2640}
2641
2642impl common::ResponseResult for ListUsableSubnetworksResponse {}
2643
2644/// LocalNvmeSsdBlockConfig contains configuration for using raw-block local NVMe SSDs
2645///
2646/// This type is not used in any activity, and only used as *part* of another schema.
2647///
2648#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2649#[serde_with::serde_as]
2650#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2651pub struct LocalNvmeSsdBlockConfig {
2652 /// 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.
2653 #[serde(rename = "localSsdCount")]
2654 pub local_ssd_count: Option<i32>,
2655}
2656
2657impl common::Part for LocalNvmeSsdBlockConfig {}
2658
2659/// LoggingComponentConfig is cluster logging component configuration.
2660///
2661/// This type is not used in any activity, and only used as *part* of another schema.
2662///
2663#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2664#[serde_with::serde_as]
2665#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2666pub struct LoggingComponentConfig {
2667 /// Select components to collect logs. An empty set would disable all logging.
2668 #[serde(rename = "enableComponents")]
2669 pub enable_components: Option<Vec<String>>,
2670}
2671
2672impl common::Part for LoggingComponentConfig {}
2673
2674/// LoggingConfig is cluster logging configuration.
2675///
2676/// This type is not used in any activity, and only used as *part* of another schema.
2677///
2678#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2679#[serde_with::serde_as]
2680#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2681pub struct LoggingConfig {
2682 /// Logging components configuration
2683 #[serde(rename = "componentConfig")]
2684 pub component_config: Option<LoggingComponentConfig>,
2685}
2686
2687impl common::Part for LoggingConfig {}
2688
2689/// LoggingVariantConfig specifies the behaviour of the logging component.
2690///
2691/// This type is not used in any activity, and only used as *part* of another schema.
2692///
2693#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2694#[serde_with::serde_as]
2695#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2696pub struct LoggingVariantConfig {
2697 /// Logging variant deployed on nodes.
2698 pub variant: Option<String>,
2699}
2700
2701impl common::Part for LoggingVariantConfig {}
2702
2703/// Configuration for the Lustre CSI driver.
2704///
2705/// This type is not used in any activity, and only used as *part* of another schema.
2706///
2707#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2708#[serde_with::serde_as]
2709#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2710pub struct LustreCsiDriverConfig {
2711 /// If set to true, the Lustre CSI driver will install Lustre kernel modules using port 6988. This serves as a workaround for a port conflict with the gke-metadata-server. This field is required ONLY under the following conditions: 1. The GKE node version is older than 1.33.2-gke.4655000. 2. You're connecting to a Lustre instance that has the 'gke-support-enabled' flag. Deprecated: This flag is no longer required as of GKE node version 1.33.2-gke.4655000, unless you are connecting to a Lustre instance that has the `gke-support-enabled` flag.
2712 #[serde(rename = "enableLegacyLustrePort")]
2713 pub enable_legacy_lustre_port: Option<bool>,
2714 /// Whether the Lustre CSI driver is enabled for this cluster.
2715 pub enabled: Option<bool>,
2716}
2717
2718impl common::Part for LustreCsiDriverConfig {}
2719
2720/// Represents the Maintenance exclusion option.
2721///
2722/// This type is not used in any activity, and only used as *part* of another schema.
2723///
2724#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2725#[serde_with::serde_as]
2726#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2727pub struct MaintenanceExclusionOptions {
2728 /// EndTimeBehavior specifies the behavior of the exclusion end time.
2729 #[serde(rename = "endTimeBehavior")]
2730 pub end_time_behavior: Option<String>,
2731 /// Scope specifies the upgrade scope which upgrades are blocked by the exclusion.
2732 pub scope: Option<String>,
2733}
2734
2735impl common::Part for MaintenanceExclusionOptions {}
2736
2737/// MaintenancePolicy defines the maintenance policy to be used for the cluster.
2738///
2739/// This type is not used in any activity, and only used as *part* of another schema.
2740///
2741#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2742#[serde_with::serde_as]
2743#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2744pub struct MaintenancePolicy {
2745 /// 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.
2746 #[serde(rename = "resourceVersion")]
2747 pub resource_version: Option<String>,
2748 /// Specifies the maintenance window in which maintenance may be performed.
2749 pub window: Option<MaintenanceWindow>,
2750}
2751
2752impl common::Part for MaintenancePolicy {}
2753
2754/// MaintenanceWindow defines the maintenance window to be used for the cluster.
2755///
2756/// This type is not used in any activity, and only used as *part* of another schema.
2757///
2758#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2759#[serde_with::serde_as]
2760#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2761pub struct MaintenanceWindow {
2762 /// DailyMaintenanceWindow specifies a daily maintenance operation window.
2763 #[serde(rename = "dailyMaintenanceWindow")]
2764 pub daily_maintenance_window: Option<DailyMaintenanceWindow>,
2765 /// Exceptions to maintenance window. Non-emergency maintenance should not occur in these windows.
2766 #[serde(rename = "maintenanceExclusions")]
2767 pub maintenance_exclusions: Option<HashMap<String, TimeWindow>>,
2768 /// 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.
2769 #[serde(rename = "recurringWindow")]
2770 pub recurring_window: Option<RecurringTimeWindow>,
2771}
2772
2773impl common::Part for MaintenanceWindow {}
2774
2775/// ManagedOpenTelemetryConfig is the configuration for the GKE Managed OpenTelemetry pipeline.
2776///
2777/// This type is not used in any activity, and only used as *part* of another schema.
2778///
2779#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2780#[serde_with::serde_as]
2781#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2782pub struct ManagedOpenTelemetryConfig {
2783 /// Scope of the Managed OpenTelemetry pipeline.
2784 pub scope: Option<String>,
2785}
2786
2787impl common::Part for ManagedOpenTelemetryConfig {}
2788
2789/// ManagedPrometheusConfig defines the configuration for Google Cloud Managed Service for Prometheus.
2790///
2791/// This type is not used in any activity, and only used as *part* of another schema.
2792///
2793#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2794#[serde_with::serde_as]
2795#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2796pub struct ManagedPrometheusConfig {
2797 /// GKE Workload Auto-Monitoring Configuration.
2798 #[serde(rename = "autoMonitoringConfig")]
2799 pub auto_monitoring_config: Option<AutoMonitoringConfig>,
2800 /// Enable Managed Collection.
2801 pub enabled: Option<bool>,
2802}
2803
2804impl common::Part for ManagedPrometheusConfig {}
2805
2806/// The authentication information for accessing the master endpoint. Authentication can be done using HTTP basic auth or using client certificates.
2807///
2808/// This type is not used in any activity, and only used as *part* of another schema.
2809///
2810#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2811#[serde_with::serde_as]
2812#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2813pub struct MasterAuth {
2814 /// Output only. Base64-encoded public certificate used by clients to authenticate to the cluster endpoint. Issued only if client_certificate_config is set.
2815 #[serde(rename = "clientCertificate")]
2816 pub client_certificate: Option<String>,
2817 /// Configuration for client certificate authentication on the cluster. For clusters before v1.12, if no configuration is specified, a client certificate is issued.
2818 #[serde(rename = "clientCertificateConfig")]
2819 pub client_certificate_config: Option<ClientCertificateConfig>,
2820 /// Output only. Base64-encoded private key used by clients to authenticate to the cluster endpoint.
2821 #[serde(rename = "clientKey")]
2822 pub client_key: Option<String>,
2823 /// Output only. Base64-encoded public certificate that is the root of trust for the cluster.
2824 #[serde(rename = "clusterCaCertificate")]
2825 pub cluster_ca_certificate: Option<String>,
2826 /// 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
2827 pub password: Option<String>,
2828 /// 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
2829 pub username: Option<String>,
2830}
2831
2832impl common::Part for MasterAuth {}
2833
2834/// 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.
2835///
2836/// This type is not used in any activity, and only used as *part* of another schema.
2837///
2838#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2839#[serde_with::serde_as]
2840#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2841pub struct MasterAuthorizedNetworksConfig {
2842 /// cidr_blocks define up to 50 external networks that could access Kubernetes master through HTTPS.
2843 #[serde(rename = "cidrBlocks")]
2844 pub cidr_blocks: Option<Vec<CidrBlock>>,
2845 /// Whether or not master authorized networks is enabled.
2846 pub enabled: Option<bool>,
2847 /// Whether master is accessible via Google Compute Engine Public IP addresses.
2848 #[serde(rename = "gcpPublicCidrsAccessEnabled")]
2849 pub gcp_public_cidrs_access_enabled: Option<bool>,
2850 /// Whether master authorized networks is enforced on private endpoint or not.
2851 #[serde(rename = "privateEndpointEnforcementEnabled")]
2852 pub private_endpoint_enforcement_enabled: Option<bool>,
2853}
2854
2855impl common::Part for MasterAuthorizedNetworksConfig {}
2856
2857/// Constraints applied to pods.
2858///
2859/// This type is not used in any activity, and only used as *part* of another schema.
2860///
2861#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2862#[serde_with::serde_as]
2863#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2864pub struct MaxPodsConstraint {
2865 /// Constraint enforced on the max num of pods per node.
2866 #[serde(rename = "maxPodsPerNode")]
2867 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2868 pub max_pods_per_node: Option<i64>,
2869}
2870
2871impl common::Part for MaxPodsConstraint {}
2872
2873/// The option enables the Kubernetes NUMA-aware Memory Manager feature. Detailed description about the feature can be found [here](https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/).
2874///
2875/// This type is not used in any activity, and only used as *part* of another schema.
2876///
2877#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2878#[serde_with::serde_as]
2879#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2880pub struct MemoryManager {
2881 /// Controls the memory management policy on the Node. See https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/#policies The following values are allowed. * "none" * "static" The default value is 'none' if unspecified.
2882 pub policy: Option<String>,
2883}
2884
2885impl common::Part for MemoryManager {}
2886
2887/// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
2888///
2889/// This type is not used in any activity, and only used as *part* of another schema.
2890///
2891#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2892#[serde_with::serde_as]
2893#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2894pub struct MeshCertificates {
2895 /// 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).
2896 #[serde(rename = "enableCertificates")]
2897 pub enable_certificates: Option<bool>,
2898}
2899
2900impl common::Part for MeshCertificates {}
2901
2902/// Progress metric is (string, int|float|string) pair.
2903///
2904/// This type is not used in any activity, and only used as *part* of another schema.
2905///
2906#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2907#[serde_with::serde_as]
2908#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2909pub struct Metric {
2910 /// For metrics with floating point value.
2911 #[serde(rename = "doubleValue")]
2912 pub double_value: Option<f64>,
2913 /// For metrics with integer value.
2914 #[serde(rename = "intValue")]
2915 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
2916 pub int_value: Option<i64>,
2917 /// Required. Metric name, e.g., "nodes total", "percent done".
2918 pub name: Option<String>,
2919 /// For metrics with custom values (ratios, visual progress, etc.).
2920 #[serde(rename = "stringValue")]
2921 pub string_value: Option<String>,
2922}
2923
2924impl common::Part for Metric {}
2925
2926/// MonitoringComponentConfig is cluster monitoring component configuration.
2927///
2928/// This type is not used in any activity, and only used as *part* of another schema.
2929///
2930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2931#[serde_with::serde_as]
2932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2933pub struct MonitoringComponentConfig {
2934 /// Select components to collect metrics. An empty set would disable all monitoring.
2935 #[serde(rename = "enableComponents")]
2936 pub enable_components: Option<Vec<String>>,
2937}
2938
2939impl common::Part for MonitoringComponentConfig {}
2940
2941/// MonitoringConfig is cluster monitoring configuration.
2942///
2943/// This type is not used in any activity, and only used as *part* of another schema.
2944///
2945#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2946#[serde_with::serde_as]
2947#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2948pub struct MonitoringConfig {
2949 /// Configuration of Advanced Datapath Observability features.
2950 #[serde(rename = "advancedDatapathObservabilityConfig")]
2951 pub advanced_datapath_observability_config: Option<AdvancedDatapathObservabilityConfig>,
2952 /// Monitoring components configuration
2953 #[serde(rename = "componentConfig")]
2954 pub component_config: Option<MonitoringComponentConfig>,
2955 /// Enable Google Cloud Managed Service for Prometheus in the cluster.
2956 #[serde(rename = "managedPrometheusConfig")]
2957 pub managed_prometheus_config: Option<ManagedPrometheusConfig>,
2958}
2959
2960impl common::Part for MonitoringConfig {}
2961
2962/// NetworkConfig reports the relative names of network & subnetwork.
2963///
2964/// This type is not used in any activity, and only used as *part* of another schema.
2965///
2966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
2967#[serde_with::serde_as]
2968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
2969pub struct NetworkConfig {
2970 /// The desired datapath provider for this cluster. By default, uses the IPTables-based kube-proxy implementation.
2971 #[serde(rename = "datapathProvider")]
2972 pub datapath_provider: Option<String>,
2973 /// Controls whether by default nodes have private IP addresses only. It is invalid to specify both PrivateClusterConfig.enablePrivateNodes and this field at the same time. To update the default setting, use ClusterUpdate.desired_default_enable_private_nodes
2974 #[serde(rename = "defaultEnablePrivateNodes")]
2975 pub default_enable_private_nodes: Option<bool>,
2976 /// 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.
2977 #[serde(rename = "defaultSnatStatus")]
2978 pub default_snat_status: Option<DefaultSnatStatus>,
2979 /// Disable L4 load balancer VPC firewalls to enable firewall policies.
2980 #[serde(rename = "disableL4LbFirewallReconciliation")]
2981 pub disable_l4_lb_firewall_reconciliation: Option<bool>,
2982 /// DNSConfig contains clusterDNS config for this cluster.
2983 #[serde(rename = "dnsConfig")]
2984 pub dns_config: Option<DNSConfig>,
2985 /// Whether CiliumClusterwideNetworkPolicy is enabled on this cluster.
2986 #[serde(rename = "enableCiliumClusterwideNetworkPolicy")]
2987 pub enable_cilium_clusterwide_network_policy: Option<bool>,
2988 /// Whether FQDN Network Policy is enabled on this cluster.
2989 #[serde(rename = "enableFqdnNetworkPolicy")]
2990 pub enable_fqdn_network_policy: Option<bool>,
2991 /// Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network.
2992 #[serde(rename = "enableIntraNodeVisibility")]
2993 pub enable_intra_node_visibility: Option<bool>,
2994 /// Whether L4ILB Subsetting is enabled for this cluster.
2995 #[serde(rename = "enableL4ilbSubsetting")]
2996 pub enable_l4ilb_subsetting: Option<bool>,
2997 /// Whether multi-networking is enabled for this cluster.
2998 #[serde(rename = "enableMultiNetworking")]
2999 pub enable_multi_networking: Option<bool>,
3000 /// GatewayAPIConfig contains the desired config of Gateway API on this cluster.
3001 #[serde(rename = "gatewayApiConfig")]
3002 pub gateway_api_config: Option<GatewayAPIConfig>,
3003 /// Specify the details of in-transit encryption. Now named inter-node transparent encryption.
3004 #[serde(rename = "inTransitEncryptionConfig")]
3005 pub in_transit_encryption_config: Option<String>,
3006 /// 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
3007 pub network: Option<String>,
3008 /// Network bandwidth tier configuration.
3009 #[serde(rename = "networkPerformanceConfig")]
3010 pub network_performance_config: Option<ClusterNetworkPerformanceConfig>,
3011 /// 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)
3012 #[serde(rename = "privateIpv6GoogleAccess")]
3013 pub private_ipv6_google_access: Option<String>,
3014 /// ServiceExternalIPsConfig specifies if services with externalIPs field are blocked or not.
3015 #[serde(rename = "serviceExternalIpsConfig")]
3016 pub service_external_ips_config: Option<ServiceExternalIPsConfig>,
3017 /// 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
3018 pub subnetwork: Option<String>,
3019}
3020
3021impl common::Part for NetworkConfig {}
3022
3023/// Configuration of all network bandwidth tiers
3024///
3025/// This type is not used in any activity, and only used as *part* of another schema.
3026///
3027#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3028#[serde_with::serde_as]
3029#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3030pub struct NetworkPerformanceConfig {
3031 /// Specifies the total network bandwidth tier for the NodePool.
3032 #[serde(rename = "totalEgressBandwidthTier")]
3033 pub total_egress_bandwidth_tier: Option<String>,
3034}
3035
3036impl common::Part for NetworkPerformanceConfig {}
3037
3038/// Configuration options for the NetworkPolicy feature. https://kubernetes.io/docs/concepts/services-networking/networkpolicies/
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 NetworkPolicy {
3046 /// Whether network policy is enabled on the cluster.
3047 pub enabled: Option<bool>,
3048 /// The selected network policy provider.
3049 pub provider: Option<String>,
3050}
3051
3052impl common::Part for NetworkPolicy {}
3053
3054/// 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.
3055///
3056/// This type is not used in any activity, and only used as *part* of another schema.
3057///
3058#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3059#[serde_with::serde_as]
3060#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3061pub struct NetworkPolicyConfig {
3062 /// Whether NetworkPolicy is enabled for this cluster.
3063 pub disabled: Option<bool>,
3064}
3065
3066impl common::Part for NetworkPolicyConfig {}
3067
3068/// Collection of Compute Engine network tags that can be applied to a node's underlying VM instance.
3069///
3070/// This type is not used in any activity, and only used as *part* of another schema.
3071///
3072#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3073#[serde_with::serde_as]
3074#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3075pub struct NetworkTags {
3076 /// List of network tags.
3077 pub tags: Option<Vec<String>>,
3078}
3079
3080impl common::Part for NetworkTags {}
3081
3082/// NetworkTierConfig contains network tier information.
3083///
3084/// This type is not used in any activity, and only used as *part* of another schema.
3085///
3086#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3087#[serde_with::serde_as]
3088#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3089pub struct NetworkTierConfig {
3090 /// Network tier configuration.
3091 #[serde(rename = "networkTier")]
3092 pub network_tier: Option<String>,
3093}
3094
3095impl common::Part for NetworkTierConfig {}
3096
3097/// 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).
3098///
3099/// This type is not used in any activity, and only used as *part* of another schema.
3100///
3101#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3102#[serde_with::serde_as]
3103#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3104pub struct NodeAffinity {
3105 /// Key for NodeAffinity.
3106 pub key: Option<String>,
3107 /// Operator for NodeAffinity.
3108 pub operator: Option<String>,
3109 /// Values for NodeAffinity.
3110 pub values: Option<Vec<String>>,
3111}
3112
3113impl common::Part for NodeAffinity {}
3114
3115/// Parameters that describe the nodes in a cluster. GKE Autopilot clusters do not recognize parameters in `NodeConfig`. Use AutoprovisioningNodePoolDefaults instead.
3116///
3117/// This type is not used in any activity, and only used as *part* of another schema.
3118///
3119#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3120#[serde_with::serde_as]
3121#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3122pub struct NodeConfig {
3123 /// 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.
3124 pub accelerators: Option<Vec<AcceleratorConfig>>,
3125 /// Advanced features for the Compute Engine VM.
3126 #[serde(rename = "advancedMachineFeatures")]
3127 pub advanced_machine_features: Option<AdvancedMachineFeatures>,
3128 /// The boot disk configuration for the node pool.
3129 #[serde(rename = "bootDisk")]
3130 pub boot_disk: Option<BootDisk>,
3131 /// 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
3132 #[serde(rename = "bootDiskKmsKey")]
3133 pub boot_disk_kms_key: Option<String>,
3134 /// Confidential nodes config. All the nodes in the node pool will be Confidential VM once enabled.
3135 #[serde(rename = "confidentialNodes")]
3136 pub confidential_nodes: Option<ConfidentialNodes>,
3137 /// Parameters for containerd customization.
3138 #[serde(rename = "containerdConfig")]
3139 pub containerd_config: Option<ContainerdConfig>,
3140 /// 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.
3141 #[serde(rename = "diskSizeGb")]
3142 pub disk_size_gb: Option<i32>,
3143 /// 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'
3144 #[serde(rename = "diskType")]
3145 pub disk_type: Option<String>,
3146 /// Output only. effective_cgroup_mode is the cgroup mode actually used by the node pool. It is determined by the cgroup mode specified in the LinuxNodeConfig or the default cgroup mode based on the cluster creation version.
3147 #[serde(rename = "effectiveCgroupMode")]
3148 pub effective_cgroup_mode: Option<String>,
3149 /// Optional. Reserved for future use.
3150 #[serde(rename = "enableConfidentialStorage")]
3151 pub enable_confidential_storage: Option<bool>,
3152 /// Parameters for the node ephemeral storage using Local SSDs. If unspecified, ephemeral storage is backed by the boot disk.
3153 #[serde(rename = "ephemeralStorageLocalSsdConfig")]
3154 pub ephemeral_storage_local_ssd_config: Option<EphemeralStorageLocalSsdConfig>,
3155 /// Enable or disable NCCL fast socket for the node pool.
3156 #[serde(rename = "fastSocket")]
3157 pub fast_socket: Option<FastSocket>,
3158 /// Flex Start flag for enabling Flex Start VM.
3159 #[serde(rename = "flexStart")]
3160 pub flex_start: Option<bool>,
3161 /// Google Container File System (image streaming) configs.
3162 #[serde(rename = "gcfsConfig")]
3163 pub gcfs_config: Option<GcfsConfig>,
3164 /// Enable or disable gvnic in the node pool.
3165 pub gvnic: Option<VirtualNIC>,
3166 /// 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.
3167 #[serde(rename = "imageType")]
3168 pub image_type: Option<String>,
3169 /// Node kubelet configs.
3170 #[serde(rename = "kubeletConfig")]
3171 pub kubelet_config: Option<NodeKubeletConfig>,
3172 /// 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/
3173 pub labels: Option<HashMap<String, String>>,
3174 /// Parameters that can be configured on Linux nodes.
3175 #[serde(rename = "linuxNodeConfig")]
3176 pub linux_node_config: Option<LinuxNodeConfig>,
3177 /// Parameters for using raw-block Local NVMe SSDs.
3178 #[serde(rename = "localNvmeSsdBlockConfig")]
3179 pub local_nvme_ssd_block_config: Option<LocalNvmeSsdBlockConfig>,
3180 /// 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.
3181 #[serde(rename = "localSsdCount")]
3182 pub local_ssd_count: Option<i32>,
3183 /// Specifies which method should be used for encrypting the Local SSDs attached to the node.
3184 #[serde(rename = "localSsdEncryptionMode")]
3185 pub local_ssd_encryption_mode: Option<String>,
3186 /// Logging configuration.
3187 #[serde(rename = "loggingConfig")]
3188 pub logging_config: Option<NodePoolLoggingConfig>,
3189 /// 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`.
3190 #[serde(rename = "machineType")]
3191 pub machine_type: Option<String>,
3192 /// The maximum duration for the nodes to exist. If unspecified, the nodes can exist indefinitely.
3193 #[serde(rename = "maxRunDuration")]
3194 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
3195 pub max_run_duration: Option<chrono::Duration>,
3196 /// 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.
3197 pub metadata: Option<HashMap<String, String>>,
3198 /// 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)
3199 #[serde(rename = "minCpuPlatform")]
3200 pub min_cpu_platform: Option<String>,
3201 /// 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).
3202 #[serde(rename = "nodeGroup")]
3203 pub node_group: Option<String>,
3204 /// 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 [Artifact Registry](https://cloud.google.com/artifact-registry/)). If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are enabled, in which case their required scopes will be added.
3205 #[serde(rename = "oauthScopes")]
3206 pub oauth_scopes: Option<Vec<String>>,
3207 /// 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.
3208 pub preemptible: Option<bool>,
3209 /// 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.
3210 #[serde(rename = "reservationAffinity")]
3211 pub reservation_affinity: Option<ReservationAffinity>,
3212 /// The resource labels for the node pool to use to annotate any related Google Compute Engine resources.
3213 #[serde(rename = "resourceLabels")]
3214 pub resource_labels: Option<HashMap<String, String>>,
3215 /// A map of resource manager tag keys and values to be attached to the nodes.
3216 #[serde(rename = "resourceManagerTags")]
3217 pub resource_manager_tags: Option<ResourceManagerTags>,
3218 /// Sandbox configuration for this node.
3219 #[serde(rename = "sandboxConfig")]
3220 pub sandbox_config: Option<SandboxConfig>,
3221 /// Secondary boot disk update strategy.
3222 #[serde(rename = "secondaryBootDiskUpdateStrategy")]
3223 pub secondary_boot_disk_update_strategy: Option<SecondaryBootDiskUpdateStrategy>,
3224 /// List of secondary boot disks attached to the nodes.
3225 #[serde(rename = "secondaryBootDisks")]
3226 pub secondary_boot_disks: Option<Vec<SecondaryBootDisk>>,
3227 /// 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.
3228 #[serde(rename = "serviceAccount")]
3229 pub service_account: Option<String>,
3230 /// Shielded Instance options.
3231 #[serde(rename = "shieldedInstanceConfig")]
3232 pub shielded_instance_config: Option<ShieldedInstanceConfig>,
3233 /// Parameters for node pools to be backed by shared sole tenant node groups.
3234 #[serde(rename = "soleTenantConfig")]
3235 pub sole_tenant_config: Option<SoleTenantConfig>,
3236 /// Spot flag for enabling Spot VM, which is a rebrand of the existing preemptible flag.
3237 pub spot: Option<bool>,
3238 /// List of Storage Pools where boot disks are provisioned.
3239 #[serde(rename = "storagePools")]
3240 pub storage_pools: Option<Vec<String>>,
3241 /// 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.
3242 pub tags: Option<Vec<String>>,
3243 /// 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/
3244 pub taints: Option<Vec<NodeTaint>>,
3245 /// Parameters that can be configured on Windows nodes.
3246 #[serde(rename = "windowsNodeConfig")]
3247 pub windows_node_config: Option<WindowsNodeConfig>,
3248 /// The workload metadata configuration for this node.
3249 #[serde(rename = "workloadMetadataConfig")]
3250 pub workload_metadata_config: Option<WorkloadMetadataConfig>,
3251}
3252
3253impl common::Part for NodeConfig {}
3254
3255/// Subset of NodeConfig message that has defaults.
3256///
3257/// This type is not used in any activity, and only used as *part* of another schema.
3258///
3259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3260#[serde_with::serde_as]
3261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3262pub struct NodeConfigDefaults {
3263 /// Parameters for containerd customization.
3264 #[serde(rename = "containerdConfig")]
3265 pub containerd_config: Option<ContainerdConfig>,
3266 /// GCFS (Google Container File System, also known as Riptide) options.
3267 #[serde(rename = "gcfsConfig")]
3268 pub gcfs_config: Option<GcfsConfig>,
3269 /// Logging configuration for node pools.
3270 #[serde(rename = "loggingConfig")]
3271 pub logging_config: Option<NodePoolLoggingConfig>,
3272 /// NodeKubeletConfig controls the defaults for new node-pools. Currently only `insecure_kubelet_readonly_port_enabled` can be set here.
3273 #[serde(rename = "nodeKubeletConfig")]
3274 pub node_kubelet_config: Option<NodeKubeletConfig>,
3275}
3276
3277impl common::Part for NodeConfigDefaults {}
3278
3279/// NodeDrainConfig contains the node drain related configurations for this nodepool.
3280///
3281/// This type is not used in any activity, and only used as *part* of another schema.
3282///
3283#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3284#[serde_with::serde_as]
3285#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3286pub struct NodeDrainConfig {
3287 /// Whether to respect PDB during node pool deletion.
3288 #[serde(rename = "respectPdbDuringNodePoolDeletion")]
3289 pub respect_pdb_during_node_pool_deletion: Option<bool>,
3290}
3291
3292impl common::Part for NodeDrainConfig {}
3293
3294/// Configuration for kernel module loading on nodes.
3295///
3296/// This type is not used in any activity, and only used as *part* of another schema.
3297///
3298#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3299#[serde_with::serde_as]
3300#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3301pub struct NodeKernelModuleLoading {
3302 /// Set the node module loading policy for nodes in the node pool.
3303 pub policy: Option<String>,
3304}
3305
3306impl common::Part for NodeKernelModuleLoading {}
3307
3308/// Node kubelet configs.
3309///
3310/// This type is not used in any activity, and only used as *part* of another schema.
3311///
3312#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3313#[serde_with::serde_as]
3314#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3315pub struct NodeKubeletConfig {
3316 /// Optional. Defines a comma-separated allowlist of unsafe sysctls or sysctl patterns (ending in `*`). The unsafe namespaced sysctl groups are `kernel.shm*`, `kernel.msg*`, `kernel.sem`, `fs.mqueue.*`, and `net.*`. Leaving this allowlist empty means they cannot be set on Pods. To allow certain sysctls or sysctl patterns to be set on Pods, list them separated by commas. For example: `kernel.msg*,net.ipv4.route.min_pmtu`. See https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/ for more details.
3317 #[serde(rename = "allowedUnsafeSysctls")]
3318 pub allowed_unsafe_sysctls: Option<Vec<String>>,
3319 /// Optional. Defines the maximum number of container log files that can be present for a container. See https://kubernetes.io/docs/concepts/cluster-administration/logging/#log-rotation The value must be an integer between 2 and 10, inclusive. The default value is 5 if unspecified.
3320 #[serde(rename = "containerLogMaxFiles")]
3321 pub container_log_max_files: Option<i32>,
3322 /// Optional. Defines the maximum size of the container log file before it is rotated. See https://kubernetes.io/docs/concepts/cluster-administration/logging/#log-rotation Valid format is positive number + unit, e.g. 100Ki, 10Mi. Valid units are Ki, Mi, Gi. The value must be between 10Mi and 500Mi, inclusive. Note that the total container log size (container_log_max_size * container_log_max_files) cannot exceed 1% of the total storage of the node, to avoid disk pressure caused by log files. The default value is 10Mi if unspecified.
3323 #[serde(rename = "containerLogMaxSize")]
3324 pub container_log_max_size: Option<String>,
3325 /// 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.
3326 #[serde(rename = "cpuCfsQuota")]
3327 pub cpu_cfs_quota: Option<bool>,
3328 /// 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 between 1ms and 1 second, inclusive.
3329 #[serde(rename = "cpuCfsQuotaPeriod")]
3330 pub cpu_cfs_quota_period: Option<String>,
3331 /// 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.
3332 #[serde(rename = "cpuManagerPolicy")]
3333 pub cpu_manager_policy: Option<String>,
3334 /// Optional. eviction_max_pod_grace_period_seconds is the maximum allowed grace period (in seconds) to use when terminating pods in response to a soft eviction threshold being met. This value effectively caps the Pod's terminationGracePeriodSeconds value during soft evictions. Default: 0. Range: [0, 300].
3335 #[serde(rename = "evictionMaxPodGracePeriodSeconds")]
3336 pub eviction_max_pod_grace_period_seconds: Option<i32>,
3337 /// Optional. eviction_minimum_reclaim is a map of signal names to quantities that defines minimum reclaims, which describe the minimum amount of a given resource the kubelet will reclaim when performing a pod eviction while that resource is under pressure.
3338 #[serde(rename = "evictionMinimumReclaim")]
3339 pub eviction_minimum_reclaim: Option<EvictionMinimumReclaim>,
3340 /// Optional. eviction_soft is a map of signal names to quantities that defines soft eviction thresholds. Each signal is compared to its corresponding threshold to determine if a pod eviction should occur.
3341 #[serde(rename = "evictionSoft")]
3342 pub eviction_soft: Option<EvictionSignals>,
3343 /// Optional. eviction_soft_grace_period is a map of signal names to quantities that defines grace periods for each soft eviction signal. The grace period is the amount of time that a pod must be under pressure before an eviction occurs.
3344 #[serde(rename = "evictionSoftGracePeriod")]
3345 pub eviction_soft_grace_period: Option<EvictionGracePeriod>,
3346 /// Optional. Defines the percent of disk usage after which image garbage collection is always run. The percent is calculated as this field value out of 100. The value must be between 10 and 85, inclusive and greater than image_gc_low_threshold_percent. The default value is 85 if unspecified.
3347 #[serde(rename = "imageGcHighThresholdPercent")]
3348 pub image_gc_high_threshold_percent: Option<i32>,
3349 /// Optional. Defines the percent of disk usage before which image garbage collection is never run. Lowest disk usage to garbage collect to. The percent is calculated as this field value out of 100. The value must be between 10 and 85, inclusive and smaller than image_gc_high_threshold_percent. The default value is 80 if unspecified.
3350 #[serde(rename = "imageGcLowThresholdPercent")]
3351 pub image_gc_low_threshold_percent: Option<i32>,
3352 /// Optional. Defines the maximum age an image can be unused before it is garbage collected. The string must be a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300s", "1.5h", and "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The value must be a positive duration greater than image_minimum_gc_age or "0s". The default value is "0s" if unspecified, which disables this field, meaning images won't be garbage collected based on being unused for too long.
3353 #[serde(rename = "imageMaximumGcAge")]
3354 pub image_maximum_gc_age: Option<String>,
3355 /// Optional. Defines the minimum age for an unused image before it is garbage collected. The string must be a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300s", "1.5h", and "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The value must be a positive duration less than or equal to 2 minutes. The default value is "2m0s" if unspecified.
3356 #[serde(rename = "imageMinimumGcAge")]
3357 pub image_minimum_gc_age: Option<String>,
3358 /// Enable or disable Kubelet read only port.
3359 #[serde(rename = "insecureKubeletReadonlyPortEnabled")]
3360 pub insecure_kubelet_readonly_port_enabled: Option<bool>,
3361 /// Optional. Defines the maximum number of image pulls in parallel. The range is 2 to 5, inclusive. The default value is 2 or 3 depending on the disk type. See https://kubernetes.io/docs/concepts/containers/images/#maximum-parallel-image-pulls for more details.
3362 #[serde(rename = "maxParallelImagePulls")]
3363 pub max_parallel_image_pulls: Option<i32>,
3364 /// Optional. Controls NUMA-aware Memory Manager configuration on the node. For more information, see: https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/
3365 #[serde(rename = "memoryManager")]
3366 pub memory_manager: Option<MemoryManager>,
3367 /// 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.
3368 #[serde(rename = "podPidsLimit")]
3369 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
3370 pub pod_pids_limit: Option<i64>,
3371 /// Optional. Defines whether to enable single process OOM killer. If true, will prevent the memory.oom.group flag from being set for container cgroups in cgroups v2. This causes processes in the container to be OOM killed individually instead of as a group.
3372 #[serde(rename = "singleProcessOomKill")]
3373 pub single_process_oom_kill: Option<bool>,
3374 /// Optional. Controls Topology Manager configuration on the node. For more information, see: https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/
3375 #[serde(rename = "topologyManager")]
3376 pub topology_manager: Option<TopologyManager>,
3377}
3378
3379impl common::Part for NodeKubeletConfig {}
3380
3381/// Collection of node-level [Kubernetes labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels).
3382///
3383/// This type is not used in any activity, and only used as *part* of another schema.
3384///
3385#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3386#[serde_with::serde_as]
3387#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3388pub struct NodeLabels {
3389 /// Map of node label keys and node label values.
3390 pub labels: Option<HashMap<String, String>>,
3391}
3392
3393impl common::Part for NodeLabels {}
3394
3395/// NodeManagement defines the set of node management services turned on for the node pool.
3396///
3397/// This type is not used in any activity, and only used as *part* of another schema.
3398///
3399#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3400#[serde_with::serde_as]
3401#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3402pub struct NodeManagement {
3403 /// 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.
3404 #[serde(rename = "autoRepair")]
3405 pub auto_repair: Option<bool>,
3406 /// 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.
3407 #[serde(rename = "autoUpgrade")]
3408 pub auto_upgrade: Option<bool>,
3409 /// Specifies the Auto Upgrade knobs for the node pool.
3410 #[serde(rename = "upgradeOptions")]
3411 pub upgrade_options: Option<AutoUpgradeOptions>,
3412}
3413
3414impl common::Part for NodeManagement {}
3415
3416/// Parameters for node pool-level network config.
3417///
3418/// This type is not used in any activity, and only used as *part* of another schema.
3419///
3420#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3421#[serde_with::serde_as]
3422#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3423pub struct NodeNetworkConfig {
3424 /// We specify the additional node networks for this node pool using this list. Each node network corresponds to an additional interface
3425 #[serde(rename = "additionalNodeNetworkConfigs")]
3426 pub additional_node_network_configs: Option<Vec<AdditionalNodeNetworkConfig>>,
3427 /// 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
3428 #[serde(rename = "additionalPodNetworkConfigs")]
3429 pub additional_pod_network_configs: Option<Vec<AdditionalPodNetworkConfig>>,
3430 /// 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.
3431 #[serde(rename = "createPodRange")]
3432 pub create_pod_range: Option<bool>,
3433 /// Whether nodes have internal IP addresses only. If enable_private_nodes is not specified, then the value is derived from Cluster.NetworkConfig.default_enable_private_nodes
3434 #[serde(rename = "enablePrivateNodes")]
3435 pub enable_private_nodes: Option<bool>,
3436 /// Network bandwidth tier configuration.
3437 #[serde(rename = "networkPerformanceConfig")]
3438 pub network_performance_config: Option<NetworkPerformanceConfig>,
3439 /// Output only. The network tier configuration for the node pool inherits from the cluster-level configuration and remains immutable throughout the node pool's lifecycle, including during upgrades.
3440 #[serde(rename = "networkTierConfig")]
3441 pub network_tier_config: Option<NetworkTierConfig>,
3442 /// [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.
3443 #[serde(rename = "podCidrOverprovisionConfig")]
3444 pub pod_cidr_overprovision_config: Option<PodCIDROverprovisionConfig>,
3445 /// 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.
3446 #[serde(rename = "podIpv4CidrBlock")]
3447 pub pod_ipv4_cidr_block: Option<String>,
3448 /// 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.
3449 #[serde(rename = "podIpv4RangeUtilization")]
3450 pub pod_ipv4_range_utilization: Option<f64>,
3451 /// 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.
3452 #[serde(rename = "podRange")]
3453 pub pod_range: Option<String>,
3454 /// The subnetwork path for the node pool. Format: projects/{project}/regions/{region}/subnetworks/{subnetwork} If the cluster is associated with multiple subnetworks, the subnetwork for the node pool is picked based on the IP utilization during node pool creation and is immutable.
3455 pub subnetwork: Option<String>,
3456}
3457
3458impl common::Part for NodeNetworkConfig {}
3459
3460/// 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.
3461///
3462/// # Activities
3463///
3464/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3465/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3466///
3467/// * [locations clusters node pools get projects](ProjectLocationClusterNodePoolGetCall) (response)
3468/// * [zones clusters node pools get projects](ProjectZoneClusterNodePoolGetCall) (response)
3469#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3470#[serde_with::serde_as]
3471#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3472pub struct NodePool {
3473 /// Specifies the autopilot configuration for this node pool. This field is exclusively reserved for Cluster Autoscaler.
3474 #[serde(rename = "autopilotConfig")]
3475 pub autopilot_config: Option<AutopilotConfig>,
3476 /// Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid configuration is present.
3477 pub autoscaling: Option<NodePoolAutoscaling>,
3478 /// Enable best effort provisioning for nodes
3479 #[serde(rename = "bestEffortProvisioning")]
3480 pub best_effort_provisioning: Option<BestEffortProvisioning>,
3481 /// Which conditions caused the current node pool state.
3482 pub conditions: Option<Vec<StatusCondition>>,
3483 /// The node configuration of the pool.
3484 pub config: Option<NodeConfig>,
3485 /// 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.
3486 pub etag: Option<String>,
3487 /// 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.
3488 #[serde(rename = "initialNodeCount")]
3489 pub initial_node_count: Option<i32>,
3490 /// 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.
3491 #[serde(rename = "instanceGroupUrls")]
3492 pub instance_group_urls: Option<Vec<String>>,
3493 /// 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.
3494 pub locations: Option<Vec<String>>,
3495 /// NodeManagement configuration for this NodePool.
3496 pub management: Option<NodeManagement>,
3497 /// The constraint on the maximum number of pods that can be run simultaneously on a node in the node pool.
3498 #[serde(rename = "maxPodsConstraint")]
3499 pub max_pods_constraint: Option<MaxPodsConstraint>,
3500 /// The name of the node pool.
3501 pub name: Option<String>,
3502 /// Networking configuration for this NodePool. If specified, it overrides the cluster-level defaults.
3503 #[serde(rename = "networkConfig")]
3504 pub network_config: Option<NodeNetworkConfig>,
3505 /// Specifies the node drain configuration for this node pool.
3506 #[serde(rename = "nodeDrainConfig")]
3507 pub node_drain_config: Option<NodeDrainConfig>,
3508 /// Specifies the node placement policy.
3509 #[serde(rename = "placementPolicy")]
3510 pub placement_policy: Option<PlacementPolicy>,
3511 /// Output only. The pod CIDR block size per node in this node pool.
3512 #[serde(rename = "podIpv4CidrSize")]
3513 pub pod_ipv4_cidr_size: Option<i32>,
3514 /// Specifies the configuration of queued provisioning.
3515 #[serde(rename = "queuedProvisioning")]
3516 pub queued_provisioning: Option<QueuedProvisioning>,
3517 /// Output only. Server-defined URL for the resource.
3518 #[serde(rename = "selfLink")]
3519 pub self_link: Option<String>,
3520 /// Output only. The status of the nodes in this pool instance.
3521 pub status: Option<String>,
3522 /// Output only. Deprecated. Use conditions instead. Additional information about the current status of this node pool instance, if available.
3523 #[serde(rename = "statusMessage")]
3524 pub status_message: Option<String>,
3525 /// Output only. Update info contains relevant information during a node pool update.
3526 #[serde(rename = "updateInfo")]
3527 pub update_info: Option<UpdateInfo>,
3528 /// Upgrade settings control disruption and speed of the upgrade.
3529 #[serde(rename = "upgradeSettings")]
3530 pub upgrade_settings: Option<UpgradeSettings>,
3531 /// 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).
3532 pub version: Option<String>,
3533}
3534
3535impl common::ResponseResult for NodePool {}
3536
3537/// Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
3538///
3539/// This type is not used in any activity, and only used as *part* of another schema.
3540///
3541#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3542#[serde_with::serde_as]
3543#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3544pub struct NodePoolAutoConfig {
3545 /// Output only. Configuration options for Linux nodes.
3546 #[serde(rename = "linuxNodeConfig")]
3547 pub linux_node_config: Option<LinuxNodeConfig>,
3548 /// 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.
3549 #[serde(rename = "networkTags")]
3550 pub network_tags: Option<NetworkTags>,
3551 /// NodeKubeletConfig controls the defaults for autoprovisioned node-pools. Currently only `insecure_kubelet_readonly_port_enabled` can be set here.
3552 #[serde(rename = "nodeKubeletConfig")]
3553 pub node_kubelet_config: Option<NodeKubeletConfig>,
3554 /// Resource manager tag keys and values to be attached to the nodes for managing Compute Engine firewalls using Network Firewall Policies.
3555 #[serde(rename = "resourceManagerTags")]
3556 pub resource_manager_tags: Option<ResourceManagerTags>,
3557}
3558
3559impl common::Part for NodePoolAutoConfig {}
3560
3561/// NodePoolAutoscaling contains information required by cluster autoscaler to adjust the size of the node pool to the current cluster usage.
3562///
3563/// This type is not used in any activity, and only used as *part* of another schema.
3564///
3565#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3566#[serde_with::serde_as]
3567#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3568pub struct NodePoolAutoscaling {
3569 /// Can this node pool be deleted automatically.
3570 pub autoprovisioned: Option<bool>,
3571 /// Is autoscaling enabled for this node pool.
3572 pub enabled: Option<bool>,
3573 /// Location policy used when scaling up a nodepool.
3574 #[serde(rename = "locationPolicy")]
3575 pub location_policy: Option<String>,
3576 /// Maximum number of nodes for one location in the node pool. Must be >= min_node_count. There has to be enough quota to scale up the cluster.
3577 #[serde(rename = "maxNodeCount")]
3578 pub max_node_count: Option<i32>,
3579 /// Minimum number of nodes for one location in the node pool. Must be greater than or equal to 0 and less than or equal to max_node_count.
3580 #[serde(rename = "minNodeCount")]
3581 pub min_node_count: Option<i32>,
3582 /// Maximum number of nodes in the node pool. Must be greater than or equal to 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.
3583 #[serde(rename = "totalMaxNodeCount")]
3584 pub total_max_node_count: Option<i32>,
3585 /// Minimum number of nodes in the node pool. Must be greater than or equal to 0 and less than or equal to total_max_node_count. The total_*_node_count fields are mutually exclusive with the *_node_count fields.
3586 #[serde(rename = "totalMinNodeCount")]
3587 pub total_min_node_count: Option<i32>,
3588}
3589
3590impl common::Part for NodePoolAutoscaling {}
3591
3592/// Subset of Nodepool message that has defaults.
3593///
3594/// This type is not used in any activity, and only used as *part* of another schema.
3595///
3596#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3597#[serde_with::serde_as]
3598#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3599pub struct NodePoolDefaults {
3600 /// Subset of NodeConfig message that has defaults.
3601 #[serde(rename = "nodeConfigDefaults")]
3602 pub node_config_defaults: Option<NodeConfigDefaults>,
3603}
3604
3605impl common::Part for NodePoolDefaults {}
3606
3607/// NodePoolLoggingConfig specifies logging configuration for nodepools.
3608///
3609/// This type is not used in any activity, and only used as *part* of another schema.
3610///
3611#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3612#[serde_with::serde_as]
3613#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3614pub struct NodePoolLoggingConfig {
3615 /// Logging variant configuration.
3616 #[serde(rename = "variantConfig")]
3617 pub variant_config: Option<LoggingVariantConfig>,
3618}
3619
3620impl common::Part for NodePoolLoggingConfig {}
3621
3622/// NodePoolUpgradeInfo contains the upgrade information of a nodepool.
3623///
3624/// # Activities
3625///
3626/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3627/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3628///
3629/// * [locations clusters node pools fetch node pool upgrade info projects](ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall) (response)
3630/// * [zones clusters node pools fetch node pool upgrade info projects](ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall) (response)
3631#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3632#[serde_with::serde_as]
3633#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3634pub struct NodePoolUpgradeInfo {
3635 /// The auto upgrade status.
3636 #[serde(rename = "autoUpgradeStatus")]
3637 pub auto_upgrade_status: Option<Vec<String>>,
3638 /// The nodepool's current minor version's end of extended support timestamp.
3639 #[serde(rename = "endOfExtendedSupportTimestamp")]
3640 pub end_of_extended_support_timestamp: Option<String>,
3641 /// The nodepool's current minor version's end of standard support timestamp.
3642 #[serde(rename = "endOfStandardSupportTimestamp")]
3643 pub end_of_standard_support_timestamp: Option<String>,
3644 /// minor_target_version indicates the target version for minor upgrade.
3645 #[serde(rename = "minorTargetVersion")]
3646 pub minor_target_version: Option<String>,
3647 /// patch_target_version indicates the target version for patch upgrade.
3648 #[serde(rename = "patchTargetVersion")]
3649 pub patch_target_version: Option<String>,
3650 /// The auto upgrade paused reason.
3651 #[serde(rename = "pausedReason")]
3652 pub paused_reason: Option<Vec<String>>,
3653 /// The list of past auto upgrades.
3654 #[serde(rename = "upgradeDetails")]
3655 pub upgrade_details: Option<Vec<UpgradeDetails>>,
3656}
3657
3658impl common::ResponseResult for NodePoolUpgradeInfo {}
3659
3660/// 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.
3661///
3662/// This type is not used in any activity, and only used as *part* of another schema.
3663///
3664#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3665#[serde_with::serde_as]
3666#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3667pub struct NodeTaint {
3668 /// Effect for taint.
3669 pub effect: Option<String>,
3670 /// Key for taint.
3671 pub key: Option<String>,
3672 /// Value for taint.
3673 pub value: Option<String>,
3674}
3675
3676impl common::Part for NodeTaint {}
3677
3678/// Collection of Kubernetes [node taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration).
3679///
3680/// This type is not used in any activity, and only used as *part* of another schema.
3681///
3682#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3683#[serde_with::serde_as]
3684#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3685pub struct NodeTaints {
3686 /// List of node taints.
3687 pub taints: Option<Vec<NodeTaint>>,
3688}
3689
3690impl common::Part for NodeTaints {}
3691
3692/// NotificationConfig is the configuration of notifications.
3693///
3694/// This type is not used in any activity, and only used as *part* of another schema.
3695///
3696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3697#[serde_with::serde_as]
3698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3699pub struct NotificationConfig {
3700 /// Notification config for Pub/Sub.
3701 pub pubsub: Option<PubSub>,
3702}
3703
3704impl common::Part for NotificationConfig {}
3705
3706/// This operation resource represents operations that may have happened or are happening on the cluster. All fields are output only.
3707///
3708/// # Activities
3709///
3710/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
3711/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
3712///
3713/// * [locations clusters node pools create projects](ProjectLocationClusterNodePoolCreateCall) (response)
3714/// * [locations clusters node pools delete projects](ProjectLocationClusterNodePoolDeleteCall) (response)
3715/// * [locations clusters node pools rollback projects](ProjectLocationClusterNodePoolRollbackCall) (response)
3716/// * [locations clusters node pools set autoscaling projects](ProjectLocationClusterNodePoolSetAutoscalingCall) (response)
3717/// * [locations clusters node pools set management projects](ProjectLocationClusterNodePoolSetManagementCall) (response)
3718/// * [locations clusters node pools set size projects](ProjectLocationClusterNodePoolSetSizeCall) (response)
3719/// * [locations clusters node pools update projects](ProjectLocationClusterNodePoolUpdateCall) (response)
3720/// * [locations clusters complete ip rotation projects](ProjectLocationClusterCompleteIpRotationCall) (response)
3721/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (response)
3722/// * [locations clusters delete projects](ProjectLocationClusterDeleteCall) (response)
3723/// * [locations clusters set addons projects](ProjectLocationClusterSetAddonCall) (response)
3724/// * [locations clusters set legacy abac projects](ProjectLocationClusterSetLegacyAbacCall) (response)
3725/// * [locations clusters set locations projects](ProjectLocationClusterSetLocationCall) (response)
3726/// * [locations clusters set logging projects](ProjectLocationClusterSetLoggingCall) (response)
3727/// * [locations clusters set maintenance policy projects](ProjectLocationClusterSetMaintenancePolicyCall) (response)
3728/// * [locations clusters set master auth projects](ProjectLocationClusterSetMasterAuthCall) (response)
3729/// * [locations clusters set monitoring projects](ProjectLocationClusterSetMonitoringCall) (response)
3730/// * [locations clusters set network policy projects](ProjectLocationClusterSetNetworkPolicyCall) (response)
3731/// * [locations clusters set resource labels projects](ProjectLocationClusterSetResourceLabelCall) (response)
3732/// * [locations clusters start ip rotation projects](ProjectLocationClusterStartIpRotationCall) (response)
3733/// * [locations clusters update projects](ProjectLocationClusterUpdateCall) (response)
3734/// * [locations clusters update master projects](ProjectLocationClusterUpdateMasterCall) (response)
3735/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
3736/// * [zones clusters node pools autoscaling projects](ProjectZoneClusterNodePoolAutoscalingCall) (response)
3737/// * [zones clusters node pools create projects](ProjectZoneClusterNodePoolCreateCall) (response)
3738/// * [zones clusters node pools delete projects](ProjectZoneClusterNodePoolDeleteCall) (response)
3739/// * [zones clusters node pools rollback projects](ProjectZoneClusterNodePoolRollbackCall) (response)
3740/// * [zones clusters node pools set management projects](ProjectZoneClusterNodePoolSetManagementCall) (response)
3741/// * [zones clusters node pools set size projects](ProjectZoneClusterNodePoolSetSizeCall) (response)
3742/// * [zones clusters node pools update projects](ProjectZoneClusterNodePoolUpdateCall) (response)
3743/// * [zones clusters addons projects](ProjectZoneClusterAddonCall) (response)
3744/// * [zones clusters complete ip rotation projects](ProjectZoneClusterCompleteIpRotationCall) (response)
3745/// * [zones clusters create projects](ProjectZoneClusterCreateCall) (response)
3746/// * [zones clusters delete projects](ProjectZoneClusterDeleteCall) (response)
3747/// * [zones clusters legacy abac projects](ProjectZoneClusterLegacyAbacCall) (response)
3748/// * [zones clusters locations projects](ProjectZoneClusterLocationCall) (response)
3749/// * [zones clusters logging projects](ProjectZoneClusterLoggingCall) (response)
3750/// * [zones clusters master projects](ProjectZoneClusterMasterCall) (response)
3751/// * [zones clusters monitoring projects](ProjectZoneClusterMonitoringCall) (response)
3752/// * [zones clusters resource labels projects](ProjectZoneClusterResourceLabelCall) (response)
3753/// * [zones clusters set maintenance policy projects](ProjectZoneClusterSetMaintenancePolicyCall) (response)
3754/// * [zones clusters set master auth projects](ProjectZoneClusterSetMasterAuthCall) (response)
3755/// * [zones clusters set network policy projects](ProjectZoneClusterSetNetworkPolicyCall) (response)
3756/// * [zones clusters start ip rotation projects](ProjectZoneClusterStartIpRotationCall) (response)
3757/// * [zones clusters update projects](ProjectZoneClusterUpdateCall) (response)
3758/// * [zones operations get projects](ProjectZoneOperationGetCall) (response)
3759#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3760#[serde_with::serde_as]
3761#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3762pub struct Operation {
3763 /// Which conditions caused the current cluster state. Deprecated. Use field error instead.
3764 #[serde(rename = "clusterConditions")]
3765 pub cluster_conditions: Option<Vec<StatusCondition>>,
3766 /// Output only. Detailed operation progress, if available.
3767 pub detail: Option<String>,
3768 /// Output only. The time the operation completed, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
3769 #[serde(rename = "endTime")]
3770 pub end_time: Option<String>,
3771 /// The error result of the operation in case of failure.
3772 pub error: Option<Status>,
3773 /// 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.
3774 pub location: Option<String>,
3775 /// Output only. The server-assigned ID for the operation.
3776 pub name: Option<String>,
3777 /// Which conditions caused the current node pool state. Deprecated. Use field error instead.
3778 #[serde(rename = "nodepoolConditions")]
3779 pub nodepool_conditions: Option<Vec<StatusCondition>>,
3780 /// Output only. The operation type.
3781 #[serde(rename = "operationType")]
3782 pub operation_type: Option<String>,
3783 /// Output only. Progress information for an operation.
3784 pub progress: Option<OperationProgress>,
3785 /// Output only. Server-defined URI for the operation. Example: `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`.
3786 #[serde(rename = "selfLink")]
3787 pub self_link: Option<String>,
3788 /// Output only. The time the operation started, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
3789 #[serde(rename = "startTime")]
3790 pub start_time: Option<String>,
3791 /// Output only. The current status of the operation.
3792 pub status: Option<String>,
3793 /// Output only. If an error has occurred, a textual description of the error. Deprecated. Use the field error instead.
3794 #[serde(rename = "statusMessage")]
3795 pub status_message: Option<String>,
3796 /// Output only. 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`
3797 #[serde(rename = "targetLink")]
3798 pub target_link: Option<String>,
3799 /// Output only. 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.
3800 pub zone: Option<String>,
3801}
3802
3803impl common::ResponseResult for Operation {}
3804
3805/// OperationError records errors seen from CloudKMS keys encountered during updates to DatabaseEncryption configuration.
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 OperationError {
3813 /// Description of the error seen during the operation.
3814 #[serde(rename = "errorMessage")]
3815 pub error_message: Option<String>,
3816 /// CloudKMS key resource that had the error.
3817 #[serde(rename = "keyName")]
3818 pub key_name: Option<String>,
3819 /// Time when the CloudKMS error was seen.
3820 pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
3821}
3822
3823impl common::Part for OperationError {}
3824
3825/// Information about operation (or operation stage) progress.
3826///
3827/// This type is not used in any activity, and only used as *part* of another schema.
3828///
3829#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3830#[serde_with::serde_as]
3831#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3832pub struct OperationProgress {
3833 /// 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}]
3834 pub metrics: Option<Vec<Metric>>,
3835 /// A non-parameterized string describing an operation stage. Unset for single-stage operations.
3836 pub name: Option<String>,
3837 /// Substages of an operation or a stage.
3838 pub stages: Option<Vec<OperationProgress>>,
3839 /// Status of an operation stage. Unset for single-stage operations.
3840 pub status: Option<String>,
3841}
3842
3843impl common::Part for OperationProgress {}
3844
3845/// Configuration for the Cloud Storage Parallelstore CSI driver.
3846///
3847/// This type is not used in any activity, and only used as *part* of another schema.
3848///
3849#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3850#[serde_with::serde_as]
3851#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3852pub struct ParallelstoreCsiDriverConfig {
3853 /// Whether the Cloud Storage Parallelstore CSI driver is enabled for this cluster.
3854 pub enabled: Option<bool>,
3855}
3856
3857impl common::Part for ParallelstoreCsiDriverConfig {}
3858
3859/// 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.
3860///
3861/// This type is not used in any activity, and only used as *part* of another schema.
3862///
3863#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3864#[serde_with::serde_as]
3865#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3866pub struct ParentProductConfig {
3867 /// Labels contain the configuration of the parent product.
3868 pub labels: Option<HashMap<String, String>>,
3869 /// Name of the parent product associated with the cluster.
3870 #[serde(rename = "productName")]
3871 pub product_name: Option<String>,
3872}
3873
3874impl common::Part for ParentProductConfig {}
3875
3876/// PlacementPolicy defines the placement policy used by the node pool.
3877///
3878/// This type is not used in any activity, and only used as *part* of another schema.
3879///
3880#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3881#[serde_with::serde_as]
3882#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3883pub struct PlacementPolicy {
3884 /// 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.
3885 #[serde(rename = "policyName")]
3886 pub policy_name: Option<String>,
3887 /// Optional. TPU placement topology for pod slice node pool. https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies
3888 #[serde(rename = "tpuTopology")]
3889 pub tpu_topology: Option<String>,
3890 /// The type of placement.
3891 #[serde(rename = "type")]
3892 pub type_: Option<String>,
3893}
3894
3895impl common::Part for PlacementPolicy {}
3896
3897/// PodAutoscaling is used for configuration of parameters for workload autoscaling.
3898///
3899/// This type is not used in any activity, and only used as *part* of another schema.
3900///
3901#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3902#[serde_with::serde_as]
3903#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3904pub struct PodAutoscaling {
3905 /// Selected Horizontal Pod Autoscaling profile.
3906 #[serde(rename = "hpaProfile")]
3907 pub hpa_profile: Option<String>,
3908}
3909
3910impl common::Part for PodAutoscaling {}
3911
3912/// [PRIVATE FIELD] Config for pod CIDR size overprovisioning.
3913///
3914/// This type is not used in any activity, and only used as *part* of another schema.
3915///
3916#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3917#[serde_with::serde_as]
3918#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3919pub struct PodCIDROverprovisionConfig {
3920 /// Whether Pod CIDR overprovisioning is disabled. Note: Pod CIDR overprovisioning is enabled by default.
3921 pub disable: Option<bool>,
3922}
3923
3924impl common::Part for PodCIDROverprovisionConfig {}
3925
3926/// Configuration options for private clusters.
3927///
3928/// This type is not used in any activity, and only used as *part* of another schema.
3929///
3930#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3931#[serde_with::serde_as]
3932#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3933pub struct PrivateClusterConfig {
3934 /// Whether the master's internal IP address is used as the cluster endpoint. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_public_endpoint instead. Note that the value of enable_public_endpoint is reversed: if enable_private_endpoint is false, then enable_public_endpoint will be true.
3935 #[serde(rename = "enablePrivateEndpoint")]
3936 pub enable_private_endpoint: Option<bool>,
3937 /// 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. Deprecated: Use NetworkConfig.default_enable_private_nodes instead.
3938 #[serde(rename = "enablePrivateNodes")]
3939 pub enable_private_nodes: Option<bool>,
3940 /// Controls master global access settings. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_global_access instead.
3941 #[serde(rename = "masterGlobalAccessConfig")]
3942 pub master_global_access_config: Option<PrivateClusterMasterGlobalAccessConfig>,
3943 /// 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.
3944 #[serde(rename = "masterIpv4CidrBlock")]
3945 pub master_ipv4_cidr_block: Option<String>,
3946 /// Output only. The peering name in the customer VPC used by this cluster.
3947 #[serde(rename = "peeringName")]
3948 pub peering_name: Option<String>,
3949 /// Output only. The internal IP address of this cluster's master endpoint. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint instead.
3950 #[serde(rename = "privateEndpoint")]
3951 pub private_endpoint: Option<String>,
3952 /// Subnet to provision the master's private endpoint during cluster creation. Specified in projects/*/regions/*/subnetworks/* format. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint_subnetwork instead.
3953 #[serde(rename = "privateEndpointSubnetwork")]
3954 pub private_endpoint_subnetwork: Option<String>,
3955 /// Output only. The external IP address of this cluster's master endpoint. Deprecated:Use ControlPlaneEndpointsConfig.IPEndpointsConfig.public_endpoint instead.
3956 #[serde(rename = "publicEndpoint")]
3957 pub public_endpoint: Option<String>,
3958}
3959
3960impl common::Part for PrivateClusterConfig {}
3961
3962/// Configuration for controlling master global access settings.
3963///
3964/// This type is not used in any activity, and only used as *part* of another schema.
3965///
3966#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3967#[serde_with::serde_as]
3968#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3969pub struct PrivateClusterMasterGlobalAccessConfig {
3970 /// Whenever master is accessible globally or not.
3971 pub enabled: Option<bool>,
3972}
3973
3974impl common::Part for PrivateClusterMasterGlobalAccessConfig {}
3975
3976/// PrivateRegistryAccessConfig contains access configuration for private container registries.
3977///
3978/// This type is not used in any activity, and only used as *part* of another schema.
3979///
3980#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3981#[serde_with::serde_as]
3982#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
3983pub struct PrivateRegistryAccessConfig {
3984 /// Private registry access configuration.
3985 #[serde(rename = "certificateAuthorityDomainConfig")]
3986 pub certificate_authority_domain_config: Option<Vec<CertificateAuthorityDomainConfig>>,
3987 /// Private registry access is enabled.
3988 pub enabled: Option<bool>,
3989}
3990
3991impl common::Part for PrivateRegistryAccessConfig {}
3992
3993/// PrivilegedAdmissionConfig stores the list of authorized allowlist paths for the cluster.
3994///
3995/// This type is not used in any activity, and only used as *part* of another schema.
3996///
3997#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
3998#[serde_with::serde_as]
3999#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4000pub struct PrivilegedAdmissionConfig {
4001 /// The customer allowlist Cloud Storage paths for the cluster. These paths are used with the `--autopilot-privileged-admission` flag to authorize privileged workloads in Autopilot clusters. Paths can be GKE-owned, in the format `gke:////`, or customer-owned, in the format `gs:///`. Wildcards (`*`) are supported to authorize all allowlists under specific paths or directories. Example: `gs://my-bucket/*` will authorize all allowlists under the `my-bucket` bucket.
4002 #[serde(rename = "allowlistPaths")]
4003 pub allowlist_paths: Option<Vec<String>>,
4004}
4005
4006impl common::Part for PrivilegedAdmissionConfig {}
4007
4008/// Pub/Sub specific notification config.
4009///
4010/// This type is not used in any activity, and only used as *part* of another schema.
4011///
4012#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4013#[serde_with::serde_as]
4014#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4015pub struct PubSub {
4016 /// Enable notifications for Pub/Sub.
4017 pub enabled: Option<bool>,
4018 /// 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
4019 pub filter: Option<Filter>,
4020 /// The desired Pub/Sub topic to which notifications will be sent by GKE. Format is `projects/{project}/topics/{topic}`.
4021 pub topic: Option<String>,
4022}
4023
4024impl common::Part for PubSub {}
4025
4026/// QueuedProvisioning defines the queued provisioning used by the node pool.
4027///
4028/// This type is not used in any activity, and only used as *part* of another schema.
4029///
4030#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4031#[serde_with::serde_as]
4032#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4033pub struct QueuedProvisioning {
4034 /// Denotes that this nodepool is QRM specific, meaning nodes can be only obtained through queuing via the Cluster Autoscaler ProvisioningRequest API.
4035 pub enabled: Option<bool>,
4036}
4037
4038impl common::Part for QueuedProvisioning {}
4039
4040/// RBACBindingConfig allows user to restrict ClusterRoleBindings an RoleBindings that can be created.
4041///
4042/// This type is not used in any activity, and only used as *part* of another schema.
4043///
4044#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4045#[serde_with::serde_as]
4046#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4047pub struct RBACBindingConfig {
4048 /// Setting this to true will allow any ClusterRoleBinding and RoleBinding with subjects system:authenticated.
4049 #[serde(rename = "enableInsecureBindingSystemAuthenticated")]
4050 pub enable_insecure_binding_system_authenticated: Option<bool>,
4051 /// Setting this to true will allow any ClusterRoleBinding and RoleBinding with subjets system:anonymous or system:unauthenticated.
4052 #[serde(rename = "enableInsecureBindingSystemUnauthenticated")]
4053 pub enable_insecure_binding_system_unauthenticated: Option<bool>,
4054}
4055
4056impl common::Part for RBACBindingConfig {}
4057
4058/// RangeInfo contains the range name and the range utilization by this cluster.
4059///
4060/// This type is not used in any activity, and only used as *part* of another schema.
4061///
4062#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4063#[serde_with::serde_as]
4064#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4065pub struct RangeInfo {
4066 /// Output only. Name of a range.
4067 #[serde(rename = "rangeName")]
4068 pub range_name: Option<String>,
4069 /// Output only. The utilization of the range.
4070 pub utilization: Option<f64>,
4071}
4072
4073impl common::Part for RangeInfo {}
4074
4075/// RayClusterLoggingConfig specifies configuration of Ray logging.
4076///
4077/// This type is not used in any activity, and only used as *part* of another schema.
4078///
4079#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4080#[serde_with::serde_as]
4081#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4082pub struct RayClusterLoggingConfig {
4083 /// Enable log collection for Ray clusters.
4084 pub enabled: Option<bool>,
4085}
4086
4087impl common::Part for RayClusterLoggingConfig {}
4088
4089/// RayClusterMonitoringConfig specifies monitoring configuration for Ray clusters.
4090///
4091/// This type is not used in any activity, and only used as *part* of another schema.
4092///
4093#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4094#[serde_with::serde_as]
4095#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4096pub struct RayClusterMonitoringConfig {
4097 /// Enable metrics collection for Ray clusters.
4098 pub enabled: Option<bool>,
4099}
4100
4101impl common::Part for RayClusterMonitoringConfig {}
4102
4103/// Configuration options for the Ray Operator add-on.
4104///
4105/// This type is not used in any activity, and only used as *part* of another schema.
4106///
4107#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4108#[serde_with::serde_as]
4109#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4110pub struct RayOperatorConfig {
4111 /// Whether the Ray Operator addon is enabled for this cluster.
4112 pub enabled: Option<bool>,
4113 /// Optional. Logging configuration for Ray clusters.
4114 #[serde(rename = "rayClusterLoggingConfig")]
4115 pub ray_cluster_logging_config: Option<RayClusterLoggingConfig>,
4116 /// Optional. Monitoring configuration for Ray clusters.
4117 #[serde(rename = "rayClusterMonitoringConfig")]
4118 pub ray_cluster_monitoring_config: Option<RayClusterMonitoringConfig>,
4119}
4120
4121impl common::Part for RayOperatorConfig {}
4122
4123/// Represents an arbitrary window of time that recurs.
4124///
4125/// This type is not used in any activity, and only used as *part* of another schema.
4126///
4127#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4128#[serde_with::serde_as]
4129#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4130pub struct RecurringTimeWindow {
4131 /// An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how this window recurs. 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.
4132 pub recurrence: Option<String>,
4133 /// The window of the first recurrence.
4134 pub window: Option<TimeWindow>,
4135}
4136
4137impl common::Part for RecurringTimeWindow {}
4138
4139/// RegistryHeader configures headers for the registry.
4140///
4141/// This type is not used in any activity, and only used as *part* of another schema.
4142///
4143#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4144#[serde_with::serde_as]
4145#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4146pub struct RegistryHeader {
4147 /// Key configures the header key.
4148 pub key: Option<String>,
4149 /// Value configures the header value.
4150 pub value: Option<Vec<String>>,
4151}
4152
4153impl common::Part for RegistryHeader {}
4154
4155/// RegistryHostConfig configures the top-level structure for a single containerd registry server's configuration, which represents one hosts.toml file on the node. It will override the same fqdns in PrivateRegistryAccessConfig.
4156///
4157/// This type is not used in any activity, and only used as *part* of another schema.
4158///
4159#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4160#[serde_with::serde_as]
4161#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4162pub struct RegistryHostConfig {
4163 /// HostConfig configures a list of host-specific configurations for the server. Each server can have at most 10 host configurations.
4164 pub hosts: Option<Vec<HostConfig>>,
4165 /// Defines the host name of the registry server, which will be used to create configuration file as /etc/containerd/hosts.d//hosts.toml. It supports fully qualified domain names (FQDN) and IP addresses: Specifying port is supported. Wildcards are NOT supported. Examples: - my.customdomain.com - 10.0.1.2:5000
4166 pub server: Option<String>,
4167}
4168
4169impl common::Part for RegistryHostConfig {}
4170
4171/// 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.
4172///
4173/// This type is not used in any activity, and only used as *part* of another schema.
4174///
4175#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4176#[serde_with::serde_as]
4177#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4178pub struct ReleaseChannel {
4179 /// channel specifies which release channel the cluster is subscribed to.
4180 pub channel: Option<String>,
4181}
4182
4183impl common::Part for ReleaseChannel {}
4184
4185/// ReleaseChannelConfig exposes configuration for a release channel.
4186///
4187/// This type is not used in any activity, and only used as *part* of another schema.
4188///
4189#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4190#[serde_with::serde_as]
4191#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4192pub struct ReleaseChannelConfig {
4193 /// The release channel this configuration applies to.
4194 pub channel: Option<String>,
4195 /// The default version for newly created clusters on the channel.
4196 #[serde(rename = "defaultVersion")]
4197 pub default_version: Option<String>,
4198 /// The auto upgrade target version for clusters on the channel.
4199 #[serde(rename = "upgradeTargetVersion")]
4200 pub upgrade_target_version: Option<String>,
4201 /// List of valid versions for the channel.
4202 #[serde(rename = "validVersions")]
4203 pub valid_versions: Option<Vec<String>>,
4204}
4205
4206impl common::Part for ReleaseChannelConfig {}
4207
4208/// [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) is the configuration of desired reservation which instances could take capacity from.
4209///
4210/// This type is not used in any activity, and only used as *part* of another schema.
4211///
4212#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4213#[serde_with::serde_as]
4214#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4215pub struct ReservationAffinity {
4216 /// Corresponds to the type of reservation consumption.
4217 #[serde(rename = "consumeReservationType")]
4218 pub consume_reservation_type: Option<String>,
4219 /// 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.
4220 pub key: Option<String>,
4221 /// Corresponds to the label value(s) of reservation resource(s).
4222 pub values: Option<Vec<String>>,
4223}
4224
4225impl common::Part for ReservationAffinity {}
4226
4227/// Collection of [Resource Manager labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels).
4228///
4229/// This type is not used in any activity, and only used as *part* of another schema.
4230///
4231#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4232#[serde_with::serde_as]
4233#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4234pub struct ResourceLabels {
4235 /// Map of node label keys and node label values.
4236 pub labels: Option<HashMap<String, String>>,
4237}
4238
4239impl common::Part for ResourceLabels {}
4240
4241/// Contains information about amount of some resource in the cluster. For memory, value should be in GB.
4242///
4243/// This type is not used in any activity, and only used as *part* of another schema.
4244///
4245#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4246#[serde_with::serde_as]
4247#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4248pub struct ResourceLimit {
4249 /// Maximum amount of the resource in the cluster.
4250 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4251 pub maximum: Option<i64>,
4252 /// Minimum amount of the resource in the cluster.
4253 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
4254 pub minimum: Option<i64>,
4255 /// Resource name "cpu", "memory" or gpu-specific string.
4256 #[serde(rename = "resourceType")]
4257 pub resource_type: Option<String>,
4258}
4259
4260impl common::Part for ResourceLimit {}
4261
4262/// 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.
4263///
4264/// This type is not used in any activity, and only used as *part* of another schema.
4265///
4266#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4267#[serde_with::serde_as]
4268#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4269pub struct ResourceManagerTags {
4270 /// 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}`
4271 pub tags: Option<HashMap<String, String>>,
4272}
4273
4274impl common::Part for ResourceManagerTags {}
4275
4276/// Configuration for exporting cluster resource usages.
4277///
4278/// This type is not used in any activity, and only used as *part* of another schema.
4279///
4280#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4281#[serde_with::serde_as]
4282#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4283pub struct ResourceUsageExportConfig {
4284 /// Configuration to use BigQuery as usage export destination.
4285 #[serde(rename = "bigqueryDestination")]
4286 pub bigquery_destination: Option<BigQueryDestination>,
4287 /// Configuration to enable resource consumption metering.
4288 #[serde(rename = "consumptionMeteringConfig")]
4289 pub consumption_metering_config: Option<ConsumptionMeteringConfig>,
4290 /// Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic.
4291 #[serde(rename = "enableNetworkEgressMetering")]
4292 pub enable_network_egress_metering: Option<bool>,
4293}
4294
4295impl common::Part for ResourceUsageExportConfig {}
4296
4297/// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed NodePool upgrade. This will be an no-op if the last upgrade successfully completed.
4298///
4299/// # Activities
4300///
4301/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4302/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4303///
4304/// * [locations clusters node pools rollback projects](ProjectLocationClusterNodePoolRollbackCall) (request)
4305/// * [zones clusters node pools rollback projects](ProjectZoneClusterNodePoolRollbackCall) (request)
4306#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4307#[serde_with::serde_as]
4308#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4309pub struct RollbackNodePoolUpgradeRequest {
4310 /// Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
4311 #[serde(rename = "clusterId")]
4312 pub cluster_id: Option<String>,
4313 /// The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4314 pub name: Option<String>,
4315 /// Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
4316 #[serde(rename = "nodePoolId")]
4317 pub node_pool_id: Option<String>,
4318 /// 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.
4319 #[serde(rename = "projectId")]
4320 pub project_id: Option<String>,
4321 /// Option for rollback to ignore the PodDisruptionBudget. Default value is false.
4322 #[serde(rename = "respectPdb")]
4323 pub respect_pdb: Option<bool>,
4324 /// 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.
4325 pub zone: Option<String>,
4326}
4327
4328impl common::RequestValue for RollbackNodePoolUpgradeRequest {}
4329
4330/// RotationConfig is config for secret manager auto rotation.
4331///
4332/// This type is not used in any activity, and only used as *part* of another schema.
4333///
4334#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4335#[serde_with::serde_as]
4336#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4337pub struct RotationConfig {
4338 /// Whether the rotation is enabled.
4339 pub enabled: Option<bool>,
4340 /// The interval between two consecutive rotations. Default rotation interval is 2 minutes.
4341 #[serde(rename = "rotationInterval")]
4342 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
4343 pub rotation_interval: Option<chrono::Duration>,
4344}
4345
4346impl common::Part for RotationConfig {}
4347
4348/// SandboxConfig contains configurations of the sandbox to use for the node.
4349///
4350/// This type is not used in any activity, and only used as *part* of another schema.
4351///
4352#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4353#[serde_with::serde_as]
4354#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4355pub struct SandboxConfig {
4356 /// Type of the sandbox to use for the node.
4357 #[serde(rename = "type")]
4358 pub type_: Option<String>,
4359}
4360
4361impl common::Part for SandboxConfig {}
4362
4363/// SecondaryBootDisk represents a persistent disk attached to a node with special configurations based on its mode.
4364///
4365/// This type is not used in any activity, and only used as *part* of another schema.
4366///
4367#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4368#[serde_with::serde_as]
4369#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4370pub struct SecondaryBootDisk {
4371 /// Fully-qualified resource ID for an existing disk image.
4372 #[serde(rename = "diskImage")]
4373 pub disk_image: Option<String>,
4374 /// Disk mode (container image cache, etc.)
4375 pub mode: Option<String>,
4376}
4377
4378impl common::Part for SecondaryBootDisk {}
4379
4380/// SecondaryBootDiskUpdateStrategy is a placeholder which will be extended in the future to define different options for updating secondary boot disks.
4381///
4382/// This type is not used in any activity, and only used as *part* of another schema.
4383///
4384#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4385#[serde_with::serde_as]
4386#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4387pub struct SecondaryBootDiskUpdateStrategy {
4388 _never_set: Option<bool>,
4389}
4390
4391impl common::Part for SecondaryBootDiskUpdateStrategy {}
4392
4393/// SecretManagerConfig is config for secret manager enablement.
4394///
4395/// This type is not used in any activity, and only used as *part* of another schema.
4396///
4397#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4398#[serde_with::serde_as]
4399#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4400pub struct SecretManagerConfig {
4401 /// Enable/Disable Secret Manager Config.
4402 pub enabled: Option<bool>,
4403 /// Rotation config for secret manager.
4404 #[serde(rename = "rotationConfig")]
4405 pub rotation_config: Option<RotationConfig>,
4406}
4407
4408impl common::Part for SecretManagerConfig {}
4409
4410/// SecurityPostureConfig defines the flags needed to enable/disable features for the Security Posture API.
4411///
4412/// This type is not used in any activity, and only used as *part* of another schema.
4413///
4414#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4415#[serde_with::serde_as]
4416#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4417pub struct SecurityPostureConfig {
4418 /// Sets which mode to use for Security Posture features.
4419 pub mode: Option<String>,
4420 /// Sets which mode to use for vulnerability scanning.
4421 #[serde(rename = "vulnerabilityMode")]
4422 pub vulnerability_mode: Option<String>,
4423}
4424
4425impl common::Part for SecurityPostureConfig {}
4426
4427/// Kubernetes Engine service configuration.
4428///
4429/// # Activities
4430///
4431/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4432/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4433///
4434/// * [locations get server config projects](ProjectLocationGetServerConfigCall) (response)
4435/// * [zones get serverconfig projects](ProjectZoneGetServerconfigCall) (response)
4436#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4437#[serde_with::serde_as]
4438#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4439pub struct ServerConfig {
4440 /// List of release channel configurations.
4441 pub channels: Option<Vec<ReleaseChannelConfig>>,
4442 /// Version of Kubernetes the service deploys by default.
4443 #[serde(rename = "defaultClusterVersion")]
4444 pub default_cluster_version: Option<String>,
4445 /// Default image type.
4446 #[serde(rename = "defaultImageType")]
4447 pub default_image_type: Option<String>,
4448 /// List of valid image types.
4449 #[serde(rename = "validImageTypes")]
4450 pub valid_image_types: Option<Vec<String>>,
4451 /// List of valid master versions, in descending order.
4452 #[serde(rename = "validMasterVersions")]
4453 pub valid_master_versions: Option<Vec<String>>,
4454 /// List of valid node upgrade target versions, in descending order.
4455 #[serde(rename = "validNodeVersions")]
4456 pub valid_node_versions: Option<Vec<String>>,
4457}
4458
4459impl common::ResponseResult for ServerConfig {}
4460
4461/// Config to block services with externalIPs field.
4462///
4463/// This type is not used in any activity, and only used as *part* of another schema.
4464///
4465#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4466#[serde_with::serde_as]
4467#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4468pub struct ServiceExternalIPsConfig {
4469 /// Whether Services with ExternalIPs field are allowed or not.
4470 pub enabled: Option<bool>,
4471}
4472
4473impl common::Part for ServiceExternalIPsConfig {}
4474
4475/// SetAddonsConfigRequest sets the addons associated with the cluster.
4476///
4477/// # Activities
4478///
4479/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4480/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4481///
4482/// * [locations clusters set addons projects](ProjectLocationClusterSetAddonCall) (request)
4483/// * [zones clusters addons projects](ProjectZoneClusterAddonCall) (request)
4484#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4485#[serde_with::serde_as]
4486#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4487pub struct SetAddonsConfigRequest {
4488 /// Required. The desired configurations for the various addons available to run in the cluster.
4489 #[serde(rename = "addonsConfig")]
4490 pub addons_config: Option<AddonsConfig>,
4491 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4492 #[serde(rename = "clusterId")]
4493 pub cluster_id: Option<String>,
4494 /// The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
4495 pub name: Option<String>,
4496 /// 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.
4497 #[serde(rename = "projectId")]
4498 pub project_id: Option<String>,
4499 /// 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.
4500 pub zone: Option<String>,
4501}
4502
4503impl common::RequestValue for SetAddonsConfigRequest {}
4504
4505/// 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
4506///
4507/// # Activities
4508///
4509/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4510/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4511///
4512/// * [locations clusters set resource labels projects](ProjectLocationClusterSetResourceLabelCall) (request)
4513/// * [zones clusters resource labels projects](ProjectZoneClusterResourceLabelCall) (request)
4514#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4515#[serde_with::serde_as]
4516#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4517pub struct SetLabelsRequest {
4518 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
4519 #[serde(rename = "clusterId")]
4520 pub cluster_id: Option<String>,
4521 /// 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.
4522 #[serde(rename = "labelFingerprint")]
4523 pub label_fingerprint: Option<String>,
4524 /// The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
4525 pub name: Option<String>,
4526 /// 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.
4527 #[serde(rename = "projectId")]
4528 pub project_id: Option<String>,
4529 /// Required. The labels to set for that cluster.
4530 #[serde(rename = "resourceLabels")]
4531 pub resource_labels: Option<HashMap<String, String>>,
4532 /// 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.
4533 pub zone: Option<String>,
4534}
4535
4536impl common::RequestValue for SetLabelsRequest {}
4537
4538/// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for a cluster.
4539///
4540/// # Activities
4541///
4542/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4543/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4544///
4545/// * [locations clusters set legacy abac projects](ProjectLocationClusterSetLegacyAbacCall) (request)
4546/// * [zones clusters legacy abac projects](ProjectZoneClusterLegacyAbacCall) (request)
4547#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4548#[serde_with::serde_as]
4549#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4550pub struct SetLegacyAbacRequest {
4551 /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
4552 #[serde(rename = "clusterId")]
4553 pub cluster_id: Option<String>,
4554 /// Required. Whether ABAC authorization will be enabled in the cluster.
4555 pub enabled: Option<bool>,
4556 /// The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
4557 pub name: Option<String>,
4558 /// 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.
4559 #[serde(rename = "projectId")]
4560 pub project_id: Option<String>,
4561 /// 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.
4562 pub zone: Option<String>,
4563}
4564
4565impl common::RequestValue for SetLegacyAbacRequest {}
4566
4567/// SetLocationsRequest sets the locations of the cluster.
4568///
4569/// # Activities
4570///
4571/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4572/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4573///
4574/// * [locations clusters set locations projects](ProjectLocationClusterSetLocationCall) (request)
4575/// * [zones clusters locations projects](ProjectZoneClusterLocationCall) (request)
4576#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4577#[serde_with::serde_as]
4578#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4579pub struct SetLocationsRequest {
4580 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4581 #[serde(rename = "clusterId")]
4582 pub cluster_id: Option<String>,
4583 /// 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.
4584 pub locations: Option<Vec<String>>,
4585 /// The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
4586 pub name: Option<String>,
4587 /// 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.
4588 #[serde(rename = "projectId")]
4589 pub project_id: Option<String>,
4590 /// 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.
4591 pub zone: Option<String>,
4592}
4593
4594impl common::RequestValue for SetLocationsRequest {}
4595
4596/// SetLoggingServiceRequest sets the logging service of a cluster.
4597///
4598/// # Activities
4599///
4600/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4601/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4602///
4603/// * [locations clusters set logging projects](ProjectLocationClusterSetLoggingCall) (request)
4604/// * [zones clusters logging projects](ProjectZoneClusterLoggingCall) (request)
4605#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4606#[serde_with::serde_as]
4607#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4608pub struct SetLoggingServiceRequest {
4609 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4610 #[serde(rename = "clusterId")]
4611 pub cluster_id: Option<String>,
4612 /// 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.
4613 #[serde(rename = "loggingService")]
4614 pub logging_service: Option<String>,
4615 /// The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
4616 pub name: Option<String>,
4617 /// 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.
4618 #[serde(rename = "projectId")]
4619 pub project_id: Option<String>,
4620 /// 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.
4621 pub zone: Option<String>,
4622}
4623
4624impl common::RequestValue for SetLoggingServiceRequest {}
4625
4626/// SetMaintenancePolicyRequest sets the maintenance policy for a cluster.
4627///
4628/// # Activities
4629///
4630/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4631/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4632///
4633/// * [locations clusters set maintenance policy projects](ProjectLocationClusterSetMaintenancePolicyCall) (request)
4634/// * [zones clusters set maintenance policy projects](ProjectZoneClusterSetMaintenancePolicyCall) (request)
4635#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4636#[serde_with::serde_as]
4637#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4638pub struct SetMaintenancePolicyRequest {
4639 /// Required. The name of the cluster to update.
4640 #[serde(rename = "clusterId")]
4641 pub cluster_id: Option<String>,
4642 /// Required. The maintenance policy to be set for the cluster. An empty field clears the existing maintenance policy.
4643 #[serde(rename = "maintenancePolicy")]
4644 pub maintenance_policy: Option<MaintenancePolicy>,
4645 /// The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
4646 pub name: Option<String>,
4647 /// Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
4648 #[serde(rename = "projectId")]
4649 pub project_id: Option<String>,
4650 /// Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
4651 pub zone: Option<String>,
4652}
4653
4654impl common::RequestValue for SetMaintenancePolicyRequest {}
4655
4656/// SetMasterAuthRequest updates the admin password of a cluster.
4657///
4658/// # Activities
4659///
4660/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4661/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4662///
4663/// * [locations clusters set master auth projects](ProjectLocationClusterSetMasterAuthCall) (request)
4664/// * [zones clusters set master auth projects](ProjectZoneClusterSetMasterAuthCall) (request)
4665#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4666#[serde_with::serde_as]
4667#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4668pub struct SetMasterAuthRequest {
4669 /// Required. The exact form of action to be taken on the master auth.
4670 pub action: Option<String>,
4671 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4672 #[serde(rename = "clusterId")]
4673 pub cluster_id: Option<String>,
4674 /// The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
4675 pub name: Option<String>,
4676 /// 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.
4677 #[serde(rename = "projectId")]
4678 pub project_id: Option<String>,
4679 /// Required. A description of the update.
4680 pub update: Option<MasterAuth>,
4681 /// 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.
4682 pub zone: Option<String>,
4683}
4684
4685impl common::RequestValue for SetMasterAuthRequest {}
4686
4687/// SetMonitoringServiceRequest sets the monitoring service of a cluster.
4688///
4689/// # Activities
4690///
4691/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4692/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4693///
4694/// * [locations clusters set monitoring projects](ProjectLocationClusterSetMonitoringCall) (request)
4695/// * [zones clusters monitoring projects](ProjectZoneClusterMonitoringCall) (request)
4696#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4697#[serde_with::serde_as]
4698#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4699pub struct SetMonitoringServiceRequest {
4700 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4701 #[serde(rename = "clusterId")]
4702 pub cluster_id: Option<String>,
4703 /// 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.
4704 #[serde(rename = "monitoringService")]
4705 pub monitoring_service: Option<String>,
4706 /// The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
4707 pub name: Option<String>,
4708 /// 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.
4709 #[serde(rename = "projectId")]
4710 pub project_id: Option<String>,
4711 /// 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.
4712 pub zone: Option<String>,
4713}
4714
4715impl common::RequestValue for SetMonitoringServiceRequest {}
4716
4717/// SetNetworkPolicyRequest enables/disables network policy for a cluster.
4718///
4719/// # Activities
4720///
4721/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4722/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4723///
4724/// * [locations clusters set network policy projects](ProjectLocationClusterSetNetworkPolicyCall) (request)
4725/// * [zones clusters set network policy projects](ProjectZoneClusterSetNetworkPolicyCall) (request)
4726#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4727#[serde_with::serde_as]
4728#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4729pub struct SetNetworkPolicyRequest {
4730 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
4731 #[serde(rename = "clusterId")]
4732 pub cluster_id: Option<String>,
4733 /// The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
4734 pub name: Option<String>,
4735 /// Required. Configuration options for the NetworkPolicy feature.
4736 #[serde(rename = "networkPolicy")]
4737 pub network_policy: Option<NetworkPolicy>,
4738 /// 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.
4739 #[serde(rename = "projectId")]
4740 pub project_id: Option<String>,
4741 /// 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.
4742 pub zone: Option<String>,
4743}
4744
4745impl common::RequestValue for SetNetworkPolicyRequest {}
4746
4747/// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool.
4748///
4749/// # Activities
4750///
4751/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4752/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4753///
4754/// * [locations clusters node pools set autoscaling projects](ProjectLocationClusterNodePoolSetAutoscalingCall) (request)
4755/// * [zones clusters node pools autoscaling projects](ProjectZoneClusterNodePoolAutoscalingCall) (request)
4756#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4757#[serde_with::serde_as]
4758#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4759pub struct SetNodePoolAutoscalingRequest {
4760 /// Required. Autoscaling configuration for the node pool.
4761 pub autoscaling: Option<NodePoolAutoscaling>,
4762 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
4763 #[serde(rename = "clusterId")]
4764 pub cluster_id: Option<String>,
4765 /// The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4766 pub name: Option<String>,
4767 /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
4768 #[serde(rename = "nodePoolId")]
4769 pub node_pool_id: Option<String>,
4770 /// 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.
4771 #[serde(rename = "projectId")]
4772 pub project_id: Option<String>,
4773 /// 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.
4774 pub zone: Option<String>,
4775}
4776
4777impl common::RequestValue for SetNodePoolAutoscalingRequest {}
4778
4779/// SetNodePoolManagementRequest sets the node management properties of a node pool.
4780///
4781/// # Activities
4782///
4783/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4784/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4785///
4786/// * [locations clusters node pools set management projects](ProjectLocationClusterNodePoolSetManagementCall) (request)
4787/// * [zones clusters node pools set management projects](ProjectZoneClusterNodePoolSetManagementCall) (request)
4788#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4789#[serde_with::serde_as]
4790#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4791pub struct SetNodePoolManagementRequest {
4792 /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
4793 #[serde(rename = "clusterId")]
4794 pub cluster_id: Option<String>,
4795 /// Required. NodeManagement configuration for the node pool.
4796 pub management: Option<NodeManagement>,
4797 /// The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4798 pub name: Option<String>,
4799 /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
4800 #[serde(rename = "nodePoolId")]
4801 pub node_pool_id: Option<String>,
4802 /// 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.
4803 #[serde(rename = "projectId")]
4804 pub project_id: Option<String>,
4805 /// 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.
4806 pub zone: Option<String>,
4807}
4808
4809impl common::RequestValue for SetNodePoolManagementRequest {}
4810
4811/// SetNodePoolSizeRequest sets the size of a node pool.
4812///
4813/// # Activities
4814///
4815/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4816/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4817///
4818/// * [locations clusters node pools set size projects](ProjectLocationClusterNodePoolSetSizeCall) (request)
4819/// * [zones clusters node pools set size projects](ProjectZoneClusterNodePoolSetSizeCall) (request)
4820#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4821#[serde_with::serde_as]
4822#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4823pub struct SetNodePoolSizeRequest {
4824 /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
4825 #[serde(rename = "clusterId")]
4826 pub cluster_id: Option<String>,
4827 /// The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
4828 pub name: Option<String>,
4829 /// Required. The desired node count for the pool.
4830 #[serde(rename = "nodeCount")]
4831 pub node_count: Option<i32>,
4832 /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
4833 #[serde(rename = "nodePoolId")]
4834 pub node_pool_id: Option<String>,
4835 /// 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.
4836 #[serde(rename = "projectId")]
4837 pub project_id: Option<String>,
4838 /// 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.
4839 pub zone: Option<String>,
4840}
4841
4842impl common::RequestValue for SetNodePoolSizeRequest {}
4843
4844/// A set of Shielded Instance options.
4845///
4846/// This type is not used in any activity, and only used as *part* of another schema.
4847///
4848#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4849#[serde_with::serde_as]
4850#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4851pub struct ShieldedInstanceConfig {
4852 /// 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.
4853 #[serde(rename = "enableIntegrityMonitoring")]
4854 pub enable_integrity_monitoring: Option<bool>,
4855 /// 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.
4856 #[serde(rename = "enableSecureBoot")]
4857 pub enable_secure_boot: Option<bool>,
4858}
4859
4860impl common::Part for ShieldedInstanceConfig {}
4861
4862/// Configuration of Shielded Nodes feature.
4863///
4864/// This type is not used in any activity, and only used as *part* of another schema.
4865///
4866#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4867#[serde_with::serde_as]
4868#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4869pub struct ShieldedNodes {
4870 /// Whether Shielded Nodes features are enabled on all nodes in this cluster.
4871 pub enabled: Option<bool>,
4872}
4873
4874impl common::Part for ShieldedNodes {}
4875
4876/// SoleTenantConfig contains the NodeAffinities to specify what shared sole tenant node groups should back the node pool.
4877///
4878/// This type is not used in any activity, and only used as *part* of another schema.
4879///
4880#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4881#[serde_with::serde_as]
4882#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4883pub struct SoleTenantConfig {
4884 /// Optional. The minimum number of virtual CPUs this instance will consume when running on a sole-tenant node. This field can only be set if the node pool is created in a shared sole-tenant node group.
4885 #[serde(rename = "minNodeCpus")]
4886 pub min_node_cpus: Option<i32>,
4887 /// NodeAffinities used to match to a shared sole tenant node group.
4888 #[serde(rename = "nodeAffinities")]
4889 pub node_affinities: Option<Vec<NodeAffinity>>,
4890}
4891
4892impl common::Part for SoleTenantConfig {}
4893
4894/// Standard rollout policy is the default policy for blue-green.
4895///
4896/// This type is not used in any activity, and only used as *part* of another schema.
4897///
4898#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4899#[serde_with::serde_as]
4900#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4901pub struct StandardRolloutPolicy {
4902 /// Number of blue nodes to drain in a batch.
4903 #[serde(rename = "batchNodeCount")]
4904 pub batch_node_count: Option<i32>,
4905 /// Percentage of the blue pool nodes to drain in a batch. The range of this field should be (0.0, 1.0].
4906 #[serde(rename = "batchPercentage")]
4907 pub batch_percentage: Option<f32>,
4908 /// Soak time after each batch gets drained. Default to zero.
4909 #[serde(rename = "batchSoakDuration")]
4910 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
4911 pub batch_soak_duration: Option<chrono::Duration>,
4912}
4913
4914impl common::Part for StandardRolloutPolicy {}
4915
4916/// StartIPRotationRequest creates a new IP for the cluster and then performs a node upgrade on each node pool to point to the new IP.
4917///
4918/// # Activities
4919///
4920/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
4921/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
4922///
4923/// * [locations clusters start ip rotation projects](ProjectLocationClusterStartIpRotationCall) (request)
4924/// * [zones clusters start ip rotation projects](ProjectZoneClusterStartIpRotationCall) (request)
4925#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4926#[serde_with::serde_as]
4927#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4928pub struct StartIPRotationRequest {
4929 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
4930 #[serde(rename = "clusterId")]
4931 pub cluster_id: Option<String>,
4932 /// The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
4933 pub name: Option<String>,
4934 /// 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.
4935 #[serde(rename = "projectId")]
4936 pub project_id: Option<String>,
4937 /// Whether to rotate credentials during IP rotation.
4938 #[serde(rename = "rotateCredentials")]
4939 pub rotate_credentials: Option<bool>,
4940 /// 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.
4941 pub zone: Option<String>,
4942}
4943
4944impl common::RequestValue for StartIPRotationRequest {}
4945
4946/// Configuration for the Stateful HA add-on.
4947///
4948/// This type is not used in any activity, and only used as *part* of another schema.
4949///
4950#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4951#[serde_with::serde_as]
4952#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4953pub struct StatefulHAConfig {
4954 /// Whether the Stateful HA add-on is enabled for this cluster.
4955 pub enabled: Option<bool>,
4956}
4957
4958impl common::Part for StatefulHAConfig {}
4959
4960/// 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).
4961///
4962/// This type is not used in any activity, and only used as *part* of another schema.
4963///
4964#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4965#[serde_with::serde_as]
4966#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4967pub struct Status {
4968 /// The status code, which should be an enum value of google.rpc.Code.
4969 pub code: Option<i32>,
4970 /// A list of messages that carry the error details. There is a common set of message types for APIs to use.
4971 pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
4972 /// 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.
4973 pub message: Option<String>,
4974}
4975
4976impl common::Part for Status {}
4977
4978/// StatusCondition describes why a cluster or a node pool has a certain status (e.g., ERROR or DEGRADED).
4979///
4980/// This type is not used in any activity, and only used as *part* of another schema.
4981///
4982#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
4983#[serde_with::serde_as]
4984#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
4985pub struct StatusCondition {
4986 /// Canonical code of the condition.
4987 #[serde(rename = "canonicalCode")]
4988 pub canonical_code: Option<String>,
4989 /// Machine-friendly representation of the condition Deprecated. Use canonical_code instead.
4990 pub code: Option<String>,
4991 /// Human-friendly representation of the condition
4992 pub message: Option<String>,
4993}
4994
4995impl common::Part for StatusCondition {}
4996
4997/// Represents an arbitrary window of time.
4998///
4999/// This type is not used in any activity, and only used as *part* of another schema.
5000///
5001#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5002#[serde_with::serde_as]
5003#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5004pub struct TimeWindow {
5005 /// The time that the window ends. The end time should take place after the start time.
5006 #[serde(rename = "endTime")]
5007 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
5008 /// MaintenanceExclusionOptions provides maintenance exclusion related options.
5009 #[serde(rename = "maintenanceExclusionOptions")]
5010 pub maintenance_exclusion_options: Option<MaintenanceExclusionOptions>,
5011 /// The time that the window first starts.
5012 #[serde(rename = "startTime")]
5013 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
5014}
5015
5016impl common::Part for TimeWindow {}
5017
5018/// TopologyManager defines the configuration options for Topology Manager feature. See https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/
5019///
5020/// This type is not used in any activity, and only used as *part* of another schema.
5021///
5022#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5023#[serde_with::serde_as]
5024#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5025pub struct TopologyManager {
5026 /// Configures the strategy for resource alignment. Allowed values are: * none: the default policy, and does not perform any topology alignment. * restricted: the topology manager stores the preferred NUMA node affinity for the container, and will reject the pod if the affinity if not preferred. * best-effort: the topology manager stores the preferred NUMA node affinity for the container. If the affinity is not preferred, the topology manager will admit the pod to the node anyway. * single-numa-node: the topology manager determines if the single NUMA node affinity is possible. If it is, Topology Manager will store this and the Hint Providers can then use this information when making the resource allocation decision. If, however, this is not possible then the Topology Manager will reject the pod from the node. This will result in a pod in a Terminated state with a pod admission failure. The default policy value is 'none' if unspecified. Details about each strategy can be found [here](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/#topology-manager-policies).
5027 pub policy: Option<String>,
5028 /// The Topology Manager aligns resources in following scopes: * container * pod The default scope is 'container' if unspecified. See https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/#topology-manager-scopes
5029 pub scope: Option<String>,
5030}
5031
5032impl common::Part for TopologyManager {}
5033
5034/// UpdateClusterRequest updates the settings of a cluster.
5035///
5036/// # Activities
5037///
5038/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5039/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5040///
5041/// * [locations clusters update projects](ProjectLocationClusterUpdateCall) (request)
5042/// * [zones clusters update projects](ProjectZoneClusterUpdateCall) (request)
5043#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5044#[serde_with::serde_as]
5045#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5046pub struct UpdateClusterRequest {
5047 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5048 #[serde(rename = "clusterId")]
5049 pub cluster_id: Option<String>,
5050 /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
5051 pub name: Option<String>,
5052 /// 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.
5053 #[serde(rename = "projectId")]
5054 pub project_id: Option<String>,
5055 /// Required. A description of the update.
5056 pub update: Option<ClusterUpdate>,
5057 /// 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.
5058 pub zone: Option<String>,
5059}
5060
5061impl common::RequestValue for UpdateClusterRequest {}
5062
5063/// UpdateInfo contains resource (instance groups, etc), status and other intermediate information relevant to a node pool upgrade.
5064///
5065/// This type is not used in any activity, and only used as *part* of another schema.
5066///
5067#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5068#[serde_with::serde_as]
5069#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5070pub struct UpdateInfo {
5071 /// Information of a blue-green upgrade.
5072 #[serde(rename = "blueGreenInfo")]
5073 pub blue_green_info: Option<BlueGreenInfo>,
5074}
5075
5076impl common::Part for UpdateInfo {}
5077
5078/// UpdateMasterRequest updates the master of the cluster.
5079///
5080/// # Activities
5081///
5082/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5083/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5084///
5085/// * [locations clusters update master projects](ProjectLocationClusterUpdateMasterCall) (request)
5086/// * [zones clusters master projects](ProjectZoneClusterMasterCall) (request)
5087#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5088#[serde_with::serde_as]
5089#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5090pub struct UpdateMasterRequest {
5091 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5092 #[serde(rename = "clusterId")]
5093 pub cluster_id: Option<String>,
5094 /// 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
5095 #[serde(rename = "masterVersion")]
5096 pub master_version: Option<String>,
5097 /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
5098 pub name: Option<String>,
5099 /// 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.
5100 #[serde(rename = "projectId")]
5101 pub project_id: Option<String>,
5102 /// 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.
5103 pub zone: Option<String>,
5104}
5105
5106impl common::RequestValue for UpdateMasterRequest {}
5107
5108/// UpdateNodePoolRequests update a node pool’s image and/or version.
5109///
5110/// # Activities
5111///
5112/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
5113/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
5114///
5115/// * [locations clusters node pools update projects](ProjectLocationClusterNodePoolUpdateCall) (request)
5116/// * [zones clusters node pools update projects](ProjectZoneClusterNodePoolUpdateCall) (request)
5117#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5118#[serde_with::serde_as]
5119#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5120pub struct UpdateNodePoolRequest {
5121 /// 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.
5122 pub accelerators: Option<Vec<AcceleratorConfig>>,
5123 /// The desired boot disk config for nodes in the node pool. Initiates an upgrade operation that migrates the nodes in the node pool to the specified boot disk config.
5124 #[serde(rename = "bootDisk")]
5125 pub boot_disk: Option<BootDisk>,
5126 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
5127 #[serde(rename = "clusterId")]
5128 pub cluster_id: Option<String>,
5129 /// Confidential nodes config. All the nodes in the node pool will be Confidential VM once enabled.
5130 #[serde(rename = "confidentialNodes")]
5131 pub confidential_nodes: Option<ConfidentialNodes>,
5132 /// The desired containerd config for nodes in the node pool. Initiates an upgrade operation that recreates the nodes with the new config.
5133 #[serde(rename = "containerdConfig")]
5134 pub containerd_config: Option<ContainerdConfig>,
5135 /// 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.
5136 #[serde(rename = "diskSizeGb")]
5137 #[serde_as(as = "Option<serde_with::DisplayFromStr>")]
5138 pub disk_size_gb: Option<i64>,
5139 /// 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.
5140 #[serde(rename = "diskType")]
5141 pub disk_type: Option<String>,
5142 /// 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.
5143 pub etag: Option<String>,
5144 /// Enable or disable NCCL fast socket for the node pool.
5145 #[serde(rename = "fastSocket")]
5146 pub fast_socket: Option<FastSocket>,
5147 /// Flex Start flag for enabling Flex Start VM.
5148 #[serde(rename = "flexStart")]
5149 pub flex_start: Option<bool>,
5150 /// GCFS config.
5151 #[serde(rename = "gcfsConfig")]
5152 pub gcfs_config: Option<GcfsConfig>,
5153 /// Enable or disable gvnic on the node pool.
5154 pub gvnic: Option<VirtualNIC>,
5155 /// 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.
5156 #[serde(rename = "imageType")]
5157 pub image_type: Option<String>,
5158 /// Node kubelet configs.
5159 #[serde(rename = "kubeletConfig")]
5160 pub kubelet_config: Option<NodeKubeletConfig>,
5161 /// 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.
5162 pub labels: Option<NodeLabels>,
5163 /// Parameters that can be configured on Linux nodes.
5164 #[serde(rename = "linuxNodeConfig")]
5165 pub linux_node_config: Option<LinuxNodeConfig>,
5166 /// 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. Warning: It is recommended to update node pool locations in a standalone API call. Do not combine a location update with changes to other fields (such as `tags`, `labels`, `taints`, etc.) in the same request. Otherwise, the API performs a structural modification where changes to other fields will only apply to newly created nodes and will not be applied to existing nodes in the node pool. To ensure all nodes are updated consistently, use a separate API call for location changes.
5167 pub locations: Option<Vec<String>>,
5168 /// Logging configuration.
5169 #[serde(rename = "loggingConfig")]
5170 pub logging_config: Option<NodePoolLoggingConfig>,
5171 /// 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.
5172 #[serde(rename = "machineType")]
5173 pub machine_type: Option<String>,
5174 /// The maximum duration for the nodes to exist. If unspecified, the nodes can exist indefinitely.
5175 #[serde(rename = "maxRunDuration")]
5176 #[serde_as(as = "Option<common::serde::duration::Wrapper>")]
5177 pub max_run_duration: Option<chrono::Duration>,
5178 /// The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5179 pub name: Option<String>,
5180 /// The desired node drain configuration for nodes in the node pool.
5181 #[serde(rename = "nodeDrainConfig")]
5182 pub node_drain_config: Option<NodeDrainConfig>,
5183 /// Node network config.
5184 #[serde(rename = "nodeNetworkConfig")]
5185 pub node_network_config: Option<NodeNetworkConfig>,
5186 /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
5187 #[serde(rename = "nodePoolId")]
5188 pub node_pool_id: Option<String>,
5189 /// 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
5190 #[serde(rename = "nodeVersion")]
5191 pub node_version: Option<String>,
5192 /// 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.
5193 #[serde(rename = "projectId")]
5194 pub project_id: Option<String>,
5195 /// Specifies the configuration of queued provisioning.
5196 #[serde(rename = "queuedProvisioning")]
5197 pub queued_provisioning: Option<QueuedProvisioning>,
5198 /// The resource labels for the node pool to use to annotate any related Google Compute Engine resources.
5199 #[serde(rename = "resourceLabels")]
5200 pub resource_labels: Option<ResourceLabels>,
5201 /// 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.
5202 #[serde(rename = "resourceManagerTags")]
5203 pub resource_manager_tags: Option<ResourceManagerTags>,
5204 /// List of Storage Pools where boot disks are provisioned. Existing Storage Pools will be replaced with storage-pools.
5205 #[serde(rename = "storagePools")]
5206 pub storage_pools: Option<Vec<String>>,
5207 /// 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.
5208 pub tags: Option<NetworkTags>,
5209 /// 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.
5210 pub taints: Option<NodeTaints>,
5211 /// Upgrade settings control disruption and speed of the upgrade.
5212 #[serde(rename = "upgradeSettings")]
5213 pub upgrade_settings: Option<UpgradeSettings>,
5214 /// Parameters that can be configured on Windows nodes.
5215 #[serde(rename = "windowsNodeConfig")]
5216 pub windows_node_config: Option<WindowsNodeConfig>,
5217 /// The desired workload metadata config for the node pool.
5218 #[serde(rename = "workloadMetadataConfig")]
5219 pub workload_metadata_config: Option<WorkloadMetadataConfig>,
5220 /// 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.
5221 pub zone: Option<String>,
5222}
5223
5224impl common::RequestValue for UpdateNodePoolRequest {}
5225
5226/// UpgradeDetails contains detailed information of each individual upgrade operation.
5227///
5228/// This type is not used in any activity, and only used as *part* of another schema.
5229///
5230#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5231#[serde_with::serde_as]
5232#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5233pub struct UpgradeDetails {
5234 /// The end timestamp of the upgrade.
5235 #[serde(rename = "endTime")]
5236 pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
5237 /// The version before the upgrade.
5238 #[serde(rename = "initialVersion")]
5239 pub initial_version: Option<String>,
5240 /// The start timestamp of the upgrade.
5241 #[serde(rename = "startTime")]
5242 pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
5243 /// The start type of the upgrade.
5244 #[serde(rename = "startType")]
5245 pub start_type: Option<String>,
5246 /// Output only. The state of the upgrade.
5247 pub state: Option<String>,
5248 /// The version after the upgrade.
5249 #[serde(rename = "targetVersion")]
5250 pub target_version: Option<String>,
5251}
5252
5253impl common::Part for UpgradeDetails {}
5254
5255/// 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.
5256///
5257/// This type is not used in any activity, and only used as *part* of another schema.
5258///
5259#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5260#[serde_with::serde_as]
5261#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5262pub struct UpgradeSettings {
5263 /// Settings for blue-green upgrade strategy.
5264 #[serde(rename = "blueGreenSettings")]
5265 pub blue_green_settings: Option<BlueGreenSettings>,
5266 /// The maximum number of nodes that can be created beyond the current size of the node pool during the upgrade process.
5267 #[serde(rename = "maxSurge")]
5268 pub max_surge: Option<i32>,
5269 /// The maximum number of nodes that can be simultaneously unavailable during the upgrade process. A node is considered available if its status is Ready.
5270 #[serde(rename = "maxUnavailable")]
5271 pub max_unavailable: Option<i32>,
5272 /// Update strategy of the node pool.
5273 pub strategy: Option<String>,
5274}
5275
5276impl common::Part for UpgradeSettings {}
5277
5278/// UsableSubnetwork resource returns the subnetwork name, its associated network and the primary CIDR range.
5279///
5280/// This type is not used in any activity, and only used as *part* of another schema.
5281///
5282#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5283#[serde_with::serde_as]
5284#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5285pub struct UsableSubnetwork {
5286 /// The range of internal addresses that are owned by this subnetwork.
5287 #[serde(rename = "ipCidrRange")]
5288 pub ip_cidr_range: Option<String>,
5289 /// Network Name. Example: projects/my-project/global/networks/my-network
5290 pub network: Option<String>,
5291 /// Secondary IP ranges.
5292 #[serde(rename = "secondaryIpRanges")]
5293 pub secondary_ip_ranges: Option<Vec<UsableSubnetworkSecondaryRange>>,
5294 /// 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.
5295 #[serde(rename = "statusMessage")]
5296 pub status_message: Option<String>,
5297 /// Subnetwork Name. Example: projects/my-project/regions/us-central1/subnetworks/my-subnet
5298 pub subnetwork: Option<String>,
5299}
5300
5301impl common::Part for UsableSubnetwork {}
5302
5303/// Secondary IP range of a usable subnetwork.
5304///
5305/// This type is not used in any activity, and only used as *part* of another schema.
5306///
5307#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5308#[serde_with::serde_as]
5309#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5310pub struct UsableSubnetworkSecondaryRange {
5311 /// The range of IP addresses belonging to this subnetwork secondary range.
5312 #[serde(rename = "ipCidrRange")]
5313 pub ip_cidr_range: Option<String>,
5314 /// The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.
5315 #[serde(rename = "rangeName")]
5316 pub range_name: Option<String>,
5317 /// This field is to determine the status of the secondary range programmably.
5318 pub status: Option<String>,
5319}
5320
5321impl common::Part for UsableSubnetworkSecondaryRange {}
5322
5323/// UserManagedKeysConfig holds the resource address to Keys which are used for signing certs and token that are used for communication within cluster.
5324///
5325/// This type is not used in any activity, and only used as *part* of another schema.
5326///
5327#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5328#[serde_with::serde_as]
5329#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5330pub struct UserManagedKeysConfig {
5331 /// The Certificate Authority Service caPool to use for the aggregation CA in this cluster.
5332 #[serde(rename = "aggregationCa")]
5333 pub aggregation_ca: Option<String>,
5334 /// The Certificate Authority Service caPool to use for the cluster CA in this cluster.
5335 #[serde(rename = "clusterCa")]
5336 pub cluster_ca: Option<String>,
5337 /// The Cloud KMS cryptoKey to use for Confidential Hyperdisk on the control plane nodes.
5338 #[serde(rename = "controlPlaneDiskEncryptionKey")]
5339 pub control_plane_disk_encryption_key: Option<String>,
5340 /// Output only. All of the versions of the Cloud KMS cryptoKey that are used by Confidential Hyperdisks on the control plane nodes.
5341 #[serde(rename = "controlPlaneDiskEncryptionKeyVersions")]
5342 pub control_plane_disk_encryption_key_versions: Option<Vec<String>>,
5343 /// Resource path of the Certificate Authority Service caPool to use for the etcd API CA in this cluster.
5344 #[serde(rename = "etcdApiCa")]
5345 pub etcd_api_ca: Option<String>,
5346 /// Resource path of the Certificate Authority Service caPool to use for the etcd peer CA in this cluster.
5347 #[serde(rename = "etcdPeerCa")]
5348 pub etcd_peer_ca: Option<String>,
5349 /// Resource path of the Cloud KMS cryptoKey to use for encryption of internal etcd backups.
5350 #[serde(rename = "gkeopsEtcdBackupEncryptionKey")]
5351 pub gkeops_etcd_backup_encryption_key: Option<String>,
5352 /// The Cloud KMS cryptoKeyVersions to use for signing service account JWTs issued by this cluster. Format: `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}`
5353 #[serde(rename = "serviceAccountSigningKeys")]
5354 pub service_account_signing_keys: Option<Vec<String>>,
5355 /// The Cloud KMS cryptoKeyVersions to use for verifying service account JWTs issued by this cluster. Format: `projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{cryptoKey}/cryptoKeyVersions/{cryptoKeyVersion}`
5356 #[serde(rename = "serviceAccountVerificationKeys")]
5357 pub service_account_verification_keys: Option<Vec<String>>,
5358}
5359
5360impl common::Part for UserManagedKeysConfig {}
5361
5362/// VerticalPodAutoscaling contains global, per-cluster information required by Vertical Pod Autoscaler to automatically adjust the resources of pods controlled by it.
5363///
5364/// This type is not used in any activity, and only used as *part* of another schema.
5365///
5366#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5367#[serde_with::serde_as]
5368#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5369pub struct VerticalPodAutoscaling {
5370 /// Enables vertical pod autoscaling.
5371 pub enabled: Option<bool>,
5372}
5373
5374impl common::Part for VerticalPodAutoscaling {}
5375
5376/// Configuration of gVNIC feature.
5377///
5378/// This type is not used in any activity, and only used as *part* of another schema.
5379///
5380#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5381#[serde_with::serde_as]
5382#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5383pub struct VirtualNIC {
5384 /// Whether gVNIC features are enabled in the node pool.
5385 pub enabled: Option<bool>,
5386}
5387
5388impl common::Part for VirtualNIC {}
5389
5390/// 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.
5391///
5392/// This type is not used in any activity, and only used as *part* of another schema.
5393///
5394#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5395#[serde_with::serde_as]
5396#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5397pub struct WindowsNodeConfig {
5398 /// OSVersion specifies the Windows node config to be used on the node.
5399 #[serde(rename = "osVersion")]
5400 pub os_version: Option<String>,
5401}
5402
5403impl common::Part for WindowsNodeConfig {}
5404
5405/// Configuration for the use of Kubernetes Service Accounts in IAM policies.
5406///
5407/// This type is not used in any activity, and only used as *part* of another schema.
5408///
5409#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5410#[serde_with::serde_as]
5411#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5412pub struct WorkloadIdentityConfig {
5413 /// The workload pool to attach all Kubernetes service accounts to.
5414 #[serde(rename = "workloadPool")]
5415 pub workload_pool: Option<String>,
5416}
5417
5418impl common::Part for WorkloadIdentityConfig {}
5419
5420/// WorkloadMetadataConfig defines the metadata configuration to expose to workloads on the node pool.
5421///
5422/// This type is not used in any activity, and only used as *part* of another schema.
5423///
5424#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5425#[serde_with::serde_as]
5426#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5427pub struct WorkloadMetadataConfig {
5428 /// Mode is the configuration for how to expose metadata to workloads running on the node pool.
5429 pub mode: Option<String>,
5430}
5431
5432impl common::Part for WorkloadMetadataConfig {}
5433
5434/// WorkloadPolicyConfig is the configuration related to GCW workload policy
5435///
5436/// This type is not used in any activity, and only used as *part* of another schema.
5437///
5438#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5439#[serde_with::serde_as]
5440#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5441pub struct WorkloadPolicyConfig {
5442 /// If true, workloads can use NET_ADMIN capability.
5443 #[serde(rename = "allowNetAdmin")]
5444 pub allow_net_admin: Option<bool>,
5445 /// If true, enables the GCW Auditor that audits workloads on standard clusters.
5446 #[serde(rename = "autopilotCompatibilityAuditingEnabled")]
5447 pub autopilot_compatibility_auditing_enabled: Option<bool>,
5448}
5449
5450impl common::Part for WorkloadPolicyConfig {}
5451
5452/// Defines writable cgroups configuration.
5453///
5454/// This type is not used in any activity, and only used as *part* of another schema.
5455///
5456#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
5457#[serde_with::serde_as]
5458#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
5459pub struct WritableCgroups {
5460 /// Optional. Whether writable cgroups is enabled.
5461 pub enabled: Option<bool>,
5462}
5463
5464impl common::Part for WritableCgroups {}
5465
5466// ###################
5467// MethodBuilders ###
5468// #################
5469
5470/// A builder providing access to all methods supported on *project* resources.
5471/// It is not used directly, but through the [`Container`] hub.
5472///
5473/// # Example
5474///
5475/// Instantiate a resource builder
5476///
5477/// ```test_harness,no_run
5478/// extern crate hyper;
5479/// extern crate hyper_rustls;
5480/// extern crate google_container1 as container1;
5481///
5482/// # async fn dox() {
5483/// use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
5484///
5485/// let secret: yup_oauth2::ApplicationSecret = Default::default();
5486/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
5487/// .with_native_roots()
5488/// .unwrap()
5489/// .https_only()
5490/// .enable_http2()
5491/// .build();
5492///
5493/// let executor = hyper_util::rt::TokioExecutor::new();
5494/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
5495/// secret,
5496/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
5497/// yup_oauth2::client::CustomHyperClientBuilder::from(
5498/// hyper_util::client::legacy::Client::builder(executor).build(connector),
5499/// ),
5500/// ).build().await.unwrap();
5501///
5502/// let client = hyper_util::client::legacy::Client::builder(
5503/// hyper_util::rt::TokioExecutor::new()
5504/// )
5505/// .build(
5506/// hyper_rustls::HttpsConnectorBuilder::new()
5507/// .with_native_roots()
5508/// .unwrap()
5509/// .https_or_http()
5510/// .enable_http2()
5511/// .build()
5512/// );
5513/// let mut hub = Container::new(client, auth);
5514/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
5515/// // like `aggregated_usable_subnetworks_list(...)`, `locations_clusters_check_autopilot_compatibility(...)`, `locations_clusters_complete_ip_rotation(...)`, `locations_clusters_create(...)`, `locations_clusters_delete(...)`, `locations_clusters_fetch_cluster_upgrade_info(...)`, `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_fetch_node_pool_upgrade_info(...)`, `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_fetch_cluster_upgrade_info(...)`, `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_fetch_node_pool_upgrade_info(...)`, `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(...)`
5516/// // to build up your call.
5517/// let rb = hub.projects();
5518/// # }
5519/// ```
5520pub struct ProjectMethods<'a, C>
5521where
5522 C: 'a,
5523{
5524 hub: &'a Container<C>,
5525}
5526
5527impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
5528
5529impl<'a, C> ProjectMethods<'a, C> {
5530 /// Create a builder to help you perform the following task:
5531 ///
5532 /// Lists subnetworks that are usable for creating clusters in a project.
5533 ///
5534 /// # Arguments
5535 ///
5536 /// * `parent` - The parent project where subnetworks are usable. Specified in the format `projects/*`.
5537 pub fn aggregated_usable_subnetworks_list(
5538 &self,
5539 parent: &str,
5540 ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
5541 ProjectAggregatedUsableSubnetworkListCall {
5542 hub: self.hub,
5543 _parent: parent.to_string(),
5544 _page_token: Default::default(),
5545 _page_size: Default::default(),
5546 _filter: Default::default(),
5547 _delegate: Default::default(),
5548 _additional_params: Default::default(),
5549 _scopes: Default::default(),
5550 }
5551 }
5552
5553 /// Create a builder to help you perform the following task:
5554 ///
5555 /// CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.
5556 ///
5557 /// # Arguments
5558 ///
5559 /// * `request` - No description provided.
5560 /// * `name` - The name (project, location, cluster, node pool id) of the node pool to complete upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5561 pub fn locations_clusters_node_pools_complete_upgrade(
5562 &self,
5563 request: CompleteNodePoolUpgradeRequest,
5564 name: &str,
5565 ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
5566 ProjectLocationClusterNodePoolCompleteUpgradeCall {
5567 hub: self.hub,
5568 _request: request,
5569 _name: name.to_string(),
5570 _delegate: Default::default(),
5571 _additional_params: Default::default(),
5572 _scopes: Default::default(),
5573 }
5574 }
5575
5576 /// Create a builder to help you perform the following task:
5577 ///
5578 /// Creates a node pool for a cluster.
5579 ///
5580 /// # Arguments
5581 ///
5582 /// * `request` - No description provided.
5583 /// * `parent` - The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
5584 pub fn locations_clusters_node_pools_create(
5585 &self,
5586 request: CreateNodePoolRequest,
5587 parent: &str,
5588 ) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
5589 ProjectLocationClusterNodePoolCreateCall {
5590 hub: self.hub,
5591 _request: request,
5592 _parent: parent.to_string(),
5593 _delegate: Default::default(),
5594 _additional_params: Default::default(),
5595 _scopes: Default::default(),
5596 }
5597 }
5598
5599 /// Create a builder to help you perform the following task:
5600 ///
5601 /// Deletes a node pool from a cluster.
5602 ///
5603 /// # Arguments
5604 ///
5605 /// * `name` - The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5606 pub fn locations_clusters_node_pools_delete(
5607 &self,
5608 name: &str,
5609 ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
5610 ProjectLocationClusterNodePoolDeleteCall {
5611 hub: self.hub,
5612 _name: name.to_string(),
5613 _zone: Default::default(),
5614 _project_id: Default::default(),
5615 _node_pool_id: Default::default(),
5616 _cluster_id: Default::default(),
5617 _delegate: Default::default(),
5618 _additional_params: Default::default(),
5619 _scopes: Default::default(),
5620 }
5621 }
5622
5623 /// Create a builder to help you perform the following task:
5624 ///
5625 /// Fetch upgrade information of a specific nodepool.
5626 ///
5627 /// # Arguments
5628 ///
5629 /// * `name` - Required. The name (project, location, cluster, nodepool) of the nodepool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*` or `projects/*/zones/*/clusters/*/nodePools/*`.
5630 pub fn locations_clusters_node_pools_fetch_node_pool_upgrade_info(
5631 &self,
5632 name: &str,
5633 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
5634 ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall {
5635 hub: self.hub,
5636 _name: name.to_string(),
5637 _version: Default::default(),
5638 _delegate: Default::default(),
5639 _additional_params: Default::default(),
5640 _scopes: Default::default(),
5641 }
5642 }
5643
5644 /// Create a builder to help you perform the following task:
5645 ///
5646 /// Retrieves the requested node pool.
5647 ///
5648 /// # Arguments
5649 ///
5650 /// * `name` - The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5651 pub fn locations_clusters_node_pools_get(
5652 &self,
5653 name: &str,
5654 ) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
5655 ProjectLocationClusterNodePoolGetCall {
5656 hub: self.hub,
5657 _name: name.to_string(),
5658 _zone: Default::default(),
5659 _project_id: Default::default(),
5660 _node_pool_id: Default::default(),
5661 _cluster_id: Default::default(),
5662 _delegate: Default::default(),
5663 _additional_params: Default::default(),
5664 _scopes: Default::default(),
5665 }
5666 }
5667
5668 /// Create a builder to help you perform the following task:
5669 ///
5670 /// Lists the node pools for a cluster.
5671 ///
5672 /// # Arguments
5673 ///
5674 /// * `parent` - The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
5675 pub fn locations_clusters_node_pools_list(
5676 &self,
5677 parent: &str,
5678 ) -> ProjectLocationClusterNodePoolListCall<'a, C> {
5679 ProjectLocationClusterNodePoolListCall {
5680 hub: self.hub,
5681 _parent: parent.to_string(),
5682 _zone: Default::default(),
5683 _project_id: Default::default(),
5684 _cluster_id: Default::default(),
5685 _delegate: Default::default(),
5686 _additional_params: Default::default(),
5687 _scopes: Default::default(),
5688 }
5689 }
5690
5691 /// Create a builder to help you perform the following task:
5692 ///
5693 /// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
5694 ///
5695 /// # Arguments
5696 ///
5697 /// * `request` - No description provided.
5698 /// * `name` - The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5699 pub fn locations_clusters_node_pools_rollback(
5700 &self,
5701 request: RollbackNodePoolUpgradeRequest,
5702 name: &str,
5703 ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
5704 ProjectLocationClusterNodePoolRollbackCall {
5705 hub: self.hub,
5706 _request: request,
5707 _name: name.to_string(),
5708 _delegate: Default::default(),
5709 _additional_params: Default::default(),
5710 _scopes: Default::default(),
5711 }
5712 }
5713
5714 /// Create a builder to help you perform the following task:
5715 ///
5716 /// Sets the autoscaling settings for the specified node pool.
5717 ///
5718 /// # Arguments
5719 ///
5720 /// * `request` - No description provided.
5721 /// * `name` - The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5722 pub fn locations_clusters_node_pools_set_autoscaling(
5723 &self,
5724 request: SetNodePoolAutoscalingRequest,
5725 name: &str,
5726 ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
5727 ProjectLocationClusterNodePoolSetAutoscalingCall {
5728 hub: self.hub,
5729 _request: request,
5730 _name: name.to_string(),
5731 _delegate: Default::default(),
5732 _additional_params: Default::default(),
5733 _scopes: Default::default(),
5734 }
5735 }
5736
5737 /// Create a builder to help you perform the following task:
5738 ///
5739 /// Sets the NodeManagement options for a node pool.
5740 ///
5741 /// # Arguments
5742 ///
5743 /// * `request` - No description provided.
5744 /// * `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/*`.
5745 pub fn locations_clusters_node_pools_set_management(
5746 &self,
5747 request: SetNodePoolManagementRequest,
5748 name: &str,
5749 ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
5750 ProjectLocationClusterNodePoolSetManagementCall {
5751 hub: self.hub,
5752 _request: request,
5753 _name: name.to_string(),
5754 _delegate: Default::default(),
5755 _additional_params: Default::default(),
5756 _scopes: Default::default(),
5757 }
5758 }
5759
5760 /// Create a builder to help you perform the following task:
5761 ///
5762 /// 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.
5763 ///
5764 /// # Arguments
5765 ///
5766 /// * `request` - No description provided.
5767 /// * `name` - The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5768 pub fn locations_clusters_node_pools_set_size(
5769 &self,
5770 request: SetNodePoolSizeRequest,
5771 name: &str,
5772 ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
5773 ProjectLocationClusterNodePoolSetSizeCall {
5774 hub: self.hub,
5775 _request: request,
5776 _name: name.to_string(),
5777 _delegate: Default::default(),
5778 _additional_params: Default::default(),
5779 _scopes: Default::default(),
5780 }
5781 }
5782
5783 /// Create a builder to help you perform the following task:
5784 ///
5785 /// Updates the version and/or image type for the specified node pool.
5786 ///
5787 /// # Arguments
5788 ///
5789 /// * `request` - No description provided.
5790 /// * `name` - The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
5791 pub fn locations_clusters_node_pools_update(
5792 &self,
5793 request: UpdateNodePoolRequest,
5794 name: &str,
5795 ) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
5796 ProjectLocationClusterNodePoolUpdateCall {
5797 hub: self.hub,
5798 _request: request,
5799 _name: name.to_string(),
5800 _delegate: Default::default(),
5801 _additional_params: Default::default(),
5802 _scopes: Default::default(),
5803 }
5804 }
5805
5806 /// Create a builder to help you perform the following task:
5807 ///
5808 /// 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.
5809 ///
5810 /// # Arguments
5811 ///
5812 /// * `parent` - The cluster (project, location, cluster name) to get the discovery document for. Specified in the format `projects/*/locations/*/clusters/*`.
5813 pub fn locations_clusters_well_known_get_openid_configuration(
5814 &self,
5815 parent: &str,
5816 ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
5817 ProjectLocationClusterWellKnownGetOpenidConfigurationCall {
5818 hub: self.hub,
5819 _parent: parent.to_string(),
5820 _delegate: Default::default(),
5821 _additional_params: Default::default(),
5822 }
5823 }
5824
5825 /// Create a builder to help you perform the following task:
5826 ///
5827 /// Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.
5828 ///
5829 /// # Arguments
5830 ///
5831 /// * `name` - The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
5832 pub fn locations_clusters_check_autopilot_compatibility(
5833 &self,
5834 name: &str,
5835 ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
5836 ProjectLocationClusterCheckAutopilotCompatibilityCall {
5837 hub: self.hub,
5838 _name: name.to_string(),
5839 _delegate: Default::default(),
5840 _additional_params: Default::default(),
5841 _scopes: Default::default(),
5842 }
5843 }
5844
5845 /// Create a builder to help you perform the following task:
5846 ///
5847 /// Completes master IP rotation.
5848 ///
5849 /// # Arguments
5850 ///
5851 /// * `request` - No description provided.
5852 /// * `name` - The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
5853 pub fn locations_clusters_complete_ip_rotation(
5854 &self,
5855 request: CompleteIPRotationRequest,
5856 name: &str,
5857 ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
5858 ProjectLocationClusterCompleteIpRotationCall {
5859 hub: self.hub,
5860 _request: request,
5861 _name: name.to_string(),
5862 _delegate: Default::default(),
5863 _additional_params: Default::default(),
5864 _scopes: Default::default(),
5865 }
5866 }
5867
5868 /// Create a builder to help you perform the following task:
5869 ///
5870 /// 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.
5871 ///
5872 /// # Arguments
5873 ///
5874 /// * `request` - No description provided.
5875 /// * `parent` - The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
5876 pub fn locations_clusters_create(
5877 &self,
5878 request: CreateClusterRequest,
5879 parent: &str,
5880 ) -> ProjectLocationClusterCreateCall<'a, C> {
5881 ProjectLocationClusterCreateCall {
5882 hub: self.hub,
5883 _request: request,
5884 _parent: parent.to_string(),
5885 _delegate: Default::default(),
5886 _additional_params: Default::default(),
5887 _scopes: Default::default(),
5888 }
5889 }
5890
5891 /// Create a builder to help you perform the following task:
5892 ///
5893 /// 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.
5894 ///
5895 /// # Arguments
5896 ///
5897 /// * `name` - The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
5898 pub fn locations_clusters_delete(&self, name: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
5899 ProjectLocationClusterDeleteCall {
5900 hub: self.hub,
5901 _name: name.to_string(),
5902 _zone: Default::default(),
5903 _project_id: Default::default(),
5904 _cluster_id: Default::default(),
5905 _delegate: Default::default(),
5906 _additional_params: Default::default(),
5907 _scopes: Default::default(),
5908 }
5909 }
5910
5911 /// Create a builder to help you perform the following task:
5912 ///
5913 /// Fetch upgrade information of a specific cluster.
5914 ///
5915 /// # Arguments
5916 ///
5917 /// * `name` - Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
5918 pub fn locations_clusters_fetch_cluster_upgrade_info(
5919 &self,
5920 name: &str,
5921 ) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
5922 ProjectLocationClusterFetchClusterUpgradeInfoCall {
5923 hub: self.hub,
5924 _name: name.to_string(),
5925 _version: Default::default(),
5926 _delegate: Default::default(),
5927 _additional_params: Default::default(),
5928 _scopes: Default::default(),
5929 }
5930 }
5931
5932 /// Create a builder to help you perform the following task:
5933 ///
5934 /// Gets the details of a specific cluster.
5935 ///
5936 /// # Arguments
5937 ///
5938 /// * `name` - The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
5939 pub fn locations_clusters_get(&self, name: &str) -> ProjectLocationClusterGetCall<'a, C> {
5940 ProjectLocationClusterGetCall {
5941 hub: self.hub,
5942 _name: name.to_string(),
5943 _zone: Default::default(),
5944 _project_id: Default::default(),
5945 _cluster_id: Default::default(),
5946 _delegate: Default::default(),
5947 _additional_params: Default::default(),
5948 _scopes: Default::default(),
5949 }
5950 }
5951
5952 /// Create a builder to help you perform the following task:
5953 ///
5954 /// Gets the public component of the cluster signing keys in JSON Web Key format.
5955 ///
5956 /// # Arguments
5957 ///
5958 /// * `parent` - The cluster (project, location, cluster name) to get keys for. Specified in the format `projects/*/locations/*/clusters/*`.
5959 pub fn locations_clusters_get_jwks(
5960 &self,
5961 parent: &str,
5962 ) -> ProjectLocationClusterGetJwkCall<'a, C> {
5963 ProjectLocationClusterGetJwkCall {
5964 hub: self.hub,
5965 _parent: parent.to_string(),
5966 _delegate: Default::default(),
5967 _additional_params: Default::default(),
5968 }
5969 }
5970
5971 /// Create a builder to help you perform the following task:
5972 ///
5973 /// Lists all clusters owned by a project in either the specified zone or all zones.
5974 ///
5975 /// # Arguments
5976 ///
5977 /// * `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.
5978 pub fn locations_clusters_list(&self, parent: &str) -> ProjectLocationClusterListCall<'a, C> {
5979 ProjectLocationClusterListCall {
5980 hub: self.hub,
5981 _parent: parent.to_string(),
5982 _zone: Default::default(),
5983 _project_id: Default::default(),
5984 _delegate: Default::default(),
5985 _additional_params: Default::default(),
5986 _scopes: Default::default(),
5987 }
5988 }
5989
5990 /// Create a builder to help you perform the following task:
5991 ///
5992 /// Sets the addons for a specific cluster.
5993 ///
5994 /// # Arguments
5995 ///
5996 /// * `request` - No description provided.
5997 /// * `name` - The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
5998 pub fn locations_clusters_set_addons(
5999 &self,
6000 request: SetAddonsConfigRequest,
6001 name: &str,
6002 ) -> ProjectLocationClusterSetAddonCall<'a, C> {
6003 ProjectLocationClusterSetAddonCall {
6004 hub: self.hub,
6005 _request: request,
6006 _name: name.to_string(),
6007 _delegate: Default::default(),
6008 _additional_params: Default::default(),
6009 _scopes: Default::default(),
6010 }
6011 }
6012
6013 /// Create a builder to help you perform the following task:
6014 ///
6015 /// Enables or disables the ABAC authorization mechanism on a cluster.
6016 ///
6017 /// # Arguments
6018 ///
6019 /// * `request` - No description provided.
6020 /// * `name` - The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
6021 pub fn locations_clusters_set_legacy_abac(
6022 &self,
6023 request: SetLegacyAbacRequest,
6024 name: &str,
6025 ) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
6026 ProjectLocationClusterSetLegacyAbacCall {
6027 hub: self.hub,
6028 _request: request,
6029 _name: name.to_string(),
6030 _delegate: Default::default(),
6031 _additional_params: Default::default(),
6032 _scopes: Default::default(),
6033 }
6034 }
6035
6036 /// Create a builder to help you perform the following task:
6037 ///
6038 /// 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.
6039 ///
6040 /// # Arguments
6041 ///
6042 /// * `request` - No description provided.
6043 /// * `name` - The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
6044 pub fn locations_clusters_set_locations(
6045 &self,
6046 request: SetLocationsRequest,
6047 name: &str,
6048 ) -> ProjectLocationClusterSetLocationCall<'a, C> {
6049 ProjectLocationClusterSetLocationCall {
6050 hub: self.hub,
6051 _request: request,
6052 _name: name.to_string(),
6053 _delegate: Default::default(),
6054 _additional_params: Default::default(),
6055 _scopes: Default::default(),
6056 }
6057 }
6058
6059 /// Create a builder to help you perform the following task:
6060 ///
6061 /// Sets the logging service for a specific cluster.
6062 ///
6063 /// # Arguments
6064 ///
6065 /// * `request` - No description provided.
6066 /// * `name` - The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
6067 pub fn locations_clusters_set_logging(
6068 &self,
6069 request: SetLoggingServiceRequest,
6070 name: &str,
6071 ) -> ProjectLocationClusterSetLoggingCall<'a, C> {
6072 ProjectLocationClusterSetLoggingCall {
6073 hub: self.hub,
6074 _request: request,
6075 _name: name.to_string(),
6076 _delegate: Default::default(),
6077 _additional_params: Default::default(),
6078 _scopes: Default::default(),
6079 }
6080 }
6081
6082 /// Create a builder to help you perform the following task:
6083 ///
6084 /// Sets the maintenance policy for a cluster.
6085 ///
6086 /// # Arguments
6087 ///
6088 /// * `request` - No description provided.
6089 /// * `name` - The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
6090 pub fn locations_clusters_set_maintenance_policy(
6091 &self,
6092 request: SetMaintenancePolicyRequest,
6093 name: &str,
6094 ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
6095 ProjectLocationClusterSetMaintenancePolicyCall {
6096 hub: self.hub,
6097 _request: request,
6098 _name: name.to_string(),
6099 _delegate: Default::default(),
6100 _additional_params: Default::default(),
6101 _scopes: Default::default(),
6102 }
6103 }
6104
6105 /// Create a builder to help you perform the following task:
6106 ///
6107 /// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
6108 ///
6109 /// # Arguments
6110 ///
6111 /// * `request` - No description provided.
6112 /// * `name` - The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
6113 pub fn locations_clusters_set_master_auth(
6114 &self,
6115 request: SetMasterAuthRequest,
6116 name: &str,
6117 ) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
6118 ProjectLocationClusterSetMasterAuthCall {
6119 hub: self.hub,
6120 _request: request,
6121 _name: name.to_string(),
6122 _delegate: Default::default(),
6123 _additional_params: Default::default(),
6124 _scopes: Default::default(),
6125 }
6126 }
6127
6128 /// Create a builder to help you perform the following task:
6129 ///
6130 /// Sets the monitoring service for a specific cluster.
6131 ///
6132 /// # Arguments
6133 ///
6134 /// * `request` - No description provided.
6135 /// * `name` - The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
6136 pub fn locations_clusters_set_monitoring(
6137 &self,
6138 request: SetMonitoringServiceRequest,
6139 name: &str,
6140 ) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
6141 ProjectLocationClusterSetMonitoringCall {
6142 hub: self.hub,
6143 _request: request,
6144 _name: name.to_string(),
6145 _delegate: Default::default(),
6146 _additional_params: Default::default(),
6147 _scopes: Default::default(),
6148 }
6149 }
6150
6151 /// Create a builder to help you perform the following task:
6152 ///
6153 /// Enables or disables Network Policy for a cluster.
6154 ///
6155 /// # Arguments
6156 ///
6157 /// * `request` - No description provided.
6158 /// * `name` - The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
6159 pub fn locations_clusters_set_network_policy(
6160 &self,
6161 request: SetNetworkPolicyRequest,
6162 name: &str,
6163 ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
6164 ProjectLocationClusterSetNetworkPolicyCall {
6165 hub: self.hub,
6166 _request: request,
6167 _name: name.to_string(),
6168 _delegate: Default::default(),
6169 _additional_params: Default::default(),
6170 _scopes: Default::default(),
6171 }
6172 }
6173
6174 /// Create a builder to help you perform the following task:
6175 ///
6176 /// Sets labels on a cluster.
6177 ///
6178 /// # Arguments
6179 ///
6180 /// * `request` - No description provided.
6181 /// * `name` - The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
6182 pub fn locations_clusters_set_resource_labels(
6183 &self,
6184 request: SetLabelsRequest,
6185 name: &str,
6186 ) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
6187 ProjectLocationClusterSetResourceLabelCall {
6188 hub: self.hub,
6189 _request: request,
6190 _name: name.to_string(),
6191 _delegate: Default::default(),
6192 _additional_params: Default::default(),
6193 _scopes: Default::default(),
6194 }
6195 }
6196
6197 /// Create a builder to help you perform the following task:
6198 ///
6199 /// Starts master IP rotation.
6200 ///
6201 /// # Arguments
6202 ///
6203 /// * `request` - No description provided.
6204 /// * `name` - The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
6205 pub fn locations_clusters_start_ip_rotation(
6206 &self,
6207 request: StartIPRotationRequest,
6208 name: &str,
6209 ) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
6210 ProjectLocationClusterStartIpRotationCall {
6211 hub: self.hub,
6212 _request: request,
6213 _name: name.to_string(),
6214 _delegate: Default::default(),
6215 _additional_params: Default::default(),
6216 _scopes: Default::default(),
6217 }
6218 }
6219
6220 /// Create a builder to help you perform the following task:
6221 ///
6222 /// Updates the settings of a specific cluster.
6223 ///
6224 /// # Arguments
6225 ///
6226 /// * `request` - No description provided.
6227 /// * `name` - The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
6228 pub fn locations_clusters_update(
6229 &self,
6230 request: UpdateClusterRequest,
6231 name: &str,
6232 ) -> ProjectLocationClusterUpdateCall<'a, C> {
6233 ProjectLocationClusterUpdateCall {
6234 hub: self.hub,
6235 _request: request,
6236 _name: name.to_string(),
6237 _delegate: Default::default(),
6238 _additional_params: Default::default(),
6239 _scopes: Default::default(),
6240 }
6241 }
6242
6243 /// Create a builder to help you perform the following task:
6244 ///
6245 /// Updates the master for a specific cluster.
6246 ///
6247 /// # Arguments
6248 ///
6249 /// * `request` - No description provided.
6250 /// * `name` - The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
6251 pub fn locations_clusters_update_master(
6252 &self,
6253 request: UpdateMasterRequest,
6254 name: &str,
6255 ) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
6256 ProjectLocationClusterUpdateMasterCall {
6257 hub: self.hub,
6258 _request: request,
6259 _name: name.to_string(),
6260 _delegate: Default::default(),
6261 _additional_params: Default::default(),
6262 _scopes: Default::default(),
6263 }
6264 }
6265
6266 /// Create a builder to help you perform the following task:
6267 ///
6268 /// Cancels the specified operation.
6269 ///
6270 /// # Arguments
6271 ///
6272 /// * `request` - No description provided.
6273 /// * `name` - The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
6274 pub fn locations_operations_cancel(
6275 &self,
6276 request: CancelOperationRequest,
6277 name: &str,
6278 ) -> ProjectLocationOperationCancelCall<'a, C> {
6279 ProjectLocationOperationCancelCall {
6280 hub: self.hub,
6281 _request: request,
6282 _name: name.to_string(),
6283 _delegate: Default::default(),
6284 _additional_params: Default::default(),
6285 _scopes: Default::default(),
6286 }
6287 }
6288
6289 /// Create a builder to help you perform the following task:
6290 ///
6291 /// Gets the specified operation.
6292 ///
6293 /// # Arguments
6294 ///
6295 /// * `name` - The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
6296 pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
6297 ProjectLocationOperationGetCall {
6298 hub: self.hub,
6299 _name: name.to_string(),
6300 _zone: Default::default(),
6301 _project_id: Default::default(),
6302 _operation_id: Default::default(),
6303 _delegate: Default::default(),
6304 _additional_params: Default::default(),
6305 _scopes: Default::default(),
6306 }
6307 }
6308
6309 /// Create a builder to help you perform the following task:
6310 ///
6311 /// Lists all operations in a project in a specific zone or all zones.
6312 ///
6313 /// # Arguments
6314 ///
6315 /// * `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.
6316 pub fn locations_operations_list(
6317 &self,
6318 parent: &str,
6319 ) -> ProjectLocationOperationListCall<'a, C> {
6320 ProjectLocationOperationListCall {
6321 hub: self.hub,
6322 _parent: parent.to_string(),
6323 _zone: Default::default(),
6324 _project_id: Default::default(),
6325 _delegate: Default::default(),
6326 _additional_params: Default::default(),
6327 _scopes: Default::default(),
6328 }
6329 }
6330
6331 /// Create a builder to help you perform the following task:
6332 ///
6333 /// Returns configuration info about the Google Kubernetes Engine service.
6334 ///
6335 /// # Arguments
6336 ///
6337 /// * `name` - The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
6338 pub fn locations_get_server_config(
6339 &self,
6340 name: &str,
6341 ) -> ProjectLocationGetServerConfigCall<'a, C> {
6342 ProjectLocationGetServerConfigCall {
6343 hub: self.hub,
6344 _name: name.to_string(),
6345 _zone: Default::default(),
6346 _project_id: Default::default(),
6347 _delegate: Default::default(),
6348 _additional_params: Default::default(),
6349 _scopes: Default::default(),
6350 }
6351 }
6352
6353 /// Create a builder to help you perform the following task:
6354 ///
6355 /// Sets the autoscaling settings for the specified node pool.
6356 ///
6357 /// # Arguments
6358 ///
6359 /// * `request` - No description provided.
6360 /// * `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.
6361 /// * `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.
6362 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
6363 /// * `nodePoolId` - Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
6364 pub fn zones_clusters_node_pools_autoscaling(
6365 &self,
6366 request: SetNodePoolAutoscalingRequest,
6367 project_id: &str,
6368 zone: &str,
6369 cluster_id: &str,
6370 node_pool_id: &str,
6371 ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
6372 ProjectZoneClusterNodePoolAutoscalingCall {
6373 hub: self.hub,
6374 _request: request,
6375 _project_id: project_id.to_string(),
6376 _zone: zone.to_string(),
6377 _cluster_id: cluster_id.to_string(),
6378 _node_pool_id: node_pool_id.to_string(),
6379 _delegate: Default::default(),
6380 _additional_params: Default::default(),
6381 _scopes: Default::default(),
6382 }
6383 }
6384
6385 /// Create a builder to help you perform the following task:
6386 ///
6387 /// Creates a node pool for a cluster.
6388 ///
6389 /// # Arguments
6390 ///
6391 /// * `request` - No description provided.
6392 /// * `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.
6393 /// * `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.
6394 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
6395 pub fn zones_clusters_node_pools_create(
6396 &self,
6397 request: CreateNodePoolRequest,
6398 project_id: &str,
6399 zone: &str,
6400 cluster_id: &str,
6401 ) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
6402 ProjectZoneClusterNodePoolCreateCall {
6403 hub: self.hub,
6404 _request: request,
6405 _project_id: project_id.to_string(),
6406 _zone: zone.to_string(),
6407 _cluster_id: cluster_id.to_string(),
6408 _delegate: Default::default(),
6409 _additional_params: Default::default(),
6410 _scopes: Default::default(),
6411 }
6412 }
6413
6414 /// Create a builder to help you perform the following task:
6415 ///
6416 /// Deletes a node pool from a cluster.
6417 ///
6418 /// # Arguments
6419 ///
6420 /// * `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.
6421 /// * `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.
6422 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
6423 /// * `nodePoolId` - Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
6424 pub fn zones_clusters_node_pools_delete(
6425 &self,
6426 project_id: &str,
6427 zone: &str,
6428 cluster_id: &str,
6429 node_pool_id: &str,
6430 ) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
6431 ProjectZoneClusterNodePoolDeleteCall {
6432 hub: self.hub,
6433 _project_id: project_id.to_string(),
6434 _zone: zone.to_string(),
6435 _cluster_id: cluster_id.to_string(),
6436 _node_pool_id: node_pool_id.to_string(),
6437 _name: Default::default(),
6438 _delegate: Default::default(),
6439 _additional_params: Default::default(),
6440 _scopes: Default::default(),
6441 }
6442 }
6443
6444 /// Create a builder to help you perform the following task:
6445 ///
6446 /// Fetch upgrade information of a specific nodepool.
6447 ///
6448 /// # Arguments
6449 ///
6450 /// * `name` - Required. The name (project, location, cluster, nodepool) of the nodepool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*` or `projects/*/zones/*/clusters/*/nodePools/*`.
6451 pub fn zones_clusters_node_pools_fetch_node_pool_upgrade_info(
6452 &self,
6453 name: &str,
6454 ) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
6455 ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall {
6456 hub: self.hub,
6457 _name: name.to_string(),
6458 _version: Default::default(),
6459 _delegate: Default::default(),
6460 _additional_params: Default::default(),
6461 _scopes: Default::default(),
6462 }
6463 }
6464
6465 /// Create a builder to help you perform the following task:
6466 ///
6467 /// Retrieves the requested node pool.
6468 ///
6469 /// # Arguments
6470 ///
6471 /// * `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.
6472 /// * `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.
6473 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
6474 /// * `nodePoolId` - Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
6475 pub fn zones_clusters_node_pools_get(
6476 &self,
6477 project_id: &str,
6478 zone: &str,
6479 cluster_id: &str,
6480 node_pool_id: &str,
6481 ) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
6482 ProjectZoneClusterNodePoolGetCall {
6483 hub: self.hub,
6484 _project_id: project_id.to_string(),
6485 _zone: zone.to_string(),
6486 _cluster_id: cluster_id.to_string(),
6487 _node_pool_id: node_pool_id.to_string(),
6488 _name: Default::default(),
6489 _delegate: Default::default(),
6490 _additional_params: Default::default(),
6491 _scopes: Default::default(),
6492 }
6493 }
6494
6495 /// Create a builder to help you perform the following task:
6496 ///
6497 /// Lists the node pools for a cluster.
6498 ///
6499 /// # Arguments
6500 ///
6501 /// * `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.
6502 /// * `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.
6503 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
6504 pub fn zones_clusters_node_pools_list(
6505 &self,
6506 project_id: &str,
6507 zone: &str,
6508 cluster_id: &str,
6509 ) -> ProjectZoneClusterNodePoolListCall<'a, C> {
6510 ProjectZoneClusterNodePoolListCall {
6511 hub: self.hub,
6512 _project_id: project_id.to_string(),
6513 _zone: zone.to_string(),
6514 _cluster_id: cluster_id.to_string(),
6515 _parent: Default::default(),
6516 _delegate: Default::default(),
6517 _additional_params: Default::default(),
6518 _scopes: Default::default(),
6519 }
6520 }
6521
6522 /// Create a builder to help you perform the following task:
6523 ///
6524 /// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
6525 ///
6526 /// # Arguments
6527 ///
6528 /// * `request` - No description provided.
6529 /// * `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.
6530 /// * `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.
6531 /// * `clusterId` - Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
6532 /// * `nodePoolId` - Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
6533 pub fn zones_clusters_node_pools_rollback(
6534 &self,
6535 request: RollbackNodePoolUpgradeRequest,
6536 project_id: &str,
6537 zone: &str,
6538 cluster_id: &str,
6539 node_pool_id: &str,
6540 ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
6541 ProjectZoneClusterNodePoolRollbackCall {
6542 hub: self.hub,
6543 _request: request,
6544 _project_id: project_id.to_string(),
6545 _zone: zone.to_string(),
6546 _cluster_id: cluster_id.to_string(),
6547 _node_pool_id: node_pool_id.to_string(),
6548 _delegate: Default::default(),
6549 _additional_params: Default::default(),
6550 _scopes: Default::default(),
6551 }
6552 }
6553
6554 /// Create a builder to help you perform the following task:
6555 ///
6556 /// Sets the NodeManagement options for a node pool.
6557 ///
6558 /// # Arguments
6559 ///
6560 /// * `request` - No description provided.
6561 /// * `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.
6562 /// * `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.
6563 /// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
6564 /// * `nodePoolId` - Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
6565 pub fn zones_clusters_node_pools_set_management(
6566 &self,
6567 request: SetNodePoolManagementRequest,
6568 project_id: &str,
6569 zone: &str,
6570 cluster_id: &str,
6571 node_pool_id: &str,
6572 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
6573 ProjectZoneClusterNodePoolSetManagementCall {
6574 hub: self.hub,
6575 _request: request,
6576 _project_id: project_id.to_string(),
6577 _zone: zone.to_string(),
6578 _cluster_id: cluster_id.to_string(),
6579 _node_pool_id: node_pool_id.to_string(),
6580 _delegate: Default::default(),
6581 _additional_params: Default::default(),
6582 _scopes: Default::default(),
6583 }
6584 }
6585
6586 /// Create a builder to help you perform the following task:
6587 ///
6588 /// 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.
6589 ///
6590 /// # Arguments
6591 ///
6592 /// * `request` - No description provided.
6593 /// * `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.
6594 /// * `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.
6595 /// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
6596 /// * `nodePoolId` - Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
6597 pub fn zones_clusters_node_pools_set_size(
6598 &self,
6599 request: SetNodePoolSizeRequest,
6600 project_id: &str,
6601 zone: &str,
6602 cluster_id: &str,
6603 node_pool_id: &str,
6604 ) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
6605 ProjectZoneClusterNodePoolSetSizeCall {
6606 hub: self.hub,
6607 _request: request,
6608 _project_id: project_id.to_string(),
6609 _zone: zone.to_string(),
6610 _cluster_id: cluster_id.to_string(),
6611 _node_pool_id: node_pool_id.to_string(),
6612 _delegate: Default::default(),
6613 _additional_params: Default::default(),
6614 _scopes: Default::default(),
6615 }
6616 }
6617
6618 /// Create a builder to help you perform the following task:
6619 ///
6620 /// Updates the version and/or image type for the specified node pool.
6621 ///
6622 /// # Arguments
6623 ///
6624 /// * `request` - No description provided.
6625 /// * `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.
6626 /// * `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.
6627 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
6628 /// * `nodePoolId` - Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
6629 pub fn zones_clusters_node_pools_update(
6630 &self,
6631 request: UpdateNodePoolRequest,
6632 project_id: &str,
6633 zone: &str,
6634 cluster_id: &str,
6635 node_pool_id: &str,
6636 ) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
6637 ProjectZoneClusterNodePoolUpdateCall {
6638 hub: self.hub,
6639 _request: request,
6640 _project_id: project_id.to_string(),
6641 _zone: zone.to_string(),
6642 _cluster_id: cluster_id.to_string(),
6643 _node_pool_id: node_pool_id.to_string(),
6644 _delegate: Default::default(),
6645 _additional_params: Default::default(),
6646 _scopes: Default::default(),
6647 }
6648 }
6649
6650 /// Create a builder to help you perform the following task:
6651 ///
6652 /// Sets the addons for a specific cluster.
6653 ///
6654 /// # Arguments
6655 ///
6656 /// * `request` - No description provided.
6657 /// * `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.
6658 /// * `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.
6659 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
6660 pub fn zones_clusters_addons(
6661 &self,
6662 request: SetAddonsConfigRequest,
6663 project_id: &str,
6664 zone: &str,
6665 cluster_id: &str,
6666 ) -> ProjectZoneClusterAddonCall<'a, C> {
6667 ProjectZoneClusterAddonCall {
6668 hub: self.hub,
6669 _request: request,
6670 _project_id: project_id.to_string(),
6671 _zone: zone.to_string(),
6672 _cluster_id: cluster_id.to_string(),
6673 _delegate: Default::default(),
6674 _additional_params: Default::default(),
6675 _scopes: Default::default(),
6676 }
6677 }
6678
6679 /// Create a builder to help you perform the following task:
6680 ///
6681 /// Completes master IP rotation.
6682 ///
6683 /// # Arguments
6684 ///
6685 /// * `request` - No description provided.
6686 /// * `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.
6687 /// * `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.
6688 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
6689 pub fn zones_clusters_complete_ip_rotation(
6690 &self,
6691 request: CompleteIPRotationRequest,
6692 project_id: &str,
6693 zone: &str,
6694 cluster_id: &str,
6695 ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
6696 ProjectZoneClusterCompleteIpRotationCall {
6697 hub: self.hub,
6698 _request: request,
6699 _project_id: project_id.to_string(),
6700 _zone: zone.to_string(),
6701 _cluster_id: cluster_id.to_string(),
6702 _delegate: Default::default(),
6703 _additional_params: Default::default(),
6704 _scopes: Default::default(),
6705 }
6706 }
6707
6708 /// Create a builder to help you perform the following task:
6709 ///
6710 /// 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.
6711 ///
6712 /// # Arguments
6713 ///
6714 /// * `request` - No description provided.
6715 /// * `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.
6716 /// * `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.
6717 pub fn zones_clusters_create(
6718 &self,
6719 request: CreateClusterRequest,
6720 project_id: &str,
6721 zone: &str,
6722 ) -> ProjectZoneClusterCreateCall<'a, C> {
6723 ProjectZoneClusterCreateCall {
6724 hub: self.hub,
6725 _request: request,
6726 _project_id: project_id.to_string(),
6727 _zone: zone.to_string(),
6728 _delegate: Default::default(),
6729 _additional_params: Default::default(),
6730 _scopes: Default::default(),
6731 }
6732 }
6733
6734 /// Create a builder to help you perform the following task:
6735 ///
6736 /// 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.
6737 ///
6738 /// # Arguments
6739 ///
6740 /// * `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.
6741 /// * `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.
6742 /// * `clusterId` - Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
6743 pub fn zones_clusters_delete(
6744 &self,
6745 project_id: &str,
6746 zone: &str,
6747 cluster_id: &str,
6748 ) -> ProjectZoneClusterDeleteCall<'a, C> {
6749 ProjectZoneClusterDeleteCall {
6750 hub: self.hub,
6751 _project_id: project_id.to_string(),
6752 _zone: zone.to_string(),
6753 _cluster_id: cluster_id.to_string(),
6754 _name: Default::default(),
6755 _delegate: Default::default(),
6756 _additional_params: Default::default(),
6757 _scopes: Default::default(),
6758 }
6759 }
6760
6761 /// Create a builder to help you perform the following task:
6762 ///
6763 /// Fetch upgrade information of a specific cluster.
6764 ///
6765 /// # Arguments
6766 ///
6767 /// * `name` - Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
6768 pub fn zones_clusters_fetch_cluster_upgrade_info(
6769 &self,
6770 name: &str,
6771 ) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
6772 ProjectZoneClusterFetchClusterUpgradeInfoCall {
6773 hub: self.hub,
6774 _name: name.to_string(),
6775 _version: Default::default(),
6776 _delegate: Default::default(),
6777 _additional_params: Default::default(),
6778 _scopes: Default::default(),
6779 }
6780 }
6781
6782 /// Create a builder to help you perform the following task:
6783 ///
6784 /// Gets the details of a specific cluster.
6785 ///
6786 /// # Arguments
6787 ///
6788 /// * `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.
6789 /// * `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.
6790 /// * `clusterId` - Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
6791 pub fn zones_clusters_get(
6792 &self,
6793 project_id: &str,
6794 zone: &str,
6795 cluster_id: &str,
6796 ) -> ProjectZoneClusterGetCall<'a, C> {
6797 ProjectZoneClusterGetCall {
6798 hub: self.hub,
6799 _project_id: project_id.to_string(),
6800 _zone: zone.to_string(),
6801 _cluster_id: cluster_id.to_string(),
6802 _name: Default::default(),
6803 _delegate: Default::default(),
6804 _additional_params: Default::default(),
6805 _scopes: Default::default(),
6806 }
6807 }
6808
6809 /// Create a builder to help you perform the following task:
6810 ///
6811 /// Enables or disables the ABAC authorization mechanism on a cluster.
6812 ///
6813 /// # Arguments
6814 ///
6815 /// * `request` - No description provided.
6816 /// * `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.
6817 /// * `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.
6818 /// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
6819 pub fn zones_clusters_legacy_abac(
6820 &self,
6821 request: SetLegacyAbacRequest,
6822 project_id: &str,
6823 zone: &str,
6824 cluster_id: &str,
6825 ) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
6826 ProjectZoneClusterLegacyAbacCall {
6827 hub: self.hub,
6828 _request: request,
6829 _project_id: project_id.to_string(),
6830 _zone: zone.to_string(),
6831 _cluster_id: cluster_id.to_string(),
6832 _delegate: Default::default(),
6833 _additional_params: Default::default(),
6834 _scopes: Default::default(),
6835 }
6836 }
6837
6838 /// Create a builder to help you perform the following task:
6839 ///
6840 /// Lists all clusters owned by a project in either the specified zone or all zones.
6841 ///
6842 /// # Arguments
6843 ///
6844 /// * `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.
6845 /// * `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.
6846 pub fn zones_clusters_list(
6847 &self,
6848 project_id: &str,
6849 zone: &str,
6850 ) -> ProjectZoneClusterListCall<'a, C> {
6851 ProjectZoneClusterListCall {
6852 hub: self.hub,
6853 _project_id: project_id.to_string(),
6854 _zone: zone.to_string(),
6855 _parent: Default::default(),
6856 _delegate: Default::default(),
6857 _additional_params: Default::default(),
6858 _scopes: Default::default(),
6859 }
6860 }
6861
6862 /// Create a builder to help you perform the following task:
6863 ///
6864 /// 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.
6865 ///
6866 /// # Arguments
6867 ///
6868 /// * `request` - No description provided.
6869 /// * `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.
6870 /// * `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.
6871 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
6872 pub fn zones_clusters_locations(
6873 &self,
6874 request: SetLocationsRequest,
6875 project_id: &str,
6876 zone: &str,
6877 cluster_id: &str,
6878 ) -> ProjectZoneClusterLocationCall<'a, C> {
6879 ProjectZoneClusterLocationCall {
6880 hub: self.hub,
6881 _request: request,
6882 _project_id: project_id.to_string(),
6883 _zone: zone.to_string(),
6884 _cluster_id: cluster_id.to_string(),
6885 _delegate: Default::default(),
6886 _additional_params: Default::default(),
6887 _scopes: Default::default(),
6888 }
6889 }
6890
6891 /// Create a builder to help you perform the following task:
6892 ///
6893 /// Sets the logging service for a specific cluster.
6894 ///
6895 /// # Arguments
6896 ///
6897 /// * `request` - No description provided.
6898 /// * `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.
6899 /// * `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.
6900 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
6901 pub fn zones_clusters_logging(
6902 &self,
6903 request: SetLoggingServiceRequest,
6904 project_id: &str,
6905 zone: &str,
6906 cluster_id: &str,
6907 ) -> ProjectZoneClusterLoggingCall<'a, C> {
6908 ProjectZoneClusterLoggingCall {
6909 hub: self.hub,
6910 _request: request,
6911 _project_id: project_id.to_string(),
6912 _zone: zone.to_string(),
6913 _cluster_id: cluster_id.to_string(),
6914 _delegate: Default::default(),
6915 _additional_params: Default::default(),
6916 _scopes: Default::default(),
6917 }
6918 }
6919
6920 /// Create a builder to help you perform the following task:
6921 ///
6922 /// Updates the master for a specific cluster.
6923 ///
6924 /// # Arguments
6925 ///
6926 /// * `request` - No description provided.
6927 /// * `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.
6928 /// * `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.
6929 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
6930 pub fn zones_clusters_master(
6931 &self,
6932 request: UpdateMasterRequest,
6933 project_id: &str,
6934 zone: &str,
6935 cluster_id: &str,
6936 ) -> ProjectZoneClusterMasterCall<'a, C> {
6937 ProjectZoneClusterMasterCall {
6938 hub: self.hub,
6939 _request: request,
6940 _project_id: project_id.to_string(),
6941 _zone: zone.to_string(),
6942 _cluster_id: cluster_id.to_string(),
6943 _delegate: Default::default(),
6944 _additional_params: Default::default(),
6945 _scopes: Default::default(),
6946 }
6947 }
6948
6949 /// Create a builder to help you perform the following task:
6950 ///
6951 /// Sets the monitoring service for a specific cluster.
6952 ///
6953 /// # Arguments
6954 ///
6955 /// * `request` - No description provided.
6956 /// * `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.
6957 /// * `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.
6958 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
6959 pub fn zones_clusters_monitoring(
6960 &self,
6961 request: SetMonitoringServiceRequest,
6962 project_id: &str,
6963 zone: &str,
6964 cluster_id: &str,
6965 ) -> ProjectZoneClusterMonitoringCall<'a, C> {
6966 ProjectZoneClusterMonitoringCall {
6967 hub: self.hub,
6968 _request: request,
6969 _project_id: project_id.to_string(),
6970 _zone: zone.to_string(),
6971 _cluster_id: cluster_id.to_string(),
6972 _delegate: Default::default(),
6973 _additional_params: Default::default(),
6974 _scopes: Default::default(),
6975 }
6976 }
6977
6978 /// Create a builder to help you perform the following task:
6979 ///
6980 /// Sets labels on a cluster.
6981 ///
6982 /// # Arguments
6983 ///
6984 /// * `request` - No description provided.
6985 /// * `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.
6986 /// * `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.
6987 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
6988 pub fn zones_clusters_resource_labels(
6989 &self,
6990 request: SetLabelsRequest,
6991 project_id: &str,
6992 zone: &str,
6993 cluster_id: &str,
6994 ) -> ProjectZoneClusterResourceLabelCall<'a, C> {
6995 ProjectZoneClusterResourceLabelCall {
6996 hub: self.hub,
6997 _request: request,
6998 _project_id: project_id.to_string(),
6999 _zone: zone.to_string(),
7000 _cluster_id: cluster_id.to_string(),
7001 _delegate: Default::default(),
7002 _additional_params: Default::default(),
7003 _scopes: Default::default(),
7004 }
7005 }
7006
7007 /// Create a builder to help you perform the following task:
7008 ///
7009 /// Sets the maintenance policy for a cluster.
7010 ///
7011 /// # Arguments
7012 ///
7013 /// * `request` - No description provided.
7014 /// * `projectId` - Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
7015 /// * `zone` - Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
7016 /// * `clusterId` - Required. The name of the cluster to update.
7017 pub fn zones_clusters_set_maintenance_policy(
7018 &self,
7019 request: SetMaintenancePolicyRequest,
7020 project_id: &str,
7021 zone: &str,
7022 cluster_id: &str,
7023 ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
7024 ProjectZoneClusterSetMaintenancePolicyCall {
7025 hub: self.hub,
7026 _request: request,
7027 _project_id: project_id.to_string(),
7028 _zone: zone.to_string(),
7029 _cluster_id: cluster_id.to_string(),
7030 _delegate: Default::default(),
7031 _additional_params: Default::default(),
7032 _scopes: Default::default(),
7033 }
7034 }
7035
7036 /// Create a builder to help you perform the following task:
7037 ///
7038 /// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
7039 ///
7040 /// # Arguments
7041 ///
7042 /// * `request` - No description provided.
7043 /// * `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.
7044 /// * `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.
7045 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
7046 pub fn zones_clusters_set_master_auth(
7047 &self,
7048 request: SetMasterAuthRequest,
7049 project_id: &str,
7050 zone: &str,
7051 cluster_id: &str,
7052 ) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
7053 ProjectZoneClusterSetMasterAuthCall {
7054 hub: self.hub,
7055 _request: request,
7056 _project_id: project_id.to_string(),
7057 _zone: zone.to_string(),
7058 _cluster_id: cluster_id.to_string(),
7059 _delegate: Default::default(),
7060 _additional_params: Default::default(),
7061 _scopes: Default::default(),
7062 }
7063 }
7064
7065 /// Create a builder to help you perform the following task:
7066 ///
7067 /// Enables or disables Network Policy for a cluster.
7068 ///
7069 /// # Arguments
7070 ///
7071 /// * `request` - No description provided.
7072 /// * `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.
7073 /// * `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.
7074 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
7075 pub fn zones_clusters_set_network_policy(
7076 &self,
7077 request: SetNetworkPolicyRequest,
7078 project_id: &str,
7079 zone: &str,
7080 cluster_id: &str,
7081 ) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
7082 ProjectZoneClusterSetNetworkPolicyCall {
7083 hub: self.hub,
7084 _request: request,
7085 _project_id: project_id.to_string(),
7086 _zone: zone.to_string(),
7087 _cluster_id: cluster_id.to_string(),
7088 _delegate: Default::default(),
7089 _additional_params: Default::default(),
7090 _scopes: Default::default(),
7091 }
7092 }
7093
7094 /// Create a builder to help you perform the following task:
7095 ///
7096 /// Starts master IP rotation.
7097 ///
7098 /// # Arguments
7099 ///
7100 /// * `request` - No description provided.
7101 /// * `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.
7102 /// * `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.
7103 /// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
7104 pub fn zones_clusters_start_ip_rotation(
7105 &self,
7106 request: StartIPRotationRequest,
7107 project_id: &str,
7108 zone: &str,
7109 cluster_id: &str,
7110 ) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
7111 ProjectZoneClusterStartIpRotationCall {
7112 hub: self.hub,
7113 _request: request,
7114 _project_id: project_id.to_string(),
7115 _zone: zone.to_string(),
7116 _cluster_id: cluster_id.to_string(),
7117 _delegate: Default::default(),
7118 _additional_params: Default::default(),
7119 _scopes: Default::default(),
7120 }
7121 }
7122
7123 /// Create a builder to help you perform the following task:
7124 ///
7125 /// Updates the settings of a specific cluster.
7126 ///
7127 /// # Arguments
7128 ///
7129 /// * `request` - No description provided.
7130 /// * `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.
7131 /// * `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.
7132 /// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
7133 pub fn zones_clusters_update(
7134 &self,
7135 request: UpdateClusterRequest,
7136 project_id: &str,
7137 zone: &str,
7138 cluster_id: &str,
7139 ) -> ProjectZoneClusterUpdateCall<'a, C> {
7140 ProjectZoneClusterUpdateCall {
7141 hub: self.hub,
7142 _request: request,
7143 _project_id: project_id.to_string(),
7144 _zone: zone.to_string(),
7145 _cluster_id: cluster_id.to_string(),
7146 _delegate: Default::default(),
7147 _additional_params: Default::default(),
7148 _scopes: Default::default(),
7149 }
7150 }
7151
7152 /// Create a builder to help you perform the following task:
7153 ///
7154 /// Cancels the specified operation.
7155 ///
7156 /// # Arguments
7157 ///
7158 /// * `request` - No description provided.
7159 /// * `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.
7160 /// * `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.
7161 /// * `operationId` - Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
7162 pub fn zones_operations_cancel(
7163 &self,
7164 request: CancelOperationRequest,
7165 project_id: &str,
7166 zone: &str,
7167 operation_id: &str,
7168 ) -> ProjectZoneOperationCancelCall<'a, C> {
7169 ProjectZoneOperationCancelCall {
7170 hub: self.hub,
7171 _request: request,
7172 _project_id: project_id.to_string(),
7173 _zone: zone.to_string(),
7174 _operation_id: operation_id.to_string(),
7175 _delegate: Default::default(),
7176 _additional_params: Default::default(),
7177 _scopes: Default::default(),
7178 }
7179 }
7180
7181 /// Create a builder to help you perform the following task:
7182 ///
7183 /// Gets the specified operation.
7184 ///
7185 /// # Arguments
7186 ///
7187 /// * `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.
7188 /// * `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.
7189 /// * `operationId` - Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
7190 pub fn zones_operations_get(
7191 &self,
7192 project_id: &str,
7193 zone: &str,
7194 operation_id: &str,
7195 ) -> ProjectZoneOperationGetCall<'a, C> {
7196 ProjectZoneOperationGetCall {
7197 hub: self.hub,
7198 _project_id: project_id.to_string(),
7199 _zone: zone.to_string(),
7200 _operation_id: operation_id.to_string(),
7201 _name: Default::default(),
7202 _delegate: Default::default(),
7203 _additional_params: Default::default(),
7204 _scopes: Default::default(),
7205 }
7206 }
7207
7208 /// Create a builder to help you perform the following task:
7209 ///
7210 /// Lists all operations in a project in a specific zone or all zones.
7211 ///
7212 /// # Arguments
7213 ///
7214 /// * `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.
7215 /// * `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.
7216 pub fn zones_operations_list(
7217 &self,
7218 project_id: &str,
7219 zone: &str,
7220 ) -> ProjectZoneOperationListCall<'a, C> {
7221 ProjectZoneOperationListCall {
7222 hub: self.hub,
7223 _project_id: project_id.to_string(),
7224 _zone: zone.to_string(),
7225 _parent: Default::default(),
7226 _delegate: Default::default(),
7227 _additional_params: Default::default(),
7228 _scopes: Default::default(),
7229 }
7230 }
7231
7232 /// Create a builder to help you perform the following task:
7233 ///
7234 /// Returns configuration info about the Google Kubernetes Engine service.
7235 ///
7236 /// # Arguments
7237 ///
7238 /// * `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.
7239 /// * `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.
7240 pub fn zones_get_serverconfig(
7241 &self,
7242 project_id: &str,
7243 zone: &str,
7244 ) -> ProjectZoneGetServerconfigCall<'a, C> {
7245 ProjectZoneGetServerconfigCall {
7246 hub: self.hub,
7247 _project_id: project_id.to_string(),
7248 _zone: zone.to_string(),
7249 _name: Default::default(),
7250 _delegate: Default::default(),
7251 _additional_params: Default::default(),
7252 _scopes: Default::default(),
7253 }
7254 }
7255}
7256
7257// ###################
7258// CallBuilders ###
7259// #################
7260
7261/// Lists subnetworks that are usable for creating clusters in a project.
7262///
7263/// A builder for the *aggregated.usableSubnetworks.list* method supported by a *project* resource.
7264/// It is not used directly, but through a [`ProjectMethods`] instance.
7265///
7266/// # Example
7267///
7268/// Instantiate a resource method builder
7269///
7270/// ```test_harness,no_run
7271/// # extern crate hyper;
7272/// # extern crate hyper_rustls;
7273/// # extern crate google_container1 as container1;
7274/// # async fn dox() {
7275/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7276///
7277/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7278/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7279/// # .with_native_roots()
7280/// # .unwrap()
7281/// # .https_only()
7282/// # .enable_http2()
7283/// # .build();
7284///
7285/// # let executor = hyper_util::rt::TokioExecutor::new();
7286/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7287/// # secret,
7288/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7289/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7290/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7291/// # ),
7292/// # ).build().await.unwrap();
7293///
7294/// # let client = hyper_util::client::legacy::Client::builder(
7295/// # hyper_util::rt::TokioExecutor::new()
7296/// # )
7297/// # .build(
7298/// # hyper_rustls::HttpsConnectorBuilder::new()
7299/// # .with_native_roots()
7300/// # .unwrap()
7301/// # .https_or_http()
7302/// # .enable_http2()
7303/// # .build()
7304/// # );
7305/// # let mut hub = Container::new(client, auth);
7306/// // You can configure optional parameters by calling the respective setters at will, and
7307/// // execute the final call using `doit()`.
7308/// // Values shown here are possibly random and not representative !
7309/// let result = hub.projects().aggregated_usable_subnetworks_list("parent")
7310/// .page_token("eos")
7311/// .page_size(-4)
7312/// .filter("ea")
7313/// .doit().await;
7314/// # }
7315/// ```
7316pub struct ProjectAggregatedUsableSubnetworkListCall<'a, C>
7317where
7318 C: 'a,
7319{
7320 hub: &'a Container<C>,
7321 _parent: String,
7322 _page_token: Option<String>,
7323 _page_size: Option<i32>,
7324 _filter: Option<String>,
7325 _delegate: Option<&'a mut dyn common::Delegate>,
7326 _additional_params: HashMap<String, String>,
7327 _scopes: BTreeSet<String>,
7328}
7329
7330impl<'a, C> common::CallBuilder for ProjectAggregatedUsableSubnetworkListCall<'a, C> {}
7331
7332impl<'a, C> ProjectAggregatedUsableSubnetworkListCall<'a, C>
7333where
7334 C: common::Connector,
7335{
7336 /// Perform the operation you have build so far.
7337 pub async fn doit(
7338 mut self,
7339 ) -> common::Result<(common::Response, ListUsableSubnetworksResponse)> {
7340 use std::borrow::Cow;
7341 use std::io::{Read, Seek};
7342
7343 use common::{url::Params, ToParts};
7344 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7345
7346 let mut dd = common::DefaultDelegate;
7347 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7348 dlg.begin(common::MethodInfo {
7349 id: "container.projects.aggregated.usableSubnetworks.list",
7350 http_method: hyper::Method::GET,
7351 });
7352
7353 for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
7354 if self._additional_params.contains_key(field) {
7355 dlg.finished(false);
7356 return Err(common::Error::FieldClash(field));
7357 }
7358 }
7359
7360 let mut params = Params::with_capacity(6 + self._additional_params.len());
7361 params.push("parent", self._parent);
7362 if let Some(value) = self._page_token.as_ref() {
7363 params.push("pageToken", value);
7364 }
7365 if let Some(value) = self._page_size.as_ref() {
7366 params.push("pageSize", value.to_string());
7367 }
7368 if let Some(value) = self._filter.as_ref() {
7369 params.push("filter", value);
7370 }
7371
7372 params.extend(self._additional_params.iter());
7373
7374 params.push("alt", "json");
7375 let mut url = self.hub._base_url.clone() + "v1/{+parent}/aggregated/usableSubnetworks";
7376 if self._scopes.is_empty() {
7377 self._scopes
7378 .insert(Scope::CloudPlatform.as_ref().to_string());
7379 }
7380
7381 #[allow(clippy::single_element_loop)]
7382 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
7383 url = params.uri_replacement(url, param_name, find_this, true);
7384 }
7385 {
7386 let to_remove = ["parent"];
7387 params.remove_params(&to_remove);
7388 }
7389
7390 let url = params.parse_with_url(&url);
7391
7392 loop {
7393 let token = match self
7394 .hub
7395 .auth
7396 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7397 .await
7398 {
7399 Ok(token) => token,
7400 Err(e) => match dlg.token(e) {
7401 Ok(token) => token,
7402 Err(e) => {
7403 dlg.finished(false);
7404 return Err(common::Error::MissingToken(e));
7405 }
7406 },
7407 };
7408 let mut req_result = {
7409 let client = &self.hub.client;
7410 dlg.pre_request();
7411 let mut req_builder = hyper::Request::builder()
7412 .method(hyper::Method::GET)
7413 .uri(url.as_str())
7414 .header(USER_AGENT, self.hub._user_agent.clone());
7415
7416 if let Some(token) = token.as_ref() {
7417 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7418 }
7419
7420 let request = req_builder
7421 .header(CONTENT_LENGTH, 0_u64)
7422 .body(common::to_body::<String>(None));
7423
7424 client.request(request.unwrap()).await
7425 };
7426
7427 match req_result {
7428 Err(err) => {
7429 if let common::Retry::After(d) = dlg.http_error(&err) {
7430 sleep(d).await;
7431 continue;
7432 }
7433 dlg.finished(false);
7434 return Err(common::Error::HttpError(err));
7435 }
7436 Ok(res) => {
7437 let (mut parts, body) = res.into_parts();
7438 let mut body = common::Body::new(body);
7439 if !parts.status.is_success() {
7440 let bytes = common::to_bytes(body).await.unwrap_or_default();
7441 let error = serde_json::from_str(&common::to_string(&bytes));
7442 let response = common::to_response(parts, bytes.into());
7443
7444 if let common::Retry::After(d) =
7445 dlg.http_failure(&response, error.as_ref().ok())
7446 {
7447 sleep(d).await;
7448 continue;
7449 }
7450
7451 dlg.finished(false);
7452
7453 return Err(match error {
7454 Ok(value) => common::Error::BadRequest(value),
7455 _ => common::Error::Failure(response),
7456 });
7457 }
7458 let response = {
7459 let bytes = common::to_bytes(body).await.unwrap_or_default();
7460 let encoded = common::to_string(&bytes);
7461 match serde_json::from_str(&encoded) {
7462 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7463 Err(error) => {
7464 dlg.response_json_decode_error(&encoded, &error);
7465 return Err(common::Error::JsonDecodeError(
7466 encoded.to_string(),
7467 error,
7468 ));
7469 }
7470 }
7471 };
7472
7473 dlg.finished(true);
7474 return Ok(response);
7475 }
7476 }
7477 }
7478 }
7479
7480 /// The parent project where subnetworks are usable. Specified in the format `projects/*`.
7481 ///
7482 /// Sets the *parent* path property to the given value.
7483 ///
7484 /// Even though the property as already been set when instantiating this call,
7485 /// we provide this method for API completeness.
7486 pub fn parent(mut self, new_value: &str) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
7487 self._parent = new_value.to_string();
7488 self
7489 }
7490 /// Specifies a page token to use. Set this to the nextPageToken returned by previous list requests to get the next page of results.
7491 ///
7492 /// Sets the *page token* query property to the given value.
7493 pub fn page_token(
7494 mut self,
7495 new_value: &str,
7496 ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
7497 self._page_token = Some(new_value.to_string());
7498 self
7499 }
7500 /// 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)
7501 ///
7502 /// Sets the *page size* query property to the given value.
7503 pub fn page_size(mut self, new_value: i32) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
7504 self._page_size = Some(new_value);
7505 self
7506 }
7507 /// 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.
7508 ///
7509 /// Sets the *filter* query property to the given value.
7510 pub fn filter(mut self, new_value: &str) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
7511 self._filter = Some(new_value.to_string());
7512 self
7513 }
7514 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7515 /// while executing the actual API request.
7516 ///
7517 /// ````text
7518 /// It should be used to handle progress information, and to implement a certain level of resilience.
7519 /// ````
7520 ///
7521 /// Sets the *delegate* property to the given value.
7522 pub fn delegate(
7523 mut self,
7524 new_value: &'a mut dyn common::Delegate,
7525 ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
7526 self._delegate = Some(new_value);
7527 self
7528 }
7529
7530 /// Set any additional parameter of the query string used in the request.
7531 /// It should be used to set parameters which are not yet available through their own
7532 /// setters.
7533 ///
7534 /// Please note that this method must not be used to set any of the known parameters
7535 /// which have their own setter method. If done anyway, the request will fail.
7536 ///
7537 /// # Additional Parameters
7538 ///
7539 /// * *$.xgafv* (query-string) - V1 error format.
7540 /// * *access_token* (query-string) - OAuth access token.
7541 /// * *alt* (query-string) - Data format for response.
7542 /// * *callback* (query-string) - JSONP
7543 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7544 /// * *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.
7545 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7546 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7547 /// * *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.
7548 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7549 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7550 pub fn param<T>(mut self, name: T, value: T) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
7551 where
7552 T: AsRef<str>,
7553 {
7554 self._additional_params
7555 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7556 self
7557 }
7558
7559 /// Identifies the authorization scope for the method you are building.
7560 ///
7561 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7562 /// [`Scope::CloudPlatform`].
7563 ///
7564 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7565 /// tokens for more than one scope.
7566 ///
7567 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7568 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7569 /// sufficient, a read-write scope will do as well.
7570 pub fn add_scope<St>(mut self, scope: St) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
7571 where
7572 St: AsRef<str>,
7573 {
7574 self._scopes.insert(String::from(scope.as_ref()));
7575 self
7576 }
7577 /// Identifies the authorization scope(s) for the method you are building.
7578 ///
7579 /// See [`Self::add_scope()`] for details.
7580 pub fn add_scopes<I, St>(
7581 mut self,
7582 scopes: I,
7583 ) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
7584 where
7585 I: IntoIterator<Item = St>,
7586 St: AsRef<str>,
7587 {
7588 self._scopes
7589 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7590 self
7591 }
7592
7593 /// Removes all scopes, and no default scope will be used either.
7594 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7595 /// for details).
7596 pub fn clear_scopes(mut self) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
7597 self._scopes.clear();
7598 self
7599 }
7600}
7601
7602/// CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.
7603///
7604/// A builder for the *locations.clusters.nodePools.completeUpgrade* method supported by a *project* resource.
7605/// It is not used directly, but through a [`ProjectMethods`] instance.
7606///
7607/// # Example
7608///
7609/// Instantiate a resource method builder
7610///
7611/// ```test_harness,no_run
7612/// # extern crate hyper;
7613/// # extern crate hyper_rustls;
7614/// # extern crate google_container1 as container1;
7615/// use container1::api::CompleteNodePoolUpgradeRequest;
7616/// # async fn dox() {
7617/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7618///
7619/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7620/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7621/// # .with_native_roots()
7622/// # .unwrap()
7623/// # .https_only()
7624/// # .enable_http2()
7625/// # .build();
7626///
7627/// # let executor = hyper_util::rt::TokioExecutor::new();
7628/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7629/// # secret,
7630/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7631/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7632/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7633/// # ),
7634/// # ).build().await.unwrap();
7635///
7636/// # let client = hyper_util::client::legacy::Client::builder(
7637/// # hyper_util::rt::TokioExecutor::new()
7638/// # )
7639/// # .build(
7640/// # hyper_rustls::HttpsConnectorBuilder::new()
7641/// # .with_native_roots()
7642/// # .unwrap()
7643/// # .https_or_http()
7644/// # .enable_http2()
7645/// # .build()
7646/// # );
7647/// # let mut hub = Container::new(client, auth);
7648/// // As the method needs a request, you would usually fill it with the desired information
7649/// // into the respective structure. Some of the parts shown here might not be applicable !
7650/// // Values shown here are possibly random and not representative !
7651/// let mut req = CompleteNodePoolUpgradeRequest::default();
7652///
7653/// // You can configure optional parameters by calling the respective setters at will, and
7654/// // execute the final call using `doit()`.
7655/// // Values shown here are possibly random and not representative !
7656/// let result = hub.projects().locations_clusters_node_pools_complete_upgrade(req, "name")
7657/// .doit().await;
7658/// # }
7659/// ```
7660pub struct ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
7661where
7662 C: 'a,
7663{
7664 hub: &'a Container<C>,
7665 _request: CompleteNodePoolUpgradeRequest,
7666 _name: String,
7667 _delegate: Option<&'a mut dyn common::Delegate>,
7668 _additional_params: HashMap<String, String>,
7669 _scopes: BTreeSet<String>,
7670}
7671
7672impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {}
7673
7674impl<'a, C> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
7675where
7676 C: common::Connector,
7677{
7678 /// Perform the operation you have build so far.
7679 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
7680 use std::borrow::Cow;
7681 use std::io::{Read, Seek};
7682
7683 use common::{url::Params, ToParts};
7684 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
7685
7686 let mut dd = common::DefaultDelegate;
7687 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
7688 dlg.begin(common::MethodInfo {
7689 id: "container.projects.locations.clusters.nodePools.completeUpgrade",
7690 http_method: hyper::Method::POST,
7691 });
7692
7693 for &field in ["alt", "name"].iter() {
7694 if self._additional_params.contains_key(field) {
7695 dlg.finished(false);
7696 return Err(common::Error::FieldClash(field));
7697 }
7698 }
7699
7700 let mut params = Params::with_capacity(4 + self._additional_params.len());
7701 params.push("name", self._name);
7702
7703 params.extend(self._additional_params.iter());
7704
7705 params.push("alt", "json");
7706 let mut url = self.hub._base_url.clone() + "v1/{+name}:completeUpgrade";
7707 if self._scopes.is_empty() {
7708 self._scopes
7709 .insert(Scope::CloudPlatform.as_ref().to_string());
7710 }
7711
7712 #[allow(clippy::single_element_loop)]
7713 for &(find_this, param_name) in [("{+name}", "name")].iter() {
7714 url = params.uri_replacement(url, param_name, find_this, true);
7715 }
7716 {
7717 let to_remove = ["name"];
7718 params.remove_params(&to_remove);
7719 }
7720
7721 let url = params.parse_with_url(&url);
7722
7723 let mut json_mime_type = mime::APPLICATION_JSON;
7724 let mut request_value_reader = {
7725 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
7726 common::remove_json_null_values(&mut value);
7727 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
7728 serde_json::to_writer(&mut dst, &value).unwrap();
7729 dst
7730 };
7731 let request_size = request_value_reader
7732 .seek(std::io::SeekFrom::End(0))
7733 .unwrap();
7734 request_value_reader
7735 .seek(std::io::SeekFrom::Start(0))
7736 .unwrap();
7737
7738 loop {
7739 let token = match self
7740 .hub
7741 .auth
7742 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
7743 .await
7744 {
7745 Ok(token) => token,
7746 Err(e) => match dlg.token(e) {
7747 Ok(token) => token,
7748 Err(e) => {
7749 dlg.finished(false);
7750 return Err(common::Error::MissingToken(e));
7751 }
7752 },
7753 };
7754 request_value_reader
7755 .seek(std::io::SeekFrom::Start(0))
7756 .unwrap();
7757 let mut req_result = {
7758 let client = &self.hub.client;
7759 dlg.pre_request();
7760 let mut req_builder = hyper::Request::builder()
7761 .method(hyper::Method::POST)
7762 .uri(url.as_str())
7763 .header(USER_AGENT, self.hub._user_agent.clone());
7764
7765 if let Some(token) = token.as_ref() {
7766 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
7767 }
7768
7769 let request = req_builder
7770 .header(CONTENT_TYPE, json_mime_type.to_string())
7771 .header(CONTENT_LENGTH, request_size as u64)
7772 .body(common::to_body(
7773 request_value_reader.get_ref().clone().into(),
7774 ));
7775
7776 client.request(request.unwrap()).await
7777 };
7778
7779 match req_result {
7780 Err(err) => {
7781 if let common::Retry::After(d) = dlg.http_error(&err) {
7782 sleep(d).await;
7783 continue;
7784 }
7785 dlg.finished(false);
7786 return Err(common::Error::HttpError(err));
7787 }
7788 Ok(res) => {
7789 let (mut parts, body) = res.into_parts();
7790 let mut body = common::Body::new(body);
7791 if !parts.status.is_success() {
7792 let bytes = common::to_bytes(body).await.unwrap_or_default();
7793 let error = serde_json::from_str(&common::to_string(&bytes));
7794 let response = common::to_response(parts, bytes.into());
7795
7796 if let common::Retry::After(d) =
7797 dlg.http_failure(&response, error.as_ref().ok())
7798 {
7799 sleep(d).await;
7800 continue;
7801 }
7802
7803 dlg.finished(false);
7804
7805 return Err(match error {
7806 Ok(value) => common::Error::BadRequest(value),
7807 _ => common::Error::Failure(response),
7808 });
7809 }
7810 let response = {
7811 let bytes = common::to_bytes(body).await.unwrap_or_default();
7812 let encoded = common::to_string(&bytes);
7813 match serde_json::from_str(&encoded) {
7814 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
7815 Err(error) => {
7816 dlg.response_json_decode_error(&encoded, &error);
7817 return Err(common::Error::JsonDecodeError(
7818 encoded.to_string(),
7819 error,
7820 ));
7821 }
7822 }
7823 };
7824
7825 dlg.finished(true);
7826 return Ok(response);
7827 }
7828 }
7829 }
7830 }
7831
7832 ///
7833 /// Sets the *request* property to the given value.
7834 ///
7835 /// Even though the property as already been set when instantiating this call,
7836 /// we provide this method for API completeness.
7837 pub fn request(
7838 mut self,
7839 new_value: CompleteNodePoolUpgradeRequest,
7840 ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
7841 self._request = new_value;
7842 self
7843 }
7844 /// The name (project, location, cluster, node pool id) of the node pool to complete upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
7845 ///
7846 /// Sets the *name* path property to the given value.
7847 ///
7848 /// Even though the property as already been set when instantiating this call,
7849 /// we provide this method for API completeness.
7850 pub fn name(
7851 mut self,
7852 new_value: &str,
7853 ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
7854 self._name = new_value.to_string();
7855 self
7856 }
7857 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
7858 /// while executing the actual API request.
7859 ///
7860 /// ````text
7861 /// It should be used to handle progress information, and to implement a certain level of resilience.
7862 /// ````
7863 ///
7864 /// Sets the *delegate* property to the given value.
7865 pub fn delegate(
7866 mut self,
7867 new_value: &'a mut dyn common::Delegate,
7868 ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
7869 self._delegate = Some(new_value);
7870 self
7871 }
7872
7873 /// Set any additional parameter of the query string used in the request.
7874 /// It should be used to set parameters which are not yet available through their own
7875 /// setters.
7876 ///
7877 /// Please note that this method must not be used to set any of the known parameters
7878 /// which have their own setter method. If done anyway, the request will fail.
7879 ///
7880 /// # Additional Parameters
7881 ///
7882 /// * *$.xgafv* (query-string) - V1 error format.
7883 /// * *access_token* (query-string) - OAuth access token.
7884 /// * *alt* (query-string) - Data format for response.
7885 /// * *callback* (query-string) - JSONP
7886 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
7887 /// * *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.
7888 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
7889 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
7890 /// * *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.
7891 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
7892 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
7893 pub fn param<T>(
7894 mut self,
7895 name: T,
7896 value: T,
7897 ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
7898 where
7899 T: AsRef<str>,
7900 {
7901 self._additional_params
7902 .insert(name.as_ref().to_string(), value.as_ref().to_string());
7903 self
7904 }
7905
7906 /// Identifies the authorization scope for the method you are building.
7907 ///
7908 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
7909 /// [`Scope::CloudPlatform`].
7910 ///
7911 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
7912 /// tokens for more than one scope.
7913 ///
7914 /// Usually there is more than one suitable scope to authorize an operation, some of which may
7915 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
7916 /// sufficient, a read-write scope will do as well.
7917 pub fn add_scope<St>(
7918 mut self,
7919 scope: St,
7920 ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
7921 where
7922 St: AsRef<str>,
7923 {
7924 self._scopes.insert(String::from(scope.as_ref()));
7925 self
7926 }
7927 /// Identifies the authorization scope(s) for the method you are building.
7928 ///
7929 /// See [`Self::add_scope()`] for details.
7930 pub fn add_scopes<I, St>(
7931 mut self,
7932 scopes: I,
7933 ) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
7934 where
7935 I: IntoIterator<Item = St>,
7936 St: AsRef<str>,
7937 {
7938 self._scopes
7939 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
7940 self
7941 }
7942
7943 /// Removes all scopes, and no default scope will be used either.
7944 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
7945 /// for details).
7946 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
7947 self._scopes.clear();
7948 self
7949 }
7950}
7951
7952/// Creates a node pool for a cluster.
7953///
7954/// A builder for the *locations.clusters.nodePools.create* method supported by a *project* resource.
7955/// It is not used directly, but through a [`ProjectMethods`] instance.
7956///
7957/// # Example
7958///
7959/// Instantiate a resource method builder
7960///
7961/// ```test_harness,no_run
7962/// # extern crate hyper;
7963/// # extern crate hyper_rustls;
7964/// # extern crate google_container1 as container1;
7965/// use container1::api::CreateNodePoolRequest;
7966/// # async fn dox() {
7967/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
7968///
7969/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
7970/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
7971/// # .with_native_roots()
7972/// # .unwrap()
7973/// # .https_only()
7974/// # .enable_http2()
7975/// # .build();
7976///
7977/// # let executor = hyper_util::rt::TokioExecutor::new();
7978/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
7979/// # secret,
7980/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
7981/// # yup_oauth2::client::CustomHyperClientBuilder::from(
7982/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
7983/// # ),
7984/// # ).build().await.unwrap();
7985///
7986/// # let client = hyper_util::client::legacy::Client::builder(
7987/// # hyper_util::rt::TokioExecutor::new()
7988/// # )
7989/// # .build(
7990/// # hyper_rustls::HttpsConnectorBuilder::new()
7991/// # .with_native_roots()
7992/// # .unwrap()
7993/// # .https_or_http()
7994/// # .enable_http2()
7995/// # .build()
7996/// # );
7997/// # let mut hub = Container::new(client, auth);
7998/// // As the method needs a request, you would usually fill it with the desired information
7999/// // into the respective structure. Some of the parts shown here might not be applicable !
8000/// // Values shown here are possibly random and not representative !
8001/// let mut req = CreateNodePoolRequest::default();
8002///
8003/// // You can configure optional parameters by calling the respective setters at will, and
8004/// // execute the final call using `doit()`.
8005/// // Values shown here are possibly random and not representative !
8006/// let result = hub.projects().locations_clusters_node_pools_create(req, "parent")
8007/// .doit().await;
8008/// # }
8009/// ```
8010pub struct ProjectLocationClusterNodePoolCreateCall<'a, C>
8011where
8012 C: 'a,
8013{
8014 hub: &'a Container<C>,
8015 _request: CreateNodePoolRequest,
8016 _parent: String,
8017 _delegate: Option<&'a mut dyn common::Delegate>,
8018 _additional_params: HashMap<String, String>,
8019 _scopes: BTreeSet<String>,
8020}
8021
8022impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolCreateCall<'a, C> {}
8023
8024impl<'a, C> ProjectLocationClusterNodePoolCreateCall<'a, C>
8025where
8026 C: common::Connector,
8027{
8028 /// Perform the operation you have build so far.
8029 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8030 use std::borrow::Cow;
8031 use std::io::{Read, Seek};
8032
8033 use common::{url::Params, ToParts};
8034 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8035
8036 let mut dd = common::DefaultDelegate;
8037 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8038 dlg.begin(common::MethodInfo {
8039 id: "container.projects.locations.clusters.nodePools.create",
8040 http_method: hyper::Method::POST,
8041 });
8042
8043 for &field in ["alt", "parent"].iter() {
8044 if self._additional_params.contains_key(field) {
8045 dlg.finished(false);
8046 return Err(common::Error::FieldClash(field));
8047 }
8048 }
8049
8050 let mut params = Params::with_capacity(4 + self._additional_params.len());
8051 params.push("parent", self._parent);
8052
8053 params.extend(self._additional_params.iter());
8054
8055 params.push("alt", "json");
8056 let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
8057 if self._scopes.is_empty() {
8058 self._scopes
8059 .insert(Scope::CloudPlatform.as_ref().to_string());
8060 }
8061
8062 #[allow(clippy::single_element_loop)]
8063 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
8064 url = params.uri_replacement(url, param_name, find_this, true);
8065 }
8066 {
8067 let to_remove = ["parent"];
8068 params.remove_params(&to_remove);
8069 }
8070
8071 let url = params.parse_with_url(&url);
8072
8073 let mut json_mime_type = mime::APPLICATION_JSON;
8074 let mut request_value_reader = {
8075 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
8076 common::remove_json_null_values(&mut value);
8077 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
8078 serde_json::to_writer(&mut dst, &value).unwrap();
8079 dst
8080 };
8081 let request_size = request_value_reader
8082 .seek(std::io::SeekFrom::End(0))
8083 .unwrap();
8084 request_value_reader
8085 .seek(std::io::SeekFrom::Start(0))
8086 .unwrap();
8087
8088 loop {
8089 let token = match self
8090 .hub
8091 .auth
8092 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8093 .await
8094 {
8095 Ok(token) => token,
8096 Err(e) => match dlg.token(e) {
8097 Ok(token) => token,
8098 Err(e) => {
8099 dlg.finished(false);
8100 return Err(common::Error::MissingToken(e));
8101 }
8102 },
8103 };
8104 request_value_reader
8105 .seek(std::io::SeekFrom::Start(0))
8106 .unwrap();
8107 let mut req_result = {
8108 let client = &self.hub.client;
8109 dlg.pre_request();
8110 let mut req_builder = hyper::Request::builder()
8111 .method(hyper::Method::POST)
8112 .uri(url.as_str())
8113 .header(USER_AGENT, self.hub._user_agent.clone());
8114
8115 if let Some(token) = token.as_ref() {
8116 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8117 }
8118
8119 let request = req_builder
8120 .header(CONTENT_TYPE, json_mime_type.to_string())
8121 .header(CONTENT_LENGTH, request_size as u64)
8122 .body(common::to_body(
8123 request_value_reader.get_ref().clone().into(),
8124 ));
8125
8126 client.request(request.unwrap()).await
8127 };
8128
8129 match req_result {
8130 Err(err) => {
8131 if let common::Retry::After(d) = dlg.http_error(&err) {
8132 sleep(d).await;
8133 continue;
8134 }
8135 dlg.finished(false);
8136 return Err(common::Error::HttpError(err));
8137 }
8138 Ok(res) => {
8139 let (mut parts, body) = res.into_parts();
8140 let mut body = common::Body::new(body);
8141 if !parts.status.is_success() {
8142 let bytes = common::to_bytes(body).await.unwrap_or_default();
8143 let error = serde_json::from_str(&common::to_string(&bytes));
8144 let response = common::to_response(parts, bytes.into());
8145
8146 if let common::Retry::After(d) =
8147 dlg.http_failure(&response, error.as_ref().ok())
8148 {
8149 sleep(d).await;
8150 continue;
8151 }
8152
8153 dlg.finished(false);
8154
8155 return Err(match error {
8156 Ok(value) => common::Error::BadRequest(value),
8157 _ => common::Error::Failure(response),
8158 });
8159 }
8160 let response = {
8161 let bytes = common::to_bytes(body).await.unwrap_or_default();
8162 let encoded = common::to_string(&bytes);
8163 match serde_json::from_str(&encoded) {
8164 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8165 Err(error) => {
8166 dlg.response_json_decode_error(&encoded, &error);
8167 return Err(common::Error::JsonDecodeError(
8168 encoded.to_string(),
8169 error,
8170 ));
8171 }
8172 }
8173 };
8174
8175 dlg.finished(true);
8176 return Ok(response);
8177 }
8178 }
8179 }
8180 }
8181
8182 ///
8183 /// Sets the *request* property to the given value.
8184 ///
8185 /// Even though the property as already been set when instantiating this call,
8186 /// we provide this method for API completeness.
8187 pub fn request(
8188 mut self,
8189 new_value: CreateNodePoolRequest,
8190 ) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
8191 self._request = new_value;
8192 self
8193 }
8194 /// The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
8195 ///
8196 /// Sets the *parent* path property to the given value.
8197 ///
8198 /// Even though the property as already been set when instantiating this call,
8199 /// we provide this method for API completeness.
8200 pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
8201 self._parent = new_value.to_string();
8202 self
8203 }
8204 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8205 /// while executing the actual API request.
8206 ///
8207 /// ````text
8208 /// It should be used to handle progress information, and to implement a certain level of resilience.
8209 /// ````
8210 ///
8211 /// Sets the *delegate* property to the given value.
8212 pub fn delegate(
8213 mut self,
8214 new_value: &'a mut dyn common::Delegate,
8215 ) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
8216 self._delegate = Some(new_value);
8217 self
8218 }
8219
8220 /// Set any additional parameter of the query string used in the request.
8221 /// It should be used to set parameters which are not yet available through their own
8222 /// setters.
8223 ///
8224 /// Please note that this method must not be used to set any of the known parameters
8225 /// which have their own setter method. If done anyway, the request will fail.
8226 ///
8227 /// # Additional Parameters
8228 ///
8229 /// * *$.xgafv* (query-string) - V1 error format.
8230 /// * *access_token* (query-string) - OAuth access token.
8231 /// * *alt* (query-string) - Data format for response.
8232 /// * *callback* (query-string) - JSONP
8233 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8234 /// * *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.
8235 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8236 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8237 /// * *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.
8238 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8239 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8240 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
8241 where
8242 T: AsRef<str>,
8243 {
8244 self._additional_params
8245 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8246 self
8247 }
8248
8249 /// Identifies the authorization scope for the method you are building.
8250 ///
8251 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8252 /// [`Scope::CloudPlatform`].
8253 ///
8254 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8255 /// tokens for more than one scope.
8256 ///
8257 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8258 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8259 /// sufficient, a read-write scope will do as well.
8260 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
8261 where
8262 St: AsRef<str>,
8263 {
8264 self._scopes.insert(String::from(scope.as_ref()));
8265 self
8266 }
8267 /// Identifies the authorization scope(s) for the method you are building.
8268 ///
8269 /// See [`Self::add_scope()`] for details.
8270 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
8271 where
8272 I: IntoIterator<Item = St>,
8273 St: AsRef<str>,
8274 {
8275 self._scopes
8276 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8277 self
8278 }
8279
8280 /// Removes all scopes, and no default scope will be used either.
8281 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8282 /// for details).
8283 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
8284 self._scopes.clear();
8285 self
8286 }
8287}
8288
8289/// Deletes a node pool from a cluster.
8290///
8291/// A builder for the *locations.clusters.nodePools.delete* method supported by a *project* resource.
8292/// It is not used directly, but through a [`ProjectMethods`] instance.
8293///
8294/// # Example
8295///
8296/// Instantiate a resource method builder
8297///
8298/// ```test_harness,no_run
8299/// # extern crate hyper;
8300/// # extern crate hyper_rustls;
8301/// # extern crate google_container1 as container1;
8302/// # async fn dox() {
8303/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8304///
8305/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8306/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8307/// # .with_native_roots()
8308/// # .unwrap()
8309/// # .https_only()
8310/// # .enable_http2()
8311/// # .build();
8312///
8313/// # let executor = hyper_util::rt::TokioExecutor::new();
8314/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8315/// # secret,
8316/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8317/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8318/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8319/// # ),
8320/// # ).build().await.unwrap();
8321///
8322/// # let client = hyper_util::client::legacy::Client::builder(
8323/// # hyper_util::rt::TokioExecutor::new()
8324/// # )
8325/// # .build(
8326/// # hyper_rustls::HttpsConnectorBuilder::new()
8327/// # .with_native_roots()
8328/// # .unwrap()
8329/// # .https_or_http()
8330/// # .enable_http2()
8331/// # .build()
8332/// # );
8333/// # let mut hub = Container::new(client, auth);
8334/// // You can configure optional parameters by calling the respective setters at will, and
8335/// // execute the final call using `doit()`.
8336/// // Values shown here are possibly random and not representative !
8337/// let result = hub.projects().locations_clusters_node_pools_delete("name")
8338/// .zone("duo")
8339/// .project_id("ipsum")
8340/// .node_pool_id("sed")
8341/// .cluster_id("ut")
8342/// .doit().await;
8343/// # }
8344/// ```
8345pub struct ProjectLocationClusterNodePoolDeleteCall<'a, C>
8346where
8347 C: 'a,
8348{
8349 hub: &'a Container<C>,
8350 _name: String,
8351 _zone: Option<String>,
8352 _project_id: Option<String>,
8353 _node_pool_id: Option<String>,
8354 _cluster_id: Option<String>,
8355 _delegate: Option<&'a mut dyn common::Delegate>,
8356 _additional_params: HashMap<String, String>,
8357 _scopes: BTreeSet<String>,
8358}
8359
8360impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolDeleteCall<'a, C> {}
8361
8362impl<'a, C> ProjectLocationClusterNodePoolDeleteCall<'a, C>
8363where
8364 C: common::Connector,
8365{
8366 /// Perform the operation you have build so far.
8367 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
8368 use std::borrow::Cow;
8369 use std::io::{Read, Seek};
8370
8371 use common::{url::Params, ToParts};
8372 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8373
8374 let mut dd = common::DefaultDelegate;
8375 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8376 dlg.begin(common::MethodInfo {
8377 id: "container.projects.locations.clusters.nodePools.delete",
8378 http_method: hyper::Method::DELETE,
8379 });
8380
8381 for &field in [
8382 "alt",
8383 "name",
8384 "zone",
8385 "projectId",
8386 "nodePoolId",
8387 "clusterId",
8388 ]
8389 .iter()
8390 {
8391 if self._additional_params.contains_key(field) {
8392 dlg.finished(false);
8393 return Err(common::Error::FieldClash(field));
8394 }
8395 }
8396
8397 let mut params = Params::with_capacity(7 + self._additional_params.len());
8398 params.push("name", self._name);
8399 if let Some(value) = self._zone.as_ref() {
8400 params.push("zone", value);
8401 }
8402 if let Some(value) = self._project_id.as_ref() {
8403 params.push("projectId", value);
8404 }
8405 if let Some(value) = self._node_pool_id.as_ref() {
8406 params.push("nodePoolId", value);
8407 }
8408 if let Some(value) = self._cluster_id.as_ref() {
8409 params.push("clusterId", value);
8410 }
8411
8412 params.extend(self._additional_params.iter());
8413
8414 params.push("alt", "json");
8415 let mut url = self.hub._base_url.clone() + "v1/{+name}";
8416 if self._scopes.is_empty() {
8417 self._scopes
8418 .insert(Scope::CloudPlatform.as_ref().to_string());
8419 }
8420
8421 #[allow(clippy::single_element_loop)]
8422 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8423 url = params.uri_replacement(url, param_name, find_this, true);
8424 }
8425 {
8426 let to_remove = ["name"];
8427 params.remove_params(&to_remove);
8428 }
8429
8430 let url = params.parse_with_url(&url);
8431
8432 loop {
8433 let token = match self
8434 .hub
8435 .auth
8436 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8437 .await
8438 {
8439 Ok(token) => token,
8440 Err(e) => match dlg.token(e) {
8441 Ok(token) => token,
8442 Err(e) => {
8443 dlg.finished(false);
8444 return Err(common::Error::MissingToken(e));
8445 }
8446 },
8447 };
8448 let mut req_result = {
8449 let client = &self.hub.client;
8450 dlg.pre_request();
8451 let mut req_builder = hyper::Request::builder()
8452 .method(hyper::Method::DELETE)
8453 .uri(url.as_str())
8454 .header(USER_AGENT, self.hub._user_agent.clone());
8455
8456 if let Some(token) = token.as_ref() {
8457 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8458 }
8459
8460 let request = req_builder
8461 .header(CONTENT_LENGTH, 0_u64)
8462 .body(common::to_body::<String>(None));
8463
8464 client.request(request.unwrap()).await
8465 };
8466
8467 match req_result {
8468 Err(err) => {
8469 if let common::Retry::After(d) = dlg.http_error(&err) {
8470 sleep(d).await;
8471 continue;
8472 }
8473 dlg.finished(false);
8474 return Err(common::Error::HttpError(err));
8475 }
8476 Ok(res) => {
8477 let (mut parts, body) = res.into_parts();
8478 let mut body = common::Body::new(body);
8479 if !parts.status.is_success() {
8480 let bytes = common::to_bytes(body).await.unwrap_or_default();
8481 let error = serde_json::from_str(&common::to_string(&bytes));
8482 let response = common::to_response(parts, bytes.into());
8483
8484 if let common::Retry::After(d) =
8485 dlg.http_failure(&response, error.as_ref().ok())
8486 {
8487 sleep(d).await;
8488 continue;
8489 }
8490
8491 dlg.finished(false);
8492
8493 return Err(match error {
8494 Ok(value) => common::Error::BadRequest(value),
8495 _ => common::Error::Failure(response),
8496 });
8497 }
8498 let response = {
8499 let bytes = common::to_bytes(body).await.unwrap_or_default();
8500 let encoded = common::to_string(&bytes);
8501 match serde_json::from_str(&encoded) {
8502 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8503 Err(error) => {
8504 dlg.response_json_decode_error(&encoded, &error);
8505 return Err(common::Error::JsonDecodeError(
8506 encoded.to_string(),
8507 error,
8508 ));
8509 }
8510 }
8511 };
8512
8513 dlg.finished(true);
8514 return Ok(response);
8515 }
8516 }
8517 }
8518 }
8519
8520 /// The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
8521 ///
8522 /// Sets the *name* path property to the given value.
8523 ///
8524 /// Even though the property as already been set when instantiating this call,
8525 /// we provide this method for API completeness.
8526 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
8527 self._name = new_value.to_string();
8528 self
8529 }
8530 /// 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.
8531 ///
8532 /// Sets the *zone* query property to the given value.
8533 pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
8534 self._zone = Some(new_value.to_string());
8535 self
8536 }
8537 /// 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.
8538 ///
8539 /// Sets the *project id* query property to the given value.
8540 pub fn project_id(
8541 mut self,
8542 new_value: &str,
8543 ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
8544 self._project_id = Some(new_value.to_string());
8545 self
8546 }
8547 /// Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
8548 ///
8549 /// Sets the *node pool id* query property to the given value.
8550 pub fn node_pool_id(
8551 mut self,
8552 new_value: &str,
8553 ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
8554 self._node_pool_id = Some(new_value.to_string());
8555 self
8556 }
8557 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
8558 ///
8559 /// Sets the *cluster id* query property to the given value.
8560 pub fn cluster_id(
8561 mut self,
8562 new_value: &str,
8563 ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
8564 self._cluster_id = Some(new_value.to_string());
8565 self
8566 }
8567 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8568 /// while executing the actual API request.
8569 ///
8570 /// ````text
8571 /// It should be used to handle progress information, and to implement a certain level of resilience.
8572 /// ````
8573 ///
8574 /// Sets the *delegate* property to the given value.
8575 pub fn delegate(
8576 mut self,
8577 new_value: &'a mut dyn common::Delegate,
8578 ) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
8579 self._delegate = Some(new_value);
8580 self
8581 }
8582
8583 /// Set any additional parameter of the query string used in the request.
8584 /// It should be used to set parameters which are not yet available through their own
8585 /// setters.
8586 ///
8587 /// Please note that this method must not be used to set any of the known parameters
8588 /// which have their own setter method. If done anyway, the request will fail.
8589 ///
8590 /// # Additional Parameters
8591 ///
8592 /// * *$.xgafv* (query-string) - V1 error format.
8593 /// * *access_token* (query-string) - OAuth access token.
8594 /// * *alt* (query-string) - Data format for response.
8595 /// * *callback* (query-string) - JSONP
8596 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8597 /// * *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.
8598 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8599 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8600 /// * *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.
8601 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8602 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8603 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
8604 where
8605 T: AsRef<str>,
8606 {
8607 self._additional_params
8608 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8609 self
8610 }
8611
8612 /// Identifies the authorization scope for the method you are building.
8613 ///
8614 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8615 /// [`Scope::CloudPlatform`].
8616 ///
8617 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8618 /// tokens for more than one scope.
8619 ///
8620 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8621 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8622 /// sufficient, a read-write scope will do as well.
8623 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
8624 where
8625 St: AsRef<str>,
8626 {
8627 self._scopes.insert(String::from(scope.as_ref()));
8628 self
8629 }
8630 /// Identifies the authorization scope(s) for the method you are building.
8631 ///
8632 /// See [`Self::add_scope()`] for details.
8633 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
8634 where
8635 I: IntoIterator<Item = St>,
8636 St: AsRef<str>,
8637 {
8638 self._scopes
8639 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8640 self
8641 }
8642
8643 /// Removes all scopes, and no default scope will be used either.
8644 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8645 /// for details).
8646 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
8647 self._scopes.clear();
8648 self
8649 }
8650}
8651
8652/// Fetch upgrade information of a specific nodepool.
8653///
8654/// A builder for the *locations.clusters.nodePools.fetchNodePoolUpgradeInfo* method supported by a *project* resource.
8655/// It is not used directly, but through a [`ProjectMethods`] instance.
8656///
8657/// # Example
8658///
8659/// Instantiate a resource method builder
8660///
8661/// ```test_harness,no_run
8662/// # extern crate hyper;
8663/// # extern crate hyper_rustls;
8664/// # extern crate google_container1 as container1;
8665/// # async fn dox() {
8666/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8667///
8668/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8669/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
8670/// # .with_native_roots()
8671/// # .unwrap()
8672/// # .https_only()
8673/// # .enable_http2()
8674/// # .build();
8675///
8676/// # let executor = hyper_util::rt::TokioExecutor::new();
8677/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
8678/// # secret,
8679/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
8680/// # yup_oauth2::client::CustomHyperClientBuilder::from(
8681/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
8682/// # ),
8683/// # ).build().await.unwrap();
8684///
8685/// # let client = hyper_util::client::legacy::Client::builder(
8686/// # hyper_util::rt::TokioExecutor::new()
8687/// # )
8688/// # .build(
8689/// # hyper_rustls::HttpsConnectorBuilder::new()
8690/// # .with_native_roots()
8691/// # .unwrap()
8692/// # .https_or_http()
8693/// # .enable_http2()
8694/// # .build()
8695/// # );
8696/// # let mut hub = Container::new(client, auth);
8697/// // You can configure optional parameters by calling the respective setters at will, and
8698/// // execute the final call using `doit()`.
8699/// // Values shown here are possibly random and not representative !
8700/// let result = hub.projects().locations_clusters_node_pools_fetch_node_pool_upgrade_info("name")
8701/// .version("rebum.")
8702/// .doit().await;
8703/// # }
8704/// ```
8705pub struct ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
8706where
8707 C: 'a,
8708{
8709 hub: &'a Container<C>,
8710 _name: String,
8711 _version: Option<String>,
8712 _delegate: Option<&'a mut dyn common::Delegate>,
8713 _additional_params: HashMap<String, String>,
8714 _scopes: BTreeSet<String>,
8715}
8716
8717impl<'a, C> common::CallBuilder
8718 for ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
8719{
8720}
8721
8722impl<'a, C> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
8723where
8724 C: common::Connector,
8725{
8726 /// Perform the operation you have build so far.
8727 pub async fn doit(mut self) -> common::Result<(common::Response, NodePoolUpgradeInfo)> {
8728 use std::borrow::Cow;
8729 use std::io::{Read, Seek};
8730
8731 use common::{url::Params, ToParts};
8732 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
8733
8734 let mut dd = common::DefaultDelegate;
8735 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
8736 dlg.begin(common::MethodInfo {
8737 id: "container.projects.locations.clusters.nodePools.fetchNodePoolUpgradeInfo",
8738 http_method: hyper::Method::GET,
8739 });
8740
8741 for &field in ["alt", "name", "version"].iter() {
8742 if self._additional_params.contains_key(field) {
8743 dlg.finished(false);
8744 return Err(common::Error::FieldClash(field));
8745 }
8746 }
8747
8748 let mut params = Params::with_capacity(4 + self._additional_params.len());
8749 params.push("name", self._name);
8750 if let Some(value) = self._version.as_ref() {
8751 params.push("version", value);
8752 }
8753
8754 params.extend(self._additional_params.iter());
8755
8756 params.push("alt", "json");
8757 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchNodePoolUpgradeInfo";
8758 if self._scopes.is_empty() {
8759 self._scopes
8760 .insert(Scope::CloudPlatform.as_ref().to_string());
8761 }
8762
8763 #[allow(clippy::single_element_loop)]
8764 for &(find_this, param_name) in [("{+name}", "name")].iter() {
8765 url = params.uri_replacement(url, param_name, find_this, true);
8766 }
8767 {
8768 let to_remove = ["name"];
8769 params.remove_params(&to_remove);
8770 }
8771
8772 let url = params.parse_with_url(&url);
8773
8774 loop {
8775 let token = match self
8776 .hub
8777 .auth
8778 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
8779 .await
8780 {
8781 Ok(token) => token,
8782 Err(e) => match dlg.token(e) {
8783 Ok(token) => token,
8784 Err(e) => {
8785 dlg.finished(false);
8786 return Err(common::Error::MissingToken(e));
8787 }
8788 },
8789 };
8790 let mut req_result = {
8791 let client = &self.hub.client;
8792 dlg.pre_request();
8793 let mut req_builder = hyper::Request::builder()
8794 .method(hyper::Method::GET)
8795 .uri(url.as_str())
8796 .header(USER_AGENT, self.hub._user_agent.clone());
8797
8798 if let Some(token) = token.as_ref() {
8799 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
8800 }
8801
8802 let request = req_builder
8803 .header(CONTENT_LENGTH, 0_u64)
8804 .body(common::to_body::<String>(None));
8805
8806 client.request(request.unwrap()).await
8807 };
8808
8809 match req_result {
8810 Err(err) => {
8811 if let common::Retry::After(d) = dlg.http_error(&err) {
8812 sleep(d).await;
8813 continue;
8814 }
8815 dlg.finished(false);
8816 return Err(common::Error::HttpError(err));
8817 }
8818 Ok(res) => {
8819 let (mut parts, body) = res.into_parts();
8820 let mut body = common::Body::new(body);
8821 if !parts.status.is_success() {
8822 let bytes = common::to_bytes(body).await.unwrap_or_default();
8823 let error = serde_json::from_str(&common::to_string(&bytes));
8824 let response = common::to_response(parts, bytes.into());
8825
8826 if let common::Retry::After(d) =
8827 dlg.http_failure(&response, error.as_ref().ok())
8828 {
8829 sleep(d).await;
8830 continue;
8831 }
8832
8833 dlg.finished(false);
8834
8835 return Err(match error {
8836 Ok(value) => common::Error::BadRequest(value),
8837 _ => common::Error::Failure(response),
8838 });
8839 }
8840 let response = {
8841 let bytes = common::to_bytes(body).await.unwrap_or_default();
8842 let encoded = common::to_string(&bytes);
8843 match serde_json::from_str(&encoded) {
8844 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
8845 Err(error) => {
8846 dlg.response_json_decode_error(&encoded, &error);
8847 return Err(common::Error::JsonDecodeError(
8848 encoded.to_string(),
8849 error,
8850 ));
8851 }
8852 }
8853 };
8854
8855 dlg.finished(true);
8856 return Ok(response);
8857 }
8858 }
8859 }
8860 }
8861
8862 /// Required. The name (project, location, cluster, nodepool) of the nodepool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*` or `projects/*/zones/*/clusters/*/nodePools/*`.
8863 ///
8864 /// Sets the *name* path property to the given value.
8865 ///
8866 /// Even though the property as already been set when instantiating this call,
8867 /// we provide this method for API completeness.
8868 pub fn name(
8869 mut self,
8870 new_value: &str,
8871 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
8872 self._name = new_value.to_string();
8873 self
8874 }
8875 /// API request version that initiates this operation.
8876 ///
8877 /// Sets the *version* query property to the given value.
8878 pub fn version(
8879 mut self,
8880 new_value: &str,
8881 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
8882 self._version = Some(new_value.to_string());
8883 self
8884 }
8885 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
8886 /// while executing the actual API request.
8887 ///
8888 /// ````text
8889 /// It should be used to handle progress information, and to implement a certain level of resilience.
8890 /// ````
8891 ///
8892 /// Sets the *delegate* property to the given value.
8893 pub fn delegate(
8894 mut self,
8895 new_value: &'a mut dyn common::Delegate,
8896 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
8897 self._delegate = Some(new_value);
8898 self
8899 }
8900
8901 /// Set any additional parameter of the query string used in the request.
8902 /// It should be used to set parameters which are not yet available through their own
8903 /// setters.
8904 ///
8905 /// Please note that this method must not be used to set any of the known parameters
8906 /// which have their own setter method. If done anyway, the request will fail.
8907 ///
8908 /// # Additional Parameters
8909 ///
8910 /// * *$.xgafv* (query-string) - V1 error format.
8911 /// * *access_token* (query-string) - OAuth access token.
8912 /// * *alt* (query-string) - Data format for response.
8913 /// * *callback* (query-string) - JSONP
8914 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
8915 /// * *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.
8916 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
8917 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
8918 /// * *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.
8919 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
8920 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
8921 pub fn param<T>(
8922 mut self,
8923 name: T,
8924 value: T,
8925 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
8926 where
8927 T: AsRef<str>,
8928 {
8929 self._additional_params
8930 .insert(name.as_ref().to_string(), value.as_ref().to_string());
8931 self
8932 }
8933
8934 /// Identifies the authorization scope for the method you are building.
8935 ///
8936 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
8937 /// [`Scope::CloudPlatform`].
8938 ///
8939 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
8940 /// tokens for more than one scope.
8941 ///
8942 /// Usually there is more than one suitable scope to authorize an operation, some of which may
8943 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
8944 /// sufficient, a read-write scope will do as well.
8945 pub fn add_scope<St>(
8946 mut self,
8947 scope: St,
8948 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
8949 where
8950 St: AsRef<str>,
8951 {
8952 self._scopes.insert(String::from(scope.as_ref()));
8953 self
8954 }
8955 /// Identifies the authorization scope(s) for the method you are building.
8956 ///
8957 /// See [`Self::add_scope()`] for details.
8958 pub fn add_scopes<I, St>(
8959 mut self,
8960 scopes: I,
8961 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
8962 where
8963 I: IntoIterator<Item = St>,
8964 St: AsRef<str>,
8965 {
8966 self._scopes
8967 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
8968 self
8969 }
8970
8971 /// Removes all scopes, and no default scope will be used either.
8972 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
8973 /// for details).
8974 pub fn clear_scopes(
8975 mut self,
8976 ) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
8977 self._scopes.clear();
8978 self
8979 }
8980}
8981
8982/// Retrieves the requested node pool.
8983///
8984/// A builder for the *locations.clusters.nodePools.get* method supported by a *project* resource.
8985/// It is not used directly, but through a [`ProjectMethods`] instance.
8986///
8987/// # Example
8988///
8989/// Instantiate a resource method builder
8990///
8991/// ```test_harness,no_run
8992/// # extern crate hyper;
8993/// # extern crate hyper_rustls;
8994/// # extern crate google_container1 as container1;
8995/// # async fn dox() {
8996/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
8997///
8998/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
8999/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9000/// # .with_native_roots()
9001/// # .unwrap()
9002/// # .https_only()
9003/// # .enable_http2()
9004/// # .build();
9005///
9006/// # let executor = hyper_util::rt::TokioExecutor::new();
9007/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9008/// # secret,
9009/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9010/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9011/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9012/// # ),
9013/// # ).build().await.unwrap();
9014///
9015/// # let client = hyper_util::client::legacy::Client::builder(
9016/// # hyper_util::rt::TokioExecutor::new()
9017/// # )
9018/// # .build(
9019/// # hyper_rustls::HttpsConnectorBuilder::new()
9020/// # .with_native_roots()
9021/// # .unwrap()
9022/// # .https_or_http()
9023/// # .enable_http2()
9024/// # .build()
9025/// # );
9026/// # let mut hub = Container::new(client, auth);
9027/// // You can configure optional parameters by calling the respective setters at will, and
9028/// // execute the final call using `doit()`.
9029/// // Values shown here are possibly random and not representative !
9030/// let result = hub.projects().locations_clusters_node_pools_get("name")
9031/// .zone("ipsum")
9032/// .project_id("ipsum")
9033/// .node_pool_id("est")
9034/// .cluster_id("gubergren")
9035/// .doit().await;
9036/// # }
9037/// ```
9038pub struct ProjectLocationClusterNodePoolGetCall<'a, C>
9039where
9040 C: 'a,
9041{
9042 hub: &'a Container<C>,
9043 _name: String,
9044 _zone: Option<String>,
9045 _project_id: Option<String>,
9046 _node_pool_id: Option<String>,
9047 _cluster_id: Option<String>,
9048 _delegate: Option<&'a mut dyn common::Delegate>,
9049 _additional_params: HashMap<String, String>,
9050 _scopes: BTreeSet<String>,
9051}
9052
9053impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolGetCall<'a, C> {}
9054
9055impl<'a, C> ProjectLocationClusterNodePoolGetCall<'a, C>
9056where
9057 C: common::Connector,
9058{
9059 /// Perform the operation you have build so far.
9060 pub async fn doit(mut self) -> common::Result<(common::Response, NodePool)> {
9061 use std::borrow::Cow;
9062 use std::io::{Read, Seek};
9063
9064 use common::{url::Params, ToParts};
9065 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9066
9067 let mut dd = common::DefaultDelegate;
9068 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9069 dlg.begin(common::MethodInfo {
9070 id: "container.projects.locations.clusters.nodePools.get",
9071 http_method: hyper::Method::GET,
9072 });
9073
9074 for &field in [
9075 "alt",
9076 "name",
9077 "zone",
9078 "projectId",
9079 "nodePoolId",
9080 "clusterId",
9081 ]
9082 .iter()
9083 {
9084 if self._additional_params.contains_key(field) {
9085 dlg.finished(false);
9086 return Err(common::Error::FieldClash(field));
9087 }
9088 }
9089
9090 let mut params = Params::with_capacity(7 + self._additional_params.len());
9091 params.push("name", self._name);
9092 if let Some(value) = self._zone.as_ref() {
9093 params.push("zone", value);
9094 }
9095 if let Some(value) = self._project_id.as_ref() {
9096 params.push("projectId", value);
9097 }
9098 if let Some(value) = self._node_pool_id.as_ref() {
9099 params.push("nodePoolId", value);
9100 }
9101 if let Some(value) = self._cluster_id.as_ref() {
9102 params.push("clusterId", value);
9103 }
9104
9105 params.extend(self._additional_params.iter());
9106
9107 params.push("alt", "json");
9108 let mut url = self.hub._base_url.clone() + "v1/{+name}";
9109 if self._scopes.is_empty() {
9110 self._scopes
9111 .insert(Scope::CloudPlatform.as_ref().to_string());
9112 }
9113
9114 #[allow(clippy::single_element_loop)]
9115 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9116 url = params.uri_replacement(url, param_name, find_this, true);
9117 }
9118 {
9119 let to_remove = ["name"];
9120 params.remove_params(&to_remove);
9121 }
9122
9123 let url = params.parse_with_url(&url);
9124
9125 loop {
9126 let token = match self
9127 .hub
9128 .auth
9129 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9130 .await
9131 {
9132 Ok(token) => token,
9133 Err(e) => match dlg.token(e) {
9134 Ok(token) => token,
9135 Err(e) => {
9136 dlg.finished(false);
9137 return Err(common::Error::MissingToken(e));
9138 }
9139 },
9140 };
9141 let mut req_result = {
9142 let client = &self.hub.client;
9143 dlg.pre_request();
9144 let mut req_builder = hyper::Request::builder()
9145 .method(hyper::Method::GET)
9146 .uri(url.as_str())
9147 .header(USER_AGENT, self.hub._user_agent.clone());
9148
9149 if let Some(token) = token.as_ref() {
9150 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9151 }
9152
9153 let request = req_builder
9154 .header(CONTENT_LENGTH, 0_u64)
9155 .body(common::to_body::<String>(None));
9156
9157 client.request(request.unwrap()).await
9158 };
9159
9160 match req_result {
9161 Err(err) => {
9162 if let common::Retry::After(d) = dlg.http_error(&err) {
9163 sleep(d).await;
9164 continue;
9165 }
9166 dlg.finished(false);
9167 return Err(common::Error::HttpError(err));
9168 }
9169 Ok(res) => {
9170 let (mut parts, body) = res.into_parts();
9171 let mut body = common::Body::new(body);
9172 if !parts.status.is_success() {
9173 let bytes = common::to_bytes(body).await.unwrap_or_default();
9174 let error = serde_json::from_str(&common::to_string(&bytes));
9175 let response = common::to_response(parts, bytes.into());
9176
9177 if let common::Retry::After(d) =
9178 dlg.http_failure(&response, error.as_ref().ok())
9179 {
9180 sleep(d).await;
9181 continue;
9182 }
9183
9184 dlg.finished(false);
9185
9186 return Err(match error {
9187 Ok(value) => common::Error::BadRequest(value),
9188 _ => common::Error::Failure(response),
9189 });
9190 }
9191 let response = {
9192 let bytes = common::to_bytes(body).await.unwrap_or_default();
9193 let encoded = common::to_string(&bytes);
9194 match serde_json::from_str(&encoded) {
9195 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9196 Err(error) => {
9197 dlg.response_json_decode_error(&encoded, &error);
9198 return Err(common::Error::JsonDecodeError(
9199 encoded.to_string(),
9200 error,
9201 ));
9202 }
9203 }
9204 };
9205
9206 dlg.finished(true);
9207 return Ok(response);
9208 }
9209 }
9210 }
9211 }
9212
9213 /// The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
9214 ///
9215 /// Sets the *name* path property to the given value.
9216 ///
9217 /// Even though the property as already been set when instantiating this call,
9218 /// we provide this method for API completeness.
9219 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
9220 self._name = new_value.to_string();
9221 self
9222 }
9223 /// 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.
9224 ///
9225 /// Sets the *zone* query property to the given value.
9226 pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
9227 self._zone = Some(new_value.to_string());
9228 self
9229 }
9230 /// 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.
9231 ///
9232 /// Sets the *project id* query property to the given value.
9233 pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
9234 self._project_id = Some(new_value.to_string());
9235 self
9236 }
9237 /// Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
9238 ///
9239 /// Sets the *node pool id* query property to the given value.
9240 pub fn node_pool_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
9241 self._node_pool_id = Some(new_value.to_string());
9242 self
9243 }
9244 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
9245 ///
9246 /// Sets the *cluster id* query property to the given value.
9247 pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
9248 self._cluster_id = Some(new_value.to_string());
9249 self
9250 }
9251 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9252 /// while executing the actual API request.
9253 ///
9254 /// ````text
9255 /// It should be used to handle progress information, and to implement a certain level of resilience.
9256 /// ````
9257 ///
9258 /// Sets the *delegate* property to the given value.
9259 pub fn delegate(
9260 mut self,
9261 new_value: &'a mut dyn common::Delegate,
9262 ) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
9263 self._delegate = Some(new_value);
9264 self
9265 }
9266
9267 /// Set any additional parameter of the query string used in the request.
9268 /// It should be used to set parameters which are not yet available through their own
9269 /// setters.
9270 ///
9271 /// Please note that this method must not be used to set any of the known parameters
9272 /// which have their own setter method. If done anyway, the request will fail.
9273 ///
9274 /// # Additional Parameters
9275 ///
9276 /// * *$.xgafv* (query-string) - V1 error format.
9277 /// * *access_token* (query-string) - OAuth access token.
9278 /// * *alt* (query-string) - Data format for response.
9279 /// * *callback* (query-string) - JSONP
9280 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9281 /// * *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.
9282 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9283 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9284 /// * *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.
9285 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9286 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9287 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolGetCall<'a, C>
9288 where
9289 T: AsRef<str>,
9290 {
9291 self._additional_params
9292 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9293 self
9294 }
9295
9296 /// Identifies the authorization scope for the method you are building.
9297 ///
9298 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9299 /// [`Scope::CloudPlatform`].
9300 ///
9301 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9302 /// tokens for more than one scope.
9303 ///
9304 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9305 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9306 /// sufficient, a read-write scope will do as well.
9307 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolGetCall<'a, C>
9308 where
9309 St: AsRef<str>,
9310 {
9311 self._scopes.insert(String::from(scope.as_ref()));
9312 self
9313 }
9314 /// Identifies the authorization scope(s) for the method you are building.
9315 ///
9316 /// See [`Self::add_scope()`] for details.
9317 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolGetCall<'a, C>
9318 where
9319 I: IntoIterator<Item = St>,
9320 St: AsRef<str>,
9321 {
9322 self._scopes
9323 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9324 self
9325 }
9326
9327 /// Removes all scopes, and no default scope will be used either.
9328 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9329 /// for details).
9330 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
9331 self._scopes.clear();
9332 self
9333 }
9334}
9335
9336/// Lists the node pools for a cluster.
9337///
9338/// A builder for the *locations.clusters.nodePools.list* method supported by a *project* resource.
9339/// It is not used directly, but through a [`ProjectMethods`] instance.
9340///
9341/// # Example
9342///
9343/// Instantiate a resource method builder
9344///
9345/// ```test_harness,no_run
9346/// # extern crate hyper;
9347/// # extern crate hyper_rustls;
9348/// # extern crate google_container1 as container1;
9349/// # async fn dox() {
9350/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9351///
9352/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9353/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9354/// # .with_native_roots()
9355/// # .unwrap()
9356/// # .https_only()
9357/// # .enable_http2()
9358/// # .build();
9359///
9360/// # let executor = hyper_util::rt::TokioExecutor::new();
9361/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9362/// # secret,
9363/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9364/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9365/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9366/// # ),
9367/// # ).build().await.unwrap();
9368///
9369/// # let client = hyper_util::client::legacy::Client::builder(
9370/// # hyper_util::rt::TokioExecutor::new()
9371/// # )
9372/// # .build(
9373/// # hyper_rustls::HttpsConnectorBuilder::new()
9374/// # .with_native_roots()
9375/// # .unwrap()
9376/// # .https_or_http()
9377/// # .enable_http2()
9378/// # .build()
9379/// # );
9380/// # let mut hub = Container::new(client, auth);
9381/// // You can configure optional parameters by calling the respective setters at will, and
9382/// // execute the final call using `doit()`.
9383/// // Values shown here are possibly random and not representative !
9384/// let result = hub.projects().locations_clusters_node_pools_list("parent")
9385/// .zone("dolor")
9386/// .project_id("Lorem")
9387/// .cluster_id("eos")
9388/// .doit().await;
9389/// # }
9390/// ```
9391pub struct ProjectLocationClusterNodePoolListCall<'a, C>
9392where
9393 C: 'a,
9394{
9395 hub: &'a Container<C>,
9396 _parent: String,
9397 _zone: Option<String>,
9398 _project_id: Option<String>,
9399 _cluster_id: Option<String>,
9400 _delegate: Option<&'a mut dyn common::Delegate>,
9401 _additional_params: HashMap<String, String>,
9402 _scopes: BTreeSet<String>,
9403}
9404
9405impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolListCall<'a, C> {}
9406
9407impl<'a, C> ProjectLocationClusterNodePoolListCall<'a, C>
9408where
9409 C: common::Connector,
9410{
9411 /// Perform the operation you have build so far.
9412 pub async fn doit(mut self) -> common::Result<(common::Response, ListNodePoolsResponse)> {
9413 use std::borrow::Cow;
9414 use std::io::{Read, Seek};
9415
9416 use common::{url::Params, ToParts};
9417 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
9418
9419 let mut dd = common::DefaultDelegate;
9420 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
9421 dlg.begin(common::MethodInfo {
9422 id: "container.projects.locations.clusters.nodePools.list",
9423 http_method: hyper::Method::GET,
9424 });
9425
9426 for &field in ["alt", "parent", "zone", "projectId", "clusterId"].iter() {
9427 if self._additional_params.contains_key(field) {
9428 dlg.finished(false);
9429 return Err(common::Error::FieldClash(field));
9430 }
9431 }
9432
9433 let mut params = Params::with_capacity(6 + self._additional_params.len());
9434 params.push("parent", self._parent);
9435 if let Some(value) = self._zone.as_ref() {
9436 params.push("zone", value);
9437 }
9438 if let Some(value) = self._project_id.as_ref() {
9439 params.push("projectId", value);
9440 }
9441 if let Some(value) = self._cluster_id.as_ref() {
9442 params.push("clusterId", value);
9443 }
9444
9445 params.extend(self._additional_params.iter());
9446
9447 params.push("alt", "json");
9448 let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
9449 if self._scopes.is_empty() {
9450 self._scopes
9451 .insert(Scope::CloudPlatform.as_ref().to_string());
9452 }
9453
9454 #[allow(clippy::single_element_loop)]
9455 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
9456 url = params.uri_replacement(url, param_name, find_this, true);
9457 }
9458 {
9459 let to_remove = ["parent"];
9460 params.remove_params(&to_remove);
9461 }
9462
9463 let url = params.parse_with_url(&url);
9464
9465 loop {
9466 let token = match self
9467 .hub
9468 .auth
9469 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9470 .await
9471 {
9472 Ok(token) => token,
9473 Err(e) => match dlg.token(e) {
9474 Ok(token) => token,
9475 Err(e) => {
9476 dlg.finished(false);
9477 return Err(common::Error::MissingToken(e));
9478 }
9479 },
9480 };
9481 let mut req_result = {
9482 let client = &self.hub.client;
9483 dlg.pre_request();
9484 let mut req_builder = hyper::Request::builder()
9485 .method(hyper::Method::GET)
9486 .uri(url.as_str())
9487 .header(USER_AGENT, self.hub._user_agent.clone());
9488
9489 if let Some(token) = token.as_ref() {
9490 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9491 }
9492
9493 let request = req_builder
9494 .header(CONTENT_LENGTH, 0_u64)
9495 .body(common::to_body::<String>(None));
9496
9497 client.request(request.unwrap()).await
9498 };
9499
9500 match req_result {
9501 Err(err) => {
9502 if let common::Retry::After(d) = dlg.http_error(&err) {
9503 sleep(d).await;
9504 continue;
9505 }
9506 dlg.finished(false);
9507 return Err(common::Error::HttpError(err));
9508 }
9509 Ok(res) => {
9510 let (mut parts, body) = res.into_parts();
9511 let mut body = common::Body::new(body);
9512 if !parts.status.is_success() {
9513 let bytes = common::to_bytes(body).await.unwrap_or_default();
9514 let error = serde_json::from_str(&common::to_string(&bytes));
9515 let response = common::to_response(parts, bytes.into());
9516
9517 if let common::Retry::After(d) =
9518 dlg.http_failure(&response, error.as_ref().ok())
9519 {
9520 sleep(d).await;
9521 continue;
9522 }
9523
9524 dlg.finished(false);
9525
9526 return Err(match error {
9527 Ok(value) => common::Error::BadRequest(value),
9528 _ => common::Error::Failure(response),
9529 });
9530 }
9531 let response = {
9532 let bytes = common::to_bytes(body).await.unwrap_or_default();
9533 let encoded = common::to_string(&bytes);
9534 match serde_json::from_str(&encoded) {
9535 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9536 Err(error) => {
9537 dlg.response_json_decode_error(&encoded, &error);
9538 return Err(common::Error::JsonDecodeError(
9539 encoded.to_string(),
9540 error,
9541 ));
9542 }
9543 }
9544 };
9545
9546 dlg.finished(true);
9547 return Ok(response);
9548 }
9549 }
9550 }
9551 }
9552
9553 /// The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
9554 ///
9555 /// Sets the *parent* path property to the given value.
9556 ///
9557 /// Even though the property as already been set when instantiating this call,
9558 /// we provide this method for API completeness.
9559 pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
9560 self._parent = new_value.to_string();
9561 self
9562 }
9563 /// 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.
9564 ///
9565 /// Sets the *zone* query property to the given value.
9566 pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
9567 self._zone = Some(new_value.to_string());
9568 self
9569 }
9570 /// 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.
9571 ///
9572 /// Sets the *project id* query property to the given value.
9573 pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
9574 self._project_id = Some(new_value.to_string());
9575 self
9576 }
9577 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
9578 ///
9579 /// Sets the *cluster id* query property to the given value.
9580 pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
9581 self._cluster_id = Some(new_value.to_string());
9582 self
9583 }
9584 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9585 /// while executing the actual API request.
9586 ///
9587 /// ````text
9588 /// It should be used to handle progress information, and to implement a certain level of resilience.
9589 /// ````
9590 ///
9591 /// Sets the *delegate* property to the given value.
9592 pub fn delegate(
9593 mut self,
9594 new_value: &'a mut dyn common::Delegate,
9595 ) -> ProjectLocationClusterNodePoolListCall<'a, C> {
9596 self._delegate = Some(new_value);
9597 self
9598 }
9599
9600 /// Set any additional parameter of the query string used in the request.
9601 /// It should be used to set parameters which are not yet available through their own
9602 /// setters.
9603 ///
9604 /// Please note that this method must not be used to set any of the known parameters
9605 /// which have their own setter method. If done anyway, the request will fail.
9606 ///
9607 /// # Additional Parameters
9608 ///
9609 /// * *$.xgafv* (query-string) - V1 error format.
9610 /// * *access_token* (query-string) - OAuth access token.
9611 /// * *alt* (query-string) - Data format for response.
9612 /// * *callback* (query-string) - JSONP
9613 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9614 /// * *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.
9615 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9616 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9617 /// * *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.
9618 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9619 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9620 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolListCall<'a, C>
9621 where
9622 T: AsRef<str>,
9623 {
9624 self._additional_params
9625 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9626 self
9627 }
9628
9629 /// Identifies the authorization scope for the method you are building.
9630 ///
9631 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9632 /// [`Scope::CloudPlatform`].
9633 ///
9634 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9635 /// tokens for more than one scope.
9636 ///
9637 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9638 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9639 /// sufficient, a read-write scope will do as well.
9640 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolListCall<'a, C>
9641 where
9642 St: AsRef<str>,
9643 {
9644 self._scopes.insert(String::from(scope.as_ref()));
9645 self
9646 }
9647 /// Identifies the authorization scope(s) for the method you are building.
9648 ///
9649 /// See [`Self::add_scope()`] for details.
9650 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolListCall<'a, C>
9651 where
9652 I: IntoIterator<Item = St>,
9653 St: AsRef<str>,
9654 {
9655 self._scopes
9656 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
9657 self
9658 }
9659
9660 /// Removes all scopes, and no default scope will be used either.
9661 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
9662 /// for details).
9663 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolListCall<'a, C> {
9664 self._scopes.clear();
9665 self
9666 }
9667}
9668
9669/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
9670///
9671/// A builder for the *locations.clusters.nodePools.rollback* method supported by a *project* resource.
9672/// It is not used directly, but through a [`ProjectMethods`] instance.
9673///
9674/// # Example
9675///
9676/// Instantiate a resource method builder
9677///
9678/// ```test_harness,no_run
9679/// # extern crate hyper;
9680/// # extern crate hyper_rustls;
9681/// # extern crate google_container1 as container1;
9682/// use container1::api::RollbackNodePoolUpgradeRequest;
9683/// # async fn dox() {
9684/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
9685///
9686/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
9687/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
9688/// # .with_native_roots()
9689/// # .unwrap()
9690/// # .https_only()
9691/// # .enable_http2()
9692/// # .build();
9693///
9694/// # let executor = hyper_util::rt::TokioExecutor::new();
9695/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
9696/// # secret,
9697/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
9698/// # yup_oauth2::client::CustomHyperClientBuilder::from(
9699/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
9700/// # ),
9701/// # ).build().await.unwrap();
9702///
9703/// # let client = hyper_util::client::legacy::Client::builder(
9704/// # hyper_util::rt::TokioExecutor::new()
9705/// # )
9706/// # .build(
9707/// # hyper_rustls::HttpsConnectorBuilder::new()
9708/// # .with_native_roots()
9709/// # .unwrap()
9710/// # .https_or_http()
9711/// # .enable_http2()
9712/// # .build()
9713/// # );
9714/// # let mut hub = Container::new(client, auth);
9715/// // As the method needs a request, you would usually fill it with the desired information
9716/// // into the respective structure. Some of the parts shown here might not be applicable !
9717/// // Values shown here are possibly random and not representative !
9718/// let mut req = RollbackNodePoolUpgradeRequest::default();
9719///
9720/// // You can configure optional parameters by calling the respective setters at will, and
9721/// // execute the final call using `doit()`.
9722/// // Values shown here are possibly random and not representative !
9723/// let result = hub.projects().locations_clusters_node_pools_rollback(req, "name")
9724/// .doit().await;
9725/// # }
9726/// ```
9727pub struct ProjectLocationClusterNodePoolRollbackCall<'a, C>
9728where
9729 C: 'a,
9730{
9731 hub: &'a Container<C>,
9732 _request: RollbackNodePoolUpgradeRequest,
9733 _name: String,
9734 _delegate: Option<&'a mut dyn common::Delegate>,
9735 _additional_params: HashMap<String, String>,
9736 _scopes: BTreeSet<String>,
9737}
9738
9739impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolRollbackCall<'a, C> {}
9740
9741impl<'a, C> ProjectLocationClusterNodePoolRollbackCall<'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, Operation)> {
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.nodePools.rollback",
9757 http_method: hyper::Method::POST,
9758 });
9759
9760 for &field in ["alt", "name"].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(4 + self._additional_params.len());
9768 params.push("name", self._name);
9769
9770 params.extend(self._additional_params.iter());
9771
9772 params.push("alt", "json");
9773 let mut url = self.hub._base_url.clone() + "v1/{+name}:rollback";
9774 if self._scopes.is_empty() {
9775 self._scopes
9776 .insert(Scope::CloudPlatform.as_ref().to_string());
9777 }
9778
9779 #[allow(clippy::single_element_loop)]
9780 for &(find_this, param_name) in [("{+name}", "name")].iter() {
9781 url = params.uri_replacement(url, param_name, find_this, true);
9782 }
9783 {
9784 let to_remove = ["name"];
9785 params.remove_params(&to_remove);
9786 }
9787
9788 let url = params.parse_with_url(&url);
9789
9790 let mut json_mime_type = mime::APPLICATION_JSON;
9791 let mut request_value_reader = {
9792 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
9793 common::remove_json_null_values(&mut value);
9794 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
9795 serde_json::to_writer(&mut dst, &value).unwrap();
9796 dst
9797 };
9798 let request_size = request_value_reader
9799 .seek(std::io::SeekFrom::End(0))
9800 .unwrap();
9801 request_value_reader
9802 .seek(std::io::SeekFrom::Start(0))
9803 .unwrap();
9804
9805 loop {
9806 let token = match self
9807 .hub
9808 .auth
9809 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
9810 .await
9811 {
9812 Ok(token) => token,
9813 Err(e) => match dlg.token(e) {
9814 Ok(token) => token,
9815 Err(e) => {
9816 dlg.finished(false);
9817 return Err(common::Error::MissingToken(e));
9818 }
9819 },
9820 };
9821 request_value_reader
9822 .seek(std::io::SeekFrom::Start(0))
9823 .unwrap();
9824 let mut req_result = {
9825 let client = &self.hub.client;
9826 dlg.pre_request();
9827 let mut req_builder = hyper::Request::builder()
9828 .method(hyper::Method::POST)
9829 .uri(url.as_str())
9830 .header(USER_AGENT, self.hub._user_agent.clone());
9831
9832 if let Some(token) = token.as_ref() {
9833 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
9834 }
9835
9836 let request = req_builder
9837 .header(CONTENT_TYPE, json_mime_type.to_string())
9838 .header(CONTENT_LENGTH, request_size as u64)
9839 .body(common::to_body(
9840 request_value_reader.get_ref().clone().into(),
9841 ));
9842
9843 client.request(request.unwrap()).await
9844 };
9845
9846 match req_result {
9847 Err(err) => {
9848 if let common::Retry::After(d) = dlg.http_error(&err) {
9849 sleep(d).await;
9850 continue;
9851 }
9852 dlg.finished(false);
9853 return Err(common::Error::HttpError(err));
9854 }
9855 Ok(res) => {
9856 let (mut parts, body) = res.into_parts();
9857 let mut body = common::Body::new(body);
9858 if !parts.status.is_success() {
9859 let bytes = common::to_bytes(body).await.unwrap_or_default();
9860 let error = serde_json::from_str(&common::to_string(&bytes));
9861 let response = common::to_response(parts, bytes.into());
9862
9863 if let common::Retry::After(d) =
9864 dlg.http_failure(&response, error.as_ref().ok())
9865 {
9866 sleep(d).await;
9867 continue;
9868 }
9869
9870 dlg.finished(false);
9871
9872 return Err(match error {
9873 Ok(value) => common::Error::BadRequest(value),
9874 _ => common::Error::Failure(response),
9875 });
9876 }
9877 let response = {
9878 let bytes = common::to_bytes(body).await.unwrap_or_default();
9879 let encoded = common::to_string(&bytes);
9880 match serde_json::from_str(&encoded) {
9881 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
9882 Err(error) => {
9883 dlg.response_json_decode_error(&encoded, &error);
9884 return Err(common::Error::JsonDecodeError(
9885 encoded.to_string(),
9886 error,
9887 ));
9888 }
9889 }
9890 };
9891
9892 dlg.finished(true);
9893 return Ok(response);
9894 }
9895 }
9896 }
9897 }
9898
9899 ///
9900 /// Sets the *request* property to the given value.
9901 ///
9902 /// Even though the property as already been set when instantiating this call,
9903 /// we provide this method for API completeness.
9904 pub fn request(
9905 mut self,
9906 new_value: RollbackNodePoolUpgradeRequest,
9907 ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
9908 self._request = new_value;
9909 self
9910 }
9911 /// The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
9912 ///
9913 /// Sets the *name* path property to the given value.
9914 ///
9915 /// Even though the property as already been set when instantiating this call,
9916 /// we provide this method for API completeness.
9917 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
9918 self._name = new_value.to_string();
9919 self
9920 }
9921 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
9922 /// while executing the actual API request.
9923 ///
9924 /// ````text
9925 /// It should be used to handle progress information, and to implement a certain level of resilience.
9926 /// ````
9927 ///
9928 /// Sets the *delegate* property to the given value.
9929 pub fn delegate(
9930 mut self,
9931 new_value: &'a mut dyn common::Delegate,
9932 ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
9933 self._delegate = Some(new_value);
9934 self
9935 }
9936
9937 /// Set any additional parameter of the query string used in the request.
9938 /// It should be used to set parameters which are not yet available through their own
9939 /// setters.
9940 ///
9941 /// Please note that this method must not be used to set any of the known parameters
9942 /// which have their own setter method. If done anyway, the request will fail.
9943 ///
9944 /// # Additional Parameters
9945 ///
9946 /// * *$.xgafv* (query-string) - V1 error format.
9947 /// * *access_token* (query-string) - OAuth access token.
9948 /// * *alt* (query-string) - Data format for response.
9949 /// * *callback* (query-string) - JSONP
9950 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
9951 /// * *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.
9952 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
9953 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
9954 /// * *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.
9955 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
9956 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
9957 pub fn param<T>(
9958 mut self,
9959 name: T,
9960 value: T,
9961 ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
9962 where
9963 T: AsRef<str>,
9964 {
9965 self._additional_params
9966 .insert(name.as_ref().to_string(), value.as_ref().to_string());
9967 self
9968 }
9969
9970 /// Identifies the authorization scope for the method you are building.
9971 ///
9972 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
9973 /// [`Scope::CloudPlatform`].
9974 ///
9975 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
9976 /// tokens for more than one scope.
9977 ///
9978 /// Usually there is more than one suitable scope to authorize an operation, some of which may
9979 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
9980 /// sufficient, a read-write scope will do as well.
9981 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
9982 where
9983 St: AsRef<str>,
9984 {
9985 self._scopes.insert(String::from(scope.as_ref()));
9986 self
9987 }
9988 /// Identifies the authorization scope(s) for the method you are building.
9989 ///
9990 /// See [`Self::add_scope()`] for details.
9991 pub fn add_scopes<I, St>(
9992 mut self,
9993 scopes: I,
9994 ) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
9995 where
9996 I: IntoIterator<Item = St>,
9997 St: AsRef<str>,
9998 {
9999 self._scopes
10000 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10001 self
10002 }
10003
10004 /// Removes all scopes, and no default scope will be used either.
10005 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10006 /// for details).
10007 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
10008 self._scopes.clear();
10009 self
10010 }
10011}
10012
10013/// Sets the autoscaling settings for the specified node pool.
10014///
10015/// A builder for the *locations.clusters.nodePools.setAutoscaling* method supported by a *project* resource.
10016/// It is not used directly, but through a [`ProjectMethods`] instance.
10017///
10018/// # Example
10019///
10020/// Instantiate a resource method builder
10021///
10022/// ```test_harness,no_run
10023/// # extern crate hyper;
10024/// # extern crate hyper_rustls;
10025/// # extern crate google_container1 as container1;
10026/// use container1::api::SetNodePoolAutoscalingRequest;
10027/// # async fn dox() {
10028/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10029///
10030/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10031/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10032/// # .with_native_roots()
10033/// # .unwrap()
10034/// # .https_only()
10035/// # .enable_http2()
10036/// # .build();
10037///
10038/// # let executor = hyper_util::rt::TokioExecutor::new();
10039/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10040/// # secret,
10041/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10042/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10043/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10044/// # ),
10045/// # ).build().await.unwrap();
10046///
10047/// # let client = hyper_util::client::legacy::Client::builder(
10048/// # hyper_util::rt::TokioExecutor::new()
10049/// # )
10050/// # .build(
10051/// # hyper_rustls::HttpsConnectorBuilder::new()
10052/// # .with_native_roots()
10053/// # .unwrap()
10054/// # .https_or_http()
10055/// # .enable_http2()
10056/// # .build()
10057/// # );
10058/// # let mut hub = Container::new(client, auth);
10059/// // As the method needs a request, you would usually fill it with the desired information
10060/// // into the respective structure. Some of the parts shown here might not be applicable !
10061/// // Values shown here are possibly random and not representative !
10062/// let mut req = SetNodePoolAutoscalingRequest::default();
10063///
10064/// // You can configure optional parameters by calling the respective setters at will, and
10065/// // execute the final call using `doit()`.
10066/// // Values shown here are possibly random and not representative !
10067/// let result = hub.projects().locations_clusters_node_pools_set_autoscaling(req, "name")
10068/// .doit().await;
10069/// # }
10070/// ```
10071pub struct ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
10072where
10073 C: 'a,
10074{
10075 hub: &'a Container<C>,
10076 _request: SetNodePoolAutoscalingRequest,
10077 _name: String,
10078 _delegate: Option<&'a mut dyn common::Delegate>,
10079 _additional_params: HashMap<String, String>,
10080 _scopes: BTreeSet<String>,
10081}
10082
10083impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {}
10084
10085impl<'a, C> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
10086where
10087 C: common::Connector,
10088{
10089 /// Perform the operation you have build so far.
10090 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10091 use std::borrow::Cow;
10092 use std::io::{Read, Seek};
10093
10094 use common::{url::Params, ToParts};
10095 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10096
10097 let mut dd = common::DefaultDelegate;
10098 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10099 dlg.begin(common::MethodInfo {
10100 id: "container.projects.locations.clusters.nodePools.setAutoscaling",
10101 http_method: hyper::Method::POST,
10102 });
10103
10104 for &field in ["alt", "name"].iter() {
10105 if self._additional_params.contains_key(field) {
10106 dlg.finished(false);
10107 return Err(common::Error::FieldClash(field));
10108 }
10109 }
10110
10111 let mut params = Params::with_capacity(4 + self._additional_params.len());
10112 params.push("name", self._name);
10113
10114 params.extend(self._additional_params.iter());
10115
10116 params.push("alt", "json");
10117 let mut url = self.hub._base_url.clone() + "v1/{+name}:setAutoscaling";
10118 if self._scopes.is_empty() {
10119 self._scopes
10120 .insert(Scope::CloudPlatform.as_ref().to_string());
10121 }
10122
10123 #[allow(clippy::single_element_loop)]
10124 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10125 url = params.uri_replacement(url, param_name, find_this, true);
10126 }
10127 {
10128 let to_remove = ["name"];
10129 params.remove_params(&to_remove);
10130 }
10131
10132 let url = params.parse_with_url(&url);
10133
10134 let mut json_mime_type = mime::APPLICATION_JSON;
10135 let mut request_value_reader = {
10136 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10137 common::remove_json_null_values(&mut value);
10138 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10139 serde_json::to_writer(&mut dst, &value).unwrap();
10140 dst
10141 };
10142 let request_size = request_value_reader
10143 .seek(std::io::SeekFrom::End(0))
10144 .unwrap();
10145 request_value_reader
10146 .seek(std::io::SeekFrom::Start(0))
10147 .unwrap();
10148
10149 loop {
10150 let token = match self
10151 .hub
10152 .auth
10153 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10154 .await
10155 {
10156 Ok(token) => token,
10157 Err(e) => match dlg.token(e) {
10158 Ok(token) => token,
10159 Err(e) => {
10160 dlg.finished(false);
10161 return Err(common::Error::MissingToken(e));
10162 }
10163 },
10164 };
10165 request_value_reader
10166 .seek(std::io::SeekFrom::Start(0))
10167 .unwrap();
10168 let mut req_result = {
10169 let client = &self.hub.client;
10170 dlg.pre_request();
10171 let mut req_builder = hyper::Request::builder()
10172 .method(hyper::Method::POST)
10173 .uri(url.as_str())
10174 .header(USER_AGENT, self.hub._user_agent.clone());
10175
10176 if let Some(token) = token.as_ref() {
10177 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10178 }
10179
10180 let request = req_builder
10181 .header(CONTENT_TYPE, json_mime_type.to_string())
10182 .header(CONTENT_LENGTH, request_size as u64)
10183 .body(common::to_body(
10184 request_value_reader.get_ref().clone().into(),
10185 ));
10186
10187 client.request(request.unwrap()).await
10188 };
10189
10190 match req_result {
10191 Err(err) => {
10192 if let common::Retry::After(d) = dlg.http_error(&err) {
10193 sleep(d).await;
10194 continue;
10195 }
10196 dlg.finished(false);
10197 return Err(common::Error::HttpError(err));
10198 }
10199 Ok(res) => {
10200 let (mut parts, body) = res.into_parts();
10201 let mut body = common::Body::new(body);
10202 if !parts.status.is_success() {
10203 let bytes = common::to_bytes(body).await.unwrap_or_default();
10204 let error = serde_json::from_str(&common::to_string(&bytes));
10205 let response = common::to_response(parts, bytes.into());
10206
10207 if let common::Retry::After(d) =
10208 dlg.http_failure(&response, error.as_ref().ok())
10209 {
10210 sleep(d).await;
10211 continue;
10212 }
10213
10214 dlg.finished(false);
10215
10216 return Err(match error {
10217 Ok(value) => common::Error::BadRequest(value),
10218 _ => common::Error::Failure(response),
10219 });
10220 }
10221 let response = {
10222 let bytes = common::to_bytes(body).await.unwrap_or_default();
10223 let encoded = common::to_string(&bytes);
10224 match serde_json::from_str(&encoded) {
10225 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10226 Err(error) => {
10227 dlg.response_json_decode_error(&encoded, &error);
10228 return Err(common::Error::JsonDecodeError(
10229 encoded.to_string(),
10230 error,
10231 ));
10232 }
10233 }
10234 };
10235
10236 dlg.finished(true);
10237 return Ok(response);
10238 }
10239 }
10240 }
10241 }
10242
10243 ///
10244 /// Sets the *request* property to the given value.
10245 ///
10246 /// Even though the property as already been set when instantiating this call,
10247 /// we provide this method for API completeness.
10248 pub fn request(
10249 mut self,
10250 new_value: SetNodePoolAutoscalingRequest,
10251 ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
10252 self._request = new_value;
10253 self
10254 }
10255 /// The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
10256 ///
10257 /// Sets the *name* path property to the given value.
10258 ///
10259 /// Even though the property as already been set when instantiating this call,
10260 /// we provide this method for API completeness.
10261 pub fn name(
10262 mut self,
10263 new_value: &str,
10264 ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
10265 self._name = new_value.to_string();
10266 self
10267 }
10268 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10269 /// while executing the actual API request.
10270 ///
10271 /// ````text
10272 /// It should be used to handle progress information, and to implement a certain level of resilience.
10273 /// ````
10274 ///
10275 /// Sets the *delegate* property to the given value.
10276 pub fn delegate(
10277 mut self,
10278 new_value: &'a mut dyn common::Delegate,
10279 ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
10280 self._delegate = Some(new_value);
10281 self
10282 }
10283
10284 /// Set any additional parameter of the query string used in the request.
10285 /// It should be used to set parameters which are not yet available through their own
10286 /// setters.
10287 ///
10288 /// Please note that this method must not be used to set any of the known parameters
10289 /// which have their own setter method. If done anyway, the request will fail.
10290 ///
10291 /// # Additional Parameters
10292 ///
10293 /// * *$.xgafv* (query-string) - V1 error format.
10294 /// * *access_token* (query-string) - OAuth access token.
10295 /// * *alt* (query-string) - Data format for response.
10296 /// * *callback* (query-string) - JSONP
10297 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10298 /// * *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.
10299 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10300 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10301 /// * *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.
10302 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10303 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10304 pub fn param<T>(
10305 mut self,
10306 name: T,
10307 value: T,
10308 ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
10309 where
10310 T: AsRef<str>,
10311 {
10312 self._additional_params
10313 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10314 self
10315 }
10316
10317 /// Identifies the authorization scope for the method you are building.
10318 ///
10319 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10320 /// [`Scope::CloudPlatform`].
10321 ///
10322 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10323 /// tokens for more than one scope.
10324 ///
10325 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10326 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10327 /// sufficient, a read-write scope will do as well.
10328 pub fn add_scope<St>(
10329 mut self,
10330 scope: St,
10331 ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
10332 where
10333 St: AsRef<str>,
10334 {
10335 self._scopes.insert(String::from(scope.as_ref()));
10336 self
10337 }
10338 /// Identifies the authorization scope(s) for the method you are building.
10339 ///
10340 /// See [`Self::add_scope()`] for details.
10341 pub fn add_scopes<I, St>(
10342 mut self,
10343 scopes: I,
10344 ) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
10345 where
10346 I: IntoIterator<Item = St>,
10347 St: AsRef<str>,
10348 {
10349 self._scopes
10350 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10351 self
10352 }
10353
10354 /// Removes all scopes, and no default scope will be used either.
10355 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10356 /// for details).
10357 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
10358 self._scopes.clear();
10359 self
10360 }
10361}
10362
10363/// Sets the NodeManagement options for a node pool.
10364///
10365/// A builder for the *locations.clusters.nodePools.setManagement* method supported by a *project* resource.
10366/// It is not used directly, but through a [`ProjectMethods`] instance.
10367///
10368/// # Example
10369///
10370/// Instantiate a resource method builder
10371///
10372/// ```test_harness,no_run
10373/// # extern crate hyper;
10374/// # extern crate hyper_rustls;
10375/// # extern crate google_container1 as container1;
10376/// use container1::api::SetNodePoolManagementRequest;
10377/// # async fn dox() {
10378/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10379///
10380/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10381/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10382/// # .with_native_roots()
10383/// # .unwrap()
10384/// # .https_only()
10385/// # .enable_http2()
10386/// # .build();
10387///
10388/// # let executor = hyper_util::rt::TokioExecutor::new();
10389/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10390/// # secret,
10391/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10392/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10393/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10394/// # ),
10395/// # ).build().await.unwrap();
10396///
10397/// # let client = hyper_util::client::legacy::Client::builder(
10398/// # hyper_util::rt::TokioExecutor::new()
10399/// # )
10400/// # .build(
10401/// # hyper_rustls::HttpsConnectorBuilder::new()
10402/// # .with_native_roots()
10403/// # .unwrap()
10404/// # .https_or_http()
10405/// # .enable_http2()
10406/// # .build()
10407/// # );
10408/// # let mut hub = Container::new(client, auth);
10409/// // As the method needs a request, you would usually fill it with the desired information
10410/// // into the respective structure. Some of the parts shown here might not be applicable !
10411/// // Values shown here are possibly random and not representative !
10412/// let mut req = SetNodePoolManagementRequest::default();
10413///
10414/// // You can configure optional parameters by calling the respective setters at will, and
10415/// // execute the final call using `doit()`.
10416/// // Values shown here are possibly random and not representative !
10417/// let result = hub.projects().locations_clusters_node_pools_set_management(req, "name")
10418/// .doit().await;
10419/// # }
10420/// ```
10421pub struct ProjectLocationClusterNodePoolSetManagementCall<'a, C>
10422where
10423 C: 'a,
10424{
10425 hub: &'a Container<C>,
10426 _request: SetNodePoolManagementRequest,
10427 _name: String,
10428 _delegate: Option<&'a mut dyn common::Delegate>,
10429 _additional_params: HashMap<String, String>,
10430 _scopes: BTreeSet<String>,
10431}
10432
10433impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetManagementCall<'a, C> {}
10434
10435impl<'a, C> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
10436where
10437 C: common::Connector,
10438{
10439 /// Perform the operation you have build so far.
10440 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10441 use std::borrow::Cow;
10442 use std::io::{Read, Seek};
10443
10444 use common::{url::Params, ToParts};
10445 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10446
10447 let mut dd = common::DefaultDelegate;
10448 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10449 dlg.begin(common::MethodInfo {
10450 id: "container.projects.locations.clusters.nodePools.setManagement",
10451 http_method: hyper::Method::POST,
10452 });
10453
10454 for &field in ["alt", "name"].iter() {
10455 if self._additional_params.contains_key(field) {
10456 dlg.finished(false);
10457 return Err(common::Error::FieldClash(field));
10458 }
10459 }
10460
10461 let mut params = Params::with_capacity(4 + self._additional_params.len());
10462 params.push("name", self._name);
10463
10464 params.extend(self._additional_params.iter());
10465
10466 params.push("alt", "json");
10467 let mut url = self.hub._base_url.clone() + "v1/{+name}:setManagement";
10468 if self._scopes.is_empty() {
10469 self._scopes
10470 .insert(Scope::CloudPlatform.as_ref().to_string());
10471 }
10472
10473 #[allow(clippy::single_element_loop)]
10474 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10475 url = params.uri_replacement(url, param_name, find_this, true);
10476 }
10477 {
10478 let to_remove = ["name"];
10479 params.remove_params(&to_remove);
10480 }
10481
10482 let url = params.parse_with_url(&url);
10483
10484 let mut json_mime_type = mime::APPLICATION_JSON;
10485 let mut request_value_reader = {
10486 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10487 common::remove_json_null_values(&mut value);
10488 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10489 serde_json::to_writer(&mut dst, &value).unwrap();
10490 dst
10491 };
10492 let request_size = request_value_reader
10493 .seek(std::io::SeekFrom::End(0))
10494 .unwrap();
10495 request_value_reader
10496 .seek(std::io::SeekFrom::Start(0))
10497 .unwrap();
10498
10499 loop {
10500 let token = match self
10501 .hub
10502 .auth
10503 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10504 .await
10505 {
10506 Ok(token) => token,
10507 Err(e) => match dlg.token(e) {
10508 Ok(token) => token,
10509 Err(e) => {
10510 dlg.finished(false);
10511 return Err(common::Error::MissingToken(e));
10512 }
10513 },
10514 };
10515 request_value_reader
10516 .seek(std::io::SeekFrom::Start(0))
10517 .unwrap();
10518 let mut req_result = {
10519 let client = &self.hub.client;
10520 dlg.pre_request();
10521 let mut req_builder = hyper::Request::builder()
10522 .method(hyper::Method::POST)
10523 .uri(url.as_str())
10524 .header(USER_AGENT, self.hub._user_agent.clone());
10525
10526 if let Some(token) = token.as_ref() {
10527 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10528 }
10529
10530 let request = req_builder
10531 .header(CONTENT_TYPE, json_mime_type.to_string())
10532 .header(CONTENT_LENGTH, request_size as u64)
10533 .body(common::to_body(
10534 request_value_reader.get_ref().clone().into(),
10535 ));
10536
10537 client.request(request.unwrap()).await
10538 };
10539
10540 match req_result {
10541 Err(err) => {
10542 if let common::Retry::After(d) = dlg.http_error(&err) {
10543 sleep(d).await;
10544 continue;
10545 }
10546 dlg.finished(false);
10547 return Err(common::Error::HttpError(err));
10548 }
10549 Ok(res) => {
10550 let (mut parts, body) = res.into_parts();
10551 let mut body = common::Body::new(body);
10552 if !parts.status.is_success() {
10553 let bytes = common::to_bytes(body).await.unwrap_or_default();
10554 let error = serde_json::from_str(&common::to_string(&bytes));
10555 let response = common::to_response(parts, bytes.into());
10556
10557 if let common::Retry::After(d) =
10558 dlg.http_failure(&response, error.as_ref().ok())
10559 {
10560 sleep(d).await;
10561 continue;
10562 }
10563
10564 dlg.finished(false);
10565
10566 return Err(match error {
10567 Ok(value) => common::Error::BadRequest(value),
10568 _ => common::Error::Failure(response),
10569 });
10570 }
10571 let response = {
10572 let bytes = common::to_bytes(body).await.unwrap_or_default();
10573 let encoded = common::to_string(&bytes);
10574 match serde_json::from_str(&encoded) {
10575 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10576 Err(error) => {
10577 dlg.response_json_decode_error(&encoded, &error);
10578 return Err(common::Error::JsonDecodeError(
10579 encoded.to_string(),
10580 error,
10581 ));
10582 }
10583 }
10584 };
10585
10586 dlg.finished(true);
10587 return Ok(response);
10588 }
10589 }
10590 }
10591 }
10592
10593 ///
10594 /// Sets the *request* property to the given value.
10595 ///
10596 /// Even though the property as already been set when instantiating this call,
10597 /// we provide this method for API completeness.
10598 pub fn request(
10599 mut self,
10600 new_value: SetNodePoolManagementRequest,
10601 ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
10602 self._request = new_value;
10603 self
10604 }
10605 /// The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
10606 ///
10607 /// Sets the *name* path property to the given value.
10608 ///
10609 /// Even though the property as already been set when instantiating this call,
10610 /// we provide this method for API completeness.
10611 pub fn name(
10612 mut self,
10613 new_value: &str,
10614 ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
10615 self._name = new_value.to_string();
10616 self
10617 }
10618 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10619 /// while executing the actual API request.
10620 ///
10621 /// ````text
10622 /// It should be used to handle progress information, and to implement a certain level of resilience.
10623 /// ````
10624 ///
10625 /// Sets the *delegate* property to the given value.
10626 pub fn delegate(
10627 mut self,
10628 new_value: &'a mut dyn common::Delegate,
10629 ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
10630 self._delegate = Some(new_value);
10631 self
10632 }
10633
10634 /// Set any additional parameter of the query string used in the request.
10635 /// It should be used to set parameters which are not yet available through their own
10636 /// setters.
10637 ///
10638 /// Please note that this method must not be used to set any of the known parameters
10639 /// which have their own setter method. If done anyway, the request will fail.
10640 ///
10641 /// # Additional Parameters
10642 ///
10643 /// * *$.xgafv* (query-string) - V1 error format.
10644 /// * *access_token* (query-string) - OAuth access token.
10645 /// * *alt* (query-string) - Data format for response.
10646 /// * *callback* (query-string) - JSONP
10647 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10648 /// * *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.
10649 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10650 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10651 /// * *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.
10652 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
10653 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
10654 pub fn param<T>(
10655 mut self,
10656 name: T,
10657 value: T,
10658 ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
10659 where
10660 T: AsRef<str>,
10661 {
10662 self._additional_params
10663 .insert(name.as_ref().to_string(), value.as_ref().to_string());
10664 self
10665 }
10666
10667 /// Identifies the authorization scope for the method you are building.
10668 ///
10669 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
10670 /// [`Scope::CloudPlatform`].
10671 ///
10672 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
10673 /// tokens for more than one scope.
10674 ///
10675 /// Usually there is more than one suitable scope to authorize an operation, some of which may
10676 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
10677 /// sufficient, a read-write scope will do as well.
10678 pub fn add_scope<St>(
10679 mut self,
10680 scope: St,
10681 ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
10682 where
10683 St: AsRef<str>,
10684 {
10685 self._scopes.insert(String::from(scope.as_ref()));
10686 self
10687 }
10688 /// Identifies the authorization scope(s) for the method you are building.
10689 ///
10690 /// See [`Self::add_scope()`] for details.
10691 pub fn add_scopes<I, St>(
10692 mut self,
10693 scopes: I,
10694 ) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
10695 where
10696 I: IntoIterator<Item = St>,
10697 St: AsRef<str>,
10698 {
10699 self._scopes
10700 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
10701 self
10702 }
10703
10704 /// Removes all scopes, and no default scope will be used either.
10705 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
10706 /// for details).
10707 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
10708 self._scopes.clear();
10709 self
10710 }
10711}
10712
10713/// 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.
10714///
10715/// A builder for the *locations.clusters.nodePools.setSize* method supported by a *project* resource.
10716/// It is not used directly, but through a [`ProjectMethods`] instance.
10717///
10718/// # Example
10719///
10720/// Instantiate a resource method builder
10721///
10722/// ```test_harness,no_run
10723/// # extern crate hyper;
10724/// # extern crate hyper_rustls;
10725/// # extern crate google_container1 as container1;
10726/// use container1::api::SetNodePoolSizeRequest;
10727/// # async fn dox() {
10728/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
10729///
10730/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
10731/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
10732/// # .with_native_roots()
10733/// # .unwrap()
10734/// # .https_only()
10735/// # .enable_http2()
10736/// # .build();
10737///
10738/// # let executor = hyper_util::rt::TokioExecutor::new();
10739/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
10740/// # secret,
10741/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
10742/// # yup_oauth2::client::CustomHyperClientBuilder::from(
10743/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
10744/// # ),
10745/// # ).build().await.unwrap();
10746///
10747/// # let client = hyper_util::client::legacy::Client::builder(
10748/// # hyper_util::rt::TokioExecutor::new()
10749/// # )
10750/// # .build(
10751/// # hyper_rustls::HttpsConnectorBuilder::new()
10752/// # .with_native_roots()
10753/// # .unwrap()
10754/// # .https_or_http()
10755/// # .enable_http2()
10756/// # .build()
10757/// # );
10758/// # let mut hub = Container::new(client, auth);
10759/// // As the method needs a request, you would usually fill it with the desired information
10760/// // into the respective structure. Some of the parts shown here might not be applicable !
10761/// // Values shown here are possibly random and not representative !
10762/// let mut req = SetNodePoolSizeRequest::default();
10763///
10764/// // You can configure optional parameters by calling the respective setters at will, and
10765/// // execute the final call using `doit()`.
10766/// // Values shown here are possibly random and not representative !
10767/// let result = hub.projects().locations_clusters_node_pools_set_size(req, "name")
10768/// .doit().await;
10769/// # }
10770/// ```
10771pub struct ProjectLocationClusterNodePoolSetSizeCall<'a, C>
10772where
10773 C: 'a,
10774{
10775 hub: &'a Container<C>,
10776 _request: SetNodePoolSizeRequest,
10777 _name: String,
10778 _delegate: Option<&'a mut dyn common::Delegate>,
10779 _additional_params: HashMap<String, String>,
10780 _scopes: BTreeSet<String>,
10781}
10782
10783impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetSizeCall<'a, C> {}
10784
10785impl<'a, C> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
10786where
10787 C: common::Connector,
10788{
10789 /// Perform the operation you have build so far.
10790 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
10791 use std::borrow::Cow;
10792 use std::io::{Read, Seek};
10793
10794 use common::{url::Params, ToParts};
10795 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
10796
10797 let mut dd = common::DefaultDelegate;
10798 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
10799 dlg.begin(common::MethodInfo {
10800 id: "container.projects.locations.clusters.nodePools.setSize",
10801 http_method: hyper::Method::POST,
10802 });
10803
10804 for &field in ["alt", "name"].iter() {
10805 if self._additional_params.contains_key(field) {
10806 dlg.finished(false);
10807 return Err(common::Error::FieldClash(field));
10808 }
10809 }
10810
10811 let mut params = Params::with_capacity(4 + self._additional_params.len());
10812 params.push("name", self._name);
10813
10814 params.extend(self._additional_params.iter());
10815
10816 params.push("alt", "json");
10817 let mut url = self.hub._base_url.clone() + "v1/{+name}:setSize";
10818 if self._scopes.is_empty() {
10819 self._scopes
10820 .insert(Scope::CloudPlatform.as_ref().to_string());
10821 }
10822
10823 #[allow(clippy::single_element_loop)]
10824 for &(find_this, param_name) in [("{+name}", "name")].iter() {
10825 url = params.uri_replacement(url, param_name, find_this, true);
10826 }
10827 {
10828 let to_remove = ["name"];
10829 params.remove_params(&to_remove);
10830 }
10831
10832 let url = params.parse_with_url(&url);
10833
10834 let mut json_mime_type = mime::APPLICATION_JSON;
10835 let mut request_value_reader = {
10836 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
10837 common::remove_json_null_values(&mut value);
10838 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
10839 serde_json::to_writer(&mut dst, &value).unwrap();
10840 dst
10841 };
10842 let request_size = request_value_reader
10843 .seek(std::io::SeekFrom::End(0))
10844 .unwrap();
10845 request_value_reader
10846 .seek(std::io::SeekFrom::Start(0))
10847 .unwrap();
10848
10849 loop {
10850 let token = match self
10851 .hub
10852 .auth
10853 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
10854 .await
10855 {
10856 Ok(token) => token,
10857 Err(e) => match dlg.token(e) {
10858 Ok(token) => token,
10859 Err(e) => {
10860 dlg.finished(false);
10861 return Err(common::Error::MissingToken(e));
10862 }
10863 },
10864 };
10865 request_value_reader
10866 .seek(std::io::SeekFrom::Start(0))
10867 .unwrap();
10868 let mut req_result = {
10869 let client = &self.hub.client;
10870 dlg.pre_request();
10871 let mut req_builder = hyper::Request::builder()
10872 .method(hyper::Method::POST)
10873 .uri(url.as_str())
10874 .header(USER_AGENT, self.hub._user_agent.clone());
10875
10876 if let Some(token) = token.as_ref() {
10877 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
10878 }
10879
10880 let request = req_builder
10881 .header(CONTENT_TYPE, json_mime_type.to_string())
10882 .header(CONTENT_LENGTH, request_size as u64)
10883 .body(common::to_body(
10884 request_value_reader.get_ref().clone().into(),
10885 ));
10886
10887 client.request(request.unwrap()).await
10888 };
10889
10890 match req_result {
10891 Err(err) => {
10892 if let common::Retry::After(d) = dlg.http_error(&err) {
10893 sleep(d).await;
10894 continue;
10895 }
10896 dlg.finished(false);
10897 return Err(common::Error::HttpError(err));
10898 }
10899 Ok(res) => {
10900 let (mut parts, body) = res.into_parts();
10901 let mut body = common::Body::new(body);
10902 if !parts.status.is_success() {
10903 let bytes = common::to_bytes(body).await.unwrap_or_default();
10904 let error = serde_json::from_str(&common::to_string(&bytes));
10905 let response = common::to_response(parts, bytes.into());
10906
10907 if let common::Retry::After(d) =
10908 dlg.http_failure(&response, error.as_ref().ok())
10909 {
10910 sleep(d).await;
10911 continue;
10912 }
10913
10914 dlg.finished(false);
10915
10916 return Err(match error {
10917 Ok(value) => common::Error::BadRequest(value),
10918 _ => common::Error::Failure(response),
10919 });
10920 }
10921 let response = {
10922 let bytes = common::to_bytes(body).await.unwrap_or_default();
10923 let encoded = common::to_string(&bytes);
10924 match serde_json::from_str(&encoded) {
10925 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
10926 Err(error) => {
10927 dlg.response_json_decode_error(&encoded, &error);
10928 return Err(common::Error::JsonDecodeError(
10929 encoded.to_string(),
10930 error,
10931 ));
10932 }
10933 }
10934 };
10935
10936 dlg.finished(true);
10937 return Ok(response);
10938 }
10939 }
10940 }
10941 }
10942
10943 ///
10944 /// Sets the *request* property to the given value.
10945 ///
10946 /// Even though the property as already been set when instantiating this call,
10947 /// we provide this method for API completeness.
10948 pub fn request(
10949 mut self,
10950 new_value: SetNodePoolSizeRequest,
10951 ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
10952 self._request = new_value;
10953 self
10954 }
10955 /// The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
10956 ///
10957 /// Sets the *name* path property to the given value.
10958 ///
10959 /// Even though the property as already been set when instantiating this call,
10960 /// we provide this method for API completeness.
10961 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
10962 self._name = new_value.to_string();
10963 self
10964 }
10965 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
10966 /// while executing the actual API request.
10967 ///
10968 /// ````text
10969 /// It should be used to handle progress information, and to implement a certain level of resilience.
10970 /// ````
10971 ///
10972 /// Sets the *delegate* property to the given value.
10973 pub fn delegate(
10974 mut self,
10975 new_value: &'a mut dyn common::Delegate,
10976 ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
10977 self._delegate = Some(new_value);
10978 self
10979 }
10980
10981 /// Set any additional parameter of the query string used in the request.
10982 /// It should be used to set parameters which are not yet available through their own
10983 /// setters.
10984 ///
10985 /// Please note that this method must not be used to set any of the known parameters
10986 /// which have their own setter method. If done anyway, the request will fail.
10987 ///
10988 /// # Additional Parameters
10989 ///
10990 /// * *$.xgafv* (query-string) - V1 error format.
10991 /// * *access_token* (query-string) - OAuth access token.
10992 /// * *alt* (query-string) - Data format for response.
10993 /// * *callback* (query-string) - JSONP
10994 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
10995 /// * *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.
10996 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
10997 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
10998 /// * *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.
10999 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11000 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11001 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
11002 where
11003 T: AsRef<str>,
11004 {
11005 self._additional_params
11006 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11007 self
11008 }
11009
11010 /// Identifies the authorization scope for the method you are building.
11011 ///
11012 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11013 /// [`Scope::CloudPlatform`].
11014 ///
11015 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11016 /// tokens for more than one scope.
11017 ///
11018 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11019 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11020 /// sufficient, a read-write scope will do as well.
11021 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
11022 where
11023 St: AsRef<str>,
11024 {
11025 self._scopes.insert(String::from(scope.as_ref()));
11026 self
11027 }
11028 /// Identifies the authorization scope(s) for the method you are building.
11029 ///
11030 /// See [`Self::add_scope()`] for details.
11031 pub fn add_scopes<I, St>(
11032 mut self,
11033 scopes: I,
11034 ) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
11035 where
11036 I: IntoIterator<Item = St>,
11037 St: AsRef<str>,
11038 {
11039 self._scopes
11040 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11041 self
11042 }
11043
11044 /// Removes all scopes, and no default scope will be used either.
11045 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11046 /// for details).
11047 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
11048 self._scopes.clear();
11049 self
11050 }
11051}
11052
11053/// Updates the version and/or image type for the specified node pool.
11054///
11055/// A builder for the *locations.clusters.nodePools.update* method supported by a *project* resource.
11056/// It is not used directly, but through a [`ProjectMethods`] instance.
11057///
11058/// # Example
11059///
11060/// Instantiate a resource method builder
11061///
11062/// ```test_harness,no_run
11063/// # extern crate hyper;
11064/// # extern crate hyper_rustls;
11065/// # extern crate google_container1 as container1;
11066/// use container1::api::UpdateNodePoolRequest;
11067/// # async fn dox() {
11068/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11069///
11070/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11071/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11072/// # .with_native_roots()
11073/// # .unwrap()
11074/// # .https_only()
11075/// # .enable_http2()
11076/// # .build();
11077///
11078/// # let executor = hyper_util::rt::TokioExecutor::new();
11079/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11080/// # secret,
11081/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11082/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11083/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11084/// # ),
11085/// # ).build().await.unwrap();
11086///
11087/// # let client = hyper_util::client::legacy::Client::builder(
11088/// # hyper_util::rt::TokioExecutor::new()
11089/// # )
11090/// # .build(
11091/// # hyper_rustls::HttpsConnectorBuilder::new()
11092/// # .with_native_roots()
11093/// # .unwrap()
11094/// # .https_or_http()
11095/// # .enable_http2()
11096/// # .build()
11097/// # );
11098/// # let mut hub = Container::new(client, auth);
11099/// // As the method needs a request, you would usually fill it with the desired information
11100/// // into the respective structure. Some of the parts shown here might not be applicable !
11101/// // Values shown here are possibly random and not representative !
11102/// let mut req = UpdateNodePoolRequest::default();
11103///
11104/// // You can configure optional parameters by calling the respective setters at will, and
11105/// // execute the final call using `doit()`.
11106/// // Values shown here are possibly random and not representative !
11107/// let result = hub.projects().locations_clusters_node_pools_update(req, "name")
11108/// .doit().await;
11109/// # }
11110/// ```
11111pub struct ProjectLocationClusterNodePoolUpdateCall<'a, C>
11112where
11113 C: 'a,
11114{
11115 hub: &'a Container<C>,
11116 _request: UpdateNodePoolRequest,
11117 _name: String,
11118 _delegate: Option<&'a mut dyn common::Delegate>,
11119 _additional_params: HashMap<String, String>,
11120 _scopes: BTreeSet<String>,
11121}
11122
11123impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolUpdateCall<'a, C> {}
11124
11125impl<'a, C> ProjectLocationClusterNodePoolUpdateCall<'a, C>
11126where
11127 C: common::Connector,
11128{
11129 /// Perform the operation you have build so far.
11130 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
11131 use std::borrow::Cow;
11132 use std::io::{Read, Seek};
11133
11134 use common::{url::Params, ToParts};
11135 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11136
11137 let mut dd = common::DefaultDelegate;
11138 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11139 dlg.begin(common::MethodInfo {
11140 id: "container.projects.locations.clusters.nodePools.update",
11141 http_method: hyper::Method::PUT,
11142 });
11143
11144 for &field in ["alt", "name"].iter() {
11145 if self._additional_params.contains_key(field) {
11146 dlg.finished(false);
11147 return Err(common::Error::FieldClash(field));
11148 }
11149 }
11150
11151 let mut params = Params::with_capacity(4 + self._additional_params.len());
11152 params.push("name", self._name);
11153
11154 params.extend(self._additional_params.iter());
11155
11156 params.push("alt", "json");
11157 let mut url = self.hub._base_url.clone() + "v1/{+name}";
11158 if self._scopes.is_empty() {
11159 self._scopes
11160 .insert(Scope::CloudPlatform.as_ref().to_string());
11161 }
11162
11163 #[allow(clippy::single_element_loop)]
11164 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11165 url = params.uri_replacement(url, param_name, find_this, true);
11166 }
11167 {
11168 let to_remove = ["name"];
11169 params.remove_params(&to_remove);
11170 }
11171
11172 let url = params.parse_with_url(&url);
11173
11174 let mut json_mime_type = mime::APPLICATION_JSON;
11175 let mut request_value_reader = {
11176 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
11177 common::remove_json_null_values(&mut value);
11178 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
11179 serde_json::to_writer(&mut dst, &value).unwrap();
11180 dst
11181 };
11182 let request_size = request_value_reader
11183 .seek(std::io::SeekFrom::End(0))
11184 .unwrap();
11185 request_value_reader
11186 .seek(std::io::SeekFrom::Start(0))
11187 .unwrap();
11188
11189 loop {
11190 let token = match self
11191 .hub
11192 .auth
11193 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11194 .await
11195 {
11196 Ok(token) => token,
11197 Err(e) => match dlg.token(e) {
11198 Ok(token) => token,
11199 Err(e) => {
11200 dlg.finished(false);
11201 return Err(common::Error::MissingToken(e));
11202 }
11203 },
11204 };
11205 request_value_reader
11206 .seek(std::io::SeekFrom::Start(0))
11207 .unwrap();
11208 let mut req_result = {
11209 let client = &self.hub.client;
11210 dlg.pre_request();
11211 let mut req_builder = hyper::Request::builder()
11212 .method(hyper::Method::PUT)
11213 .uri(url.as_str())
11214 .header(USER_AGENT, self.hub._user_agent.clone());
11215
11216 if let Some(token) = token.as_ref() {
11217 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11218 }
11219
11220 let request = req_builder
11221 .header(CONTENT_TYPE, json_mime_type.to_string())
11222 .header(CONTENT_LENGTH, request_size as u64)
11223 .body(common::to_body(
11224 request_value_reader.get_ref().clone().into(),
11225 ));
11226
11227 client.request(request.unwrap()).await
11228 };
11229
11230 match req_result {
11231 Err(err) => {
11232 if let common::Retry::After(d) = dlg.http_error(&err) {
11233 sleep(d).await;
11234 continue;
11235 }
11236 dlg.finished(false);
11237 return Err(common::Error::HttpError(err));
11238 }
11239 Ok(res) => {
11240 let (mut parts, body) = res.into_parts();
11241 let mut body = common::Body::new(body);
11242 if !parts.status.is_success() {
11243 let bytes = common::to_bytes(body).await.unwrap_or_default();
11244 let error = serde_json::from_str(&common::to_string(&bytes));
11245 let response = common::to_response(parts, bytes.into());
11246
11247 if let common::Retry::After(d) =
11248 dlg.http_failure(&response, error.as_ref().ok())
11249 {
11250 sleep(d).await;
11251 continue;
11252 }
11253
11254 dlg.finished(false);
11255
11256 return Err(match error {
11257 Ok(value) => common::Error::BadRequest(value),
11258 _ => common::Error::Failure(response),
11259 });
11260 }
11261 let response = {
11262 let bytes = common::to_bytes(body).await.unwrap_or_default();
11263 let encoded = common::to_string(&bytes);
11264 match serde_json::from_str(&encoded) {
11265 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11266 Err(error) => {
11267 dlg.response_json_decode_error(&encoded, &error);
11268 return Err(common::Error::JsonDecodeError(
11269 encoded.to_string(),
11270 error,
11271 ));
11272 }
11273 }
11274 };
11275
11276 dlg.finished(true);
11277 return Ok(response);
11278 }
11279 }
11280 }
11281 }
11282
11283 ///
11284 /// Sets the *request* property to the given value.
11285 ///
11286 /// Even though the property as already been set when instantiating this call,
11287 /// we provide this method for API completeness.
11288 pub fn request(
11289 mut self,
11290 new_value: UpdateNodePoolRequest,
11291 ) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
11292 self._request = new_value;
11293 self
11294 }
11295 /// The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
11296 ///
11297 /// Sets the *name* path property to the given value.
11298 ///
11299 /// Even though the property as already been set when instantiating this call,
11300 /// we provide this method for API completeness.
11301 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
11302 self._name = new_value.to_string();
11303 self
11304 }
11305 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11306 /// while executing the actual API request.
11307 ///
11308 /// ````text
11309 /// It should be used to handle progress information, and to implement a certain level of resilience.
11310 /// ````
11311 ///
11312 /// Sets the *delegate* property to the given value.
11313 pub fn delegate(
11314 mut self,
11315 new_value: &'a mut dyn common::Delegate,
11316 ) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
11317 self._delegate = Some(new_value);
11318 self
11319 }
11320
11321 /// Set any additional parameter of the query string used in the request.
11322 /// It should be used to set parameters which are not yet available through their own
11323 /// setters.
11324 ///
11325 /// Please note that this method must not be used to set any of the known parameters
11326 /// which have their own setter method. If done anyway, the request will fail.
11327 ///
11328 /// # Additional Parameters
11329 ///
11330 /// * *$.xgafv* (query-string) - V1 error format.
11331 /// * *access_token* (query-string) - OAuth access token.
11332 /// * *alt* (query-string) - Data format for response.
11333 /// * *callback* (query-string) - JSONP
11334 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11335 /// * *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.
11336 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11337 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11338 /// * *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.
11339 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11340 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11341 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
11342 where
11343 T: AsRef<str>,
11344 {
11345 self._additional_params
11346 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11347 self
11348 }
11349
11350 /// Identifies the authorization scope for the method you are building.
11351 ///
11352 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11353 /// [`Scope::CloudPlatform`].
11354 ///
11355 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11356 /// tokens for more than one scope.
11357 ///
11358 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11359 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11360 /// sufficient, a read-write scope will do as well.
11361 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
11362 where
11363 St: AsRef<str>,
11364 {
11365 self._scopes.insert(String::from(scope.as_ref()));
11366 self
11367 }
11368 /// Identifies the authorization scope(s) for the method you are building.
11369 ///
11370 /// See [`Self::add_scope()`] for details.
11371 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
11372 where
11373 I: IntoIterator<Item = St>,
11374 St: AsRef<str>,
11375 {
11376 self._scopes
11377 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11378 self
11379 }
11380
11381 /// Removes all scopes, and no default scope will be used either.
11382 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11383 /// for details).
11384 pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
11385 self._scopes.clear();
11386 self
11387 }
11388}
11389
11390/// 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.
11391///
11392/// A builder for the *locations.clusters.well-known.getOpenid-configuration* method supported by a *project* resource.
11393/// It is not used directly, but through a [`ProjectMethods`] instance.
11394///
11395/// # Example
11396///
11397/// Instantiate a resource method builder
11398///
11399/// ```test_harness,no_run
11400/// # extern crate hyper;
11401/// # extern crate hyper_rustls;
11402/// # extern crate google_container1 as container1;
11403/// # async fn dox() {
11404/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11405///
11406/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11407/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11408/// # .with_native_roots()
11409/// # .unwrap()
11410/// # .https_only()
11411/// # .enable_http2()
11412/// # .build();
11413///
11414/// # let executor = hyper_util::rt::TokioExecutor::new();
11415/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11416/// # secret,
11417/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11418/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11419/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11420/// # ),
11421/// # ).build().await.unwrap();
11422///
11423/// # let client = hyper_util::client::legacy::Client::builder(
11424/// # hyper_util::rt::TokioExecutor::new()
11425/// # )
11426/// # .build(
11427/// # hyper_rustls::HttpsConnectorBuilder::new()
11428/// # .with_native_roots()
11429/// # .unwrap()
11430/// # .https_or_http()
11431/// # .enable_http2()
11432/// # .build()
11433/// # );
11434/// # let mut hub = Container::new(client, auth);
11435/// // You can configure optional parameters by calling the respective setters at will, and
11436/// // execute the final call using `doit()`.
11437/// // Values shown here are possibly random and not representative !
11438/// let result = hub.projects().locations_clusters_well_known_get_openid_configuration("parent")
11439/// .doit().await;
11440/// # }
11441/// ```
11442pub struct ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
11443where
11444 C: 'a,
11445{
11446 hub: &'a Container<C>,
11447 _parent: String,
11448 _delegate: Option<&'a mut dyn common::Delegate>,
11449 _additional_params: HashMap<String, String>,
11450}
11451
11452impl<'a, C> common::CallBuilder
11453 for ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
11454{
11455}
11456
11457impl<'a, C> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
11458where
11459 C: common::Connector,
11460{
11461 /// Perform the operation you have build so far.
11462 pub async fn doit(mut self) -> common::Result<(common::Response, GetOpenIDConfigResponse)> {
11463 use std::borrow::Cow;
11464 use std::io::{Read, Seek};
11465
11466 use common::{url::Params, ToParts};
11467 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11468
11469 let mut dd = common::DefaultDelegate;
11470 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11471 dlg.begin(common::MethodInfo {
11472 id: "container.projects.locations.clusters.well-known.getOpenid-configuration",
11473 http_method: hyper::Method::GET,
11474 });
11475
11476 for &field in ["alt", "parent"].iter() {
11477 if self._additional_params.contains_key(field) {
11478 dlg.finished(false);
11479 return Err(common::Error::FieldClash(field));
11480 }
11481 }
11482
11483 let mut params = Params::with_capacity(3 + self._additional_params.len());
11484 params.push("parent", self._parent);
11485
11486 params.extend(self._additional_params.iter());
11487
11488 params.push("alt", "json");
11489 let mut url = self.hub._base_url.clone() + "v1/{+parent}/.well-known/openid-configuration";
11490
11491 match dlg.api_key() {
11492 Some(value) => params.push("key", value),
11493 None => {
11494 dlg.finished(false);
11495 return Err(common::Error::MissingAPIKey);
11496 }
11497 }
11498
11499 #[allow(clippy::single_element_loop)]
11500 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
11501 url = params.uri_replacement(url, param_name, find_this, true);
11502 }
11503 {
11504 let to_remove = ["parent"];
11505 params.remove_params(&to_remove);
11506 }
11507
11508 let url = params.parse_with_url(&url);
11509
11510 loop {
11511 let mut req_result = {
11512 let client = &self.hub.client;
11513 dlg.pre_request();
11514 let mut req_builder = hyper::Request::builder()
11515 .method(hyper::Method::GET)
11516 .uri(url.as_str())
11517 .header(USER_AGENT, self.hub._user_agent.clone());
11518
11519 let request = req_builder
11520 .header(CONTENT_LENGTH, 0_u64)
11521 .body(common::to_body::<String>(None));
11522
11523 client.request(request.unwrap()).await
11524 };
11525
11526 match req_result {
11527 Err(err) => {
11528 if let common::Retry::After(d) = dlg.http_error(&err) {
11529 sleep(d).await;
11530 continue;
11531 }
11532 dlg.finished(false);
11533 return Err(common::Error::HttpError(err));
11534 }
11535 Ok(res) => {
11536 let (mut parts, body) = res.into_parts();
11537 let mut body = common::Body::new(body);
11538 if !parts.status.is_success() {
11539 let bytes = common::to_bytes(body).await.unwrap_or_default();
11540 let error = serde_json::from_str(&common::to_string(&bytes));
11541 let response = common::to_response(parts, bytes.into());
11542
11543 if let common::Retry::After(d) =
11544 dlg.http_failure(&response, error.as_ref().ok())
11545 {
11546 sleep(d).await;
11547 continue;
11548 }
11549
11550 dlg.finished(false);
11551
11552 return Err(match error {
11553 Ok(value) => common::Error::BadRequest(value),
11554 _ => common::Error::Failure(response),
11555 });
11556 }
11557 let response = {
11558 let bytes = common::to_bytes(body).await.unwrap_or_default();
11559 let encoded = common::to_string(&bytes);
11560 match serde_json::from_str(&encoded) {
11561 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11562 Err(error) => {
11563 dlg.response_json_decode_error(&encoded, &error);
11564 return Err(common::Error::JsonDecodeError(
11565 encoded.to_string(),
11566 error,
11567 ));
11568 }
11569 }
11570 };
11571
11572 dlg.finished(true);
11573 return Ok(response);
11574 }
11575 }
11576 }
11577 }
11578
11579 /// The cluster (project, location, cluster name) to get the discovery document for. Specified in the format `projects/*/locations/*/clusters/*`.
11580 ///
11581 /// Sets the *parent* path property to the given value.
11582 ///
11583 /// Even though the property as already been set when instantiating this call,
11584 /// we provide this method for API completeness.
11585 pub fn parent(
11586 mut self,
11587 new_value: &str,
11588 ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
11589 self._parent = new_value.to_string();
11590 self
11591 }
11592 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11593 /// while executing the actual API request.
11594 ///
11595 /// ````text
11596 /// It should be used to handle progress information, and to implement a certain level of resilience.
11597 /// ````
11598 ///
11599 /// Sets the *delegate* property to the given value.
11600 pub fn delegate(
11601 mut self,
11602 new_value: &'a mut dyn common::Delegate,
11603 ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
11604 self._delegate = Some(new_value);
11605 self
11606 }
11607
11608 /// Set any additional parameter of the query string used in the request.
11609 /// It should be used to set parameters which are not yet available through their own
11610 /// setters.
11611 ///
11612 /// Please note that this method must not be used to set any of the known parameters
11613 /// which have their own setter method. If done anyway, the request will fail.
11614 ///
11615 /// # Additional Parameters
11616 ///
11617 /// * *$.xgafv* (query-string) - V1 error format.
11618 /// * *access_token* (query-string) - OAuth access token.
11619 /// * *alt* (query-string) - Data format for response.
11620 /// * *callback* (query-string) - JSONP
11621 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11622 /// * *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.
11623 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11624 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11625 /// * *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.
11626 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11627 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11628 pub fn param<T>(
11629 mut self,
11630 name: T,
11631 value: T,
11632 ) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
11633 where
11634 T: AsRef<str>,
11635 {
11636 self._additional_params
11637 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11638 self
11639 }
11640}
11641
11642/// Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.
11643///
11644/// A builder for the *locations.clusters.checkAutopilotCompatibility* method supported by a *project* resource.
11645/// It is not used directly, but through a [`ProjectMethods`] instance.
11646///
11647/// # Example
11648///
11649/// Instantiate a resource method builder
11650///
11651/// ```test_harness,no_run
11652/// # extern crate hyper;
11653/// # extern crate hyper_rustls;
11654/// # extern crate google_container1 as container1;
11655/// # async fn dox() {
11656/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11657///
11658/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11659/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11660/// # .with_native_roots()
11661/// # .unwrap()
11662/// # .https_only()
11663/// # .enable_http2()
11664/// # .build();
11665///
11666/// # let executor = hyper_util::rt::TokioExecutor::new();
11667/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11668/// # secret,
11669/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11670/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11671/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11672/// # ),
11673/// # ).build().await.unwrap();
11674///
11675/// # let client = hyper_util::client::legacy::Client::builder(
11676/// # hyper_util::rt::TokioExecutor::new()
11677/// # )
11678/// # .build(
11679/// # hyper_rustls::HttpsConnectorBuilder::new()
11680/// # .with_native_roots()
11681/// # .unwrap()
11682/// # .https_or_http()
11683/// # .enable_http2()
11684/// # .build()
11685/// # );
11686/// # let mut hub = Container::new(client, auth);
11687/// // You can configure optional parameters by calling the respective setters at will, and
11688/// // execute the final call using `doit()`.
11689/// // Values shown here are possibly random and not representative !
11690/// let result = hub.projects().locations_clusters_check_autopilot_compatibility("name")
11691/// .doit().await;
11692/// # }
11693/// ```
11694pub struct ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
11695where
11696 C: 'a,
11697{
11698 hub: &'a Container<C>,
11699 _name: String,
11700 _delegate: Option<&'a mut dyn common::Delegate>,
11701 _additional_params: HashMap<String, String>,
11702 _scopes: BTreeSet<String>,
11703}
11704
11705impl<'a, C> common::CallBuilder for ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {}
11706
11707impl<'a, C> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
11708where
11709 C: common::Connector,
11710{
11711 /// Perform the operation you have build so far.
11712 pub async fn doit(
11713 mut self,
11714 ) -> common::Result<(common::Response, CheckAutopilotCompatibilityResponse)> {
11715 use std::borrow::Cow;
11716 use std::io::{Read, Seek};
11717
11718 use common::{url::Params, ToParts};
11719 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
11720
11721 let mut dd = common::DefaultDelegate;
11722 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
11723 dlg.begin(common::MethodInfo {
11724 id: "container.projects.locations.clusters.checkAutopilotCompatibility",
11725 http_method: hyper::Method::GET,
11726 });
11727
11728 for &field in ["alt", "name"].iter() {
11729 if self._additional_params.contains_key(field) {
11730 dlg.finished(false);
11731 return Err(common::Error::FieldClash(field));
11732 }
11733 }
11734
11735 let mut params = Params::with_capacity(3 + self._additional_params.len());
11736 params.push("name", self._name);
11737
11738 params.extend(self._additional_params.iter());
11739
11740 params.push("alt", "json");
11741 let mut url = self.hub._base_url.clone() + "v1/{+name}:checkAutopilotCompatibility";
11742 if self._scopes.is_empty() {
11743 self._scopes
11744 .insert(Scope::CloudPlatform.as_ref().to_string());
11745 }
11746
11747 #[allow(clippy::single_element_loop)]
11748 for &(find_this, param_name) in [("{+name}", "name")].iter() {
11749 url = params.uri_replacement(url, param_name, find_this, true);
11750 }
11751 {
11752 let to_remove = ["name"];
11753 params.remove_params(&to_remove);
11754 }
11755
11756 let url = params.parse_with_url(&url);
11757
11758 loop {
11759 let token = match self
11760 .hub
11761 .auth
11762 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
11763 .await
11764 {
11765 Ok(token) => token,
11766 Err(e) => match dlg.token(e) {
11767 Ok(token) => token,
11768 Err(e) => {
11769 dlg.finished(false);
11770 return Err(common::Error::MissingToken(e));
11771 }
11772 },
11773 };
11774 let mut req_result = {
11775 let client = &self.hub.client;
11776 dlg.pre_request();
11777 let mut req_builder = hyper::Request::builder()
11778 .method(hyper::Method::GET)
11779 .uri(url.as_str())
11780 .header(USER_AGENT, self.hub._user_agent.clone());
11781
11782 if let Some(token) = token.as_ref() {
11783 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
11784 }
11785
11786 let request = req_builder
11787 .header(CONTENT_LENGTH, 0_u64)
11788 .body(common::to_body::<String>(None));
11789
11790 client.request(request.unwrap()).await
11791 };
11792
11793 match req_result {
11794 Err(err) => {
11795 if let common::Retry::After(d) = dlg.http_error(&err) {
11796 sleep(d).await;
11797 continue;
11798 }
11799 dlg.finished(false);
11800 return Err(common::Error::HttpError(err));
11801 }
11802 Ok(res) => {
11803 let (mut parts, body) = res.into_parts();
11804 let mut body = common::Body::new(body);
11805 if !parts.status.is_success() {
11806 let bytes = common::to_bytes(body).await.unwrap_or_default();
11807 let error = serde_json::from_str(&common::to_string(&bytes));
11808 let response = common::to_response(parts, bytes.into());
11809
11810 if let common::Retry::After(d) =
11811 dlg.http_failure(&response, error.as_ref().ok())
11812 {
11813 sleep(d).await;
11814 continue;
11815 }
11816
11817 dlg.finished(false);
11818
11819 return Err(match error {
11820 Ok(value) => common::Error::BadRequest(value),
11821 _ => common::Error::Failure(response),
11822 });
11823 }
11824 let response = {
11825 let bytes = common::to_bytes(body).await.unwrap_or_default();
11826 let encoded = common::to_string(&bytes);
11827 match serde_json::from_str(&encoded) {
11828 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
11829 Err(error) => {
11830 dlg.response_json_decode_error(&encoded, &error);
11831 return Err(common::Error::JsonDecodeError(
11832 encoded.to_string(),
11833 error,
11834 ));
11835 }
11836 }
11837 };
11838
11839 dlg.finished(true);
11840 return Ok(response);
11841 }
11842 }
11843 }
11844 }
11845
11846 /// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
11847 ///
11848 /// Sets the *name* path property to the given value.
11849 ///
11850 /// Even though the property as already been set when instantiating this call,
11851 /// we provide this method for API completeness.
11852 pub fn name(
11853 mut self,
11854 new_value: &str,
11855 ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
11856 self._name = new_value.to_string();
11857 self
11858 }
11859 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
11860 /// while executing the actual API request.
11861 ///
11862 /// ````text
11863 /// It should be used to handle progress information, and to implement a certain level of resilience.
11864 /// ````
11865 ///
11866 /// Sets the *delegate* property to the given value.
11867 pub fn delegate(
11868 mut self,
11869 new_value: &'a mut dyn common::Delegate,
11870 ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
11871 self._delegate = Some(new_value);
11872 self
11873 }
11874
11875 /// Set any additional parameter of the query string used in the request.
11876 /// It should be used to set parameters which are not yet available through their own
11877 /// setters.
11878 ///
11879 /// Please note that this method must not be used to set any of the known parameters
11880 /// which have their own setter method. If done anyway, the request will fail.
11881 ///
11882 /// # Additional Parameters
11883 ///
11884 /// * *$.xgafv* (query-string) - V1 error format.
11885 /// * *access_token* (query-string) - OAuth access token.
11886 /// * *alt* (query-string) - Data format for response.
11887 /// * *callback* (query-string) - JSONP
11888 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
11889 /// * *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.
11890 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
11891 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
11892 /// * *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.
11893 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
11894 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
11895 pub fn param<T>(
11896 mut self,
11897 name: T,
11898 value: T,
11899 ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
11900 where
11901 T: AsRef<str>,
11902 {
11903 self._additional_params
11904 .insert(name.as_ref().to_string(), value.as_ref().to_string());
11905 self
11906 }
11907
11908 /// Identifies the authorization scope for the method you are building.
11909 ///
11910 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
11911 /// [`Scope::CloudPlatform`].
11912 ///
11913 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
11914 /// tokens for more than one scope.
11915 ///
11916 /// Usually there is more than one suitable scope to authorize an operation, some of which may
11917 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
11918 /// sufficient, a read-write scope will do as well.
11919 pub fn add_scope<St>(
11920 mut self,
11921 scope: St,
11922 ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
11923 where
11924 St: AsRef<str>,
11925 {
11926 self._scopes.insert(String::from(scope.as_ref()));
11927 self
11928 }
11929 /// Identifies the authorization scope(s) for the method you are building.
11930 ///
11931 /// See [`Self::add_scope()`] for details.
11932 pub fn add_scopes<I, St>(
11933 mut self,
11934 scopes: I,
11935 ) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
11936 where
11937 I: IntoIterator<Item = St>,
11938 St: AsRef<str>,
11939 {
11940 self._scopes
11941 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
11942 self
11943 }
11944
11945 /// Removes all scopes, and no default scope will be used either.
11946 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
11947 /// for details).
11948 pub fn clear_scopes(mut self) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
11949 self._scopes.clear();
11950 self
11951 }
11952}
11953
11954/// Completes master IP rotation.
11955///
11956/// A builder for the *locations.clusters.completeIpRotation* method supported by a *project* resource.
11957/// It is not used directly, but through a [`ProjectMethods`] instance.
11958///
11959/// # Example
11960///
11961/// Instantiate a resource method builder
11962///
11963/// ```test_harness,no_run
11964/// # extern crate hyper;
11965/// # extern crate hyper_rustls;
11966/// # extern crate google_container1 as container1;
11967/// use container1::api::CompleteIPRotationRequest;
11968/// # async fn dox() {
11969/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
11970///
11971/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
11972/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
11973/// # .with_native_roots()
11974/// # .unwrap()
11975/// # .https_only()
11976/// # .enable_http2()
11977/// # .build();
11978///
11979/// # let executor = hyper_util::rt::TokioExecutor::new();
11980/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
11981/// # secret,
11982/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
11983/// # yup_oauth2::client::CustomHyperClientBuilder::from(
11984/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
11985/// # ),
11986/// # ).build().await.unwrap();
11987///
11988/// # let client = hyper_util::client::legacy::Client::builder(
11989/// # hyper_util::rt::TokioExecutor::new()
11990/// # )
11991/// # .build(
11992/// # hyper_rustls::HttpsConnectorBuilder::new()
11993/// # .with_native_roots()
11994/// # .unwrap()
11995/// # .https_or_http()
11996/// # .enable_http2()
11997/// # .build()
11998/// # );
11999/// # let mut hub = Container::new(client, auth);
12000/// // As the method needs a request, you would usually fill it with the desired information
12001/// // into the respective structure. Some of the parts shown here might not be applicable !
12002/// // Values shown here are possibly random and not representative !
12003/// let mut req = CompleteIPRotationRequest::default();
12004///
12005/// // You can configure optional parameters by calling the respective setters at will, and
12006/// // execute the final call using `doit()`.
12007/// // Values shown here are possibly random and not representative !
12008/// let result = hub.projects().locations_clusters_complete_ip_rotation(req, "name")
12009/// .doit().await;
12010/// # }
12011/// ```
12012pub struct ProjectLocationClusterCompleteIpRotationCall<'a, C>
12013where
12014 C: 'a,
12015{
12016 hub: &'a Container<C>,
12017 _request: CompleteIPRotationRequest,
12018 _name: String,
12019 _delegate: Option<&'a mut dyn common::Delegate>,
12020 _additional_params: HashMap<String, String>,
12021 _scopes: BTreeSet<String>,
12022}
12023
12024impl<'a, C> common::CallBuilder for ProjectLocationClusterCompleteIpRotationCall<'a, C> {}
12025
12026impl<'a, C> ProjectLocationClusterCompleteIpRotationCall<'a, C>
12027where
12028 C: common::Connector,
12029{
12030 /// Perform the operation you have build so far.
12031 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12032 use std::borrow::Cow;
12033 use std::io::{Read, Seek};
12034
12035 use common::{url::Params, ToParts};
12036 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12037
12038 let mut dd = common::DefaultDelegate;
12039 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12040 dlg.begin(common::MethodInfo {
12041 id: "container.projects.locations.clusters.completeIpRotation",
12042 http_method: hyper::Method::POST,
12043 });
12044
12045 for &field in ["alt", "name"].iter() {
12046 if self._additional_params.contains_key(field) {
12047 dlg.finished(false);
12048 return Err(common::Error::FieldClash(field));
12049 }
12050 }
12051
12052 let mut params = Params::with_capacity(4 + self._additional_params.len());
12053 params.push("name", self._name);
12054
12055 params.extend(self._additional_params.iter());
12056
12057 params.push("alt", "json");
12058 let mut url = self.hub._base_url.clone() + "v1/{+name}:completeIpRotation";
12059 if self._scopes.is_empty() {
12060 self._scopes
12061 .insert(Scope::CloudPlatform.as_ref().to_string());
12062 }
12063
12064 #[allow(clippy::single_element_loop)]
12065 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12066 url = params.uri_replacement(url, param_name, find_this, true);
12067 }
12068 {
12069 let to_remove = ["name"];
12070 params.remove_params(&to_remove);
12071 }
12072
12073 let url = params.parse_with_url(&url);
12074
12075 let mut json_mime_type = mime::APPLICATION_JSON;
12076 let mut request_value_reader = {
12077 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12078 common::remove_json_null_values(&mut value);
12079 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12080 serde_json::to_writer(&mut dst, &value).unwrap();
12081 dst
12082 };
12083 let request_size = request_value_reader
12084 .seek(std::io::SeekFrom::End(0))
12085 .unwrap();
12086 request_value_reader
12087 .seek(std::io::SeekFrom::Start(0))
12088 .unwrap();
12089
12090 loop {
12091 let token = match self
12092 .hub
12093 .auth
12094 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12095 .await
12096 {
12097 Ok(token) => token,
12098 Err(e) => match dlg.token(e) {
12099 Ok(token) => token,
12100 Err(e) => {
12101 dlg.finished(false);
12102 return Err(common::Error::MissingToken(e));
12103 }
12104 },
12105 };
12106 request_value_reader
12107 .seek(std::io::SeekFrom::Start(0))
12108 .unwrap();
12109 let mut req_result = {
12110 let client = &self.hub.client;
12111 dlg.pre_request();
12112 let mut req_builder = hyper::Request::builder()
12113 .method(hyper::Method::POST)
12114 .uri(url.as_str())
12115 .header(USER_AGENT, self.hub._user_agent.clone());
12116
12117 if let Some(token) = token.as_ref() {
12118 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12119 }
12120
12121 let request = req_builder
12122 .header(CONTENT_TYPE, json_mime_type.to_string())
12123 .header(CONTENT_LENGTH, request_size as u64)
12124 .body(common::to_body(
12125 request_value_reader.get_ref().clone().into(),
12126 ));
12127
12128 client.request(request.unwrap()).await
12129 };
12130
12131 match req_result {
12132 Err(err) => {
12133 if let common::Retry::After(d) = dlg.http_error(&err) {
12134 sleep(d).await;
12135 continue;
12136 }
12137 dlg.finished(false);
12138 return Err(common::Error::HttpError(err));
12139 }
12140 Ok(res) => {
12141 let (mut parts, body) = res.into_parts();
12142 let mut body = common::Body::new(body);
12143 if !parts.status.is_success() {
12144 let bytes = common::to_bytes(body).await.unwrap_or_default();
12145 let error = serde_json::from_str(&common::to_string(&bytes));
12146 let response = common::to_response(parts, bytes.into());
12147
12148 if let common::Retry::After(d) =
12149 dlg.http_failure(&response, error.as_ref().ok())
12150 {
12151 sleep(d).await;
12152 continue;
12153 }
12154
12155 dlg.finished(false);
12156
12157 return Err(match error {
12158 Ok(value) => common::Error::BadRequest(value),
12159 _ => common::Error::Failure(response),
12160 });
12161 }
12162 let response = {
12163 let bytes = common::to_bytes(body).await.unwrap_or_default();
12164 let encoded = common::to_string(&bytes);
12165 match serde_json::from_str(&encoded) {
12166 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12167 Err(error) => {
12168 dlg.response_json_decode_error(&encoded, &error);
12169 return Err(common::Error::JsonDecodeError(
12170 encoded.to_string(),
12171 error,
12172 ));
12173 }
12174 }
12175 };
12176
12177 dlg.finished(true);
12178 return Ok(response);
12179 }
12180 }
12181 }
12182 }
12183
12184 ///
12185 /// Sets the *request* property to the given value.
12186 ///
12187 /// Even though the property as already been set when instantiating this call,
12188 /// we provide this method for API completeness.
12189 pub fn request(
12190 mut self,
12191 new_value: CompleteIPRotationRequest,
12192 ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
12193 self._request = new_value;
12194 self
12195 }
12196 /// The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
12197 ///
12198 /// Sets the *name* path property to the given value.
12199 ///
12200 /// Even though the property as already been set when instantiating this call,
12201 /// we provide this method for API completeness.
12202 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
12203 self._name = new_value.to_string();
12204 self
12205 }
12206 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12207 /// while executing the actual API request.
12208 ///
12209 /// ````text
12210 /// It should be used to handle progress information, and to implement a certain level of resilience.
12211 /// ````
12212 ///
12213 /// Sets the *delegate* property to the given value.
12214 pub fn delegate(
12215 mut self,
12216 new_value: &'a mut dyn common::Delegate,
12217 ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
12218 self._delegate = Some(new_value);
12219 self
12220 }
12221
12222 /// Set any additional parameter of the query string used in the request.
12223 /// It should be used to set parameters which are not yet available through their own
12224 /// setters.
12225 ///
12226 /// Please note that this method must not be used to set any of the known parameters
12227 /// which have their own setter method. If done anyway, the request will fail.
12228 ///
12229 /// # Additional Parameters
12230 ///
12231 /// * *$.xgafv* (query-string) - V1 error format.
12232 /// * *access_token* (query-string) - OAuth access token.
12233 /// * *alt* (query-string) - Data format for response.
12234 /// * *callback* (query-string) - JSONP
12235 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12236 /// * *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.
12237 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12238 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12239 /// * *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.
12240 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12241 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12242 pub fn param<T>(
12243 mut self,
12244 name: T,
12245 value: T,
12246 ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
12247 where
12248 T: AsRef<str>,
12249 {
12250 self._additional_params
12251 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12252 self
12253 }
12254
12255 /// Identifies the authorization scope for the method you are building.
12256 ///
12257 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12258 /// [`Scope::CloudPlatform`].
12259 ///
12260 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12261 /// tokens for more than one scope.
12262 ///
12263 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12264 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12265 /// sufficient, a read-write scope will do as well.
12266 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
12267 where
12268 St: AsRef<str>,
12269 {
12270 self._scopes.insert(String::from(scope.as_ref()));
12271 self
12272 }
12273 /// Identifies the authorization scope(s) for the method you are building.
12274 ///
12275 /// See [`Self::add_scope()`] for details.
12276 pub fn add_scopes<I, St>(
12277 mut self,
12278 scopes: I,
12279 ) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
12280 where
12281 I: IntoIterator<Item = St>,
12282 St: AsRef<str>,
12283 {
12284 self._scopes
12285 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12286 self
12287 }
12288
12289 /// Removes all scopes, and no default scope will be used either.
12290 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12291 /// for details).
12292 pub fn clear_scopes(mut self) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
12293 self._scopes.clear();
12294 self
12295 }
12296}
12297
12298/// 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.
12299///
12300/// A builder for the *locations.clusters.create* method supported by a *project* resource.
12301/// It is not used directly, but through a [`ProjectMethods`] instance.
12302///
12303/// # Example
12304///
12305/// Instantiate a resource method builder
12306///
12307/// ```test_harness,no_run
12308/// # extern crate hyper;
12309/// # extern crate hyper_rustls;
12310/// # extern crate google_container1 as container1;
12311/// use container1::api::CreateClusterRequest;
12312/// # async fn dox() {
12313/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12314///
12315/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12316/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12317/// # .with_native_roots()
12318/// # .unwrap()
12319/// # .https_only()
12320/// # .enable_http2()
12321/// # .build();
12322///
12323/// # let executor = hyper_util::rt::TokioExecutor::new();
12324/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12325/// # secret,
12326/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12327/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12328/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12329/// # ),
12330/// # ).build().await.unwrap();
12331///
12332/// # let client = hyper_util::client::legacy::Client::builder(
12333/// # hyper_util::rt::TokioExecutor::new()
12334/// # )
12335/// # .build(
12336/// # hyper_rustls::HttpsConnectorBuilder::new()
12337/// # .with_native_roots()
12338/// # .unwrap()
12339/// # .https_or_http()
12340/// # .enable_http2()
12341/// # .build()
12342/// # );
12343/// # let mut hub = Container::new(client, auth);
12344/// // As the method needs a request, you would usually fill it with the desired information
12345/// // into the respective structure. Some of the parts shown here might not be applicable !
12346/// // Values shown here are possibly random and not representative !
12347/// let mut req = CreateClusterRequest::default();
12348///
12349/// // You can configure optional parameters by calling the respective setters at will, and
12350/// // execute the final call using `doit()`.
12351/// // Values shown here are possibly random and not representative !
12352/// let result = hub.projects().locations_clusters_create(req, "parent")
12353/// .doit().await;
12354/// # }
12355/// ```
12356pub struct ProjectLocationClusterCreateCall<'a, C>
12357where
12358 C: 'a,
12359{
12360 hub: &'a Container<C>,
12361 _request: CreateClusterRequest,
12362 _parent: String,
12363 _delegate: Option<&'a mut dyn common::Delegate>,
12364 _additional_params: HashMap<String, String>,
12365 _scopes: BTreeSet<String>,
12366}
12367
12368impl<'a, C> common::CallBuilder for ProjectLocationClusterCreateCall<'a, C> {}
12369
12370impl<'a, C> ProjectLocationClusterCreateCall<'a, C>
12371where
12372 C: common::Connector,
12373{
12374 /// Perform the operation you have build so far.
12375 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12376 use std::borrow::Cow;
12377 use std::io::{Read, Seek};
12378
12379 use common::{url::Params, ToParts};
12380 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12381
12382 let mut dd = common::DefaultDelegate;
12383 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12384 dlg.begin(common::MethodInfo {
12385 id: "container.projects.locations.clusters.create",
12386 http_method: hyper::Method::POST,
12387 });
12388
12389 for &field in ["alt", "parent"].iter() {
12390 if self._additional_params.contains_key(field) {
12391 dlg.finished(false);
12392 return Err(common::Error::FieldClash(field));
12393 }
12394 }
12395
12396 let mut params = Params::with_capacity(4 + self._additional_params.len());
12397 params.push("parent", self._parent);
12398
12399 params.extend(self._additional_params.iter());
12400
12401 params.push("alt", "json");
12402 let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
12403 if self._scopes.is_empty() {
12404 self._scopes
12405 .insert(Scope::CloudPlatform.as_ref().to_string());
12406 }
12407
12408 #[allow(clippy::single_element_loop)]
12409 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
12410 url = params.uri_replacement(url, param_name, find_this, true);
12411 }
12412 {
12413 let to_remove = ["parent"];
12414 params.remove_params(&to_remove);
12415 }
12416
12417 let url = params.parse_with_url(&url);
12418
12419 let mut json_mime_type = mime::APPLICATION_JSON;
12420 let mut request_value_reader = {
12421 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
12422 common::remove_json_null_values(&mut value);
12423 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
12424 serde_json::to_writer(&mut dst, &value).unwrap();
12425 dst
12426 };
12427 let request_size = request_value_reader
12428 .seek(std::io::SeekFrom::End(0))
12429 .unwrap();
12430 request_value_reader
12431 .seek(std::io::SeekFrom::Start(0))
12432 .unwrap();
12433
12434 loop {
12435 let token = match self
12436 .hub
12437 .auth
12438 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12439 .await
12440 {
12441 Ok(token) => token,
12442 Err(e) => match dlg.token(e) {
12443 Ok(token) => token,
12444 Err(e) => {
12445 dlg.finished(false);
12446 return Err(common::Error::MissingToken(e));
12447 }
12448 },
12449 };
12450 request_value_reader
12451 .seek(std::io::SeekFrom::Start(0))
12452 .unwrap();
12453 let mut req_result = {
12454 let client = &self.hub.client;
12455 dlg.pre_request();
12456 let mut req_builder = hyper::Request::builder()
12457 .method(hyper::Method::POST)
12458 .uri(url.as_str())
12459 .header(USER_AGENT, self.hub._user_agent.clone());
12460
12461 if let Some(token) = token.as_ref() {
12462 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12463 }
12464
12465 let request = req_builder
12466 .header(CONTENT_TYPE, json_mime_type.to_string())
12467 .header(CONTENT_LENGTH, request_size as u64)
12468 .body(common::to_body(
12469 request_value_reader.get_ref().clone().into(),
12470 ));
12471
12472 client.request(request.unwrap()).await
12473 };
12474
12475 match req_result {
12476 Err(err) => {
12477 if let common::Retry::After(d) = dlg.http_error(&err) {
12478 sleep(d).await;
12479 continue;
12480 }
12481 dlg.finished(false);
12482 return Err(common::Error::HttpError(err));
12483 }
12484 Ok(res) => {
12485 let (mut parts, body) = res.into_parts();
12486 let mut body = common::Body::new(body);
12487 if !parts.status.is_success() {
12488 let bytes = common::to_bytes(body).await.unwrap_or_default();
12489 let error = serde_json::from_str(&common::to_string(&bytes));
12490 let response = common::to_response(parts, bytes.into());
12491
12492 if let common::Retry::After(d) =
12493 dlg.http_failure(&response, error.as_ref().ok())
12494 {
12495 sleep(d).await;
12496 continue;
12497 }
12498
12499 dlg.finished(false);
12500
12501 return Err(match error {
12502 Ok(value) => common::Error::BadRequest(value),
12503 _ => common::Error::Failure(response),
12504 });
12505 }
12506 let response = {
12507 let bytes = common::to_bytes(body).await.unwrap_or_default();
12508 let encoded = common::to_string(&bytes);
12509 match serde_json::from_str(&encoded) {
12510 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12511 Err(error) => {
12512 dlg.response_json_decode_error(&encoded, &error);
12513 return Err(common::Error::JsonDecodeError(
12514 encoded.to_string(),
12515 error,
12516 ));
12517 }
12518 }
12519 };
12520
12521 dlg.finished(true);
12522 return Ok(response);
12523 }
12524 }
12525 }
12526 }
12527
12528 ///
12529 /// Sets the *request* property to the given value.
12530 ///
12531 /// Even though the property as already been set when instantiating this call,
12532 /// we provide this method for API completeness.
12533 pub fn request(
12534 mut self,
12535 new_value: CreateClusterRequest,
12536 ) -> ProjectLocationClusterCreateCall<'a, C> {
12537 self._request = new_value;
12538 self
12539 }
12540 /// The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
12541 ///
12542 /// Sets the *parent* path property to the given value.
12543 ///
12544 /// Even though the property as already been set when instantiating this call,
12545 /// we provide this method for API completeness.
12546 pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterCreateCall<'a, C> {
12547 self._parent = new_value.to_string();
12548 self
12549 }
12550 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12551 /// while executing the actual API request.
12552 ///
12553 /// ````text
12554 /// It should be used to handle progress information, and to implement a certain level of resilience.
12555 /// ````
12556 ///
12557 /// Sets the *delegate* property to the given value.
12558 pub fn delegate(
12559 mut self,
12560 new_value: &'a mut dyn common::Delegate,
12561 ) -> ProjectLocationClusterCreateCall<'a, C> {
12562 self._delegate = Some(new_value);
12563 self
12564 }
12565
12566 /// Set any additional parameter of the query string used in the request.
12567 /// It should be used to set parameters which are not yet available through their own
12568 /// setters.
12569 ///
12570 /// Please note that this method must not be used to set any of the known parameters
12571 /// which have their own setter method. If done anyway, the request will fail.
12572 ///
12573 /// # Additional Parameters
12574 ///
12575 /// * *$.xgafv* (query-string) - V1 error format.
12576 /// * *access_token* (query-string) - OAuth access token.
12577 /// * *alt* (query-string) - Data format for response.
12578 /// * *callback* (query-string) - JSONP
12579 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12580 /// * *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.
12581 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12582 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12583 /// * *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.
12584 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12585 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12586 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterCreateCall<'a, C>
12587 where
12588 T: AsRef<str>,
12589 {
12590 self._additional_params
12591 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12592 self
12593 }
12594
12595 /// Identifies the authorization scope for the method you are building.
12596 ///
12597 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12598 /// [`Scope::CloudPlatform`].
12599 ///
12600 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12601 /// tokens for more than one scope.
12602 ///
12603 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12604 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12605 /// sufficient, a read-write scope will do as well.
12606 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterCreateCall<'a, C>
12607 where
12608 St: AsRef<str>,
12609 {
12610 self._scopes.insert(String::from(scope.as_ref()));
12611 self
12612 }
12613 /// Identifies the authorization scope(s) for the method you are building.
12614 ///
12615 /// See [`Self::add_scope()`] for details.
12616 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterCreateCall<'a, C>
12617 where
12618 I: IntoIterator<Item = St>,
12619 St: AsRef<str>,
12620 {
12621 self._scopes
12622 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12623 self
12624 }
12625
12626 /// Removes all scopes, and no default scope will be used either.
12627 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12628 /// for details).
12629 pub fn clear_scopes(mut self) -> ProjectLocationClusterCreateCall<'a, C> {
12630 self._scopes.clear();
12631 self
12632 }
12633}
12634
12635/// 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.
12636///
12637/// A builder for the *locations.clusters.delete* method supported by a *project* resource.
12638/// It is not used directly, but through a [`ProjectMethods`] instance.
12639///
12640/// # Example
12641///
12642/// Instantiate a resource method builder
12643///
12644/// ```test_harness,no_run
12645/// # extern crate hyper;
12646/// # extern crate hyper_rustls;
12647/// # extern crate google_container1 as container1;
12648/// # async fn dox() {
12649/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12650///
12651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12652/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12653/// # .with_native_roots()
12654/// # .unwrap()
12655/// # .https_only()
12656/// # .enable_http2()
12657/// # .build();
12658///
12659/// # let executor = hyper_util::rt::TokioExecutor::new();
12660/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12661/// # secret,
12662/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12663/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12664/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12665/// # ),
12666/// # ).build().await.unwrap();
12667///
12668/// # let client = hyper_util::client::legacy::Client::builder(
12669/// # hyper_util::rt::TokioExecutor::new()
12670/// # )
12671/// # .build(
12672/// # hyper_rustls::HttpsConnectorBuilder::new()
12673/// # .with_native_roots()
12674/// # .unwrap()
12675/// # .https_or_http()
12676/// # .enable_http2()
12677/// # .build()
12678/// # );
12679/// # let mut hub = Container::new(client, auth);
12680/// // You can configure optional parameters by calling the respective setters at will, and
12681/// // execute the final call using `doit()`.
12682/// // Values shown here are possibly random and not representative !
12683/// let result = hub.projects().locations_clusters_delete("name")
12684/// .zone("et")
12685/// .project_id("vero")
12686/// .cluster_id("erat")
12687/// .doit().await;
12688/// # }
12689/// ```
12690pub struct ProjectLocationClusterDeleteCall<'a, C>
12691where
12692 C: 'a,
12693{
12694 hub: &'a Container<C>,
12695 _name: String,
12696 _zone: Option<String>,
12697 _project_id: Option<String>,
12698 _cluster_id: Option<String>,
12699 _delegate: Option<&'a mut dyn common::Delegate>,
12700 _additional_params: HashMap<String, String>,
12701 _scopes: BTreeSet<String>,
12702}
12703
12704impl<'a, C> common::CallBuilder for ProjectLocationClusterDeleteCall<'a, C> {}
12705
12706impl<'a, C> ProjectLocationClusterDeleteCall<'a, C>
12707where
12708 C: common::Connector,
12709{
12710 /// Perform the operation you have build so far.
12711 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
12712 use std::borrow::Cow;
12713 use std::io::{Read, Seek};
12714
12715 use common::{url::Params, ToParts};
12716 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
12717
12718 let mut dd = common::DefaultDelegate;
12719 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
12720 dlg.begin(common::MethodInfo {
12721 id: "container.projects.locations.clusters.delete",
12722 http_method: hyper::Method::DELETE,
12723 });
12724
12725 for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
12726 if self._additional_params.contains_key(field) {
12727 dlg.finished(false);
12728 return Err(common::Error::FieldClash(field));
12729 }
12730 }
12731
12732 let mut params = Params::with_capacity(6 + self._additional_params.len());
12733 params.push("name", self._name);
12734 if let Some(value) = self._zone.as_ref() {
12735 params.push("zone", value);
12736 }
12737 if let Some(value) = self._project_id.as_ref() {
12738 params.push("projectId", value);
12739 }
12740 if let Some(value) = self._cluster_id.as_ref() {
12741 params.push("clusterId", value);
12742 }
12743
12744 params.extend(self._additional_params.iter());
12745
12746 params.push("alt", "json");
12747 let mut url = self.hub._base_url.clone() + "v1/{+name}";
12748 if self._scopes.is_empty() {
12749 self._scopes
12750 .insert(Scope::CloudPlatform.as_ref().to_string());
12751 }
12752
12753 #[allow(clippy::single_element_loop)]
12754 for &(find_this, param_name) in [("{+name}", "name")].iter() {
12755 url = params.uri_replacement(url, param_name, find_this, true);
12756 }
12757 {
12758 let to_remove = ["name"];
12759 params.remove_params(&to_remove);
12760 }
12761
12762 let url = params.parse_with_url(&url);
12763
12764 loop {
12765 let token = match self
12766 .hub
12767 .auth
12768 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
12769 .await
12770 {
12771 Ok(token) => token,
12772 Err(e) => match dlg.token(e) {
12773 Ok(token) => token,
12774 Err(e) => {
12775 dlg.finished(false);
12776 return Err(common::Error::MissingToken(e));
12777 }
12778 },
12779 };
12780 let mut req_result = {
12781 let client = &self.hub.client;
12782 dlg.pre_request();
12783 let mut req_builder = hyper::Request::builder()
12784 .method(hyper::Method::DELETE)
12785 .uri(url.as_str())
12786 .header(USER_AGENT, self.hub._user_agent.clone());
12787
12788 if let Some(token) = token.as_ref() {
12789 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
12790 }
12791
12792 let request = req_builder
12793 .header(CONTENT_LENGTH, 0_u64)
12794 .body(common::to_body::<String>(None));
12795
12796 client.request(request.unwrap()).await
12797 };
12798
12799 match req_result {
12800 Err(err) => {
12801 if let common::Retry::After(d) = dlg.http_error(&err) {
12802 sleep(d).await;
12803 continue;
12804 }
12805 dlg.finished(false);
12806 return Err(common::Error::HttpError(err));
12807 }
12808 Ok(res) => {
12809 let (mut parts, body) = res.into_parts();
12810 let mut body = common::Body::new(body);
12811 if !parts.status.is_success() {
12812 let bytes = common::to_bytes(body).await.unwrap_or_default();
12813 let error = serde_json::from_str(&common::to_string(&bytes));
12814 let response = common::to_response(parts, bytes.into());
12815
12816 if let common::Retry::After(d) =
12817 dlg.http_failure(&response, error.as_ref().ok())
12818 {
12819 sleep(d).await;
12820 continue;
12821 }
12822
12823 dlg.finished(false);
12824
12825 return Err(match error {
12826 Ok(value) => common::Error::BadRequest(value),
12827 _ => common::Error::Failure(response),
12828 });
12829 }
12830 let response = {
12831 let bytes = common::to_bytes(body).await.unwrap_or_default();
12832 let encoded = common::to_string(&bytes);
12833 match serde_json::from_str(&encoded) {
12834 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
12835 Err(error) => {
12836 dlg.response_json_decode_error(&encoded, &error);
12837 return Err(common::Error::JsonDecodeError(
12838 encoded.to_string(),
12839 error,
12840 ));
12841 }
12842 }
12843 };
12844
12845 dlg.finished(true);
12846 return Ok(response);
12847 }
12848 }
12849 }
12850 }
12851
12852 /// The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
12853 ///
12854 /// Sets the *name* path property to the given value.
12855 ///
12856 /// Even though the property as already been set when instantiating this call,
12857 /// we provide this method for API completeness.
12858 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
12859 self._name = new_value.to_string();
12860 self
12861 }
12862 /// 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.
12863 ///
12864 /// Sets the *zone* query property to the given value.
12865 pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
12866 self._zone = Some(new_value.to_string());
12867 self
12868 }
12869 /// 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.
12870 ///
12871 /// Sets the *project id* query property to the given value.
12872 pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
12873 self._project_id = Some(new_value.to_string());
12874 self
12875 }
12876 /// Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
12877 ///
12878 /// Sets the *cluster id* query property to the given value.
12879 pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
12880 self._cluster_id = Some(new_value.to_string());
12881 self
12882 }
12883 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
12884 /// while executing the actual API request.
12885 ///
12886 /// ````text
12887 /// It should be used to handle progress information, and to implement a certain level of resilience.
12888 /// ````
12889 ///
12890 /// Sets the *delegate* property to the given value.
12891 pub fn delegate(
12892 mut self,
12893 new_value: &'a mut dyn common::Delegate,
12894 ) -> ProjectLocationClusterDeleteCall<'a, C> {
12895 self._delegate = Some(new_value);
12896 self
12897 }
12898
12899 /// Set any additional parameter of the query string used in the request.
12900 /// It should be used to set parameters which are not yet available through their own
12901 /// setters.
12902 ///
12903 /// Please note that this method must not be used to set any of the known parameters
12904 /// which have their own setter method. If done anyway, the request will fail.
12905 ///
12906 /// # Additional Parameters
12907 ///
12908 /// * *$.xgafv* (query-string) - V1 error format.
12909 /// * *access_token* (query-string) - OAuth access token.
12910 /// * *alt* (query-string) - Data format for response.
12911 /// * *callback* (query-string) - JSONP
12912 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
12913 /// * *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.
12914 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
12915 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
12916 /// * *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.
12917 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
12918 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
12919 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterDeleteCall<'a, C>
12920 where
12921 T: AsRef<str>,
12922 {
12923 self._additional_params
12924 .insert(name.as_ref().to_string(), value.as_ref().to_string());
12925 self
12926 }
12927
12928 /// Identifies the authorization scope for the method you are building.
12929 ///
12930 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
12931 /// [`Scope::CloudPlatform`].
12932 ///
12933 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
12934 /// tokens for more than one scope.
12935 ///
12936 /// Usually there is more than one suitable scope to authorize an operation, some of which may
12937 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
12938 /// sufficient, a read-write scope will do as well.
12939 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterDeleteCall<'a, C>
12940 where
12941 St: AsRef<str>,
12942 {
12943 self._scopes.insert(String::from(scope.as_ref()));
12944 self
12945 }
12946 /// Identifies the authorization scope(s) for the method you are building.
12947 ///
12948 /// See [`Self::add_scope()`] for details.
12949 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterDeleteCall<'a, C>
12950 where
12951 I: IntoIterator<Item = St>,
12952 St: AsRef<str>,
12953 {
12954 self._scopes
12955 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
12956 self
12957 }
12958
12959 /// Removes all scopes, and no default scope will be used either.
12960 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
12961 /// for details).
12962 pub fn clear_scopes(mut self) -> ProjectLocationClusterDeleteCall<'a, C> {
12963 self._scopes.clear();
12964 self
12965 }
12966}
12967
12968/// Fetch upgrade information of a specific cluster.
12969///
12970/// A builder for the *locations.clusters.fetchClusterUpgradeInfo* method supported by a *project* resource.
12971/// It is not used directly, but through a [`ProjectMethods`] instance.
12972///
12973/// # Example
12974///
12975/// Instantiate a resource method builder
12976///
12977/// ```test_harness,no_run
12978/// # extern crate hyper;
12979/// # extern crate hyper_rustls;
12980/// # extern crate google_container1 as container1;
12981/// # async fn dox() {
12982/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
12983///
12984/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
12985/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
12986/// # .with_native_roots()
12987/// # .unwrap()
12988/// # .https_only()
12989/// # .enable_http2()
12990/// # .build();
12991///
12992/// # let executor = hyper_util::rt::TokioExecutor::new();
12993/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
12994/// # secret,
12995/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
12996/// # yup_oauth2::client::CustomHyperClientBuilder::from(
12997/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
12998/// # ),
12999/// # ).build().await.unwrap();
13000///
13001/// # let client = hyper_util::client::legacy::Client::builder(
13002/// # hyper_util::rt::TokioExecutor::new()
13003/// # )
13004/// # .build(
13005/// # hyper_rustls::HttpsConnectorBuilder::new()
13006/// # .with_native_roots()
13007/// # .unwrap()
13008/// # .https_or_http()
13009/// # .enable_http2()
13010/// # .build()
13011/// # );
13012/// # let mut hub = Container::new(client, auth);
13013/// // You can configure optional parameters by calling the respective setters at will, and
13014/// // execute the final call using `doit()`.
13015/// // Values shown here are possibly random and not representative !
13016/// let result = hub.projects().locations_clusters_fetch_cluster_upgrade_info("name")
13017/// .version("duo")
13018/// .doit().await;
13019/// # }
13020/// ```
13021pub struct ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
13022where
13023 C: 'a,
13024{
13025 hub: &'a Container<C>,
13026 _name: String,
13027 _version: Option<String>,
13028 _delegate: Option<&'a mut dyn common::Delegate>,
13029 _additional_params: HashMap<String, String>,
13030 _scopes: BTreeSet<String>,
13031}
13032
13033impl<'a, C> common::CallBuilder for ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {}
13034
13035impl<'a, C> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
13036where
13037 C: common::Connector,
13038{
13039 /// Perform the operation you have build so far.
13040 pub async fn doit(mut self) -> common::Result<(common::Response, ClusterUpgradeInfo)> {
13041 use std::borrow::Cow;
13042 use std::io::{Read, Seek};
13043
13044 use common::{url::Params, ToParts};
13045 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13046
13047 let mut dd = common::DefaultDelegate;
13048 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13049 dlg.begin(common::MethodInfo {
13050 id: "container.projects.locations.clusters.fetchClusterUpgradeInfo",
13051 http_method: hyper::Method::GET,
13052 });
13053
13054 for &field in ["alt", "name", "version"].iter() {
13055 if self._additional_params.contains_key(field) {
13056 dlg.finished(false);
13057 return Err(common::Error::FieldClash(field));
13058 }
13059 }
13060
13061 let mut params = Params::with_capacity(4 + self._additional_params.len());
13062 params.push("name", self._name);
13063 if let Some(value) = self._version.as_ref() {
13064 params.push("version", value);
13065 }
13066
13067 params.extend(self._additional_params.iter());
13068
13069 params.push("alt", "json");
13070 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchClusterUpgradeInfo";
13071 if self._scopes.is_empty() {
13072 self._scopes
13073 .insert(Scope::CloudPlatform.as_ref().to_string());
13074 }
13075
13076 #[allow(clippy::single_element_loop)]
13077 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13078 url = params.uri_replacement(url, param_name, find_this, true);
13079 }
13080 {
13081 let to_remove = ["name"];
13082 params.remove_params(&to_remove);
13083 }
13084
13085 let url = params.parse_with_url(&url);
13086
13087 loop {
13088 let token = match self
13089 .hub
13090 .auth
13091 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13092 .await
13093 {
13094 Ok(token) => token,
13095 Err(e) => match dlg.token(e) {
13096 Ok(token) => token,
13097 Err(e) => {
13098 dlg.finished(false);
13099 return Err(common::Error::MissingToken(e));
13100 }
13101 },
13102 };
13103 let mut req_result = {
13104 let client = &self.hub.client;
13105 dlg.pre_request();
13106 let mut req_builder = hyper::Request::builder()
13107 .method(hyper::Method::GET)
13108 .uri(url.as_str())
13109 .header(USER_AGENT, self.hub._user_agent.clone());
13110
13111 if let Some(token) = token.as_ref() {
13112 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13113 }
13114
13115 let request = req_builder
13116 .header(CONTENT_LENGTH, 0_u64)
13117 .body(common::to_body::<String>(None));
13118
13119 client.request(request.unwrap()).await
13120 };
13121
13122 match req_result {
13123 Err(err) => {
13124 if let common::Retry::After(d) = dlg.http_error(&err) {
13125 sleep(d).await;
13126 continue;
13127 }
13128 dlg.finished(false);
13129 return Err(common::Error::HttpError(err));
13130 }
13131 Ok(res) => {
13132 let (mut parts, body) = res.into_parts();
13133 let mut body = common::Body::new(body);
13134 if !parts.status.is_success() {
13135 let bytes = common::to_bytes(body).await.unwrap_or_default();
13136 let error = serde_json::from_str(&common::to_string(&bytes));
13137 let response = common::to_response(parts, bytes.into());
13138
13139 if let common::Retry::After(d) =
13140 dlg.http_failure(&response, error.as_ref().ok())
13141 {
13142 sleep(d).await;
13143 continue;
13144 }
13145
13146 dlg.finished(false);
13147
13148 return Err(match error {
13149 Ok(value) => common::Error::BadRequest(value),
13150 _ => common::Error::Failure(response),
13151 });
13152 }
13153 let response = {
13154 let bytes = common::to_bytes(body).await.unwrap_or_default();
13155 let encoded = common::to_string(&bytes);
13156 match serde_json::from_str(&encoded) {
13157 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13158 Err(error) => {
13159 dlg.response_json_decode_error(&encoded, &error);
13160 return Err(common::Error::JsonDecodeError(
13161 encoded.to_string(),
13162 error,
13163 ));
13164 }
13165 }
13166 };
13167
13168 dlg.finished(true);
13169 return Ok(response);
13170 }
13171 }
13172 }
13173 }
13174
13175 /// Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
13176 ///
13177 /// Sets the *name* path property to the given value.
13178 ///
13179 /// Even though the property as already been set when instantiating this call,
13180 /// we provide this method for API completeness.
13181 pub fn name(
13182 mut self,
13183 new_value: &str,
13184 ) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
13185 self._name = new_value.to_string();
13186 self
13187 }
13188 /// API request version that initiates this operation.
13189 ///
13190 /// Sets the *version* query property to the given value.
13191 pub fn version(
13192 mut self,
13193 new_value: &str,
13194 ) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
13195 self._version = Some(new_value.to_string());
13196 self
13197 }
13198 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13199 /// while executing the actual API request.
13200 ///
13201 /// ````text
13202 /// It should be used to handle progress information, and to implement a certain level of resilience.
13203 /// ````
13204 ///
13205 /// Sets the *delegate* property to the given value.
13206 pub fn delegate(
13207 mut self,
13208 new_value: &'a mut dyn common::Delegate,
13209 ) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
13210 self._delegate = Some(new_value);
13211 self
13212 }
13213
13214 /// Set any additional parameter of the query string used in the request.
13215 /// It should be used to set parameters which are not yet available through their own
13216 /// setters.
13217 ///
13218 /// Please note that this method must not be used to set any of the known parameters
13219 /// which have their own setter method. If done anyway, the request will fail.
13220 ///
13221 /// # Additional Parameters
13222 ///
13223 /// * *$.xgafv* (query-string) - V1 error format.
13224 /// * *access_token* (query-string) - OAuth access token.
13225 /// * *alt* (query-string) - Data format for response.
13226 /// * *callback* (query-string) - JSONP
13227 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13228 /// * *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.
13229 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13230 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13231 /// * *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.
13232 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13233 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13234 pub fn param<T>(
13235 mut self,
13236 name: T,
13237 value: T,
13238 ) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
13239 where
13240 T: AsRef<str>,
13241 {
13242 self._additional_params
13243 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13244 self
13245 }
13246
13247 /// Identifies the authorization scope for the method you are building.
13248 ///
13249 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13250 /// [`Scope::CloudPlatform`].
13251 ///
13252 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13253 /// tokens for more than one scope.
13254 ///
13255 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13256 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13257 /// sufficient, a read-write scope will do as well.
13258 pub fn add_scope<St>(
13259 mut self,
13260 scope: St,
13261 ) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
13262 where
13263 St: AsRef<str>,
13264 {
13265 self._scopes.insert(String::from(scope.as_ref()));
13266 self
13267 }
13268 /// Identifies the authorization scope(s) for the method you are building.
13269 ///
13270 /// See [`Self::add_scope()`] for details.
13271 pub fn add_scopes<I, St>(
13272 mut self,
13273 scopes: I,
13274 ) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
13275 where
13276 I: IntoIterator<Item = St>,
13277 St: AsRef<str>,
13278 {
13279 self._scopes
13280 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13281 self
13282 }
13283
13284 /// Removes all scopes, and no default scope will be used either.
13285 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13286 /// for details).
13287 pub fn clear_scopes(mut self) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
13288 self._scopes.clear();
13289 self
13290 }
13291}
13292
13293/// Gets the details of a specific cluster.
13294///
13295/// A builder for the *locations.clusters.get* method supported by a *project* resource.
13296/// It is not used directly, but through a [`ProjectMethods`] instance.
13297///
13298/// # Example
13299///
13300/// Instantiate a resource method builder
13301///
13302/// ```test_harness,no_run
13303/// # extern crate hyper;
13304/// # extern crate hyper_rustls;
13305/// # extern crate google_container1 as container1;
13306/// # async fn dox() {
13307/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13308///
13309/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13310/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13311/// # .with_native_roots()
13312/// # .unwrap()
13313/// # .https_only()
13314/// # .enable_http2()
13315/// # .build();
13316///
13317/// # let executor = hyper_util::rt::TokioExecutor::new();
13318/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13319/// # secret,
13320/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13321/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13322/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13323/// # ),
13324/// # ).build().await.unwrap();
13325///
13326/// # let client = hyper_util::client::legacy::Client::builder(
13327/// # hyper_util::rt::TokioExecutor::new()
13328/// # )
13329/// # .build(
13330/// # hyper_rustls::HttpsConnectorBuilder::new()
13331/// # .with_native_roots()
13332/// # .unwrap()
13333/// # .https_or_http()
13334/// # .enable_http2()
13335/// # .build()
13336/// # );
13337/// # let mut hub = Container::new(client, auth);
13338/// // You can configure optional parameters by calling the respective setters at will, and
13339/// // execute the final call using `doit()`.
13340/// // Values shown here are possibly random and not representative !
13341/// let result = hub.projects().locations_clusters_get("name")
13342/// .zone("et")
13343/// .project_id("voluptua.")
13344/// .cluster_id("amet.")
13345/// .doit().await;
13346/// # }
13347/// ```
13348pub struct ProjectLocationClusterGetCall<'a, C>
13349where
13350 C: 'a,
13351{
13352 hub: &'a Container<C>,
13353 _name: String,
13354 _zone: Option<String>,
13355 _project_id: Option<String>,
13356 _cluster_id: Option<String>,
13357 _delegate: Option<&'a mut dyn common::Delegate>,
13358 _additional_params: HashMap<String, String>,
13359 _scopes: BTreeSet<String>,
13360}
13361
13362impl<'a, C> common::CallBuilder for ProjectLocationClusterGetCall<'a, C> {}
13363
13364impl<'a, C> ProjectLocationClusterGetCall<'a, C>
13365where
13366 C: common::Connector,
13367{
13368 /// Perform the operation you have build so far.
13369 pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
13370 use std::borrow::Cow;
13371 use std::io::{Read, Seek};
13372
13373 use common::{url::Params, ToParts};
13374 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13375
13376 let mut dd = common::DefaultDelegate;
13377 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13378 dlg.begin(common::MethodInfo {
13379 id: "container.projects.locations.clusters.get",
13380 http_method: hyper::Method::GET,
13381 });
13382
13383 for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
13384 if self._additional_params.contains_key(field) {
13385 dlg.finished(false);
13386 return Err(common::Error::FieldClash(field));
13387 }
13388 }
13389
13390 let mut params = Params::with_capacity(6 + self._additional_params.len());
13391 params.push("name", self._name);
13392 if let Some(value) = self._zone.as_ref() {
13393 params.push("zone", value);
13394 }
13395 if let Some(value) = self._project_id.as_ref() {
13396 params.push("projectId", value);
13397 }
13398 if let Some(value) = self._cluster_id.as_ref() {
13399 params.push("clusterId", value);
13400 }
13401
13402 params.extend(self._additional_params.iter());
13403
13404 params.push("alt", "json");
13405 let mut url = self.hub._base_url.clone() + "v1/{+name}";
13406 if self._scopes.is_empty() {
13407 self._scopes
13408 .insert(Scope::CloudPlatform.as_ref().to_string());
13409 }
13410
13411 #[allow(clippy::single_element_loop)]
13412 for &(find_this, param_name) in [("{+name}", "name")].iter() {
13413 url = params.uri_replacement(url, param_name, find_this, true);
13414 }
13415 {
13416 let to_remove = ["name"];
13417 params.remove_params(&to_remove);
13418 }
13419
13420 let url = params.parse_with_url(&url);
13421
13422 loop {
13423 let token = match self
13424 .hub
13425 .auth
13426 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13427 .await
13428 {
13429 Ok(token) => token,
13430 Err(e) => match dlg.token(e) {
13431 Ok(token) => token,
13432 Err(e) => {
13433 dlg.finished(false);
13434 return Err(common::Error::MissingToken(e));
13435 }
13436 },
13437 };
13438 let mut req_result = {
13439 let client = &self.hub.client;
13440 dlg.pre_request();
13441 let mut req_builder = hyper::Request::builder()
13442 .method(hyper::Method::GET)
13443 .uri(url.as_str())
13444 .header(USER_AGENT, self.hub._user_agent.clone());
13445
13446 if let Some(token) = token.as_ref() {
13447 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
13448 }
13449
13450 let request = req_builder
13451 .header(CONTENT_LENGTH, 0_u64)
13452 .body(common::to_body::<String>(None));
13453
13454 client.request(request.unwrap()).await
13455 };
13456
13457 match req_result {
13458 Err(err) => {
13459 if let common::Retry::After(d) = dlg.http_error(&err) {
13460 sleep(d).await;
13461 continue;
13462 }
13463 dlg.finished(false);
13464 return Err(common::Error::HttpError(err));
13465 }
13466 Ok(res) => {
13467 let (mut parts, body) = res.into_parts();
13468 let mut body = common::Body::new(body);
13469 if !parts.status.is_success() {
13470 let bytes = common::to_bytes(body).await.unwrap_or_default();
13471 let error = serde_json::from_str(&common::to_string(&bytes));
13472 let response = common::to_response(parts, bytes.into());
13473
13474 if let common::Retry::After(d) =
13475 dlg.http_failure(&response, error.as_ref().ok())
13476 {
13477 sleep(d).await;
13478 continue;
13479 }
13480
13481 dlg.finished(false);
13482
13483 return Err(match error {
13484 Ok(value) => common::Error::BadRequest(value),
13485 _ => common::Error::Failure(response),
13486 });
13487 }
13488 let response = {
13489 let bytes = common::to_bytes(body).await.unwrap_or_default();
13490 let encoded = common::to_string(&bytes);
13491 match serde_json::from_str(&encoded) {
13492 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13493 Err(error) => {
13494 dlg.response_json_decode_error(&encoded, &error);
13495 return Err(common::Error::JsonDecodeError(
13496 encoded.to_string(),
13497 error,
13498 ));
13499 }
13500 }
13501 };
13502
13503 dlg.finished(true);
13504 return Ok(response);
13505 }
13506 }
13507 }
13508 }
13509
13510 /// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
13511 ///
13512 /// Sets the *name* path property to the given value.
13513 ///
13514 /// Even though the property as already been set when instantiating this call,
13515 /// we provide this method for API completeness.
13516 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
13517 self._name = new_value.to_string();
13518 self
13519 }
13520 /// 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.
13521 ///
13522 /// Sets the *zone* query property to the given value.
13523 pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
13524 self._zone = Some(new_value.to_string());
13525 self
13526 }
13527 /// 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.
13528 ///
13529 /// Sets the *project id* query property to the given value.
13530 pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
13531 self._project_id = Some(new_value.to_string());
13532 self
13533 }
13534 /// Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
13535 ///
13536 /// Sets the *cluster id* query property to the given value.
13537 pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
13538 self._cluster_id = Some(new_value.to_string());
13539 self
13540 }
13541 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13542 /// while executing the actual API request.
13543 ///
13544 /// ````text
13545 /// It should be used to handle progress information, and to implement a certain level of resilience.
13546 /// ````
13547 ///
13548 /// Sets the *delegate* property to the given value.
13549 pub fn delegate(
13550 mut self,
13551 new_value: &'a mut dyn common::Delegate,
13552 ) -> ProjectLocationClusterGetCall<'a, C> {
13553 self._delegate = Some(new_value);
13554 self
13555 }
13556
13557 /// Set any additional parameter of the query string used in the request.
13558 /// It should be used to set parameters which are not yet available through their own
13559 /// setters.
13560 ///
13561 /// Please note that this method must not be used to set any of the known parameters
13562 /// which have their own setter method. If done anyway, the request will fail.
13563 ///
13564 /// # Additional Parameters
13565 ///
13566 /// * *$.xgafv* (query-string) - V1 error format.
13567 /// * *access_token* (query-string) - OAuth access token.
13568 /// * *alt* (query-string) - Data format for response.
13569 /// * *callback* (query-string) - JSONP
13570 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13571 /// * *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.
13572 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13573 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13574 /// * *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.
13575 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13576 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13577 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterGetCall<'a, C>
13578 where
13579 T: AsRef<str>,
13580 {
13581 self._additional_params
13582 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13583 self
13584 }
13585
13586 /// Identifies the authorization scope for the method you are building.
13587 ///
13588 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
13589 /// [`Scope::CloudPlatform`].
13590 ///
13591 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
13592 /// tokens for more than one scope.
13593 ///
13594 /// Usually there is more than one suitable scope to authorize an operation, some of which may
13595 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
13596 /// sufficient, a read-write scope will do as well.
13597 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterGetCall<'a, C>
13598 where
13599 St: AsRef<str>,
13600 {
13601 self._scopes.insert(String::from(scope.as_ref()));
13602 self
13603 }
13604 /// Identifies the authorization scope(s) for the method you are building.
13605 ///
13606 /// See [`Self::add_scope()`] for details.
13607 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterGetCall<'a, C>
13608 where
13609 I: IntoIterator<Item = St>,
13610 St: AsRef<str>,
13611 {
13612 self._scopes
13613 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
13614 self
13615 }
13616
13617 /// Removes all scopes, and no default scope will be used either.
13618 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
13619 /// for details).
13620 pub fn clear_scopes(mut self) -> ProjectLocationClusterGetCall<'a, C> {
13621 self._scopes.clear();
13622 self
13623 }
13624}
13625
13626/// Gets the public component of the cluster signing keys in JSON Web Key format.
13627///
13628/// A builder for the *locations.clusters.getJwks* method supported by a *project* resource.
13629/// It is not used directly, but through a [`ProjectMethods`] instance.
13630///
13631/// # Example
13632///
13633/// Instantiate a resource method builder
13634///
13635/// ```test_harness,no_run
13636/// # extern crate hyper;
13637/// # extern crate hyper_rustls;
13638/// # extern crate google_container1 as container1;
13639/// # async fn dox() {
13640/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13641///
13642/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13643/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13644/// # .with_native_roots()
13645/// # .unwrap()
13646/// # .https_only()
13647/// # .enable_http2()
13648/// # .build();
13649///
13650/// # let executor = hyper_util::rt::TokioExecutor::new();
13651/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13652/// # secret,
13653/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13654/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13655/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13656/// # ),
13657/// # ).build().await.unwrap();
13658///
13659/// # let client = hyper_util::client::legacy::Client::builder(
13660/// # hyper_util::rt::TokioExecutor::new()
13661/// # )
13662/// # .build(
13663/// # hyper_rustls::HttpsConnectorBuilder::new()
13664/// # .with_native_roots()
13665/// # .unwrap()
13666/// # .https_or_http()
13667/// # .enable_http2()
13668/// # .build()
13669/// # );
13670/// # let mut hub = Container::new(client, auth);
13671/// // You can configure optional parameters by calling the respective setters at will, and
13672/// // execute the final call using `doit()`.
13673/// // Values shown here are possibly random and not representative !
13674/// let result = hub.projects().locations_clusters_get_jwks("parent")
13675/// .doit().await;
13676/// # }
13677/// ```
13678pub struct ProjectLocationClusterGetJwkCall<'a, C>
13679where
13680 C: 'a,
13681{
13682 hub: &'a Container<C>,
13683 _parent: String,
13684 _delegate: Option<&'a mut dyn common::Delegate>,
13685 _additional_params: HashMap<String, String>,
13686}
13687
13688impl<'a, C> common::CallBuilder for ProjectLocationClusterGetJwkCall<'a, C> {}
13689
13690impl<'a, C> ProjectLocationClusterGetJwkCall<'a, C>
13691where
13692 C: common::Connector,
13693{
13694 /// Perform the operation you have build so far.
13695 pub async fn doit(mut self) -> common::Result<(common::Response, GetJSONWebKeysResponse)> {
13696 use std::borrow::Cow;
13697 use std::io::{Read, Seek};
13698
13699 use common::{url::Params, ToParts};
13700 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13701
13702 let mut dd = common::DefaultDelegate;
13703 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13704 dlg.begin(common::MethodInfo {
13705 id: "container.projects.locations.clusters.getJwks",
13706 http_method: hyper::Method::GET,
13707 });
13708
13709 for &field in ["alt", "parent"].iter() {
13710 if self._additional_params.contains_key(field) {
13711 dlg.finished(false);
13712 return Err(common::Error::FieldClash(field));
13713 }
13714 }
13715
13716 let mut params = Params::with_capacity(3 + self._additional_params.len());
13717 params.push("parent", self._parent);
13718
13719 params.extend(self._additional_params.iter());
13720
13721 params.push("alt", "json");
13722 let mut url = self.hub._base_url.clone() + "v1/{+parent}/jwks";
13723
13724 match dlg.api_key() {
13725 Some(value) => params.push("key", value),
13726 None => {
13727 dlg.finished(false);
13728 return Err(common::Error::MissingAPIKey);
13729 }
13730 }
13731
13732 #[allow(clippy::single_element_loop)]
13733 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13734 url = params.uri_replacement(url, param_name, find_this, true);
13735 }
13736 {
13737 let to_remove = ["parent"];
13738 params.remove_params(&to_remove);
13739 }
13740
13741 let url = params.parse_with_url(&url);
13742
13743 loop {
13744 let mut req_result = {
13745 let client = &self.hub.client;
13746 dlg.pre_request();
13747 let mut req_builder = hyper::Request::builder()
13748 .method(hyper::Method::GET)
13749 .uri(url.as_str())
13750 .header(USER_AGENT, self.hub._user_agent.clone());
13751
13752 let request = req_builder
13753 .header(CONTENT_LENGTH, 0_u64)
13754 .body(common::to_body::<String>(None));
13755
13756 client.request(request.unwrap()).await
13757 };
13758
13759 match req_result {
13760 Err(err) => {
13761 if let common::Retry::After(d) = dlg.http_error(&err) {
13762 sleep(d).await;
13763 continue;
13764 }
13765 dlg.finished(false);
13766 return Err(common::Error::HttpError(err));
13767 }
13768 Ok(res) => {
13769 let (mut parts, body) = res.into_parts();
13770 let mut body = common::Body::new(body);
13771 if !parts.status.is_success() {
13772 let bytes = common::to_bytes(body).await.unwrap_or_default();
13773 let error = serde_json::from_str(&common::to_string(&bytes));
13774 let response = common::to_response(parts, bytes.into());
13775
13776 if let common::Retry::After(d) =
13777 dlg.http_failure(&response, error.as_ref().ok())
13778 {
13779 sleep(d).await;
13780 continue;
13781 }
13782
13783 dlg.finished(false);
13784
13785 return Err(match error {
13786 Ok(value) => common::Error::BadRequest(value),
13787 _ => common::Error::Failure(response),
13788 });
13789 }
13790 let response = {
13791 let bytes = common::to_bytes(body).await.unwrap_or_default();
13792 let encoded = common::to_string(&bytes);
13793 match serde_json::from_str(&encoded) {
13794 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
13795 Err(error) => {
13796 dlg.response_json_decode_error(&encoded, &error);
13797 return Err(common::Error::JsonDecodeError(
13798 encoded.to_string(),
13799 error,
13800 ));
13801 }
13802 }
13803 };
13804
13805 dlg.finished(true);
13806 return Ok(response);
13807 }
13808 }
13809 }
13810 }
13811
13812 /// The cluster (project, location, cluster name) to get keys for. Specified in the format `projects/*/locations/*/clusters/*`.
13813 ///
13814 /// Sets the *parent* path property to the given value.
13815 ///
13816 /// Even though the property as already been set when instantiating this call,
13817 /// we provide this method for API completeness.
13818 pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterGetJwkCall<'a, C> {
13819 self._parent = new_value.to_string();
13820 self
13821 }
13822 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
13823 /// while executing the actual API request.
13824 ///
13825 /// ````text
13826 /// It should be used to handle progress information, and to implement a certain level of resilience.
13827 /// ````
13828 ///
13829 /// Sets the *delegate* property to the given value.
13830 pub fn delegate(
13831 mut self,
13832 new_value: &'a mut dyn common::Delegate,
13833 ) -> ProjectLocationClusterGetJwkCall<'a, C> {
13834 self._delegate = Some(new_value);
13835 self
13836 }
13837
13838 /// Set any additional parameter of the query string used in the request.
13839 /// It should be used to set parameters which are not yet available through their own
13840 /// setters.
13841 ///
13842 /// Please note that this method must not be used to set any of the known parameters
13843 /// which have their own setter method. If done anyway, the request will fail.
13844 ///
13845 /// # Additional Parameters
13846 ///
13847 /// * *$.xgafv* (query-string) - V1 error format.
13848 /// * *access_token* (query-string) - OAuth access token.
13849 /// * *alt* (query-string) - Data format for response.
13850 /// * *callback* (query-string) - JSONP
13851 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
13852 /// * *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.
13853 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
13854 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
13855 /// * *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.
13856 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
13857 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
13858 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterGetJwkCall<'a, C>
13859 where
13860 T: AsRef<str>,
13861 {
13862 self._additional_params
13863 .insert(name.as_ref().to_string(), value.as_ref().to_string());
13864 self
13865 }
13866}
13867
13868/// Lists all clusters owned by a project in either the specified zone or all zones.
13869///
13870/// A builder for the *locations.clusters.list* method supported by a *project* resource.
13871/// It is not used directly, but through a [`ProjectMethods`] instance.
13872///
13873/// # Example
13874///
13875/// Instantiate a resource method builder
13876///
13877/// ```test_harness,no_run
13878/// # extern crate hyper;
13879/// # extern crate hyper_rustls;
13880/// # extern crate google_container1 as container1;
13881/// # async fn dox() {
13882/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
13883///
13884/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
13885/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
13886/// # .with_native_roots()
13887/// # .unwrap()
13888/// # .https_only()
13889/// # .enable_http2()
13890/// # .build();
13891///
13892/// # let executor = hyper_util::rt::TokioExecutor::new();
13893/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
13894/// # secret,
13895/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
13896/// # yup_oauth2::client::CustomHyperClientBuilder::from(
13897/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
13898/// # ),
13899/// # ).build().await.unwrap();
13900///
13901/// # let client = hyper_util::client::legacy::Client::builder(
13902/// # hyper_util::rt::TokioExecutor::new()
13903/// # )
13904/// # .build(
13905/// # hyper_rustls::HttpsConnectorBuilder::new()
13906/// # .with_native_roots()
13907/// # .unwrap()
13908/// # .https_or_http()
13909/// # .enable_http2()
13910/// # .build()
13911/// # );
13912/// # let mut hub = Container::new(client, auth);
13913/// // You can configure optional parameters by calling the respective setters at will, and
13914/// // execute the final call using `doit()`.
13915/// // Values shown here are possibly random and not representative !
13916/// let result = hub.projects().locations_clusters_list("parent")
13917/// .zone("dolor")
13918/// .project_id("et")
13919/// .doit().await;
13920/// # }
13921/// ```
13922pub struct ProjectLocationClusterListCall<'a, C>
13923where
13924 C: 'a,
13925{
13926 hub: &'a Container<C>,
13927 _parent: String,
13928 _zone: Option<String>,
13929 _project_id: Option<String>,
13930 _delegate: Option<&'a mut dyn common::Delegate>,
13931 _additional_params: HashMap<String, String>,
13932 _scopes: BTreeSet<String>,
13933}
13934
13935impl<'a, C> common::CallBuilder for ProjectLocationClusterListCall<'a, C> {}
13936
13937impl<'a, C> ProjectLocationClusterListCall<'a, C>
13938where
13939 C: common::Connector,
13940{
13941 /// Perform the operation you have build so far.
13942 pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
13943 use std::borrow::Cow;
13944 use std::io::{Read, Seek};
13945
13946 use common::{url::Params, ToParts};
13947 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
13948
13949 let mut dd = common::DefaultDelegate;
13950 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
13951 dlg.begin(common::MethodInfo {
13952 id: "container.projects.locations.clusters.list",
13953 http_method: hyper::Method::GET,
13954 });
13955
13956 for &field in ["alt", "parent", "zone", "projectId"].iter() {
13957 if self._additional_params.contains_key(field) {
13958 dlg.finished(false);
13959 return Err(common::Error::FieldClash(field));
13960 }
13961 }
13962
13963 let mut params = Params::with_capacity(5 + self._additional_params.len());
13964 params.push("parent", self._parent);
13965 if let Some(value) = self._zone.as_ref() {
13966 params.push("zone", value);
13967 }
13968 if let Some(value) = self._project_id.as_ref() {
13969 params.push("projectId", value);
13970 }
13971
13972 params.extend(self._additional_params.iter());
13973
13974 params.push("alt", "json");
13975 let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
13976 if self._scopes.is_empty() {
13977 self._scopes
13978 .insert(Scope::CloudPlatform.as_ref().to_string());
13979 }
13980
13981 #[allow(clippy::single_element_loop)]
13982 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
13983 url = params.uri_replacement(url, param_name, find_this, true);
13984 }
13985 {
13986 let to_remove = ["parent"];
13987 params.remove_params(&to_remove);
13988 }
13989
13990 let url = params.parse_with_url(&url);
13991
13992 loop {
13993 let token = match self
13994 .hub
13995 .auth
13996 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
13997 .await
13998 {
13999 Ok(token) => token,
14000 Err(e) => match dlg.token(e) {
14001 Ok(token) => token,
14002 Err(e) => {
14003 dlg.finished(false);
14004 return Err(common::Error::MissingToken(e));
14005 }
14006 },
14007 };
14008 let mut req_result = {
14009 let client = &self.hub.client;
14010 dlg.pre_request();
14011 let mut req_builder = hyper::Request::builder()
14012 .method(hyper::Method::GET)
14013 .uri(url.as_str())
14014 .header(USER_AGENT, self.hub._user_agent.clone());
14015
14016 if let Some(token) = token.as_ref() {
14017 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14018 }
14019
14020 let request = req_builder
14021 .header(CONTENT_LENGTH, 0_u64)
14022 .body(common::to_body::<String>(None));
14023
14024 client.request(request.unwrap()).await
14025 };
14026
14027 match req_result {
14028 Err(err) => {
14029 if let common::Retry::After(d) = dlg.http_error(&err) {
14030 sleep(d).await;
14031 continue;
14032 }
14033 dlg.finished(false);
14034 return Err(common::Error::HttpError(err));
14035 }
14036 Ok(res) => {
14037 let (mut parts, body) = res.into_parts();
14038 let mut body = common::Body::new(body);
14039 if !parts.status.is_success() {
14040 let bytes = common::to_bytes(body).await.unwrap_or_default();
14041 let error = serde_json::from_str(&common::to_string(&bytes));
14042 let response = common::to_response(parts, bytes.into());
14043
14044 if let common::Retry::After(d) =
14045 dlg.http_failure(&response, error.as_ref().ok())
14046 {
14047 sleep(d).await;
14048 continue;
14049 }
14050
14051 dlg.finished(false);
14052
14053 return Err(match error {
14054 Ok(value) => common::Error::BadRequest(value),
14055 _ => common::Error::Failure(response),
14056 });
14057 }
14058 let response = {
14059 let bytes = common::to_bytes(body).await.unwrap_or_default();
14060 let encoded = common::to_string(&bytes);
14061 match serde_json::from_str(&encoded) {
14062 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14063 Err(error) => {
14064 dlg.response_json_decode_error(&encoded, &error);
14065 return Err(common::Error::JsonDecodeError(
14066 encoded.to_string(),
14067 error,
14068 ));
14069 }
14070 }
14071 };
14072
14073 dlg.finished(true);
14074 return Ok(response);
14075 }
14076 }
14077 }
14078 }
14079
14080 /// The parent (project and location) where the clusters will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
14081 ///
14082 /// Sets the *parent* path property to the given value.
14083 ///
14084 /// Even though the property as already been set when instantiating this call,
14085 /// we provide this method for API completeness.
14086 pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
14087 self._parent = new_value.to_string();
14088 self
14089 }
14090 /// 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.
14091 ///
14092 /// Sets the *zone* query property to the given value.
14093 pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
14094 self._zone = Some(new_value.to_string());
14095 self
14096 }
14097 /// 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.
14098 ///
14099 /// Sets the *project id* query property to the given value.
14100 pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
14101 self._project_id = Some(new_value.to_string());
14102 self
14103 }
14104 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14105 /// while executing the actual API request.
14106 ///
14107 /// ````text
14108 /// It should be used to handle progress information, and to implement a certain level of resilience.
14109 /// ````
14110 ///
14111 /// Sets the *delegate* property to the given value.
14112 pub fn delegate(
14113 mut self,
14114 new_value: &'a mut dyn common::Delegate,
14115 ) -> ProjectLocationClusterListCall<'a, C> {
14116 self._delegate = Some(new_value);
14117 self
14118 }
14119
14120 /// Set any additional parameter of the query string used in the request.
14121 /// It should be used to set parameters which are not yet available through their own
14122 /// setters.
14123 ///
14124 /// Please note that this method must not be used to set any of the known parameters
14125 /// which have their own setter method. If done anyway, the request will fail.
14126 ///
14127 /// # Additional Parameters
14128 ///
14129 /// * *$.xgafv* (query-string) - V1 error format.
14130 /// * *access_token* (query-string) - OAuth access token.
14131 /// * *alt* (query-string) - Data format for response.
14132 /// * *callback* (query-string) - JSONP
14133 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14134 /// * *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.
14135 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14136 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14137 /// * *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.
14138 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14139 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14140 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterListCall<'a, C>
14141 where
14142 T: AsRef<str>,
14143 {
14144 self._additional_params
14145 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14146 self
14147 }
14148
14149 /// Identifies the authorization scope for the method you are building.
14150 ///
14151 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14152 /// [`Scope::CloudPlatform`].
14153 ///
14154 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14155 /// tokens for more than one scope.
14156 ///
14157 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14158 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14159 /// sufficient, a read-write scope will do as well.
14160 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterListCall<'a, C>
14161 where
14162 St: AsRef<str>,
14163 {
14164 self._scopes.insert(String::from(scope.as_ref()));
14165 self
14166 }
14167 /// Identifies the authorization scope(s) for the method you are building.
14168 ///
14169 /// See [`Self::add_scope()`] for details.
14170 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterListCall<'a, C>
14171 where
14172 I: IntoIterator<Item = St>,
14173 St: AsRef<str>,
14174 {
14175 self._scopes
14176 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14177 self
14178 }
14179
14180 /// Removes all scopes, and no default scope will be used either.
14181 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14182 /// for details).
14183 pub fn clear_scopes(mut self) -> ProjectLocationClusterListCall<'a, C> {
14184 self._scopes.clear();
14185 self
14186 }
14187}
14188
14189/// Sets the addons for a specific cluster.
14190///
14191/// A builder for the *locations.clusters.setAddons* method supported by a *project* resource.
14192/// It is not used directly, but through a [`ProjectMethods`] instance.
14193///
14194/// # Example
14195///
14196/// Instantiate a resource method builder
14197///
14198/// ```test_harness,no_run
14199/// # extern crate hyper;
14200/// # extern crate hyper_rustls;
14201/// # extern crate google_container1 as container1;
14202/// use container1::api::SetAddonsConfigRequest;
14203/// # async fn dox() {
14204/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14205///
14206/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14207/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14208/// # .with_native_roots()
14209/// # .unwrap()
14210/// # .https_only()
14211/// # .enable_http2()
14212/// # .build();
14213///
14214/// # let executor = hyper_util::rt::TokioExecutor::new();
14215/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14216/// # secret,
14217/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14218/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14219/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14220/// # ),
14221/// # ).build().await.unwrap();
14222///
14223/// # let client = hyper_util::client::legacy::Client::builder(
14224/// # hyper_util::rt::TokioExecutor::new()
14225/// # )
14226/// # .build(
14227/// # hyper_rustls::HttpsConnectorBuilder::new()
14228/// # .with_native_roots()
14229/// # .unwrap()
14230/// # .https_or_http()
14231/// # .enable_http2()
14232/// # .build()
14233/// # );
14234/// # let mut hub = Container::new(client, auth);
14235/// // As the method needs a request, you would usually fill it with the desired information
14236/// // into the respective structure. Some of the parts shown here might not be applicable !
14237/// // Values shown here are possibly random and not representative !
14238/// let mut req = SetAddonsConfigRequest::default();
14239///
14240/// // You can configure optional parameters by calling the respective setters at will, and
14241/// // execute the final call using `doit()`.
14242/// // Values shown here are possibly random and not representative !
14243/// let result = hub.projects().locations_clusters_set_addons(req, "name")
14244/// .doit().await;
14245/// # }
14246/// ```
14247pub struct ProjectLocationClusterSetAddonCall<'a, C>
14248where
14249 C: 'a,
14250{
14251 hub: &'a Container<C>,
14252 _request: SetAddonsConfigRequest,
14253 _name: String,
14254 _delegate: Option<&'a mut dyn common::Delegate>,
14255 _additional_params: HashMap<String, String>,
14256 _scopes: BTreeSet<String>,
14257}
14258
14259impl<'a, C> common::CallBuilder for ProjectLocationClusterSetAddonCall<'a, C> {}
14260
14261impl<'a, C> ProjectLocationClusterSetAddonCall<'a, C>
14262where
14263 C: common::Connector,
14264{
14265 /// Perform the operation you have build so far.
14266 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14267 use std::borrow::Cow;
14268 use std::io::{Read, Seek};
14269
14270 use common::{url::Params, ToParts};
14271 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14272
14273 let mut dd = common::DefaultDelegate;
14274 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14275 dlg.begin(common::MethodInfo {
14276 id: "container.projects.locations.clusters.setAddons",
14277 http_method: hyper::Method::POST,
14278 });
14279
14280 for &field in ["alt", "name"].iter() {
14281 if self._additional_params.contains_key(field) {
14282 dlg.finished(false);
14283 return Err(common::Error::FieldClash(field));
14284 }
14285 }
14286
14287 let mut params = Params::with_capacity(4 + self._additional_params.len());
14288 params.push("name", self._name);
14289
14290 params.extend(self._additional_params.iter());
14291
14292 params.push("alt", "json");
14293 let mut url = self.hub._base_url.clone() + "v1/{+name}:setAddons";
14294 if self._scopes.is_empty() {
14295 self._scopes
14296 .insert(Scope::CloudPlatform.as_ref().to_string());
14297 }
14298
14299 #[allow(clippy::single_element_loop)]
14300 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14301 url = params.uri_replacement(url, param_name, find_this, true);
14302 }
14303 {
14304 let to_remove = ["name"];
14305 params.remove_params(&to_remove);
14306 }
14307
14308 let url = params.parse_with_url(&url);
14309
14310 let mut json_mime_type = mime::APPLICATION_JSON;
14311 let mut request_value_reader = {
14312 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14313 common::remove_json_null_values(&mut value);
14314 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14315 serde_json::to_writer(&mut dst, &value).unwrap();
14316 dst
14317 };
14318 let request_size = request_value_reader
14319 .seek(std::io::SeekFrom::End(0))
14320 .unwrap();
14321 request_value_reader
14322 .seek(std::io::SeekFrom::Start(0))
14323 .unwrap();
14324
14325 loop {
14326 let token = match self
14327 .hub
14328 .auth
14329 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14330 .await
14331 {
14332 Ok(token) => token,
14333 Err(e) => match dlg.token(e) {
14334 Ok(token) => token,
14335 Err(e) => {
14336 dlg.finished(false);
14337 return Err(common::Error::MissingToken(e));
14338 }
14339 },
14340 };
14341 request_value_reader
14342 .seek(std::io::SeekFrom::Start(0))
14343 .unwrap();
14344 let mut req_result = {
14345 let client = &self.hub.client;
14346 dlg.pre_request();
14347 let mut req_builder = hyper::Request::builder()
14348 .method(hyper::Method::POST)
14349 .uri(url.as_str())
14350 .header(USER_AGENT, self.hub._user_agent.clone());
14351
14352 if let Some(token) = token.as_ref() {
14353 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14354 }
14355
14356 let request = req_builder
14357 .header(CONTENT_TYPE, json_mime_type.to_string())
14358 .header(CONTENT_LENGTH, request_size as u64)
14359 .body(common::to_body(
14360 request_value_reader.get_ref().clone().into(),
14361 ));
14362
14363 client.request(request.unwrap()).await
14364 };
14365
14366 match req_result {
14367 Err(err) => {
14368 if let common::Retry::After(d) = dlg.http_error(&err) {
14369 sleep(d).await;
14370 continue;
14371 }
14372 dlg.finished(false);
14373 return Err(common::Error::HttpError(err));
14374 }
14375 Ok(res) => {
14376 let (mut parts, body) = res.into_parts();
14377 let mut body = common::Body::new(body);
14378 if !parts.status.is_success() {
14379 let bytes = common::to_bytes(body).await.unwrap_or_default();
14380 let error = serde_json::from_str(&common::to_string(&bytes));
14381 let response = common::to_response(parts, bytes.into());
14382
14383 if let common::Retry::After(d) =
14384 dlg.http_failure(&response, error.as_ref().ok())
14385 {
14386 sleep(d).await;
14387 continue;
14388 }
14389
14390 dlg.finished(false);
14391
14392 return Err(match error {
14393 Ok(value) => common::Error::BadRequest(value),
14394 _ => common::Error::Failure(response),
14395 });
14396 }
14397 let response = {
14398 let bytes = common::to_bytes(body).await.unwrap_or_default();
14399 let encoded = common::to_string(&bytes);
14400 match serde_json::from_str(&encoded) {
14401 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14402 Err(error) => {
14403 dlg.response_json_decode_error(&encoded, &error);
14404 return Err(common::Error::JsonDecodeError(
14405 encoded.to_string(),
14406 error,
14407 ));
14408 }
14409 }
14410 };
14411
14412 dlg.finished(true);
14413 return Ok(response);
14414 }
14415 }
14416 }
14417 }
14418
14419 ///
14420 /// Sets the *request* property to the given value.
14421 ///
14422 /// Even though the property as already been set when instantiating this call,
14423 /// we provide this method for API completeness.
14424 pub fn request(
14425 mut self,
14426 new_value: SetAddonsConfigRequest,
14427 ) -> ProjectLocationClusterSetAddonCall<'a, C> {
14428 self._request = new_value;
14429 self
14430 }
14431 /// The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
14432 ///
14433 /// Sets the *name* path property to the given value.
14434 ///
14435 /// Even though the property as already been set when instantiating this call,
14436 /// we provide this method for API completeness.
14437 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetAddonCall<'a, C> {
14438 self._name = new_value.to_string();
14439 self
14440 }
14441 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14442 /// while executing the actual API request.
14443 ///
14444 /// ````text
14445 /// It should be used to handle progress information, and to implement a certain level of resilience.
14446 /// ````
14447 ///
14448 /// Sets the *delegate* property to the given value.
14449 pub fn delegate(
14450 mut self,
14451 new_value: &'a mut dyn common::Delegate,
14452 ) -> ProjectLocationClusterSetAddonCall<'a, C> {
14453 self._delegate = Some(new_value);
14454 self
14455 }
14456
14457 /// Set any additional parameter of the query string used in the request.
14458 /// It should be used to set parameters which are not yet available through their own
14459 /// setters.
14460 ///
14461 /// Please note that this method must not be used to set any of the known parameters
14462 /// which have their own setter method. If done anyway, the request will fail.
14463 ///
14464 /// # Additional Parameters
14465 ///
14466 /// * *$.xgafv* (query-string) - V1 error format.
14467 /// * *access_token* (query-string) - OAuth access token.
14468 /// * *alt* (query-string) - Data format for response.
14469 /// * *callback* (query-string) - JSONP
14470 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14471 /// * *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.
14472 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14473 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14474 /// * *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.
14475 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14476 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14477 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetAddonCall<'a, C>
14478 where
14479 T: AsRef<str>,
14480 {
14481 self._additional_params
14482 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14483 self
14484 }
14485
14486 /// Identifies the authorization scope for the method you are building.
14487 ///
14488 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14489 /// [`Scope::CloudPlatform`].
14490 ///
14491 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14492 /// tokens for more than one scope.
14493 ///
14494 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14495 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14496 /// sufficient, a read-write scope will do as well.
14497 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetAddonCall<'a, C>
14498 where
14499 St: AsRef<str>,
14500 {
14501 self._scopes.insert(String::from(scope.as_ref()));
14502 self
14503 }
14504 /// Identifies the authorization scope(s) for the method you are building.
14505 ///
14506 /// See [`Self::add_scope()`] for details.
14507 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetAddonCall<'a, C>
14508 where
14509 I: IntoIterator<Item = St>,
14510 St: AsRef<str>,
14511 {
14512 self._scopes
14513 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14514 self
14515 }
14516
14517 /// Removes all scopes, and no default scope will be used either.
14518 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14519 /// for details).
14520 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetAddonCall<'a, C> {
14521 self._scopes.clear();
14522 self
14523 }
14524}
14525
14526/// Enables or disables the ABAC authorization mechanism on a cluster.
14527///
14528/// A builder for the *locations.clusters.setLegacyAbac* method supported by a *project* resource.
14529/// It is not used directly, but through a [`ProjectMethods`] instance.
14530///
14531/// # Example
14532///
14533/// Instantiate a resource method builder
14534///
14535/// ```test_harness,no_run
14536/// # extern crate hyper;
14537/// # extern crate hyper_rustls;
14538/// # extern crate google_container1 as container1;
14539/// use container1::api::SetLegacyAbacRequest;
14540/// # async fn dox() {
14541/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14542///
14543/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14544/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14545/// # .with_native_roots()
14546/// # .unwrap()
14547/// # .https_only()
14548/// # .enable_http2()
14549/// # .build();
14550///
14551/// # let executor = hyper_util::rt::TokioExecutor::new();
14552/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14553/// # secret,
14554/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14555/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14556/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14557/// # ),
14558/// # ).build().await.unwrap();
14559///
14560/// # let client = hyper_util::client::legacy::Client::builder(
14561/// # hyper_util::rt::TokioExecutor::new()
14562/// # )
14563/// # .build(
14564/// # hyper_rustls::HttpsConnectorBuilder::new()
14565/// # .with_native_roots()
14566/// # .unwrap()
14567/// # .https_or_http()
14568/// # .enable_http2()
14569/// # .build()
14570/// # );
14571/// # let mut hub = Container::new(client, auth);
14572/// // As the method needs a request, you would usually fill it with the desired information
14573/// // into the respective structure. Some of the parts shown here might not be applicable !
14574/// // Values shown here are possibly random and not representative !
14575/// let mut req = SetLegacyAbacRequest::default();
14576///
14577/// // You can configure optional parameters by calling the respective setters at will, and
14578/// // execute the final call using `doit()`.
14579/// // Values shown here are possibly random and not representative !
14580/// let result = hub.projects().locations_clusters_set_legacy_abac(req, "name")
14581/// .doit().await;
14582/// # }
14583/// ```
14584pub struct ProjectLocationClusterSetLegacyAbacCall<'a, C>
14585where
14586 C: 'a,
14587{
14588 hub: &'a Container<C>,
14589 _request: SetLegacyAbacRequest,
14590 _name: String,
14591 _delegate: Option<&'a mut dyn common::Delegate>,
14592 _additional_params: HashMap<String, String>,
14593 _scopes: BTreeSet<String>,
14594}
14595
14596impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLegacyAbacCall<'a, C> {}
14597
14598impl<'a, C> ProjectLocationClusterSetLegacyAbacCall<'a, C>
14599where
14600 C: common::Connector,
14601{
14602 /// Perform the operation you have build so far.
14603 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14604 use std::borrow::Cow;
14605 use std::io::{Read, Seek};
14606
14607 use common::{url::Params, ToParts};
14608 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14609
14610 let mut dd = common::DefaultDelegate;
14611 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14612 dlg.begin(common::MethodInfo {
14613 id: "container.projects.locations.clusters.setLegacyAbac",
14614 http_method: hyper::Method::POST,
14615 });
14616
14617 for &field in ["alt", "name"].iter() {
14618 if self._additional_params.contains_key(field) {
14619 dlg.finished(false);
14620 return Err(common::Error::FieldClash(field));
14621 }
14622 }
14623
14624 let mut params = Params::with_capacity(4 + self._additional_params.len());
14625 params.push("name", self._name);
14626
14627 params.extend(self._additional_params.iter());
14628
14629 params.push("alt", "json");
14630 let mut url = self.hub._base_url.clone() + "v1/{+name}:setLegacyAbac";
14631 if self._scopes.is_empty() {
14632 self._scopes
14633 .insert(Scope::CloudPlatform.as_ref().to_string());
14634 }
14635
14636 #[allow(clippy::single_element_loop)]
14637 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14638 url = params.uri_replacement(url, param_name, find_this, true);
14639 }
14640 {
14641 let to_remove = ["name"];
14642 params.remove_params(&to_remove);
14643 }
14644
14645 let url = params.parse_with_url(&url);
14646
14647 let mut json_mime_type = mime::APPLICATION_JSON;
14648 let mut request_value_reader = {
14649 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14650 common::remove_json_null_values(&mut value);
14651 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14652 serde_json::to_writer(&mut dst, &value).unwrap();
14653 dst
14654 };
14655 let request_size = request_value_reader
14656 .seek(std::io::SeekFrom::End(0))
14657 .unwrap();
14658 request_value_reader
14659 .seek(std::io::SeekFrom::Start(0))
14660 .unwrap();
14661
14662 loop {
14663 let token = match self
14664 .hub
14665 .auth
14666 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
14667 .await
14668 {
14669 Ok(token) => token,
14670 Err(e) => match dlg.token(e) {
14671 Ok(token) => token,
14672 Err(e) => {
14673 dlg.finished(false);
14674 return Err(common::Error::MissingToken(e));
14675 }
14676 },
14677 };
14678 request_value_reader
14679 .seek(std::io::SeekFrom::Start(0))
14680 .unwrap();
14681 let mut req_result = {
14682 let client = &self.hub.client;
14683 dlg.pre_request();
14684 let mut req_builder = hyper::Request::builder()
14685 .method(hyper::Method::POST)
14686 .uri(url.as_str())
14687 .header(USER_AGENT, self.hub._user_agent.clone());
14688
14689 if let Some(token) = token.as_ref() {
14690 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
14691 }
14692
14693 let request = req_builder
14694 .header(CONTENT_TYPE, json_mime_type.to_string())
14695 .header(CONTENT_LENGTH, request_size as u64)
14696 .body(common::to_body(
14697 request_value_reader.get_ref().clone().into(),
14698 ));
14699
14700 client.request(request.unwrap()).await
14701 };
14702
14703 match req_result {
14704 Err(err) => {
14705 if let common::Retry::After(d) = dlg.http_error(&err) {
14706 sleep(d).await;
14707 continue;
14708 }
14709 dlg.finished(false);
14710 return Err(common::Error::HttpError(err));
14711 }
14712 Ok(res) => {
14713 let (mut parts, body) = res.into_parts();
14714 let mut body = common::Body::new(body);
14715 if !parts.status.is_success() {
14716 let bytes = common::to_bytes(body).await.unwrap_or_default();
14717 let error = serde_json::from_str(&common::to_string(&bytes));
14718 let response = common::to_response(parts, bytes.into());
14719
14720 if let common::Retry::After(d) =
14721 dlg.http_failure(&response, error.as_ref().ok())
14722 {
14723 sleep(d).await;
14724 continue;
14725 }
14726
14727 dlg.finished(false);
14728
14729 return Err(match error {
14730 Ok(value) => common::Error::BadRequest(value),
14731 _ => common::Error::Failure(response),
14732 });
14733 }
14734 let response = {
14735 let bytes = common::to_bytes(body).await.unwrap_or_default();
14736 let encoded = common::to_string(&bytes);
14737 match serde_json::from_str(&encoded) {
14738 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
14739 Err(error) => {
14740 dlg.response_json_decode_error(&encoded, &error);
14741 return Err(common::Error::JsonDecodeError(
14742 encoded.to_string(),
14743 error,
14744 ));
14745 }
14746 }
14747 };
14748
14749 dlg.finished(true);
14750 return Ok(response);
14751 }
14752 }
14753 }
14754 }
14755
14756 ///
14757 /// Sets the *request* property to the given value.
14758 ///
14759 /// Even though the property as already been set when instantiating this call,
14760 /// we provide this method for API completeness.
14761 pub fn request(
14762 mut self,
14763 new_value: SetLegacyAbacRequest,
14764 ) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
14765 self._request = new_value;
14766 self
14767 }
14768 /// The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
14769 ///
14770 /// Sets the *name* path property to the given value.
14771 ///
14772 /// Even though the property as already been set when instantiating this call,
14773 /// we provide this method for API completeness.
14774 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
14775 self._name = new_value.to_string();
14776 self
14777 }
14778 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
14779 /// while executing the actual API request.
14780 ///
14781 /// ````text
14782 /// It should be used to handle progress information, and to implement a certain level of resilience.
14783 /// ````
14784 ///
14785 /// Sets the *delegate* property to the given value.
14786 pub fn delegate(
14787 mut self,
14788 new_value: &'a mut dyn common::Delegate,
14789 ) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
14790 self._delegate = Some(new_value);
14791 self
14792 }
14793
14794 /// Set any additional parameter of the query string used in the request.
14795 /// It should be used to set parameters which are not yet available through their own
14796 /// setters.
14797 ///
14798 /// Please note that this method must not be used to set any of the known parameters
14799 /// which have their own setter method. If done anyway, the request will fail.
14800 ///
14801 /// # Additional Parameters
14802 ///
14803 /// * *$.xgafv* (query-string) - V1 error format.
14804 /// * *access_token* (query-string) - OAuth access token.
14805 /// * *alt* (query-string) - Data format for response.
14806 /// * *callback* (query-string) - JSONP
14807 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
14808 /// * *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.
14809 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
14810 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
14811 /// * *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.
14812 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
14813 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
14814 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
14815 where
14816 T: AsRef<str>,
14817 {
14818 self._additional_params
14819 .insert(name.as_ref().to_string(), value.as_ref().to_string());
14820 self
14821 }
14822
14823 /// Identifies the authorization scope for the method you are building.
14824 ///
14825 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
14826 /// [`Scope::CloudPlatform`].
14827 ///
14828 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
14829 /// tokens for more than one scope.
14830 ///
14831 /// Usually there is more than one suitable scope to authorize an operation, some of which may
14832 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
14833 /// sufficient, a read-write scope will do as well.
14834 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
14835 where
14836 St: AsRef<str>,
14837 {
14838 self._scopes.insert(String::from(scope.as_ref()));
14839 self
14840 }
14841 /// Identifies the authorization scope(s) for the method you are building.
14842 ///
14843 /// See [`Self::add_scope()`] for details.
14844 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
14845 where
14846 I: IntoIterator<Item = St>,
14847 St: AsRef<str>,
14848 {
14849 self._scopes
14850 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
14851 self
14852 }
14853
14854 /// Removes all scopes, and no default scope will be used either.
14855 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
14856 /// for details).
14857 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
14858 self._scopes.clear();
14859 self
14860 }
14861}
14862
14863/// 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.
14864///
14865/// A builder for the *locations.clusters.setLocations* method supported by a *project* resource.
14866/// It is not used directly, but through a [`ProjectMethods`] instance.
14867///
14868/// # Example
14869///
14870/// Instantiate a resource method builder
14871///
14872/// ```test_harness,no_run
14873/// # extern crate hyper;
14874/// # extern crate hyper_rustls;
14875/// # extern crate google_container1 as container1;
14876/// use container1::api::SetLocationsRequest;
14877/// # async fn dox() {
14878/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
14879///
14880/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
14881/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
14882/// # .with_native_roots()
14883/// # .unwrap()
14884/// # .https_only()
14885/// # .enable_http2()
14886/// # .build();
14887///
14888/// # let executor = hyper_util::rt::TokioExecutor::new();
14889/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
14890/// # secret,
14891/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
14892/// # yup_oauth2::client::CustomHyperClientBuilder::from(
14893/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
14894/// # ),
14895/// # ).build().await.unwrap();
14896///
14897/// # let client = hyper_util::client::legacy::Client::builder(
14898/// # hyper_util::rt::TokioExecutor::new()
14899/// # )
14900/// # .build(
14901/// # hyper_rustls::HttpsConnectorBuilder::new()
14902/// # .with_native_roots()
14903/// # .unwrap()
14904/// # .https_or_http()
14905/// # .enable_http2()
14906/// # .build()
14907/// # );
14908/// # let mut hub = Container::new(client, auth);
14909/// // As the method needs a request, you would usually fill it with the desired information
14910/// // into the respective structure. Some of the parts shown here might not be applicable !
14911/// // Values shown here are possibly random and not representative !
14912/// let mut req = SetLocationsRequest::default();
14913///
14914/// // You can configure optional parameters by calling the respective setters at will, and
14915/// // execute the final call using `doit()`.
14916/// // Values shown here are possibly random and not representative !
14917/// let result = hub.projects().locations_clusters_set_locations(req, "name")
14918/// .doit().await;
14919/// # }
14920/// ```
14921pub struct ProjectLocationClusterSetLocationCall<'a, C>
14922where
14923 C: 'a,
14924{
14925 hub: &'a Container<C>,
14926 _request: SetLocationsRequest,
14927 _name: String,
14928 _delegate: Option<&'a mut dyn common::Delegate>,
14929 _additional_params: HashMap<String, String>,
14930 _scopes: BTreeSet<String>,
14931}
14932
14933impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLocationCall<'a, C> {}
14934
14935impl<'a, C> ProjectLocationClusterSetLocationCall<'a, C>
14936where
14937 C: common::Connector,
14938{
14939 /// Perform the operation you have build so far.
14940 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
14941 use std::borrow::Cow;
14942 use std::io::{Read, Seek};
14943
14944 use common::{url::Params, ToParts};
14945 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
14946
14947 let mut dd = common::DefaultDelegate;
14948 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
14949 dlg.begin(common::MethodInfo {
14950 id: "container.projects.locations.clusters.setLocations",
14951 http_method: hyper::Method::POST,
14952 });
14953
14954 for &field in ["alt", "name"].iter() {
14955 if self._additional_params.contains_key(field) {
14956 dlg.finished(false);
14957 return Err(common::Error::FieldClash(field));
14958 }
14959 }
14960
14961 let mut params = Params::with_capacity(4 + self._additional_params.len());
14962 params.push("name", self._name);
14963
14964 params.extend(self._additional_params.iter());
14965
14966 params.push("alt", "json");
14967 let mut url = self.hub._base_url.clone() + "v1/{+name}:setLocations";
14968 if self._scopes.is_empty() {
14969 self._scopes
14970 .insert(Scope::CloudPlatform.as_ref().to_string());
14971 }
14972
14973 #[allow(clippy::single_element_loop)]
14974 for &(find_this, param_name) in [("{+name}", "name")].iter() {
14975 url = params.uri_replacement(url, param_name, find_this, true);
14976 }
14977 {
14978 let to_remove = ["name"];
14979 params.remove_params(&to_remove);
14980 }
14981
14982 let url = params.parse_with_url(&url);
14983
14984 let mut json_mime_type = mime::APPLICATION_JSON;
14985 let mut request_value_reader = {
14986 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
14987 common::remove_json_null_values(&mut value);
14988 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
14989 serde_json::to_writer(&mut dst, &value).unwrap();
14990 dst
14991 };
14992 let request_size = request_value_reader
14993 .seek(std::io::SeekFrom::End(0))
14994 .unwrap();
14995 request_value_reader
14996 .seek(std::io::SeekFrom::Start(0))
14997 .unwrap();
14998
14999 loop {
15000 let token = match self
15001 .hub
15002 .auth
15003 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15004 .await
15005 {
15006 Ok(token) => token,
15007 Err(e) => match dlg.token(e) {
15008 Ok(token) => token,
15009 Err(e) => {
15010 dlg.finished(false);
15011 return Err(common::Error::MissingToken(e));
15012 }
15013 },
15014 };
15015 request_value_reader
15016 .seek(std::io::SeekFrom::Start(0))
15017 .unwrap();
15018 let mut req_result = {
15019 let client = &self.hub.client;
15020 dlg.pre_request();
15021 let mut req_builder = hyper::Request::builder()
15022 .method(hyper::Method::POST)
15023 .uri(url.as_str())
15024 .header(USER_AGENT, self.hub._user_agent.clone());
15025
15026 if let Some(token) = token.as_ref() {
15027 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15028 }
15029
15030 let request = req_builder
15031 .header(CONTENT_TYPE, json_mime_type.to_string())
15032 .header(CONTENT_LENGTH, request_size as u64)
15033 .body(common::to_body(
15034 request_value_reader.get_ref().clone().into(),
15035 ));
15036
15037 client.request(request.unwrap()).await
15038 };
15039
15040 match req_result {
15041 Err(err) => {
15042 if let common::Retry::After(d) = dlg.http_error(&err) {
15043 sleep(d).await;
15044 continue;
15045 }
15046 dlg.finished(false);
15047 return Err(common::Error::HttpError(err));
15048 }
15049 Ok(res) => {
15050 let (mut parts, body) = res.into_parts();
15051 let mut body = common::Body::new(body);
15052 if !parts.status.is_success() {
15053 let bytes = common::to_bytes(body).await.unwrap_or_default();
15054 let error = serde_json::from_str(&common::to_string(&bytes));
15055 let response = common::to_response(parts, bytes.into());
15056
15057 if let common::Retry::After(d) =
15058 dlg.http_failure(&response, error.as_ref().ok())
15059 {
15060 sleep(d).await;
15061 continue;
15062 }
15063
15064 dlg.finished(false);
15065
15066 return Err(match error {
15067 Ok(value) => common::Error::BadRequest(value),
15068 _ => common::Error::Failure(response),
15069 });
15070 }
15071 let response = {
15072 let bytes = common::to_bytes(body).await.unwrap_or_default();
15073 let encoded = common::to_string(&bytes);
15074 match serde_json::from_str(&encoded) {
15075 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15076 Err(error) => {
15077 dlg.response_json_decode_error(&encoded, &error);
15078 return Err(common::Error::JsonDecodeError(
15079 encoded.to_string(),
15080 error,
15081 ));
15082 }
15083 }
15084 };
15085
15086 dlg.finished(true);
15087 return Ok(response);
15088 }
15089 }
15090 }
15091 }
15092
15093 ///
15094 /// Sets the *request* property to the given value.
15095 ///
15096 /// Even though the property as already been set when instantiating this call,
15097 /// we provide this method for API completeness.
15098 pub fn request(
15099 mut self,
15100 new_value: SetLocationsRequest,
15101 ) -> ProjectLocationClusterSetLocationCall<'a, C> {
15102 self._request = new_value;
15103 self
15104 }
15105 /// The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
15106 ///
15107 /// Sets the *name* path property to the given value.
15108 ///
15109 /// Even though the property as already been set when instantiating this call,
15110 /// we provide this method for API completeness.
15111 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLocationCall<'a, C> {
15112 self._name = new_value.to_string();
15113 self
15114 }
15115 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15116 /// while executing the actual API request.
15117 ///
15118 /// ````text
15119 /// It should be used to handle progress information, and to implement a certain level of resilience.
15120 /// ````
15121 ///
15122 /// Sets the *delegate* property to the given value.
15123 pub fn delegate(
15124 mut self,
15125 new_value: &'a mut dyn common::Delegate,
15126 ) -> ProjectLocationClusterSetLocationCall<'a, C> {
15127 self._delegate = Some(new_value);
15128 self
15129 }
15130
15131 /// Set any additional parameter of the query string used in the request.
15132 /// It should be used to set parameters which are not yet available through their own
15133 /// setters.
15134 ///
15135 /// Please note that this method must not be used to set any of the known parameters
15136 /// which have their own setter method. If done anyway, the request will fail.
15137 ///
15138 /// # Additional Parameters
15139 ///
15140 /// * *$.xgafv* (query-string) - V1 error format.
15141 /// * *access_token* (query-string) - OAuth access token.
15142 /// * *alt* (query-string) - Data format for response.
15143 /// * *callback* (query-string) - JSONP
15144 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15145 /// * *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.
15146 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15147 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15148 /// * *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.
15149 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15150 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15151 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLocationCall<'a, C>
15152 where
15153 T: AsRef<str>,
15154 {
15155 self._additional_params
15156 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15157 self
15158 }
15159
15160 /// Identifies the authorization scope for the method you are building.
15161 ///
15162 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15163 /// [`Scope::CloudPlatform`].
15164 ///
15165 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15166 /// tokens for more than one scope.
15167 ///
15168 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15169 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15170 /// sufficient, a read-write scope will do as well.
15171 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLocationCall<'a, C>
15172 where
15173 St: AsRef<str>,
15174 {
15175 self._scopes.insert(String::from(scope.as_ref()));
15176 self
15177 }
15178 /// Identifies the authorization scope(s) for the method you are building.
15179 ///
15180 /// See [`Self::add_scope()`] for details.
15181 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLocationCall<'a, C>
15182 where
15183 I: IntoIterator<Item = St>,
15184 St: AsRef<str>,
15185 {
15186 self._scopes
15187 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15188 self
15189 }
15190
15191 /// Removes all scopes, and no default scope will be used either.
15192 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15193 /// for details).
15194 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLocationCall<'a, C> {
15195 self._scopes.clear();
15196 self
15197 }
15198}
15199
15200/// Sets the logging service for a specific cluster.
15201///
15202/// A builder for the *locations.clusters.setLogging* method supported by a *project* resource.
15203/// It is not used directly, but through a [`ProjectMethods`] instance.
15204///
15205/// # Example
15206///
15207/// Instantiate a resource method builder
15208///
15209/// ```test_harness,no_run
15210/// # extern crate hyper;
15211/// # extern crate hyper_rustls;
15212/// # extern crate google_container1 as container1;
15213/// use container1::api::SetLoggingServiceRequest;
15214/// # async fn dox() {
15215/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15216///
15217/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15218/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15219/// # .with_native_roots()
15220/// # .unwrap()
15221/// # .https_only()
15222/// # .enable_http2()
15223/// # .build();
15224///
15225/// # let executor = hyper_util::rt::TokioExecutor::new();
15226/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15227/// # secret,
15228/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15229/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15230/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15231/// # ),
15232/// # ).build().await.unwrap();
15233///
15234/// # let client = hyper_util::client::legacy::Client::builder(
15235/// # hyper_util::rt::TokioExecutor::new()
15236/// # )
15237/// # .build(
15238/// # hyper_rustls::HttpsConnectorBuilder::new()
15239/// # .with_native_roots()
15240/// # .unwrap()
15241/// # .https_or_http()
15242/// # .enable_http2()
15243/// # .build()
15244/// # );
15245/// # let mut hub = Container::new(client, auth);
15246/// // As the method needs a request, you would usually fill it with the desired information
15247/// // into the respective structure. Some of the parts shown here might not be applicable !
15248/// // Values shown here are possibly random and not representative !
15249/// let mut req = SetLoggingServiceRequest::default();
15250///
15251/// // You can configure optional parameters by calling the respective setters at will, and
15252/// // execute the final call using `doit()`.
15253/// // Values shown here are possibly random and not representative !
15254/// let result = hub.projects().locations_clusters_set_logging(req, "name")
15255/// .doit().await;
15256/// # }
15257/// ```
15258pub struct ProjectLocationClusterSetLoggingCall<'a, C>
15259where
15260 C: 'a,
15261{
15262 hub: &'a Container<C>,
15263 _request: SetLoggingServiceRequest,
15264 _name: String,
15265 _delegate: Option<&'a mut dyn common::Delegate>,
15266 _additional_params: HashMap<String, String>,
15267 _scopes: BTreeSet<String>,
15268}
15269
15270impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLoggingCall<'a, C> {}
15271
15272impl<'a, C> ProjectLocationClusterSetLoggingCall<'a, C>
15273where
15274 C: common::Connector,
15275{
15276 /// Perform the operation you have build so far.
15277 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15278 use std::borrow::Cow;
15279 use std::io::{Read, Seek};
15280
15281 use common::{url::Params, ToParts};
15282 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15283
15284 let mut dd = common::DefaultDelegate;
15285 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15286 dlg.begin(common::MethodInfo {
15287 id: "container.projects.locations.clusters.setLogging",
15288 http_method: hyper::Method::POST,
15289 });
15290
15291 for &field in ["alt", "name"].iter() {
15292 if self._additional_params.contains_key(field) {
15293 dlg.finished(false);
15294 return Err(common::Error::FieldClash(field));
15295 }
15296 }
15297
15298 let mut params = Params::with_capacity(4 + self._additional_params.len());
15299 params.push("name", self._name);
15300
15301 params.extend(self._additional_params.iter());
15302
15303 params.push("alt", "json");
15304 let mut url = self.hub._base_url.clone() + "v1/{+name}:setLogging";
15305 if self._scopes.is_empty() {
15306 self._scopes
15307 .insert(Scope::CloudPlatform.as_ref().to_string());
15308 }
15309
15310 #[allow(clippy::single_element_loop)]
15311 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15312 url = params.uri_replacement(url, param_name, find_this, true);
15313 }
15314 {
15315 let to_remove = ["name"];
15316 params.remove_params(&to_remove);
15317 }
15318
15319 let url = params.parse_with_url(&url);
15320
15321 let mut json_mime_type = mime::APPLICATION_JSON;
15322 let mut request_value_reader = {
15323 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15324 common::remove_json_null_values(&mut value);
15325 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15326 serde_json::to_writer(&mut dst, &value).unwrap();
15327 dst
15328 };
15329 let request_size = request_value_reader
15330 .seek(std::io::SeekFrom::End(0))
15331 .unwrap();
15332 request_value_reader
15333 .seek(std::io::SeekFrom::Start(0))
15334 .unwrap();
15335
15336 loop {
15337 let token = match self
15338 .hub
15339 .auth
15340 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15341 .await
15342 {
15343 Ok(token) => token,
15344 Err(e) => match dlg.token(e) {
15345 Ok(token) => token,
15346 Err(e) => {
15347 dlg.finished(false);
15348 return Err(common::Error::MissingToken(e));
15349 }
15350 },
15351 };
15352 request_value_reader
15353 .seek(std::io::SeekFrom::Start(0))
15354 .unwrap();
15355 let mut req_result = {
15356 let client = &self.hub.client;
15357 dlg.pre_request();
15358 let mut req_builder = hyper::Request::builder()
15359 .method(hyper::Method::POST)
15360 .uri(url.as_str())
15361 .header(USER_AGENT, self.hub._user_agent.clone());
15362
15363 if let Some(token) = token.as_ref() {
15364 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15365 }
15366
15367 let request = req_builder
15368 .header(CONTENT_TYPE, json_mime_type.to_string())
15369 .header(CONTENT_LENGTH, request_size as u64)
15370 .body(common::to_body(
15371 request_value_reader.get_ref().clone().into(),
15372 ));
15373
15374 client.request(request.unwrap()).await
15375 };
15376
15377 match req_result {
15378 Err(err) => {
15379 if let common::Retry::After(d) = dlg.http_error(&err) {
15380 sleep(d).await;
15381 continue;
15382 }
15383 dlg.finished(false);
15384 return Err(common::Error::HttpError(err));
15385 }
15386 Ok(res) => {
15387 let (mut parts, body) = res.into_parts();
15388 let mut body = common::Body::new(body);
15389 if !parts.status.is_success() {
15390 let bytes = common::to_bytes(body).await.unwrap_or_default();
15391 let error = serde_json::from_str(&common::to_string(&bytes));
15392 let response = common::to_response(parts, bytes.into());
15393
15394 if let common::Retry::After(d) =
15395 dlg.http_failure(&response, error.as_ref().ok())
15396 {
15397 sleep(d).await;
15398 continue;
15399 }
15400
15401 dlg.finished(false);
15402
15403 return Err(match error {
15404 Ok(value) => common::Error::BadRequest(value),
15405 _ => common::Error::Failure(response),
15406 });
15407 }
15408 let response = {
15409 let bytes = common::to_bytes(body).await.unwrap_or_default();
15410 let encoded = common::to_string(&bytes);
15411 match serde_json::from_str(&encoded) {
15412 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15413 Err(error) => {
15414 dlg.response_json_decode_error(&encoded, &error);
15415 return Err(common::Error::JsonDecodeError(
15416 encoded.to_string(),
15417 error,
15418 ));
15419 }
15420 }
15421 };
15422
15423 dlg.finished(true);
15424 return Ok(response);
15425 }
15426 }
15427 }
15428 }
15429
15430 ///
15431 /// Sets the *request* property to the given value.
15432 ///
15433 /// Even though the property as already been set when instantiating this call,
15434 /// we provide this method for API completeness.
15435 pub fn request(
15436 mut self,
15437 new_value: SetLoggingServiceRequest,
15438 ) -> ProjectLocationClusterSetLoggingCall<'a, C> {
15439 self._request = new_value;
15440 self
15441 }
15442 /// The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
15443 ///
15444 /// Sets the *name* path property to the given value.
15445 ///
15446 /// Even though the property as already been set when instantiating this call,
15447 /// we provide this method for API completeness.
15448 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLoggingCall<'a, C> {
15449 self._name = new_value.to_string();
15450 self
15451 }
15452 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15453 /// while executing the actual API request.
15454 ///
15455 /// ````text
15456 /// It should be used to handle progress information, and to implement a certain level of resilience.
15457 /// ````
15458 ///
15459 /// Sets the *delegate* property to the given value.
15460 pub fn delegate(
15461 mut self,
15462 new_value: &'a mut dyn common::Delegate,
15463 ) -> ProjectLocationClusterSetLoggingCall<'a, C> {
15464 self._delegate = Some(new_value);
15465 self
15466 }
15467
15468 /// Set any additional parameter of the query string used in the request.
15469 /// It should be used to set parameters which are not yet available through their own
15470 /// setters.
15471 ///
15472 /// Please note that this method must not be used to set any of the known parameters
15473 /// which have their own setter method. If done anyway, the request will fail.
15474 ///
15475 /// # Additional Parameters
15476 ///
15477 /// * *$.xgafv* (query-string) - V1 error format.
15478 /// * *access_token* (query-string) - OAuth access token.
15479 /// * *alt* (query-string) - Data format for response.
15480 /// * *callback* (query-string) - JSONP
15481 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15482 /// * *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.
15483 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15484 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15485 /// * *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.
15486 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15487 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15488 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLoggingCall<'a, C>
15489 where
15490 T: AsRef<str>,
15491 {
15492 self._additional_params
15493 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15494 self
15495 }
15496
15497 /// Identifies the authorization scope for the method you are building.
15498 ///
15499 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15500 /// [`Scope::CloudPlatform`].
15501 ///
15502 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15503 /// tokens for more than one scope.
15504 ///
15505 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15506 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15507 /// sufficient, a read-write scope will do as well.
15508 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLoggingCall<'a, C>
15509 where
15510 St: AsRef<str>,
15511 {
15512 self._scopes.insert(String::from(scope.as_ref()));
15513 self
15514 }
15515 /// Identifies the authorization scope(s) for the method you are building.
15516 ///
15517 /// See [`Self::add_scope()`] for details.
15518 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLoggingCall<'a, C>
15519 where
15520 I: IntoIterator<Item = St>,
15521 St: AsRef<str>,
15522 {
15523 self._scopes
15524 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15525 self
15526 }
15527
15528 /// Removes all scopes, and no default scope will be used either.
15529 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15530 /// for details).
15531 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLoggingCall<'a, C> {
15532 self._scopes.clear();
15533 self
15534 }
15535}
15536
15537/// Sets the maintenance policy for a cluster.
15538///
15539/// A builder for the *locations.clusters.setMaintenancePolicy* method supported by a *project* resource.
15540/// It is not used directly, but through a [`ProjectMethods`] instance.
15541///
15542/// # Example
15543///
15544/// Instantiate a resource method builder
15545///
15546/// ```test_harness,no_run
15547/// # extern crate hyper;
15548/// # extern crate hyper_rustls;
15549/// # extern crate google_container1 as container1;
15550/// use container1::api::SetMaintenancePolicyRequest;
15551/// # async fn dox() {
15552/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15553///
15554/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15555/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15556/// # .with_native_roots()
15557/// # .unwrap()
15558/// # .https_only()
15559/// # .enable_http2()
15560/// # .build();
15561///
15562/// # let executor = hyper_util::rt::TokioExecutor::new();
15563/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15564/// # secret,
15565/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15566/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15567/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15568/// # ),
15569/// # ).build().await.unwrap();
15570///
15571/// # let client = hyper_util::client::legacy::Client::builder(
15572/// # hyper_util::rt::TokioExecutor::new()
15573/// # )
15574/// # .build(
15575/// # hyper_rustls::HttpsConnectorBuilder::new()
15576/// # .with_native_roots()
15577/// # .unwrap()
15578/// # .https_or_http()
15579/// # .enable_http2()
15580/// # .build()
15581/// # );
15582/// # let mut hub = Container::new(client, auth);
15583/// // As the method needs a request, you would usually fill it with the desired information
15584/// // into the respective structure. Some of the parts shown here might not be applicable !
15585/// // Values shown here are possibly random and not representative !
15586/// let mut req = SetMaintenancePolicyRequest::default();
15587///
15588/// // You can configure optional parameters by calling the respective setters at will, and
15589/// // execute the final call using `doit()`.
15590/// // Values shown here are possibly random and not representative !
15591/// let result = hub.projects().locations_clusters_set_maintenance_policy(req, "name")
15592/// .doit().await;
15593/// # }
15594/// ```
15595pub struct ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
15596where
15597 C: 'a,
15598{
15599 hub: &'a Container<C>,
15600 _request: SetMaintenancePolicyRequest,
15601 _name: String,
15602 _delegate: Option<&'a mut dyn common::Delegate>,
15603 _additional_params: HashMap<String, String>,
15604 _scopes: BTreeSet<String>,
15605}
15606
15607impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {}
15608
15609impl<'a, C> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
15610where
15611 C: common::Connector,
15612{
15613 /// Perform the operation you have build so far.
15614 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15615 use std::borrow::Cow;
15616 use std::io::{Read, Seek};
15617
15618 use common::{url::Params, ToParts};
15619 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15620
15621 let mut dd = common::DefaultDelegate;
15622 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15623 dlg.begin(common::MethodInfo {
15624 id: "container.projects.locations.clusters.setMaintenancePolicy",
15625 http_method: hyper::Method::POST,
15626 });
15627
15628 for &field in ["alt", "name"].iter() {
15629 if self._additional_params.contains_key(field) {
15630 dlg.finished(false);
15631 return Err(common::Error::FieldClash(field));
15632 }
15633 }
15634
15635 let mut params = Params::with_capacity(4 + self._additional_params.len());
15636 params.push("name", self._name);
15637
15638 params.extend(self._additional_params.iter());
15639
15640 params.push("alt", "json");
15641 let mut url = self.hub._base_url.clone() + "v1/{+name}:setMaintenancePolicy";
15642 if self._scopes.is_empty() {
15643 self._scopes
15644 .insert(Scope::CloudPlatform.as_ref().to_string());
15645 }
15646
15647 #[allow(clippy::single_element_loop)]
15648 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15649 url = params.uri_replacement(url, param_name, find_this, true);
15650 }
15651 {
15652 let to_remove = ["name"];
15653 params.remove_params(&to_remove);
15654 }
15655
15656 let url = params.parse_with_url(&url);
15657
15658 let mut json_mime_type = mime::APPLICATION_JSON;
15659 let mut request_value_reader = {
15660 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
15661 common::remove_json_null_values(&mut value);
15662 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
15663 serde_json::to_writer(&mut dst, &value).unwrap();
15664 dst
15665 };
15666 let request_size = request_value_reader
15667 .seek(std::io::SeekFrom::End(0))
15668 .unwrap();
15669 request_value_reader
15670 .seek(std::io::SeekFrom::Start(0))
15671 .unwrap();
15672
15673 loop {
15674 let token = match self
15675 .hub
15676 .auth
15677 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
15678 .await
15679 {
15680 Ok(token) => token,
15681 Err(e) => match dlg.token(e) {
15682 Ok(token) => token,
15683 Err(e) => {
15684 dlg.finished(false);
15685 return Err(common::Error::MissingToken(e));
15686 }
15687 },
15688 };
15689 request_value_reader
15690 .seek(std::io::SeekFrom::Start(0))
15691 .unwrap();
15692 let mut req_result = {
15693 let client = &self.hub.client;
15694 dlg.pre_request();
15695 let mut req_builder = hyper::Request::builder()
15696 .method(hyper::Method::POST)
15697 .uri(url.as_str())
15698 .header(USER_AGENT, self.hub._user_agent.clone());
15699
15700 if let Some(token) = token.as_ref() {
15701 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
15702 }
15703
15704 let request = req_builder
15705 .header(CONTENT_TYPE, json_mime_type.to_string())
15706 .header(CONTENT_LENGTH, request_size as u64)
15707 .body(common::to_body(
15708 request_value_reader.get_ref().clone().into(),
15709 ));
15710
15711 client.request(request.unwrap()).await
15712 };
15713
15714 match req_result {
15715 Err(err) => {
15716 if let common::Retry::After(d) = dlg.http_error(&err) {
15717 sleep(d).await;
15718 continue;
15719 }
15720 dlg.finished(false);
15721 return Err(common::Error::HttpError(err));
15722 }
15723 Ok(res) => {
15724 let (mut parts, body) = res.into_parts();
15725 let mut body = common::Body::new(body);
15726 if !parts.status.is_success() {
15727 let bytes = common::to_bytes(body).await.unwrap_or_default();
15728 let error = serde_json::from_str(&common::to_string(&bytes));
15729 let response = common::to_response(parts, bytes.into());
15730
15731 if let common::Retry::After(d) =
15732 dlg.http_failure(&response, error.as_ref().ok())
15733 {
15734 sleep(d).await;
15735 continue;
15736 }
15737
15738 dlg.finished(false);
15739
15740 return Err(match error {
15741 Ok(value) => common::Error::BadRequest(value),
15742 _ => common::Error::Failure(response),
15743 });
15744 }
15745 let response = {
15746 let bytes = common::to_bytes(body).await.unwrap_or_default();
15747 let encoded = common::to_string(&bytes);
15748 match serde_json::from_str(&encoded) {
15749 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
15750 Err(error) => {
15751 dlg.response_json_decode_error(&encoded, &error);
15752 return Err(common::Error::JsonDecodeError(
15753 encoded.to_string(),
15754 error,
15755 ));
15756 }
15757 }
15758 };
15759
15760 dlg.finished(true);
15761 return Ok(response);
15762 }
15763 }
15764 }
15765 }
15766
15767 ///
15768 /// Sets the *request* property to the given value.
15769 ///
15770 /// Even though the property as already been set when instantiating this call,
15771 /// we provide this method for API completeness.
15772 pub fn request(
15773 mut self,
15774 new_value: SetMaintenancePolicyRequest,
15775 ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
15776 self._request = new_value;
15777 self
15778 }
15779 /// The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
15780 ///
15781 /// Sets the *name* path property to the given value.
15782 ///
15783 /// Even though the property as already been set when instantiating this call,
15784 /// we provide this method for API completeness.
15785 pub fn name(
15786 mut self,
15787 new_value: &str,
15788 ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
15789 self._name = new_value.to_string();
15790 self
15791 }
15792 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
15793 /// while executing the actual API request.
15794 ///
15795 /// ````text
15796 /// It should be used to handle progress information, and to implement a certain level of resilience.
15797 /// ````
15798 ///
15799 /// Sets the *delegate* property to the given value.
15800 pub fn delegate(
15801 mut self,
15802 new_value: &'a mut dyn common::Delegate,
15803 ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
15804 self._delegate = Some(new_value);
15805 self
15806 }
15807
15808 /// Set any additional parameter of the query string used in the request.
15809 /// It should be used to set parameters which are not yet available through their own
15810 /// setters.
15811 ///
15812 /// Please note that this method must not be used to set any of the known parameters
15813 /// which have their own setter method. If done anyway, the request will fail.
15814 ///
15815 /// # Additional Parameters
15816 ///
15817 /// * *$.xgafv* (query-string) - V1 error format.
15818 /// * *access_token* (query-string) - OAuth access token.
15819 /// * *alt* (query-string) - Data format for response.
15820 /// * *callback* (query-string) - JSONP
15821 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
15822 /// * *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.
15823 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
15824 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
15825 /// * *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.
15826 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
15827 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
15828 pub fn param<T>(
15829 mut self,
15830 name: T,
15831 value: T,
15832 ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
15833 where
15834 T: AsRef<str>,
15835 {
15836 self._additional_params
15837 .insert(name.as_ref().to_string(), value.as_ref().to_string());
15838 self
15839 }
15840
15841 /// Identifies the authorization scope for the method you are building.
15842 ///
15843 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
15844 /// [`Scope::CloudPlatform`].
15845 ///
15846 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
15847 /// tokens for more than one scope.
15848 ///
15849 /// Usually there is more than one suitable scope to authorize an operation, some of which may
15850 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
15851 /// sufficient, a read-write scope will do as well.
15852 pub fn add_scope<St>(
15853 mut self,
15854 scope: St,
15855 ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
15856 where
15857 St: AsRef<str>,
15858 {
15859 self._scopes.insert(String::from(scope.as_ref()));
15860 self
15861 }
15862 /// Identifies the authorization scope(s) for the method you are building.
15863 ///
15864 /// See [`Self::add_scope()`] for details.
15865 pub fn add_scopes<I, St>(
15866 mut self,
15867 scopes: I,
15868 ) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
15869 where
15870 I: IntoIterator<Item = St>,
15871 St: AsRef<str>,
15872 {
15873 self._scopes
15874 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
15875 self
15876 }
15877
15878 /// Removes all scopes, and no default scope will be used either.
15879 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
15880 /// for details).
15881 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
15882 self._scopes.clear();
15883 self
15884 }
15885}
15886
15887/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
15888///
15889/// A builder for the *locations.clusters.setMasterAuth* method supported by a *project* resource.
15890/// It is not used directly, but through a [`ProjectMethods`] instance.
15891///
15892/// # Example
15893///
15894/// Instantiate a resource method builder
15895///
15896/// ```test_harness,no_run
15897/// # extern crate hyper;
15898/// # extern crate hyper_rustls;
15899/// # extern crate google_container1 as container1;
15900/// use container1::api::SetMasterAuthRequest;
15901/// # async fn dox() {
15902/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
15903///
15904/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
15905/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
15906/// # .with_native_roots()
15907/// # .unwrap()
15908/// # .https_only()
15909/// # .enable_http2()
15910/// # .build();
15911///
15912/// # let executor = hyper_util::rt::TokioExecutor::new();
15913/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
15914/// # secret,
15915/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
15916/// # yup_oauth2::client::CustomHyperClientBuilder::from(
15917/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
15918/// # ),
15919/// # ).build().await.unwrap();
15920///
15921/// # let client = hyper_util::client::legacy::Client::builder(
15922/// # hyper_util::rt::TokioExecutor::new()
15923/// # )
15924/// # .build(
15925/// # hyper_rustls::HttpsConnectorBuilder::new()
15926/// # .with_native_roots()
15927/// # .unwrap()
15928/// # .https_or_http()
15929/// # .enable_http2()
15930/// # .build()
15931/// # );
15932/// # let mut hub = Container::new(client, auth);
15933/// // As the method needs a request, you would usually fill it with the desired information
15934/// // into the respective structure. Some of the parts shown here might not be applicable !
15935/// // Values shown here are possibly random and not representative !
15936/// let mut req = SetMasterAuthRequest::default();
15937///
15938/// // You can configure optional parameters by calling the respective setters at will, and
15939/// // execute the final call using `doit()`.
15940/// // Values shown here are possibly random and not representative !
15941/// let result = hub.projects().locations_clusters_set_master_auth(req, "name")
15942/// .doit().await;
15943/// # }
15944/// ```
15945pub struct ProjectLocationClusterSetMasterAuthCall<'a, C>
15946where
15947 C: 'a,
15948{
15949 hub: &'a Container<C>,
15950 _request: SetMasterAuthRequest,
15951 _name: String,
15952 _delegate: Option<&'a mut dyn common::Delegate>,
15953 _additional_params: HashMap<String, String>,
15954 _scopes: BTreeSet<String>,
15955}
15956
15957impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMasterAuthCall<'a, C> {}
15958
15959impl<'a, C> ProjectLocationClusterSetMasterAuthCall<'a, C>
15960where
15961 C: common::Connector,
15962{
15963 /// Perform the operation you have build so far.
15964 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
15965 use std::borrow::Cow;
15966 use std::io::{Read, Seek};
15967
15968 use common::{url::Params, ToParts};
15969 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
15970
15971 let mut dd = common::DefaultDelegate;
15972 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
15973 dlg.begin(common::MethodInfo {
15974 id: "container.projects.locations.clusters.setMasterAuth",
15975 http_method: hyper::Method::POST,
15976 });
15977
15978 for &field in ["alt", "name"].iter() {
15979 if self._additional_params.contains_key(field) {
15980 dlg.finished(false);
15981 return Err(common::Error::FieldClash(field));
15982 }
15983 }
15984
15985 let mut params = Params::with_capacity(4 + self._additional_params.len());
15986 params.push("name", self._name);
15987
15988 params.extend(self._additional_params.iter());
15989
15990 params.push("alt", "json");
15991 let mut url = self.hub._base_url.clone() + "v1/{+name}:setMasterAuth";
15992 if self._scopes.is_empty() {
15993 self._scopes
15994 .insert(Scope::CloudPlatform.as_ref().to_string());
15995 }
15996
15997 #[allow(clippy::single_element_loop)]
15998 for &(find_this, param_name) in [("{+name}", "name")].iter() {
15999 url = params.uri_replacement(url, param_name, find_this, true);
16000 }
16001 {
16002 let to_remove = ["name"];
16003 params.remove_params(&to_remove);
16004 }
16005
16006 let url = params.parse_with_url(&url);
16007
16008 let mut json_mime_type = mime::APPLICATION_JSON;
16009 let mut request_value_reader = {
16010 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16011 common::remove_json_null_values(&mut value);
16012 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16013 serde_json::to_writer(&mut dst, &value).unwrap();
16014 dst
16015 };
16016 let request_size = request_value_reader
16017 .seek(std::io::SeekFrom::End(0))
16018 .unwrap();
16019 request_value_reader
16020 .seek(std::io::SeekFrom::Start(0))
16021 .unwrap();
16022
16023 loop {
16024 let token = match self
16025 .hub
16026 .auth
16027 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16028 .await
16029 {
16030 Ok(token) => token,
16031 Err(e) => match dlg.token(e) {
16032 Ok(token) => token,
16033 Err(e) => {
16034 dlg.finished(false);
16035 return Err(common::Error::MissingToken(e));
16036 }
16037 },
16038 };
16039 request_value_reader
16040 .seek(std::io::SeekFrom::Start(0))
16041 .unwrap();
16042 let mut req_result = {
16043 let client = &self.hub.client;
16044 dlg.pre_request();
16045 let mut req_builder = hyper::Request::builder()
16046 .method(hyper::Method::POST)
16047 .uri(url.as_str())
16048 .header(USER_AGENT, self.hub._user_agent.clone());
16049
16050 if let Some(token) = token.as_ref() {
16051 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16052 }
16053
16054 let request = req_builder
16055 .header(CONTENT_TYPE, json_mime_type.to_string())
16056 .header(CONTENT_LENGTH, request_size as u64)
16057 .body(common::to_body(
16058 request_value_reader.get_ref().clone().into(),
16059 ));
16060
16061 client.request(request.unwrap()).await
16062 };
16063
16064 match req_result {
16065 Err(err) => {
16066 if let common::Retry::After(d) = dlg.http_error(&err) {
16067 sleep(d).await;
16068 continue;
16069 }
16070 dlg.finished(false);
16071 return Err(common::Error::HttpError(err));
16072 }
16073 Ok(res) => {
16074 let (mut parts, body) = res.into_parts();
16075 let mut body = common::Body::new(body);
16076 if !parts.status.is_success() {
16077 let bytes = common::to_bytes(body).await.unwrap_or_default();
16078 let error = serde_json::from_str(&common::to_string(&bytes));
16079 let response = common::to_response(parts, bytes.into());
16080
16081 if let common::Retry::After(d) =
16082 dlg.http_failure(&response, error.as_ref().ok())
16083 {
16084 sleep(d).await;
16085 continue;
16086 }
16087
16088 dlg.finished(false);
16089
16090 return Err(match error {
16091 Ok(value) => common::Error::BadRequest(value),
16092 _ => common::Error::Failure(response),
16093 });
16094 }
16095 let response = {
16096 let bytes = common::to_bytes(body).await.unwrap_or_default();
16097 let encoded = common::to_string(&bytes);
16098 match serde_json::from_str(&encoded) {
16099 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16100 Err(error) => {
16101 dlg.response_json_decode_error(&encoded, &error);
16102 return Err(common::Error::JsonDecodeError(
16103 encoded.to_string(),
16104 error,
16105 ));
16106 }
16107 }
16108 };
16109
16110 dlg.finished(true);
16111 return Ok(response);
16112 }
16113 }
16114 }
16115 }
16116
16117 ///
16118 /// Sets the *request* property to the given value.
16119 ///
16120 /// Even though the property as already been set when instantiating this call,
16121 /// we provide this method for API completeness.
16122 pub fn request(
16123 mut self,
16124 new_value: SetMasterAuthRequest,
16125 ) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
16126 self._request = new_value;
16127 self
16128 }
16129 /// The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
16130 ///
16131 /// Sets the *name* path property to the given value.
16132 ///
16133 /// Even though the property as already been set when instantiating this call,
16134 /// we provide this method for API completeness.
16135 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
16136 self._name = new_value.to_string();
16137 self
16138 }
16139 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16140 /// while executing the actual API request.
16141 ///
16142 /// ````text
16143 /// It should be used to handle progress information, and to implement a certain level of resilience.
16144 /// ````
16145 ///
16146 /// Sets the *delegate* property to the given value.
16147 pub fn delegate(
16148 mut self,
16149 new_value: &'a mut dyn common::Delegate,
16150 ) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
16151 self._delegate = Some(new_value);
16152 self
16153 }
16154
16155 /// Set any additional parameter of the query string used in the request.
16156 /// It should be used to set parameters which are not yet available through their own
16157 /// setters.
16158 ///
16159 /// Please note that this method must not be used to set any of the known parameters
16160 /// which have their own setter method. If done anyway, the request will fail.
16161 ///
16162 /// # Additional Parameters
16163 ///
16164 /// * *$.xgafv* (query-string) - V1 error format.
16165 /// * *access_token* (query-string) - OAuth access token.
16166 /// * *alt* (query-string) - Data format for response.
16167 /// * *callback* (query-string) - JSONP
16168 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16169 /// * *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.
16170 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16171 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16172 /// * *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.
16173 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16174 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16175 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
16176 where
16177 T: AsRef<str>,
16178 {
16179 self._additional_params
16180 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16181 self
16182 }
16183
16184 /// Identifies the authorization scope for the method you are building.
16185 ///
16186 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16187 /// [`Scope::CloudPlatform`].
16188 ///
16189 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16190 /// tokens for more than one scope.
16191 ///
16192 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16193 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16194 /// sufficient, a read-write scope will do as well.
16195 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
16196 where
16197 St: AsRef<str>,
16198 {
16199 self._scopes.insert(String::from(scope.as_ref()));
16200 self
16201 }
16202 /// Identifies the authorization scope(s) for the method you are building.
16203 ///
16204 /// See [`Self::add_scope()`] for details.
16205 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
16206 where
16207 I: IntoIterator<Item = St>,
16208 St: AsRef<str>,
16209 {
16210 self._scopes
16211 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16212 self
16213 }
16214
16215 /// Removes all scopes, and no default scope will be used either.
16216 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16217 /// for details).
16218 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
16219 self._scopes.clear();
16220 self
16221 }
16222}
16223
16224/// Sets the monitoring service for a specific cluster.
16225///
16226/// A builder for the *locations.clusters.setMonitoring* method supported by a *project* resource.
16227/// It is not used directly, but through a [`ProjectMethods`] instance.
16228///
16229/// # Example
16230///
16231/// Instantiate a resource method builder
16232///
16233/// ```test_harness,no_run
16234/// # extern crate hyper;
16235/// # extern crate hyper_rustls;
16236/// # extern crate google_container1 as container1;
16237/// use container1::api::SetMonitoringServiceRequest;
16238/// # async fn dox() {
16239/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16240///
16241/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16242/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16243/// # .with_native_roots()
16244/// # .unwrap()
16245/// # .https_only()
16246/// # .enable_http2()
16247/// # .build();
16248///
16249/// # let executor = hyper_util::rt::TokioExecutor::new();
16250/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16251/// # secret,
16252/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16253/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16254/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16255/// # ),
16256/// # ).build().await.unwrap();
16257///
16258/// # let client = hyper_util::client::legacy::Client::builder(
16259/// # hyper_util::rt::TokioExecutor::new()
16260/// # )
16261/// # .build(
16262/// # hyper_rustls::HttpsConnectorBuilder::new()
16263/// # .with_native_roots()
16264/// # .unwrap()
16265/// # .https_or_http()
16266/// # .enable_http2()
16267/// # .build()
16268/// # );
16269/// # let mut hub = Container::new(client, auth);
16270/// // As the method needs a request, you would usually fill it with the desired information
16271/// // into the respective structure. Some of the parts shown here might not be applicable !
16272/// // Values shown here are possibly random and not representative !
16273/// let mut req = SetMonitoringServiceRequest::default();
16274///
16275/// // You can configure optional parameters by calling the respective setters at will, and
16276/// // execute the final call using `doit()`.
16277/// // Values shown here are possibly random and not representative !
16278/// let result = hub.projects().locations_clusters_set_monitoring(req, "name")
16279/// .doit().await;
16280/// # }
16281/// ```
16282pub struct ProjectLocationClusterSetMonitoringCall<'a, C>
16283where
16284 C: 'a,
16285{
16286 hub: &'a Container<C>,
16287 _request: SetMonitoringServiceRequest,
16288 _name: String,
16289 _delegate: Option<&'a mut dyn common::Delegate>,
16290 _additional_params: HashMap<String, String>,
16291 _scopes: BTreeSet<String>,
16292}
16293
16294impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMonitoringCall<'a, C> {}
16295
16296impl<'a, C> ProjectLocationClusterSetMonitoringCall<'a, C>
16297where
16298 C: common::Connector,
16299{
16300 /// Perform the operation you have build so far.
16301 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16302 use std::borrow::Cow;
16303 use std::io::{Read, Seek};
16304
16305 use common::{url::Params, ToParts};
16306 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16307
16308 let mut dd = common::DefaultDelegate;
16309 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16310 dlg.begin(common::MethodInfo {
16311 id: "container.projects.locations.clusters.setMonitoring",
16312 http_method: hyper::Method::POST,
16313 });
16314
16315 for &field in ["alt", "name"].iter() {
16316 if self._additional_params.contains_key(field) {
16317 dlg.finished(false);
16318 return Err(common::Error::FieldClash(field));
16319 }
16320 }
16321
16322 let mut params = Params::with_capacity(4 + self._additional_params.len());
16323 params.push("name", self._name);
16324
16325 params.extend(self._additional_params.iter());
16326
16327 params.push("alt", "json");
16328 let mut url = self.hub._base_url.clone() + "v1/{+name}:setMonitoring";
16329 if self._scopes.is_empty() {
16330 self._scopes
16331 .insert(Scope::CloudPlatform.as_ref().to_string());
16332 }
16333
16334 #[allow(clippy::single_element_loop)]
16335 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16336 url = params.uri_replacement(url, param_name, find_this, true);
16337 }
16338 {
16339 let to_remove = ["name"];
16340 params.remove_params(&to_remove);
16341 }
16342
16343 let url = params.parse_with_url(&url);
16344
16345 let mut json_mime_type = mime::APPLICATION_JSON;
16346 let mut request_value_reader = {
16347 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16348 common::remove_json_null_values(&mut value);
16349 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16350 serde_json::to_writer(&mut dst, &value).unwrap();
16351 dst
16352 };
16353 let request_size = request_value_reader
16354 .seek(std::io::SeekFrom::End(0))
16355 .unwrap();
16356 request_value_reader
16357 .seek(std::io::SeekFrom::Start(0))
16358 .unwrap();
16359
16360 loop {
16361 let token = match self
16362 .hub
16363 .auth
16364 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16365 .await
16366 {
16367 Ok(token) => token,
16368 Err(e) => match dlg.token(e) {
16369 Ok(token) => token,
16370 Err(e) => {
16371 dlg.finished(false);
16372 return Err(common::Error::MissingToken(e));
16373 }
16374 },
16375 };
16376 request_value_reader
16377 .seek(std::io::SeekFrom::Start(0))
16378 .unwrap();
16379 let mut req_result = {
16380 let client = &self.hub.client;
16381 dlg.pre_request();
16382 let mut req_builder = hyper::Request::builder()
16383 .method(hyper::Method::POST)
16384 .uri(url.as_str())
16385 .header(USER_AGENT, self.hub._user_agent.clone());
16386
16387 if let Some(token) = token.as_ref() {
16388 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16389 }
16390
16391 let request = req_builder
16392 .header(CONTENT_TYPE, json_mime_type.to_string())
16393 .header(CONTENT_LENGTH, request_size as u64)
16394 .body(common::to_body(
16395 request_value_reader.get_ref().clone().into(),
16396 ));
16397
16398 client.request(request.unwrap()).await
16399 };
16400
16401 match req_result {
16402 Err(err) => {
16403 if let common::Retry::After(d) = dlg.http_error(&err) {
16404 sleep(d).await;
16405 continue;
16406 }
16407 dlg.finished(false);
16408 return Err(common::Error::HttpError(err));
16409 }
16410 Ok(res) => {
16411 let (mut parts, body) = res.into_parts();
16412 let mut body = common::Body::new(body);
16413 if !parts.status.is_success() {
16414 let bytes = common::to_bytes(body).await.unwrap_or_default();
16415 let error = serde_json::from_str(&common::to_string(&bytes));
16416 let response = common::to_response(parts, bytes.into());
16417
16418 if let common::Retry::After(d) =
16419 dlg.http_failure(&response, error.as_ref().ok())
16420 {
16421 sleep(d).await;
16422 continue;
16423 }
16424
16425 dlg.finished(false);
16426
16427 return Err(match error {
16428 Ok(value) => common::Error::BadRequest(value),
16429 _ => common::Error::Failure(response),
16430 });
16431 }
16432 let response = {
16433 let bytes = common::to_bytes(body).await.unwrap_or_default();
16434 let encoded = common::to_string(&bytes);
16435 match serde_json::from_str(&encoded) {
16436 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16437 Err(error) => {
16438 dlg.response_json_decode_error(&encoded, &error);
16439 return Err(common::Error::JsonDecodeError(
16440 encoded.to_string(),
16441 error,
16442 ));
16443 }
16444 }
16445 };
16446
16447 dlg.finished(true);
16448 return Ok(response);
16449 }
16450 }
16451 }
16452 }
16453
16454 ///
16455 /// Sets the *request* property to the given value.
16456 ///
16457 /// Even though the property as already been set when instantiating this call,
16458 /// we provide this method for API completeness.
16459 pub fn request(
16460 mut self,
16461 new_value: SetMonitoringServiceRequest,
16462 ) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
16463 self._request = new_value;
16464 self
16465 }
16466 /// The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
16467 ///
16468 /// Sets the *name* path property to the given value.
16469 ///
16470 /// Even though the property as already been set when instantiating this call,
16471 /// we provide this method for API completeness.
16472 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
16473 self._name = new_value.to_string();
16474 self
16475 }
16476 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16477 /// while executing the actual API request.
16478 ///
16479 /// ````text
16480 /// It should be used to handle progress information, and to implement a certain level of resilience.
16481 /// ````
16482 ///
16483 /// Sets the *delegate* property to the given value.
16484 pub fn delegate(
16485 mut self,
16486 new_value: &'a mut dyn common::Delegate,
16487 ) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
16488 self._delegate = Some(new_value);
16489 self
16490 }
16491
16492 /// Set any additional parameter of the query string used in the request.
16493 /// It should be used to set parameters which are not yet available through their own
16494 /// setters.
16495 ///
16496 /// Please note that this method must not be used to set any of the known parameters
16497 /// which have their own setter method. If done anyway, the request will fail.
16498 ///
16499 /// # Additional Parameters
16500 ///
16501 /// * *$.xgafv* (query-string) - V1 error format.
16502 /// * *access_token* (query-string) - OAuth access token.
16503 /// * *alt* (query-string) - Data format for response.
16504 /// * *callback* (query-string) - JSONP
16505 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16506 /// * *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.
16507 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16508 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16509 /// * *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.
16510 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16511 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16512 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetMonitoringCall<'a, C>
16513 where
16514 T: AsRef<str>,
16515 {
16516 self._additional_params
16517 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16518 self
16519 }
16520
16521 /// Identifies the authorization scope for the method you are building.
16522 ///
16523 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16524 /// [`Scope::CloudPlatform`].
16525 ///
16526 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16527 /// tokens for more than one scope.
16528 ///
16529 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16530 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16531 /// sufficient, a read-write scope will do as well.
16532 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetMonitoringCall<'a, C>
16533 where
16534 St: AsRef<str>,
16535 {
16536 self._scopes.insert(String::from(scope.as_ref()));
16537 self
16538 }
16539 /// Identifies the authorization scope(s) for the method you are building.
16540 ///
16541 /// See [`Self::add_scope()`] for details.
16542 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetMonitoringCall<'a, C>
16543 where
16544 I: IntoIterator<Item = St>,
16545 St: AsRef<str>,
16546 {
16547 self._scopes
16548 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16549 self
16550 }
16551
16552 /// Removes all scopes, and no default scope will be used either.
16553 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16554 /// for details).
16555 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
16556 self._scopes.clear();
16557 self
16558 }
16559}
16560
16561/// Enables or disables Network Policy for a cluster.
16562///
16563/// A builder for the *locations.clusters.setNetworkPolicy* method supported by a *project* resource.
16564/// It is not used directly, but through a [`ProjectMethods`] instance.
16565///
16566/// # Example
16567///
16568/// Instantiate a resource method builder
16569///
16570/// ```test_harness,no_run
16571/// # extern crate hyper;
16572/// # extern crate hyper_rustls;
16573/// # extern crate google_container1 as container1;
16574/// use container1::api::SetNetworkPolicyRequest;
16575/// # async fn dox() {
16576/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16577///
16578/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16579/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16580/// # .with_native_roots()
16581/// # .unwrap()
16582/// # .https_only()
16583/// # .enable_http2()
16584/// # .build();
16585///
16586/// # let executor = hyper_util::rt::TokioExecutor::new();
16587/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16588/// # secret,
16589/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16590/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16591/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16592/// # ),
16593/// # ).build().await.unwrap();
16594///
16595/// # let client = hyper_util::client::legacy::Client::builder(
16596/// # hyper_util::rt::TokioExecutor::new()
16597/// # )
16598/// # .build(
16599/// # hyper_rustls::HttpsConnectorBuilder::new()
16600/// # .with_native_roots()
16601/// # .unwrap()
16602/// # .https_or_http()
16603/// # .enable_http2()
16604/// # .build()
16605/// # );
16606/// # let mut hub = Container::new(client, auth);
16607/// // As the method needs a request, you would usually fill it with the desired information
16608/// // into the respective structure. Some of the parts shown here might not be applicable !
16609/// // Values shown here are possibly random and not representative !
16610/// let mut req = SetNetworkPolicyRequest::default();
16611///
16612/// // You can configure optional parameters by calling the respective setters at will, and
16613/// // execute the final call using `doit()`.
16614/// // Values shown here are possibly random and not representative !
16615/// let result = hub.projects().locations_clusters_set_network_policy(req, "name")
16616/// .doit().await;
16617/// # }
16618/// ```
16619pub struct ProjectLocationClusterSetNetworkPolicyCall<'a, C>
16620where
16621 C: 'a,
16622{
16623 hub: &'a Container<C>,
16624 _request: SetNetworkPolicyRequest,
16625 _name: String,
16626 _delegate: Option<&'a mut dyn common::Delegate>,
16627 _additional_params: HashMap<String, String>,
16628 _scopes: BTreeSet<String>,
16629}
16630
16631impl<'a, C> common::CallBuilder for ProjectLocationClusterSetNetworkPolicyCall<'a, C> {}
16632
16633impl<'a, C> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
16634where
16635 C: common::Connector,
16636{
16637 /// Perform the operation you have build so far.
16638 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16639 use std::borrow::Cow;
16640 use std::io::{Read, Seek};
16641
16642 use common::{url::Params, ToParts};
16643 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16644
16645 let mut dd = common::DefaultDelegate;
16646 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16647 dlg.begin(common::MethodInfo {
16648 id: "container.projects.locations.clusters.setNetworkPolicy",
16649 http_method: hyper::Method::POST,
16650 });
16651
16652 for &field in ["alt", "name"].iter() {
16653 if self._additional_params.contains_key(field) {
16654 dlg.finished(false);
16655 return Err(common::Error::FieldClash(field));
16656 }
16657 }
16658
16659 let mut params = Params::with_capacity(4 + self._additional_params.len());
16660 params.push("name", self._name);
16661
16662 params.extend(self._additional_params.iter());
16663
16664 params.push("alt", "json");
16665 let mut url = self.hub._base_url.clone() + "v1/{+name}:setNetworkPolicy";
16666 if self._scopes.is_empty() {
16667 self._scopes
16668 .insert(Scope::CloudPlatform.as_ref().to_string());
16669 }
16670
16671 #[allow(clippy::single_element_loop)]
16672 for &(find_this, param_name) in [("{+name}", "name")].iter() {
16673 url = params.uri_replacement(url, param_name, find_this, true);
16674 }
16675 {
16676 let to_remove = ["name"];
16677 params.remove_params(&to_remove);
16678 }
16679
16680 let url = params.parse_with_url(&url);
16681
16682 let mut json_mime_type = mime::APPLICATION_JSON;
16683 let mut request_value_reader = {
16684 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
16685 common::remove_json_null_values(&mut value);
16686 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
16687 serde_json::to_writer(&mut dst, &value).unwrap();
16688 dst
16689 };
16690 let request_size = request_value_reader
16691 .seek(std::io::SeekFrom::End(0))
16692 .unwrap();
16693 request_value_reader
16694 .seek(std::io::SeekFrom::Start(0))
16695 .unwrap();
16696
16697 loop {
16698 let token = match self
16699 .hub
16700 .auth
16701 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
16702 .await
16703 {
16704 Ok(token) => token,
16705 Err(e) => match dlg.token(e) {
16706 Ok(token) => token,
16707 Err(e) => {
16708 dlg.finished(false);
16709 return Err(common::Error::MissingToken(e));
16710 }
16711 },
16712 };
16713 request_value_reader
16714 .seek(std::io::SeekFrom::Start(0))
16715 .unwrap();
16716 let mut req_result = {
16717 let client = &self.hub.client;
16718 dlg.pre_request();
16719 let mut req_builder = hyper::Request::builder()
16720 .method(hyper::Method::POST)
16721 .uri(url.as_str())
16722 .header(USER_AGENT, self.hub._user_agent.clone());
16723
16724 if let Some(token) = token.as_ref() {
16725 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
16726 }
16727
16728 let request = req_builder
16729 .header(CONTENT_TYPE, json_mime_type.to_string())
16730 .header(CONTENT_LENGTH, request_size as u64)
16731 .body(common::to_body(
16732 request_value_reader.get_ref().clone().into(),
16733 ));
16734
16735 client.request(request.unwrap()).await
16736 };
16737
16738 match req_result {
16739 Err(err) => {
16740 if let common::Retry::After(d) = dlg.http_error(&err) {
16741 sleep(d).await;
16742 continue;
16743 }
16744 dlg.finished(false);
16745 return Err(common::Error::HttpError(err));
16746 }
16747 Ok(res) => {
16748 let (mut parts, body) = res.into_parts();
16749 let mut body = common::Body::new(body);
16750 if !parts.status.is_success() {
16751 let bytes = common::to_bytes(body).await.unwrap_or_default();
16752 let error = serde_json::from_str(&common::to_string(&bytes));
16753 let response = common::to_response(parts, bytes.into());
16754
16755 if let common::Retry::After(d) =
16756 dlg.http_failure(&response, error.as_ref().ok())
16757 {
16758 sleep(d).await;
16759 continue;
16760 }
16761
16762 dlg.finished(false);
16763
16764 return Err(match error {
16765 Ok(value) => common::Error::BadRequest(value),
16766 _ => common::Error::Failure(response),
16767 });
16768 }
16769 let response = {
16770 let bytes = common::to_bytes(body).await.unwrap_or_default();
16771 let encoded = common::to_string(&bytes);
16772 match serde_json::from_str(&encoded) {
16773 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
16774 Err(error) => {
16775 dlg.response_json_decode_error(&encoded, &error);
16776 return Err(common::Error::JsonDecodeError(
16777 encoded.to_string(),
16778 error,
16779 ));
16780 }
16781 }
16782 };
16783
16784 dlg.finished(true);
16785 return Ok(response);
16786 }
16787 }
16788 }
16789 }
16790
16791 ///
16792 /// Sets the *request* property to the given value.
16793 ///
16794 /// Even though the property as already been set when instantiating this call,
16795 /// we provide this method for API completeness.
16796 pub fn request(
16797 mut self,
16798 new_value: SetNetworkPolicyRequest,
16799 ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
16800 self._request = new_value;
16801 self
16802 }
16803 /// The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
16804 ///
16805 /// Sets the *name* path property to the given value.
16806 ///
16807 /// Even though the property as already been set when instantiating this call,
16808 /// we provide this method for API completeness.
16809 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
16810 self._name = new_value.to_string();
16811 self
16812 }
16813 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
16814 /// while executing the actual API request.
16815 ///
16816 /// ````text
16817 /// It should be used to handle progress information, and to implement a certain level of resilience.
16818 /// ````
16819 ///
16820 /// Sets the *delegate* property to the given value.
16821 pub fn delegate(
16822 mut self,
16823 new_value: &'a mut dyn common::Delegate,
16824 ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
16825 self._delegate = Some(new_value);
16826 self
16827 }
16828
16829 /// Set any additional parameter of the query string used in the request.
16830 /// It should be used to set parameters which are not yet available through their own
16831 /// setters.
16832 ///
16833 /// Please note that this method must not be used to set any of the known parameters
16834 /// which have their own setter method. If done anyway, the request will fail.
16835 ///
16836 /// # Additional Parameters
16837 ///
16838 /// * *$.xgafv* (query-string) - V1 error format.
16839 /// * *access_token* (query-string) - OAuth access token.
16840 /// * *alt* (query-string) - Data format for response.
16841 /// * *callback* (query-string) - JSONP
16842 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
16843 /// * *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.
16844 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
16845 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
16846 /// * *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.
16847 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
16848 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
16849 pub fn param<T>(
16850 mut self,
16851 name: T,
16852 value: T,
16853 ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
16854 where
16855 T: AsRef<str>,
16856 {
16857 self._additional_params
16858 .insert(name.as_ref().to_string(), value.as_ref().to_string());
16859 self
16860 }
16861
16862 /// Identifies the authorization scope for the method you are building.
16863 ///
16864 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
16865 /// [`Scope::CloudPlatform`].
16866 ///
16867 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
16868 /// tokens for more than one scope.
16869 ///
16870 /// Usually there is more than one suitable scope to authorize an operation, some of which may
16871 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
16872 /// sufficient, a read-write scope will do as well.
16873 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
16874 where
16875 St: AsRef<str>,
16876 {
16877 self._scopes.insert(String::from(scope.as_ref()));
16878 self
16879 }
16880 /// Identifies the authorization scope(s) for the method you are building.
16881 ///
16882 /// See [`Self::add_scope()`] for details.
16883 pub fn add_scopes<I, St>(
16884 mut self,
16885 scopes: I,
16886 ) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
16887 where
16888 I: IntoIterator<Item = St>,
16889 St: AsRef<str>,
16890 {
16891 self._scopes
16892 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
16893 self
16894 }
16895
16896 /// Removes all scopes, and no default scope will be used either.
16897 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
16898 /// for details).
16899 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
16900 self._scopes.clear();
16901 self
16902 }
16903}
16904
16905/// Sets labels on a cluster.
16906///
16907/// A builder for the *locations.clusters.setResourceLabels* method supported by a *project* resource.
16908/// It is not used directly, but through a [`ProjectMethods`] instance.
16909///
16910/// # Example
16911///
16912/// Instantiate a resource method builder
16913///
16914/// ```test_harness,no_run
16915/// # extern crate hyper;
16916/// # extern crate hyper_rustls;
16917/// # extern crate google_container1 as container1;
16918/// use container1::api::SetLabelsRequest;
16919/// # async fn dox() {
16920/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
16921///
16922/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
16923/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
16924/// # .with_native_roots()
16925/// # .unwrap()
16926/// # .https_only()
16927/// # .enable_http2()
16928/// # .build();
16929///
16930/// # let executor = hyper_util::rt::TokioExecutor::new();
16931/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
16932/// # secret,
16933/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
16934/// # yup_oauth2::client::CustomHyperClientBuilder::from(
16935/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
16936/// # ),
16937/// # ).build().await.unwrap();
16938///
16939/// # let client = hyper_util::client::legacy::Client::builder(
16940/// # hyper_util::rt::TokioExecutor::new()
16941/// # )
16942/// # .build(
16943/// # hyper_rustls::HttpsConnectorBuilder::new()
16944/// # .with_native_roots()
16945/// # .unwrap()
16946/// # .https_or_http()
16947/// # .enable_http2()
16948/// # .build()
16949/// # );
16950/// # let mut hub = Container::new(client, auth);
16951/// // As the method needs a request, you would usually fill it with the desired information
16952/// // into the respective structure. Some of the parts shown here might not be applicable !
16953/// // Values shown here are possibly random and not representative !
16954/// let mut req = SetLabelsRequest::default();
16955///
16956/// // You can configure optional parameters by calling the respective setters at will, and
16957/// // execute the final call using `doit()`.
16958/// // Values shown here are possibly random and not representative !
16959/// let result = hub.projects().locations_clusters_set_resource_labels(req, "name")
16960/// .doit().await;
16961/// # }
16962/// ```
16963pub struct ProjectLocationClusterSetResourceLabelCall<'a, C>
16964where
16965 C: 'a,
16966{
16967 hub: &'a Container<C>,
16968 _request: SetLabelsRequest,
16969 _name: String,
16970 _delegate: Option<&'a mut dyn common::Delegate>,
16971 _additional_params: HashMap<String, String>,
16972 _scopes: BTreeSet<String>,
16973}
16974
16975impl<'a, C> common::CallBuilder for ProjectLocationClusterSetResourceLabelCall<'a, C> {}
16976
16977impl<'a, C> ProjectLocationClusterSetResourceLabelCall<'a, C>
16978where
16979 C: common::Connector,
16980{
16981 /// Perform the operation you have build so far.
16982 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
16983 use std::borrow::Cow;
16984 use std::io::{Read, Seek};
16985
16986 use common::{url::Params, ToParts};
16987 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
16988
16989 let mut dd = common::DefaultDelegate;
16990 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
16991 dlg.begin(common::MethodInfo {
16992 id: "container.projects.locations.clusters.setResourceLabels",
16993 http_method: hyper::Method::POST,
16994 });
16995
16996 for &field in ["alt", "name"].iter() {
16997 if self._additional_params.contains_key(field) {
16998 dlg.finished(false);
16999 return Err(common::Error::FieldClash(field));
17000 }
17001 }
17002
17003 let mut params = Params::with_capacity(4 + self._additional_params.len());
17004 params.push("name", self._name);
17005
17006 params.extend(self._additional_params.iter());
17007
17008 params.push("alt", "json");
17009 let mut url = self.hub._base_url.clone() + "v1/{+name}:setResourceLabels";
17010 if self._scopes.is_empty() {
17011 self._scopes
17012 .insert(Scope::CloudPlatform.as_ref().to_string());
17013 }
17014
17015 #[allow(clippy::single_element_loop)]
17016 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17017 url = params.uri_replacement(url, param_name, find_this, true);
17018 }
17019 {
17020 let to_remove = ["name"];
17021 params.remove_params(&to_remove);
17022 }
17023
17024 let url = params.parse_with_url(&url);
17025
17026 let mut json_mime_type = mime::APPLICATION_JSON;
17027 let mut request_value_reader = {
17028 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17029 common::remove_json_null_values(&mut value);
17030 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17031 serde_json::to_writer(&mut dst, &value).unwrap();
17032 dst
17033 };
17034 let request_size = request_value_reader
17035 .seek(std::io::SeekFrom::End(0))
17036 .unwrap();
17037 request_value_reader
17038 .seek(std::io::SeekFrom::Start(0))
17039 .unwrap();
17040
17041 loop {
17042 let token = match self
17043 .hub
17044 .auth
17045 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17046 .await
17047 {
17048 Ok(token) => token,
17049 Err(e) => match dlg.token(e) {
17050 Ok(token) => token,
17051 Err(e) => {
17052 dlg.finished(false);
17053 return Err(common::Error::MissingToken(e));
17054 }
17055 },
17056 };
17057 request_value_reader
17058 .seek(std::io::SeekFrom::Start(0))
17059 .unwrap();
17060 let mut req_result = {
17061 let client = &self.hub.client;
17062 dlg.pre_request();
17063 let mut req_builder = hyper::Request::builder()
17064 .method(hyper::Method::POST)
17065 .uri(url.as_str())
17066 .header(USER_AGENT, self.hub._user_agent.clone());
17067
17068 if let Some(token) = token.as_ref() {
17069 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17070 }
17071
17072 let request = req_builder
17073 .header(CONTENT_TYPE, json_mime_type.to_string())
17074 .header(CONTENT_LENGTH, request_size as u64)
17075 .body(common::to_body(
17076 request_value_reader.get_ref().clone().into(),
17077 ));
17078
17079 client.request(request.unwrap()).await
17080 };
17081
17082 match req_result {
17083 Err(err) => {
17084 if let common::Retry::After(d) = dlg.http_error(&err) {
17085 sleep(d).await;
17086 continue;
17087 }
17088 dlg.finished(false);
17089 return Err(common::Error::HttpError(err));
17090 }
17091 Ok(res) => {
17092 let (mut parts, body) = res.into_parts();
17093 let mut body = common::Body::new(body);
17094 if !parts.status.is_success() {
17095 let bytes = common::to_bytes(body).await.unwrap_or_default();
17096 let error = serde_json::from_str(&common::to_string(&bytes));
17097 let response = common::to_response(parts, bytes.into());
17098
17099 if let common::Retry::After(d) =
17100 dlg.http_failure(&response, error.as_ref().ok())
17101 {
17102 sleep(d).await;
17103 continue;
17104 }
17105
17106 dlg.finished(false);
17107
17108 return Err(match error {
17109 Ok(value) => common::Error::BadRequest(value),
17110 _ => common::Error::Failure(response),
17111 });
17112 }
17113 let response = {
17114 let bytes = common::to_bytes(body).await.unwrap_or_default();
17115 let encoded = common::to_string(&bytes);
17116 match serde_json::from_str(&encoded) {
17117 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17118 Err(error) => {
17119 dlg.response_json_decode_error(&encoded, &error);
17120 return Err(common::Error::JsonDecodeError(
17121 encoded.to_string(),
17122 error,
17123 ));
17124 }
17125 }
17126 };
17127
17128 dlg.finished(true);
17129 return Ok(response);
17130 }
17131 }
17132 }
17133 }
17134
17135 ///
17136 /// Sets the *request* property to the given value.
17137 ///
17138 /// Even though the property as already been set when instantiating this call,
17139 /// we provide this method for API completeness.
17140 pub fn request(
17141 mut self,
17142 new_value: SetLabelsRequest,
17143 ) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
17144 self._request = new_value;
17145 self
17146 }
17147 /// The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
17148 ///
17149 /// Sets the *name* path property to the given value.
17150 ///
17151 /// Even though the property as already been set when instantiating this call,
17152 /// we provide this method for API completeness.
17153 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
17154 self._name = new_value.to_string();
17155 self
17156 }
17157 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17158 /// while executing the actual API request.
17159 ///
17160 /// ````text
17161 /// It should be used to handle progress information, and to implement a certain level of resilience.
17162 /// ````
17163 ///
17164 /// Sets the *delegate* property to the given value.
17165 pub fn delegate(
17166 mut self,
17167 new_value: &'a mut dyn common::Delegate,
17168 ) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
17169 self._delegate = Some(new_value);
17170 self
17171 }
17172
17173 /// Set any additional parameter of the query string used in the request.
17174 /// It should be used to set parameters which are not yet available through their own
17175 /// setters.
17176 ///
17177 /// Please note that this method must not be used to set any of the known parameters
17178 /// which have their own setter method. If done anyway, the request will fail.
17179 ///
17180 /// # Additional Parameters
17181 ///
17182 /// * *$.xgafv* (query-string) - V1 error format.
17183 /// * *access_token* (query-string) - OAuth access token.
17184 /// * *alt* (query-string) - Data format for response.
17185 /// * *callback* (query-string) - JSONP
17186 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17187 /// * *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.
17188 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17189 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17190 /// * *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.
17191 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17192 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17193 pub fn param<T>(
17194 mut self,
17195 name: T,
17196 value: T,
17197 ) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
17198 where
17199 T: AsRef<str>,
17200 {
17201 self._additional_params
17202 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17203 self
17204 }
17205
17206 /// Identifies the authorization scope for the method you are building.
17207 ///
17208 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17209 /// [`Scope::CloudPlatform`].
17210 ///
17211 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17212 /// tokens for more than one scope.
17213 ///
17214 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17215 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17216 /// sufficient, a read-write scope will do as well.
17217 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
17218 where
17219 St: AsRef<str>,
17220 {
17221 self._scopes.insert(String::from(scope.as_ref()));
17222 self
17223 }
17224 /// Identifies the authorization scope(s) for the method you are building.
17225 ///
17226 /// See [`Self::add_scope()`] for details.
17227 pub fn add_scopes<I, St>(
17228 mut self,
17229 scopes: I,
17230 ) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
17231 where
17232 I: IntoIterator<Item = St>,
17233 St: AsRef<str>,
17234 {
17235 self._scopes
17236 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17237 self
17238 }
17239
17240 /// Removes all scopes, and no default scope will be used either.
17241 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17242 /// for details).
17243 pub fn clear_scopes(mut self) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
17244 self._scopes.clear();
17245 self
17246 }
17247}
17248
17249/// Starts master IP rotation.
17250///
17251/// A builder for the *locations.clusters.startIpRotation* method supported by a *project* resource.
17252/// It is not used directly, but through a [`ProjectMethods`] instance.
17253///
17254/// # Example
17255///
17256/// Instantiate a resource method builder
17257///
17258/// ```test_harness,no_run
17259/// # extern crate hyper;
17260/// # extern crate hyper_rustls;
17261/// # extern crate google_container1 as container1;
17262/// use container1::api::StartIPRotationRequest;
17263/// # async fn dox() {
17264/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17265///
17266/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17267/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17268/// # .with_native_roots()
17269/// # .unwrap()
17270/// # .https_only()
17271/// # .enable_http2()
17272/// # .build();
17273///
17274/// # let executor = hyper_util::rt::TokioExecutor::new();
17275/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17276/// # secret,
17277/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17278/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17279/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17280/// # ),
17281/// # ).build().await.unwrap();
17282///
17283/// # let client = hyper_util::client::legacy::Client::builder(
17284/// # hyper_util::rt::TokioExecutor::new()
17285/// # )
17286/// # .build(
17287/// # hyper_rustls::HttpsConnectorBuilder::new()
17288/// # .with_native_roots()
17289/// # .unwrap()
17290/// # .https_or_http()
17291/// # .enable_http2()
17292/// # .build()
17293/// # );
17294/// # let mut hub = Container::new(client, auth);
17295/// // As the method needs a request, you would usually fill it with the desired information
17296/// // into the respective structure. Some of the parts shown here might not be applicable !
17297/// // Values shown here are possibly random and not representative !
17298/// let mut req = StartIPRotationRequest::default();
17299///
17300/// // You can configure optional parameters by calling the respective setters at will, and
17301/// // execute the final call using `doit()`.
17302/// // Values shown here are possibly random and not representative !
17303/// let result = hub.projects().locations_clusters_start_ip_rotation(req, "name")
17304/// .doit().await;
17305/// # }
17306/// ```
17307pub struct ProjectLocationClusterStartIpRotationCall<'a, C>
17308where
17309 C: 'a,
17310{
17311 hub: &'a Container<C>,
17312 _request: StartIPRotationRequest,
17313 _name: String,
17314 _delegate: Option<&'a mut dyn common::Delegate>,
17315 _additional_params: HashMap<String, String>,
17316 _scopes: BTreeSet<String>,
17317}
17318
17319impl<'a, C> common::CallBuilder for ProjectLocationClusterStartIpRotationCall<'a, C> {}
17320
17321impl<'a, C> ProjectLocationClusterStartIpRotationCall<'a, C>
17322where
17323 C: common::Connector,
17324{
17325 /// Perform the operation you have build so far.
17326 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17327 use std::borrow::Cow;
17328 use std::io::{Read, Seek};
17329
17330 use common::{url::Params, ToParts};
17331 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17332
17333 let mut dd = common::DefaultDelegate;
17334 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17335 dlg.begin(common::MethodInfo {
17336 id: "container.projects.locations.clusters.startIpRotation",
17337 http_method: hyper::Method::POST,
17338 });
17339
17340 for &field in ["alt", "name"].iter() {
17341 if self._additional_params.contains_key(field) {
17342 dlg.finished(false);
17343 return Err(common::Error::FieldClash(field));
17344 }
17345 }
17346
17347 let mut params = Params::with_capacity(4 + self._additional_params.len());
17348 params.push("name", self._name);
17349
17350 params.extend(self._additional_params.iter());
17351
17352 params.push("alt", "json");
17353 let mut url = self.hub._base_url.clone() + "v1/{+name}:startIpRotation";
17354 if self._scopes.is_empty() {
17355 self._scopes
17356 .insert(Scope::CloudPlatform.as_ref().to_string());
17357 }
17358
17359 #[allow(clippy::single_element_loop)]
17360 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17361 url = params.uri_replacement(url, param_name, find_this, true);
17362 }
17363 {
17364 let to_remove = ["name"];
17365 params.remove_params(&to_remove);
17366 }
17367
17368 let url = params.parse_with_url(&url);
17369
17370 let mut json_mime_type = mime::APPLICATION_JSON;
17371 let mut request_value_reader = {
17372 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17373 common::remove_json_null_values(&mut value);
17374 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17375 serde_json::to_writer(&mut dst, &value).unwrap();
17376 dst
17377 };
17378 let request_size = request_value_reader
17379 .seek(std::io::SeekFrom::End(0))
17380 .unwrap();
17381 request_value_reader
17382 .seek(std::io::SeekFrom::Start(0))
17383 .unwrap();
17384
17385 loop {
17386 let token = match self
17387 .hub
17388 .auth
17389 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17390 .await
17391 {
17392 Ok(token) => token,
17393 Err(e) => match dlg.token(e) {
17394 Ok(token) => token,
17395 Err(e) => {
17396 dlg.finished(false);
17397 return Err(common::Error::MissingToken(e));
17398 }
17399 },
17400 };
17401 request_value_reader
17402 .seek(std::io::SeekFrom::Start(0))
17403 .unwrap();
17404 let mut req_result = {
17405 let client = &self.hub.client;
17406 dlg.pre_request();
17407 let mut req_builder = hyper::Request::builder()
17408 .method(hyper::Method::POST)
17409 .uri(url.as_str())
17410 .header(USER_AGENT, self.hub._user_agent.clone());
17411
17412 if let Some(token) = token.as_ref() {
17413 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17414 }
17415
17416 let request = req_builder
17417 .header(CONTENT_TYPE, json_mime_type.to_string())
17418 .header(CONTENT_LENGTH, request_size as u64)
17419 .body(common::to_body(
17420 request_value_reader.get_ref().clone().into(),
17421 ));
17422
17423 client.request(request.unwrap()).await
17424 };
17425
17426 match req_result {
17427 Err(err) => {
17428 if let common::Retry::After(d) = dlg.http_error(&err) {
17429 sleep(d).await;
17430 continue;
17431 }
17432 dlg.finished(false);
17433 return Err(common::Error::HttpError(err));
17434 }
17435 Ok(res) => {
17436 let (mut parts, body) = res.into_parts();
17437 let mut body = common::Body::new(body);
17438 if !parts.status.is_success() {
17439 let bytes = common::to_bytes(body).await.unwrap_or_default();
17440 let error = serde_json::from_str(&common::to_string(&bytes));
17441 let response = common::to_response(parts, bytes.into());
17442
17443 if let common::Retry::After(d) =
17444 dlg.http_failure(&response, error.as_ref().ok())
17445 {
17446 sleep(d).await;
17447 continue;
17448 }
17449
17450 dlg.finished(false);
17451
17452 return Err(match error {
17453 Ok(value) => common::Error::BadRequest(value),
17454 _ => common::Error::Failure(response),
17455 });
17456 }
17457 let response = {
17458 let bytes = common::to_bytes(body).await.unwrap_or_default();
17459 let encoded = common::to_string(&bytes);
17460 match serde_json::from_str(&encoded) {
17461 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17462 Err(error) => {
17463 dlg.response_json_decode_error(&encoded, &error);
17464 return Err(common::Error::JsonDecodeError(
17465 encoded.to_string(),
17466 error,
17467 ));
17468 }
17469 }
17470 };
17471
17472 dlg.finished(true);
17473 return Ok(response);
17474 }
17475 }
17476 }
17477 }
17478
17479 ///
17480 /// Sets the *request* property to the given value.
17481 ///
17482 /// Even though the property as already been set when instantiating this call,
17483 /// we provide this method for API completeness.
17484 pub fn request(
17485 mut self,
17486 new_value: StartIPRotationRequest,
17487 ) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
17488 self._request = new_value;
17489 self
17490 }
17491 /// The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
17492 ///
17493 /// Sets the *name* path property to the given value.
17494 ///
17495 /// Even though the property as already been set when instantiating this call,
17496 /// we provide this method for API completeness.
17497 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
17498 self._name = new_value.to_string();
17499 self
17500 }
17501 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17502 /// while executing the actual API request.
17503 ///
17504 /// ````text
17505 /// It should be used to handle progress information, and to implement a certain level of resilience.
17506 /// ````
17507 ///
17508 /// Sets the *delegate* property to the given value.
17509 pub fn delegate(
17510 mut self,
17511 new_value: &'a mut dyn common::Delegate,
17512 ) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
17513 self._delegate = Some(new_value);
17514 self
17515 }
17516
17517 /// Set any additional parameter of the query string used in the request.
17518 /// It should be used to set parameters which are not yet available through their own
17519 /// setters.
17520 ///
17521 /// Please note that this method must not be used to set any of the known parameters
17522 /// which have their own setter method. If done anyway, the request will fail.
17523 ///
17524 /// # Additional Parameters
17525 ///
17526 /// * *$.xgafv* (query-string) - V1 error format.
17527 /// * *access_token* (query-string) - OAuth access token.
17528 /// * *alt* (query-string) - Data format for response.
17529 /// * *callback* (query-string) - JSONP
17530 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17531 /// * *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.
17532 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17533 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17534 /// * *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.
17535 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17536 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17537 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterStartIpRotationCall<'a, C>
17538 where
17539 T: AsRef<str>,
17540 {
17541 self._additional_params
17542 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17543 self
17544 }
17545
17546 /// Identifies the authorization scope for the method you are building.
17547 ///
17548 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17549 /// [`Scope::CloudPlatform`].
17550 ///
17551 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17552 /// tokens for more than one scope.
17553 ///
17554 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17555 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17556 /// sufficient, a read-write scope will do as well.
17557 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterStartIpRotationCall<'a, C>
17558 where
17559 St: AsRef<str>,
17560 {
17561 self._scopes.insert(String::from(scope.as_ref()));
17562 self
17563 }
17564 /// Identifies the authorization scope(s) for the method you are building.
17565 ///
17566 /// See [`Self::add_scope()`] for details.
17567 pub fn add_scopes<I, St>(
17568 mut self,
17569 scopes: I,
17570 ) -> ProjectLocationClusterStartIpRotationCall<'a, C>
17571 where
17572 I: IntoIterator<Item = St>,
17573 St: AsRef<str>,
17574 {
17575 self._scopes
17576 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17577 self
17578 }
17579
17580 /// Removes all scopes, and no default scope will be used either.
17581 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17582 /// for details).
17583 pub fn clear_scopes(mut self) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
17584 self._scopes.clear();
17585 self
17586 }
17587}
17588
17589/// Updates the settings of a specific cluster.
17590///
17591/// A builder for the *locations.clusters.update* method supported by a *project* resource.
17592/// It is not used directly, but through a [`ProjectMethods`] instance.
17593///
17594/// # Example
17595///
17596/// Instantiate a resource method builder
17597///
17598/// ```test_harness,no_run
17599/// # extern crate hyper;
17600/// # extern crate hyper_rustls;
17601/// # extern crate google_container1 as container1;
17602/// use container1::api::UpdateClusterRequest;
17603/// # async fn dox() {
17604/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17605///
17606/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17607/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17608/// # .with_native_roots()
17609/// # .unwrap()
17610/// # .https_only()
17611/// # .enable_http2()
17612/// # .build();
17613///
17614/// # let executor = hyper_util::rt::TokioExecutor::new();
17615/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17616/// # secret,
17617/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17618/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17619/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17620/// # ),
17621/// # ).build().await.unwrap();
17622///
17623/// # let client = hyper_util::client::legacy::Client::builder(
17624/// # hyper_util::rt::TokioExecutor::new()
17625/// # )
17626/// # .build(
17627/// # hyper_rustls::HttpsConnectorBuilder::new()
17628/// # .with_native_roots()
17629/// # .unwrap()
17630/// # .https_or_http()
17631/// # .enable_http2()
17632/// # .build()
17633/// # );
17634/// # let mut hub = Container::new(client, auth);
17635/// // As the method needs a request, you would usually fill it with the desired information
17636/// // into the respective structure. Some of the parts shown here might not be applicable !
17637/// // Values shown here are possibly random and not representative !
17638/// let mut req = UpdateClusterRequest::default();
17639///
17640/// // You can configure optional parameters by calling the respective setters at will, and
17641/// // execute the final call using `doit()`.
17642/// // Values shown here are possibly random and not representative !
17643/// let result = hub.projects().locations_clusters_update(req, "name")
17644/// .doit().await;
17645/// # }
17646/// ```
17647pub struct ProjectLocationClusterUpdateCall<'a, C>
17648where
17649 C: 'a,
17650{
17651 hub: &'a Container<C>,
17652 _request: UpdateClusterRequest,
17653 _name: String,
17654 _delegate: Option<&'a mut dyn common::Delegate>,
17655 _additional_params: HashMap<String, String>,
17656 _scopes: BTreeSet<String>,
17657}
17658
17659impl<'a, C> common::CallBuilder for ProjectLocationClusterUpdateCall<'a, C> {}
17660
17661impl<'a, C> ProjectLocationClusterUpdateCall<'a, C>
17662where
17663 C: common::Connector,
17664{
17665 /// Perform the operation you have build so far.
17666 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
17667 use std::borrow::Cow;
17668 use std::io::{Read, Seek};
17669
17670 use common::{url::Params, ToParts};
17671 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
17672
17673 let mut dd = common::DefaultDelegate;
17674 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
17675 dlg.begin(common::MethodInfo {
17676 id: "container.projects.locations.clusters.update",
17677 http_method: hyper::Method::PUT,
17678 });
17679
17680 for &field in ["alt", "name"].iter() {
17681 if self._additional_params.contains_key(field) {
17682 dlg.finished(false);
17683 return Err(common::Error::FieldClash(field));
17684 }
17685 }
17686
17687 let mut params = Params::with_capacity(4 + self._additional_params.len());
17688 params.push("name", self._name);
17689
17690 params.extend(self._additional_params.iter());
17691
17692 params.push("alt", "json");
17693 let mut url = self.hub._base_url.clone() + "v1/{+name}";
17694 if self._scopes.is_empty() {
17695 self._scopes
17696 .insert(Scope::CloudPlatform.as_ref().to_string());
17697 }
17698
17699 #[allow(clippy::single_element_loop)]
17700 for &(find_this, param_name) in [("{+name}", "name")].iter() {
17701 url = params.uri_replacement(url, param_name, find_this, true);
17702 }
17703 {
17704 let to_remove = ["name"];
17705 params.remove_params(&to_remove);
17706 }
17707
17708 let url = params.parse_with_url(&url);
17709
17710 let mut json_mime_type = mime::APPLICATION_JSON;
17711 let mut request_value_reader = {
17712 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
17713 common::remove_json_null_values(&mut value);
17714 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
17715 serde_json::to_writer(&mut dst, &value).unwrap();
17716 dst
17717 };
17718 let request_size = request_value_reader
17719 .seek(std::io::SeekFrom::End(0))
17720 .unwrap();
17721 request_value_reader
17722 .seek(std::io::SeekFrom::Start(0))
17723 .unwrap();
17724
17725 loop {
17726 let token = match self
17727 .hub
17728 .auth
17729 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
17730 .await
17731 {
17732 Ok(token) => token,
17733 Err(e) => match dlg.token(e) {
17734 Ok(token) => token,
17735 Err(e) => {
17736 dlg.finished(false);
17737 return Err(common::Error::MissingToken(e));
17738 }
17739 },
17740 };
17741 request_value_reader
17742 .seek(std::io::SeekFrom::Start(0))
17743 .unwrap();
17744 let mut req_result = {
17745 let client = &self.hub.client;
17746 dlg.pre_request();
17747 let mut req_builder = hyper::Request::builder()
17748 .method(hyper::Method::PUT)
17749 .uri(url.as_str())
17750 .header(USER_AGENT, self.hub._user_agent.clone());
17751
17752 if let Some(token) = token.as_ref() {
17753 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
17754 }
17755
17756 let request = req_builder
17757 .header(CONTENT_TYPE, json_mime_type.to_string())
17758 .header(CONTENT_LENGTH, request_size as u64)
17759 .body(common::to_body(
17760 request_value_reader.get_ref().clone().into(),
17761 ));
17762
17763 client.request(request.unwrap()).await
17764 };
17765
17766 match req_result {
17767 Err(err) => {
17768 if let common::Retry::After(d) = dlg.http_error(&err) {
17769 sleep(d).await;
17770 continue;
17771 }
17772 dlg.finished(false);
17773 return Err(common::Error::HttpError(err));
17774 }
17775 Ok(res) => {
17776 let (mut parts, body) = res.into_parts();
17777 let mut body = common::Body::new(body);
17778 if !parts.status.is_success() {
17779 let bytes = common::to_bytes(body).await.unwrap_or_default();
17780 let error = serde_json::from_str(&common::to_string(&bytes));
17781 let response = common::to_response(parts, bytes.into());
17782
17783 if let common::Retry::After(d) =
17784 dlg.http_failure(&response, error.as_ref().ok())
17785 {
17786 sleep(d).await;
17787 continue;
17788 }
17789
17790 dlg.finished(false);
17791
17792 return Err(match error {
17793 Ok(value) => common::Error::BadRequest(value),
17794 _ => common::Error::Failure(response),
17795 });
17796 }
17797 let response = {
17798 let bytes = common::to_bytes(body).await.unwrap_or_default();
17799 let encoded = common::to_string(&bytes);
17800 match serde_json::from_str(&encoded) {
17801 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
17802 Err(error) => {
17803 dlg.response_json_decode_error(&encoded, &error);
17804 return Err(common::Error::JsonDecodeError(
17805 encoded.to_string(),
17806 error,
17807 ));
17808 }
17809 }
17810 };
17811
17812 dlg.finished(true);
17813 return Ok(response);
17814 }
17815 }
17816 }
17817 }
17818
17819 ///
17820 /// Sets the *request* property to the given value.
17821 ///
17822 /// Even though the property as already been set when instantiating this call,
17823 /// we provide this method for API completeness.
17824 pub fn request(
17825 mut self,
17826 new_value: UpdateClusterRequest,
17827 ) -> ProjectLocationClusterUpdateCall<'a, C> {
17828 self._request = new_value;
17829 self
17830 }
17831 /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
17832 ///
17833 /// Sets the *name* path property to the given value.
17834 ///
17835 /// Even though the property as already been set when instantiating this call,
17836 /// we provide this method for API completeness.
17837 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterUpdateCall<'a, C> {
17838 self._name = new_value.to_string();
17839 self
17840 }
17841 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
17842 /// while executing the actual API request.
17843 ///
17844 /// ````text
17845 /// It should be used to handle progress information, and to implement a certain level of resilience.
17846 /// ````
17847 ///
17848 /// Sets the *delegate* property to the given value.
17849 pub fn delegate(
17850 mut self,
17851 new_value: &'a mut dyn common::Delegate,
17852 ) -> ProjectLocationClusterUpdateCall<'a, C> {
17853 self._delegate = Some(new_value);
17854 self
17855 }
17856
17857 /// Set any additional parameter of the query string used in the request.
17858 /// It should be used to set parameters which are not yet available through their own
17859 /// setters.
17860 ///
17861 /// Please note that this method must not be used to set any of the known parameters
17862 /// which have their own setter method. If done anyway, the request will fail.
17863 ///
17864 /// # Additional Parameters
17865 ///
17866 /// * *$.xgafv* (query-string) - V1 error format.
17867 /// * *access_token* (query-string) - OAuth access token.
17868 /// * *alt* (query-string) - Data format for response.
17869 /// * *callback* (query-string) - JSONP
17870 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
17871 /// * *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.
17872 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
17873 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
17874 /// * *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.
17875 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
17876 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
17877 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterUpdateCall<'a, C>
17878 where
17879 T: AsRef<str>,
17880 {
17881 self._additional_params
17882 .insert(name.as_ref().to_string(), value.as_ref().to_string());
17883 self
17884 }
17885
17886 /// Identifies the authorization scope for the method you are building.
17887 ///
17888 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
17889 /// [`Scope::CloudPlatform`].
17890 ///
17891 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
17892 /// tokens for more than one scope.
17893 ///
17894 /// Usually there is more than one suitable scope to authorize an operation, some of which may
17895 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
17896 /// sufficient, a read-write scope will do as well.
17897 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterUpdateCall<'a, C>
17898 where
17899 St: AsRef<str>,
17900 {
17901 self._scopes.insert(String::from(scope.as_ref()));
17902 self
17903 }
17904 /// Identifies the authorization scope(s) for the method you are building.
17905 ///
17906 /// See [`Self::add_scope()`] for details.
17907 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterUpdateCall<'a, C>
17908 where
17909 I: IntoIterator<Item = St>,
17910 St: AsRef<str>,
17911 {
17912 self._scopes
17913 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
17914 self
17915 }
17916
17917 /// Removes all scopes, and no default scope will be used either.
17918 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
17919 /// for details).
17920 pub fn clear_scopes(mut self) -> ProjectLocationClusterUpdateCall<'a, C> {
17921 self._scopes.clear();
17922 self
17923 }
17924}
17925
17926/// Updates the master for a specific cluster.
17927///
17928/// A builder for the *locations.clusters.updateMaster* method supported by a *project* resource.
17929/// It is not used directly, but through a [`ProjectMethods`] instance.
17930///
17931/// # Example
17932///
17933/// Instantiate a resource method builder
17934///
17935/// ```test_harness,no_run
17936/// # extern crate hyper;
17937/// # extern crate hyper_rustls;
17938/// # extern crate google_container1 as container1;
17939/// use container1::api::UpdateMasterRequest;
17940/// # async fn dox() {
17941/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
17942///
17943/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
17944/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
17945/// # .with_native_roots()
17946/// # .unwrap()
17947/// # .https_only()
17948/// # .enable_http2()
17949/// # .build();
17950///
17951/// # let executor = hyper_util::rt::TokioExecutor::new();
17952/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
17953/// # secret,
17954/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
17955/// # yup_oauth2::client::CustomHyperClientBuilder::from(
17956/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
17957/// # ),
17958/// # ).build().await.unwrap();
17959///
17960/// # let client = hyper_util::client::legacy::Client::builder(
17961/// # hyper_util::rt::TokioExecutor::new()
17962/// # )
17963/// # .build(
17964/// # hyper_rustls::HttpsConnectorBuilder::new()
17965/// # .with_native_roots()
17966/// # .unwrap()
17967/// # .https_or_http()
17968/// # .enable_http2()
17969/// # .build()
17970/// # );
17971/// # let mut hub = Container::new(client, auth);
17972/// // As the method needs a request, you would usually fill it with the desired information
17973/// // into the respective structure. Some of the parts shown here might not be applicable !
17974/// // Values shown here are possibly random and not representative !
17975/// let mut req = UpdateMasterRequest::default();
17976///
17977/// // You can configure optional parameters by calling the respective setters at will, and
17978/// // execute the final call using `doit()`.
17979/// // Values shown here are possibly random and not representative !
17980/// let result = hub.projects().locations_clusters_update_master(req, "name")
17981/// .doit().await;
17982/// # }
17983/// ```
17984pub struct ProjectLocationClusterUpdateMasterCall<'a, C>
17985where
17986 C: 'a,
17987{
17988 hub: &'a Container<C>,
17989 _request: UpdateMasterRequest,
17990 _name: String,
17991 _delegate: Option<&'a mut dyn common::Delegate>,
17992 _additional_params: HashMap<String, String>,
17993 _scopes: BTreeSet<String>,
17994}
17995
17996impl<'a, C> common::CallBuilder for ProjectLocationClusterUpdateMasterCall<'a, C> {}
17997
17998impl<'a, C> ProjectLocationClusterUpdateMasterCall<'a, C>
17999where
18000 C: common::Connector,
18001{
18002 /// Perform the operation you have build so far.
18003 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18004 use std::borrow::Cow;
18005 use std::io::{Read, Seek};
18006
18007 use common::{url::Params, ToParts};
18008 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18009
18010 let mut dd = common::DefaultDelegate;
18011 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18012 dlg.begin(common::MethodInfo {
18013 id: "container.projects.locations.clusters.updateMaster",
18014 http_method: hyper::Method::POST,
18015 });
18016
18017 for &field in ["alt", "name"].iter() {
18018 if self._additional_params.contains_key(field) {
18019 dlg.finished(false);
18020 return Err(common::Error::FieldClash(field));
18021 }
18022 }
18023
18024 let mut params = Params::with_capacity(4 + self._additional_params.len());
18025 params.push("name", self._name);
18026
18027 params.extend(self._additional_params.iter());
18028
18029 params.push("alt", "json");
18030 let mut url = self.hub._base_url.clone() + "v1/{+name}:updateMaster";
18031 if self._scopes.is_empty() {
18032 self._scopes
18033 .insert(Scope::CloudPlatform.as_ref().to_string());
18034 }
18035
18036 #[allow(clippy::single_element_loop)]
18037 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18038 url = params.uri_replacement(url, param_name, find_this, true);
18039 }
18040 {
18041 let to_remove = ["name"];
18042 params.remove_params(&to_remove);
18043 }
18044
18045 let url = params.parse_with_url(&url);
18046
18047 let mut json_mime_type = mime::APPLICATION_JSON;
18048 let mut request_value_reader = {
18049 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18050 common::remove_json_null_values(&mut value);
18051 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18052 serde_json::to_writer(&mut dst, &value).unwrap();
18053 dst
18054 };
18055 let request_size = request_value_reader
18056 .seek(std::io::SeekFrom::End(0))
18057 .unwrap();
18058 request_value_reader
18059 .seek(std::io::SeekFrom::Start(0))
18060 .unwrap();
18061
18062 loop {
18063 let token = match self
18064 .hub
18065 .auth
18066 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18067 .await
18068 {
18069 Ok(token) => token,
18070 Err(e) => match dlg.token(e) {
18071 Ok(token) => token,
18072 Err(e) => {
18073 dlg.finished(false);
18074 return Err(common::Error::MissingToken(e));
18075 }
18076 },
18077 };
18078 request_value_reader
18079 .seek(std::io::SeekFrom::Start(0))
18080 .unwrap();
18081 let mut req_result = {
18082 let client = &self.hub.client;
18083 dlg.pre_request();
18084 let mut req_builder = hyper::Request::builder()
18085 .method(hyper::Method::POST)
18086 .uri(url.as_str())
18087 .header(USER_AGENT, self.hub._user_agent.clone());
18088
18089 if let Some(token) = token.as_ref() {
18090 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18091 }
18092
18093 let request = req_builder
18094 .header(CONTENT_TYPE, json_mime_type.to_string())
18095 .header(CONTENT_LENGTH, request_size as u64)
18096 .body(common::to_body(
18097 request_value_reader.get_ref().clone().into(),
18098 ));
18099
18100 client.request(request.unwrap()).await
18101 };
18102
18103 match req_result {
18104 Err(err) => {
18105 if let common::Retry::After(d) = dlg.http_error(&err) {
18106 sleep(d).await;
18107 continue;
18108 }
18109 dlg.finished(false);
18110 return Err(common::Error::HttpError(err));
18111 }
18112 Ok(res) => {
18113 let (mut parts, body) = res.into_parts();
18114 let mut body = common::Body::new(body);
18115 if !parts.status.is_success() {
18116 let bytes = common::to_bytes(body).await.unwrap_or_default();
18117 let error = serde_json::from_str(&common::to_string(&bytes));
18118 let response = common::to_response(parts, bytes.into());
18119
18120 if let common::Retry::After(d) =
18121 dlg.http_failure(&response, error.as_ref().ok())
18122 {
18123 sleep(d).await;
18124 continue;
18125 }
18126
18127 dlg.finished(false);
18128
18129 return Err(match error {
18130 Ok(value) => common::Error::BadRequest(value),
18131 _ => common::Error::Failure(response),
18132 });
18133 }
18134 let response = {
18135 let bytes = common::to_bytes(body).await.unwrap_or_default();
18136 let encoded = common::to_string(&bytes);
18137 match serde_json::from_str(&encoded) {
18138 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18139 Err(error) => {
18140 dlg.response_json_decode_error(&encoded, &error);
18141 return Err(common::Error::JsonDecodeError(
18142 encoded.to_string(),
18143 error,
18144 ));
18145 }
18146 }
18147 };
18148
18149 dlg.finished(true);
18150 return Ok(response);
18151 }
18152 }
18153 }
18154 }
18155
18156 ///
18157 /// Sets the *request* property to the given value.
18158 ///
18159 /// Even though the property as already been set when instantiating this call,
18160 /// we provide this method for API completeness.
18161 pub fn request(
18162 mut self,
18163 new_value: UpdateMasterRequest,
18164 ) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
18165 self._request = new_value;
18166 self
18167 }
18168 /// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
18169 ///
18170 /// Sets the *name* path property to the given value.
18171 ///
18172 /// Even though the property as already been set when instantiating this call,
18173 /// we provide this method for API completeness.
18174 pub fn name(mut self, new_value: &str) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
18175 self._name = new_value.to_string();
18176 self
18177 }
18178 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18179 /// while executing the actual API request.
18180 ///
18181 /// ````text
18182 /// It should be used to handle progress information, and to implement a certain level of resilience.
18183 /// ````
18184 ///
18185 /// Sets the *delegate* property to the given value.
18186 pub fn delegate(
18187 mut self,
18188 new_value: &'a mut dyn common::Delegate,
18189 ) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
18190 self._delegate = Some(new_value);
18191 self
18192 }
18193
18194 /// Set any additional parameter of the query string used in the request.
18195 /// It should be used to set parameters which are not yet available through their own
18196 /// setters.
18197 ///
18198 /// Please note that this method must not be used to set any of the known parameters
18199 /// which have their own setter method. If done anyway, the request will fail.
18200 ///
18201 /// # Additional Parameters
18202 ///
18203 /// * *$.xgafv* (query-string) - V1 error format.
18204 /// * *access_token* (query-string) - OAuth access token.
18205 /// * *alt* (query-string) - Data format for response.
18206 /// * *callback* (query-string) - JSONP
18207 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18208 /// * *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.
18209 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18211 /// * *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.
18212 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18213 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18214 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterUpdateMasterCall<'a, C>
18215 where
18216 T: AsRef<str>,
18217 {
18218 self._additional_params
18219 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18220 self
18221 }
18222
18223 /// Identifies the authorization scope for the method you are building.
18224 ///
18225 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18226 /// [`Scope::CloudPlatform`].
18227 ///
18228 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18229 /// tokens for more than one scope.
18230 ///
18231 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18232 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18233 /// sufficient, a read-write scope will do as well.
18234 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterUpdateMasterCall<'a, C>
18235 where
18236 St: AsRef<str>,
18237 {
18238 self._scopes.insert(String::from(scope.as_ref()));
18239 self
18240 }
18241 /// Identifies the authorization scope(s) for the method you are building.
18242 ///
18243 /// See [`Self::add_scope()`] for details.
18244 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterUpdateMasterCall<'a, C>
18245 where
18246 I: IntoIterator<Item = St>,
18247 St: AsRef<str>,
18248 {
18249 self._scopes
18250 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18251 self
18252 }
18253
18254 /// Removes all scopes, and no default scope will be used either.
18255 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18256 /// for details).
18257 pub fn clear_scopes(mut self) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
18258 self._scopes.clear();
18259 self
18260 }
18261}
18262
18263/// Cancels the specified operation.
18264///
18265/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
18266/// It is not used directly, but through a [`ProjectMethods`] instance.
18267///
18268/// # Example
18269///
18270/// Instantiate a resource method builder
18271///
18272/// ```test_harness,no_run
18273/// # extern crate hyper;
18274/// # extern crate hyper_rustls;
18275/// # extern crate google_container1 as container1;
18276/// use container1::api::CancelOperationRequest;
18277/// # async fn dox() {
18278/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18279///
18280/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18281/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18282/// # .with_native_roots()
18283/// # .unwrap()
18284/// # .https_only()
18285/// # .enable_http2()
18286/// # .build();
18287///
18288/// # let executor = hyper_util::rt::TokioExecutor::new();
18289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18290/// # secret,
18291/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18292/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18293/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18294/// # ),
18295/// # ).build().await.unwrap();
18296///
18297/// # let client = hyper_util::client::legacy::Client::builder(
18298/// # hyper_util::rt::TokioExecutor::new()
18299/// # )
18300/// # .build(
18301/// # hyper_rustls::HttpsConnectorBuilder::new()
18302/// # .with_native_roots()
18303/// # .unwrap()
18304/// # .https_or_http()
18305/// # .enable_http2()
18306/// # .build()
18307/// # );
18308/// # let mut hub = Container::new(client, auth);
18309/// // As the method needs a request, you would usually fill it with the desired information
18310/// // into the respective structure. Some of the parts shown here might not be applicable !
18311/// // Values shown here are possibly random and not representative !
18312/// let mut req = CancelOperationRequest::default();
18313///
18314/// // You can configure optional parameters by calling the respective setters at will, and
18315/// // execute the final call using `doit()`.
18316/// // Values shown here are possibly random and not representative !
18317/// let result = hub.projects().locations_operations_cancel(req, "name")
18318/// .doit().await;
18319/// # }
18320/// ```
18321pub struct ProjectLocationOperationCancelCall<'a, C>
18322where
18323 C: 'a,
18324{
18325 hub: &'a Container<C>,
18326 _request: CancelOperationRequest,
18327 _name: String,
18328 _delegate: Option<&'a mut dyn common::Delegate>,
18329 _additional_params: HashMap<String, String>,
18330 _scopes: BTreeSet<String>,
18331}
18332
18333impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
18334
18335impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
18336where
18337 C: common::Connector,
18338{
18339 /// Perform the operation you have build so far.
18340 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
18341 use std::borrow::Cow;
18342 use std::io::{Read, Seek};
18343
18344 use common::{url::Params, ToParts};
18345 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18346
18347 let mut dd = common::DefaultDelegate;
18348 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18349 dlg.begin(common::MethodInfo {
18350 id: "container.projects.locations.operations.cancel",
18351 http_method: hyper::Method::POST,
18352 });
18353
18354 for &field in ["alt", "name"].iter() {
18355 if self._additional_params.contains_key(field) {
18356 dlg.finished(false);
18357 return Err(common::Error::FieldClash(field));
18358 }
18359 }
18360
18361 let mut params = Params::with_capacity(4 + self._additional_params.len());
18362 params.push("name", self._name);
18363
18364 params.extend(self._additional_params.iter());
18365
18366 params.push("alt", "json");
18367 let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
18368 if self._scopes.is_empty() {
18369 self._scopes
18370 .insert(Scope::CloudPlatform.as_ref().to_string());
18371 }
18372
18373 #[allow(clippy::single_element_loop)]
18374 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18375 url = params.uri_replacement(url, param_name, find_this, true);
18376 }
18377 {
18378 let to_remove = ["name"];
18379 params.remove_params(&to_remove);
18380 }
18381
18382 let url = params.parse_with_url(&url);
18383
18384 let mut json_mime_type = mime::APPLICATION_JSON;
18385 let mut request_value_reader = {
18386 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
18387 common::remove_json_null_values(&mut value);
18388 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
18389 serde_json::to_writer(&mut dst, &value).unwrap();
18390 dst
18391 };
18392 let request_size = request_value_reader
18393 .seek(std::io::SeekFrom::End(0))
18394 .unwrap();
18395 request_value_reader
18396 .seek(std::io::SeekFrom::Start(0))
18397 .unwrap();
18398
18399 loop {
18400 let token = match self
18401 .hub
18402 .auth
18403 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18404 .await
18405 {
18406 Ok(token) => token,
18407 Err(e) => match dlg.token(e) {
18408 Ok(token) => token,
18409 Err(e) => {
18410 dlg.finished(false);
18411 return Err(common::Error::MissingToken(e));
18412 }
18413 },
18414 };
18415 request_value_reader
18416 .seek(std::io::SeekFrom::Start(0))
18417 .unwrap();
18418 let mut req_result = {
18419 let client = &self.hub.client;
18420 dlg.pre_request();
18421 let mut req_builder = hyper::Request::builder()
18422 .method(hyper::Method::POST)
18423 .uri(url.as_str())
18424 .header(USER_AGENT, self.hub._user_agent.clone());
18425
18426 if let Some(token) = token.as_ref() {
18427 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18428 }
18429
18430 let request = req_builder
18431 .header(CONTENT_TYPE, json_mime_type.to_string())
18432 .header(CONTENT_LENGTH, request_size as u64)
18433 .body(common::to_body(
18434 request_value_reader.get_ref().clone().into(),
18435 ));
18436
18437 client.request(request.unwrap()).await
18438 };
18439
18440 match req_result {
18441 Err(err) => {
18442 if let common::Retry::After(d) = dlg.http_error(&err) {
18443 sleep(d).await;
18444 continue;
18445 }
18446 dlg.finished(false);
18447 return Err(common::Error::HttpError(err));
18448 }
18449 Ok(res) => {
18450 let (mut parts, body) = res.into_parts();
18451 let mut body = common::Body::new(body);
18452 if !parts.status.is_success() {
18453 let bytes = common::to_bytes(body).await.unwrap_or_default();
18454 let error = serde_json::from_str(&common::to_string(&bytes));
18455 let response = common::to_response(parts, bytes.into());
18456
18457 if let common::Retry::After(d) =
18458 dlg.http_failure(&response, error.as_ref().ok())
18459 {
18460 sleep(d).await;
18461 continue;
18462 }
18463
18464 dlg.finished(false);
18465
18466 return Err(match error {
18467 Ok(value) => common::Error::BadRequest(value),
18468 _ => common::Error::Failure(response),
18469 });
18470 }
18471 let response = {
18472 let bytes = common::to_bytes(body).await.unwrap_or_default();
18473 let encoded = common::to_string(&bytes);
18474 match serde_json::from_str(&encoded) {
18475 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18476 Err(error) => {
18477 dlg.response_json_decode_error(&encoded, &error);
18478 return Err(common::Error::JsonDecodeError(
18479 encoded.to_string(),
18480 error,
18481 ));
18482 }
18483 }
18484 };
18485
18486 dlg.finished(true);
18487 return Ok(response);
18488 }
18489 }
18490 }
18491 }
18492
18493 ///
18494 /// Sets the *request* property to the given value.
18495 ///
18496 /// Even though the property as already been set when instantiating this call,
18497 /// we provide this method for API completeness.
18498 pub fn request(
18499 mut self,
18500 new_value: CancelOperationRequest,
18501 ) -> ProjectLocationOperationCancelCall<'a, C> {
18502 self._request = new_value;
18503 self
18504 }
18505 /// The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
18506 ///
18507 /// Sets the *name* path property to the given value.
18508 ///
18509 /// Even though the property as already been set when instantiating this call,
18510 /// we provide this method for API completeness.
18511 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
18512 self._name = new_value.to_string();
18513 self
18514 }
18515 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18516 /// while executing the actual API request.
18517 ///
18518 /// ````text
18519 /// It should be used to handle progress information, and to implement a certain level of resilience.
18520 /// ````
18521 ///
18522 /// Sets the *delegate* property to the given value.
18523 pub fn delegate(
18524 mut self,
18525 new_value: &'a mut dyn common::Delegate,
18526 ) -> ProjectLocationOperationCancelCall<'a, C> {
18527 self._delegate = Some(new_value);
18528 self
18529 }
18530
18531 /// Set any additional parameter of the query string used in the request.
18532 /// It should be used to set parameters which are not yet available through their own
18533 /// setters.
18534 ///
18535 /// Please note that this method must not be used to set any of the known parameters
18536 /// which have their own setter method. If done anyway, the request will fail.
18537 ///
18538 /// # Additional Parameters
18539 ///
18540 /// * *$.xgafv* (query-string) - V1 error format.
18541 /// * *access_token* (query-string) - OAuth access token.
18542 /// * *alt* (query-string) - Data format for response.
18543 /// * *callback* (query-string) - JSONP
18544 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18545 /// * *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.
18546 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18547 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18548 /// * *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.
18549 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18550 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18551 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
18552 where
18553 T: AsRef<str>,
18554 {
18555 self._additional_params
18556 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18557 self
18558 }
18559
18560 /// Identifies the authorization scope for the method you are building.
18561 ///
18562 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18563 /// [`Scope::CloudPlatform`].
18564 ///
18565 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18566 /// tokens for more than one scope.
18567 ///
18568 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18569 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18570 /// sufficient, a read-write scope will do as well.
18571 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
18572 where
18573 St: AsRef<str>,
18574 {
18575 self._scopes.insert(String::from(scope.as_ref()));
18576 self
18577 }
18578 /// Identifies the authorization scope(s) for the method you are building.
18579 ///
18580 /// See [`Self::add_scope()`] for details.
18581 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
18582 where
18583 I: IntoIterator<Item = St>,
18584 St: AsRef<str>,
18585 {
18586 self._scopes
18587 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18588 self
18589 }
18590
18591 /// Removes all scopes, and no default scope will be used either.
18592 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18593 /// for details).
18594 pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
18595 self._scopes.clear();
18596 self
18597 }
18598}
18599
18600/// Gets the specified operation.
18601///
18602/// A builder for the *locations.operations.get* method supported by a *project* resource.
18603/// It is not used directly, but through a [`ProjectMethods`] instance.
18604///
18605/// # Example
18606///
18607/// Instantiate a resource method builder
18608///
18609/// ```test_harness,no_run
18610/// # extern crate hyper;
18611/// # extern crate hyper_rustls;
18612/// # extern crate google_container1 as container1;
18613/// # async fn dox() {
18614/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18615///
18616/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18617/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18618/// # .with_native_roots()
18619/// # .unwrap()
18620/// # .https_only()
18621/// # .enable_http2()
18622/// # .build();
18623///
18624/// # let executor = hyper_util::rt::TokioExecutor::new();
18625/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18626/// # secret,
18627/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18628/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18629/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18630/// # ),
18631/// # ).build().await.unwrap();
18632///
18633/// # let client = hyper_util::client::legacy::Client::builder(
18634/// # hyper_util::rt::TokioExecutor::new()
18635/// # )
18636/// # .build(
18637/// # hyper_rustls::HttpsConnectorBuilder::new()
18638/// # .with_native_roots()
18639/// # .unwrap()
18640/// # .https_or_http()
18641/// # .enable_http2()
18642/// # .build()
18643/// # );
18644/// # let mut hub = Container::new(client, auth);
18645/// // You can configure optional parameters by calling the respective setters at will, and
18646/// // execute the final call using `doit()`.
18647/// // Values shown here are possibly random and not representative !
18648/// let result = hub.projects().locations_operations_get("name")
18649/// .zone("ipsum")
18650/// .project_id("accusam")
18651/// .operation_id("takimata")
18652/// .doit().await;
18653/// # }
18654/// ```
18655pub struct ProjectLocationOperationGetCall<'a, C>
18656where
18657 C: 'a,
18658{
18659 hub: &'a Container<C>,
18660 _name: String,
18661 _zone: Option<String>,
18662 _project_id: Option<String>,
18663 _operation_id: Option<String>,
18664 _delegate: Option<&'a mut dyn common::Delegate>,
18665 _additional_params: HashMap<String, String>,
18666 _scopes: BTreeSet<String>,
18667}
18668
18669impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
18670
18671impl<'a, C> ProjectLocationOperationGetCall<'a, C>
18672where
18673 C: common::Connector,
18674{
18675 /// Perform the operation you have build so far.
18676 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
18677 use std::borrow::Cow;
18678 use std::io::{Read, Seek};
18679
18680 use common::{url::Params, ToParts};
18681 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
18682
18683 let mut dd = common::DefaultDelegate;
18684 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
18685 dlg.begin(common::MethodInfo {
18686 id: "container.projects.locations.operations.get",
18687 http_method: hyper::Method::GET,
18688 });
18689
18690 for &field in ["alt", "name", "zone", "projectId", "operationId"].iter() {
18691 if self._additional_params.contains_key(field) {
18692 dlg.finished(false);
18693 return Err(common::Error::FieldClash(field));
18694 }
18695 }
18696
18697 let mut params = Params::with_capacity(6 + self._additional_params.len());
18698 params.push("name", self._name);
18699 if let Some(value) = self._zone.as_ref() {
18700 params.push("zone", value);
18701 }
18702 if let Some(value) = self._project_id.as_ref() {
18703 params.push("projectId", value);
18704 }
18705 if let Some(value) = self._operation_id.as_ref() {
18706 params.push("operationId", value);
18707 }
18708
18709 params.extend(self._additional_params.iter());
18710
18711 params.push("alt", "json");
18712 let mut url = self.hub._base_url.clone() + "v1/{+name}";
18713 if self._scopes.is_empty() {
18714 self._scopes
18715 .insert(Scope::CloudPlatform.as_ref().to_string());
18716 }
18717
18718 #[allow(clippy::single_element_loop)]
18719 for &(find_this, param_name) in [("{+name}", "name")].iter() {
18720 url = params.uri_replacement(url, param_name, find_this, true);
18721 }
18722 {
18723 let to_remove = ["name"];
18724 params.remove_params(&to_remove);
18725 }
18726
18727 let url = params.parse_with_url(&url);
18728
18729 loop {
18730 let token = match self
18731 .hub
18732 .auth
18733 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
18734 .await
18735 {
18736 Ok(token) => token,
18737 Err(e) => match dlg.token(e) {
18738 Ok(token) => token,
18739 Err(e) => {
18740 dlg.finished(false);
18741 return Err(common::Error::MissingToken(e));
18742 }
18743 },
18744 };
18745 let mut req_result = {
18746 let client = &self.hub.client;
18747 dlg.pre_request();
18748 let mut req_builder = hyper::Request::builder()
18749 .method(hyper::Method::GET)
18750 .uri(url.as_str())
18751 .header(USER_AGENT, self.hub._user_agent.clone());
18752
18753 if let Some(token) = token.as_ref() {
18754 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
18755 }
18756
18757 let request = req_builder
18758 .header(CONTENT_LENGTH, 0_u64)
18759 .body(common::to_body::<String>(None));
18760
18761 client.request(request.unwrap()).await
18762 };
18763
18764 match req_result {
18765 Err(err) => {
18766 if let common::Retry::After(d) = dlg.http_error(&err) {
18767 sleep(d).await;
18768 continue;
18769 }
18770 dlg.finished(false);
18771 return Err(common::Error::HttpError(err));
18772 }
18773 Ok(res) => {
18774 let (mut parts, body) = res.into_parts();
18775 let mut body = common::Body::new(body);
18776 if !parts.status.is_success() {
18777 let bytes = common::to_bytes(body).await.unwrap_or_default();
18778 let error = serde_json::from_str(&common::to_string(&bytes));
18779 let response = common::to_response(parts, bytes.into());
18780
18781 if let common::Retry::After(d) =
18782 dlg.http_failure(&response, error.as_ref().ok())
18783 {
18784 sleep(d).await;
18785 continue;
18786 }
18787
18788 dlg.finished(false);
18789
18790 return Err(match error {
18791 Ok(value) => common::Error::BadRequest(value),
18792 _ => common::Error::Failure(response),
18793 });
18794 }
18795 let response = {
18796 let bytes = common::to_bytes(body).await.unwrap_or_default();
18797 let encoded = common::to_string(&bytes);
18798 match serde_json::from_str(&encoded) {
18799 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
18800 Err(error) => {
18801 dlg.response_json_decode_error(&encoded, &error);
18802 return Err(common::Error::JsonDecodeError(
18803 encoded.to_string(),
18804 error,
18805 ));
18806 }
18807 }
18808 };
18809
18810 dlg.finished(true);
18811 return Ok(response);
18812 }
18813 }
18814 }
18815 }
18816
18817 /// The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
18818 ///
18819 /// Sets the *name* path property to the given value.
18820 ///
18821 /// Even though the property as already been set when instantiating this call,
18822 /// we provide this method for API completeness.
18823 pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
18824 self._name = new_value.to_string();
18825 self
18826 }
18827 /// 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.
18828 ///
18829 /// Sets the *zone* query property to the given value.
18830 pub fn zone(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
18831 self._zone = Some(new_value.to_string());
18832 self
18833 }
18834 /// 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.
18835 ///
18836 /// Sets the *project id* query property to the given value.
18837 pub fn project_id(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
18838 self._project_id = Some(new_value.to_string());
18839 self
18840 }
18841 /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
18842 ///
18843 /// Sets the *operation id* query property to the given value.
18844 pub fn operation_id(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
18845 self._operation_id = Some(new_value.to_string());
18846 self
18847 }
18848 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
18849 /// while executing the actual API request.
18850 ///
18851 /// ````text
18852 /// It should be used to handle progress information, and to implement a certain level of resilience.
18853 /// ````
18854 ///
18855 /// Sets the *delegate* property to the given value.
18856 pub fn delegate(
18857 mut self,
18858 new_value: &'a mut dyn common::Delegate,
18859 ) -> ProjectLocationOperationGetCall<'a, C> {
18860 self._delegate = Some(new_value);
18861 self
18862 }
18863
18864 /// Set any additional parameter of the query string used in the request.
18865 /// It should be used to set parameters which are not yet available through their own
18866 /// setters.
18867 ///
18868 /// Please note that this method must not be used to set any of the known parameters
18869 /// which have their own setter method. If done anyway, the request will fail.
18870 ///
18871 /// # Additional Parameters
18872 ///
18873 /// * *$.xgafv* (query-string) - V1 error format.
18874 /// * *access_token* (query-string) - OAuth access token.
18875 /// * *alt* (query-string) - Data format for response.
18876 /// * *callback* (query-string) - JSONP
18877 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
18878 /// * *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.
18879 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
18880 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
18881 /// * *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.
18882 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
18883 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
18884 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
18885 where
18886 T: AsRef<str>,
18887 {
18888 self._additional_params
18889 .insert(name.as_ref().to_string(), value.as_ref().to_string());
18890 self
18891 }
18892
18893 /// Identifies the authorization scope for the method you are building.
18894 ///
18895 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
18896 /// [`Scope::CloudPlatform`].
18897 ///
18898 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
18899 /// tokens for more than one scope.
18900 ///
18901 /// Usually there is more than one suitable scope to authorize an operation, some of which may
18902 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
18903 /// sufficient, a read-write scope will do as well.
18904 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
18905 where
18906 St: AsRef<str>,
18907 {
18908 self._scopes.insert(String::from(scope.as_ref()));
18909 self
18910 }
18911 /// Identifies the authorization scope(s) for the method you are building.
18912 ///
18913 /// See [`Self::add_scope()`] for details.
18914 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
18915 where
18916 I: IntoIterator<Item = St>,
18917 St: AsRef<str>,
18918 {
18919 self._scopes
18920 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
18921 self
18922 }
18923
18924 /// Removes all scopes, and no default scope will be used either.
18925 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
18926 /// for details).
18927 pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
18928 self._scopes.clear();
18929 self
18930 }
18931}
18932
18933/// Lists all operations in a project in a specific zone or all zones.
18934///
18935/// A builder for the *locations.operations.list* method supported by a *project* resource.
18936/// It is not used directly, but through a [`ProjectMethods`] instance.
18937///
18938/// # Example
18939///
18940/// Instantiate a resource method builder
18941///
18942/// ```test_harness,no_run
18943/// # extern crate hyper;
18944/// # extern crate hyper_rustls;
18945/// # extern crate google_container1 as container1;
18946/// # async fn dox() {
18947/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
18948///
18949/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
18950/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
18951/// # .with_native_roots()
18952/// # .unwrap()
18953/// # .https_only()
18954/// # .enable_http2()
18955/// # .build();
18956///
18957/// # let executor = hyper_util::rt::TokioExecutor::new();
18958/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
18959/// # secret,
18960/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
18961/// # yup_oauth2::client::CustomHyperClientBuilder::from(
18962/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
18963/// # ),
18964/// # ).build().await.unwrap();
18965///
18966/// # let client = hyper_util::client::legacy::Client::builder(
18967/// # hyper_util::rt::TokioExecutor::new()
18968/// # )
18969/// # .build(
18970/// # hyper_rustls::HttpsConnectorBuilder::new()
18971/// # .with_native_roots()
18972/// # .unwrap()
18973/// # .https_or_http()
18974/// # .enable_http2()
18975/// # .build()
18976/// # );
18977/// # let mut hub = Container::new(client, auth);
18978/// // You can configure optional parameters by calling the respective setters at will, and
18979/// // execute the final call using `doit()`.
18980/// // Values shown here are possibly random and not representative !
18981/// let result = hub.projects().locations_operations_list("parent")
18982/// .zone("voluptua.")
18983/// .project_id("et")
18984/// .doit().await;
18985/// # }
18986/// ```
18987pub struct ProjectLocationOperationListCall<'a, C>
18988where
18989 C: 'a,
18990{
18991 hub: &'a Container<C>,
18992 _parent: String,
18993 _zone: Option<String>,
18994 _project_id: Option<String>,
18995 _delegate: Option<&'a mut dyn common::Delegate>,
18996 _additional_params: HashMap<String, String>,
18997 _scopes: BTreeSet<String>,
18998}
18999
19000impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
19001
19002impl<'a, C> ProjectLocationOperationListCall<'a, C>
19003where
19004 C: common::Connector,
19005{
19006 /// Perform the operation you have build so far.
19007 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
19008 use std::borrow::Cow;
19009 use std::io::{Read, Seek};
19010
19011 use common::{url::Params, ToParts};
19012 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19013
19014 let mut dd = common::DefaultDelegate;
19015 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19016 dlg.begin(common::MethodInfo {
19017 id: "container.projects.locations.operations.list",
19018 http_method: hyper::Method::GET,
19019 });
19020
19021 for &field in ["alt", "parent", "zone", "projectId"].iter() {
19022 if self._additional_params.contains_key(field) {
19023 dlg.finished(false);
19024 return Err(common::Error::FieldClash(field));
19025 }
19026 }
19027
19028 let mut params = Params::with_capacity(5 + self._additional_params.len());
19029 params.push("parent", self._parent);
19030 if let Some(value) = self._zone.as_ref() {
19031 params.push("zone", value);
19032 }
19033 if let Some(value) = self._project_id.as_ref() {
19034 params.push("projectId", value);
19035 }
19036
19037 params.extend(self._additional_params.iter());
19038
19039 params.push("alt", "json");
19040 let mut url = self.hub._base_url.clone() + "v1/{+parent}/operations";
19041 if self._scopes.is_empty() {
19042 self._scopes
19043 .insert(Scope::CloudPlatform.as_ref().to_string());
19044 }
19045
19046 #[allow(clippy::single_element_loop)]
19047 for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
19048 url = params.uri_replacement(url, param_name, find_this, true);
19049 }
19050 {
19051 let to_remove = ["parent"];
19052 params.remove_params(&to_remove);
19053 }
19054
19055 let url = params.parse_with_url(&url);
19056
19057 loop {
19058 let token = match self
19059 .hub
19060 .auth
19061 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19062 .await
19063 {
19064 Ok(token) => token,
19065 Err(e) => match dlg.token(e) {
19066 Ok(token) => token,
19067 Err(e) => {
19068 dlg.finished(false);
19069 return Err(common::Error::MissingToken(e));
19070 }
19071 },
19072 };
19073 let mut req_result = {
19074 let client = &self.hub.client;
19075 dlg.pre_request();
19076 let mut req_builder = hyper::Request::builder()
19077 .method(hyper::Method::GET)
19078 .uri(url.as_str())
19079 .header(USER_AGENT, self.hub._user_agent.clone());
19080
19081 if let Some(token) = token.as_ref() {
19082 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19083 }
19084
19085 let request = req_builder
19086 .header(CONTENT_LENGTH, 0_u64)
19087 .body(common::to_body::<String>(None));
19088
19089 client.request(request.unwrap()).await
19090 };
19091
19092 match req_result {
19093 Err(err) => {
19094 if let common::Retry::After(d) = dlg.http_error(&err) {
19095 sleep(d).await;
19096 continue;
19097 }
19098 dlg.finished(false);
19099 return Err(common::Error::HttpError(err));
19100 }
19101 Ok(res) => {
19102 let (mut parts, body) = res.into_parts();
19103 let mut body = common::Body::new(body);
19104 if !parts.status.is_success() {
19105 let bytes = common::to_bytes(body).await.unwrap_or_default();
19106 let error = serde_json::from_str(&common::to_string(&bytes));
19107 let response = common::to_response(parts, bytes.into());
19108
19109 if let common::Retry::After(d) =
19110 dlg.http_failure(&response, error.as_ref().ok())
19111 {
19112 sleep(d).await;
19113 continue;
19114 }
19115
19116 dlg.finished(false);
19117
19118 return Err(match error {
19119 Ok(value) => common::Error::BadRequest(value),
19120 _ => common::Error::Failure(response),
19121 });
19122 }
19123 let response = {
19124 let bytes = common::to_bytes(body).await.unwrap_or_default();
19125 let encoded = common::to_string(&bytes);
19126 match serde_json::from_str(&encoded) {
19127 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19128 Err(error) => {
19129 dlg.response_json_decode_error(&encoded, &error);
19130 return Err(common::Error::JsonDecodeError(
19131 encoded.to_string(),
19132 error,
19133 ));
19134 }
19135 }
19136 };
19137
19138 dlg.finished(true);
19139 return Ok(response);
19140 }
19141 }
19142 }
19143 }
19144
19145 /// The parent (project and location) where the operations will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
19146 ///
19147 /// Sets the *parent* path property to the given value.
19148 ///
19149 /// Even though the property as already been set when instantiating this call,
19150 /// we provide this method for API completeness.
19151 pub fn parent(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
19152 self._parent = new_value.to_string();
19153 self
19154 }
19155 /// 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.
19156 ///
19157 /// Sets the *zone* query property to the given value.
19158 pub fn zone(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
19159 self._zone = Some(new_value.to_string());
19160 self
19161 }
19162 /// 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.
19163 ///
19164 /// Sets the *project id* query property to the given value.
19165 pub fn project_id(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
19166 self._project_id = Some(new_value.to_string());
19167 self
19168 }
19169 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19170 /// while executing the actual API request.
19171 ///
19172 /// ````text
19173 /// It should be used to handle progress information, and to implement a certain level of resilience.
19174 /// ````
19175 ///
19176 /// Sets the *delegate* property to the given value.
19177 pub fn delegate(
19178 mut self,
19179 new_value: &'a mut dyn common::Delegate,
19180 ) -> ProjectLocationOperationListCall<'a, C> {
19181 self._delegate = Some(new_value);
19182 self
19183 }
19184
19185 /// Set any additional parameter of the query string used in the request.
19186 /// It should be used to set parameters which are not yet available through their own
19187 /// setters.
19188 ///
19189 /// Please note that this method must not be used to set any of the known parameters
19190 /// which have their own setter method. If done anyway, the request will fail.
19191 ///
19192 /// # Additional Parameters
19193 ///
19194 /// * *$.xgafv* (query-string) - V1 error format.
19195 /// * *access_token* (query-string) - OAuth access token.
19196 /// * *alt* (query-string) - Data format for response.
19197 /// * *callback* (query-string) - JSONP
19198 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19199 /// * *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.
19200 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19201 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19202 /// * *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.
19203 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19204 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19205 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
19206 where
19207 T: AsRef<str>,
19208 {
19209 self._additional_params
19210 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19211 self
19212 }
19213
19214 /// Identifies the authorization scope for the method you are building.
19215 ///
19216 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19217 /// [`Scope::CloudPlatform`].
19218 ///
19219 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19220 /// tokens for more than one scope.
19221 ///
19222 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19223 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19224 /// sufficient, a read-write scope will do as well.
19225 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
19226 where
19227 St: AsRef<str>,
19228 {
19229 self._scopes.insert(String::from(scope.as_ref()));
19230 self
19231 }
19232 /// Identifies the authorization scope(s) for the method you are building.
19233 ///
19234 /// See [`Self::add_scope()`] for details.
19235 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
19236 where
19237 I: IntoIterator<Item = St>,
19238 St: AsRef<str>,
19239 {
19240 self._scopes
19241 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19242 self
19243 }
19244
19245 /// Removes all scopes, and no default scope will be used either.
19246 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19247 /// for details).
19248 pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
19249 self._scopes.clear();
19250 self
19251 }
19252}
19253
19254/// Returns configuration info about the Google Kubernetes Engine service.
19255///
19256/// A builder for the *locations.getServerConfig* method supported by a *project* resource.
19257/// It is not used directly, but through a [`ProjectMethods`] instance.
19258///
19259/// # Example
19260///
19261/// Instantiate a resource method builder
19262///
19263/// ```test_harness,no_run
19264/// # extern crate hyper;
19265/// # extern crate hyper_rustls;
19266/// # extern crate google_container1 as container1;
19267/// # async fn dox() {
19268/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19269///
19270/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19271/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19272/// # .with_native_roots()
19273/// # .unwrap()
19274/// # .https_only()
19275/// # .enable_http2()
19276/// # .build();
19277///
19278/// # let executor = hyper_util::rt::TokioExecutor::new();
19279/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19280/// # secret,
19281/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19282/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19283/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19284/// # ),
19285/// # ).build().await.unwrap();
19286///
19287/// # let client = hyper_util::client::legacy::Client::builder(
19288/// # hyper_util::rt::TokioExecutor::new()
19289/// # )
19290/// # .build(
19291/// # hyper_rustls::HttpsConnectorBuilder::new()
19292/// # .with_native_roots()
19293/// # .unwrap()
19294/// # .https_or_http()
19295/// # .enable_http2()
19296/// # .build()
19297/// # );
19298/// # let mut hub = Container::new(client, auth);
19299/// // You can configure optional parameters by calling the respective setters at will, and
19300/// // execute the final call using `doit()`.
19301/// // Values shown here are possibly random and not representative !
19302/// let result = hub.projects().locations_get_server_config("name")
19303/// .zone("consetetur")
19304/// .project_id("amet.")
19305/// .doit().await;
19306/// # }
19307/// ```
19308pub struct ProjectLocationGetServerConfigCall<'a, C>
19309where
19310 C: 'a,
19311{
19312 hub: &'a Container<C>,
19313 _name: String,
19314 _zone: Option<String>,
19315 _project_id: Option<String>,
19316 _delegate: Option<&'a mut dyn common::Delegate>,
19317 _additional_params: HashMap<String, String>,
19318 _scopes: BTreeSet<String>,
19319}
19320
19321impl<'a, C> common::CallBuilder for ProjectLocationGetServerConfigCall<'a, C> {}
19322
19323impl<'a, C> ProjectLocationGetServerConfigCall<'a, C>
19324where
19325 C: common::Connector,
19326{
19327 /// Perform the operation you have build so far.
19328 pub async fn doit(mut self) -> common::Result<(common::Response, ServerConfig)> {
19329 use std::borrow::Cow;
19330 use std::io::{Read, Seek};
19331
19332 use common::{url::Params, ToParts};
19333 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19334
19335 let mut dd = common::DefaultDelegate;
19336 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19337 dlg.begin(common::MethodInfo {
19338 id: "container.projects.locations.getServerConfig",
19339 http_method: hyper::Method::GET,
19340 });
19341
19342 for &field in ["alt", "name", "zone", "projectId"].iter() {
19343 if self._additional_params.contains_key(field) {
19344 dlg.finished(false);
19345 return Err(common::Error::FieldClash(field));
19346 }
19347 }
19348
19349 let mut params = Params::with_capacity(5 + self._additional_params.len());
19350 params.push("name", self._name);
19351 if let Some(value) = self._zone.as_ref() {
19352 params.push("zone", value);
19353 }
19354 if let Some(value) = self._project_id.as_ref() {
19355 params.push("projectId", value);
19356 }
19357
19358 params.extend(self._additional_params.iter());
19359
19360 params.push("alt", "json");
19361 let mut url = self.hub._base_url.clone() + "v1/{+name}/serverConfig";
19362 if self._scopes.is_empty() {
19363 self._scopes
19364 .insert(Scope::CloudPlatform.as_ref().to_string());
19365 }
19366
19367 #[allow(clippy::single_element_loop)]
19368 for &(find_this, param_name) in [("{+name}", "name")].iter() {
19369 url = params.uri_replacement(url, param_name, find_this, true);
19370 }
19371 {
19372 let to_remove = ["name"];
19373 params.remove_params(&to_remove);
19374 }
19375
19376 let url = params.parse_with_url(&url);
19377
19378 loop {
19379 let token = match self
19380 .hub
19381 .auth
19382 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19383 .await
19384 {
19385 Ok(token) => token,
19386 Err(e) => match dlg.token(e) {
19387 Ok(token) => token,
19388 Err(e) => {
19389 dlg.finished(false);
19390 return Err(common::Error::MissingToken(e));
19391 }
19392 },
19393 };
19394 let mut req_result = {
19395 let client = &self.hub.client;
19396 dlg.pre_request();
19397 let mut req_builder = hyper::Request::builder()
19398 .method(hyper::Method::GET)
19399 .uri(url.as_str())
19400 .header(USER_AGENT, self.hub._user_agent.clone());
19401
19402 if let Some(token) = token.as_ref() {
19403 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19404 }
19405
19406 let request = req_builder
19407 .header(CONTENT_LENGTH, 0_u64)
19408 .body(common::to_body::<String>(None));
19409
19410 client.request(request.unwrap()).await
19411 };
19412
19413 match req_result {
19414 Err(err) => {
19415 if let common::Retry::After(d) = dlg.http_error(&err) {
19416 sleep(d).await;
19417 continue;
19418 }
19419 dlg.finished(false);
19420 return Err(common::Error::HttpError(err));
19421 }
19422 Ok(res) => {
19423 let (mut parts, body) = res.into_parts();
19424 let mut body = common::Body::new(body);
19425 if !parts.status.is_success() {
19426 let bytes = common::to_bytes(body).await.unwrap_or_default();
19427 let error = serde_json::from_str(&common::to_string(&bytes));
19428 let response = common::to_response(parts, bytes.into());
19429
19430 if let common::Retry::After(d) =
19431 dlg.http_failure(&response, error.as_ref().ok())
19432 {
19433 sleep(d).await;
19434 continue;
19435 }
19436
19437 dlg.finished(false);
19438
19439 return Err(match error {
19440 Ok(value) => common::Error::BadRequest(value),
19441 _ => common::Error::Failure(response),
19442 });
19443 }
19444 let response = {
19445 let bytes = common::to_bytes(body).await.unwrap_or_default();
19446 let encoded = common::to_string(&bytes);
19447 match serde_json::from_str(&encoded) {
19448 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19449 Err(error) => {
19450 dlg.response_json_decode_error(&encoded, &error);
19451 return Err(common::Error::JsonDecodeError(
19452 encoded.to_string(),
19453 error,
19454 ));
19455 }
19456 }
19457 };
19458
19459 dlg.finished(true);
19460 return Ok(response);
19461 }
19462 }
19463 }
19464 }
19465
19466 /// The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
19467 ///
19468 /// Sets the *name* path property to the given value.
19469 ///
19470 /// Even though the property as already been set when instantiating this call,
19471 /// we provide this method for API completeness.
19472 pub fn name(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
19473 self._name = new_value.to_string();
19474 self
19475 }
19476 /// 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.
19477 ///
19478 /// Sets the *zone* query property to the given value.
19479 pub fn zone(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
19480 self._zone = Some(new_value.to_string());
19481 self
19482 }
19483 /// 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.
19484 ///
19485 /// Sets the *project id* query property to the given value.
19486 pub fn project_id(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
19487 self._project_id = Some(new_value.to_string());
19488 self
19489 }
19490 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19491 /// while executing the actual API request.
19492 ///
19493 /// ````text
19494 /// It should be used to handle progress information, and to implement a certain level of resilience.
19495 /// ````
19496 ///
19497 /// Sets the *delegate* property to the given value.
19498 pub fn delegate(
19499 mut self,
19500 new_value: &'a mut dyn common::Delegate,
19501 ) -> ProjectLocationGetServerConfigCall<'a, C> {
19502 self._delegate = Some(new_value);
19503 self
19504 }
19505
19506 /// Set any additional parameter of the query string used in the request.
19507 /// It should be used to set parameters which are not yet available through their own
19508 /// setters.
19509 ///
19510 /// Please note that this method must not be used to set any of the known parameters
19511 /// which have their own setter method. If done anyway, the request will fail.
19512 ///
19513 /// # Additional Parameters
19514 ///
19515 /// * *$.xgafv* (query-string) - V1 error format.
19516 /// * *access_token* (query-string) - OAuth access token.
19517 /// * *alt* (query-string) - Data format for response.
19518 /// * *callback* (query-string) - JSONP
19519 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19520 /// * *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.
19521 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19522 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19523 /// * *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.
19524 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19525 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19526 pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetServerConfigCall<'a, C>
19527 where
19528 T: AsRef<str>,
19529 {
19530 self._additional_params
19531 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19532 self
19533 }
19534
19535 /// Identifies the authorization scope for the method you are building.
19536 ///
19537 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19538 /// [`Scope::CloudPlatform`].
19539 ///
19540 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19541 /// tokens for more than one scope.
19542 ///
19543 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19544 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19545 /// sufficient, a read-write scope will do as well.
19546 pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetServerConfigCall<'a, C>
19547 where
19548 St: AsRef<str>,
19549 {
19550 self._scopes.insert(String::from(scope.as_ref()));
19551 self
19552 }
19553 /// Identifies the authorization scope(s) for the method you are building.
19554 ///
19555 /// See [`Self::add_scope()`] for details.
19556 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetServerConfigCall<'a, C>
19557 where
19558 I: IntoIterator<Item = St>,
19559 St: AsRef<str>,
19560 {
19561 self._scopes
19562 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19563 self
19564 }
19565
19566 /// Removes all scopes, and no default scope will be used either.
19567 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19568 /// for details).
19569 pub fn clear_scopes(mut self) -> ProjectLocationGetServerConfigCall<'a, C> {
19570 self._scopes.clear();
19571 self
19572 }
19573}
19574
19575/// Sets the autoscaling settings for the specified node pool.
19576///
19577/// A builder for the *zones.clusters.nodePools.autoscaling* method supported by a *project* resource.
19578/// It is not used directly, but through a [`ProjectMethods`] instance.
19579///
19580/// # Example
19581///
19582/// Instantiate a resource method builder
19583///
19584/// ```test_harness,no_run
19585/// # extern crate hyper;
19586/// # extern crate hyper_rustls;
19587/// # extern crate google_container1 as container1;
19588/// use container1::api::SetNodePoolAutoscalingRequest;
19589/// # async fn dox() {
19590/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19591///
19592/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19593/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19594/// # .with_native_roots()
19595/// # .unwrap()
19596/// # .https_only()
19597/// # .enable_http2()
19598/// # .build();
19599///
19600/// # let executor = hyper_util::rt::TokioExecutor::new();
19601/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19602/// # secret,
19603/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19604/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19605/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19606/// # ),
19607/// # ).build().await.unwrap();
19608///
19609/// # let client = hyper_util::client::legacy::Client::builder(
19610/// # hyper_util::rt::TokioExecutor::new()
19611/// # )
19612/// # .build(
19613/// # hyper_rustls::HttpsConnectorBuilder::new()
19614/// # .with_native_roots()
19615/// # .unwrap()
19616/// # .https_or_http()
19617/// # .enable_http2()
19618/// # .build()
19619/// # );
19620/// # let mut hub = Container::new(client, auth);
19621/// // As the method needs a request, you would usually fill it with the desired information
19622/// // into the respective structure. Some of the parts shown here might not be applicable !
19623/// // Values shown here are possibly random and not representative !
19624/// let mut req = SetNodePoolAutoscalingRequest::default();
19625///
19626/// // You can configure optional parameters by calling the respective setters at will, and
19627/// // execute the final call using `doit()`.
19628/// // Values shown here are possibly random and not representative !
19629/// let result = hub.projects().zones_clusters_node_pools_autoscaling(req, "projectId", "zone", "clusterId", "nodePoolId")
19630/// .doit().await;
19631/// # }
19632/// ```
19633pub struct ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
19634where
19635 C: 'a,
19636{
19637 hub: &'a Container<C>,
19638 _request: SetNodePoolAutoscalingRequest,
19639 _project_id: String,
19640 _zone: String,
19641 _cluster_id: String,
19642 _node_pool_id: String,
19643 _delegate: Option<&'a mut dyn common::Delegate>,
19644 _additional_params: HashMap<String, String>,
19645 _scopes: BTreeSet<String>,
19646}
19647
19648impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {}
19649
19650impl<'a, C> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
19651where
19652 C: common::Connector,
19653{
19654 /// Perform the operation you have build so far.
19655 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
19656 use std::borrow::Cow;
19657 use std::io::{Read, Seek};
19658
19659 use common::{url::Params, ToParts};
19660 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
19661
19662 let mut dd = common::DefaultDelegate;
19663 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
19664 dlg.begin(common::MethodInfo {
19665 id: "container.projects.zones.clusters.nodePools.autoscaling",
19666 http_method: hyper::Method::POST,
19667 });
19668
19669 for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
19670 if self._additional_params.contains_key(field) {
19671 dlg.finished(false);
19672 return Err(common::Error::FieldClash(field));
19673 }
19674 }
19675
19676 let mut params = Params::with_capacity(7 + self._additional_params.len());
19677 params.push("projectId", self._project_id);
19678 params.push("zone", self._zone);
19679 params.push("clusterId", self._cluster_id);
19680 params.push("nodePoolId", self._node_pool_id);
19681
19682 params.extend(self._additional_params.iter());
19683
19684 params.push("alt", "json");
19685 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/autoscaling";
19686 if self._scopes.is_empty() {
19687 self._scopes
19688 .insert(Scope::CloudPlatform.as_ref().to_string());
19689 }
19690
19691 #[allow(clippy::single_element_loop)]
19692 for &(find_this, param_name) in [
19693 ("{projectId}", "projectId"),
19694 ("{zone}", "zone"),
19695 ("{clusterId}", "clusterId"),
19696 ("{nodePoolId}", "nodePoolId"),
19697 ]
19698 .iter()
19699 {
19700 url = params.uri_replacement(url, param_name, find_this, false);
19701 }
19702 {
19703 let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
19704 params.remove_params(&to_remove);
19705 }
19706
19707 let url = params.parse_with_url(&url);
19708
19709 let mut json_mime_type = mime::APPLICATION_JSON;
19710 let mut request_value_reader = {
19711 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
19712 common::remove_json_null_values(&mut value);
19713 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
19714 serde_json::to_writer(&mut dst, &value).unwrap();
19715 dst
19716 };
19717 let request_size = request_value_reader
19718 .seek(std::io::SeekFrom::End(0))
19719 .unwrap();
19720 request_value_reader
19721 .seek(std::io::SeekFrom::Start(0))
19722 .unwrap();
19723
19724 loop {
19725 let token = match self
19726 .hub
19727 .auth
19728 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
19729 .await
19730 {
19731 Ok(token) => token,
19732 Err(e) => match dlg.token(e) {
19733 Ok(token) => token,
19734 Err(e) => {
19735 dlg.finished(false);
19736 return Err(common::Error::MissingToken(e));
19737 }
19738 },
19739 };
19740 request_value_reader
19741 .seek(std::io::SeekFrom::Start(0))
19742 .unwrap();
19743 let mut req_result = {
19744 let client = &self.hub.client;
19745 dlg.pre_request();
19746 let mut req_builder = hyper::Request::builder()
19747 .method(hyper::Method::POST)
19748 .uri(url.as_str())
19749 .header(USER_AGENT, self.hub._user_agent.clone());
19750
19751 if let Some(token) = token.as_ref() {
19752 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
19753 }
19754
19755 let request = req_builder
19756 .header(CONTENT_TYPE, json_mime_type.to_string())
19757 .header(CONTENT_LENGTH, request_size as u64)
19758 .body(common::to_body(
19759 request_value_reader.get_ref().clone().into(),
19760 ));
19761
19762 client.request(request.unwrap()).await
19763 };
19764
19765 match req_result {
19766 Err(err) => {
19767 if let common::Retry::After(d) = dlg.http_error(&err) {
19768 sleep(d).await;
19769 continue;
19770 }
19771 dlg.finished(false);
19772 return Err(common::Error::HttpError(err));
19773 }
19774 Ok(res) => {
19775 let (mut parts, body) = res.into_parts();
19776 let mut body = common::Body::new(body);
19777 if !parts.status.is_success() {
19778 let bytes = common::to_bytes(body).await.unwrap_or_default();
19779 let error = serde_json::from_str(&common::to_string(&bytes));
19780 let response = common::to_response(parts, bytes.into());
19781
19782 if let common::Retry::After(d) =
19783 dlg.http_failure(&response, error.as_ref().ok())
19784 {
19785 sleep(d).await;
19786 continue;
19787 }
19788
19789 dlg.finished(false);
19790
19791 return Err(match error {
19792 Ok(value) => common::Error::BadRequest(value),
19793 _ => common::Error::Failure(response),
19794 });
19795 }
19796 let response = {
19797 let bytes = common::to_bytes(body).await.unwrap_or_default();
19798 let encoded = common::to_string(&bytes);
19799 match serde_json::from_str(&encoded) {
19800 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
19801 Err(error) => {
19802 dlg.response_json_decode_error(&encoded, &error);
19803 return Err(common::Error::JsonDecodeError(
19804 encoded.to_string(),
19805 error,
19806 ));
19807 }
19808 }
19809 };
19810
19811 dlg.finished(true);
19812 return Ok(response);
19813 }
19814 }
19815 }
19816 }
19817
19818 ///
19819 /// Sets the *request* property to the given value.
19820 ///
19821 /// Even though the property as already been set when instantiating this call,
19822 /// we provide this method for API completeness.
19823 pub fn request(
19824 mut self,
19825 new_value: SetNodePoolAutoscalingRequest,
19826 ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
19827 self._request = new_value;
19828 self
19829 }
19830 /// 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.
19831 ///
19832 /// Sets the *project id* path property to the given value.
19833 ///
19834 /// Even though the property as already been set when instantiating this call,
19835 /// we provide this method for API completeness.
19836 pub fn project_id(
19837 mut self,
19838 new_value: &str,
19839 ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
19840 self._project_id = new_value.to_string();
19841 self
19842 }
19843 /// 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.
19844 ///
19845 /// Sets the *zone* path property to the given value.
19846 ///
19847 /// Even though the property as already been set when instantiating this call,
19848 /// we provide this method for API completeness.
19849 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
19850 self._zone = new_value.to_string();
19851 self
19852 }
19853 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
19854 ///
19855 /// Sets the *cluster id* path property to the given value.
19856 ///
19857 /// Even though the property as already been set when instantiating this call,
19858 /// we provide this method for API completeness.
19859 pub fn cluster_id(
19860 mut self,
19861 new_value: &str,
19862 ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
19863 self._cluster_id = new_value.to_string();
19864 self
19865 }
19866 /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
19867 ///
19868 /// Sets the *node pool id* path property to the given value.
19869 ///
19870 /// Even though the property as already been set when instantiating this call,
19871 /// we provide this method for API completeness.
19872 pub fn node_pool_id(
19873 mut self,
19874 new_value: &str,
19875 ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
19876 self._node_pool_id = new_value.to_string();
19877 self
19878 }
19879 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
19880 /// while executing the actual API request.
19881 ///
19882 /// ````text
19883 /// It should be used to handle progress information, and to implement a certain level of resilience.
19884 /// ````
19885 ///
19886 /// Sets the *delegate* property to the given value.
19887 pub fn delegate(
19888 mut self,
19889 new_value: &'a mut dyn common::Delegate,
19890 ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
19891 self._delegate = Some(new_value);
19892 self
19893 }
19894
19895 /// Set any additional parameter of the query string used in the request.
19896 /// It should be used to set parameters which are not yet available through their own
19897 /// setters.
19898 ///
19899 /// Please note that this method must not be used to set any of the known parameters
19900 /// which have their own setter method. If done anyway, the request will fail.
19901 ///
19902 /// # Additional Parameters
19903 ///
19904 /// * *$.xgafv* (query-string) - V1 error format.
19905 /// * *access_token* (query-string) - OAuth access token.
19906 /// * *alt* (query-string) - Data format for response.
19907 /// * *callback* (query-string) - JSONP
19908 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
19909 /// * *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.
19910 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
19911 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
19912 /// * *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.
19913 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
19914 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
19915 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
19916 where
19917 T: AsRef<str>,
19918 {
19919 self._additional_params
19920 .insert(name.as_ref().to_string(), value.as_ref().to_string());
19921 self
19922 }
19923
19924 /// Identifies the authorization scope for the method you are building.
19925 ///
19926 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
19927 /// [`Scope::CloudPlatform`].
19928 ///
19929 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
19930 /// tokens for more than one scope.
19931 ///
19932 /// Usually there is more than one suitable scope to authorize an operation, some of which may
19933 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
19934 /// sufficient, a read-write scope will do as well.
19935 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
19936 where
19937 St: AsRef<str>,
19938 {
19939 self._scopes.insert(String::from(scope.as_ref()));
19940 self
19941 }
19942 /// Identifies the authorization scope(s) for the method you are building.
19943 ///
19944 /// See [`Self::add_scope()`] for details.
19945 pub fn add_scopes<I, St>(
19946 mut self,
19947 scopes: I,
19948 ) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
19949 where
19950 I: IntoIterator<Item = St>,
19951 St: AsRef<str>,
19952 {
19953 self._scopes
19954 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
19955 self
19956 }
19957
19958 /// Removes all scopes, and no default scope will be used either.
19959 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
19960 /// for details).
19961 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
19962 self._scopes.clear();
19963 self
19964 }
19965}
19966
19967/// Creates a node pool for a cluster.
19968///
19969/// A builder for the *zones.clusters.nodePools.create* method supported by a *project* resource.
19970/// It is not used directly, but through a [`ProjectMethods`] instance.
19971///
19972/// # Example
19973///
19974/// Instantiate a resource method builder
19975///
19976/// ```test_harness,no_run
19977/// # extern crate hyper;
19978/// # extern crate hyper_rustls;
19979/// # extern crate google_container1 as container1;
19980/// use container1::api::CreateNodePoolRequest;
19981/// # async fn dox() {
19982/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
19983///
19984/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
19985/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
19986/// # .with_native_roots()
19987/// # .unwrap()
19988/// # .https_only()
19989/// # .enable_http2()
19990/// # .build();
19991///
19992/// # let executor = hyper_util::rt::TokioExecutor::new();
19993/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
19994/// # secret,
19995/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
19996/// # yup_oauth2::client::CustomHyperClientBuilder::from(
19997/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
19998/// # ),
19999/// # ).build().await.unwrap();
20000///
20001/// # let client = hyper_util::client::legacy::Client::builder(
20002/// # hyper_util::rt::TokioExecutor::new()
20003/// # )
20004/// # .build(
20005/// # hyper_rustls::HttpsConnectorBuilder::new()
20006/// # .with_native_roots()
20007/// # .unwrap()
20008/// # .https_or_http()
20009/// # .enable_http2()
20010/// # .build()
20011/// # );
20012/// # let mut hub = Container::new(client, auth);
20013/// // As the method needs a request, you would usually fill it with the desired information
20014/// // into the respective structure. Some of the parts shown here might not be applicable !
20015/// // Values shown here are possibly random and not representative !
20016/// let mut req = CreateNodePoolRequest::default();
20017///
20018/// // You can configure optional parameters by calling the respective setters at will, and
20019/// // execute the final call using `doit()`.
20020/// // Values shown here are possibly random and not representative !
20021/// let result = hub.projects().zones_clusters_node_pools_create(req, "projectId", "zone", "clusterId")
20022/// .doit().await;
20023/// # }
20024/// ```
20025pub struct ProjectZoneClusterNodePoolCreateCall<'a, C>
20026where
20027 C: 'a,
20028{
20029 hub: &'a Container<C>,
20030 _request: CreateNodePoolRequest,
20031 _project_id: String,
20032 _zone: String,
20033 _cluster_id: String,
20034 _delegate: Option<&'a mut dyn common::Delegate>,
20035 _additional_params: HashMap<String, String>,
20036 _scopes: BTreeSet<String>,
20037}
20038
20039impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolCreateCall<'a, C> {}
20040
20041impl<'a, C> ProjectZoneClusterNodePoolCreateCall<'a, C>
20042where
20043 C: common::Connector,
20044{
20045 /// Perform the operation you have build so far.
20046 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20047 use std::borrow::Cow;
20048 use std::io::{Read, Seek};
20049
20050 use common::{url::Params, ToParts};
20051 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20052
20053 let mut dd = common::DefaultDelegate;
20054 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20055 dlg.begin(common::MethodInfo {
20056 id: "container.projects.zones.clusters.nodePools.create",
20057 http_method: hyper::Method::POST,
20058 });
20059
20060 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
20061 if self._additional_params.contains_key(field) {
20062 dlg.finished(false);
20063 return Err(common::Error::FieldClash(field));
20064 }
20065 }
20066
20067 let mut params = Params::with_capacity(6 + self._additional_params.len());
20068 params.push("projectId", self._project_id);
20069 params.push("zone", self._zone);
20070 params.push("clusterId", self._cluster_id);
20071
20072 params.extend(self._additional_params.iter());
20073
20074 params.push("alt", "json");
20075 let mut url = self.hub._base_url.clone()
20076 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
20077 if self._scopes.is_empty() {
20078 self._scopes
20079 .insert(Scope::CloudPlatform.as_ref().to_string());
20080 }
20081
20082 #[allow(clippy::single_element_loop)]
20083 for &(find_this, param_name) in [
20084 ("{projectId}", "projectId"),
20085 ("{zone}", "zone"),
20086 ("{clusterId}", "clusterId"),
20087 ]
20088 .iter()
20089 {
20090 url = params.uri_replacement(url, param_name, find_this, false);
20091 }
20092 {
20093 let to_remove = ["clusterId", "zone", "projectId"];
20094 params.remove_params(&to_remove);
20095 }
20096
20097 let url = params.parse_with_url(&url);
20098
20099 let mut json_mime_type = mime::APPLICATION_JSON;
20100 let mut request_value_reader = {
20101 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
20102 common::remove_json_null_values(&mut value);
20103 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
20104 serde_json::to_writer(&mut dst, &value).unwrap();
20105 dst
20106 };
20107 let request_size = request_value_reader
20108 .seek(std::io::SeekFrom::End(0))
20109 .unwrap();
20110 request_value_reader
20111 .seek(std::io::SeekFrom::Start(0))
20112 .unwrap();
20113
20114 loop {
20115 let token = match self
20116 .hub
20117 .auth
20118 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20119 .await
20120 {
20121 Ok(token) => token,
20122 Err(e) => match dlg.token(e) {
20123 Ok(token) => token,
20124 Err(e) => {
20125 dlg.finished(false);
20126 return Err(common::Error::MissingToken(e));
20127 }
20128 },
20129 };
20130 request_value_reader
20131 .seek(std::io::SeekFrom::Start(0))
20132 .unwrap();
20133 let mut req_result = {
20134 let client = &self.hub.client;
20135 dlg.pre_request();
20136 let mut req_builder = hyper::Request::builder()
20137 .method(hyper::Method::POST)
20138 .uri(url.as_str())
20139 .header(USER_AGENT, self.hub._user_agent.clone());
20140
20141 if let Some(token) = token.as_ref() {
20142 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20143 }
20144
20145 let request = req_builder
20146 .header(CONTENT_TYPE, json_mime_type.to_string())
20147 .header(CONTENT_LENGTH, request_size as u64)
20148 .body(common::to_body(
20149 request_value_reader.get_ref().clone().into(),
20150 ));
20151
20152 client.request(request.unwrap()).await
20153 };
20154
20155 match req_result {
20156 Err(err) => {
20157 if let common::Retry::After(d) = dlg.http_error(&err) {
20158 sleep(d).await;
20159 continue;
20160 }
20161 dlg.finished(false);
20162 return Err(common::Error::HttpError(err));
20163 }
20164 Ok(res) => {
20165 let (mut parts, body) = res.into_parts();
20166 let mut body = common::Body::new(body);
20167 if !parts.status.is_success() {
20168 let bytes = common::to_bytes(body).await.unwrap_or_default();
20169 let error = serde_json::from_str(&common::to_string(&bytes));
20170 let response = common::to_response(parts, bytes.into());
20171
20172 if let common::Retry::After(d) =
20173 dlg.http_failure(&response, error.as_ref().ok())
20174 {
20175 sleep(d).await;
20176 continue;
20177 }
20178
20179 dlg.finished(false);
20180
20181 return Err(match error {
20182 Ok(value) => common::Error::BadRequest(value),
20183 _ => common::Error::Failure(response),
20184 });
20185 }
20186 let response = {
20187 let bytes = common::to_bytes(body).await.unwrap_or_default();
20188 let encoded = common::to_string(&bytes);
20189 match serde_json::from_str(&encoded) {
20190 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20191 Err(error) => {
20192 dlg.response_json_decode_error(&encoded, &error);
20193 return Err(common::Error::JsonDecodeError(
20194 encoded.to_string(),
20195 error,
20196 ));
20197 }
20198 }
20199 };
20200
20201 dlg.finished(true);
20202 return Ok(response);
20203 }
20204 }
20205 }
20206 }
20207
20208 ///
20209 /// Sets the *request* property to the given value.
20210 ///
20211 /// Even though the property as already been set when instantiating this call,
20212 /// we provide this method for API completeness.
20213 pub fn request(
20214 mut self,
20215 new_value: CreateNodePoolRequest,
20216 ) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
20217 self._request = new_value;
20218 self
20219 }
20220 /// 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.
20221 ///
20222 /// Sets the *project id* path property to the given value.
20223 ///
20224 /// Even though the property as already been set when instantiating this call,
20225 /// we provide this method for API completeness.
20226 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
20227 self._project_id = new_value.to_string();
20228 self
20229 }
20230 /// 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.
20231 ///
20232 /// Sets the *zone* path property to the given value.
20233 ///
20234 /// Even though the property as already been set when instantiating this call,
20235 /// we provide this method for API completeness.
20236 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
20237 self._zone = new_value.to_string();
20238 self
20239 }
20240 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
20241 ///
20242 /// Sets the *cluster id* path property to the given value.
20243 ///
20244 /// Even though the property as already been set when instantiating this call,
20245 /// we provide this method for API completeness.
20246 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
20247 self._cluster_id = new_value.to_string();
20248 self
20249 }
20250 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20251 /// while executing the actual API request.
20252 ///
20253 /// ````text
20254 /// It should be used to handle progress information, and to implement a certain level of resilience.
20255 /// ````
20256 ///
20257 /// Sets the *delegate* property to the given value.
20258 pub fn delegate(
20259 mut self,
20260 new_value: &'a mut dyn common::Delegate,
20261 ) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
20262 self._delegate = Some(new_value);
20263 self
20264 }
20265
20266 /// Set any additional parameter of the query string used in the request.
20267 /// It should be used to set parameters which are not yet available through their own
20268 /// setters.
20269 ///
20270 /// Please note that this method must not be used to set any of the known parameters
20271 /// which have their own setter method. If done anyway, the request will fail.
20272 ///
20273 /// # Additional Parameters
20274 ///
20275 /// * *$.xgafv* (query-string) - V1 error format.
20276 /// * *access_token* (query-string) - OAuth access token.
20277 /// * *alt* (query-string) - Data format for response.
20278 /// * *callback* (query-string) - JSONP
20279 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20280 /// * *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.
20281 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20282 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20283 /// * *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.
20284 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20285 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20286 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
20287 where
20288 T: AsRef<str>,
20289 {
20290 self._additional_params
20291 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20292 self
20293 }
20294
20295 /// Identifies the authorization scope for the method you are building.
20296 ///
20297 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20298 /// [`Scope::CloudPlatform`].
20299 ///
20300 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20301 /// tokens for more than one scope.
20302 ///
20303 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20304 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20305 /// sufficient, a read-write scope will do as well.
20306 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
20307 where
20308 St: AsRef<str>,
20309 {
20310 self._scopes.insert(String::from(scope.as_ref()));
20311 self
20312 }
20313 /// Identifies the authorization scope(s) for the method you are building.
20314 ///
20315 /// See [`Self::add_scope()`] for details.
20316 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
20317 where
20318 I: IntoIterator<Item = St>,
20319 St: AsRef<str>,
20320 {
20321 self._scopes
20322 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20323 self
20324 }
20325
20326 /// Removes all scopes, and no default scope will be used either.
20327 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20328 /// for details).
20329 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
20330 self._scopes.clear();
20331 self
20332 }
20333}
20334
20335/// Deletes a node pool from a cluster.
20336///
20337/// A builder for the *zones.clusters.nodePools.delete* method supported by a *project* resource.
20338/// It is not used directly, but through a [`ProjectMethods`] instance.
20339///
20340/// # Example
20341///
20342/// Instantiate a resource method builder
20343///
20344/// ```test_harness,no_run
20345/// # extern crate hyper;
20346/// # extern crate hyper_rustls;
20347/// # extern crate google_container1 as container1;
20348/// # async fn dox() {
20349/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20350///
20351/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20352/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20353/// # .with_native_roots()
20354/// # .unwrap()
20355/// # .https_only()
20356/// # .enable_http2()
20357/// # .build();
20358///
20359/// # let executor = hyper_util::rt::TokioExecutor::new();
20360/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20361/// # secret,
20362/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20363/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20364/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20365/// # ),
20366/// # ).build().await.unwrap();
20367///
20368/// # let client = hyper_util::client::legacy::Client::builder(
20369/// # hyper_util::rt::TokioExecutor::new()
20370/// # )
20371/// # .build(
20372/// # hyper_rustls::HttpsConnectorBuilder::new()
20373/// # .with_native_roots()
20374/// # .unwrap()
20375/// # .https_or_http()
20376/// # .enable_http2()
20377/// # .build()
20378/// # );
20379/// # let mut hub = Container::new(client, auth);
20380/// // You can configure optional parameters by calling the respective setters at will, and
20381/// // execute the final call using `doit()`.
20382/// // Values shown here are possibly random and not representative !
20383/// let result = hub.projects().zones_clusters_node_pools_delete("projectId", "zone", "clusterId", "nodePoolId")
20384/// .name("amet.")
20385/// .doit().await;
20386/// # }
20387/// ```
20388pub struct ProjectZoneClusterNodePoolDeleteCall<'a, C>
20389where
20390 C: 'a,
20391{
20392 hub: &'a Container<C>,
20393 _project_id: String,
20394 _zone: String,
20395 _cluster_id: String,
20396 _node_pool_id: String,
20397 _name: Option<String>,
20398 _delegate: Option<&'a mut dyn common::Delegate>,
20399 _additional_params: HashMap<String, String>,
20400 _scopes: BTreeSet<String>,
20401}
20402
20403impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolDeleteCall<'a, C> {}
20404
20405impl<'a, C> ProjectZoneClusterNodePoolDeleteCall<'a, C>
20406where
20407 C: common::Connector,
20408{
20409 /// Perform the operation you have build so far.
20410 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
20411 use std::borrow::Cow;
20412 use std::io::{Read, Seek};
20413
20414 use common::{url::Params, ToParts};
20415 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20416
20417 let mut dd = common::DefaultDelegate;
20418 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20419 dlg.begin(common::MethodInfo {
20420 id: "container.projects.zones.clusters.nodePools.delete",
20421 http_method: hyper::Method::DELETE,
20422 });
20423
20424 for &field in [
20425 "alt",
20426 "projectId",
20427 "zone",
20428 "clusterId",
20429 "nodePoolId",
20430 "name",
20431 ]
20432 .iter()
20433 {
20434 if self._additional_params.contains_key(field) {
20435 dlg.finished(false);
20436 return Err(common::Error::FieldClash(field));
20437 }
20438 }
20439
20440 let mut params = Params::with_capacity(7 + self._additional_params.len());
20441 params.push("projectId", self._project_id);
20442 params.push("zone", self._zone);
20443 params.push("clusterId", self._cluster_id);
20444 params.push("nodePoolId", self._node_pool_id);
20445 if let Some(value) = self._name.as_ref() {
20446 params.push("name", value);
20447 }
20448
20449 params.extend(self._additional_params.iter());
20450
20451 params.push("alt", "json");
20452 let mut url = self.hub._base_url.clone()
20453 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
20454 if self._scopes.is_empty() {
20455 self._scopes
20456 .insert(Scope::CloudPlatform.as_ref().to_string());
20457 }
20458
20459 #[allow(clippy::single_element_loop)]
20460 for &(find_this, param_name) in [
20461 ("{projectId}", "projectId"),
20462 ("{zone}", "zone"),
20463 ("{clusterId}", "clusterId"),
20464 ("{nodePoolId}", "nodePoolId"),
20465 ]
20466 .iter()
20467 {
20468 url = params.uri_replacement(url, param_name, find_this, false);
20469 }
20470 {
20471 let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
20472 params.remove_params(&to_remove);
20473 }
20474
20475 let url = params.parse_with_url(&url);
20476
20477 loop {
20478 let token = match self
20479 .hub
20480 .auth
20481 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20482 .await
20483 {
20484 Ok(token) => token,
20485 Err(e) => match dlg.token(e) {
20486 Ok(token) => token,
20487 Err(e) => {
20488 dlg.finished(false);
20489 return Err(common::Error::MissingToken(e));
20490 }
20491 },
20492 };
20493 let mut req_result = {
20494 let client = &self.hub.client;
20495 dlg.pre_request();
20496 let mut req_builder = hyper::Request::builder()
20497 .method(hyper::Method::DELETE)
20498 .uri(url.as_str())
20499 .header(USER_AGENT, self.hub._user_agent.clone());
20500
20501 if let Some(token) = token.as_ref() {
20502 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20503 }
20504
20505 let request = req_builder
20506 .header(CONTENT_LENGTH, 0_u64)
20507 .body(common::to_body::<String>(None));
20508
20509 client.request(request.unwrap()).await
20510 };
20511
20512 match req_result {
20513 Err(err) => {
20514 if let common::Retry::After(d) = dlg.http_error(&err) {
20515 sleep(d).await;
20516 continue;
20517 }
20518 dlg.finished(false);
20519 return Err(common::Error::HttpError(err));
20520 }
20521 Ok(res) => {
20522 let (mut parts, body) = res.into_parts();
20523 let mut body = common::Body::new(body);
20524 if !parts.status.is_success() {
20525 let bytes = common::to_bytes(body).await.unwrap_or_default();
20526 let error = serde_json::from_str(&common::to_string(&bytes));
20527 let response = common::to_response(parts, bytes.into());
20528
20529 if let common::Retry::After(d) =
20530 dlg.http_failure(&response, error.as_ref().ok())
20531 {
20532 sleep(d).await;
20533 continue;
20534 }
20535
20536 dlg.finished(false);
20537
20538 return Err(match error {
20539 Ok(value) => common::Error::BadRequest(value),
20540 _ => common::Error::Failure(response),
20541 });
20542 }
20543 let response = {
20544 let bytes = common::to_bytes(body).await.unwrap_or_default();
20545 let encoded = common::to_string(&bytes);
20546 match serde_json::from_str(&encoded) {
20547 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20548 Err(error) => {
20549 dlg.response_json_decode_error(&encoded, &error);
20550 return Err(common::Error::JsonDecodeError(
20551 encoded.to_string(),
20552 error,
20553 ));
20554 }
20555 }
20556 };
20557
20558 dlg.finished(true);
20559 return Ok(response);
20560 }
20561 }
20562 }
20563 }
20564
20565 /// 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.
20566 ///
20567 /// Sets the *project id* path property to the given value.
20568 ///
20569 /// Even though the property as already been set when instantiating this call,
20570 /// we provide this method for API completeness.
20571 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
20572 self._project_id = new_value.to_string();
20573 self
20574 }
20575 /// 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.
20576 ///
20577 /// Sets the *zone* path property to the given value.
20578 ///
20579 /// Even though the property as already been set when instantiating this call,
20580 /// we provide this method for API completeness.
20581 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
20582 self._zone = new_value.to_string();
20583 self
20584 }
20585 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
20586 ///
20587 /// Sets the *cluster id* path property to the given value.
20588 ///
20589 /// Even though the property as already been set when instantiating this call,
20590 /// we provide this method for API completeness.
20591 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
20592 self._cluster_id = new_value.to_string();
20593 self
20594 }
20595 /// Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
20596 ///
20597 /// Sets the *node pool id* path property to the given value.
20598 ///
20599 /// Even though the property as already been set when instantiating this call,
20600 /// we provide this method for API completeness.
20601 pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
20602 self._node_pool_id = new_value.to_string();
20603 self
20604 }
20605 /// The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
20606 ///
20607 /// Sets the *name* query property to the given value.
20608 pub fn name(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
20609 self._name = Some(new_value.to_string());
20610 self
20611 }
20612 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20613 /// while executing the actual API request.
20614 ///
20615 /// ````text
20616 /// It should be used to handle progress information, and to implement a certain level of resilience.
20617 /// ````
20618 ///
20619 /// Sets the *delegate* property to the given value.
20620 pub fn delegate(
20621 mut self,
20622 new_value: &'a mut dyn common::Delegate,
20623 ) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
20624 self._delegate = Some(new_value);
20625 self
20626 }
20627
20628 /// Set any additional parameter of the query string used in the request.
20629 /// It should be used to set parameters which are not yet available through their own
20630 /// setters.
20631 ///
20632 /// Please note that this method must not be used to set any of the known parameters
20633 /// which have their own setter method. If done anyway, the request will fail.
20634 ///
20635 /// # Additional Parameters
20636 ///
20637 /// * *$.xgafv* (query-string) - V1 error format.
20638 /// * *access_token* (query-string) - OAuth access token.
20639 /// * *alt* (query-string) - Data format for response.
20640 /// * *callback* (query-string) - JSONP
20641 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20642 /// * *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.
20643 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20644 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20645 /// * *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.
20646 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20647 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20648 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
20649 where
20650 T: AsRef<str>,
20651 {
20652 self._additional_params
20653 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20654 self
20655 }
20656
20657 /// Identifies the authorization scope for the method you are building.
20658 ///
20659 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20660 /// [`Scope::CloudPlatform`].
20661 ///
20662 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20663 /// tokens for more than one scope.
20664 ///
20665 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20666 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20667 /// sufficient, a read-write scope will do as well.
20668 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
20669 where
20670 St: AsRef<str>,
20671 {
20672 self._scopes.insert(String::from(scope.as_ref()));
20673 self
20674 }
20675 /// Identifies the authorization scope(s) for the method you are building.
20676 ///
20677 /// See [`Self::add_scope()`] for details.
20678 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
20679 where
20680 I: IntoIterator<Item = St>,
20681 St: AsRef<str>,
20682 {
20683 self._scopes
20684 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
20685 self
20686 }
20687
20688 /// Removes all scopes, and no default scope will be used either.
20689 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
20690 /// for details).
20691 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
20692 self._scopes.clear();
20693 self
20694 }
20695}
20696
20697/// Fetch upgrade information of a specific nodepool.
20698///
20699/// A builder for the *zones.clusters.nodePools.fetchNodePoolUpgradeInfo* method supported by a *project* resource.
20700/// It is not used directly, but through a [`ProjectMethods`] instance.
20701///
20702/// # Example
20703///
20704/// Instantiate a resource method builder
20705///
20706/// ```test_harness,no_run
20707/// # extern crate hyper;
20708/// # extern crate hyper_rustls;
20709/// # extern crate google_container1 as container1;
20710/// # async fn dox() {
20711/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
20712///
20713/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
20714/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
20715/// # .with_native_roots()
20716/// # .unwrap()
20717/// # .https_only()
20718/// # .enable_http2()
20719/// # .build();
20720///
20721/// # let executor = hyper_util::rt::TokioExecutor::new();
20722/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
20723/// # secret,
20724/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
20725/// # yup_oauth2::client::CustomHyperClientBuilder::from(
20726/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
20727/// # ),
20728/// # ).build().await.unwrap();
20729///
20730/// # let client = hyper_util::client::legacy::Client::builder(
20731/// # hyper_util::rt::TokioExecutor::new()
20732/// # )
20733/// # .build(
20734/// # hyper_rustls::HttpsConnectorBuilder::new()
20735/// # .with_native_roots()
20736/// # .unwrap()
20737/// # .https_or_http()
20738/// # .enable_http2()
20739/// # .build()
20740/// # );
20741/// # let mut hub = Container::new(client, auth);
20742/// // You can configure optional parameters by calling the respective setters at will, and
20743/// // execute the final call using `doit()`.
20744/// // Values shown here are possibly random and not representative !
20745/// let result = hub.projects().zones_clusters_node_pools_fetch_node_pool_upgrade_info("name")
20746/// .version("sadipscing")
20747/// .doit().await;
20748/// # }
20749/// ```
20750pub struct ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
20751where
20752 C: 'a,
20753{
20754 hub: &'a Container<C>,
20755 _name: String,
20756 _version: Option<String>,
20757 _delegate: Option<&'a mut dyn common::Delegate>,
20758 _additional_params: HashMap<String, String>,
20759 _scopes: BTreeSet<String>,
20760}
20761
20762impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {}
20763
20764impl<'a, C> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
20765where
20766 C: common::Connector,
20767{
20768 /// Perform the operation you have build so far.
20769 pub async fn doit(mut self) -> common::Result<(common::Response, NodePoolUpgradeInfo)> {
20770 use std::borrow::Cow;
20771 use std::io::{Read, Seek};
20772
20773 use common::{url::Params, ToParts};
20774 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
20775
20776 let mut dd = common::DefaultDelegate;
20777 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
20778 dlg.begin(common::MethodInfo {
20779 id: "container.projects.zones.clusters.nodePools.fetchNodePoolUpgradeInfo",
20780 http_method: hyper::Method::GET,
20781 });
20782
20783 for &field in ["alt", "name", "version"].iter() {
20784 if self._additional_params.contains_key(field) {
20785 dlg.finished(false);
20786 return Err(common::Error::FieldClash(field));
20787 }
20788 }
20789
20790 let mut params = Params::with_capacity(4 + self._additional_params.len());
20791 params.push("name", self._name);
20792 if let Some(value) = self._version.as_ref() {
20793 params.push("version", value);
20794 }
20795
20796 params.extend(self._additional_params.iter());
20797
20798 params.push("alt", "json");
20799 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchNodePoolUpgradeInfo";
20800 if self._scopes.is_empty() {
20801 self._scopes
20802 .insert(Scope::CloudPlatform.as_ref().to_string());
20803 }
20804
20805 #[allow(clippy::single_element_loop)]
20806 for &(find_this, param_name) in [("{+name}", "name")].iter() {
20807 url = params.uri_replacement(url, param_name, find_this, true);
20808 }
20809 {
20810 let to_remove = ["name"];
20811 params.remove_params(&to_remove);
20812 }
20813
20814 let url = params.parse_with_url(&url);
20815
20816 loop {
20817 let token = match self
20818 .hub
20819 .auth
20820 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
20821 .await
20822 {
20823 Ok(token) => token,
20824 Err(e) => match dlg.token(e) {
20825 Ok(token) => token,
20826 Err(e) => {
20827 dlg.finished(false);
20828 return Err(common::Error::MissingToken(e));
20829 }
20830 },
20831 };
20832 let mut req_result = {
20833 let client = &self.hub.client;
20834 dlg.pre_request();
20835 let mut req_builder = hyper::Request::builder()
20836 .method(hyper::Method::GET)
20837 .uri(url.as_str())
20838 .header(USER_AGENT, self.hub._user_agent.clone());
20839
20840 if let Some(token) = token.as_ref() {
20841 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
20842 }
20843
20844 let request = req_builder
20845 .header(CONTENT_LENGTH, 0_u64)
20846 .body(common::to_body::<String>(None));
20847
20848 client.request(request.unwrap()).await
20849 };
20850
20851 match req_result {
20852 Err(err) => {
20853 if let common::Retry::After(d) = dlg.http_error(&err) {
20854 sleep(d).await;
20855 continue;
20856 }
20857 dlg.finished(false);
20858 return Err(common::Error::HttpError(err));
20859 }
20860 Ok(res) => {
20861 let (mut parts, body) = res.into_parts();
20862 let mut body = common::Body::new(body);
20863 if !parts.status.is_success() {
20864 let bytes = common::to_bytes(body).await.unwrap_or_default();
20865 let error = serde_json::from_str(&common::to_string(&bytes));
20866 let response = common::to_response(parts, bytes.into());
20867
20868 if let common::Retry::After(d) =
20869 dlg.http_failure(&response, error.as_ref().ok())
20870 {
20871 sleep(d).await;
20872 continue;
20873 }
20874
20875 dlg.finished(false);
20876
20877 return Err(match error {
20878 Ok(value) => common::Error::BadRequest(value),
20879 _ => common::Error::Failure(response),
20880 });
20881 }
20882 let response = {
20883 let bytes = common::to_bytes(body).await.unwrap_or_default();
20884 let encoded = common::to_string(&bytes);
20885 match serde_json::from_str(&encoded) {
20886 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
20887 Err(error) => {
20888 dlg.response_json_decode_error(&encoded, &error);
20889 return Err(common::Error::JsonDecodeError(
20890 encoded.to_string(),
20891 error,
20892 ));
20893 }
20894 }
20895 };
20896
20897 dlg.finished(true);
20898 return Ok(response);
20899 }
20900 }
20901 }
20902 }
20903
20904 /// Required. The name (project, location, cluster, nodepool) of the nodepool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*` or `projects/*/zones/*/clusters/*/nodePools/*`.
20905 ///
20906 /// Sets the *name* path property to the given value.
20907 ///
20908 /// Even though the property as already been set when instantiating this call,
20909 /// we provide this method for API completeness.
20910 pub fn name(
20911 mut self,
20912 new_value: &str,
20913 ) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
20914 self._name = new_value.to_string();
20915 self
20916 }
20917 /// API request version that initiates this operation.
20918 ///
20919 /// Sets the *version* query property to the given value.
20920 pub fn version(
20921 mut self,
20922 new_value: &str,
20923 ) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
20924 self._version = Some(new_value.to_string());
20925 self
20926 }
20927 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
20928 /// while executing the actual API request.
20929 ///
20930 /// ````text
20931 /// It should be used to handle progress information, and to implement a certain level of resilience.
20932 /// ````
20933 ///
20934 /// Sets the *delegate* property to the given value.
20935 pub fn delegate(
20936 mut self,
20937 new_value: &'a mut dyn common::Delegate,
20938 ) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
20939 self._delegate = Some(new_value);
20940 self
20941 }
20942
20943 /// Set any additional parameter of the query string used in the request.
20944 /// It should be used to set parameters which are not yet available through their own
20945 /// setters.
20946 ///
20947 /// Please note that this method must not be used to set any of the known parameters
20948 /// which have their own setter method. If done anyway, the request will fail.
20949 ///
20950 /// # Additional Parameters
20951 ///
20952 /// * *$.xgafv* (query-string) - V1 error format.
20953 /// * *access_token* (query-string) - OAuth access token.
20954 /// * *alt* (query-string) - Data format for response.
20955 /// * *callback* (query-string) - JSONP
20956 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
20957 /// * *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.
20958 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
20959 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
20960 /// * *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.
20961 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
20962 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
20963 pub fn param<T>(
20964 mut self,
20965 name: T,
20966 value: T,
20967 ) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
20968 where
20969 T: AsRef<str>,
20970 {
20971 self._additional_params
20972 .insert(name.as_ref().to_string(), value.as_ref().to_string());
20973 self
20974 }
20975
20976 /// Identifies the authorization scope for the method you are building.
20977 ///
20978 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
20979 /// [`Scope::CloudPlatform`].
20980 ///
20981 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
20982 /// tokens for more than one scope.
20983 ///
20984 /// Usually there is more than one suitable scope to authorize an operation, some of which may
20985 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
20986 /// sufficient, a read-write scope will do as well.
20987 pub fn add_scope<St>(
20988 mut self,
20989 scope: St,
20990 ) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
20991 where
20992 St: AsRef<str>,
20993 {
20994 self._scopes.insert(String::from(scope.as_ref()));
20995 self
20996 }
20997 /// Identifies the authorization scope(s) for the method you are building.
20998 ///
20999 /// See [`Self::add_scope()`] for details.
21000 pub fn add_scopes<I, St>(
21001 mut self,
21002 scopes: I,
21003 ) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
21004 where
21005 I: IntoIterator<Item = St>,
21006 St: AsRef<str>,
21007 {
21008 self._scopes
21009 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21010 self
21011 }
21012
21013 /// Removes all scopes, and no default scope will be used either.
21014 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21015 /// for details).
21016 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
21017 self._scopes.clear();
21018 self
21019 }
21020}
21021
21022/// Retrieves the requested node pool.
21023///
21024/// A builder for the *zones.clusters.nodePools.get* method supported by a *project* resource.
21025/// It is not used directly, but through a [`ProjectMethods`] instance.
21026///
21027/// # Example
21028///
21029/// Instantiate a resource method builder
21030///
21031/// ```test_harness,no_run
21032/// # extern crate hyper;
21033/// # extern crate hyper_rustls;
21034/// # extern crate google_container1 as container1;
21035/// # async fn dox() {
21036/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21037///
21038/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21039/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21040/// # .with_native_roots()
21041/// # .unwrap()
21042/// # .https_only()
21043/// # .enable_http2()
21044/// # .build();
21045///
21046/// # let executor = hyper_util::rt::TokioExecutor::new();
21047/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21048/// # secret,
21049/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21050/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21051/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21052/// # ),
21053/// # ).build().await.unwrap();
21054///
21055/// # let client = hyper_util::client::legacy::Client::builder(
21056/// # hyper_util::rt::TokioExecutor::new()
21057/// # )
21058/// # .build(
21059/// # hyper_rustls::HttpsConnectorBuilder::new()
21060/// # .with_native_roots()
21061/// # .unwrap()
21062/// # .https_or_http()
21063/// # .enable_http2()
21064/// # .build()
21065/// # );
21066/// # let mut hub = Container::new(client, auth);
21067/// // You can configure optional parameters by calling the respective setters at will, and
21068/// // execute the final call using `doit()`.
21069/// // Values shown here are possibly random and not representative !
21070/// let result = hub.projects().zones_clusters_node_pools_get("projectId", "zone", "clusterId", "nodePoolId")
21071/// .name("At")
21072/// .doit().await;
21073/// # }
21074/// ```
21075pub struct ProjectZoneClusterNodePoolGetCall<'a, C>
21076where
21077 C: 'a,
21078{
21079 hub: &'a Container<C>,
21080 _project_id: String,
21081 _zone: String,
21082 _cluster_id: String,
21083 _node_pool_id: String,
21084 _name: Option<String>,
21085 _delegate: Option<&'a mut dyn common::Delegate>,
21086 _additional_params: HashMap<String, String>,
21087 _scopes: BTreeSet<String>,
21088}
21089
21090impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolGetCall<'a, C> {}
21091
21092impl<'a, C> ProjectZoneClusterNodePoolGetCall<'a, C>
21093where
21094 C: common::Connector,
21095{
21096 /// Perform the operation you have build so far.
21097 pub async fn doit(mut self) -> common::Result<(common::Response, NodePool)> {
21098 use std::borrow::Cow;
21099 use std::io::{Read, Seek};
21100
21101 use common::{url::Params, ToParts};
21102 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21103
21104 let mut dd = common::DefaultDelegate;
21105 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21106 dlg.begin(common::MethodInfo {
21107 id: "container.projects.zones.clusters.nodePools.get",
21108 http_method: hyper::Method::GET,
21109 });
21110
21111 for &field in [
21112 "alt",
21113 "projectId",
21114 "zone",
21115 "clusterId",
21116 "nodePoolId",
21117 "name",
21118 ]
21119 .iter()
21120 {
21121 if self._additional_params.contains_key(field) {
21122 dlg.finished(false);
21123 return Err(common::Error::FieldClash(field));
21124 }
21125 }
21126
21127 let mut params = Params::with_capacity(7 + self._additional_params.len());
21128 params.push("projectId", self._project_id);
21129 params.push("zone", self._zone);
21130 params.push("clusterId", self._cluster_id);
21131 params.push("nodePoolId", self._node_pool_id);
21132 if let Some(value) = self._name.as_ref() {
21133 params.push("name", value);
21134 }
21135
21136 params.extend(self._additional_params.iter());
21137
21138 params.push("alt", "json");
21139 let mut url = self.hub._base_url.clone()
21140 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
21141 if self._scopes.is_empty() {
21142 self._scopes
21143 .insert(Scope::CloudPlatform.as_ref().to_string());
21144 }
21145
21146 #[allow(clippy::single_element_loop)]
21147 for &(find_this, param_name) in [
21148 ("{projectId}", "projectId"),
21149 ("{zone}", "zone"),
21150 ("{clusterId}", "clusterId"),
21151 ("{nodePoolId}", "nodePoolId"),
21152 ]
21153 .iter()
21154 {
21155 url = params.uri_replacement(url, param_name, find_this, false);
21156 }
21157 {
21158 let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
21159 params.remove_params(&to_remove);
21160 }
21161
21162 let url = params.parse_with_url(&url);
21163
21164 loop {
21165 let token = match self
21166 .hub
21167 .auth
21168 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21169 .await
21170 {
21171 Ok(token) => token,
21172 Err(e) => match dlg.token(e) {
21173 Ok(token) => token,
21174 Err(e) => {
21175 dlg.finished(false);
21176 return Err(common::Error::MissingToken(e));
21177 }
21178 },
21179 };
21180 let mut req_result = {
21181 let client = &self.hub.client;
21182 dlg.pre_request();
21183 let mut req_builder = hyper::Request::builder()
21184 .method(hyper::Method::GET)
21185 .uri(url.as_str())
21186 .header(USER_AGENT, self.hub._user_agent.clone());
21187
21188 if let Some(token) = token.as_ref() {
21189 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21190 }
21191
21192 let request = req_builder
21193 .header(CONTENT_LENGTH, 0_u64)
21194 .body(common::to_body::<String>(None));
21195
21196 client.request(request.unwrap()).await
21197 };
21198
21199 match req_result {
21200 Err(err) => {
21201 if let common::Retry::After(d) = dlg.http_error(&err) {
21202 sleep(d).await;
21203 continue;
21204 }
21205 dlg.finished(false);
21206 return Err(common::Error::HttpError(err));
21207 }
21208 Ok(res) => {
21209 let (mut parts, body) = res.into_parts();
21210 let mut body = common::Body::new(body);
21211 if !parts.status.is_success() {
21212 let bytes = common::to_bytes(body).await.unwrap_or_default();
21213 let error = serde_json::from_str(&common::to_string(&bytes));
21214 let response = common::to_response(parts, bytes.into());
21215
21216 if let common::Retry::After(d) =
21217 dlg.http_failure(&response, error.as_ref().ok())
21218 {
21219 sleep(d).await;
21220 continue;
21221 }
21222
21223 dlg.finished(false);
21224
21225 return Err(match error {
21226 Ok(value) => common::Error::BadRequest(value),
21227 _ => common::Error::Failure(response),
21228 });
21229 }
21230 let response = {
21231 let bytes = common::to_bytes(body).await.unwrap_or_default();
21232 let encoded = common::to_string(&bytes);
21233 match serde_json::from_str(&encoded) {
21234 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21235 Err(error) => {
21236 dlg.response_json_decode_error(&encoded, &error);
21237 return Err(common::Error::JsonDecodeError(
21238 encoded.to_string(),
21239 error,
21240 ));
21241 }
21242 }
21243 };
21244
21245 dlg.finished(true);
21246 return Ok(response);
21247 }
21248 }
21249 }
21250 }
21251
21252 /// 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.
21253 ///
21254 /// Sets the *project id* path property to the given value.
21255 ///
21256 /// Even though the property as already been set when instantiating this call,
21257 /// we provide this method for API completeness.
21258 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
21259 self._project_id = new_value.to_string();
21260 self
21261 }
21262 /// 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.
21263 ///
21264 /// Sets the *zone* path property to the given value.
21265 ///
21266 /// Even though the property as already been set when instantiating this call,
21267 /// we provide this method for API completeness.
21268 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
21269 self._zone = new_value.to_string();
21270 self
21271 }
21272 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
21273 ///
21274 /// Sets the *cluster id* path property to the given value.
21275 ///
21276 /// Even though the property as already been set when instantiating this call,
21277 /// we provide this method for API completeness.
21278 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
21279 self._cluster_id = new_value.to_string();
21280 self
21281 }
21282 /// Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
21283 ///
21284 /// Sets the *node pool id* path property to the given value.
21285 ///
21286 /// Even though the property as already been set when instantiating this call,
21287 /// we provide this method for API completeness.
21288 pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
21289 self._node_pool_id = new_value.to_string();
21290 self
21291 }
21292 /// The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
21293 ///
21294 /// Sets the *name* query property to the given value.
21295 pub fn name(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
21296 self._name = Some(new_value.to_string());
21297 self
21298 }
21299 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21300 /// while executing the actual API request.
21301 ///
21302 /// ````text
21303 /// It should be used to handle progress information, and to implement a certain level of resilience.
21304 /// ````
21305 ///
21306 /// Sets the *delegate* property to the given value.
21307 pub fn delegate(
21308 mut self,
21309 new_value: &'a mut dyn common::Delegate,
21310 ) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
21311 self._delegate = Some(new_value);
21312 self
21313 }
21314
21315 /// Set any additional parameter of the query string used in the request.
21316 /// It should be used to set parameters which are not yet available through their own
21317 /// setters.
21318 ///
21319 /// Please note that this method must not be used to set any of the known parameters
21320 /// which have their own setter method. If done anyway, the request will fail.
21321 ///
21322 /// # Additional Parameters
21323 ///
21324 /// * *$.xgafv* (query-string) - V1 error format.
21325 /// * *access_token* (query-string) - OAuth access token.
21326 /// * *alt* (query-string) - Data format for response.
21327 /// * *callback* (query-string) - JSONP
21328 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21329 /// * *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.
21330 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21331 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21332 /// * *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.
21333 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21334 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21335 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolGetCall<'a, C>
21336 where
21337 T: AsRef<str>,
21338 {
21339 self._additional_params
21340 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21341 self
21342 }
21343
21344 /// Identifies the authorization scope for the method you are building.
21345 ///
21346 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21347 /// [`Scope::CloudPlatform`].
21348 ///
21349 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21350 /// tokens for more than one scope.
21351 ///
21352 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21353 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21354 /// sufficient, a read-write scope will do as well.
21355 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolGetCall<'a, C>
21356 where
21357 St: AsRef<str>,
21358 {
21359 self._scopes.insert(String::from(scope.as_ref()));
21360 self
21361 }
21362 /// Identifies the authorization scope(s) for the method you are building.
21363 ///
21364 /// See [`Self::add_scope()`] for details.
21365 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolGetCall<'a, C>
21366 where
21367 I: IntoIterator<Item = St>,
21368 St: AsRef<str>,
21369 {
21370 self._scopes
21371 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21372 self
21373 }
21374
21375 /// Removes all scopes, and no default scope will be used either.
21376 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21377 /// for details).
21378 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
21379 self._scopes.clear();
21380 self
21381 }
21382}
21383
21384/// Lists the node pools for a cluster.
21385///
21386/// A builder for the *zones.clusters.nodePools.list* method supported by a *project* resource.
21387/// It is not used directly, but through a [`ProjectMethods`] instance.
21388///
21389/// # Example
21390///
21391/// Instantiate a resource method builder
21392///
21393/// ```test_harness,no_run
21394/// # extern crate hyper;
21395/// # extern crate hyper_rustls;
21396/// # extern crate google_container1 as container1;
21397/// # async fn dox() {
21398/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21399///
21400/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21401/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21402/// # .with_native_roots()
21403/// # .unwrap()
21404/// # .https_only()
21405/// # .enable_http2()
21406/// # .build();
21407///
21408/// # let executor = hyper_util::rt::TokioExecutor::new();
21409/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21410/// # secret,
21411/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21412/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21413/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21414/// # ),
21415/// # ).build().await.unwrap();
21416///
21417/// # let client = hyper_util::client::legacy::Client::builder(
21418/// # hyper_util::rt::TokioExecutor::new()
21419/// # )
21420/// # .build(
21421/// # hyper_rustls::HttpsConnectorBuilder::new()
21422/// # .with_native_roots()
21423/// # .unwrap()
21424/// # .https_or_http()
21425/// # .enable_http2()
21426/// # .build()
21427/// # );
21428/// # let mut hub = Container::new(client, auth);
21429/// // You can configure optional parameters by calling the respective setters at will, and
21430/// // execute the final call using `doit()`.
21431/// // Values shown here are possibly random and not representative !
21432/// let result = hub.projects().zones_clusters_node_pools_list("projectId", "zone", "clusterId")
21433/// .parent("tempor")
21434/// .doit().await;
21435/// # }
21436/// ```
21437pub struct ProjectZoneClusterNodePoolListCall<'a, C>
21438where
21439 C: 'a,
21440{
21441 hub: &'a Container<C>,
21442 _project_id: String,
21443 _zone: String,
21444 _cluster_id: String,
21445 _parent: Option<String>,
21446 _delegate: Option<&'a mut dyn common::Delegate>,
21447 _additional_params: HashMap<String, String>,
21448 _scopes: BTreeSet<String>,
21449}
21450
21451impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolListCall<'a, C> {}
21452
21453impl<'a, C> ProjectZoneClusterNodePoolListCall<'a, C>
21454where
21455 C: common::Connector,
21456{
21457 /// Perform the operation you have build so far.
21458 pub async fn doit(mut self) -> common::Result<(common::Response, ListNodePoolsResponse)> {
21459 use std::borrow::Cow;
21460 use std::io::{Read, Seek};
21461
21462 use common::{url::Params, ToParts};
21463 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21464
21465 let mut dd = common::DefaultDelegate;
21466 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21467 dlg.begin(common::MethodInfo {
21468 id: "container.projects.zones.clusters.nodePools.list",
21469 http_method: hyper::Method::GET,
21470 });
21471
21472 for &field in ["alt", "projectId", "zone", "clusterId", "parent"].iter() {
21473 if self._additional_params.contains_key(field) {
21474 dlg.finished(false);
21475 return Err(common::Error::FieldClash(field));
21476 }
21477 }
21478
21479 let mut params = Params::with_capacity(6 + self._additional_params.len());
21480 params.push("projectId", self._project_id);
21481 params.push("zone", self._zone);
21482 params.push("clusterId", self._cluster_id);
21483 if let Some(value) = self._parent.as_ref() {
21484 params.push("parent", value);
21485 }
21486
21487 params.extend(self._additional_params.iter());
21488
21489 params.push("alt", "json");
21490 let mut url = self.hub._base_url.clone()
21491 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
21492 if self._scopes.is_empty() {
21493 self._scopes
21494 .insert(Scope::CloudPlatform.as_ref().to_string());
21495 }
21496
21497 #[allow(clippy::single_element_loop)]
21498 for &(find_this, param_name) in [
21499 ("{projectId}", "projectId"),
21500 ("{zone}", "zone"),
21501 ("{clusterId}", "clusterId"),
21502 ]
21503 .iter()
21504 {
21505 url = params.uri_replacement(url, param_name, find_this, false);
21506 }
21507 {
21508 let to_remove = ["clusterId", "zone", "projectId"];
21509 params.remove_params(&to_remove);
21510 }
21511
21512 let url = params.parse_with_url(&url);
21513
21514 loop {
21515 let token = match self
21516 .hub
21517 .auth
21518 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21519 .await
21520 {
21521 Ok(token) => token,
21522 Err(e) => match dlg.token(e) {
21523 Ok(token) => token,
21524 Err(e) => {
21525 dlg.finished(false);
21526 return Err(common::Error::MissingToken(e));
21527 }
21528 },
21529 };
21530 let mut req_result = {
21531 let client = &self.hub.client;
21532 dlg.pre_request();
21533 let mut req_builder = hyper::Request::builder()
21534 .method(hyper::Method::GET)
21535 .uri(url.as_str())
21536 .header(USER_AGENT, self.hub._user_agent.clone());
21537
21538 if let Some(token) = token.as_ref() {
21539 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21540 }
21541
21542 let request = req_builder
21543 .header(CONTENT_LENGTH, 0_u64)
21544 .body(common::to_body::<String>(None));
21545
21546 client.request(request.unwrap()).await
21547 };
21548
21549 match req_result {
21550 Err(err) => {
21551 if let common::Retry::After(d) = dlg.http_error(&err) {
21552 sleep(d).await;
21553 continue;
21554 }
21555 dlg.finished(false);
21556 return Err(common::Error::HttpError(err));
21557 }
21558 Ok(res) => {
21559 let (mut parts, body) = res.into_parts();
21560 let mut body = common::Body::new(body);
21561 if !parts.status.is_success() {
21562 let bytes = common::to_bytes(body).await.unwrap_or_default();
21563 let error = serde_json::from_str(&common::to_string(&bytes));
21564 let response = common::to_response(parts, bytes.into());
21565
21566 if let common::Retry::After(d) =
21567 dlg.http_failure(&response, error.as_ref().ok())
21568 {
21569 sleep(d).await;
21570 continue;
21571 }
21572
21573 dlg.finished(false);
21574
21575 return Err(match error {
21576 Ok(value) => common::Error::BadRequest(value),
21577 _ => common::Error::Failure(response),
21578 });
21579 }
21580 let response = {
21581 let bytes = common::to_bytes(body).await.unwrap_or_default();
21582 let encoded = common::to_string(&bytes);
21583 match serde_json::from_str(&encoded) {
21584 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21585 Err(error) => {
21586 dlg.response_json_decode_error(&encoded, &error);
21587 return Err(common::Error::JsonDecodeError(
21588 encoded.to_string(),
21589 error,
21590 ));
21591 }
21592 }
21593 };
21594
21595 dlg.finished(true);
21596 return Ok(response);
21597 }
21598 }
21599 }
21600 }
21601
21602 /// 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.
21603 ///
21604 /// Sets the *project id* path property to the given value.
21605 ///
21606 /// Even though the property as already been set when instantiating this call,
21607 /// we provide this method for API completeness.
21608 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
21609 self._project_id = new_value.to_string();
21610 self
21611 }
21612 /// 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.
21613 ///
21614 /// Sets the *zone* path property to the given value.
21615 ///
21616 /// Even though the property as already been set when instantiating this call,
21617 /// we provide this method for API completeness.
21618 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
21619 self._zone = new_value.to_string();
21620 self
21621 }
21622 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
21623 ///
21624 /// Sets the *cluster id* path property to the given value.
21625 ///
21626 /// Even though the property as already been set when instantiating this call,
21627 /// we provide this method for API completeness.
21628 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
21629 self._cluster_id = new_value.to_string();
21630 self
21631 }
21632 /// The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
21633 ///
21634 /// Sets the *parent* query property to the given value.
21635 pub fn parent(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
21636 self._parent = Some(new_value.to_string());
21637 self
21638 }
21639 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
21640 /// while executing the actual API request.
21641 ///
21642 /// ````text
21643 /// It should be used to handle progress information, and to implement a certain level of resilience.
21644 /// ````
21645 ///
21646 /// Sets the *delegate* property to the given value.
21647 pub fn delegate(
21648 mut self,
21649 new_value: &'a mut dyn common::Delegate,
21650 ) -> ProjectZoneClusterNodePoolListCall<'a, C> {
21651 self._delegate = Some(new_value);
21652 self
21653 }
21654
21655 /// Set any additional parameter of the query string used in the request.
21656 /// It should be used to set parameters which are not yet available through their own
21657 /// setters.
21658 ///
21659 /// Please note that this method must not be used to set any of the known parameters
21660 /// which have their own setter method. If done anyway, the request will fail.
21661 ///
21662 /// # Additional Parameters
21663 ///
21664 /// * *$.xgafv* (query-string) - V1 error format.
21665 /// * *access_token* (query-string) - OAuth access token.
21666 /// * *alt* (query-string) - Data format for response.
21667 /// * *callback* (query-string) - JSONP
21668 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
21669 /// * *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.
21670 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
21671 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
21672 /// * *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.
21673 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
21674 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
21675 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolListCall<'a, C>
21676 where
21677 T: AsRef<str>,
21678 {
21679 self._additional_params
21680 .insert(name.as_ref().to_string(), value.as_ref().to_string());
21681 self
21682 }
21683
21684 /// Identifies the authorization scope for the method you are building.
21685 ///
21686 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
21687 /// [`Scope::CloudPlatform`].
21688 ///
21689 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
21690 /// tokens for more than one scope.
21691 ///
21692 /// Usually there is more than one suitable scope to authorize an operation, some of which may
21693 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
21694 /// sufficient, a read-write scope will do as well.
21695 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolListCall<'a, C>
21696 where
21697 St: AsRef<str>,
21698 {
21699 self._scopes.insert(String::from(scope.as_ref()));
21700 self
21701 }
21702 /// Identifies the authorization scope(s) for the method you are building.
21703 ///
21704 /// See [`Self::add_scope()`] for details.
21705 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolListCall<'a, C>
21706 where
21707 I: IntoIterator<Item = St>,
21708 St: AsRef<str>,
21709 {
21710 self._scopes
21711 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
21712 self
21713 }
21714
21715 /// Removes all scopes, and no default scope will be used either.
21716 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
21717 /// for details).
21718 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolListCall<'a, C> {
21719 self._scopes.clear();
21720 self
21721 }
21722}
21723
21724/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
21725///
21726/// A builder for the *zones.clusters.nodePools.rollback* method supported by a *project* resource.
21727/// It is not used directly, but through a [`ProjectMethods`] instance.
21728///
21729/// # Example
21730///
21731/// Instantiate a resource method builder
21732///
21733/// ```test_harness,no_run
21734/// # extern crate hyper;
21735/// # extern crate hyper_rustls;
21736/// # extern crate google_container1 as container1;
21737/// use container1::api::RollbackNodePoolUpgradeRequest;
21738/// # async fn dox() {
21739/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
21740///
21741/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
21742/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
21743/// # .with_native_roots()
21744/// # .unwrap()
21745/// # .https_only()
21746/// # .enable_http2()
21747/// # .build();
21748///
21749/// # let executor = hyper_util::rt::TokioExecutor::new();
21750/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
21751/// # secret,
21752/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
21753/// # yup_oauth2::client::CustomHyperClientBuilder::from(
21754/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
21755/// # ),
21756/// # ).build().await.unwrap();
21757///
21758/// # let client = hyper_util::client::legacy::Client::builder(
21759/// # hyper_util::rt::TokioExecutor::new()
21760/// # )
21761/// # .build(
21762/// # hyper_rustls::HttpsConnectorBuilder::new()
21763/// # .with_native_roots()
21764/// # .unwrap()
21765/// # .https_or_http()
21766/// # .enable_http2()
21767/// # .build()
21768/// # );
21769/// # let mut hub = Container::new(client, auth);
21770/// // As the method needs a request, you would usually fill it with the desired information
21771/// // into the respective structure. Some of the parts shown here might not be applicable !
21772/// // Values shown here are possibly random and not representative !
21773/// let mut req = RollbackNodePoolUpgradeRequest::default();
21774///
21775/// // You can configure optional parameters by calling the respective setters at will, and
21776/// // execute the final call using `doit()`.
21777/// // Values shown here are possibly random and not representative !
21778/// let result = hub.projects().zones_clusters_node_pools_rollback(req, "projectId", "zone", "clusterId", "nodePoolId")
21779/// .doit().await;
21780/// # }
21781/// ```
21782pub struct ProjectZoneClusterNodePoolRollbackCall<'a, C>
21783where
21784 C: 'a,
21785{
21786 hub: &'a Container<C>,
21787 _request: RollbackNodePoolUpgradeRequest,
21788 _project_id: String,
21789 _zone: String,
21790 _cluster_id: String,
21791 _node_pool_id: String,
21792 _delegate: Option<&'a mut dyn common::Delegate>,
21793 _additional_params: HashMap<String, String>,
21794 _scopes: BTreeSet<String>,
21795}
21796
21797impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolRollbackCall<'a, C> {}
21798
21799impl<'a, C> ProjectZoneClusterNodePoolRollbackCall<'a, C>
21800where
21801 C: common::Connector,
21802{
21803 /// Perform the operation you have build so far.
21804 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
21805 use std::borrow::Cow;
21806 use std::io::{Read, Seek};
21807
21808 use common::{url::Params, ToParts};
21809 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
21810
21811 let mut dd = common::DefaultDelegate;
21812 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
21813 dlg.begin(common::MethodInfo {
21814 id: "container.projects.zones.clusters.nodePools.rollback",
21815 http_method: hyper::Method::POST,
21816 });
21817
21818 for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
21819 if self._additional_params.contains_key(field) {
21820 dlg.finished(false);
21821 return Err(common::Error::FieldClash(field));
21822 }
21823 }
21824
21825 let mut params = Params::with_capacity(7 + self._additional_params.len());
21826 params.push("projectId", self._project_id);
21827 params.push("zone", self._zone);
21828 params.push("clusterId", self._cluster_id);
21829 params.push("nodePoolId", self._node_pool_id);
21830
21831 params.extend(self._additional_params.iter());
21832
21833 params.push("alt", "json");
21834 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}:rollback";
21835 if self._scopes.is_empty() {
21836 self._scopes
21837 .insert(Scope::CloudPlatform.as_ref().to_string());
21838 }
21839
21840 #[allow(clippy::single_element_loop)]
21841 for &(find_this, param_name) in [
21842 ("{projectId}", "projectId"),
21843 ("{zone}", "zone"),
21844 ("{clusterId}", "clusterId"),
21845 ("{nodePoolId}", "nodePoolId"),
21846 ]
21847 .iter()
21848 {
21849 url = params.uri_replacement(url, param_name, find_this, false);
21850 }
21851 {
21852 let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
21853 params.remove_params(&to_remove);
21854 }
21855
21856 let url = params.parse_with_url(&url);
21857
21858 let mut json_mime_type = mime::APPLICATION_JSON;
21859 let mut request_value_reader = {
21860 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
21861 common::remove_json_null_values(&mut value);
21862 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
21863 serde_json::to_writer(&mut dst, &value).unwrap();
21864 dst
21865 };
21866 let request_size = request_value_reader
21867 .seek(std::io::SeekFrom::End(0))
21868 .unwrap();
21869 request_value_reader
21870 .seek(std::io::SeekFrom::Start(0))
21871 .unwrap();
21872
21873 loop {
21874 let token = match self
21875 .hub
21876 .auth
21877 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
21878 .await
21879 {
21880 Ok(token) => token,
21881 Err(e) => match dlg.token(e) {
21882 Ok(token) => token,
21883 Err(e) => {
21884 dlg.finished(false);
21885 return Err(common::Error::MissingToken(e));
21886 }
21887 },
21888 };
21889 request_value_reader
21890 .seek(std::io::SeekFrom::Start(0))
21891 .unwrap();
21892 let mut req_result = {
21893 let client = &self.hub.client;
21894 dlg.pre_request();
21895 let mut req_builder = hyper::Request::builder()
21896 .method(hyper::Method::POST)
21897 .uri(url.as_str())
21898 .header(USER_AGENT, self.hub._user_agent.clone());
21899
21900 if let Some(token) = token.as_ref() {
21901 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
21902 }
21903
21904 let request = req_builder
21905 .header(CONTENT_TYPE, json_mime_type.to_string())
21906 .header(CONTENT_LENGTH, request_size as u64)
21907 .body(common::to_body(
21908 request_value_reader.get_ref().clone().into(),
21909 ));
21910
21911 client.request(request.unwrap()).await
21912 };
21913
21914 match req_result {
21915 Err(err) => {
21916 if let common::Retry::After(d) = dlg.http_error(&err) {
21917 sleep(d).await;
21918 continue;
21919 }
21920 dlg.finished(false);
21921 return Err(common::Error::HttpError(err));
21922 }
21923 Ok(res) => {
21924 let (mut parts, body) = res.into_parts();
21925 let mut body = common::Body::new(body);
21926 if !parts.status.is_success() {
21927 let bytes = common::to_bytes(body).await.unwrap_or_default();
21928 let error = serde_json::from_str(&common::to_string(&bytes));
21929 let response = common::to_response(parts, bytes.into());
21930
21931 if let common::Retry::After(d) =
21932 dlg.http_failure(&response, error.as_ref().ok())
21933 {
21934 sleep(d).await;
21935 continue;
21936 }
21937
21938 dlg.finished(false);
21939
21940 return Err(match error {
21941 Ok(value) => common::Error::BadRequest(value),
21942 _ => common::Error::Failure(response),
21943 });
21944 }
21945 let response = {
21946 let bytes = common::to_bytes(body).await.unwrap_or_default();
21947 let encoded = common::to_string(&bytes);
21948 match serde_json::from_str(&encoded) {
21949 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
21950 Err(error) => {
21951 dlg.response_json_decode_error(&encoded, &error);
21952 return Err(common::Error::JsonDecodeError(
21953 encoded.to_string(),
21954 error,
21955 ));
21956 }
21957 }
21958 };
21959
21960 dlg.finished(true);
21961 return Ok(response);
21962 }
21963 }
21964 }
21965 }
21966
21967 ///
21968 /// Sets the *request* property to the given value.
21969 ///
21970 /// Even though the property as already been set when instantiating this call,
21971 /// we provide this method for API completeness.
21972 pub fn request(
21973 mut self,
21974 new_value: RollbackNodePoolUpgradeRequest,
21975 ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
21976 self._request = new_value;
21977 self
21978 }
21979 /// 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.
21980 ///
21981 /// Sets the *project id* path property to the given value.
21982 ///
21983 /// Even though the property as already been set when instantiating this call,
21984 /// we provide this method for API completeness.
21985 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
21986 self._project_id = new_value.to_string();
21987 self
21988 }
21989 /// 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.
21990 ///
21991 /// Sets the *zone* path property to the given value.
21992 ///
21993 /// Even though the property as already been set when instantiating this call,
21994 /// we provide this method for API completeness.
21995 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
21996 self._zone = new_value.to_string();
21997 self
21998 }
21999 /// Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
22000 ///
22001 /// Sets the *cluster id* path property to the given value.
22002 ///
22003 /// Even though the property as already been set when instantiating this call,
22004 /// we provide this method for API completeness.
22005 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
22006 self._cluster_id = new_value.to_string();
22007 self
22008 }
22009 /// Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
22010 ///
22011 /// Sets the *node pool id* path property to the given value.
22012 ///
22013 /// Even though the property as already been set when instantiating this call,
22014 /// we provide this method for API completeness.
22015 pub fn node_pool_id(
22016 mut self,
22017 new_value: &str,
22018 ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
22019 self._node_pool_id = new_value.to_string();
22020 self
22021 }
22022 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22023 /// while executing the actual API request.
22024 ///
22025 /// ````text
22026 /// It should be used to handle progress information, and to implement a certain level of resilience.
22027 /// ````
22028 ///
22029 /// Sets the *delegate* property to the given value.
22030 pub fn delegate(
22031 mut self,
22032 new_value: &'a mut dyn common::Delegate,
22033 ) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
22034 self._delegate = Some(new_value);
22035 self
22036 }
22037
22038 /// Set any additional parameter of the query string used in the request.
22039 /// It should be used to set parameters which are not yet available through their own
22040 /// setters.
22041 ///
22042 /// Please note that this method must not be used to set any of the known parameters
22043 /// which have their own setter method. If done anyway, the request will fail.
22044 ///
22045 /// # Additional Parameters
22046 ///
22047 /// * *$.xgafv* (query-string) - V1 error format.
22048 /// * *access_token* (query-string) - OAuth access token.
22049 /// * *alt* (query-string) - Data format for response.
22050 /// * *callback* (query-string) - JSONP
22051 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22052 /// * *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.
22053 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22054 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22055 /// * *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.
22056 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22057 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22058 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
22059 where
22060 T: AsRef<str>,
22061 {
22062 self._additional_params
22063 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22064 self
22065 }
22066
22067 /// Identifies the authorization scope for the method you are building.
22068 ///
22069 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22070 /// [`Scope::CloudPlatform`].
22071 ///
22072 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22073 /// tokens for more than one scope.
22074 ///
22075 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22076 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22077 /// sufficient, a read-write scope will do as well.
22078 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
22079 where
22080 St: AsRef<str>,
22081 {
22082 self._scopes.insert(String::from(scope.as_ref()));
22083 self
22084 }
22085 /// Identifies the authorization scope(s) for the method you are building.
22086 ///
22087 /// See [`Self::add_scope()`] for details.
22088 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
22089 where
22090 I: IntoIterator<Item = St>,
22091 St: AsRef<str>,
22092 {
22093 self._scopes
22094 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22095 self
22096 }
22097
22098 /// Removes all scopes, and no default scope will be used either.
22099 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22100 /// for details).
22101 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
22102 self._scopes.clear();
22103 self
22104 }
22105}
22106
22107/// Sets the NodeManagement options for a node pool.
22108///
22109/// A builder for the *zones.clusters.nodePools.setManagement* method supported by a *project* resource.
22110/// It is not used directly, but through a [`ProjectMethods`] instance.
22111///
22112/// # Example
22113///
22114/// Instantiate a resource method builder
22115///
22116/// ```test_harness,no_run
22117/// # extern crate hyper;
22118/// # extern crate hyper_rustls;
22119/// # extern crate google_container1 as container1;
22120/// use container1::api::SetNodePoolManagementRequest;
22121/// # async fn dox() {
22122/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22123///
22124/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22125/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22126/// # .with_native_roots()
22127/// # .unwrap()
22128/// # .https_only()
22129/// # .enable_http2()
22130/// # .build();
22131///
22132/// # let executor = hyper_util::rt::TokioExecutor::new();
22133/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22134/// # secret,
22135/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22136/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22137/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22138/// # ),
22139/// # ).build().await.unwrap();
22140///
22141/// # let client = hyper_util::client::legacy::Client::builder(
22142/// # hyper_util::rt::TokioExecutor::new()
22143/// # )
22144/// # .build(
22145/// # hyper_rustls::HttpsConnectorBuilder::new()
22146/// # .with_native_roots()
22147/// # .unwrap()
22148/// # .https_or_http()
22149/// # .enable_http2()
22150/// # .build()
22151/// # );
22152/// # let mut hub = Container::new(client, auth);
22153/// // As the method needs a request, you would usually fill it with the desired information
22154/// // into the respective structure. Some of the parts shown here might not be applicable !
22155/// // Values shown here are possibly random and not representative !
22156/// let mut req = SetNodePoolManagementRequest::default();
22157///
22158/// // You can configure optional parameters by calling the respective setters at will, and
22159/// // execute the final call using `doit()`.
22160/// // Values shown here are possibly random and not representative !
22161/// let result = hub.projects().zones_clusters_node_pools_set_management(req, "projectId", "zone", "clusterId", "nodePoolId")
22162/// .doit().await;
22163/// # }
22164/// ```
22165pub struct ProjectZoneClusterNodePoolSetManagementCall<'a, C>
22166where
22167 C: 'a,
22168{
22169 hub: &'a Container<C>,
22170 _request: SetNodePoolManagementRequest,
22171 _project_id: String,
22172 _zone: String,
22173 _cluster_id: String,
22174 _node_pool_id: String,
22175 _delegate: Option<&'a mut dyn common::Delegate>,
22176 _additional_params: HashMap<String, String>,
22177 _scopes: BTreeSet<String>,
22178}
22179
22180impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolSetManagementCall<'a, C> {}
22181
22182impl<'a, C> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
22183where
22184 C: common::Connector,
22185{
22186 /// Perform the operation you have build so far.
22187 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22188 use std::borrow::Cow;
22189 use std::io::{Read, Seek};
22190
22191 use common::{url::Params, ToParts};
22192 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22193
22194 let mut dd = common::DefaultDelegate;
22195 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22196 dlg.begin(common::MethodInfo {
22197 id: "container.projects.zones.clusters.nodePools.setManagement",
22198 http_method: hyper::Method::POST,
22199 });
22200
22201 for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
22202 if self._additional_params.contains_key(field) {
22203 dlg.finished(false);
22204 return Err(common::Error::FieldClash(field));
22205 }
22206 }
22207
22208 let mut params = Params::with_capacity(7 + self._additional_params.len());
22209 params.push("projectId", self._project_id);
22210 params.push("zone", self._zone);
22211 params.push("clusterId", self._cluster_id);
22212 params.push("nodePoolId", self._node_pool_id);
22213
22214 params.extend(self._additional_params.iter());
22215
22216 params.push("alt", "json");
22217 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setManagement";
22218 if self._scopes.is_empty() {
22219 self._scopes
22220 .insert(Scope::CloudPlatform.as_ref().to_string());
22221 }
22222
22223 #[allow(clippy::single_element_loop)]
22224 for &(find_this, param_name) in [
22225 ("{projectId}", "projectId"),
22226 ("{zone}", "zone"),
22227 ("{clusterId}", "clusterId"),
22228 ("{nodePoolId}", "nodePoolId"),
22229 ]
22230 .iter()
22231 {
22232 url = params.uri_replacement(url, param_name, find_this, false);
22233 }
22234 {
22235 let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
22236 params.remove_params(&to_remove);
22237 }
22238
22239 let url = params.parse_with_url(&url);
22240
22241 let mut json_mime_type = mime::APPLICATION_JSON;
22242 let mut request_value_reader = {
22243 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22244 common::remove_json_null_values(&mut value);
22245 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22246 serde_json::to_writer(&mut dst, &value).unwrap();
22247 dst
22248 };
22249 let request_size = request_value_reader
22250 .seek(std::io::SeekFrom::End(0))
22251 .unwrap();
22252 request_value_reader
22253 .seek(std::io::SeekFrom::Start(0))
22254 .unwrap();
22255
22256 loop {
22257 let token = match self
22258 .hub
22259 .auth
22260 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22261 .await
22262 {
22263 Ok(token) => token,
22264 Err(e) => match dlg.token(e) {
22265 Ok(token) => token,
22266 Err(e) => {
22267 dlg.finished(false);
22268 return Err(common::Error::MissingToken(e));
22269 }
22270 },
22271 };
22272 request_value_reader
22273 .seek(std::io::SeekFrom::Start(0))
22274 .unwrap();
22275 let mut req_result = {
22276 let client = &self.hub.client;
22277 dlg.pre_request();
22278 let mut req_builder = hyper::Request::builder()
22279 .method(hyper::Method::POST)
22280 .uri(url.as_str())
22281 .header(USER_AGENT, self.hub._user_agent.clone());
22282
22283 if let Some(token) = token.as_ref() {
22284 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22285 }
22286
22287 let request = req_builder
22288 .header(CONTENT_TYPE, json_mime_type.to_string())
22289 .header(CONTENT_LENGTH, request_size as u64)
22290 .body(common::to_body(
22291 request_value_reader.get_ref().clone().into(),
22292 ));
22293
22294 client.request(request.unwrap()).await
22295 };
22296
22297 match req_result {
22298 Err(err) => {
22299 if let common::Retry::After(d) = dlg.http_error(&err) {
22300 sleep(d).await;
22301 continue;
22302 }
22303 dlg.finished(false);
22304 return Err(common::Error::HttpError(err));
22305 }
22306 Ok(res) => {
22307 let (mut parts, body) = res.into_parts();
22308 let mut body = common::Body::new(body);
22309 if !parts.status.is_success() {
22310 let bytes = common::to_bytes(body).await.unwrap_or_default();
22311 let error = serde_json::from_str(&common::to_string(&bytes));
22312 let response = common::to_response(parts, bytes.into());
22313
22314 if let common::Retry::After(d) =
22315 dlg.http_failure(&response, error.as_ref().ok())
22316 {
22317 sleep(d).await;
22318 continue;
22319 }
22320
22321 dlg.finished(false);
22322
22323 return Err(match error {
22324 Ok(value) => common::Error::BadRequest(value),
22325 _ => common::Error::Failure(response),
22326 });
22327 }
22328 let response = {
22329 let bytes = common::to_bytes(body).await.unwrap_or_default();
22330 let encoded = common::to_string(&bytes);
22331 match serde_json::from_str(&encoded) {
22332 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22333 Err(error) => {
22334 dlg.response_json_decode_error(&encoded, &error);
22335 return Err(common::Error::JsonDecodeError(
22336 encoded.to_string(),
22337 error,
22338 ));
22339 }
22340 }
22341 };
22342
22343 dlg.finished(true);
22344 return Ok(response);
22345 }
22346 }
22347 }
22348 }
22349
22350 ///
22351 /// Sets the *request* property to the given value.
22352 ///
22353 /// Even though the property as already been set when instantiating this call,
22354 /// we provide this method for API completeness.
22355 pub fn request(
22356 mut self,
22357 new_value: SetNodePoolManagementRequest,
22358 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
22359 self._request = new_value;
22360 self
22361 }
22362 /// 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.
22363 ///
22364 /// Sets the *project id* path property to the given value.
22365 ///
22366 /// Even though the property as already been set when instantiating this call,
22367 /// we provide this method for API completeness.
22368 pub fn project_id(
22369 mut self,
22370 new_value: &str,
22371 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
22372 self._project_id = new_value.to_string();
22373 self
22374 }
22375 /// 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.
22376 ///
22377 /// Sets the *zone* path property to the given value.
22378 ///
22379 /// Even though the property as already been set when instantiating this call,
22380 /// we provide this method for API completeness.
22381 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
22382 self._zone = new_value.to_string();
22383 self
22384 }
22385 /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
22386 ///
22387 /// Sets the *cluster id* path property to the given value.
22388 ///
22389 /// Even though the property as already been set when instantiating this call,
22390 /// we provide this method for API completeness.
22391 pub fn cluster_id(
22392 mut self,
22393 new_value: &str,
22394 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
22395 self._cluster_id = new_value.to_string();
22396 self
22397 }
22398 /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
22399 ///
22400 /// Sets the *node pool id* path property to the given value.
22401 ///
22402 /// Even though the property as already been set when instantiating this call,
22403 /// we provide this method for API completeness.
22404 pub fn node_pool_id(
22405 mut self,
22406 new_value: &str,
22407 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
22408 self._node_pool_id = new_value.to_string();
22409 self
22410 }
22411 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22412 /// while executing the actual API request.
22413 ///
22414 /// ````text
22415 /// It should be used to handle progress information, and to implement a certain level of resilience.
22416 /// ````
22417 ///
22418 /// Sets the *delegate* property to the given value.
22419 pub fn delegate(
22420 mut self,
22421 new_value: &'a mut dyn common::Delegate,
22422 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
22423 self._delegate = Some(new_value);
22424 self
22425 }
22426
22427 /// Set any additional parameter of the query string used in the request.
22428 /// It should be used to set parameters which are not yet available through their own
22429 /// setters.
22430 ///
22431 /// Please note that this method must not be used to set any of the known parameters
22432 /// which have their own setter method. If done anyway, the request will fail.
22433 ///
22434 /// # Additional Parameters
22435 ///
22436 /// * *$.xgafv* (query-string) - V1 error format.
22437 /// * *access_token* (query-string) - OAuth access token.
22438 /// * *alt* (query-string) - Data format for response.
22439 /// * *callback* (query-string) - JSONP
22440 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22441 /// * *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.
22442 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22443 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22444 /// * *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.
22445 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22446 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22447 pub fn param<T>(
22448 mut self,
22449 name: T,
22450 value: T,
22451 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
22452 where
22453 T: AsRef<str>,
22454 {
22455 self._additional_params
22456 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22457 self
22458 }
22459
22460 /// Identifies the authorization scope for the method you are building.
22461 ///
22462 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22463 /// [`Scope::CloudPlatform`].
22464 ///
22465 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22466 /// tokens for more than one scope.
22467 ///
22468 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22469 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22470 /// sufficient, a read-write scope will do as well.
22471 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
22472 where
22473 St: AsRef<str>,
22474 {
22475 self._scopes.insert(String::from(scope.as_ref()));
22476 self
22477 }
22478 /// Identifies the authorization scope(s) for the method you are building.
22479 ///
22480 /// See [`Self::add_scope()`] for details.
22481 pub fn add_scopes<I, St>(
22482 mut self,
22483 scopes: I,
22484 ) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
22485 where
22486 I: IntoIterator<Item = St>,
22487 St: AsRef<str>,
22488 {
22489 self._scopes
22490 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22491 self
22492 }
22493
22494 /// Removes all scopes, and no default scope will be used either.
22495 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22496 /// for details).
22497 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
22498 self._scopes.clear();
22499 self
22500 }
22501}
22502
22503/// 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.
22504///
22505/// A builder for the *zones.clusters.nodePools.setSize* method supported by a *project* resource.
22506/// It is not used directly, but through a [`ProjectMethods`] instance.
22507///
22508/// # Example
22509///
22510/// Instantiate a resource method builder
22511///
22512/// ```test_harness,no_run
22513/// # extern crate hyper;
22514/// # extern crate hyper_rustls;
22515/// # extern crate google_container1 as container1;
22516/// use container1::api::SetNodePoolSizeRequest;
22517/// # async fn dox() {
22518/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22519///
22520/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22521/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22522/// # .with_native_roots()
22523/// # .unwrap()
22524/// # .https_only()
22525/// # .enable_http2()
22526/// # .build();
22527///
22528/// # let executor = hyper_util::rt::TokioExecutor::new();
22529/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22530/// # secret,
22531/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22532/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22533/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22534/// # ),
22535/// # ).build().await.unwrap();
22536///
22537/// # let client = hyper_util::client::legacy::Client::builder(
22538/// # hyper_util::rt::TokioExecutor::new()
22539/// # )
22540/// # .build(
22541/// # hyper_rustls::HttpsConnectorBuilder::new()
22542/// # .with_native_roots()
22543/// # .unwrap()
22544/// # .https_or_http()
22545/// # .enable_http2()
22546/// # .build()
22547/// # );
22548/// # let mut hub = Container::new(client, auth);
22549/// // As the method needs a request, you would usually fill it with the desired information
22550/// // into the respective structure. Some of the parts shown here might not be applicable !
22551/// // Values shown here are possibly random and not representative !
22552/// let mut req = SetNodePoolSizeRequest::default();
22553///
22554/// // You can configure optional parameters by calling the respective setters at will, and
22555/// // execute the final call using `doit()`.
22556/// // Values shown here are possibly random and not representative !
22557/// let result = hub.projects().zones_clusters_node_pools_set_size(req, "projectId", "zone", "clusterId", "nodePoolId")
22558/// .doit().await;
22559/// # }
22560/// ```
22561pub struct ProjectZoneClusterNodePoolSetSizeCall<'a, C>
22562where
22563 C: 'a,
22564{
22565 hub: &'a Container<C>,
22566 _request: SetNodePoolSizeRequest,
22567 _project_id: String,
22568 _zone: String,
22569 _cluster_id: String,
22570 _node_pool_id: String,
22571 _delegate: Option<&'a mut dyn common::Delegate>,
22572 _additional_params: HashMap<String, String>,
22573 _scopes: BTreeSet<String>,
22574}
22575
22576impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolSetSizeCall<'a, C> {}
22577
22578impl<'a, C> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
22579where
22580 C: common::Connector,
22581{
22582 /// Perform the operation you have build so far.
22583 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22584 use std::borrow::Cow;
22585 use std::io::{Read, Seek};
22586
22587 use common::{url::Params, ToParts};
22588 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22589
22590 let mut dd = common::DefaultDelegate;
22591 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22592 dlg.begin(common::MethodInfo {
22593 id: "container.projects.zones.clusters.nodePools.setSize",
22594 http_method: hyper::Method::POST,
22595 });
22596
22597 for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
22598 if self._additional_params.contains_key(field) {
22599 dlg.finished(false);
22600 return Err(common::Error::FieldClash(field));
22601 }
22602 }
22603
22604 let mut params = Params::with_capacity(7 + self._additional_params.len());
22605 params.push("projectId", self._project_id);
22606 params.push("zone", self._zone);
22607 params.push("clusterId", self._cluster_id);
22608 params.push("nodePoolId", self._node_pool_id);
22609
22610 params.extend(self._additional_params.iter());
22611
22612 params.push("alt", "json");
22613 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setSize";
22614 if self._scopes.is_empty() {
22615 self._scopes
22616 .insert(Scope::CloudPlatform.as_ref().to_string());
22617 }
22618
22619 #[allow(clippy::single_element_loop)]
22620 for &(find_this, param_name) in [
22621 ("{projectId}", "projectId"),
22622 ("{zone}", "zone"),
22623 ("{clusterId}", "clusterId"),
22624 ("{nodePoolId}", "nodePoolId"),
22625 ]
22626 .iter()
22627 {
22628 url = params.uri_replacement(url, param_name, find_this, false);
22629 }
22630 {
22631 let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
22632 params.remove_params(&to_remove);
22633 }
22634
22635 let url = params.parse_with_url(&url);
22636
22637 let mut json_mime_type = mime::APPLICATION_JSON;
22638 let mut request_value_reader = {
22639 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
22640 common::remove_json_null_values(&mut value);
22641 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
22642 serde_json::to_writer(&mut dst, &value).unwrap();
22643 dst
22644 };
22645 let request_size = request_value_reader
22646 .seek(std::io::SeekFrom::End(0))
22647 .unwrap();
22648 request_value_reader
22649 .seek(std::io::SeekFrom::Start(0))
22650 .unwrap();
22651
22652 loop {
22653 let token = match self
22654 .hub
22655 .auth
22656 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
22657 .await
22658 {
22659 Ok(token) => token,
22660 Err(e) => match dlg.token(e) {
22661 Ok(token) => token,
22662 Err(e) => {
22663 dlg.finished(false);
22664 return Err(common::Error::MissingToken(e));
22665 }
22666 },
22667 };
22668 request_value_reader
22669 .seek(std::io::SeekFrom::Start(0))
22670 .unwrap();
22671 let mut req_result = {
22672 let client = &self.hub.client;
22673 dlg.pre_request();
22674 let mut req_builder = hyper::Request::builder()
22675 .method(hyper::Method::POST)
22676 .uri(url.as_str())
22677 .header(USER_AGENT, self.hub._user_agent.clone());
22678
22679 if let Some(token) = token.as_ref() {
22680 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
22681 }
22682
22683 let request = req_builder
22684 .header(CONTENT_TYPE, json_mime_type.to_string())
22685 .header(CONTENT_LENGTH, request_size as u64)
22686 .body(common::to_body(
22687 request_value_reader.get_ref().clone().into(),
22688 ));
22689
22690 client.request(request.unwrap()).await
22691 };
22692
22693 match req_result {
22694 Err(err) => {
22695 if let common::Retry::After(d) = dlg.http_error(&err) {
22696 sleep(d).await;
22697 continue;
22698 }
22699 dlg.finished(false);
22700 return Err(common::Error::HttpError(err));
22701 }
22702 Ok(res) => {
22703 let (mut parts, body) = res.into_parts();
22704 let mut body = common::Body::new(body);
22705 if !parts.status.is_success() {
22706 let bytes = common::to_bytes(body).await.unwrap_or_default();
22707 let error = serde_json::from_str(&common::to_string(&bytes));
22708 let response = common::to_response(parts, bytes.into());
22709
22710 if let common::Retry::After(d) =
22711 dlg.http_failure(&response, error.as_ref().ok())
22712 {
22713 sleep(d).await;
22714 continue;
22715 }
22716
22717 dlg.finished(false);
22718
22719 return Err(match error {
22720 Ok(value) => common::Error::BadRequest(value),
22721 _ => common::Error::Failure(response),
22722 });
22723 }
22724 let response = {
22725 let bytes = common::to_bytes(body).await.unwrap_or_default();
22726 let encoded = common::to_string(&bytes);
22727 match serde_json::from_str(&encoded) {
22728 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
22729 Err(error) => {
22730 dlg.response_json_decode_error(&encoded, &error);
22731 return Err(common::Error::JsonDecodeError(
22732 encoded.to_string(),
22733 error,
22734 ));
22735 }
22736 }
22737 };
22738
22739 dlg.finished(true);
22740 return Ok(response);
22741 }
22742 }
22743 }
22744 }
22745
22746 ///
22747 /// Sets the *request* property to the given value.
22748 ///
22749 /// Even though the property as already been set when instantiating this call,
22750 /// we provide this method for API completeness.
22751 pub fn request(
22752 mut self,
22753 new_value: SetNodePoolSizeRequest,
22754 ) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
22755 self._request = new_value;
22756 self
22757 }
22758 /// 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.
22759 ///
22760 /// Sets the *project id* path property to the given value.
22761 ///
22762 /// Even though the property as already been set when instantiating this call,
22763 /// we provide this method for API completeness.
22764 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
22765 self._project_id = new_value.to_string();
22766 self
22767 }
22768 /// 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.
22769 ///
22770 /// Sets the *zone* path property to the given value.
22771 ///
22772 /// Even though the property as already been set when instantiating this call,
22773 /// we provide this method for API completeness.
22774 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
22775 self._zone = new_value.to_string();
22776 self
22777 }
22778 /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
22779 ///
22780 /// Sets the *cluster id* path property to the given value.
22781 ///
22782 /// Even though the property as already been set when instantiating this call,
22783 /// we provide this method for API completeness.
22784 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
22785 self._cluster_id = new_value.to_string();
22786 self
22787 }
22788 /// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
22789 ///
22790 /// Sets the *node pool id* path property to the given value.
22791 ///
22792 /// Even though the property as already been set when instantiating this call,
22793 /// we provide this method for API completeness.
22794 pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
22795 self._node_pool_id = new_value.to_string();
22796 self
22797 }
22798 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
22799 /// while executing the actual API request.
22800 ///
22801 /// ````text
22802 /// It should be used to handle progress information, and to implement a certain level of resilience.
22803 /// ````
22804 ///
22805 /// Sets the *delegate* property to the given value.
22806 pub fn delegate(
22807 mut self,
22808 new_value: &'a mut dyn common::Delegate,
22809 ) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
22810 self._delegate = Some(new_value);
22811 self
22812 }
22813
22814 /// Set any additional parameter of the query string used in the request.
22815 /// It should be used to set parameters which are not yet available through their own
22816 /// setters.
22817 ///
22818 /// Please note that this method must not be used to set any of the known parameters
22819 /// which have their own setter method. If done anyway, the request will fail.
22820 ///
22821 /// # Additional Parameters
22822 ///
22823 /// * *$.xgafv* (query-string) - V1 error format.
22824 /// * *access_token* (query-string) - OAuth access token.
22825 /// * *alt* (query-string) - Data format for response.
22826 /// * *callback* (query-string) - JSONP
22827 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
22828 /// * *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.
22829 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
22830 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
22831 /// * *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.
22832 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
22833 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
22834 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
22835 where
22836 T: AsRef<str>,
22837 {
22838 self._additional_params
22839 .insert(name.as_ref().to_string(), value.as_ref().to_string());
22840 self
22841 }
22842
22843 /// Identifies the authorization scope for the method you are building.
22844 ///
22845 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
22846 /// [`Scope::CloudPlatform`].
22847 ///
22848 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
22849 /// tokens for more than one scope.
22850 ///
22851 /// Usually there is more than one suitable scope to authorize an operation, some of which may
22852 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
22853 /// sufficient, a read-write scope will do as well.
22854 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
22855 where
22856 St: AsRef<str>,
22857 {
22858 self._scopes.insert(String::from(scope.as_ref()));
22859 self
22860 }
22861 /// Identifies the authorization scope(s) for the method you are building.
22862 ///
22863 /// See [`Self::add_scope()`] for details.
22864 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
22865 where
22866 I: IntoIterator<Item = St>,
22867 St: AsRef<str>,
22868 {
22869 self._scopes
22870 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
22871 self
22872 }
22873
22874 /// Removes all scopes, and no default scope will be used either.
22875 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
22876 /// for details).
22877 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
22878 self._scopes.clear();
22879 self
22880 }
22881}
22882
22883/// Updates the version and/or image type for the specified node pool.
22884///
22885/// A builder for the *zones.clusters.nodePools.update* method supported by a *project* resource.
22886/// It is not used directly, but through a [`ProjectMethods`] instance.
22887///
22888/// # Example
22889///
22890/// Instantiate a resource method builder
22891///
22892/// ```test_harness,no_run
22893/// # extern crate hyper;
22894/// # extern crate hyper_rustls;
22895/// # extern crate google_container1 as container1;
22896/// use container1::api::UpdateNodePoolRequest;
22897/// # async fn dox() {
22898/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
22899///
22900/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
22901/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
22902/// # .with_native_roots()
22903/// # .unwrap()
22904/// # .https_only()
22905/// # .enable_http2()
22906/// # .build();
22907///
22908/// # let executor = hyper_util::rt::TokioExecutor::new();
22909/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
22910/// # secret,
22911/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
22912/// # yup_oauth2::client::CustomHyperClientBuilder::from(
22913/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
22914/// # ),
22915/// # ).build().await.unwrap();
22916///
22917/// # let client = hyper_util::client::legacy::Client::builder(
22918/// # hyper_util::rt::TokioExecutor::new()
22919/// # )
22920/// # .build(
22921/// # hyper_rustls::HttpsConnectorBuilder::new()
22922/// # .with_native_roots()
22923/// # .unwrap()
22924/// # .https_or_http()
22925/// # .enable_http2()
22926/// # .build()
22927/// # );
22928/// # let mut hub = Container::new(client, auth);
22929/// // As the method needs a request, you would usually fill it with the desired information
22930/// // into the respective structure. Some of the parts shown here might not be applicable !
22931/// // Values shown here are possibly random and not representative !
22932/// let mut req = UpdateNodePoolRequest::default();
22933///
22934/// // You can configure optional parameters by calling the respective setters at will, and
22935/// // execute the final call using `doit()`.
22936/// // Values shown here are possibly random and not representative !
22937/// let result = hub.projects().zones_clusters_node_pools_update(req, "projectId", "zone", "clusterId", "nodePoolId")
22938/// .doit().await;
22939/// # }
22940/// ```
22941pub struct ProjectZoneClusterNodePoolUpdateCall<'a, C>
22942where
22943 C: 'a,
22944{
22945 hub: &'a Container<C>,
22946 _request: UpdateNodePoolRequest,
22947 _project_id: String,
22948 _zone: String,
22949 _cluster_id: String,
22950 _node_pool_id: String,
22951 _delegate: Option<&'a mut dyn common::Delegate>,
22952 _additional_params: HashMap<String, String>,
22953 _scopes: BTreeSet<String>,
22954}
22955
22956impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolUpdateCall<'a, C> {}
22957
22958impl<'a, C> ProjectZoneClusterNodePoolUpdateCall<'a, C>
22959where
22960 C: common::Connector,
22961{
22962 /// Perform the operation you have build so far.
22963 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
22964 use std::borrow::Cow;
22965 use std::io::{Read, Seek};
22966
22967 use common::{url::Params, ToParts};
22968 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
22969
22970 let mut dd = common::DefaultDelegate;
22971 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
22972 dlg.begin(common::MethodInfo {
22973 id: "container.projects.zones.clusters.nodePools.update",
22974 http_method: hyper::Method::POST,
22975 });
22976
22977 for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
22978 if self._additional_params.contains_key(field) {
22979 dlg.finished(false);
22980 return Err(common::Error::FieldClash(field));
22981 }
22982 }
22983
22984 let mut params = Params::with_capacity(7 + self._additional_params.len());
22985 params.push("projectId", self._project_id);
22986 params.push("zone", self._zone);
22987 params.push("clusterId", self._cluster_id);
22988 params.push("nodePoolId", self._node_pool_id);
22989
22990 params.extend(self._additional_params.iter());
22991
22992 params.push("alt", "json");
22993 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/update";
22994 if self._scopes.is_empty() {
22995 self._scopes
22996 .insert(Scope::CloudPlatform.as_ref().to_string());
22997 }
22998
22999 #[allow(clippy::single_element_loop)]
23000 for &(find_this, param_name) in [
23001 ("{projectId}", "projectId"),
23002 ("{zone}", "zone"),
23003 ("{clusterId}", "clusterId"),
23004 ("{nodePoolId}", "nodePoolId"),
23005 ]
23006 .iter()
23007 {
23008 url = params.uri_replacement(url, param_name, find_this, false);
23009 }
23010 {
23011 let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
23012 params.remove_params(&to_remove);
23013 }
23014
23015 let url = params.parse_with_url(&url);
23016
23017 let mut json_mime_type = mime::APPLICATION_JSON;
23018 let mut request_value_reader = {
23019 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23020 common::remove_json_null_values(&mut value);
23021 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23022 serde_json::to_writer(&mut dst, &value).unwrap();
23023 dst
23024 };
23025 let request_size = request_value_reader
23026 .seek(std::io::SeekFrom::End(0))
23027 .unwrap();
23028 request_value_reader
23029 .seek(std::io::SeekFrom::Start(0))
23030 .unwrap();
23031
23032 loop {
23033 let token = match self
23034 .hub
23035 .auth
23036 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23037 .await
23038 {
23039 Ok(token) => token,
23040 Err(e) => match dlg.token(e) {
23041 Ok(token) => token,
23042 Err(e) => {
23043 dlg.finished(false);
23044 return Err(common::Error::MissingToken(e));
23045 }
23046 },
23047 };
23048 request_value_reader
23049 .seek(std::io::SeekFrom::Start(0))
23050 .unwrap();
23051 let mut req_result = {
23052 let client = &self.hub.client;
23053 dlg.pre_request();
23054 let mut req_builder = hyper::Request::builder()
23055 .method(hyper::Method::POST)
23056 .uri(url.as_str())
23057 .header(USER_AGENT, self.hub._user_agent.clone());
23058
23059 if let Some(token) = token.as_ref() {
23060 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23061 }
23062
23063 let request = req_builder
23064 .header(CONTENT_TYPE, json_mime_type.to_string())
23065 .header(CONTENT_LENGTH, request_size as u64)
23066 .body(common::to_body(
23067 request_value_reader.get_ref().clone().into(),
23068 ));
23069
23070 client.request(request.unwrap()).await
23071 };
23072
23073 match req_result {
23074 Err(err) => {
23075 if let common::Retry::After(d) = dlg.http_error(&err) {
23076 sleep(d).await;
23077 continue;
23078 }
23079 dlg.finished(false);
23080 return Err(common::Error::HttpError(err));
23081 }
23082 Ok(res) => {
23083 let (mut parts, body) = res.into_parts();
23084 let mut body = common::Body::new(body);
23085 if !parts.status.is_success() {
23086 let bytes = common::to_bytes(body).await.unwrap_or_default();
23087 let error = serde_json::from_str(&common::to_string(&bytes));
23088 let response = common::to_response(parts, bytes.into());
23089
23090 if let common::Retry::After(d) =
23091 dlg.http_failure(&response, error.as_ref().ok())
23092 {
23093 sleep(d).await;
23094 continue;
23095 }
23096
23097 dlg.finished(false);
23098
23099 return Err(match error {
23100 Ok(value) => common::Error::BadRequest(value),
23101 _ => common::Error::Failure(response),
23102 });
23103 }
23104 let response = {
23105 let bytes = common::to_bytes(body).await.unwrap_or_default();
23106 let encoded = common::to_string(&bytes);
23107 match serde_json::from_str(&encoded) {
23108 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23109 Err(error) => {
23110 dlg.response_json_decode_error(&encoded, &error);
23111 return Err(common::Error::JsonDecodeError(
23112 encoded.to_string(),
23113 error,
23114 ));
23115 }
23116 }
23117 };
23118
23119 dlg.finished(true);
23120 return Ok(response);
23121 }
23122 }
23123 }
23124 }
23125
23126 ///
23127 /// Sets the *request* property to the given value.
23128 ///
23129 /// Even though the property as already been set when instantiating this call,
23130 /// we provide this method for API completeness.
23131 pub fn request(
23132 mut self,
23133 new_value: UpdateNodePoolRequest,
23134 ) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
23135 self._request = new_value;
23136 self
23137 }
23138 /// 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.
23139 ///
23140 /// Sets the *project id* path property to the given value.
23141 ///
23142 /// Even though the property as already been set when instantiating this call,
23143 /// we provide this method for API completeness.
23144 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
23145 self._project_id = new_value.to_string();
23146 self
23147 }
23148 /// 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.
23149 ///
23150 /// Sets the *zone* path property to the given value.
23151 ///
23152 /// Even though the property as already been set when instantiating this call,
23153 /// we provide this method for API completeness.
23154 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
23155 self._zone = new_value.to_string();
23156 self
23157 }
23158 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
23159 ///
23160 /// Sets the *cluster id* path property to the given value.
23161 ///
23162 /// Even though the property as already been set when instantiating this call,
23163 /// we provide this method for API completeness.
23164 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
23165 self._cluster_id = new_value.to_string();
23166 self
23167 }
23168 /// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
23169 ///
23170 /// Sets the *node pool id* path property to the given value.
23171 ///
23172 /// Even though the property as already been set when instantiating this call,
23173 /// we provide this method for API completeness.
23174 pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
23175 self._node_pool_id = new_value.to_string();
23176 self
23177 }
23178 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23179 /// while executing the actual API request.
23180 ///
23181 /// ````text
23182 /// It should be used to handle progress information, and to implement a certain level of resilience.
23183 /// ````
23184 ///
23185 /// Sets the *delegate* property to the given value.
23186 pub fn delegate(
23187 mut self,
23188 new_value: &'a mut dyn common::Delegate,
23189 ) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
23190 self._delegate = Some(new_value);
23191 self
23192 }
23193
23194 /// Set any additional parameter of the query string used in the request.
23195 /// It should be used to set parameters which are not yet available through their own
23196 /// setters.
23197 ///
23198 /// Please note that this method must not be used to set any of the known parameters
23199 /// which have their own setter method. If done anyway, the request will fail.
23200 ///
23201 /// # Additional Parameters
23202 ///
23203 /// * *$.xgafv* (query-string) - V1 error format.
23204 /// * *access_token* (query-string) - OAuth access token.
23205 /// * *alt* (query-string) - Data format for response.
23206 /// * *callback* (query-string) - JSONP
23207 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23208 /// * *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.
23209 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23210 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23211 /// * *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.
23212 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23213 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23214 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
23215 where
23216 T: AsRef<str>,
23217 {
23218 self._additional_params
23219 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23220 self
23221 }
23222
23223 /// Identifies the authorization scope for the method you are building.
23224 ///
23225 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23226 /// [`Scope::CloudPlatform`].
23227 ///
23228 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23229 /// tokens for more than one scope.
23230 ///
23231 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23232 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23233 /// sufficient, a read-write scope will do as well.
23234 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
23235 where
23236 St: AsRef<str>,
23237 {
23238 self._scopes.insert(String::from(scope.as_ref()));
23239 self
23240 }
23241 /// Identifies the authorization scope(s) for the method you are building.
23242 ///
23243 /// See [`Self::add_scope()`] for details.
23244 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
23245 where
23246 I: IntoIterator<Item = St>,
23247 St: AsRef<str>,
23248 {
23249 self._scopes
23250 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23251 self
23252 }
23253
23254 /// Removes all scopes, and no default scope will be used either.
23255 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23256 /// for details).
23257 pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
23258 self._scopes.clear();
23259 self
23260 }
23261}
23262
23263/// Sets the addons for a specific cluster.
23264///
23265/// A builder for the *zones.clusters.addons* method supported by a *project* resource.
23266/// It is not used directly, but through a [`ProjectMethods`] instance.
23267///
23268/// # Example
23269///
23270/// Instantiate a resource method builder
23271///
23272/// ```test_harness,no_run
23273/// # extern crate hyper;
23274/// # extern crate hyper_rustls;
23275/// # extern crate google_container1 as container1;
23276/// use container1::api::SetAddonsConfigRequest;
23277/// # async fn dox() {
23278/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23279///
23280/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23281/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23282/// # .with_native_roots()
23283/// # .unwrap()
23284/// # .https_only()
23285/// # .enable_http2()
23286/// # .build();
23287///
23288/// # let executor = hyper_util::rt::TokioExecutor::new();
23289/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23290/// # secret,
23291/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23292/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23293/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23294/// # ),
23295/// # ).build().await.unwrap();
23296///
23297/// # let client = hyper_util::client::legacy::Client::builder(
23298/// # hyper_util::rt::TokioExecutor::new()
23299/// # )
23300/// # .build(
23301/// # hyper_rustls::HttpsConnectorBuilder::new()
23302/// # .with_native_roots()
23303/// # .unwrap()
23304/// # .https_or_http()
23305/// # .enable_http2()
23306/// # .build()
23307/// # );
23308/// # let mut hub = Container::new(client, auth);
23309/// // As the method needs a request, you would usually fill it with the desired information
23310/// // into the respective structure. Some of the parts shown here might not be applicable !
23311/// // Values shown here are possibly random and not representative !
23312/// let mut req = SetAddonsConfigRequest::default();
23313///
23314/// // You can configure optional parameters by calling the respective setters at will, and
23315/// // execute the final call using `doit()`.
23316/// // Values shown here are possibly random and not representative !
23317/// let result = hub.projects().zones_clusters_addons(req, "projectId", "zone", "clusterId")
23318/// .doit().await;
23319/// # }
23320/// ```
23321pub struct ProjectZoneClusterAddonCall<'a, C>
23322where
23323 C: 'a,
23324{
23325 hub: &'a Container<C>,
23326 _request: SetAddonsConfigRequest,
23327 _project_id: String,
23328 _zone: String,
23329 _cluster_id: String,
23330 _delegate: Option<&'a mut dyn common::Delegate>,
23331 _additional_params: HashMap<String, String>,
23332 _scopes: BTreeSet<String>,
23333}
23334
23335impl<'a, C> common::CallBuilder for ProjectZoneClusterAddonCall<'a, C> {}
23336
23337impl<'a, C> ProjectZoneClusterAddonCall<'a, C>
23338where
23339 C: common::Connector,
23340{
23341 /// Perform the operation you have build so far.
23342 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
23343 use std::borrow::Cow;
23344 use std::io::{Read, Seek};
23345
23346 use common::{url::Params, ToParts};
23347 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
23348
23349 let mut dd = common::DefaultDelegate;
23350 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
23351 dlg.begin(common::MethodInfo {
23352 id: "container.projects.zones.clusters.addons",
23353 http_method: hyper::Method::POST,
23354 });
23355
23356 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
23357 if self._additional_params.contains_key(field) {
23358 dlg.finished(false);
23359 return Err(common::Error::FieldClash(field));
23360 }
23361 }
23362
23363 let mut params = Params::with_capacity(6 + self._additional_params.len());
23364 params.push("projectId", self._project_id);
23365 params.push("zone", self._zone);
23366 params.push("clusterId", self._cluster_id);
23367
23368 params.extend(self._additional_params.iter());
23369
23370 params.push("alt", "json");
23371 let mut url = self.hub._base_url.clone()
23372 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/addons";
23373 if self._scopes.is_empty() {
23374 self._scopes
23375 .insert(Scope::CloudPlatform.as_ref().to_string());
23376 }
23377
23378 #[allow(clippy::single_element_loop)]
23379 for &(find_this, param_name) in [
23380 ("{projectId}", "projectId"),
23381 ("{zone}", "zone"),
23382 ("{clusterId}", "clusterId"),
23383 ]
23384 .iter()
23385 {
23386 url = params.uri_replacement(url, param_name, find_this, false);
23387 }
23388 {
23389 let to_remove = ["clusterId", "zone", "projectId"];
23390 params.remove_params(&to_remove);
23391 }
23392
23393 let url = params.parse_with_url(&url);
23394
23395 let mut json_mime_type = mime::APPLICATION_JSON;
23396 let mut request_value_reader = {
23397 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
23398 common::remove_json_null_values(&mut value);
23399 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
23400 serde_json::to_writer(&mut dst, &value).unwrap();
23401 dst
23402 };
23403 let request_size = request_value_reader
23404 .seek(std::io::SeekFrom::End(0))
23405 .unwrap();
23406 request_value_reader
23407 .seek(std::io::SeekFrom::Start(0))
23408 .unwrap();
23409
23410 loop {
23411 let token = match self
23412 .hub
23413 .auth
23414 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
23415 .await
23416 {
23417 Ok(token) => token,
23418 Err(e) => match dlg.token(e) {
23419 Ok(token) => token,
23420 Err(e) => {
23421 dlg.finished(false);
23422 return Err(common::Error::MissingToken(e));
23423 }
23424 },
23425 };
23426 request_value_reader
23427 .seek(std::io::SeekFrom::Start(0))
23428 .unwrap();
23429 let mut req_result = {
23430 let client = &self.hub.client;
23431 dlg.pre_request();
23432 let mut req_builder = hyper::Request::builder()
23433 .method(hyper::Method::POST)
23434 .uri(url.as_str())
23435 .header(USER_AGENT, self.hub._user_agent.clone());
23436
23437 if let Some(token) = token.as_ref() {
23438 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
23439 }
23440
23441 let request = req_builder
23442 .header(CONTENT_TYPE, json_mime_type.to_string())
23443 .header(CONTENT_LENGTH, request_size as u64)
23444 .body(common::to_body(
23445 request_value_reader.get_ref().clone().into(),
23446 ));
23447
23448 client.request(request.unwrap()).await
23449 };
23450
23451 match req_result {
23452 Err(err) => {
23453 if let common::Retry::After(d) = dlg.http_error(&err) {
23454 sleep(d).await;
23455 continue;
23456 }
23457 dlg.finished(false);
23458 return Err(common::Error::HttpError(err));
23459 }
23460 Ok(res) => {
23461 let (mut parts, body) = res.into_parts();
23462 let mut body = common::Body::new(body);
23463 if !parts.status.is_success() {
23464 let bytes = common::to_bytes(body).await.unwrap_or_default();
23465 let error = serde_json::from_str(&common::to_string(&bytes));
23466 let response = common::to_response(parts, bytes.into());
23467
23468 if let common::Retry::After(d) =
23469 dlg.http_failure(&response, error.as_ref().ok())
23470 {
23471 sleep(d).await;
23472 continue;
23473 }
23474
23475 dlg.finished(false);
23476
23477 return Err(match error {
23478 Ok(value) => common::Error::BadRequest(value),
23479 _ => common::Error::Failure(response),
23480 });
23481 }
23482 let response = {
23483 let bytes = common::to_bytes(body).await.unwrap_or_default();
23484 let encoded = common::to_string(&bytes);
23485 match serde_json::from_str(&encoded) {
23486 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
23487 Err(error) => {
23488 dlg.response_json_decode_error(&encoded, &error);
23489 return Err(common::Error::JsonDecodeError(
23490 encoded.to_string(),
23491 error,
23492 ));
23493 }
23494 }
23495 };
23496
23497 dlg.finished(true);
23498 return Ok(response);
23499 }
23500 }
23501 }
23502 }
23503
23504 ///
23505 /// Sets the *request* property to the given value.
23506 ///
23507 /// Even though the property as already been set when instantiating this call,
23508 /// we provide this method for API completeness.
23509 pub fn request(
23510 mut self,
23511 new_value: SetAddonsConfigRequest,
23512 ) -> ProjectZoneClusterAddonCall<'a, C> {
23513 self._request = new_value;
23514 self
23515 }
23516 /// 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.
23517 ///
23518 /// Sets the *project id* path property to the given value.
23519 ///
23520 /// Even though the property as already been set when instantiating this call,
23521 /// we provide this method for API completeness.
23522 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
23523 self._project_id = new_value.to_string();
23524 self
23525 }
23526 /// 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.
23527 ///
23528 /// Sets the *zone* path property to the given value.
23529 ///
23530 /// Even though the property as already been set when instantiating this call,
23531 /// we provide this method for API completeness.
23532 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
23533 self._zone = new_value.to_string();
23534 self
23535 }
23536 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
23537 ///
23538 /// Sets the *cluster id* path property to the given value.
23539 ///
23540 /// Even though the property as already been set when instantiating this call,
23541 /// we provide this method for API completeness.
23542 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
23543 self._cluster_id = new_value.to_string();
23544 self
23545 }
23546 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23547 /// while executing the actual API request.
23548 ///
23549 /// ````text
23550 /// It should be used to handle progress information, and to implement a certain level of resilience.
23551 /// ````
23552 ///
23553 /// Sets the *delegate* property to the given value.
23554 pub fn delegate(
23555 mut self,
23556 new_value: &'a mut dyn common::Delegate,
23557 ) -> ProjectZoneClusterAddonCall<'a, C> {
23558 self._delegate = Some(new_value);
23559 self
23560 }
23561
23562 /// Set any additional parameter of the query string used in the request.
23563 /// It should be used to set parameters which are not yet available through their own
23564 /// setters.
23565 ///
23566 /// Please note that this method must not be used to set any of the known parameters
23567 /// which have their own setter method. If done anyway, the request will fail.
23568 ///
23569 /// # Additional Parameters
23570 ///
23571 /// * *$.xgafv* (query-string) - V1 error format.
23572 /// * *access_token* (query-string) - OAuth access token.
23573 /// * *alt* (query-string) - Data format for response.
23574 /// * *callback* (query-string) - JSONP
23575 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23576 /// * *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.
23577 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23578 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23579 /// * *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.
23580 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23581 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23582 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterAddonCall<'a, C>
23583 where
23584 T: AsRef<str>,
23585 {
23586 self._additional_params
23587 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23588 self
23589 }
23590
23591 /// Identifies the authorization scope for the method you are building.
23592 ///
23593 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23594 /// [`Scope::CloudPlatform`].
23595 ///
23596 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23597 /// tokens for more than one scope.
23598 ///
23599 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23600 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23601 /// sufficient, a read-write scope will do as well.
23602 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterAddonCall<'a, C>
23603 where
23604 St: AsRef<str>,
23605 {
23606 self._scopes.insert(String::from(scope.as_ref()));
23607 self
23608 }
23609 /// Identifies the authorization scope(s) for the method you are building.
23610 ///
23611 /// See [`Self::add_scope()`] for details.
23612 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterAddonCall<'a, C>
23613 where
23614 I: IntoIterator<Item = St>,
23615 St: AsRef<str>,
23616 {
23617 self._scopes
23618 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23619 self
23620 }
23621
23622 /// Removes all scopes, and no default scope will be used either.
23623 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23624 /// for details).
23625 pub fn clear_scopes(mut self) -> ProjectZoneClusterAddonCall<'a, C> {
23626 self._scopes.clear();
23627 self
23628 }
23629}
23630
23631/// Completes master IP rotation.
23632///
23633/// A builder for the *zones.clusters.completeIpRotation* method supported by a *project* resource.
23634/// It is not used directly, but through a [`ProjectMethods`] instance.
23635///
23636/// # Example
23637///
23638/// Instantiate a resource method builder
23639///
23640/// ```test_harness,no_run
23641/// # extern crate hyper;
23642/// # extern crate hyper_rustls;
23643/// # extern crate google_container1 as container1;
23644/// use container1::api::CompleteIPRotationRequest;
23645/// # async fn dox() {
23646/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
23647///
23648/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
23649/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
23650/// # .with_native_roots()
23651/// # .unwrap()
23652/// # .https_only()
23653/// # .enable_http2()
23654/// # .build();
23655///
23656/// # let executor = hyper_util::rt::TokioExecutor::new();
23657/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
23658/// # secret,
23659/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
23660/// # yup_oauth2::client::CustomHyperClientBuilder::from(
23661/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
23662/// # ),
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_http2()
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 = CompleteIPRotationRequest::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_complete_ip_rotation(req, "projectId", "zone", "clusterId")
23686/// .doit().await;
23687/// # }
23688/// ```
23689pub struct ProjectZoneClusterCompleteIpRotationCall<'a, C>
23690where
23691 C: 'a,
23692{
23693 hub: &'a Container<C>,
23694 _request: CompleteIPRotationRequest,
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 ProjectZoneClusterCompleteIpRotationCall<'a, C> {}
23704
23705impl<'a, C> ProjectZoneClusterCompleteIpRotationCall<'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.completeIpRotation",
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}:completeIpRotation";
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: CompleteIPRotationRequest,
23880 ) -> ProjectZoneClusterCompleteIpRotationCall<'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(
23891 mut self,
23892 new_value: &str,
23893 ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
23894 self._project_id = new_value.to_string();
23895 self
23896 }
23897 /// 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.
23898 ///
23899 /// Sets the *zone* path property to the given value.
23900 ///
23901 /// Even though the property as already been set when instantiating this call,
23902 /// we provide this method for API completeness.
23903 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
23904 self._zone = new_value.to_string();
23905 self
23906 }
23907 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
23908 ///
23909 /// Sets the *cluster id* path property to the given value.
23910 ///
23911 /// Even though the property as already been set when instantiating this call,
23912 /// we provide this method for API completeness.
23913 pub fn cluster_id(
23914 mut self,
23915 new_value: &str,
23916 ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
23917 self._cluster_id = new_value.to_string();
23918 self
23919 }
23920 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
23921 /// while executing the actual API request.
23922 ///
23923 /// ````text
23924 /// It should be used to handle progress information, and to implement a certain level of resilience.
23925 /// ````
23926 ///
23927 /// Sets the *delegate* property to the given value.
23928 pub fn delegate(
23929 mut self,
23930 new_value: &'a mut dyn common::Delegate,
23931 ) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
23932 self._delegate = Some(new_value);
23933 self
23934 }
23935
23936 /// Set any additional parameter of the query string used in the request.
23937 /// It should be used to set parameters which are not yet available through their own
23938 /// setters.
23939 ///
23940 /// Please note that this method must not be used to set any of the known parameters
23941 /// which have their own setter method. If done anyway, the request will fail.
23942 ///
23943 /// # Additional Parameters
23944 ///
23945 /// * *$.xgafv* (query-string) - V1 error format.
23946 /// * *access_token* (query-string) - OAuth access token.
23947 /// * *alt* (query-string) - Data format for response.
23948 /// * *callback* (query-string) - JSONP
23949 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
23950 /// * *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.
23951 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
23952 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
23953 /// * *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.
23954 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
23955 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
23956 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
23957 where
23958 T: AsRef<str>,
23959 {
23960 self._additional_params
23961 .insert(name.as_ref().to_string(), value.as_ref().to_string());
23962 self
23963 }
23964
23965 /// Identifies the authorization scope for the method you are building.
23966 ///
23967 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
23968 /// [`Scope::CloudPlatform`].
23969 ///
23970 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
23971 /// tokens for more than one scope.
23972 ///
23973 /// Usually there is more than one suitable scope to authorize an operation, some of which may
23974 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
23975 /// sufficient, a read-write scope will do as well.
23976 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
23977 where
23978 St: AsRef<str>,
23979 {
23980 self._scopes.insert(String::from(scope.as_ref()));
23981 self
23982 }
23983 /// Identifies the authorization scope(s) for the method you are building.
23984 ///
23985 /// See [`Self::add_scope()`] for details.
23986 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
23987 where
23988 I: IntoIterator<Item = St>,
23989 St: AsRef<str>,
23990 {
23991 self._scopes
23992 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
23993 self
23994 }
23995
23996 /// Removes all scopes, and no default scope will be used either.
23997 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
23998 /// for details).
23999 pub fn clear_scopes(mut self) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
24000 self._scopes.clear();
24001 self
24002 }
24003}
24004
24005/// 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.
24006///
24007/// A builder for the *zones.clusters.create* method supported by a *project* resource.
24008/// It is not used directly, but through a [`ProjectMethods`] instance.
24009///
24010/// # Example
24011///
24012/// Instantiate a resource method builder
24013///
24014/// ```test_harness,no_run
24015/// # extern crate hyper;
24016/// # extern crate hyper_rustls;
24017/// # extern crate google_container1 as container1;
24018/// use container1::api::CreateClusterRequest;
24019/// # async fn dox() {
24020/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24021///
24022/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24023/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24024/// # .with_native_roots()
24025/// # .unwrap()
24026/// # .https_only()
24027/// # .enable_http2()
24028/// # .build();
24029///
24030/// # let executor = hyper_util::rt::TokioExecutor::new();
24031/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24032/// # secret,
24033/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24034/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24035/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24036/// # ),
24037/// # ).build().await.unwrap();
24038///
24039/// # let client = hyper_util::client::legacy::Client::builder(
24040/// # hyper_util::rt::TokioExecutor::new()
24041/// # )
24042/// # .build(
24043/// # hyper_rustls::HttpsConnectorBuilder::new()
24044/// # .with_native_roots()
24045/// # .unwrap()
24046/// # .https_or_http()
24047/// # .enable_http2()
24048/// # .build()
24049/// # );
24050/// # let mut hub = Container::new(client, auth);
24051/// // As the method needs a request, you would usually fill it with the desired information
24052/// // into the respective structure. Some of the parts shown here might not be applicable !
24053/// // Values shown here are possibly random and not representative !
24054/// let mut req = CreateClusterRequest::default();
24055///
24056/// // You can configure optional parameters by calling the respective setters at will, and
24057/// // execute the final call using `doit()`.
24058/// // Values shown here are possibly random and not representative !
24059/// let result = hub.projects().zones_clusters_create(req, "projectId", "zone")
24060/// .doit().await;
24061/// # }
24062/// ```
24063pub struct ProjectZoneClusterCreateCall<'a, C>
24064where
24065 C: 'a,
24066{
24067 hub: &'a Container<C>,
24068 _request: CreateClusterRequest,
24069 _project_id: String,
24070 _zone: String,
24071 _delegate: Option<&'a mut dyn common::Delegate>,
24072 _additional_params: HashMap<String, String>,
24073 _scopes: BTreeSet<String>,
24074}
24075
24076impl<'a, C> common::CallBuilder for ProjectZoneClusterCreateCall<'a, C> {}
24077
24078impl<'a, C> ProjectZoneClusterCreateCall<'a, C>
24079where
24080 C: common::Connector,
24081{
24082 /// Perform the operation you have build so far.
24083 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24084 use std::borrow::Cow;
24085 use std::io::{Read, Seek};
24086
24087 use common::{url::Params, ToParts};
24088 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24089
24090 let mut dd = common::DefaultDelegate;
24091 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24092 dlg.begin(common::MethodInfo {
24093 id: "container.projects.zones.clusters.create",
24094 http_method: hyper::Method::POST,
24095 });
24096
24097 for &field in ["alt", "projectId", "zone"].iter() {
24098 if self._additional_params.contains_key(field) {
24099 dlg.finished(false);
24100 return Err(common::Error::FieldClash(field));
24101 }
24102 }
24103
24104 let mut params = Params::with_capacity(5 + self._additional_params.len());
24105 params.push("projectId", self._project_id);
24106 params.push("zone", self._zone);
24107
24108 params.extend(self._additional_params.iter());
24109
24110 params.push("alt", "json");
24111 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
24112 if self._scopes.is_empty() {
24113 self._scopes
24114 .insert(Scope::CloudPlatform.as_ref().to_string());
24115 }
24116
24117 #[allow(clippy::single_element_loop)]
24118 for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
24119 url = params.uri_replacement(url, param_name, find_this, false);
24120 }
24121 {
24122 let to_remove = ["zone", "projectId"];
24123 params.remove_params(&to_remove);
24124 }
24125
24126 let url = params.parse_with_url(&url);
24127
24128 let mut json_mime_type = mime::APPLICATION_JSON;
24129 let mut request_value_reader = {
24130 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
24131 common::remove_json_null_values(&mut value);
24132 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
24133 serde_json::to_writer(&mut dst, &value).unwrap();
24134 dst
24135 };
24136 let request_size = request_value_reader
24137 .seek(std::io::SeekFrom::End(0))
24138 .unwrap();
24139 request_value_reader
24140 .seek(std::io::SeekFrom::Start(0))
24141 .unwrap();
24142
24143 loop {
24144 let token = match self
24145 .hub
24146 .auth
24147 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24148 .await
24149 {
24150 Ok(token) => token,
24151 Err(e) => match dlg.token(e) {
24152 Ok(token) => token,
24153 Err(e) => {
24154 dlg.finished(false);
24155 return Err(common::Error::MissingToken(e));
24156 }
24157 },
24158 };
24159 request_value_reader
24160 .seek(std::io::SeekFrom::Start(0))
24161 .unwrap();
24162 let mut req_result = {
24163 let client = &self.hub.client;
24164 dlg.pre_request();
24165 let mut req_builder = hyper::Request::builder()
24166 .method(hyper::Method::POST)
24167 .uri(url.as_str())
24168 .header(USER_AGENT, self.hub._user_agent.clone());
24169
24170 if let Some(token) = token.as_ref() {
24171 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24172 }
24173
24174 let request = req_builder
24175 .header(CONTENT_TYPE, json_mime_type.to_string())
24176 .header(CONTENT_LENGTH, request_size as u64)
24177 .body(common::to_body(
24178 request_value_reader.get_ref().clone().into(),
24179 ));
24180
24181 client.request(request.unwrap()).await
24182 };
24183
24184 match req_result {
24185 Err(err) => {
24186 if let common::Retry::After(d) = dlg.http_error(&err) {
24187 sleep(d).await;
24188 continue;
24189 }
24190 dlg.finished(false);
24191 return Err(common::Error::HttpError(err));
24192 }
24193 Ok(res) => {
24194 let (mut parts, body) = res.into_parts();
24195 let mut body = common::Body::new(body);
24196 if !parts.status.is_success() {
24197 let bytes = common::to_bytes(body).await.unwrap_or_default();
24198 let error = serde_json::from_str(&common::to_string(&bytes));
24199 let response = common::to_response(parts, bytes.into());
24200
24201 if let common::Retry::After(d) =
24202 dlg.http_failure(&response, error.as_ref().ok())
24203 {
24204 sleep(d).await;
24205 continue;
24206 }
24207
24208 dlg.finished(false);
24209
24210 return Err(match error {
24211 Ok(value) => common::Error::BadRequest(value),
24212 _ => common::Error::Failure(response),
24213 });
24214 }
24215 let response = {
24216 let bytes = common::to_bytes(body).await.unwrap_or_default();
24217 let encoded = common::to_string(&bytes);
24218 match serde_json::from_str(&encoded) {
24219 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24220 Err(error) => {
24221 dlg.response_json_decode_error(&encoded, &error);
24222 return Err(common::Error::JsonDecodeError(
24223 encoded.to_string(),
24224 error,
24225 ));
24226 }
24227 }
24228 };
24229
24230 dlg.finished(true);
24231 return Ok(response);
24232 }
24233 }
24234 }
24235 }
24236
24237 ///
24238 /// Sets the *request* property to the given value.
24239 ///
24240 /// Even though the property as already been set when instantiating this call,
24241 /// we provide this method for API completeness.
24242 pub fn request(
24243 mut self,
24244 new_value: CreateClusterRequest,
24245 ) -> ProjectZoneClusterCreateCall<'a, C> {
24246 self._request = new_value;
24247 self
24248 }
24249 /// 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.
24250 ///
24251 /// Sets the *project id* path property to the given value.
24252 ///
24253 /// Even though the property as already been set when instantiating this call,
24254 /// we provide this method for API completeness.
24255 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterCreateCall<'a, C> {
24256 self._project_id = new_value.to_string();
24257 self
24258 }
24259 /// 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.
24260 ///
24261 /// Sets the *zone* path property to the given value.
24262 ///
24263 /// Even though the property as already been set when instantiating this call,
24264 /// we provide this method for API completeness.
24265 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterCreateCall<'a, C> {
24266 self._zone = new_value.to_string();
24267 self
24268 }
24269 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24270 /// while executing the actual API request.
24271 ///
24272 /// ````text
24273 /// It should be used to handle progress information, and to implement a certain level of resilience.
24274 /// ````
24275 ///
24276 /// Sets the *delegate* property to the given value.
24277 pub fn delegate(
24278 mut self,
24279 new_value: &'a mut dyn common::Delegate,
24280 ) -> ProjectZoneClusterCreateCall<'a, C> {
24281 self._delegate = Some(new_value);
24282 self
24283 }
24284
24285 /// Set any additional parameter of the query string used in the request.
24286 /// It should be used to set parameters which are not yet available through their own
24287 /// setters.
24288 ///
24289 /// Please note that this method must not be used to set any of the known parameters
24290 /// which have their own setter method. If done anyway, the request will fail.
24291 ///
24292 /// # Additional Parameters
24293 ///
24294 /// * *$.xgafv* (query-string) - V1 error format.
24295 /// * *access_token* (query-string) - OAuth access token.
24296 /// * *alt* (query-string) - Data format for response.
24297 /// * *callback* (query-string) - JSONP
24298 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24299 /// * *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.
24300 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24301 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24302 /// * *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.
24303 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24304 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24305 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterCreateCall<'a, C>
24306 where
24307 T: AsRef<str>,
24308 {
24309 self._additional_params
24310 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24311 self
24312 }
24313
24314 /// Identifies the authorization scope for the method you are building.
24315 ///
24316 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24317 /// [`Scope::CloudPlatform`].
24318 ///
24319 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24320 /// tokens for more than one scope.
24321 ///
24322 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24323 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24324 /// sufficient, a read-write scope will do as well.
24325 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterCreateCall<'a, C>
24326 where
24327 St: AsRef<str>,
24328 {
24329 self._scopes.insert(String::from(scope.as_ref()));
24330 self
24331 }
24332 /// Identifies the authorization scope(s) for the method you are building.
24333 ///
24334 /// See [`Self::add_scope()`] for details.
24335 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterCreateCall<'a, C>
24336 where
24337 I: IntoIterator<Item = St>,
24338 St: AsRef<str>,
24339 {
24340 self._scopes
24341 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24342 self
24343 }
24344
24345 /// Removes all scopes, and no default scope will be used either.
24346 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24347 /// for details).
24348 pub fn clear_scopes(mut self) -> ProjectZoneClusterCreateCall<'a, C> {
24349 self._scopes.clear();
24350 self
24351 }
24352}
24353
24354/// 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.
24355///
24356/// A builder for the *zones.clusters.delete* method supported by a *project* resource.
24357/// It is not used directly, but through a [`ProjectMethods`] instance.
24358///
24359/// # Example
24360///
24361/// Instantiate a resource method builder
24362///
24363/// ```test_harness,no_run
24364/// # extern crate hyper;
24365/// # extern crate hyper_rustls;
24366/// # extern crate google_container1 as container1;
24367/// # async fn dox() {
24368/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24369///
24370/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24371/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24372/// # .with_native_roots()
24373/// # .unwrap()
24374/// # .https_only()
24375/// # .enable_http2()
24376/// # .build();
24377///
24378/// # let executor = hyper_util::rt::TokioExecutor::new();
24379/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24380/// # secret,
24381/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24382/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24383/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24384/// # ),
24385/// # ).build().await.unwrap();
24386///
24387/// # let client = hyper_util::client::legacy::Client::builder(
24388/// # hyper_util::rt::TokioExecutor::new()
24389/// # )
24390/// # .build(
24391/// # hyper_rustls::HttpsConnectorBuilder::new()
24392/// # .with_native_roots()
24393/// # .unwrap()
24394/// # .https_or_http()
24395/// # .enable_http2()
24396/// # .build()
24397/// # );
24398/// # let mut hub = Container::new(client, auth);
24399/// // You can configure optional parameters by calling the respective setters at will, and
24400/// // execute the final call using `doit()`.
24401/// // Values shown here are possibly random and not representative !
24402/// let result = hub.projects().zones_clusters_delete("projectId", "zone", "clusterId")
24403/// .name("et")
24404/// .doit().await;
24405/// # }
24406/// ```
24407pub struct ProjectZoneClusterDeleteCall<'a, C>
24408where
24409 C: 'a,
24410{
24411 hub: &'a Container<C>,
24412 _project_id: String,
24413 _zone: String,
24414 _cluster_id: String,
24415 _name: Option<String>,
24416 _delegate: Option<&'a mut dyn common::Delegate>,
24417 _additional_params: HashMap<String, String>,
24418 _scopes: BTreeSet<String>,
24419}
24420
24421impl<'a, C> common::CallBuilder for ProjectZoneClusterDeleteCall<'a, C> {}
24422
24423impl<'a, C> ProjectZoneClusterDeleteCall<'a, C>
24424where
24425 C: common::Connector,
24426{
24427 /// Perform the operation you have build so far.
24428 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
24429 use std::borrow::Cow;
24430 use std::io::{Read, Seek};
24431
24432 use common::{url::Params, ToParts};
24433 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24434
24435 let mut dd = common::DefaultDelegate;
24436 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24437 dlg.begin(common::MethodInfo {
24438 id: "container.projects.zones.clusters.delete",
24439 http_method: hyper::Method::DELETE,
24440 });
24441
24442 for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
24443 if self._additional_params.contains_key(field) {
24444 dlg.finished(false);
24445 return Err(common::Error::FieldClash(field));
24446 }
24447 }
24448
24449 let mut params = Params::with_capacity(6 + self._additional_params.len());
24450 params.push("projectId", self._project_id);
24451 params.push("zone", self._zone);
24452 params.push("clusterId", self._cluster_id);
24453 if let Some(value) = self._name.as_ref() {
24454 params.push("name", value);
24455 }
24456
24457 params.extend(self._additional_params.iter());
24458
24459 params.push("alt", "json");
24460 let mut url = self.hub._base_url.clone()
24461 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
24462 if self._scopes.is_empty() {
24463 self._scopes
24464 .insert(Scope::CloudPlatform.as_ref().to_string());
24465 }
24466
24467 #[allow(clippy::single_element_loop)]
24468 for &(find_this, param_name) in [
24469 ("{projectId}", "projectId"),
24470 ("{zone}", "zone"),
24471 ("{clusterId}", "clusterId"),
24472 ]
24473 .iter()
24474 {
24475 url = params.uri_replacement(url, param_name, find_this, false);
24476 }
24477 {
24478 let to_remove = ["clusterId", "zone", "projectId"];
24479 params.remove_params(&to_remove);
24480 }
24481
24482 let url = params.parse_with_url(&url);
24483
24484 loop {
24485 let token = match self
24486 .hub
24487 .auth
24488 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24489 .await
24490 {
24491 Ok(token) => token,
24492 Err(e) => match dlg.token(e) {
24493 Ok(token) => token,
24494 Err(e) => {
24495 dlg.finished(false);
24496 return Err(common::Error::MissingToken(e));
24497 }
24498 },
24499 };
24500 let mut req_result = {
24501 let client = &self.hub.client;
24502 dlg.pre_request();
24503 let mut req_builder = hyper::Request::builder()
24504 .method(hyper::Method::DELETE)
24505 .uri(url.as_str())
24506 .header(USER_AGENT, self.hub._user_agent.clone());
24507
24508 if let Some(token) = token.as_ref() {
24509 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24510 }
24511
24512 let request = req_builder
24513 .header(CONTENT_LENGTH, 0_u64)
24514 .body(common::to_body::<String>(None));
24515
24516 client.request(request.unwrap()).await
24517 };
24518
24519 match req_result {
24520 Err(err) => {
24521 if let common::Retry::After(d) = dlg.http_error(&err) {
24522 sleep(d).await;
24523 continue;
24524 }
24525 dlg.finished(false);
24526 return Err(common::Error::HttpError(err));
24527 }
24528 Ok(res) => {
24529 let (mut parts, body) = res.into_parts();
24530 let mut body = common::Body::new(body);
24531 if !parts.status.is_success() {
24532 let bytes = common::to_bytes(body).await.unwrap_or_default();
24533 let error = serde_json::from_str(&common::to_string(&bytes));
24534 let response = common::to_response(parts, bytes.into());
24535
24536 if let common::Retry::After(d) =
24537 dlg.http_failure(&response, error.as_ref().ok())
24538 {
24539 sleep(d).await;
24540 continue;
24541 }
24542
24543 dlg.finished(false);
24544
24545 return Err(match error {
24546 Ok(value) => common::Error::BadRequest(value),
24547 _ => common::Error::Failure(response),
24548 });
24549 }
24550 let response = {
24551 let bytes = common::to_bytes(body).await.unwrap_or_default();
24552 let encoded = common::to_string(&bytes);
24553 match serde_json::from_str(&encoded) {
24554 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24555 Err(error) => {
24556 dlg.response_json_decode_error(&encoded, &error);
24557 return Err(common::Error::JsonDecodeError(
24558 encoded.to_string(),
24559 error,
24560 ));
24561 }
24562 }
24563 };
24564
24565 dlg.finished(true);
24566 return Ok(response);
24567 }
24568 }
24569 }
24570 }
24571
24572 /// 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.
24573 ///
24574 /// Sets the *project id* path property to the given value.
24575 ///
24576 /// Even though the property as already been set when instantiating this call,
24577 /// we provide this method for API completeness.
24578 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
24579 self._project_id = new_value.to_string();
24580 self
24581 }
24582 /// 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.
24583 ///
24584 /// Sets the *zone* path property to the given value.
24585 ///
24586 /// Even though the property as already been set when instantiating this call,
24587 /// we provide this method for API completeness.
24588 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
24589 self._zone = new_value.to_string();
24590 self
24591 }
24592 /// Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
24593 ///
24594 /// Sets the *cluster id* path property to the given value.
24595 ///
24596 /// Even though the property as already been set when instantiating this call,
24597 /// we provide this method for API completeness.
24598 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
24599 self._cluster_id = new_value.to_string();
24600 self
24601 }
24602 /// The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
24603 ///
24604 /// Sets the *name* query property to the given value.
24605 pub fn name(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
24606 self._name = Some(new_value.to_string());
24607 self
24608 }
24609 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24610 /// while executing the actual API request.
24611 ///
24612 /// ````text
24613 /// It should be used to handle progress information, and to implement a certain level of resilience.
24614 /// ````
24615 ///
24616 /// Sets the *delegate* property to the given value.
24617 pub fn delegate(
24618 mut self,
24619 new_value: &'a mut dyn common::Delegate,
24620 ) -> ProjectZoneClusterDeleteCall<'a, C> {
24621 self._delegate = Some(new_value);
24622 self
24623 }
24624
24625 /// Set any additional parameter of the query string used in the request.
24626 /// It should be used to set parameters which are not yet available through their own
24627 /// setters.
24628 ///
24629 /// Please note that this method must not be used to set any of the known parameters
24630 /// which have their own setter method. If done anyway, the request will fail.
24631 ///
24632 /// # Additional Parameters
24633 ///
24634 /// * *$.xgafv* (query-string) - V1 error format.
24635 /// * *access_token* (query-string) - OAuth access token.
24636 /// * *alt* (query-string) - Data format for response.
24637 /// * *callback* (query-string) - JSONP
24638 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24639 /// * *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.
24640 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24641 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24642 /// * *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.
24643 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24644 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24645 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterDeleteCall<'a, C>
24646 where
24647 T: AsRef<str>,
24648 {
24649 self._additional_params
24650 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24651 self
24652 }
24653
24654 /// Identifies the authorization scope for the method you are building.
24655 ///
24656 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24657 /// [`Scope::CloudPlatform`].
24658 ///
24659 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24660 /// tokens for more than one scope.
24661 ///
24662 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24663 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24664 /// sufficient, a read-write scope will do as well.
24665 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterDeleteCall<'a, C>
24666 where
24667 St: AsRef<str>,
24668 {
24669 self._scopes.insert(String::from(scope.as_ref()));
24670 self
24671 }
24672 /// Identifies the authorization scope(s) for the method you are building.
24673 ///
24674 /// See [`Self::add_scope()`] for details.
24675 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterDeleteCall<'a, C>
24676 where
24677 I: IntoIterator<Item = St>,
24678 St: AsRef<str>,
24679 {
24680 self._scopes
24681 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
24682 self
24683 }
24684
24685 /// Removes all scopes, and no default scope will be used either.
24686 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
24687 /// for details).
24688 pub fn clear_scopes(mut self) -> ProjectZoneClusterDeleteCall<'a, C> {
24689 self._scopes.clear();
24690 self
24691 }
24692}
24693
24694/// Fetch upgrade information of a specific cluster.
24695///
24696/// A builder for the *zones.clusters.fetchClusterUpgradeInfo* method supported by a *project* resource.
24697/// It is not used directly, but through a [`ProjectMethods`] instance.
24698///
24699/// # Example
24700///
24701/// Instantiate a resource method builder
24702///
24703/// ```test_harness,no_run
24704/// # extern crate hyper;
24705/// # extern crate hyper_rustls;
24706/// # extern crate google_container1 as container1;
24707/// # async fn dox() {
24708/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
24709///
24710/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
24711/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
24712/// # .with_native_roots()
24713/// # .unwrap()
24714/// # .https_only()
24715/// # .enable_http2()
24716/// # .build();
24717///
24718/// # let executor = hyper_util::rt::TokioExecutor::new();
24719/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
24720/// # secret,
24721/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
24722/// # yup_oauth2::client::CustomHyperClientBuilder::from(
24723/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
24724/// # ),
24725/// # ).build().await.unwrap();
24726///
24727/// # let client = hyper_util::client::legacy::Client::builder(
24728/// # hyper_util::rt::TokioExecutor::new()
24729/// # )
24730/// # .build(
24731/// # hyper_rustls::HttpsConnectorBuilder::new()
24732/// # .with_native_roots()
24733/// # .unwrap()
24734/// # .https_or_http()
24735/// # .enable_http2()
24736/// # .build()
24737/// # );
24738/// # let mut hub = Container::new(client, auth);
24739/// // You can configure optional parameters by calling the respective setters at will, and
24740/// // execute the final call using `doit()`.
24741/// // Values shown here are possibly random and not representative !
24742/// let result = hub.projects().zones_clusters_fetch_cluster_upgrade_info("name")
24743/// .version("consetetur")
24744/// .doit().await;
24745/// # }
24746/// ```
24747pub struct ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
24748where
24749 C: 'a,
24750{
24751 hub: &'a Container<C>,
24752 _name: String,
24753 _version: Option<String>,
24754 _delegate: Option<&'a mut dyn common::Delegate>,
24755 _additional_params: HashMap<String, String>,
24756 _scopes: BTreeSet<String>,
24757}
24758
24759impl<'a, C> common::CallBuilder for ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {}
24760
24761impl<'a, C> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
24762where
24763 C: common::Connector,
24764{
24765 /// Perform the operation you have build so far.
24766 pub async fn doit(mut self) -> common::Result<(common::Response, ClusterUpgradeInfo)> {
24767 use std::borrow::Cow;
24768 use std::io::{Read, Seek};
24769
24770 use common::{url::Params, ToParts};
24771 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
24772
24773 let mut dd = common::DefaultDelegate;
24774 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
24775 dlg.begin(common::MethodInfo {
24776 id: "container.projects.zones.clusters.fetchClusterUpgradeInfo",
24777 http_method: hyper::Method::GET,
24778 });
24779
24780 for &field in ["alt", "name", "version"].iter() {
24781 if self._additional_params.contains_key(field) {
24782 dlg.finished(false);
24783 return Err(common::Error::FieldClash(field));
24784 }
24785 }
24786
24787 let mut params = Params::with_capacity(4 + self._additional_params.len());
24788 params.push("name", self._name);
24789 if let Some(value) = self._version.as_ref() {
24790 params.push("version", value);
24791 }
24792
24793 params.extend(self._additional_params.iter());
24794
24795 params.push("alt", "json");
24796 let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchClusterUpgradeInfo";
24797 if self._scopes.is_empty() {
24798 self._scopes
24799 .insert(Scope::CloudPlatform.as_ref().to_string());
24800 }
24801
24802 #[allow(clippy::single_element_loop)]
24803 for &(find_this, param_name) in [("{+name}", "name")].iter() {
24804 url = params.uri_replacement(url, param_name, find_this, true);
24805 }
24806 {
24807 let to_remove = ["name"];
24808 params.remove_params(&to_remove);
24809 }
24810
24811 let url = params.parse_with_url(&url);
24812
24813 loop {
24814 let token = match self
24815 .hub
24816 .auth
24817 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
24818 .await
24819 {
24820 Ok(token) => token,
24821 Err(e) => match dlg.token(e) {
24822 Ok(token) => token,
24823 Err(e) => {
24824 dlg.finished(false);
24825 return Err(common::Error::MissingToken(e));
24826 }
24827 },
24828 };
24829 let mut req_result = {
24830 let client = &self.hub.client;
24831 dlg.pre_request();
24832 let mut req_builder = hyper::Request::builder()
24833 .method(hyper::Method::GET)
24834 .uri(url.as_str())
24835 .header(USER_AGENT, self.hub._user_agent.clone());
24836
24837 if let Some(token) = token.as_ref() {
24838 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
24839 }
24840
24841 let request = req_builder
24842 .header(CONTENT_LENGTH, 0_u64)
24843 .body(common::to_body::<String>(None));
24844
24845 client.request(request.unwrap()).await
24846 };
24847
24848 match req_result {
24849 Err(err) => {
24850 if let common::Retry::After(d) = dlg.http_error(&err) {
24851 sleep(d).await;
24852 continue;
24853 }
24854 dlg.finished(false);
24855 return Err(common::Error::HttpError(err));
24856 }
24857 Ok(res) => {
24858 let (mut parts, body) = res.into_parts();
24859 let mut body = common::Body::new(body);
24860 if !parts.status.is_success() {
24861 let bytes = common::to_bytes(body).await.unwrap_or_default();
24862 let error = serde_json::from_str(&common::to_string(&bytes));
24863 let response = common::to_response(parts, bytes.into());
24864
24865 if let common::Retry::After(d) =
24866 dlg.http_failure(&response, error.as_ref().ok())
24867 {
24868 sleep(d).await;
24869 continue;
24870 }
24871
24872 dlg.finished(false);
24873
24874 return Err(match error {
24875 Ok(value) => common::Error::BadRequest(value),
24876 _ => common::Error::Failure(response),
24877 });
24878 }
24879 let response = {
24880 let bytes = common::to_bytes(body).await.unwrap_or_default();
24881 let encoded = common::to_string(&bytes);
24882 match serde_json::from_str(&encoded) {
24883 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
24884 Err(error) => {
24885 dlg.response_json_decode_error(&encoded, &error);
24886 return Err(common::Error::JsonDecodeError(
24887 encoded.to_string(),
24888 error,
24889 ));
24890 }
24891 }
24892 };
24893
24894 dlg.finished(true);
24895 return Ok(response);
24896 }
24897 }
24898 }
24899 }
24900
24901 /// Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
24902 ///
24903 /// Sets the *name* path property to the given value.
24904 ///
24905 /// Even though the property as already been set when instantiating this call,
24906 /// we provide this method for API completeness.
24907 pub fn name(mut self, new_value: &str) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
24908 self._name = new_value.to_string();
24909 self
24910 }
24911 /// API request version that initiates this operation.
24912 ///
24913 /// Sets the *version* query property to the given value.
24914 pub fn version(
24915 mut self,
24916 new_value: &str,
24917 ) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
24918 self._version = Some(new_value.to_string());
24919 self
24920 }
24921 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
24922 /// while executing the actual API request.
24923 ///
24924 /// ````text
24925 /// It should be used to handle progress information, and to implement a certain level of resilience.
24926 /// ````
24927 ///
24928 /// Sets the *delegate* property to the given value.
24929 pub fn delegate(
24930 mut self,
24931 new_value: &'a mut dyn common::Delegate,
24932 ) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
24933 self._delegate = Some(new_value);
24934 self
24935 }
24936
24937 /// Set any additional parameter of the query string used in the request.
24938 /// It should be used to set parameters which are not yet available through their own
24939 /// setters.
24940 ///
24941 /// Please note that this method must not be used to set any of the known parameters
24942 /// which have their own setter method. If done anyway, the request will fail.
24943 ///
24944 /// # Additional Parameters
24945 ///
24946 /// * *$.xgafv* (query-string) - V1 error format.
24947 /// * *access_token* (query-string) - OAuth access token.
24948 /// * *alt* (query-string) - Data format for response.
24949 /// * *callback* (query-string) - JSONP
24950 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
24951 /// * *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.
24952 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
24953 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
24954 /// * *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.
24955 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
24956 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
24957 pub fn param<T>(
24958 mut self,
24959 name: T,
24960 value: T,
24961 ) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
24962 where
24963 T: AsRef<str>,
24964 {
24965 self._additional_params
24966 .insert(name.as_ref().to_string(), value.as_ref().to_string());
24967 self
24968 }
24969
24970 /// Identifies the authorization scope for the method you are building.
24971 ///
24972 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
24973 /// [`Scope::CloudPlatform`].
24974 ///
24975 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
24976 /// tokens for more than one scope.
24977 ///
24978 /// Usually there is more than one suitable scope to authorize an operation, some of which may
24979 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
24980 /// sufficient, a read-write scope will do as well.
24981 pub fn add_scope<St>(
24982 mut self,
24983 scope: St,
24984 ) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
24985 where
24986 St: AsRef<str>,
24987 {
24988 self._scopes.insert(String::from(scope.as_ref()));
24989 self
24990 }
24991 /// Identifies the authorization scope(s) for the method you are building.
24992 ///
24993 /// See [`Self::add_scope()`] for details.
24994 pub fn add_scopes<I, St>(
24995 mut self,
24996 scopes: I,
24997 ) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
24998 where
24999 I: IntoIterator<Item = St>,
25000 St: AsRef<str>,
25001 {
25002 self._scopes
25003 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25004 self
25005 }
25006
25007 /// Removes all scopes, and no default scope will be used either.
25008 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25009 /// for details).
25010 pub fn clear_scopes(mut self) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
25011 self._scopes.clear();
25012 self
25013 }
25014}
25015
25016/// Gets the details of a specific cluster.
25017///
25018/// A builder for the *zones.clusters.get* method supported by a *project* resource.
25019/// It is not used directly, but through a [`ProjectMethods`] instance.
25020///
25021/// # Example
25022///
25023/// Instantiate a resource method builder
25024///
25025/// ```test_harness,no_run
25026/// # extern crate hyper;
25027/// # extern crate hyper_rustls;
25028/// # extern crate google_container1 as container1;
25029/// # async fn dox() {
25030/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25031///
25032/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25033/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25034/// # .with_native_roots()
25035/// # .unwrap()
25036/// # .https_only()
25037/// # .enable_http2()
25038/// # .build();
25039///
25040/// # let executor = hyper_util::rt::TokioExecutor::new();
25041/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25042/// # secret,
25043/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25044/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25045/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25046/// # ),
25047/// # ).build().await.unwrap();
25048///
25049/// # let client = hyper_util::client::legacy::Client::builder(
25050/// # hyper_util::rt::TokioExecutor::new()
25051/// # )
25052/// # .build(
25053/// # hyper_rustls::HttpsConnectorBuilder::new()
25054/// # .with_native_roots()
25055/// # .unwrap()
25056/// # .https_or_http()
25057/// # .enable_http2()
25058/// # .build()
25059/// # );
25060/// # let mut hub = Container::new(client, auth);
25061/// // You can configure optional parameters by calling the respective setters at will, and
25062/// // execute the final call using `doit()`.
25063/// // Values shown here are possibly random and not representative !
25064/// let result = hub.projects().zones_clusters_get("projectId", "zone", "clusterId")
25065/// .name("aliquyam")
25066/// .doit().await;
25067/// # }
25068/// ```
25069pub struct ProjectZoneClusterGetCall<'a, C>
25070where
25071 C: 'a,
25072{
25073 hub: &'a Container<C>,
25074 _project_id: String,
25075 _zone: String,
25076 _cluster_id: String,
25077 _name: Option<String>,
25078 _delegate: Option<&'a mut dyn common::Delegate>,
25079 _additional_params: HashMap<String, String>,
25080 _scopes: BTreeSet<String>,
25081}
25082
25083impl<'a, C> common::CallBuilder for ProjectZoneClusterGetCall<'a, C> {}
25084
25085impl<'a, C> ProjectZoneClusterGetCall<'a, C>
25086where
25087 C: common::Connector,
25088{
25089 /// Perform the operation you have build so far.
25090 pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
25091 use std::borrow::Cow;
25092 use std::io::{Read, Seek};
25093
25094 use common::{url::Params, ToParts};
25095 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25096
25097 let mut dd = common::DefaultDelegate;
25098 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25099 dlg.begin(common::MethodInfo {
25100 id: "container.projects.zones.clusters.get",
25101 http_method: hyper::Method::GET,
25102 });
25103
25104 for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
25105 if self._additional_params.contains_key(field) {
25106 dlg.finished(false);
25107 return Err(common::Error::FieldClash(field));
25108 }
25109 }
25110
25111 let mut params = Params::with_capacity(6 + self._additional_params.len());
25112 params.push("projectId", self._project_id);
25113 params.push("zone", self._zone);
25114 params.push("clusterId", self._cluster_id);
25115 if let Some(value) = self._name.as_ref() {
25116 params.push("name", value);
25117 }
25118
25119 params.extend(self._additional_params.iter());
25120
25121 params.push("alt", "json");
25122 let mut url = self.hub._base_url.clone()
25123 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
25124 if self._scopes.is_empty() {
25125 self._scopes
25126 .insert(Scope::CloudPlatform.as_ref().to_string());
25127 }
25128
25129 #[allow(clippy::single_element_loop)]
25130 for &(find_this, param_name) in [
25131 ("{projectId}", "projectId"),
25132 ("{zone}", "zone"),
25133 ("{clusterId}", "clusterId"),
25134 ]
25135 .iter()
25136 {
25137 url = params.uri_replacement(url, param_name, find_this, false);
25138 }
25139 {
25140 let to_remove = ["clusterId", "zone", "projectId"];
25141 params.remove_params(&to_remove);
25142 }
25143
25144 let url = params.parse_with_url(&url);
25145
25146 loop {
25147 let token = match self
25148 .hub
25149 .auth
25150 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25151 .await
25152 {
25153 Ok(token) => token,
25154 Err(e) => match dlg.token(e) {
25155 Ok(token) => token,
25156 Err(e) => {
25157 dlg.finished(false);
25158 return Err(common::Error::MissingToken(e));
25159 }
25160 },
25161 };
25162 let mut req_result = {
25163 let client = &self.hub.client;
25164 dlg.pre_request();
25165 let mut req_builder = hyper::Request::builder()
25166 .method(hyper::Method::GET)
25167 .uri(url.as_str())
25168 .header(USER_AGENT, self.hub._user_agent.clone());
25169
25170 if let Some(token) = token.as_ref() {
25171 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25172 }
25173
25174 let request = req_builder
25175 .header(CONTENT_LENGTH, 0_u64)
25176 .body(common::to_body::<String>(None));
25177
25178 client.request(request.unwrap()).await
25179 };
25180
25181 match req_result {
25182 Err(err) => {
25183 if let common::Retry::After(d) = dlg.http_error(&err) {
25184 sleep(d).await;
25185 continue;
25186 }
25187 dlg.finished(false);
25188 return Err(common::Error::HttpError(err));
25189 }
25190 Ok(res) => {
25191 let (mut parts, body) = res.into_parts();
25192 let mut body = common::Body::new(body);
25193 if !parts.status.is_success() {
25194 let bytes = common::to_bytes(body).await.unwrap_or_default();
25195 let error = serde_json::from_str(&common::to_string(&bytes));
25196 let response = common::to_response(parts, bytes.into());
25197
25198 if let common::Retry::After(d) =
25199 dlg.http_failure(&response, error.as_ref().ok())
25200 {
25201 sleep(d).await;
25202 continue;
25203 }
25204
25205 dlg.finished(false);
25206
25207 return Err(match error {
25208 Ok(value) => common::Error::BadRequest(value),
25209 _ => common::Error::Failure(response),
25210 });
25211 }
25212 let response = {
25213 let bytes = common::to_bytes(body).await.unwrap_or_default();
25214 let encoded = common::to_string(&bytes);
25215 match serde_json::from_str(&encoded) {
25216 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25217 Err(error) => {
25218 dlg.response_json_decode_error(&encoded, &error);
25219 return Err(common::Error::JsonDecodeError(
25220 encoded.to_string(),
25221 error,
25222 ));
25223 }
25224 }
25225 };
25226
25227 dlg.finished(true);
25228 return Ok(response);
25229 }
25230 }
25231 }
25232 }
25233
25234 /// 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.
25235 ///
25236 /// Sets the *project id* path property to the given value.
25237 ///
25238 /// Even though the property as already been set when instantiating this call,
25239 /// we provide this method for API completeness.
25240 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
25241 self._project_id = new_value.to_string();
25242 self
25243 }
25244 /// 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.
25245 ///
25246 /// Sets the *zone* path property to the given value.
25247 ///
25248 /// Even though the property as already been set when instantiating this call,
25249 /// we provide this method for API completeness.
25250 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
25251 self._zone = new_value.to_string();
25252 self
25253 }
25254 /// Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
25255 ///
25256 /// Sets the *cluster id* path property to the given value.
25257 ///
25258 /// Even though the property as already been set when instantiating this call,
25259 /// we provide this method for API completeness.
25260 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
25261 self._cluster_id = new_value.to_string();
25262 self
25263 }
25264 /// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
25265 ///
25266 /// Sets the *name* query property to the given value.
25267 pub fn name(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
25268 self._name = Some(new_value.to_string());
25269 self
25270 }
25271 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25272 /// while executing the actual API request.
25273 ///
25274 /// ````text
25275 /// It should be used to handle progress information, and to implement a certain level of resilience.
25276 /// ````
25277 ///
25278 /// Sets the *delegate* property to the given value.
25279 pub fn delegate(
25280 mut self,
25281 new_value: &'a mut dyn common::Delegate,
25282 ) -> ProjectZoneClusterGetCall<'a, C> {
25283 self._delegate = Some(new_value);
25284 self
25285 }
25286
25287 /// Set any additional parameter of the query string used in the request.
25288 /// It should be used to set parameters which are not yet available through their own
25289 /// setters.
25290 ///
25291 /// Please note that this method must not be used to set any of the known parameters
25292 /// which have their own setter method. If done anyway, the request will fail.
25293 ///
25294 /// # Additional Parameters
25295 ///
25296 /// * *$.xgafv* (query-string) - V1 error format.
25297 /// * *access_token* (query-string) - OAuth access token.
25298 /// * *alt* (query-string) - Data format for response.
25299 /// * *callback* (query-string) - JSONP
25300 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25301 /// * *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.
25302 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25303 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25304 /// * *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.
25305 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25306 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25307 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterGetCall<'a, C>
25308 where
25309 T: AsRef<str>,
25310 {
25311 self._additional_params
25312 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25313 self
25314 }
25315
25316 /// Identifies the authorization scope for the method you are building.
25317 ///
25318 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25319 /// [`Scope::CloudPlatform`].
25320 ///
25321 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25322 /// tokens for more than one scope.
25323 ///
25324 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25325 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25326 /// sufficient, a read-write scope will do as well.
25327 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterGetCall<'a, C>
25328 where
25329 St: AsRef<str>,
25330 {
25331 self._scopes.insert(String::from(scope.as_ref()));
25332 self
25333 }
25334 /// Identifies the authorization scope(s) for the method you are building.
25335 ///
25336 /// See [`Self::add_scope()`] for details.
25337 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterGetCall<'a, C>
25338 where
25339 I: IntoIterator<Item = St>,
25340 St: AsRef<str>,
25341 {
25342 self._scopes
25343 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25344 self
25345 }
25346
25347 /// Removes all scopes, and no default scope will be used either.
25348 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25349 /// for details).
25350 pub fn clear_scopes(mut self) -> ProjectZoneClusterGetCall<'a, C> {
25351 self._scopes.clear();
25352 self
25353 }
25354}
25355
25356/// Enables or disables the ABAC authorization mechanism on a cluster.
25357///
25358/// A builder for the *zones.clusters.legacyAbac* method supported by a *project* resource.
25359/// It is not used directly, but through a [`ProjectMethods`] instance.
25360///
25361/// # Example
25362///
25363/// Instantiate a resource method builder
25364///
25365/// ```test_harness,no_run
25366/// # extern crate hyper;
25367/// # extern crate hyper_rustls;
25368/// # extern crate google_container1 as container1;
25369/// use container1::api::SetLegacyAbacRequest;
25370/// # async fn dox() {
25371/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25372///
25373/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25374/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25375/// # .with_native_roots()
25376/// # .unwrap()
25377/// # .https_only()
25378/// # .enable_http2()
25379/// # .build();
25380///
25381/// # let executor = hyper_util::rt::TokioExecutor::new();
25382/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25383/// # secret,
25384/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25385/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25386/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25387/// # ),
25388/// # ).build().await.unwrap();
25389///
25390/// # let client = hyper_util::client::legacy::Client::builder(
25391/// # hyper_util::rt::TokioExecutor::new()
25392/// # )
25393/// # .build(
25394/// # hyper_rustls::HttpsConnectorBuilder::new()
25395/// # .with_native_roots()
25396/// # .unwrap()
25397/// # .https_or_http()
25398/// # .enable_http2()
25399/// # .build()
25400/// # );
25401/// # let mut hub = Container::new(client, auth);
25402/// // As the method needs a request, you would usually fill it with the desired information
25403/// // into the respective structure. Some of the parts shown here might not be applicable !
25404/// // Values shown here are possibly random and not representative !
25405/// let mut req = SetLegacyAbacRequest::default();
25406///
25407/// // You can configure optional parameters by calling the respective setters at will, and
25408/// // execute the final call using `doit()`.
25409/// // Values shown here are possibly random and not representative !
25410/// let result = hub.projects().zones_clusters_legacy_abac(req, "projectId", "zone", "clusterId")
25411/// .doit().await;
25412/// # }
25413/// ```
25414pub struct ProjectZoneClusterLegacyAbacCall<'a, C>
25415where
25416 C: 'a,
25417{
25418 hub: &'a Container<C>,
25419 _request: SetLegacyAbacRequest,
25420 _project_id: String,
25421 _zone: String,
25422 _cluster_id: String,
25423 _delegate: Option<&'a mut dyn common::Delegate>,
25424 _additional_params: HashMap<String, String>,
25425 _scopes: BTreeSet<String>,
25426}
25427
25428impl<'a, C> common::CallBuilder for ProjectZoneClusterLegacyAbacCall<'a, C> {}
25429
25430impl<'a, C> ProjectZoneClusterLegacyAbacCall<'a, C>
25431where
25432 C: common::Connector,
25433{
25434 /// Perform the operation you have build so far.
25435 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
25436 use std::borrow::Cow;
25437 use std::io::{Read, Seek};
25438
25439 use common::{url::Params, ToParts};
25440 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25441
25442 let mut dd = common::DefaultDelegate;
25443 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25444 dlg.begin(common::MethodInfo {
25445 id: "container.projects.zones.clusters.legacyAbac",
25446 http_method: hyper::Method::POST,
25447 });
25448
25449 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
25450 if self._additional_params.contains_key(field) {
25451 dlg.finished(false);
25452 return Err(common::Error::FieldClash(field));
25453 }
25454 }
25455
25456 let mut params = Params::with_capacity(6 + self._additional_params.len());
25457 params.push("projectId", self._project_id);
25458 params.push("zone", self._zone);
25459 params.push("clusterId", self._cluster_id);
25460
25461 params.extend(self._additional_params.iter());
25462
25463 params.push("alt", "json");
25464 let mut url = self.hub._base_url.clone()
25465 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/legacyAbac";
25466 if self._scopes.is_empty() {
25467 self._scopes
25468 .insert(Scope::CloudPlatform.as_ref().to_string());
25469 }
25470
25471 #[allow(clippy::single_element_loop)]
25472 for &(find_this, param_name) in [
25473 ("{projectId}", "projectId"),
25474 ("{zone}", "zone"),
25475 ("{clusterId}", "clusterId"),
25476 ]
25477 .iter()
25478 {
25479 url = params.uri_replacement(url, param_name, find_this, false);
25480 }
25481 {
25482 let to_remove = ["clusterId", "zone", "projectId"];
25483 params.remove_params(&to_remove);
25484 }
25485
25486 let url = params.parse_with_url(&url);
25487
25488 let mut json_mime_type = mime::APPLICATION_JSON;
25489 let mut request_value_reader = {
25490 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
25491 common::remove_json_null_values(&mut value);
25492 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
25493 serde_json::to_writer(&mut dst, &value).unwrap();
25494 dst
25495 };
25496 let request_size = request_value_reader
25497 .seek(std::io::SeekFrom::End(0))
25498 .unwrap();
25499 request_value_reader
25500 .seek(std::io::SeekFrom::Start(0))
25501 .unwrap();
25502
25503 loop {
25504 let token = match self
25505 .hub
25506 .auth
25507 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25508 .await
25509 {
25510 Ok(token) => token,
25511 Err(e) => match dlg.token(e) {
25512 Ok(token) => token,
25513 Err(e) => {
25514 dlg.finished(false);
25515 return Err(common::Error::MissingToken(e));
25516 }
25517 },
25518 };
25519 request_value_reader
25520 .seek(std::io::SeekFrom::Start(0))
25521 .unwrap();
25522 let mut req_result = {
25523 let client = &self.hub.client;
25524 dlg.pre_request();
25525 let mut req_builder = hyper::Request::builder()
25526 .method(hyper::Method::POST)
25527 .uri(url.as_str())
25528 .header(USER_AGENT, self.hub._user_agent.clone());
25529
25530 if let Some(token) = token.as_ref() {
25531 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25532 }
25533
25534 let request = req_builder
25535 .header(CONTENT_TYPE, json_mime_type.to_string())
25536 .header(CONTENT_LENGTH, request_size as u64)
25537 .body(common::to_body(
25538 request_value_reader.get_ref().clone().into(),
25539 ));
25540
25541 client.request(request.unwrap()).await
25542 };
25543
25544 match req_result {
25545 Err(err) => {
25546 if let common::Retry::After(d) = dlg.http_error(&err) {
25547 sleep(d).await;
25548 continue;
25549 }
25550 dlg.finished(false);
25551 return Err(common::Error::HttpError(err));
25552 }
25553 Ok(res) => {
25554 let (mut parts, body) = res.into_parts();
25555 let mut body = common::Body::new(body);
25556 if !parts.status.is_success() {
25557 let bytes = common::to_bytes(body).await.unwrap_or_default();
25558 let error = serde_json::from_str(&common::to_string(&bytes));
25559 let response = common::to_response(parts, bytes.into());
25560
25561 if let common::Retry::After(d) =
25562 dlg.http_failure(&response, error.as_ref().ok())
25563 {
25564 sleep(d).await;
25565 continue;
25566 }
25567
25568 dlg.finished(false);
25569
25570 return Err(match error {
25571 Ok(value) => common::Error::BadRequest(value),
25572 _ => common::Error::Failure(response),
25573 });
25574 }
25575 let response = {
25576 let bytes = common::to_bytes(body).await.unwrap_or_default();
25577 let encoded = common::to_string(&bytes);
25578 match serde_json::from_str(&encoded) {
25579 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25580 Err(error) => {
25581 dlg.response_json_decode_error(&encoded, &error);
25582 return Err(common::Error::JsonDecodeError(
25583 encoded.to_string(),
25584 error,
25585 ));
25586 }
25587 }
25588 };
25589
25590 dlg.finished(true);
25591 return Ok(response);
25592 }
25593 }
25594 }
25595 }
25596
25597 ///
25598 /// Sets the *request* property to the given value.
25599 ///
25600 /// Even though the property as already been set when instantiating this call,
25601 /// we provide this method for API completeness.
25602 pub fn request(
25603 mut self,
25604 new_value: SetLegacyAbacRequest,
25605 ) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
25606 self._request = new_value;
25607 self
25608 }
25609 /// 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.
25610 ///
25611 /// Sets the *project id* path property to the given value.
25612 ///
25613 /// Even though the property as already been set when instantiating this call,
25614 /// we provide this method for API completeness.
25615 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
25616 self._project_id = new_value.to_string();
25617 self
25618 }
25619 /// 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.
25620 ///
25621 /// Sets the *zone* path property to the given value.
25622 ///
25623 /// Even though the property as already been set when instantiating this call,
25624 /// we provide this method for API completeness.
25625 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
25626 self._zone = new_value.to_string();
25627 self
25628 }
25629 /// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
25630 ///
25631 /// Sets the *cluster id* path property to the given value.
25632 ///
25633 /// Even though the property as already been set when instantiating this call,
25634 /// we provide this method for API completeness.
25635 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
25636 self._cluster_id = new_value.to_string();
25637 self
25638 }
25639 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25640 /// while executing the actual API request.
25641 ///
25642 /// ````text
25643 /// It should be used to handle progress information, and to implement a certain level of resilience.
25644 /// ````
25645 ///
25646 /// Sets the *delegate* property to the given value.
25647 pub fn delegate(
25648 mut self,
25649 new_value: &'a mut dyn common::Delegate,
25650 ) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
25651 self._delegate = Some(new_value);
25652 self
25653 }
25654
25655 /// Set any additional parameter of the query string used in the request.
25656 /// It should be used to set parameters which are not yet available through their own
25657 /// setters.
25658 ///
25659 /// Please note that this method must not be used to set any of the known parameters
25660 /// which have their own setter method. If done anyway, the request will fail.
25661 ///
25662 /// # Additional Parameters
25663 ///
25664 /// * *$.xgafv* (query-string) - V1 error format.
25665 /// * *access_token* (query-string) - OAuth access token.
25666 /// * *alt* (query-string) - Data format for response.
25667 /// * *callback* (query-string) - JSONP
25668 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25669 /// * *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.
25670 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25671 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25672 /// * *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.
25673 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25674 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25675 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLegacyAbacCall<'a, C>
25676 where
25677 T: AsRef<str>,
25678 {
25679 self._additional_params
25680 .insert(name.as_ref().to_string(), value.as_ref().to_string());
25681 self
25682 }
25683
25684 /// Identifies the authorization scope for the method you are building.
25685 ///
25686 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
25687 /// [`Scope::CloudPlatform`].
25688 ///
25689 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
25690 /// tokens for more than one scope.
25691 ///
25692 /// Usually there is more than one suitable scope to authorize an operation, some of which may
25693 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
25694 /// sufficient, a read-write scope will do as well.
25695 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLegacyAbacCall<'a, C>
25696 where
25697 St: AsRef<str>,
25698 {
25699 self._scopes.insert(String::from(scope.as_ref()));
25700 self
25701 }
25702 /// Identifies the authorization scope(s) for the method you are building.
25703 ///
25704 /// See [`Self::add_scope()`] for details.
25705 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLegacyAbacCall<'a, C>
25706 where
25707 I: IntoIterator<Item = St>,
25708 St: AsRef<str>,
25709 {
25710 self._scopes
25711 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
25712 self
25713 }
25714
25715 /// Removes all scopes, and no default scope will be used either.
25716 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
25717 /// for details).
25718 pub fn clear_scopes(mut self) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
25719 self._scopes.clear();
25720 self
25721 }
25722}
25723
25724/// Lists all clusters owned by a project in either the specified zone or all zones.
25725///
25726/// A builder for the *zones.clusters.list* method supported by a *project* resource.
25727/// It is not used directly, but through a [`ProjectMethods`] instance.
25728///
25729/// # Example
25730///
25731/// Instantiate a resource method builder
25732///
25733/// ```test_harness,no_run
25734/// # extern crate hyper;
25735/// # extern crate hyper_rustls;
25736/// # extern crate google_container1 as container1;
25737/// # async fn dox() {
25738/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
25739///
25740/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
25741/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
25742/// # .with_native_roots()
25743/// # .unwrap()
25744/// # .https_only()
25745/// # .enable_http2()
25746/// # .build();
25747///
25748/// # let executor = hyper_util::rt::TokioExecutor::new();
25749/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
25750/// # secret,
25751/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
25752/// # yup_oauth2::client::CustomHyperClientBuilder::from(
25753/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
25754/// # ),
25755/// # ).build().await.unwrap();
25756///
25757/// # let client = hyper_util::client::legacy::Client::builder(
25758/// # hyper_util::rt::TokioExecutor::new()
25759/// # )
25760/// # .build(
25761/// # hyper_rustls::HttpsConnectorBuilder::new()
25762/// # .with_native_roots()
25763/// # .unwrap()
25764/// # .https_or_http()
25765/// # .enable_http2()
25766/// # .build()
25767/// # );
25768/// # let mut hub = Container::new(client, auth);
25769/// // You can configure optional parameters by calling the respective setters at will, and
25770/// // execute the final call using `doit()`.
25771/// // Values shown here are possibly random and not representative !
25772/// let result = hub.projects().zones_clusters_list("projectId", "zone")
25773/// .parent("sed")
25774/// .doit().await;
25775/// # }
25776/// ```
25777pub struct ProjectZoneClusterListCall<'a, C>
25778where
25779 C: 'a,
25780{
25781 hub: &'a Container<C>,
25782 _project_id: String,
25783 _zone: String,
25784 _parent: Option<String>,
25785 _delegate: Option<&'a mut dyn common::Delegate>,
25786 _additional_params: HashMap<String, String>,
25787 _scopes: BTreeSet<String>,
25788}
25789
25790impl<'a, C> common::CallBuilder for ProjectZoneClusterListCall<'a, C> {}
25791
25792impl<'a, C> ProjectZoneClusterListCall<'a, C>
25793where
25794 C: common::Connector,
25795{
25796 /// Perform the operation you have build so far.
25797 pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
25798 use std::borrow::Cow;
25799 use std::io::{Read, Seek};
25800
25801 use common::{url::Params, ToParts};
25802 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
25803
25804 let mut dd = common::DefaultDelegate;
25805 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
25806 dlg.begin(common::MethodInfo {
25807 id: "container.projects.zones.clusters.list",
25808 http_method: hyper::Method::GET,
25809 });
25810
25811 for &field in ["alt", "projectId", "zone", "parent"].iter() {
25812 if self._additional_params.contains_key(field) {
25813 dlg.finished(false);
25814 return Err(common::Error::FieldClash(field));
25815 }
25816 }
25817
25818 let mut params = Params::with_capacity(5 + self._additional_params.len());
25819 params.push("projectId", self._project_id);
25820 params.push("zone", self._zone);
25821 if let Some(value) = self._parent.as_ref() {
25822 params.push("parent", value);
25823 }
25824
25825 params.extend(self._additional_params.iter());
25826
25827 params.push("alt", "json");
25828 let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
25829 if self._scopes.is_empty() {
25830 self._scopes
25831 .insert(Scope::CloudPlatform.as_ref().to_string());
25832 }
25833
25834 #[allow(clippy::single_element_loop)]
25835 for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
25836 url = params.uri_replacement(url, param_name, find_this, false);
25837 }
25838 {
25839 let to_remove = ["zone", "projectId"];
25840 params.remove_params(&to_remove);
25841 }
25842
25843 let url = params.parse_with_url(&url);
25844
25845 loop {
25846 let token = match self
25847 .hub
25848 .auth
25849 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
25850 .await
25851 {
25852 Ok(token) => token,
25853 Err(e) => match dlg.token(e) {
25854 Ok(token) => token,
25855 Err(e) => {
25856 dlg.finished(false);
25857 return Err(common::Error::MissingToken(e));
25858 }
25859 },
25860 };
25861 let mut req_result = {
25862 let client = &self.hub.client;
25863 dlg.pre_request();
25864 let mut req_builder = hyper::Request::builder()
25865 .method(hyper::Method::GET)
25866 .uri(url.as_str())
25867 .header(USER_AGENT, self.hub._user_agent.clone());
25868
25869 if let Some(token) = token.as_ref() {
25870 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
25871 }
25872
25873 let request = req_builder
25874 .header(CONTENT_LENGTH, 0_u64)
25875 .body(common::to_body::<String>(None));
25876
25877 client.request(request.unwrap()).await
25878 };
25879
25880 match req_result {
25881 Err(err) => {
25882 if let common::Retry::After(d) = dlg.http_error(&err) {
25883 sleep(d).await;
25884 continue;
25885 }
25886 dlg.finished(false);
25887 return Err(common::Error::HttpError(err));
25888 }
25889 Ok(res) => {
25890 let (mut parts, body) = res.into_parts();
25891 let mut body = common::Body::new(body);
25892 if !parts.status.is_success() {
25893 let bytes = common::to_bytes(body).await.unwrap_or_default();
25894 let error = serde_json::from_str(&common::to_string(&bytes));
25895 let response = common::to_response(parts, bytes.into());
25896
25897 if let common::Retry::After(d) =
25898 dlg.http_failure(&response, error.as_ref().ok())
25899 {
25900 sleep(d).await;
25901 continue;
25902 }
25903
25904 dlg.finished(false);
25905
25906 return Err(match error {
25907 Ok(value) => common::Error::BadRequest(value),
25908 _ => common::Error::Failure(response),
25909 });
25910 }
25911 let response = {
25912 let bytes = common::to_bytes(body).await.unwrap_or_default();
25913 let encoded = common::to_string(&bytes);
25914 match serde_json::from_str(&encoded) {
25915 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
25916 Err(error) => {
25917 dlg.response_json_decode_error(&encoded, &error);
25918 return Err(common::Error::JsonDecodeError(
25919 encoded.to_string(),
25920 error,
25921 ));
25922 }
25923 }
25924 };
25925
25926 dlg.finished(true);
25927 return Ok(response);
25928 }
25929 }
25930 }
25931 }
25932
25933 /// 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.
25934 ///
25935 /// Sets the *project id* path property to the given value.
25936 ///
25937 /// Even though the property as already been set when instantiating this call,
25938 /// we provide this method for API completeness.
25939 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
25940 self._project_id = new_value.to_string();
25941 self
25942 }
25943 /// 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.
25944 ///
25945 /// Sets the *zone* path property to the given value.
25946 ///
25947 /// Even though the property as already been set when instantiating this call,
25948 /// we provide this method for API completeness.
25949 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
25950 self._zone = new_value.to_string();
25951 self
25952 }
25953 /// The parent (project and location) where the clusters will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
25954 ///
25955 /// Sets the *parent* query property to the given value.
25956 pub fn parent(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
25957 self._parent = Some(new_value.to_string());
25958 self
25959 }
25960 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
25961 /// while executing the actual API request.
25962 ///
25963 /// ````text
25964 /// It should be used to handle progress information, and to implement a certain level of resilience.
25965 /// ````
25966 ///
25967 /// Sets the *delegate* property to the given value.
25968 pub fn delegate(
25969 mut self,
25970 new_value: &'a mut dyn common::Delegate,
25971 ) -> ProjectZoneClusterListCall<'a, C> {
25972 self._delegate = Some(new_value);
25973 self
25974 }
25975
25976 /// Set any additional parameter of the query string used in the request.
25977 /// It should be used to set parameters which are not yet available through their own
25978 /// setters.
25979 ///
25980 /// Please note that this method must not be used to set any of the known parameters
25981 /// which have their own setter method. If done anyway, the request will fail.
25982 ///
25983 /// # Additional Parameters
25984 ///
25985 /// * *$.xgafv* (query-string) - V1 error format.
25986 /// * *access_token* (query-string) - OAuth access token.
25987 /// * *alt* (query-string) - Data format for response.
25988 /// * *callback* (query-string) - JSONP
25989 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
25990 /// * *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.
25991 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
25992 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
25993 /// * *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.
25994 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
25995 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
25996 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterListCall<'a, C>
25997 where
25998 T: AsRef<str>,
25999 {
26000 self._additional_params
26001 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26002 self
26003 }
26004
26005 /// Identifies the authorization scope for the method you are building.
26006 ///
26007 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26008 /// [`Scope::CloudPlatform`].
26009 ///
26010 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26011 /// tokens for more than one scope.
26012 ///
26013 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26014 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26015 /// sufficient, a read-write scope will do as well.
26016 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterListCall<'a, C>
26017 where
26018 St: AsRef<str>,
26019 {
26020 self._scopes.insert(String::from(scope.as_ref()));
26021 self
26022 }
26023 /// Identifies the authorization scope(s) for the method you are building.
26024 ///
26025 /// See [`Self::add_scope()`] for details.
26026 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterListCall<'a, C>
26027 where
26028 I: IntoIterator<Item = St>,
26029 St: AsRef<str>,
26030 {
26031 self._scopes
26032 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26033 self
26034 }
26035
26036 /// Removes all scopes, and no default scope will be used either.
26037 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26038 /// for details).
26039 pub fn clear_scopes(mut self) -> ProjectZoneClusterListCall<'a, C> {
26040 self._scopes.clear();
26041 self
26042 }
26043}
26044
26045/// 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.
26046///
26047/// A builder for the *zones.clusters.locations* method supported by a *project* resource.
26048/// It is not used directly, but through a [`ProjectMethods`] instance.
26049///
26050/// # Example
26051///
26052/// Instantiate a resource method builder
26053///
26054/// ```test_harness,no_run
26055/// # extern crate hyper;
26056/// # extern crate hyper_rustls;
26057/// # extern crate google_container1 as container1;
26058/// use container1::api::SetLocationsRequest;
26059/// # async fn dox() {
26060/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26061///
26062/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26063/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26064/// # .with_native_roots()
26065/// # .unwrap()
26066/// # .https_only()
26067/// # .enable_http2()
26068/// # .build();
26069///
26070/// # let executor = hyper_util::rt::TokioExecutor::new();
26071/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26072/// # secret,
26073/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26074/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26075/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26076/// # ),
26077/// # ).build().await.unwrap();
26078///
26079/// # let client = hyper_util::client::legacy::Client::builder(
26080/// # hyper_util::rt::TokioExecutor::new()
26081/// # )
26082/// # .build(
26083/// # hyper_rustls::HttpsConnectorBuilder::new()
26084/// # .with_native_roots()
26085/// # .unwrap()
26086/// # .https_or_http()
26087/// # .enable_http2()
26088/// # .build()
26089/// # );
26090/// # let mut hub = Container::new(client, auth);
26091/// // As the method needs a request, you would usually fill it with the desired information
26092/// // into the respective structure. Some of the parts shown here might not be applicable !
26093/// // Values shown here are possibly random and not representative !
26094/// let mut req = SetLocationsRequest::default();
26095///
26096/// // You can configure optional parameters by calling the respective setters at will, and
26097/// // execute the final call using `doit()`.
26098/// // Values shown here are possibly random and not representative !
26099/// let result = hub.projects().zones_clusters_locations(req, "projectId", "zone", "clusterId")
26100/// .doit().await;
26101/// # }
26102/// ```
26103pub struct ProjectZoneClusterLocationCall<'a, C>
26104where
26105 C: 'a,
26106{
26107 hub: &'a Container<C>,
26108 _request: SetLocationsRequest,
26109 _project_id: String,
26110 _zone: String,
26111 _cluster_id: String,
26112 _delegate: Option<&'a mut dyn common::Delegate>,
26113 _additional_params: HashMap<String, String>,
26114 _scopes: BTreeSet<String>,
26115}
26116
26117impl<'a, C> common::CallBuilder for ProjectZoneClusterLocationCall<'a, C> {}
26118
26119impl<'a, C> ProjectZoneClusterLocationCall<'a, C>
26120where
26121 C: common::Connector,
26122{
26123 /// Perform the operation you have build so far.
26124 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26125 use std::borrow::Cow;
26126 use std::io::{Read, Seek};
26127
26128 use common::{url::Params, ToParts};
26129 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26130
26131 let mut dd = common::DefaultDelegate;
26132 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26133 dlg.begin(common::MethodInfo {
26134 id: "container.projects.zones.clusters.locations",
26135 http_method: hyper::Method::POST,
26136 });
26137
26138 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
26139 if self._additional_params.contains_key(field) {
26140 dlg.finished(false);
26141 return Err(common::Error::FieldClash(field));
26142 }
26143 }
26144
26145 let mut params = Params::with_capacity(6 + self._additional_params.len());
26146 params.push("projectId", self._project_id);
26147 params.push("zone", self._zone);
26148 params.push("clusterId", self._cluster_id);
26149
26150 params.extend(self._additional_params.iter());
26151
26152 params.push("alt", "json");
26153 let mut url = self.hub._base_url.clone()
26154 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/locations";
26155 if self._scopes.is_empty() {
26156 self._scopes
26157 .insert(Scope::CloudPlatform.as_ref().to_string());
26158 }
26159
26160 #[allow(clippy::single_element_loop)]
26161 for &(find_this, param_name) in [
26162 ("{projectId}", "projectId"),
26163 ("{zone}", "zone"),
26164 ("{clusterId}", "clusterId"),
26165 ]
26166 .iter()
26167 {
26168 url = params.uri_replacement(url, param_name, find_this, false);
26169 }
26170 {
26171 let to_remove = ["clusterId", "zone", "projectId"];
26172 params.remove_params(&to_remove);
26173 }
26174
26175 let url = params.parse_with_url(&url);
26176
26177 let mut json_mime_type = mime::APPLICATION_JSON;
26178 let mut request_value_reader = {
26179 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26180 common::remove_json_null_values(&mut value);
26181 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26182 serde_json::to_writer(&mut dst, &value).unwrap();
26183 dst
26184 };
26185 let request_size = request_value_reader
26186 .seek(std::io::SeekFrom::End(0))
26187 .unwrap();
26188 request_value_reader
26189 .seek(std::io::SeekFrom::Start(0))
26190 .unwrap();
26191
26192 loop {
26193 let token = match self
26194 .hub
26195 .auth
26196 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26197 .await
26198 {
26199 Ok(token) => token,
26200 Err(e) => match dlg.token(e) {
26201 Ok(token) => token,
26202 Err(e) => {
26203 dlg.finished(false);
26204 return Err(common::Error::MissingToken(e));
26205 }
26206 },
26207 };
26208 request_value_reader
26209 .seek(std::io::SeekFrom::Start(0))
26210 .unwrap();
26211 let mut req_result = {
26212 let client = &self.hub.client;
26213 dlg.pre_request();
26214 let mut req_builder = hyper::Request::builder()
26215 .method(hyper::Method::POST)
26216 .uri(url.as_str())
26217 .header(USER_AGENT, self.hub._user_agent.clone());
26218
26219 if let Some(token) = token.as_ref() {
26220 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26221 }
26222
26223 let request = req_builder
26224 .header(CONTENT_TYPE, json_mime_type.to_string())
26225 .header(CONTENT_LENGTH, request_size as u64)
26226 .body(common::to_body(
26227 request_value_reader.get_ref().clone().into(),
26228 ));
26229
26230 client.request(request.unwrap()).await
26231 };
26232
26233 match req_result {
26234 Err(err) => {
26235 if let common::Retry::After(d) = dlg.http_error(&err) {
26236 sleep(d).await;
26237 continue;
26238 }
26239 dlg.finished(false);
26240 return Err(common::Error::HttpError(err));
26241 }
26242 Ok(res) => {
26243 let (mut parts, body) = res.into_parts();
26244 let mut body = common::Body::new(body);
26245 if !parts.status.is_success() {
26246 let bytes = common::to_bytes(body).await.unwrap_or_default();
26247 let error = serde_json::from_str(&common::to_string(&bytes));
26248 let response = common::to_response(parts, bytes.into());
26249
26250 if let common::Retry::After(d) =
26251 dlg.http_failure(&response, error.as_ref().ok())
26252 {
26253 sleep(d).await;
26254 continue;
26255 }
26256
26257 dlg.finished(false);
26258
26259 return Err(match error {
26260 Ok(value) => common::Error::BadRequest(value),
26261 _ => common::Error::Failure(response),
26262 });
26263 }
26264 let response = {
26265 let bytes = common::to_bytes(body).await.unwrap_or_default();
26266 let encoded = common::to_string(&bytes);
26267 match serde_json::from_str(&encoded) {
26268 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26269 Err(error) => {
26270 dlg.response_json_decode_error(&encoded, &error);
26271 return Err(common::Error::JsonDecodeError(
26272 encoded.to_string(),
26273 error,
26274 ));
26275 }
26276 }
26277 };
26278
26279 dlg.finished(true);
26280 return Ok(response);
26281 }
26282 }
26283 }
26284 }
26285
26286 ///
26287 /// Sets the *request* property to the given value.
26288 ///
26289 /// Even though the property as already been set when instantiating this call,
26290 /// we provide this method for API completeness.
26291 pub fn request(
26292 mut self,
26293 new_value: SetLocationsRequest,
26294 ) -> ProjectZoneClusterLocationCall<'a, C> {
26295 self._request = new_value;
26296 self
26297 }
26298 /// 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.
26299 ///
26300 /// Sets the *project id* path property to the given value.
26301 ///
26302 /// Even though the property as already been set when instantiating this call,
26303 /// we provide this method for API completeness.
26304 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
26305 self._project_id = new_value.to_string();
26306 self
26307 }
26308 /// 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.
26309 ///
26310 /// Sets the *zone* path property to the given value.
26311 ///
26312 /// Even though the property as already been set when instantiating this call,
26313 /// we provide this method for API completeness.
26314 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
26315 self._zone = new_value.to_string();
26316 self
26317 }
26318 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
26319 ///
26320 /// Sets the *cluster id* path property to the given value.
26321 ///
26322 /// Even though the property as already been set when instantiating this call,
26323 /// we provide this method for API completeness.
26324 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
26325 self._cluster_id = new_value.to_string();
26326 self
26327 }
26328 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26329 /// while executing the actual API request.
26330 ///
26331 /// ````text
26332 /// It should be used to handle progress information, and to implement a certain level of resilience.
26333 /// ````
26334 ///
26335 /// Sets the *delegate* property to the given value.
26336 pub fn delegate(
26337 mut self,
26338 new_value: &'a mut dyn common::Delegate,
26339 ) -> ProjectZoneClusterLocationCall<'a, C> {
26340 self._delegate = Some(new_value);
26341 self
26342 }
26343
26344 /// Set any additional parameter of the query string used in the request.
26345 /// It should be used to set parameters which are not yet available through their own
26346 /// setters.
26347 ///
26348 /// Please note that this method must not be used to set any of the known parameters
26349 /// which have their own setter method. If done anyway, the request will fail.
26350 ///
26351 /// # Additional Parameters
26352 ///
26353 /// * *$.xgafv* (query-string) - V1 error format.
26354 /// * *access_token* (query-string) - OAuth access token.
26355 /// * *alt* (query-string) - Data format for response.
26356 /// * *callback* (query-string) - JSONP
26357 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26358 /// * *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.
26359 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26360 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26361 /// * *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.
26362 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26363 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26364 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLocationCall<'a, C>
26365 where
26366 T: AsRef<str>,
26367 {
26368 self._additional_params
26369 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26370 self
26371 }
26372
26373 /// Identifies the authorization scope for the method you are building.
26374 ///
26375 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26376 /// [`Scope::CloudPlatform`].
26377 ///
26378 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26379 /// tokens for more than one scope.
26380 ///
26381 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26382 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26383 /// sufficient, a read-write scope will do as well.
26384 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLocationCall<'a, C>
26385 where
26386 St: AsRef<str>,
26387 {
26388 self._scopes.insert(String::from(scope.as_ref()));
26389 self
26390 }
26391 /// Identifies the authorization scope(s) for the method you are building.
26392 ///
26393 /// See [`Self::add_scope()`] for details.
26394 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLocationCall<'a, C>
26395 where
26396 I: IntoIterator<Item = St>,
26397 St: AsRef<str>,
26398 {
26399 self._scopes
26400 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26401 self
26402 }
26403
26404 /// Removes all scopes, and no default scope will be used either.
26405 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26406 /// for details).
26407 pub fn clear_scopes(mut self) -> ProjectZoneClusterLocationCall<'a, C> {
26408 self._scopes.clear();
26409 self
26410 }
26411}
26412
26413/// Sets the logging service for a specific cluster.
26414///
26415/// A builder for the *zones.clusters.logging* method supported by a *project* resource.
26416/// It is not used directly, but through a [`ProjectMethods`] instance.
26417///
26418/// # Example
26419///
26420/// Instantiate a resource method builder
26421///
26422/// ```test_harness,no_run
26423/// # extern crate hyper;
26424/// # extern crate hyper_rustls;
26425/// # extern crate google_container1 as container1;
26426/// use container1::api::SetLoggingServiceRequest;
26427/// # async fn dox() {
26428/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26429///
26430/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26431/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26432/// # .with_native_roots()
26433/// # .unwrap()
26434/// # .https_only()
26435/// # .enable_http2()
26436/// # .build();
26437///
26438/// # let executor = hyper_util::rt::TokioExecutor::new();
26439/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26440/// # secret,
26441/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26442/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26443/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26444/// # ),
26445/// # ).build().await.unwrap();
26446///
26447/// # let client = hyper_util::client::legacy::Client::builder(
26448/// # hyper_util::rt::TokioExecutor::new()
26449/// # )
26450/// # .build(
26451/// # hyper_rustls::HttpsConnectorBuilder::new()
26452/// # .with_native_roots()
26453/// # .unwrap()
26454/// # .https_or_http()
26455/// # .enable_http2()
26456/// # .build()
26457/// # );
26458/// # let mut hub = Container::new(client, auth);
26459/// // As the method needs a request, you would usually fill it with the desired information
26460/// // into the respective structure. Some of the parts shown here might not be applicable !
26461/// // Values shown here are possibly random and not representative !
26462/// let mut req = SetLoggingServiceRequest::default();
26463///
26464/// // You can configure optional parameters by calling the respective setters at will, and
26465/// // execute the final call using `doit()`.
26466/// // Values shown here are possibly random and not representative !
26467/// let result = hub.projects().zones_clusters_logging(req, "projectId", "zone", "clusterId")
26468/// .doit().await;
26469/// # }
26470/// ```
26471pub struct ProjectZoneClusterLoggingCall<'a, C>
26472where
26473 C: 'a,
26474{
26475 hub: &'a Container<C>,
26476 _request: SetLoggingServiceRequest,
26477 _project_id: String,
26478 _zone: String,
26479 _cluster_id: String,
26480 _delegate: Option<&'a mut dyn common::Delegate>,
26481 _additional_params: HashMap<String, String>,
26482 _scopes: BTreeSet<String>,
26483}
26484
26485impl<'a, C> common::CallBuilder for ProjectZoneClusterLoggingCall<'a, C> {}
26486
26487impl<'a, C> ProjectZoneClusterLoggingCall<'a, C>
26488where
26489 C: common::Connector,
26490{
26491 /// Perform the operation you have build so far.
26492 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26493 use std::borrow::Cow;
26494 use std::io::{Read, Seek};
26495
26496 use common::{url::Params, ToParts};
26497 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26498
26499 let mut dd = common::DefaultDelegate;
26500 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26501 dlg.begin(common::MethodInfo {
26502 id: "container.projects.zones.clusters.logging",
26503 http_method: hyper::Method::POST,
26504 });
26505
26506 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
26507 if self._additional_params.contains_key(field) {
26508 dlg.finished(false);
26509 return Err(common::Error::FieldClash(field));
26510 }
26511 }
26512
26513 let mut params = Params::with_capacity(6 + self._additional_params.len());
26514 params.push("projectId", self._project_id);
26515 params.push("zone", self._zone);
26516 params.push("clusterId", self._cluster_id);
26517
26518 params.extend(self._additional_params.iter());
26519
26520 params.push("alt", "json");
26521 let mut url = self.hub._base_url.clone()
26522 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/logging";
26523 if self._scopes.is_empty() {
26524 self._scopes
26525 .insert(Scope::CloudPlatform.as_ref().to_string());
26526 }
26527
26528 #[allow(clippy::single_element_loop)]
26529 for &(find_this, param_name) in [
26530 ("{projectId}", "projectId"),
26531 ("{zone}", "zone"),
26532 ("{clusterId}", "clusterId"),
26533 ]
26534 .iter()
26535 {
26536 url = params.uri_replacement(url, param_name, find_this, false);
26537 }
26538 {
26539 let to_remove = ["clusterId", "zone", "projectId"];
26540 params.remove_params(&to_remove);
26541 }
26542
26543 let url = params.parse_with_url(&url);
26544
26545 let mut json_mime_type = mime::APPLICATION_JSON;
26546 let mut request_value_reader = {
26547 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26548 common::remove_json_null_values(&mut value);
26549 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26550 serde_json::to_writer(&mut dst, &value).unwrap();
26551 dst
26552 };
26553 let request_size = request_value_reader
26554 .seek(std::io::SeekFrom::End(0))
26555 .unwrap();
26556 request_value_reader
26557 .seek(std::io::SeekFrom::Start(0))
26558 .unwrap();
26559
26560 loop {
26561 let token = match self
26562 .hub
26563 .auth
26564 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26565 .await
26566 {
26567 Ok(token) => token,
26568 Err(e) => match dlg.token(e) {
26569 Ok(token) => token,
26570 Err(e) => {
26571 dlg.finished(false);
26572 return Err(common::Error::MissingToken(e));
26573 }
26574 },
26575 };
26576 request_value_reader
26577 .seek(std::io::SeekFrom::Start(0))
26578 .unwrap();
26579 let mut req_result = {
26580 let client = &self.hub.client;
26581 dlg.pre_request();
26582 let mut req_builder = hyper::Request::builder()
26583 .method(hyper::Method::POST)
26584 .uri(url.as_str())
26585 .header(USER_AGENT, self.hub._user_agent.clone());
26586
26587 if let Some(token) = token.as_ref() {
26588 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26589 }
26590
26591 let request = req_builder
26592 .header(CONTENT_TYPE, json_mime_type.to_string())
26593 .header(CONTENT_LENGTH, request_size as u64)
26594 .body(common::to_body(
26595 request_value_reader.get_ref().clone().into(),
26596 ));
26597
26598 client.request(request.unwrap()).await
26599 };
26600
26601 match req_result {
26602 Err(err) => {
26603 if let common::Retry::After(d) = dlg.http_error(&err) {
26604 sleep(d).await;
26605 continue;
26606 }
26607 dlg.finished(false);
26608 return Err(common::Error::HttpError(err));
26609 }
26610 Ok(res) => {
26611 let (mut parts, body) = res.into_parts();
26612 let mut body = common::Body::new(body);
26613 if !parts.status.is_success() {
26614 let bytes = common::to_bytes(body).await.unwrap_or_default();
26615 let error = serde_json::from_str(&common::to_string(&bytes));
26616 let response = common::to_response(parts, bytes.into());
26617
26618 if let common::Retry::After(d) =
26619 dlg.http_failure(&response, error.as_ref().ok())
26620 {
26621 sleep(d).await;
26622 continue;
26623 }
26624
26625 dlg.finished(false);
26626
26627 return Err(match error {
26628 Ok(value) => common::Error::BadRequest(value),
26629 _ => common::Error::Failure(response),
26630 });
26631 }
26632 let response = {
26633 let bytes = common::to_bytes(body).await.unwrap_or_default();
26634 let encoded = common::to_string(&bytes);
26635 match serde_json::from_str(&encoded) {
26636 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
26637 Err(error) => {
26638 dlg.response_json_decode_error(&encoded, &error);
26639 return Err(common::Error::JsonDecodeError(
26640 encoded.to_string(),
26641 error,
26642 ));
26643 }
26644 }
26645 };
26646
26647 dlg.finished(true);
26648 return Ok(response);
26649 }
26650 }
26651 }
26652 }
26653
26654 ///
26655 /// Sets the *request* property to the given value.
26656 ///
26657 /// Even though the property as already been set when instantiating this call,
26658 /// we provide this method for API completeness.
26659 pub fn request(
26660 mut self,
26661 new_value: SetLoggingServiceRequest,
26662 ) -> ProjectZoneClusterLoggingCall<'a, C> {
26663 self._request = new_value;
26664 self
26665 }
26666 /// 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.
26667 ///
26668 /// Sets the *project id* path property to the given value.
26669 ///
26670 /// Even though the property as already been set when instantiating this call,
26671 /// we provide this method for API completeness.
26672 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
26673 self._project_id = new_value.to_string();
26674 self
26675 }
26676 /// 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.
26677 ///
26678 /// Sets the *zone* path property to the given value.
26679 ///
26680 /// Even though the property as already been set when instantiating this call,
26681 /// we provide this method for API completeness.
26682 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
26683 self._zone = new_value.to_string();
26684 self
26685 }
26686 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
26687 ///
26688 /// Sets the *cluster id* path property to the given value.
26689 ///
26690 /// Even though the property as already been set when instantiating this call,
26691 /// we provide this method for API completeness.
26692 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
26693 self._cluster_id = new_value.to_string();
26694 self
26695 }
26696 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
26697 /// while executing the actual API request.
26698 ///
26699 /// ````text
26700 /// It should be used to handle progress information, and to implement a certain level of resilience.
26701 /// ````
26702 ///
26703 /// Sets the *delegate* property to the given value.
26704 pub fn delegate(
26705 mut self,
26706 new_value: &'a mut dyn common::Delegate,
26707 ) -> ProjectZoneClusterLoggingCall<'a, C> {
26708 self._delegate = Some(new_value);
26709 self
26710 }
26711
26712 /// Set any additional parameter of the query string used in the request.
26713 /// It should be used to set parameters which are not yet available through their own
26714 /// setters.
26715 ///
26716 /// Please note that this method must not be used to set any of the known parameters
26717 /// which have their own setter method. If done anyway, the request will fail.
26718 ///
26719 /// # Additional Parameters
26720 ///
26721 /// * *$.xgafv* (query-string) - V1 error format.
26722 /// * *access_token* (query-string) - OAuth access token.
26723 /// * *alt* (query-string) - Data format for response.
26724 /// * *callback* (query-string) - JSONP
26725 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
26726 /// * *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.
26727 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
26728 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
26729 /// * *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.
26730 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
26731 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
26732 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLoggingCall<'a, C>
26733 where
26734 T: AsRef<str>,
26735 {
26736 self._additional_params
26737 .insert(name.as_ref().to_string(), value.as_ref().to_string());
26738 self
26739 }
26740
26741 /// Identifies the authorization scope for the method you are building.
26742 ///
26743 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
26744 /// [`Scope::CloudPlatform`].
26745 ///
26746 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
26747 /// tokens for more than one scope.
26748 ///
26749 /// Usually there is more than one suitable scope to authorize an operation, some of which may
26750 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
26751 /// sufficient, a read-write scope will do as well.
26752 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLoggingCall<'a, C>
26753 where
26754 St: AsRef<str>,
26755 {
26756 self._scopes.insert(String::from(scope.as_ref()));
26757 self
26758 }
26759 /// Identifies the authorization scope(s) for the method you are building.
26760 ///
26761 /// See [`Self::add_scope()`] for details.
26762 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLoggingCall<'a, C>
26763 where
26764 I: IntoIterator<Item = St>,
26765 St: AsRef<str>,
26766 {
26767 self._scopes
26768 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
26769 self
26770 }
26771
26772 /// Removes all scopes, and no default scope will be used either.
26773 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
26774 /// for details).
26775 pub fn clear_scopes(mut self) -> ProjectZoneClusterLoggingCall<'a, C> {
26776 self._scopes.clear();
26777 self
26778 }
26779}
26780
26781/// Updates the master for a specific cluster.
26782///
26783/// A builder for the *zones.clusters.master* method supported by a *project* resource.
26784/// It is not used directly, but through a [`ProjectMethods`] instance.
26785///
26786/// # Example
26787///
26788/// Instantiate a resource method builder
26789///
26790/// ```test_harness,no_run
26791/// # extern crate hyper;
26792/// # extern crate hyper_rustls;
26793/// # extern crate google_container1 as container1;
26794/// use container1::api::UpdateMasterRequest;
26795/// # async fn dox() {
26796/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
26797///
26798/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
26799/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
26800/// # .with_native_roots()
26801/// # .unwrap()
26802/// # .https_only()
26803/// # .enable_http2()
26804/// # .build();
26805///
26806/// # let executor = hyper_util::rt::TokioExecutor::new();
26807/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
26808/// # secret,
26809/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
26810/// # yup_oauth2::client::CustomHyperClientBuilder::from(
26811/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
26812/// # ),
26813/// # ).build().await.unwrap();
26814///
26815/// # let client = hyper_util::client::legacy::Client::builder(
26816/// # hyper_util::rt::TokioExecutor::new()
26817/// # )
26818/// # .build(
26819/// # hyper_rustls::HttpsConnectorBuilder::new()
26820/// # .with_native_roots()
26821/// # .unwrap()
26822/// # .https_or_http()
26823/// # .enable_http2()
26824/// # .build()
26825/// # );
26826/// # let mut hub = Container::new(client, auth);
26827/// // As the method needs a request, you would usually fill it with the desired information
26828/// // into the respective structure. Some of the parts shown here might not be applicable !
26829/// // Values shown here are possibly random and not representative !
26830/// let mut req = UpdateMasterRequest::default();
26831///
26832/// // You can configure optional parameters by calling the respective setters at will, and
26833/// // execute the final call using `doit()`.
26834/// // Values shown here are possibly random and not representative !
26835/// let result = hub.projects().zones_clusters_master(req, "projectId", "zone", "clusterId")
26836/// .doit().await;
26837/// # }
26838/// ```
26839pub struct ProjectZoneClusterMasterCall<'a, C>
26840where
26841 C: 'a,
26842{
26843 hub: &'a Container<C>,
26844 _request: UpdateMasterRequest,
26845 _project_id: String,
26846 _zone: String,
26847 _cluster_id: String,
26848 _delegate: Option<&'a mut dyn common::Delegate>,
26849 _additional_params: HashMap<String, String>,
26850 _scopes: BTreeSet<String>,
26851}
26852
26853impl<'a, C> common::CallBuilder for ProjectZoneClusterMasterCall<'a, C> {}
26854
26855impl<'a, C> ProjectZoneClusterMasterCall<'a, C>
26856where
26857 C: common::Connector,
26858{
26859 /// Perform the operation you have build so far.
26860 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
26861 use std::borrow::Cow;
26862 use std::io::{Read, Seek};
26863
26864 use common::{url::Params, ToParts};
26865 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
26866
26867 let mut dd = common::DefaultDelegate;
26868 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
26869 dlg.begin(common::MethodInfo {
26870 id: "container.projects.zones.clusters.master",
26871 http_method: hyper::Method::POST,
26872 });
26873
26874 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
26875 if self._additional_params.contains_key(field) {
26876 dlg.finished(false);
26877 return Err(common::Error::FieldClash(field));
26878 }
26879 }
26880
26881 let mut params = Params::with_capacity(6 + self._additional_params.len());
26882 params.push("projectId", self._project_id);
26883 params.push("zone", self._zone);
26884 params.push("clusterId", self._cluster_id);
26885
26886 params.extend(self._additional_params.iter());
26887
26888 params.push("alt", "json");
26889 let mut url = self.hub._base_url.clone()
26890 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/master";
26891 if self._scopes.is_empty() {
26892 self._scopes
26893 .insert(Scope::CloudPlatform.as_ref().to_string());
26894 }
26895
26896 #[allow(clippy::single_element_loop)]
26897 for &(find_this, param_name) in [
26898 ("{projectId}", "projectId"),
26899 ("{zone}", "zone"),
26900 ("{clusterId}", "clusterId"),
26901 ]
26902 .iter()
26903 {
26904 url = params.uri_replacement(url, param_name, find_this, false);
26905 }
26906 {
26907 let to_remove = ["clusterId", "zone", "projectId"];
26908 params.remove_params(&to_remove);
26909 }
26910
26911 let url = params.parse_with_url(&url);
26912
26913 let mut json_mime_type = mime::APPLICATION_JSON;
26914 let mut request_value_reader = {
26915 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
26916 common::remove_json_null_values(&mut value);
26917 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
26918 serde_json::to_writer(&mut dst, &value).unwrap();
26919 dst
26920 };
26921 let request_size = request_value_reader
26922 .seek(std::io::SeekFrom::End(0))
26923 .unwrap();
26924 request_value_reader
26925 .seek(std::io::SeekFrom::Start(0))
26926 .unwrap();
26927
26928 loop {
26929 let token = match self
26930 .hub
26931 .auth
26932 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
26933 .await
26934 {
26935 Ok(token) => token,
26936 Err(e) => match dlg.token(e) {
26937 Ok(token) => token,
26938 Err(e) => {
26939 dlg.finished(false);
26940 return Err(common::Error::MissingToken(e));
26941 }
26942 },
26943 };
26944 request_value_reader
26945 .seek(std::io::SeekFrom::Start(0))
26946 .unwrap();
26947 let mut req_result = {
26948 let client = &self.hub.client;
26949 dlg.pre_request();
26950 let mut req_builder = hyper::Request::builder()
26951 .method(hyper::Method::POST)
26952 .uri(url.as_str())
26953 .header(USER_AGENT, self.hub._user_agent.clone());
26954
26955 if let Some(token) = token.as_ref() {
26956 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
26957 }
26958
26959 let request = req_builder
26960 .header(CONTENT_TYPE, json_mime_type.to_string())
26961 .header(CONTENT_LENGTH, request_size as u64)
26962 .body(common::to_body(
26963 request_value_reader.get_ref().clone().into(),
26964 ));
26965
26966 client.request(request.unwrap()).await
26967 };
26968
26969 match req_result {
26970 Err(err) => {
26971 if let common::Retry::After(d) = dlg.http_error(&err) {
26972 sleep(d).await;
26973 continue;
26974 }
26975 dlg.finished(false);
26976 return Err(common::Error::HttpError(err));
26977 }
26978 Ok(res) => {
26979 let (mut parts, body) = res.into_parts();
26980 let mut body = common::Body::new(body);
26981 if !parts.status.is_success() {
26982 let bytes = common::to_bytes(body).await.unwrap_or_default();
26983 let error = serde_json::from_str(&common::to_string(&bytes));
26984 let response = common::to_response(parts, bytes.into());
26985
26986 if let common::Retry::After(d) =
26987 dlg.http_failure(&response, error.as_ref().ok())
26988 {
26989 sleep(d).await;
26990 continue;
26991 }
26992
26993 dlg.finished(false);
26994
26995 return Err(match error {
26996 Ok(value) => common::Error::BadRequest(value),
26997 _ => common::Error::Failure(response),
26998 });
26999 }
27000 let response = {
27001 let bytes = common::to_bytes(body).await.unwrap_or_default();
27002 let encoded = common::to_string(&bytes);
27003 match serde_json::from_str(&encoded) {
27004 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27005 Err(error) => {
27006 dlg.response_json_decode_error(&encoded, &error);
27007 return Err(common::Error::JsonDecodeError(
27008 encoded.to_string(),
27009 error,
27010 ));
27011 }
27012 }
27013 };
27014
27015 dlg.finished(true);
27016 return Ok(response);
27017 }
27018 }
27019 }
27020 }
27021
27022 ///
27023 /// Sets the *request* property to the given value.
27024 ///
27025 /// Even though the property as already been set when instantiating this call,
27026 /// we provide this method for API completeness.
27027 pub fn request(
27028 mut self,
27029 new_value: UpdateMasterRequest,
27030 ) -> ProjectZoneClusterMasterCall<'a, C> {
27031 self._request = new_value;
27032 self
27033 }
27034 /// 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.
27035 ///
27036 /// Sets the *project id* path property to the given value.
27037 ///
27038 /// Even though the property as already been set when instantiating this call,
27039 /// we provide this method for API completeness.
27040 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
27041 self._project_id = new_value.to_string();
27042 self
27043 }
27044 /// 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.
27045 ///
27046 /// Sets the *zone* path property to the given value.
27047 ///
27048 /// Even though the property as already been set when instantiating this call,
27049 /// we provide this method for API completeness.
27050 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
27051 self._zone = new_value.to_string();
27052 self
27053 }
27054 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
27055 ///
27056 /// Sets the *cluster id* path property to the given value.
27057 ///
27058 /// Even though the property as already been set when instantiating this call,
27059 /// we provide this method for API completeness.
27060 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
27061 self._cluster_id = new_value.to_string();
27062 self
27063 }
27064 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27065 /// while executing the actual API request.
27066 ///
27067 /// ````text
27068 /// It should be used to handle progress information, and to implement a certain level of resilience.
27069 /// ````
27070 ///
27071 /// Sets the *delegate* property to the given value.
27072 pub fn delegate(
27073 mut self,
27074 new_value: &'a mut dyn common::Delegate,
27075 ) -> ProjectZoneClusterMasterCall<'a, C> {
27076 self._delegate = Some(new_value);
27077 self
27078 }
27079
27080 /// Set any additional parameter of the query string used in the request.
27081 /// It should be used to set parameters which are not yet available through their own
27082 /// setters.
27083 ///
27084 /// Please note that this method must not be used to set any of the known parameters
27085 /// which have their own setter method. If done anyway, the request will fail.
27086 ///
27087 /// # Additional Parameters
27088 ///
27089 /// * *$.xgafv* (query-string) - V1 error format.
27090 /// * *access_token* (query-string) - OAuth access token.
27091 /// * *alt* (query-string) - Data format for response.
27092 /// * *callback* (query-string) - JSONP
27093 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27094 /// * *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.
27095 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27096 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27097 /// * *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.
27098 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27099 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27100 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterMasterCall<'a, C>
27101 where
27102 T: AsRef<str>,
27103 {
27104 self._additional_params
27105 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27106 self
27107 }
27108
27109 /// Identifies the authorization scope for the method you are building.
27110 ///
27111 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27112 /// [`Scope::CloudPlatform`].
27113 ///
27114 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27115 /// tokens for more than one scope.
27116 ///
27117 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27118 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27119 /// sufficient, a read-write scope will do as well.
27120 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterMasterCall<'a, C>
27121 where
27122 St: AsRef<str>,
27123 {
27124 self._scopes.insert(String::from(scope.as_ref()));
27125 self
27126 }
27127 /// Identifies the authorization scope(s) for the method you are building.
27128 ///
27129 /// See [`Self::add_scope()`] for details.
27130 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterMasterCall<'a, C>
27131 where
27132 I: IntoIterator<Item = St>,
27133 St: AsRef<str>,
27134 {
27135 self._scopes
27136 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27137 self
27138 }
27139
27140 /// Removes all scopes, and no default scope will be used either.
27141 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27142 /// for details).
27143 pub fn clear_scopes(mut self) -> ProjectZoneClusterMasterCall<'a, C> {
27144 self._scopes.clear();
27145 self
27146 }
27147}
27148
27149/// Sets the monitoring service for a specific cluster.
27150///
27151/// A builder for the *zones.clusters.monitoring* method supported by a *project* resource.
27152/// It is not used directly, but through a [`ProjectMethods`] instance.
27153///
27154/// # Example
27155///
27156/// Instantiate a resource method builder
27157///
27158/// ```test_harness,no_run
27159/// # extern crate hyper;
27160/// # extern crate hyper_rustls;
27161/// # extern crate google_container1 as container1;
27162/// use container1::api::SetMonitoringServiceRequest;
27163/// # async fn dox() {
27164/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27165///
27166/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27167/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27168/// # .with_native_roots()
27169/// # .unwrap()
27170/// # .https_only()
27171/// # .enable_http2()
27172/// # .build();
27173///
27174/// # let executor = hyper_util::rt::TokioExecutor::new();
27175/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27176/// # secret,
27177/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27178/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27179/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27180/// # ),
27181/// # ).build().await.unwrap();
27182///
27183/// # let client = hyper_util::client::legacy::Client::builder(
27184/// # hyper_util::rt::TokioExecutor::new()
27185/// # )
27186/// # .build(
27187/// # hyper_rustls::HttpsConnectorBuilder::new()
27188/// # .with_native_roots()
27189/// # .unwrap()
27190/// # .https_or_http()
27191/// # .enable_http2()
27192/// # .build()
27193/// # );
27194/// # let mut hub = Container::new(client, auth);
27195/// // As the method needs a request, you would usually fill it with the desired information
27196/// // into the respective structure. Some of the parts shown here might not be applicable !
27197/// // Values shown here are possibly random and not representative !
27198/// let mut req = SetMonitoringServiceRequest::default();
27199///
27200/// // You can configure optional parameters by calling the respective setters at will, and
27201/// // execute the final call using `doit()`.
27202/// // Values shown here are possibly random and not representative !
27203/// let result = hub.projects().zones_clusters_monitoring(req, "projectId", "zone", "clusterId")
27204/// .doit().await;
27205/// # }
27206/// ```
27207pub struct ProjectZoneClusterMonitoringCall<'a, C>
27208where
27209 C: 'a,
27210{
27211 hub: &'a Container<C>,
27212 _request: SetMonitoringServiceRequest,
27213 _project_id: String,
27214 _zone: String,
27215 _cluster_id: String,
27216 _delegate: Option<&'a mut dyn common::Delegate>,
27217 _additional_params: HashMap<String, String>,
27218 _scopes: BTreeSet<String>,
27219}
27220
27221impl<'a, C> common::CallBuilder for ProjectZoneClusterMonitoringCall<'a, C> {}
27222
27223impl<'a, C> ProjectZoneClusterMonitoringCall<'a, C>
27224where
27225 C: common::Connector,
27226{
27227 /// Perform the operation you have build so far.
27228 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
27229 use std::borrow::Cow;
27230 use std::io::{Read, Seek};
27231
27232 use common::{url::Params, ToParts};
27233 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27234
27235 let mut dd = common::DefaultDelegate;
27236 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27237 dlg.begin(common::MethodInfo {
27238 id: "container.projects.zones.clusters.monitoring",
27239 http_method: hyper::Method::POST,
27240 });
27241
27242 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
27243 if self._additional_params.contains_key(field) {
27244 dlg.finished(false);
27245 return Err(common::Error::FieldClash(field));
27246 }
27247 }
27248
27249 let mut params = Params::with_capacity(6 + self._additional_params.len());
27250 params.push("projectId", self._project_id);
27251 params.push("zone", self._zone);
27252 params.push("clusterId", self._cluster_id);
27253
27254 params.extend(self._additional_params.iter());
27255
27256 params.push("alt", "json");
27257 let mut url = self.hub._base_url.clone()
27258 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/monitoring";
27259 if self._scopes.is_empty() {
27260 self._scopes
27261 .insert(Scope::CloudPlatform.as_ref().to_string());
27262 }
27263
27264 #[allow(clippy::single_element_loop)]
27265 for &(find_this, param_name) in [
27266 ("{projectId}", "projectId"),
27267 ("{zone}", "zone"),
27268 ("{clusterId}", "clusterId"),
27269 ]
27270 .iter()
27271 {
27272 url = params.uri_replacement(url, param_name, find_this, false);
27273 }
27274 {
27275 let to_remove = ["clusterId", "zone", "projectId"];
27276 params.remove_params(&to_remove);
27277 }
27278
27279 let url = params.parse_with_url(&url);
27280
27281 let mut json_mime_type = mime::APPLICATION_JSON;
27282 let mut request_value_reader = {
27283 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27284 common::remove_json_null_values(&mut value);
27285 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27286 serde_json::to_writer(&mut dst, &value).unwrap();
27287 dst
27288 };
27289 let request_size = request_value_reader
27290 .seek(std::io::SeekFrom::End(0))
27291 .unwrap();
27292 request_value_reader
27293 .seek(std::io::SeekFrom::Start(0))
27294 .unwrap();
27295
27296 loop {
27297 let token = match self
27298 .hub
27299 .auth
27300 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27301 .await
27302 {
27303 Ok(token) => token,
27304 Err(e) => match dlg.token(e) {
27305 Ok(token) => token,
27306 Err(e) => {
27307 dlg.finished(false);
27308 return Err(common::Error::MissingToken(e));
27309 }
27310 },
27311 };
27312 request_value_reader
27313 .seek(std::io::SeekFrom::Start(0))
27314 .unwrap();
27315 let mut req_result = {
27316 let client = &self.hub.client;
27317 dlg.pre_request();
27318 let mut req_builder = hyper::Request::builder()
27319 .method(hyper::Method::POST)
27320 .uri(url.as_str())
27321 .header(USER_AGENT, self.hub._user_agent.clone());
27322
27323 if let Some(token) = token.as_ref() {
27324 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27325 }
27326
27327 let request = req_builder
27328 .header(CONTENT_TYPE, json_mime_type.to_string())
27329 .header(CONTENT_LENGTH, request_size as u64)
27330 .body(common::to_body(
27331 request_value_reader.get_ref().clone().into(),
27332 ));
27333
27334 client.request(request.unwrap()).await
27335 };
27336
27337 match req_result {
27338 Err(err) => {
27339 if let common::Retry::After(d) = dlg.http_error(&err) {
27340 sleep(d).await;
27341 continue;
27342 }
27343 dlg.finished(false);
27344 return Err(common::Error::HttpError(err));
27345 }
27346 Ok(res) => {
27347 let (mut parts, body) = res.into_parts();
27348 let mut body = common::Body::new(body);
27349 if !parts.status.is_success() {
27350 let bytes = common::to_bytes(body).await.unwrap_or_default();
27351 let error = serde_json::from_str(&common::to_string(&bytes));
27352 let response = common::to_response(parts, bytes.into());
27353
27354 if let common::Retry::After(d) =
27355 dlg.http_failure(&response, error.as_ref().ok())
27356 {
27357 sleep(d).await;
27358 continue;
27359 }
27360
27361 dlg.finished(false);
27362
27363 return Err(match error {
27364 Ok(value) => common::Error::BadRequest(value),
27365 _ => common::Error::Failure(response),
27366 });
27367 }
27368 let response = {
27369 let bytes = common::to_bytes(body).await.unwrap_or_default();
27370 let encoded = common::to_string(&bytes);
27371 match serde_json::from_str(&encoded) {
27372 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27373 Err(error) => {
27374 dlg.response_json_decode_error(&encoded, &error);
27375 return Err(common::Error::JsonDecodeError(
27376 encoded.to_string(),
27377 error,
27378 ));
27379 }
27380 }
27381 };
27382
27383 dlg.finished(true);
27384 return Ok(response);
27385 }
27386 }
27387 }
27388 }
27389
27390 ///
27391 /// Sets the *request* property to the given value.
27392 ///
27393 /// Even though the property as already been set when instantiating this call,
27394 /// we provide this method for API completeness.
27395 pub fn request(
27396 mut self,
27397 new_value: SetMonitoringServiceRequest,
27398 ) -> ProjectZoneClusterMonitoringCall<'a, C> {
27399 self._request = new_value;
27400 self
27401 }
27402 /// 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.
27403 ///
27404 /// Sets the *project id* path property to the given value.
27405 ///
27406 /// Even though the property as already been set when instantiating this call,
27407 /// we provide this method for API completeness.
27408 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
27409 self._project_id = new_value.to_string();
27410 self
27411 }
27412 /// 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.
27413 ///
27414 /// Sets the *zone* path property to the given value.
27415 ///
27416 /// Even though the property as already been set when instantiating this call,
27417 /// we provide this method for API completeness.
27418 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
27419 self._zone = new_value.to_string();
27420 self
27421 }
27422 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
27423 ///
27424 /// Sets the *cluster id* path property to the given value.
27425 ///
27426 /// Even though the property as already been set when instantiating this call,
27427 /// we provide this method for API completeness.
27428 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
27429 self._cluster_id = new_value.to_string();
27430 self
27431 }
27432 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27433 /// while executing the actual API request.
27434 ///
27435 /// ````text
27436 /// It should be used to handle progress information, and to implement a certain level of resilience.
27437 /// ````
27438 ///
27439 /// Sets the *delegate* property to the given value.
27440 pub fn delegate(
27441 mut self,
27442 new_value: &'a mut dyn common::Delegate,
27443 ) -> ProjectZoneClusterMonitoringCall<'a, C> {
27444 self._delegate = Some(new_value);
27445 self
27446 }
27447
27448 /// Set any additional parameter of the query string used in the request.
27449 /// It should be used to set parameters which are not yet available through their own
27450 /// setters.
27451 ///
27452 /// Please note that this method must not be used to set any of the known parameters
27453 /// which have their own setter method. If done anyway, the request will fail.
27454 ///
27455 /// # Additional Parameters
27456 ///
27457 /// * *$.xgafv* (query-string) - V1 error format.
27458 /// * *access_token* (query-string) - OAuth access token.
27459 /// * *alt* (query-string) - Data format for response.
27460 /// * *callback* (query-string) - JSONP
27461 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27462 /// * *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.
27463 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27464 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27465 /// * *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.
27466 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27467 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27468 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterMonitoringCall<'a, C>
27469 where
27470 T: AsRef<str>,
27471 {
27472 self._additional_params
27473 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27474 self
27475 }
27476
27477 /// Identifies the authorization scope for the method you are building.
27478 ///
27479 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27480 /// [`Scope::CloudPlatform`].
27481 ///
27482 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27483 /// tokens for more than one scope.
27484 ///
27485 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27486 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27487 /// sufficient, a read-write scope will do as well.
27488 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterMonitoringCall<'a, C>
27489 where
27490 St: AsRef<str>,
27491 {
27492 self._scopes.insert(String::from(scope.as_ref()));
27493 self
27494 }
27495 /// Identifies the authorization scope(s) for the method you are building.
27496 ///
27497 /// See [`Self::add_scope()`] for details.
27498 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterMonitoringCall<'a, C>
27499 where
27500 I: IntoIterator<Item = St>,
27501 St: AsRef<str>,
27502 {
27503 self._scopes
27504 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27505 self
27506 }
27507
27508 /// Removes all scopes, and no default scope will be used either.
27509 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27510 /// for details).
27511 pub fn clear_scopes(mut self) -> ProjectZoneClusterMonitoringCall<'a, C> {
27512 self._scopes.clear();
27513 self
27514 }
27515}
27516
27517/// Sets labels on a cluster.
27518///
27519/// A builder for the *zones.clusters.resourceLabels* method supported by a *project* resource.
27520/// It is not used directly, but through a [`ProjectMethods`] instance.
27521///
27522/// # Example
27523///
27524/// Instantiate a resource method builder
27525///
27526/// ```test_harness,no_run
27527/// # extern crate hyper;
27528/// # extern crate hyper_rustls;
27529/// # extern crate google_container1 as container1;
27530/// use container1::api::SetLabelsRequest;
27531/// # async fn dox() {
27532/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27533///
27534/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27535/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27536/// # .with_native_roots()
27537/// # .unwrap()
27538/// # .https_only()
27539/// # .enable_http2()
27540/// # .build();
27541///
27542/// # let executor = hyper_util::rt::TokioExecutor::new();
27543/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27544/// # secret,
27545/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27546/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27547/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27548/// # ),
27549/// # ).build().await.unwrap();
27550///
27551/// # let client = hyper_util::client::legacy::Client::builder(
27552/// # hyper_util::rt::TokioExecutor::new()
27553/// # )
27554/// # .build(
27555/// # hyper_rustls::HttpsConnectorBuilder::new()
27556/// # .with_native_roots()
27557/// # .unwrap()
27558/// # .https_or_http()
27559/// # .enable_http2()
27560/// # .build()
27561/// # );
27562/// # let mut hub = Container::new(client, auth);
27563/// // As the method needs a request, you would usually fill it with the desired information
27564/// // into the respective structure. Some of the parts shown here might not be applicable !
27565/// // Values shown here are possibly random and not representative !
27566/// let mut req = SetLabelsRequest::default();
27567///
27568/// // You can configure optional parameters by calling the respective setters at will, and
27569/// // execute the final call using `doit()`.
27570/// // Values shown here are possibly random and not representative !
27571/// let result = hub.projects().zones_clusters_resource_labels(req, "projectId", "zone", "clusterId")
27572/// .doit().await;
27573/// # }
27574/// ```
27575pub struct ProjectZoneClusterResourceLabelCall<'a, C>
27576where
27577 C: 'a,
27578{
27579 hub: &'a Container<C>,
27580 _request: SetLabelsRequest,
27581 _project_id: String,
27582 _zone: String,
27583 _cluster_id: String,
27584 _delegate: Option<&'a mut dyn common::Delegate>,
27585 _additional_params: HashMap<String, String>,
27586 _scopes: BTreeSet<String>,
27587}
27588
27589impl<'a, C> common::CallBuilder for ProjectZoneClusterResourceLabelCall<'a, C> {}
27590
27591impl<'a, C> ProjectZoneClusterResourceLabelCall<'a, C>
27592where
27593 C: common::Connector,
27594{
27595 /// Perform the operation you have build so far.
27596 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
27597 use std::borrow::Cow;
27598 use std::io::{Read, Seek};
27599
27600 use common::{url::Params, ToParts};
27601 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27602
27603 let mut dd = common::DefaultDelegate;
27604 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27605 dlg.begin(common::MethodInfo {
27606 id: "container.projects.zones.clusters.resourceLabels",
27607 http_method: hyper::Method::POST,
27608 });
27609
27610 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
27611 if self._additional_params.contains_key(field) {
27612 dlg.finished(false);
27613 return Err(common::Error::FieldClash(field));
27614 }
27615 }
27616
27617 let mut params = Params::with_capacity(6 + self._additional_params.len());
27618 params.push("projectId", self._project_id);
27619 params.push("zone", self._zone);
27620 params.push("clusterId", self._cluster_id);
27621
27622 params.extend(self._additional_params.iter());
27623
27624 params.push("alt", "json");
27625 let mut url = self.hub._base_url.clone()
27626 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/resourceLabels";
27627 if self._scopes.is_empty() {
27628 self._scopes
27629 .insert(Scope::CloudPlatform.as_ref().to_string());
27630 }
27631
27632 #[allow(clippy::single_element_loop)]
27633 for &(find_this, param_name) in [
27634 ("{projectId}", "projectId"),
27635 ("{zone}", "zone"),
27636 ("{clusterId}", "clusterId"),
27637 ]
27638 .iter()
27639 {
27640 url = params.uri_replacement(url, param_name, find_this, false);
27641 }
27642 {
27643 let to_remove = ["clusterId", "zone", "projectId"];
27644 params.remove_params(&to_remove);
27645 }
27646
27647 let url = params.parse_with_url(&url);
27648
27649 let mut json_mime_type = mime::APPLICATION_JSON;
27650 let mut request_value_reader = {
27651 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
27652 common::remove_json_null_values(&mut value);
27653 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
27654 serde_json::to_writer(&mut dst, &value).unwrap();
27655 dst
27656 };
27657 let request_size = request_value_reader
27658 .seek(std::io::SeekFrom::End(0))
27659 .unwrap();
27660 request_value_reader
27661 .seek(std::io::SeekFrom::Start(0))
27662 .unwrap();
27663
27664 loop {
27665 let token = match self
27666 .hub
27667 .auth
27668 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
27669 .await
27670 {
27671 Ok(token) => token,
27672 Err(e) => match dlg.token(e) {
27673 Ok(token) => token,
27674 Err(e) => {
27675 dlg.finished(false);
27676 return Err(common::Error::MissingToken(e));
27677 }
27678 },
27679 };
27680 request_value_reader
27681 .seek(std::io::SeekFrom::Start(0))
27682 .unwrap();
27683 let mut req_result = {
27684 let client = &self.hub.client;
27685 dlg.pre_request();
27686 let mut req_builder = hyper::Request::builder()
27687 .method(hyper::Method::POST)
27688 .uri(url.as_str())
27689 .header(USER_AGENT, self.hub._user_agent.clone());
27690
27691 if let Some(token) = token.as_ref() {
27692 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
27693 }
27694
27695 let request = req_builder
27696 .header(CONTENT_TYPE, json_mime_type.to_string())
27697 .header(CONTENT_LENGTH, request_size as u64)
27698 .body(common::to_body(
27699 request_value_reader.get_ref().clone().into(),
27700 ));
27701
27702 client.request(request.unwrap()).await
27703 };
27704
27705 match req_result {
27706 Err(err) => {
27707 if let common::Retry::After(d) = dlg.http_error(&err) {
27708 sleep(d).await;
27709 continue;
27710 }
27711 dlg.finished(false);
27712 return Err(common::Error::HttpError(err));
27713 }
27714 Ok(res) => {
27715 let (mut parts, body) = res.into_parts();
27716 let mut body = common::Body::new(body);
27717 if !parts.status.is_success() {
27718 let bytes = common::to_bytes(body).await.unwrap_or_default();
27719 let error = serde_json::from_str(&common::to_string(&bytes));
27720 let response = common::to_response(parts, bytes.into());
27721
27722 if let common::Retry::After(d) =
27723 dlg.http_failure(&response, error.as_ref().ok())
27724 {
27725 sleep(d).await;
27726 continue;
27727 }
27728
27729 dlg.finished(false);
27730
27731 return Err(match error {
27732 Ok(value) => common::Error::BadRequest(value),
27733 _ => common::Error::Failure(response),
27734 });
27735 }
27736 let response = {
27737 let bytes = common::to_bytes(body).await.unwrap_or_default();
27738 let encoded = common::to_string(&bytes);
27739 match serde_json::from_str(&encoded) {
27740 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
27741 Err(error) => {
27742 dlg.response_json_decode_error(&encoded, &error);
27743 return Err(common::Error::JsonDecodeError(
27744 encoded.to_string(),
27745 error,
27746 ));
27747 }
27748 }
27749 };
27750
27751 dlg.finished(true);
27752 return Ok(response);
27753 }
27754 }
27755 }
27756 }
27757
27758 ///
27759 /// Sets the *request* property to the given value.
27760 ///
27761 /// Even though the property as already been set when instantiating this call,
27762 /// we provide this method for API completeness.
27763 pub fn request(
27764 mut self,
27765 new_value: SetLabelsRequest,
27766 ) -> ProjectZoneClusterResourceLabelCall<'a, C> {
27767 self._request = new_value;
27768 self
27769 }
27770 /// 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.
27771 ///
27772 /// Sets the *project id* path property to the given value.
27773 ///
27774 /// Even though the property as already been set when instantiating this call,
27775 /// we provide this method for API completeness.
27776 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
27777 self._project_id = new_value.to_string();
27778 self
27779 }
27780 /// 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.
27781 ///
27782 /// Sets the *zone* path property to the given value.
27783 ///
27784 /// Even though the property as already been set when instantiating this call,
27785 /// we provide this method for API completeness.
27786 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
27787 self._zone = new_value.to_string();
27788 self
27789 }
27790 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
27791 ///
27792 /// Sets the *cluster id* path property to the given value.
27793 ///
27794 /// Even though the property as already been set when instantiating this call,
27795 /// we provide this method for API completeness.
27796 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
27797 self._cluster_id = new_value.to_string();
27798 self
27799 }
27800 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
27801 /// while executing the actual API request.
27802 ///
27803 /// ````text
27804 /// It should be used to handle progress information, and to implement a certain level of resilience.
27805 /// ````
27806 ///
27807 /// Sets the *delegate* property to the given value.
27808 pub fn delegate(
27809 mut self,
27810 new_value: &'a mut dyn common::Delegate,
27811 ) -> ProjectZoneClusterResourceLabelCall<'a, C> {
27812 self._delegate = Some(new_value);
27813 self
27814 }
27815
27816 /// Set any additional parameter of the query string used in the request.
27817 /// It should be used to set parameters which are not yet available through their own
27818 /// setters.
27819 ///
27820 /// Please note that this method must not be used to set any of the known parameters
27821 /// which have their own setter method. If done anyway, the request will fail.
27822 ///
27823 /// # Additional Parameters
27824 ///
27825 /// * *$.xgafv* (query-string) - V1 error format.
27826 /// * *access_token* (query-string) - OAuth access token.
27827 /// * *alt* (query-string) - Data format for response.
27828 /// * *callback* (query-string) - JSONP
27829 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
27830 /// * *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.
27831 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
27832 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
27833 /// * *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.
27834 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
27835 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
27836 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterResourceLabelCall<'a, C>
27837 where
27838 T: AsRef<str>,
27839 {
27840 self._additional_params
27841 .insert(name.as_ref().to_string(), value.as_ref().to_string());
27842 self
27843 }
27844
27845 /// Identifies the authorization scope for the method you are building.
27846 ///
27847 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
27848 /// [`Scope::CloudPlatform`].
27849 ///
27850 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
27851 /// tokens for more than one scope.
27852 ///
27853 /// Usually there is more than one suitable scope to authorize an operation, some of which may
27854 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
27855 /// sufficient, a read-write scope will do as well.
27856 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterResourceLabelCall<'a, C>
27857 where
27858 St: AsRef<str>,
27859 {
27860 self._scopes.insert(String::from(scope.as_ref()));
27861 self
27862 }
27863 /// Identifies the authorization scope(s) for the method you are building.
27864 ///
27865 /// See [`Self::add_scope()`] for details.
27866 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterResourceLabelCall<'a, C>
27867 where
27868 I: IntoIterator<Item = St>,
27869 St: AsRef<str>,
27870 {
27871 self._scopes
27872 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
27873 self
27874 }
27875
27876 /// Removes all scopes, and no default scope will be used either.
27877 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
27878 /// for details).
27879 pub fn clear_scopes(mut self) -> ProjectZoneClusterResourceLabelCall<'a, C> {
27880 self._scopes.clear();
27881 self
27882 }
27883}
27884
27885/// Sets the maintenance policy for a cluster.
27886///
27887/// A builder for the *zones.clusters.setMaintenancePolicy* method supported by a *project* resource.
27888/// It is not used directly, but through a [`ProjectMethods`] instance.
27889///
27890/// # Example
27891///
27892/// Instantiate a resource method builder
27893///
27894/// ```test_harness,no_run
27895/// # extern crate hyper;
27896/// # extern crate hyper_rustls;
27897/// # extern crate google_container1 as container1;
27898/// use container1::api::SetMaintenancePolicyRequest;
27899/// # async fn dox() {
27900/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
27901///
27902/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
27903/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
27904/// # .with_native_roots()
27905/// # .unwrap()
27906/// # .https_only()
27907/// # .enable_http2()
27908/// # .build();
27909///
27910/// # let executor = hyper_util::rt::TokioExecutor::new();
27911/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
27912/// # secret,
27913/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
27914/// # yup_oauth2::client::CustomHyperClientBuilder::from(
27915/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
27916/// # ),
27917/// # ).build().await.unwrap();
27918///
27919/// # let client = hyper_util::client::legacy::Client::builder(
27920/// # hyper_util::rt::TokioExecutor::new()
27921/// # )
27922/// # .build(
27923/// # hyper_rustls::HttpsConnectorBuilder::new()
27924/// # .with_native_roots()
27925/// # .unwrap()
27926/// # .https_or_http()
27927/// # .enable_http2()
27928/// # .build()
27929/// # );
27930/// # let mut hub = Container::new(client, auth);
27931/// // As the method needs a request, you would usually fill it with the desired information
27932/// // into the respective structure. Some of the parts shown here might not be applicable !
27933/// // Values shown here are possibly random and not representative !
27934/// let mut req = SetMaintenancePolicyRequest::default();
27935///
27936/// // You can configure optional parameters by calling the respective setters at will, and
27937/// // execute the final call using `doit()`.
27938/// // Values shown here are possibly random and not representative !
27939/// let result = hub.projects().zones_clusters_set_maintenance_policy(req, "projectId", "zone", "clusterId")
27940/// .doit().await;
27941/// # }
27942/// ```
27943pub struct ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
27944where
27945 C: 'a,
27946{
27947 hub: &'a Container<C>,
27948 _request: SetMaintenancePolicyRequest,
27949 _project_id: String,
27950 _zone: String,
27951 _cluster_id: String,
27952 _delegate: Option<&'a mut dyn common::Delegate>,
27953 _additional_params: HashMap<String, String>,
27954 _scopes: BTreeSet<String>,
27955}
27956
27957impl<'a, C> common::CallBuilder for ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {}
27958
27959impl<'a, C> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
27960where
27961 C: common::Connector,
27962{
27963 /// Perform the operation you have build so far.
27964 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
27965 use std::borrow::Cow;
27966 use std::io::{Read, Seek};
27967
27968 use common::{url::Params, ToParts};
27969 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
27970
27971 let mut dd = common::DefaultDelegate;
27972 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
27973 dlg.begin(common::MethodInfo {
27974 id: "container.projects.zones.clusters.setMaintenancePolicy",
27975 http_method: hyper::Method::POST,
27976 });
27977
27978 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
27979 if self._additional_params.contains_key(field) {
27980 dlg.finished(false);
27981 return Err(common::Error::FieldClash(field));
27982 }
27983 }
27984
27985 let mut params = Params::with_capacity(6 + self._additional_params.len());
27986 params.push("projectId", self._project_id);
27987 params.push("zone", self._zone);
27988 params.push("clusterId", self._cluster_id);
27989
27990 params.extend(self._additional_params.iter());
27991
27992 params.push("alt", "json");
27993 let mut url = self.hub._base_url.clone()
27994 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMaintenancePolicy";
27995 if self._scopes.is_empty() {
27996 self._scopes
27997 .insert(Scope::CloudPlatform.as_ref().to_string());
27998 }
27999
28000 #[allow(clippy::single_element_loop)]
28001 for &(find_this, param_name) in [
28002 ("{projectId}", "projectId"),
28003 ("{zone}", "zone"),
28004 ("{clusterId}", "clusterId"),
28005 ]
28006 .iter()
28007 {
28008 url = params.uri_replacement(url, param_name, find_this, false);
28009 }
28010 {
28011 let to_remove = ["clusterId", "zone", "projectId"];
28012 params.remove_params(&to_remove);
28013 }
28014
28015 let url = params.parse_with_url(&url);
28016
28017 let mut json_mime_type = mime::APPLICATION_JSON;
28018 let mut request_value_reader = {
28019 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28020 common::remove_json_null_values(&mut value);
28021 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28022 serde_json::to_writer(&mut dst, &value).unwrap();
28023 dst
28024 };
28025 let request_size = request_value_reader
28026 .seek(std::io::SeekFrom::End(0))
28027 .unwrap();
28028 request_value_reader
28029 .seek(std::io::SeekFrom::Start(0))
28030 .unwrap();
28031
28032 loop {
28033 let token = match self
28034 .hub
28035 .auth
28036 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28037 .await
28038 {
28039 Ok(token) => token,
28040 Err(e) => match dlg.token(e) {
28041 Ok(token) => token,
28042 Err(e) => {
28043 dlg.finished(false);
28044 return Err(common::Error::MissingToken(e));
28045 }
28046 },
28047 };
28048 request_value_reader
28049 .seek(std::io::SeekFrom::Start(0))
28050 .unwrap();
28051 let mut req_result = {
28052 let client = &self.hub.client;
28053 dlg.pre_request();
28054 let mut req_builder = hyper::Request::builder()
28055 .method(hyper::Method::POST)
28056 .uri(url.as_str())
28057 .header(USER_AGENT, self.hub._user_agent.clone());
28058
28059 if let Some(token) = token.as_ref() {
28060 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28061 }
28062
28063 let request = req_builder
28064 .header(CONTENT_TYPE, json_mime_type.to_string())
28065 .header(CONTENT_LENGTH, request_size as u64)
28066 .body(common::to_body(
28067 request_value_reader.get_ref().clone().into(),
28068 ));
28069
28070 client.request(request.unwrap()).await
28071 };
28072
28073 match req_result {
28074 Err(err) => {
28075 if let common::Retry::After(d) = dlg.http_error(&err) {
28076 sleep(d).await;
28077 continue;
28078 }
28079 dlg.finished(false);
28080 return Err(common::Error::HttpError(err));
28081 }
28082 Ok(res) => {
28083 let (mut parts, body) = res.into_parts();
28084 let mut body = common::Body::new(body);
28085 if !parts.status.is_success() {
28086 let bytes = common::to_bytes(body).await.unwrap_or_default();
28087 let error = serde_json::from_str(&common::to_string(&bytes));
28088 let response = common::to_response(parts, bytes.into());
28089
28090 if let common::Retry::After(d) =
28091 dlg.http_failure(&response, error.as_ref().ok())
28092 {
28093 sleep(d).await;
28094 continue;
28095 }
28096
28097 dlg.finished(false);
28098
28099 return Err(match error {
28100 Ok(value) => common::Error::BadRequest(value),
28101 _ => common::Error::Failure(response),
28102 });
28103 }
28104 let response = {
28105 let bytes = common::to_bytes(body).await.unwrap_or_default();
28106 let encoded = common::to_string(&bytes);
28107 match serde_json::from_str(&encoded) {
28108 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28109 Err(error) => {
28110 dlg.response_json_decode_error(&encoded, &error);
28111 return Err(common::Error::JsonDecodeError(
28112 encoded.to_string(),
28113 error,
28114 ));
28115 }
28116 }
28117 };
28118
28119 dlg.finished(true);
28120 return Ok(response);
28121 }
28122 }
28123 }
28124 }
28125
28126 ///
28127 /// Sets the *request* property to the given value.
28128 ///
28129 /// Even though the property as already been set when instantiating this call,
28130 /// we provide this method for API completeness.
28131 pub fn request(
28132 mut self,
28133 new_value: SetMaintenancePolicyRequest,
28134 ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
28135 self._request = new_value;
28136 self
28137 }
28138 /// Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
28139 ///
28140 /// Sets the *project id* path property to the given value.
28141 ///
28142 /// Even though the property as already been set when instantiating this call,
28143 /// we provide this method for API completeness.
28144 pub fn project_id(
28145 mut self,
28146 new_value: &str,
28147 ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
28148 self._project_id = new_value.to_string();
28149 self
28150 }
28151 /// Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
28152 ///
28153 /// Sets the *zone* path property to the given value.
28154 ///
28155 /// Even though the property as already been set when instantiating this call,
28156 /// we provide this method for API completeness.
28157 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
28158 self._zone = new_value.to_string();
28159 self
28160 }
28161 /// Required. The name of the cluster to update.
28162 ///
28163 /// Sets the *cluster id* path property to the given value.
28164 ///
28165 /// Even though the property as already been set when instantiating this call,
28166 /// we provide this method for API completeness.
28167 pub fn cluster_id(
28168 mut self,
28169 new_value: &str,
28170 ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
28171 self._cluster_id = new_value.to_string();
28172 self
28173 }
28174 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28175 /// while executing the actual API request.
28176 ///
28177 /// ````text
28178 /// It should be used to handle progress information, and to implement a certain level of resilience.
28179 /// ````
28180 ///
28181 /// Sets the *delegate* property to the given value.
28182 pub fn delegate(
28183 mut self,
28184 new_value: &'a mut dyn common::Delegate,
28185 ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
28186 self._delegate = Some(new_value);
28187 self
28188 }
28189
28190 /// Set any additional parameter of the query string used in the request.
28191 /// It should be used to set parameters which are not yet available through their own
28192 /// setters.
28193 ///
28194 /// Please note that this method must not be used to set any of the known parameters
28195 /// which have their own setter method. If done anyway, the request will fail.
28196 ///
28197 /// # Additional Parameters
28198 ///
28199 /// * *$.xgafv* (query-string) - V1 error format.
28200 /// * *access_token* (query-string) - OAuth access token.
28201 /// * *alt* (query-string) - Data format for response.
28202 /// * *callback* (query-string) - JSONP
28203 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28204 /// * *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.
28205 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28206 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28207 /// * *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.
28208 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28209 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28210 pub fn param<T>(
28211 mut self,
28212 name: T,
28213 value: T,
28214 ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
28215 where
28216 T: AsRef<str>,
28217 {
28218 self._additional_params
28219 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28220 self
28221 }
28222
28223 /// Identifies the authorization scope for the method you are building.
28224 ///
28225 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28226 /// [`Scope::CloudPlatform`].
28227 ///
28228 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28229 /// tokens for more than one scope.
28230 ///
28231 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28232 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28233 /// sufficient, a read-write scope will do as well.
28234 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
28235 where
28236 St: AsRef<str>,
28237 {
28238 self._scopes.insert(String::from(scope.as_ref()));
28239 self
28240 }
28241 /// Identifies the authorization scope(s) for the method you are building.
28242 ///
28243 /// See [`Self::add_scope()`] for details.
28244 pub fn add_scopes<I, St>(
28245 mut self,
28246 scopes: I,
28247 ) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
28248 where
28249 I: IntoIterator<Item = St>,
28250 St: AsRef<str>,
28251 {
28252 self._scopes
28253 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28254 self
28255 }
28256
28257 /// Removes all scopes, and no default scope will be used either.
28258 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28259 /// for details).
28260 pub fn clear_scopes(mut self) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
28261 self._scopes.clear();
28262 self
28263 }
28264}
28265
28266/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
28267///
28268/// A builder for the *zones.clusters.setMasterAuth* method supported by a *project* resource.
28269/// It is not used directly, but through a [`ProjectMethods`] instance.
28270///
28271/// # Example
28272///
28273/// Instantiate a resource method builder
28274///
28275/// ```test_harness,no_run
28276/// # extern crate hyper;
28277/// # extern crate hyper_rustls;
28278/// # extern crate google_container1 as container1;
28279/// use container1::api::SetMasterAuthRequest;
28280/// # async fn dox() {
28281/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28282///
28283/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28284/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28285/// # .with_native_roots()
28286/// # .unwrap()
28287/// # .https_only()
28288/// # .enable_http2()
28289/// # .build();
28290///
28291/// # let executor = hyper_util::rt::TokioExecutor::new();
28292/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28293/// # secret,
28294/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28295/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28296/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28297/// # ),
28298/// # ).build().await.unwrap();
28299///
28300/// # let client = hyper_util::client::legacy::Client::builder(
28301/// # hyper_util::rt::TokioExecutor::new()
28302/// # )
28303/// # .build(
28304/// # hyper_rustls::HttpsConnectorBuilder::new()
28305/// # .with_native_roots()
28306/// # .unwrap()
28307/// # .https_or_http()
28308/// # .enable_http2()
28309/// # .build()
28310/// # );
28311/// # let mut hub = Container::new(client, auth);
28312/// // As the method needs a request, you would usually fill it with the desired information
28313/// // into the respective structure. Some of the parts shown here might not be applicable !
28314/// // Values shown here are possibly random and not representative !
28315/// let mut req = SetMasterAuthRequest::default();
28316///
28317/// // You can configure optional parameters by calling the respective setters at will, and
28318/// // execute the final call using `doit()`.
28319/// // Values shown here are possibly random and not representative !
28320/// let result = hub.projects().zones_clusters_set_master_auth(req, "projectId", "zone", "clusterId")
28321/// .doit().await;
28322/// # }
28323/// ```
28324pub struct ProjectZoneClusterSetMasterAuthCall<'a, C>
28325where
28326 C: 'a,
28327{
28328 hub: &'a Container<C>,
28329 _request: SetMasterAuthRequest,
28330 _project_id: String,
28331 _zone: String,
28332 _cluster_id: String,
28333 _delegate: Option<&'a mut dyn common::Delegate>,
28334 _additional_params: HashMap<String, String>,
28335 _scopes: BTreeSet<String>,
28336}
28337
28338impl<'a, C> common::CallBuilder for ProjectZoneClusterSetMasterAuthCall<'a, C> {}
28339
28340impl<'a, C> ProjectZoneClusterSetMasterAuthCall<'a, C>
28341where
28342 C: common::Connector,
28343{
28344 /// Perform the operation you have build so far.
28345 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
28346 use std::borrow::Cow;
28347 use std::io::{Read, Seek};
28348
28349 use common::{url::Params, ToParts};
28350 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28351
28352 let mut dd = common::DefaultDelegate;
28353 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28354 dlg.begin(common::MethodInfo {
28355 id: "container.projects.zones.clusters.setMasterAuth",
28356 http_method: hyper::Method::POST,
28357 });
28358
28359 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
28360 if self._additional_params.contains_key(field) {
28361 dlg.finished(false);
28362 return Err(common::Error::FieldClash(field));
28363 }
28364 }
28365
28366 let mut params = Params::with_capacity(6 + self._additional_params.len());
28367 params.push("projectId", self._project_id);
28368 params.push("zone", self._zone);
28369 params.push("clusterId", self._cluster_id);
28370
28371 params.extend(self._additional_params.iter());
28372
28373 params.push("alt", "json");
28374 let mut url = self.hub._base_url.clone()
28375 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMasterAuth";
28376 if self._scopes.is_empty() {
28377 self._scopes
28378 .insert(Scope::CloudPlatform.as_ref().to_string());
28379 }
28380
28381 #[allow(clippy::single_element_loop)]
28382 for &(find_this, param_name) in [
28383 ("{projectId}", "projectId"),
28384 ("{zone}", "zone"),
28385 ("{clusterId}", "clusterId"),
28386 ]
28387 .iter()
28388 {
28389 url = params.uri_replacement(url, param_name, find_this, false);
28390 }
28391 {
28392 let to_remove = ["clusterId", "zone", "projectId"];
28393 params.remove_params(&to_remove);
28394 }
28395
28396 let url = params.parse_with_url(&url);
28397
28398 let mut json_mime_type = mime::APPLICATION_JSON;
28399 let mut request_value_reader = {
28400 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28401 common::remove_json_null_values(&mut value);
28402 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28403 serde_json::to_writer(&mut dst, &value).unwrap();
28404 dst
28405 };
28406 let request_size = request_value_reader
28407 .seek(std::io::SeekFrom::End(0))
28408 .unwrap();
28409 request_value_reader
28410 .seek(std::io::SeekFrom::Start(0))
28411 .unwrap();
28412
28413 loop {
28414 let token = match self
28415 .hub
28416 .auth
28417 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28418 .await
28419 {
28420 Ok(token) => token,
28421 Err(e) => match dlg.token(e) {
28422 Ok(token) => token,
28423 Err(e) => {
28424 dlg.finished(false);
28425 return Err(common::Error::MissingToken(e));
28426 }
28427 },
28428 };
28429 request_value_reader
28430 .seek(std::io::SeekFrom::Start(0))
28431 .unwrap();
28432 let mut req_result = {
28433 let client = &self.hub.client;
28434 dlg.pre_request();
28435 let mut req_builder = hyper::Request::builder()
28436 .method(hyper::Method::POST)
28437 .uri(url.as_str())
28438 .header(USER_AGENT, self.hub._user_agent.clone());
28439
28440 if let Some(token) = token.as_ref() {
28441 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28442 }
28443
28444 let request = req_builder
28445 .header(CONTENT_TYPE, json_mime_type.to_string())
28446 .header(CONTENT_LENGTH, request_size as u64)
28447 .body(common::to_body(
28448 request_value_reader.get_ref().clone().into(),
28449 ));
28450
28451 client.request(request.unwrap()).await
28452 };
28453
28454 match req_result {
28455 Err(err) => {
28456 if let common::Retry::After(d) = dlg.http_error(&err) {
28457 sleep(d).await;
28458 continue;
28459 }
28460 dlg.finished(false);
28461 return Err(common::Error::HttpError(err));
28462 }
28463 Ok(res) => {
28464 let (mut parts, body) = res.into_parts();
28465 let mut body = common::Body::new(body);
28466 if !parts.status.is_success() {
28467 let bytes = common::to_bytes(body).await.unwrap_or_default();
28468 let error = serde_json::from_str(&common::to_string(&bytes));
28469 let response = common::to_response(parts, bytes.into());
28470
28471 if let common::Retry::After(d) =
28472 dlg.http_failure(&response, error.as_ref().ok())
28473 {
28474 sleep(d).await;
28475 continue;
28476 }
28477
28478 dlg.finished(false);
28479
28480 return Err(match error {
28481 Ok(value) => common::Error::BadRequest(value),
28482 _ => common::Error::Failure(response),
28483 });
28484 }
28485 let response = {
28486 let bytes = common::to_bytes(body).await.unwrap_or_default();
28487 let encoded = common::to_string(&bytes);
28488 match serde_json::from_str(&encoded) {
28489 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28490 Err(error) => {
28491 dlg.response_json_decode_error(&encoded, &error);
28492 return Err(common::Error::JsonDecodeError(
28493 encoded.to_string(),
28494 error,
28495 ));
28496 }
28497 }
28498 };
28499
28500 dlg.finished(true);
28501 return Ok(response);
28502 }
28503 }
28504 }
28505 }
28506
28507 ///
28508 /// Sets the *request* property to the given value.
28509 ///
28510 /// Even though the property as already been set when instantiating this call,
28511 /// we provide this method for API completeness.
28512 pub fn request(
28513 mut self,
28514 new_value: SetMasterAuthRequest,
28515 ) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
28516 self._request = new_value;
28517 self
28518 }
28519 /// 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.
28520 ///
28521 /// Sets the *project id* path property to the given value.
28522 ///
28523 /// Even though the property as already been set when instantiating this call,
28524 /// we provide this method for API completeness.
28525 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
28526 self._project_id = new_value.to_string();
28527 self
28528 }
28529 /// 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.
28530 ///
28531 /// Sets the *zone* path property to the given value.
28532 ///
28533 /// Even though the property as already been set when instantiating this call,
28534 /// we provide this method for API completeness.
28535 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
28536 self._zone = new_value.to_string();
28537 self
28538 }
28539 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
28540 ///
28541 /// Sets the *cluster id* path property to the given value.
28542 ///
28543 /// Even though the property as already been set when instantiating this call,
28544 /// we provide this method for API completeness.
28545 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
28546 self._cluster_id = new_value.to_string();
28547 self
28548 }
28549 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28550 /// while executing the actual API request.
28551 ///
28552 /// ````text
28553 /// It should be used to handle progress information, and to implement a certain level of resilience.
28554 /// ````
28555 ///
28556 /// Sets the *delegate* property to the given value.
28557 pub fn delegate(
28558 mut self,
28559 new_value: &'a mut dyn common::Delegate,
28560 ) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
28561 self._delegate = Some(new_value);
28562 self
28563 }
28564
28565 /// Set any additional parameter of the query string used in the request.
28566 /// It should be used to set parameters which are not yet available through their own
28567 /// setters.
28568 ///
28569 /// Please note that this method must not be used to set any of the known parameters
28570 /// which have their own setter method. If done anyway, the request will fail.
28571 ///
28572 /// # Additional Parameters
28573 ///
28574 /// * *$.xgafv* (query-string) - V1 error format.
28575 /// * *access_token* (query-string) - OAuth access token.
28576 /// * *alt* (query-string) - Data format for response.
28577 /// * *callback* (query-string) - JSONP
28578 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28579 /// * *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.
28580 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28581 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28582 /// * *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.
28583 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28584 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28585 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
28586 where
28587 T: AsRef<str>,
28588 {
28589 self._additional_params
28590 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28591 self
28592 }
28593
28594 /// Identifies the authorization scope for the method you are building.
28595 ///
28596 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28597 /// [`Scope::CloudPlatform`].
28598 ///
28599 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28600 /// tokens for more than one scope.
28601 ///
28602 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28603 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28604 /// sufficient, a read-write scope will do as well.
28605 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
28606 where
28607 St: AsRef<str>,
28608 {
28609 self._scopes.insert(String::from(scope.as_ref()));
28610 self
28611 }
28612 /// Identifies the authorization scope(s) for the method you are building.
28613 ///
28614 /// See [`Self::add_scope()`] for details.
28615 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
28616 where
28617 I: IntoIterator<Item = St>,
28618 St: AsRef<str>,
28619 {
28620 self._scopes
28621 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28622 self
28623 }
28624
28625 /// Removes all scopes, and no default scope will be used either.
28626 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28627 /// for details).
28628 pub fn clear_scopes(mut self) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
28629 self._scopes.clear();
28630 self
28631 }
28632}
28633
28634/// Enables or disables Network Policy for a cluster.
28635///
28636/// A builder for the *zones.clusters.setNetworkPolicy* method supported by a *project* resource.
28637/// It is not used directly, but through a [`ProjectMethods`] instance.
28638///
28639/// # Example
28640///
28641/// Instantiate a resource method builder
28642///
28643/// ```test_harness,no_run
28644/// # extern crate hyper;
28645/// # extern crate hyper_rustls;
28646/// # extern crate google_container1 as container1;
28647/// use container1::api::SetNetworkPolicyRequest;
28648/// # async fn dox() {
28649/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
28650///
28651/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
28652/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
28653/// # .with_native_roots()
28654/// # .unwrap()
28655/// # .https_only()
28656/// # .enable_http2()
28657/// # .build();
28658///
28659/// # let executor = hyper_util::rt::TokioExecutor::new();
28660/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
28661/// # secret,
28662/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
28663/// # yup_oauth2::client::CustomHyperClientBuilder::from(
28664/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
28665/// # ),
28666/// # ).build().await.unwrap();
28667///
28668/// # let client = hyper_util::client::legacy::Client::builder(
28669/// # hyper_util::rt::TokioExecutor::new()
28670/// # )
28671/// # .build(
28672/// # hyper_rustls::HttpsConnectorBuilder::new()
28673/// # .with_native_roots()
28674/// # .unwrap()
28675/// # .https_or_http()
28676/// # .enable_http2()
28677/// # .build()
28678/// # );
28679/// # let mut hub = Container::new(client, auth);
28680/// // As the method needs a request, you would usually fill it with the desired information
28681/// // into the respective structure. Some of the parts shown here might not be applicable !
28682/// // Values shown here are possibly random and not representative !
28683/// let mut req = SetNetworkPolicyRequest::default();
28684///
28685/// // You can configure optional parameters by calling the respective setters at will, and
28686/// // execute the final call using `doit()`.
28687/// // Values shown here are possibly random and not representative !
28688/// let result = hub.projects().zones_clusters_set_network_policy(req, "projectId", "zone", "clusterId")
28689/// .doit().await;
28690/// # }
28691/// ```
28692pub struct ProjectZoneClusterSetNetworkPolicyCall<'a, C>
28693where
28694 C: 'a,
28695{
28696 hub: &'a Container<C>,
28697 _request: SetNetworkPolicyRequest,
28698 _project_id: String,
28699 _zone: String,
28700 _cluster_id: String,
28701 _delegate: Option<&'a mut dyn common::Delegate>,
28702 _additional_params: HashMap<String, String>,
28703 _scopes: BTreeSet<String>,
28704}
28705
28706impl<'a, C> common::CallBuilder for ProjectZoneClusterSetNetworkPolicyCall<'a, C> {}
28707
28708impl<'a, C> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
28709where
28710 C: common::Connector,
28711{
28712 /// Perform the operation you have build so far.
28713 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
28714 use std::borrow::Cow;
28715 use std::io::{Read, Seek};
28716
28717 use common::{url::Params, ToParts};
28718 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
28719
28720 let mut dd = common::DefaultDelegate;
28721 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
28722 dlg.begin(common::MethodInfo {
28723 id: "container.projects.zones.clusters.setNetworkPolicy",
28724 http_method: hyper::Method::POST,
28725 });
28726
28727 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
28728 if self._additional_params.contains_key(field) {
28729 dlg.finished(false);
28730 return Err(common::Error::FieldClash(field));
28731 }
28732 }
28733
28734 let mut params = Params::with_capacity(6 + self._additional_params.len());
28735 params.push("projectId", self._project_id);
28736 params.push("zone", self._zone);
28737 params.push("clusterId", self._cluster_id);
28738
28739 params.extend(self._additional_params.iter());
28740
28741 params.push("alt", "json");
28742 let mut url = self.hub._base_url.clone()
28743 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setNetworkPolicy";
28744 if self._scopes.is_empty() {
28745 self._scopes
28746 .insert(Scope::CloudPlatform.as_ref().to_string());
28747 }
28748
28749 #[allow(clippy::single_element_loop)]
28750 for &(find_this, param_name) in [
28751 ("{projectId}", "projectId"),
28752 ("{zone}", "zone"),
28753 ("{clusterId}", "clusterId"),
28754 ]
28755 .iter()
28756 {
28757 url = params.uri_replacement(url, param_name, find_this, false);
28758 }
28759 {
28760 let to_remove = ["clusterId", "zone", "projectId"];
28761 params.remove_params(&to_remove);
28762 }
28763
28764 let url = params.parse_with_url(&url);
28765
28766 let mut json_mime_type = mime::APPLICATION_JSON;
28767 let mut request_value_reader = {
28768 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
28769 common::remove_json_null_values(&mut value);
28770 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
28771 serde_json::to_writer(&mut dst, &value).unwrap();
28772 dst
28773 };
28774 let request_size = request_value_reader
28775 .seek(std::io::SeekFrom::End(0))
28776 .unwrap();
28777 request_value_reader
28778 .seek(std::io::SeekFrom::Start(0))
28779 .unwrap();
28780
28781 loop {
28782 let token = match self
28783 .hub
28784 .auth
28785 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
28786 .await
28787 {
28788 Ok(token) => token,
28789 Err(e) => match dlg.token(e) {
28790 Ok(token) => token,
28791 Err(e) => {
28792 dlg.finished(false);
28793 return Err(common::Error::MissingToken(e));
28794 }
28795 },
28796 };
28797 request_value_reader
28798 .seek(std::io::SeekFrom::Start(0))
28799 .unwrap();
28800 let mut req_result = {
28801 let client = &self.hub.client;
28802 dlg.pre_request();
28803 let mut req_builder = hyper::Request::builder()
28804 .method(hyper::Method::POST)
28805 .uri(url.as_str())
28806 .header(USER_AGENT, self.hub._user_agent.clone());
28807
28808 if let Some(token) = token.as_ref() {
28809 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
28810 }
28811
28812 let request = req_builder
28813 .header(CONTENT_TYPE, json_mime_type.to_string())
28814 .header(CONTENT_LENGTH, request_size as u64)
28815 .body(common::to_body(
28816 request_value_reader.get_ref().clone().into(),
28817 ));
28818
28819 client.request(request.unwrap()).await
28820 };
28821
28822 match req_result {
28823 Err(err) => {
28824 if let common::Retry::After(d) = dlg.http_error(&err) {
28825 sleep(d).await;
28826 continue;
28827 }
28828 dlg.finished(false);
28829 return Err(common::Error::HttpError(err));
28830 }
28831 Ok(res) => {
28832 let (mut parts, body) = res.into_parts();
28833 let mut body = common::Body::new(body);
28834 if !parts.status.is_success() {
28835 let bytes = common::to_bytes(body).await.unwrap_or_default();
28836 let error = serde_json::from_str(&common::to_string(&bytes));
28837 let response = common::to_response(parts, bytes.into());
28838
28839 if let common::Retry::After(d) =
28840 dlg.http_failure(&response, error.as_ref().ok())
28841 {
28842 sleep(d).await;
28843 continue;
28844 }
28845
28846 dlg.finished(false);
28847
28848 return Err(match error {
28849 Ok(value) => common::Error::BadRequest(value),
28850 _ => common::Error::Failure(response),
28851 });
28852 }
28853 let response = {
28854 let bytes = common::to_bytes(body).await.unwrap_or_default();
28855 let encoded = common::to_string(&bytes);
28856 match serde_json::from_str(&encoded) {
28857 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
28858 Err(error) => {
28859 dlg.response_json_decode_error(&encoded, &error);
28860 return Err(common::Error::JsonDecodeError(
28861 encoded.to_string(),
28862 error,
28863 ));
28864 }
28865 }
28866 };
28867
28868 dlg.finished(true);
28869 return Ok(response);
28870 }
28871 }
28872 }
28873 }
28874
28875 ///
28876 /// Sets the *request* property to the given value.
28877 ///
28878 /// Even though the property as already been set when instantiating this call,
28879 /// we provide this method for API completeness.
28880 pub fn request(
28881 mut self,
28882 new_value: SetNetworkPolicyRequest,
28883 ) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
28884 self._request = new_value;
28885 self
28886 }
28887 /// 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.
28888 ///
28889 /// Sets the *project id* path property to the given value.
28890 ///
28891 /// Even though the property as already been set when instantiating this call,
28892 /// we provide this method for API completeness.
28893 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
28894 self._project_id = new_value.to_string();
28895 self
28896 }
28897 /// 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.
28898 ///
28899 /// Sets the *zone* path property to the given value.
28900 ///
28901 /// Even though the property as already been set when instantiating this call,
28902 /// we provide this method for API completeness.
28903 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
28904 self._zone = new_value.to_string();
28905 self
28906 }
28907 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
28908 ///
28909 /// Sets the *cluster id* path property to the given value.
28910 ///
28911 /// Even though the property as already been set when instantiating this call,
28912 /// we provide this method for API completeness.
28913 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
28914 self._cluster_id = new_value.to_string();
28915 self
28916 }
28917 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
28918 /// while executing the actual API request.
28919 ///
28920 /// ````text
28921 /// It should be used to handle progress information, and to implement a certain level of resilience.
28922 /// ````
28923 ///
28924 /// Sets the *delegate* property to the given value.
28925 pub fn delegate(
28926 mut self,
28927 new_value: &'a mut dyn common::Delegate,
28928 ) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
28929 self._delegate = Some(new_value);
28930 self
28931 }
28932
28933 /// Set any additional parameter of the query string used in the request.
28934 /// It should be used to set parameters which are not yet available through their own
28935 /// setters.
28936 ///
28937 /// Please note that this method must not be used to set any of the known parameters
28938 /// which have their own setter method. If done anyway, the request will fail.
28939 ///
28940 /// # Additional Parameters
28941 ///
28942 /// * *$.xgafv* (query-string) - V1 error format.
28943 /// * *access_token* (query-string) - OAuth access token.
28944 /// * *alt* (query-string) - Data format for response.
28945 /// * *callback* (query-string) - JSONP
28946 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
28947 /// * *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.
28948 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
28949 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
28950 /// * *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.
28951 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
28952 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
28953 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
28954 where
28955 T: AsRef<str>,
28956 {
28957 self._additional_params
28958 .insert(name.as_ref().to_string(), value.as_ref().to_string());
28959 self
28960 }
28961
28962 /// Identifies the authorization scope for the method you are building.
28963 ///
28964 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
28965 /// [`Scope::CloudPlatform`].
28966 ///
28967 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
28968 /// tokens for more than one scope.
28969 ///
28970 /// Usually there is more than one suitable scope to authorize an operation, some of which may
28971 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
28972 /// sufficient, a read-write scope will do as well.
28973 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
28974 where
28975 St: AsRef<str>,
28976 {
28977 self._scopes.insert(String::from(scope.as_ref()));
28978 self
28979 }
28980 /// Identifies the authorization scope(s) for the method you are building.
28981 ///
28982 /// See [`Self::add_scope()`] for details.
28983 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
28984 where
28985 I: IntoIterator<Item = St>,
28986 St: AsRef<str>,
28987 {
28988 self._scopes
28989 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
28990 self
28991 }
28992
28993 /// Removes all scopes, and no default scope will be used either.
28994 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
28995 /// for details).
28996 pub fn clear_scopes(mut self) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
28997 self._scopes.clear();
28998 self
28999 }
29000}
29001
29002/// Starts master IP rotation.
29003///
29004/// A builder for the *zones.clusters.startIpRotation* method supported by a *project* resource.
29005/// It is not used directly, but through a [`ProjectMethods`] instance.
29006///
29007/// # Example
29008///
29009/// Instantiate a resource method builder
29010///
29011/// ```test_harness,no_run
29012/// # extern crate hyper;
29013/// # extern crate hyper_rustls;
29014/// # extern crate google_container1 as container1;
29015/// use container1::api::StartIPRotationRequest;
29016/// # async fn dox() {
29017/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29018///
29019/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29020/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29021/// # .with_native_roots()
29022/// # .unwrap()
29023/// # .https_only()
29024/// # .enable_http2()
29025/// # .build();
29026///
29027/// # let executor = hyper_util::rt::TokioExecutor::new();
29028/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29029/// # secret,
29030/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29031/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29032/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29033/// # ),
29034/// # ).build().await.unwrap();
29035///
29036/// # let client = hyper_util::client::legacy::Client::builder(
29037/// # hyper_util::rt::TokioExecutor::new()
29038/// # )
29039/// # .build(
29040/// # hyper_rustls::HttpsConnectorBuilder::new()
29041/// # .with_native_roots()
29042/// # .unwrap()
29043/// # .https_or_http()
29044/// # .enable_http2()
29045/// # .build()
29046/// # );
29047/// # let mut hub = Container::new(client, auth);
29048/// // As the method needs a request, you would usually fill it with the desired information
29049/// // into the respective structure. Some of the parts shown here might not be applicable !
29050/// // Values shown here are possibly random and not representative !
29051/// let mut req = StartIPRotationRequest::default();
29052///
29053/// // You can configure optional parameters by calling the respective setters at will, and
29054/// // execute the final call using `doit()`.
29055/// // Values shown here are possibly random and not representative !
29056/// let result = hub.projects().zones_clusters_start_ip_rotation(req, "projectId", "zone", "clusterId")
29057/// .doit().await;
29058/// # }
29059/// ```
29060pub struct ProjectZoneClusterStartIpRotationCall<'a, C>
29061where
29062 C: 'a,
29063{
29064 hub: &'a Container<C>,
29065 _request: StartIPRotationRequest,
29066 _project_id: String,
29067 _zone: String,
29068 _cluster_id: String,
29069 _delegate: Option<&'a mut dyn common::Delegate>,
29070 _additional_params: HashMap<String, String>,
29071 _scopes: BTreeSet<String>,
29072}
29073
29074impl<'a, C> common::CallBuilder for ProjectZoneClusterStartIpRotationCall<'a, C> {}
29075
29076impl<'a, C> ProjectZoneClusterStartIpRotationCall<'a, C>
29077where
29078 C: common::Connector,
29079{
29080 /// Perform the operation you have build so far.
29081 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
29082 use std::borrow::Cow;
29083 use std::io::{Read, Seek};
29084
29085 use common::{url::Params, ToParts};
29086 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29087
29088 let mut dd = common::DefaultDelegate;
29089 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29090 dlg.begin(common::MethodInfo {
29091 id: "container.projects.zones.clusters.startIpRotation",
29092 http_method: hyper::Method::POST,
29093 });
29094
29095 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
29096 if self._additional_params.contains_key(field) {
29097 dlg.finished(false);
29098 return Err(common::Error::FieldClash(field));
29099 }
29100 }
29101
29102 let mut params = Params::with_capacity(6 + self._additional_params.len());
29103 params.push("projectId", self._project_id);
29104 params.push("zone", self._zone);
29105 params.push("clusterId", self._cluster_id);
29106
29107 params.extend(self._additional_params.iter());
29108
29109 params.push("alt", "json");
29110 let mut url = self.hub._base_url.clone()
29111 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:startIpRotation";
29112 if self._scopes.is_empty() {
29113 self._scopes
29114 .insert(Scope::CloudPlatform.as_ref().to_string());
29115 }
29116
29117 #[allow(clippy::single_element_loop)]
29118 for &(find_this, param_name) in [
29119 ("{projectId}", "projectId"),
29120 ("{zone}", "zone"),
29121 ("{clusterId}", "clusterId"),
29122 ]
29123 .iter()
29124 {
29125 url = params.uri_replacement(url, param_name, find_this, false);
29126 }
29127 {
29128 let to_remove = ["clusterId", "zone", "projectId"];
29129 params.remove_params(&to_remove);
29130 }
29131
29132 let url = params.parse_with_url(&url);
29133
29134 let mut json_mime_type = mime::APPLICATION_JSON;
29135 let mut request_value_reader = {
29136 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29137 common::remove_json_null_values(&mut value);
29138 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29139 serde_json::to_writer(&mut dst, &value).unwrap();
29140 dst
29141 };
29142 let request_size = request_value_reader
29143 .seek(std::io::SeekFrom::End(0))
29144 .unwrap();
29145 request_value_reader
29146 .seek(std::io::SeekFrom::Start(0))
29147 .unwrap();
29148
29149 loop {
29150 let token = match self
29151 .hub
29152 .auth
29153 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29154 .await
29155 {
29156 Ok(token) => token,
29157 Err(e) => match dlg.token(e) {
29158 Ok(token) => token,
29159 Err(e) => {
29160 dlg.finished(false);
29161 return Err(common::Error::MissingToken(e));
29162 }
29163 },
29164 };
29165 request_value_reader
29166 .seek(std::io::SeekFrom::Start(0))
29167 .unwrap();
29168 let mut req_result = {
29169 let client = &self.hub.client;
29170 dlg.pre_request();
29171 let mut req_builder = hyper::Request::builder()
29172 .method(hyper::Method::POST)
29173 .uri(url.as_str())
29174 .header(USER_AGENT, self.hub._user_agent.clone());
29175
29176 if let Some(token) = token.as_ref() {
29177 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29178 }
29179
29180 let request = req_builder
29181 .header(CONTENT_TYPE, json_mime_type.to_string())
29182 .header(CONTENT_LENGTH, request_size as u64)
29183 .body(common::to_body(
29184 request_value_reader.get_ref().clone().into(),
29185 ));
29186
29187 client.request(request.unwrap()).await
29188 };
29189
29190 match req_result {
29191 Err(err) => {
29192 if let common::Retry::After(d) = dlg.http_error(&err) {
29193 sleep(d).await;
29194 continue;
29195 }
29196 dlg.finished(false);
29197 return Err(common::Error::HttpError(err));
29198 }
29199 Ok(res) => {
29200 let (mut parts, body) = res.into_parts();
29201 let mut body = common::Body::new(body);
29202 if !parts.status.is_success() {
29203 let bytes = common::to_bytes(body).await.unwrap_or_default();
29204 let error = serde_json::from_str(&common::to_string(&bytes));
29205 let response = common::to_response(parts, bytes.into());
29206
29207 if let common::Retry::After(d) =
29208 dlg.http_failure(&response, error.as_ref().ok())
29209 {
29210 sleep(d).await;
29211 continue;
29212 }
29213
29214 dlg.finished(false);
29215
29216 return Err(match error {
29217 Ok(value) => common::Error::BadRequest(value),
29218 _ => common::Error::Failure(response),
29219 });
29220 }
29221 let response = {
29222 let bytes = common::to_bytes(body).await.unwrap_or_default();
29223 let encoded = common::to_string(&bytes);
29224 match serde_json::from_str(&encoded) {
29225 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29226 Err(error) => {
29227 dlg.response_json_decode_error(&encoded, &error);
29228 return Err(common::Error::JsonDecodeError(
29229 encoded.to_string(),
29230 error,
29231 ));
29232 }
29233 }
29234 };
29235
29236 dlg.finished(true);
29237 return Ok(response);
29238 }
29239 }
29240 }
29241 }
29242
29243 ///
29244 /// Sets the *request* property to the given value.
29245 ///
29246 /// Even though the property as already been set when instantiating this call,
29247 /// we provide this method for API completeness.
29248 pub fn request(
29249 mut self,
29250 new_value: StartIPRotationRequest,
29251 ) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
29252 self._request = new_value;
29253 self
29254 }
29255 /// 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.
29256 ///
29257 /// Sets the *project id* path property to the given value.
29258 ///
29259 /// Even though the property as already been set when instantiating this call,
29260 /// we provide this method for API completeness.
29261 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
29262 self._project_id = new_value.to_string();
29263 self
29264 }
29265 /// 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.
29266 ///
29267 /// Sets the *zone* path property to the given value.
29268 ///
29269 /// Even though the property as already been set when instantiating this call,
29270 /// we provide this method for API completeness.
29271 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
29272 self._zone = new_value.to_string();
29273 self
29274 }
29275 /// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
29276 ///
29277 /// Sets the *cluster id* path property to the given value.
29278 ///
29279 /// Even though the property as already been set when instantiating this call,
29280 /// we provide this method for API completeness.
29281 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
29282 self._cluster_id = new_value.to_string();
29283 self
29284 }
29285 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29286 /// while executing the actual API request.
29287 ///
29288 /// ````text
29289 /// It should be used to handle progress information, and to implement a certain level of resilience.
29290 /// ````
29291 ///
29292 /// Sets the *delegate* property to the given value.
29293 pub fn delegate(
29294 mut self,
29295 new_value: &'a mut dyn common::Delegate,
29296 ) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
29297 self._delegate = Some(new_value);
29298 self
29299 }
29300
29301 /// Set any additional parameter of the query string used in the request.
29302 /// It should be used to set parameters which are not yet available through their own
29303 /// setters.
29304 ///
29305 /// Please note that this method must not be used to set any of the known parameters
29306 /// which have their own setter method. If done anyway, the request will fail.
29307 ///
29308 /// # Additional Parameters
29309 ///
29310 /// * *$.xgafv* (query-string) - V1 error format.
29311 /// * *access_token* (query-string) - OAuth access token.
29312 /// * *alt* (query-string) - Data format for response.
29313 /// * *callback* (query-string) - JSONP
29314 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29315 /// * *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.
29316 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29317 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29318 /// * *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.
29319 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29320 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29321 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterStartIpRotationCall<'a, C>
29322 where
29323 T: AsRef<str>,
29324 {
29325 self._additional_params
29326 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29327 self
29328 }
29329
29330 /// Identifies the authorization scope for the method you are building.
29331 ///
29332 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29333 /// [`Scope::CloudPlatform`].
29334 ///
29335 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29336 /// tokens for more than one scope.
29337 ///
29338 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29339 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29340 /// sufficient, a read-write scope will do as well.
29341 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterStartIpRotationCall<'a, C>
29342 where
29343 St: AsRef<str>,
29344 {
29345 self._scopes.insert(String::from(scope.as_ref()));
29346 self
29347 }
29348 /// Identifies the authorization scope(s) for the method you are building.
29349 ///
29350 /// See [`Self::add_scope()`] for details.
29351 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterStartIpRotationCall<'a, C>
29352 where
29353 I: IntoIterator<Item = St>,
29354 St: AsRef<str>,
29355 {
29356 self._scopes
29357 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29358 self
29359 }
29360
29361 /// Removes all scopes, and no default scope will be used either.
29362 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29363 /// for details).
29364 pub fn clear_scopes(mut self) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
29365 self._scopes.clear();
29366 self
29367 }
29368}
29369
29370/// Updates the settings of a specific cluster.
29371///
29372/// A builder for the *zones.clusters.update* method supported by a *project* resource.
29373/// It is not used directly, but through a [`ProjectMethods`] instance.
29374///
29375/// # Example
29376///
29377/// Instantiate a resource method builder
29378///
29379/// ```test_harness,no_run
29380/// # extern crate hyper;
29381/// # extern crate hyper_rustls;
29382/// # extern crate google_container1 as container1;
29383/// use container1::api::UpdateClusterRequest;
29384/// # async fn dox() {
29385/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29386///
29387/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29388/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29389/// # .with_native_roots()
29390/// # .unwrap()
29391/// # .https_only()
29392/// # .enable_http2()
29393/// # .build();
29394///
29395/// # let executor = hyper_util::rt::TokioExecutor::new();
29396/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29397/// # secret,
29398/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29399/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29400/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29401/// # ),
29402/// # ).build().await.unwrap();
29403///
29404/// # let client = hyper_util::client::legacy::Client::builder(
29405/// # hyper_util::rt::TokioExecutor::new()
29406/// # )
29407/// # .build(
29408/// # hyper_rustls::HttpsConnectorBuilder::new()
29409/// # .with_native_roots()
29410/// # .unwrap()
29411/// # .https_or_http()
29412/// # .enable_http2()
29413/// # .build()
29414/// # );
29415/// # let mut hub = Container::new(client, auth);
29416/// // As the method needs a request, you would usually fill it with the desired information
29417/// // into the respective structure. Some of the parts shown here might not be applicable !
29418/// // Values shown here are possibly random and not representative !
29419/// let mut req = UpdateClusterRequest::default();
29420///
29421/// // You can configure optional parameters by calling the respective setters at will, and
29422/// // execute the final call using `doit()`.
29423/// // Values shown here are possibly random and not representative !
29424/// let result = hub.projects().zones_clusters_update(req, "projectId", "zone", "clusterId")
29425/// .doit().await;
29426/// # }
29427/// ```
29428pub struct ProjectZoneClusterUpdateCall<'a, C>
29429where
29430 C: 'a,
29431{
29432 hub: &'a Container<C>,
29433 _request: UpdateClusterRequest,
29434 _project_id: String,
29435 _zone: String,
29436 _cluster_id: String,
29437 _delegate: Option<&'a mut dyn common::Delegate>,
29438 _additional_params: HashMap<String, String>,
29439 _scopes: BTreeSet<String>,
29440}
29441
29442impl<'a, C> common::CallBuilder for ProjectZoneClusterUpdateCall<'a, C> {}
29443
29444impl<'a, C> ProjectZoneClusterUpdateCall<'a, C>
29445where
29446 C: common::Connector,
29447{
29448 /// Perform the operation you have build so far.
29449 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
29450 use std::borrow::Cow;
29451 use std::io::{Read, Seek};
29452
29453 use common::{url::Params, ToParts};
29454 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29455
29456 let mut dd = common::DefaultDelegate;
29457 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29458 dlg.begin(common::MethodInfo {
29459 id: "container.projects.zones.clusters.update",
29460 http_method: hyper::Method::PUT,
29461 });
29462
29463 for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
29464 if self._additional_params.contains_key(field) {
29465 dlg.finished(false);
29466 return Err(common::Error::FieldClash(field));
29467 }
29468 }
29469
29470 let mut params = Params::with_capacity(6 + self._additional_params.len());
29471 params.push("projectId", self._project_id);
29472 params.push("zone", self._zone);
29473 params.push("clusterId", self._cluster_id);
29474
29475 params.extend(self._additional_params.iter());
29476
29477 params.push("alt", "json");
29478 let mut url = self.hub._base_url.clone()
29479 + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
29480 if self._scopes.is_empty() {
29481 self._scopes
29482 .insert(Scope::CloudPlatform.as_ref().to_string());
29483 }
29484
29485 #[allow(clippy::single_element_loop)]
29486 for &(find_this, param_name) in [
29487 ("{projectId}", "projectId"),
29488 ("{zone}", "zone"),
29489 ("{clusterId}", "clusterId"),
29490 ]
29491 .iter()
29492 {
29493 url = params.uri_replacement(url, param_name, find_this, false);
29494 }
29495 {
29496 let to_remove = ["clusterId", "zone", "projectId"];
29497 params.remove_params(&to_remove);
29498 }
29499
29500 let url = params.parse_with_url(&url);
29501
29502 let mut json_mime_type = mime::APPLICATION_JSON;
29503 let mut request_value_reader = {
29504 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29505 common::remove_json_null_values(&mut value);
29506 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29507 serde_json::to_writer(&mut dst, &value).unwrap();
29508 dst
29509 };
29510 let request_size = request_value_reader
29511 .seek(std::io::SeekFrom::End(0))
29512 .unwrap();
29513 request_value_reader
29514 .seek(std::io::SeekFrom::Start(0))
29515 .unwrap();
29516
29517 loop {
29518 let token = match self
29519 .hub
29520 .auth
29521 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29522 .await
29523 {
29524 Ok(token) => token,
29525 Err(e) => match dlg.token(e) {
29526 Ok(token) => token,
29527 Err(e) => {
29528 dlg.finished(false);
29529 return Err(common::Error::MissingToken(e));
29530 }
29531 },
29532 };
29533 request_value_reader
29534 .seek(std::io::SeekFrom::Start(0))
29535 .unwrap();
29536 let mut req_result = {
29537 let client = &self.hub.client;
29538 dlg.pre_request();
29539 let mut req_builder = hyper::Request::builder()
29540 .method(hyper::Method::PUT)
29541 .uri(url.as_str())
29542 .header(USER_AGENT, self.hub._user_agent.clone());
29543
29544 if let Some(token) = token.as_ref() {
29545 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29546 }
29547
29548 let request = req_builder
29549 .header(CONTENT_TYPE, json_mime_type.to_string())
29550 .header(CONTENT_LENGTH, request_size as u64)
29551 .body(common::to_body(
29552 request_value_reader.get_ref().clone().into(),
29553 ));
29554
29555 client.request(request.unwrap()).await
29556 };
29557
29558 match req_result {
29559 Err(err) => {
29560 if let common::Retry::After(d) = dlg.http_error(&err) {
29561 sleep(d).await;
29562 continue;
29563 }
29564 dlg.finished(false);
29565 return Err(common::Error::HttpError(err));
29566 }
29567 Ok(res) => {
29568 let (mut parts, body) = res.into_parts();
29569 let mut body = common::Body::new(body);
29570 if !parts.status.is_success() {
29571 let bytes = common::to_bytes(body).await.unwrap_or_default();
29572 let error = serde_json::from_str(&common::to_string(&bytes));
29573 let response = common::to_response(parts, bytes.into());
29574
29575 if let common::Retry::After(d) =
29576 dlg.http_failure(&response, error.as_ref().ok())
29577 {
29578 sleep(d).await;
29579 continue;
29580 }
29581
29582 dlg.finished(false);
29583
29584 return Err(match error {
29585 Ok(value) => common::Error::BadRequest(value),
29586 _ => common::Error::Failure(response),
29587 });
29588 }
29589 let response = {
29590 let bytes = common::to_bytes(body).await.unwrap_or_default();
29591 let encoded = common::to_string(&bytes);
29592 match serde_json::from_str(&encoded) {
29593 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29594 Err(error) => {
29595 dlg.response_json_decode_error(&encoded, &error);
29596 return Err(common::Error::JsonDecodeError(
29597 encoded.to_string(),
29598 error,
29599 ));
29600 }
29601 }
29602 };
29603
29604 dlg.finished(true);
29605 return Ok(response);
29606 }
29607 }
29608 }
29609 }
29610
29611 ///
29612 /// Sets the *request* property to the given value.
29613 ///
29614 /// Even though the property as already been set when instantiating this call,
29615 /// we provide this method for API completeness.
29616 pub fn request(
29617 mut self,
29618 new_value: UpdateClusterRequest,
29619 ) -> ProjectZoneClusterUpdateCall<'a, C> {
29620 self._request = new_value;
29621 self
29622 }
29623 /// 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.
29624 ///
29625 /// Sets the *project id* path property to the given value.
29626 ///
29627 /// Even though the property as already been set when instantiating this call,
29628 /// we provide this method for API completeness.
29629 pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
29630 self._project_id = new_value.to_string();
29631 self
29632 }
29633 /// 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.
29634 ///
29635 /// Sets the *zone* path property to the given value.
29636 ///
29637 /// Even though the property as already been set when instantiating this call,
29638 /// we provide this method for API completeness.
29639 pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
29640 self._zone = new_value.to_string();
29641 self
29642 }
29643 /// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
29644 ///
29645 /// Sets the *cluster id* path property to the given value.
29646 ///
29647 /// Even though the property as already been set when instantiating this call,
29648 /// we provide this method for API completeness.
29649 pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
29650 self._cluster_id = new_value.to_string();
29651 self
29652 }
29653 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
29654 /// while executing the actual API request.
29655 ///
29656 /// ````text
29657 /// It should be used to handle progress information, and to implement a certain level of resilience.
29658 /// ````
29659 ///
29660 /// Sets the *delegate* property to the given value.
29661 pub fn delegate(
29662 mut self,
29663 new_value: &'a mut dyn common::Delegate,
29664 ) -> ProjectZoneClusterUpdateCall<'a, C> {
29665 self._delegate = Some(new_value);
29666 self
29667 }
29668
29669 /// Set any additional parameter of the query string used in the request.
29670 /// It should be used to set parameters which are not yet available through their own
29671 /// setters.
29672 ///
29673 /// Please note that this method must not be used to set any of the known parameters
29674 /// which have their own setter method. If done anyway, the request will fail.
29675 ///
29676 /// # Additional Parameters
29677 ///
29678 /// * *$.xgafv* (query-string) - V1 error format.
29679 /// * *access_token* (query-string) - OAuth access token.
29680 /// * *alt* (query-string) - Data format for response.
29681 /// * *callback* (query-string) - JSONP
29682 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
29683 /// * *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.
29684 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
29685 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
29686 /// * *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.
29687 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
29688 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
29689 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterUpdateCall<'a, C>
29690 where
29691 T: AsRef<str>,
29692 {
29693 self._additional_params
29694 .insert(name.as_ref().to_string(), value.as_ref().to_string());
29695 self
29696 }
29697
29698 /// Identifies the authorization scope for the method you are building.
29699 ///
29700 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
29701 /// [`Scope::CloudPlatform`].
29702 ///
29703 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
29704 /// tokens for more than one scope.
29705 ///
29706 /// Usually there is more than one suitable scope to authorize an operation, some of which may
29707 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
29708 /// sufficient, a read-write scope will do as well.
29709 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterUpdateCall<'a, C>
29710 where
29711 St: AsRef<str>,
29712 {
29713 self._scopes.insert(String::from(scope.as_ref()));
29714 self
29715 }
29716 /// Identifies the authorization scope(s) for the method you are building.
29717 ///
29718 /// See [`Self::add_scope()`] for details.
29719 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterUpdateCall<'a, C>
29720 where
29721 I: IntoIterator<Item = St>,
29722 St: AsRef<str>,
29723 {
29724 self._scopes
29725 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
29726 self
29727 }
29728
29729 /// Removes all scopes, and no default scope will be used either.
29730 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
29731 /// for details).
29732 pub fn clear_scopes(mut self) -> ProjectZoneClusterUpdateCall<'a, C> {
29733 self._scopes.clear();
29734 self
29735 }
29736}
29737
29738/// Cancels the specified operation.
29739///
29740/// A builder for the *zones.operations.cancel* method supported by a *project* resource.
29741/// It is not used directly, but through a [`ProjectMethods`] instance.
29742///
29743/// # Example
29744///
29745/// Instantiate a resource method builder
29746///
29747/// ```test_harness,no_run
29748/// # extern crate hyper;
29749/// # extern crate hyper_rustls;
29750/// # extern crate google_container1 as container1;
29751/// use container1::api::CancelOperationRequest;
29752/// # async fn dox() {
29753/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
29754///
29755/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
29756/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
29757/// # .with_native_roots()
29758/// # .unwrap()
29759/// # .https_only()
29760/// # .enable_http2()
29761/// # .build();
29762///
29763/// # let executor = hyper_util::rt::TokioExecutor::new();
29764/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
29765/// # secret,
29766/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
29767/// # yup_oauth2::client::CustomHyperClientBuilder::from(
29768/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
29769/// # ),
29770/// # ).build().await.unwrap();
29771///
29772/// # let client = hyper_util::client::legacy::Client::builder(
29773/// # hyper_util::rt::TokioExecutor::new()
29774/// # )
29775/// # .build(
29776/// # hyper_rustls::HttpsConnectorBuilder::new()
29777/// # .with_native_roots()
29778/// # .unwrap()
29779/// # .https_or_http()
29780/// # .enable_http2()
29781/// # .build()
29782/// # );
29783/// # let mut hub = Container::new(client, auth);
29784/// // As the method needs a request, you would usually fill it with the desired information
29785/// // into the respective structure. Some of the parts shown here might not be applicable !
29786/// // Values shown here are possibly random and not representative !
29787/// let mut req = CancelOperationRequest::default();
29788///
29789/// // You can configure optional parameters by calling the respective setters at will, and
29790/// // execute the final call using `doit()`.
29791/// // Values shown here are possibly random and not representative !
29792/// let result = hub.projects().zones_operations_cancel(req, "projectId", "zone", "operationId")
29793/// .doit().await;
29794/// # }
29795/// ```
29796pub struct ProjectZoneOperationCancelCall<'a, C>
29797where
29798 C: 'a,
29799{
29800 hub: &'a Container<C>,
29801 _request: CancelOperationRequest,
29802 _project_id: String,
29803 _zone: String,
29804 _operation_id: String,
29805 _delegate: Option<&'a mut dyn common::Delegate>,
29806 _additional_params: HashMap<String, String>,
29807 _scopes: BTreeSet<String>,
29808}
29809
29810impl<'a, C> common::CallBuilder for ProjectZoneOperationCancelCall<'a, C> {}
29811
29812impl<'a, C> ProjectZoneOperationCancelCall<'a, C>
29813where
29814 C: common::Connector,
29815{
29816 /// Perform the operation you have build so far.
29817 pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
29818 use std::borrow::Cow;
29819 use std::io::{Read, Seek};
29820
29821 use common::{url::Params, ToParts};
29822 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
29823
29824 let mut dd = common::DefaultDelegate;
29825 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
29826 dlg.begin(common::MethodInfo {
29827 id: "container.projects.zones.operations.cancel",
29828 http_method: hyper::Method::POST,
29829 });
29830
29831 for &field in ["alt", "projectId", "zone", "operationId"].iter() {
29832 if self._additional_params.contains_key(field) {
29833 dlg.finished(false);
29834 return Err(common::Error::FieldClash(field));
29835 }
29836 }
29837
29838 let mut params = Params::with_capacity(6 + self._additional_params.len());
29839 params.push("projectId", self._project_id);
29840 params.push("zone", self._zone);
29841 params.push("operationId", self._operation_id);
29842
29843 params.extend(self._additional_params.iter());
29844
29845 params.push("alt", "json");
29846 let mut url = self.hub._base_url.clone()
29847 + "v1/projects/{projectId}/zones/{zone}/operations/{operationId}:cancel";
29848 if self._scopes.is_empty() {
29849 self._scopes
29850 .insert(Scope::CloudPlatform.as_ref().to_string());
29851 }
29852
29853 #[allow(clippy::single_element_loop)]
29854 for &(find_this, param_name) in [
29855 ("{projectId}", "projectId"),
29856 ("{zone}", "zone"),
29857 ("{operationId}", "operationId"),
29858 ]
29859 .iter()
29860 {
29861 url = params.uri_replacement(url, param_name, find_this, false);
29862 }
29863 {
29864 let to_remove = ["operationId", "zone", "projectId"];
29865 params.remove_params(&to_remove);
29866 }
29867
29868 let url = params.parse_with_url(&url);
29869
29870 let mut json_mime_type = mime::APPLICATION_JSON;
29871 let mut request_value_reader = {
29872 let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
29873 common::remove_json_null_values(&mut value);
29874 let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
29875 serde_json::to_writer(&mut dst, &value).unwrap();
29876 dst
29877 };
29878 let request_size = request_value_reader
29879 .seek(std::io::SeekFrom::End(0))
29880 .unwrap();
29881 request_value_reader
29882 .seek(std::io::SeekFrom::Start(0))
29883 .unwrap();
29884
29885 loop {
29886 let token = match self
29887 .hub
29888 .auth
29889 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
29890 .await
29891 {
29892 Ok(token) => token,
29893 Err(e) => match dlg.token(e) {
29894 Ok(token) => token,
29895 Err(e) => {
29896 dlg.finished(false);
29897 return Err(common::Error::MissingToken(e));
29898 }
29899 },
29900 };
29901 request_value_reader
29902 .seek(std::io::SeekFrom::Start(0))
29903 .unwrap();
29904 let mut req_result = {
29905 let client = &self.hub.client;
29906 dlg.pre_request();
29907 let mut req_builder = hyper::Request::builder()
29908 .method(hyper::Method::POST)
29909 .uri(url.as_str())
29910 .header(USER_AGENT, self.hub._user_agent.clone());
29911
29912 if let Some(token) = token.as_ref() {
29913 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
29914 }
29915
29916 let request = req_builder
29917 .header(CONTENT_TYPE, json_mime_type.to_string())
29918 .header(CONTENT_LENGTH, request_size as u64)
29919 .body(common::to_body(
29920 request_value_reader.get_ref().clone().into(),
29921 ));
29922
29923 client.request(request.unwrap()).await
29924 };
29925
29926 match req_result {
29927 Err(err) => {
29928 if let common::Retry::After(d) = dlg.http_error(&err) {
29929 sleep(d).await;
29930 continue;
29931 }
29932 dlg.finished(false);
29933 return Err(common::Error::HttpError(err));
29934 }
29935 Ok(res) => {
29936 let (mut parts, body) = res.into_parts();
29937 let mut body = common::Body::new(body);
29938 if !parts.status.is_success() {
29939 let bytes = common::to_bytes(body).await.unwrap_or_default();
29940 let error = serde_json::from_str(&common::to_string(&bytes));
29941 let response = common::to_response(parts, bytes.into());
29942
29943 if let common::Retry::After(d) =
29944 dlg.http_failure(&response, error.as_ref().ok())
29945 {
29946 sleep(d).await;
29947 continue;
29948 }
29949
29950 dlg.finished(false);
29951
29952 return Err(match error {
29953 Ok(value) => common::Error::BadRequest(value),
29954 _ => common::Error::Failure(response),
29955 });
29956 }
29957 let response = {
29958 let bytes = common::to_bytes(body).await.unwrap_or_default();
29959 let encoded = common::to_string(&bytes);
29960 match serde_json::from_str(&encoded) {
29961 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
29962 Err(error) => {
29963 dlg.response_json_decode_error(&encoded, &error);
29964 return Err(common::Error::JsonDecodeError(
29965 encoded.to_string(),
29966 error,
29967 ));
29968 }
29969 }
29970 };
29971
29972 dlg.finished(true);
29973 return Ok(response);
29974 }
29975 }
29976 }
29977 }
29978
29979 ///
29980 /// Sets the *request* property to the given value.
29981 ///
29982 /// Even though the property as already been set when instantiating this call,
29983 /// we provide this method for API completeness.
29984 pub fn request(
29985 mut self,
29986 new_value: CancelOperationRequest,
29987 ) -> ProjectZoneOperationCancelCall<'a, C> {
29988 self._request = new_value;
29989 self
29990 }
29991 /// 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.
29992 ///
29993 /// Sets the *project id* path property to the given value.
29994 ///
29995 /// Even though the property as already been set when instantiating this call,
29996 /// we provide this method for API completeness.
29997 pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
29998 self._project_id = new_value.to_string();
29999 self
30000 }
30001 /// 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.
30002 ///
30003 /// Sets the *zone* path property to the given value.
30004 ///
30005 /// Even though the property as already been set when instantiating this call,
30006 /// we provide this method for API completeness.
30007 pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
30008 self._zone = new_value.to_string();
30009 self
30010 }
30011 /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
30012 ///
30013 /// Sets the *operation id* path property to the given value.
30014 ///
30015 /// Even though the property as already been set when instantiating this call,
30016 /// we provide this method for API completeness.
30017 pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
30018 self._operation_id = new_value.to_string();
30019 self
30020 }
30021 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30022 /// while executing the actual API request.
30023 ///
30024 /// ````text
30025 /// It should be used to handle progress information, and to implement a certain level of resilience.
30026 /// ````
30027 ///
30028 /// Sets the *delegate* property to the given value.
30029 pub fn delegate(
30030 mut self,
30031 new_value: &'a mut dyn common::Delegate,
30032 ) -> ProjectZoneOperationCancelCall<'a, C> {
30033 self._delegate = Some(new_value);
30034 self
30035 }
30036
30037 /// Set any additional parameter of the query string used in the request.
30038 /// It should be used to set parameters which are not yet available through their own
30039 /// setters.
30040 ///
30041 /// Please note that this method must not be used to set any of the known parameters
30042 /// which have their own setter method. If done anyway, the request will fail.
30043 ///
30044 /// # Additional Parameters
30045 ///
30046 /// * *$.xgafv* (query-string) - V1 error format.
30047 /// * *access_token* (query-string) - OAuth access token.
30048 /// * *alt* (query-string) - Data format for response.
30049 /// * *callback* (query-string) - JSONP
30050 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30051 /// * *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.
30052 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30053 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30054 /// * *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.
30055 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30056 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30057 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationCancelCall<'a, C>
30058 where
30059 T: AsRef<str>,
30060 {
30061 self._additional_params
30062 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30063 self
30064 }
30065
30066 /// Identifies the authorization scope for the method you are building.
30067 ///
30068 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30069 /// [`Scope::CloudPlatform`].
30070 ///
30071 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30072 /// tokens for more than one scope.
30073 ///
30074 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30075 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30076 /// sufficient, a read-write scope will do as well.
30077 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationCancelCall<'a, C>
30078 where
30079 St: AsRef<str>,
30080 {
30081 self._scopes.insert(String::from(scope.as_ref()));
30082 self
30083 }
30084 /// Identifies the authorization scope(s) for the method you are building.
30085 ///
30086 /// See [`Self::add_scope()`] for details.
30087 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationCancelCall<'a, C>
30088 where
30089 I: IntoIterator<Item = St>,
30090 St: AsRef<str>,
30091 {
30092 self._scopes
30093 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30094 self
30095 }
30096
30097 /// Removes all scopes, and no default scope will be used either.
30098 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30099 /// for details).
30100 pub fn clear_scopes(mut self) -> ProjectZoneOperationCancelCall<'a, C> {
30101 self._scopes.clear();
30102 self
30103 }
30104}
30105
30106/// Gets the specified operation.
30107///
30108/// A builder for the *zones.operations.get* method supported by a *project* resource.
30109/// It is not used directly, but through a [`ProjectMethods`] instance.
30110///
30111/// # Example
30112///
30113/// Instantiate a resource method builder
30114///
30115/// ```test_harness,no_run
30116/// # extern crate hyper;
30117/// # extern crate hyper_rustls;
30118/// # extern crate google_container1 as container1;
30119/// # async fn dox() {
30120/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30121///
30122/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30123/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30124/// # .with_native_roots()
30125/// # .unwrap()
30126/// # .https_only()
30127/// # .enable_http2()
30128/// # .build();
30129///
30130/// # let executor = hyper_util::rt::TokioExecutor::new();
30131/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30132/// # secret,
30133/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30134/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30135/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30136/// # ),
30137/// # ).build().await.unwrap();
30138///
30139/// # let client = hyper_util::client::legacy::Client::builder(
30140/// # hyper_util::rt::TokioExecutor::new()
30141/// # )
30142/// # .build(
30143/// # hyper_rustls::HttpsConnectorBuilder::new()
30144/// # .with_native_roots()
30145/// # .unwrap()
30146/// # .https_or_http()
30147/// # .enable_http2()
30148/// # .build()
30149/// # );
30150/// # let mut hub = Container::new(client, auth);
30151/// // You can configure optional parameters by calling the respective setters at will, and
30152/// // execute the final call using `doit()`.
30153/// // Values shown here are possibly random and not representative !
30154/// let result = hub.projects().zones_operations_get("projectId", "zone", "operationId")
30155/// .name("aliquyam")
30156/// .doit().await;
30157/// # }
30158/// ```
30159pub struct ProjectZoneOperationGetCall<'a, C>
30160where
30161 C: 'a,
30162{
30163 hub: &'a Container<C>,
30164 _project_id: String,
30165 _zone: String,
30166 _operation_id: String,
30167 _name: Option<String>,
30168 _delegate: Option<&'a mut dyn common::Delegate>,
30169 _additional_params: HashMap<String, String>,
30170 _scopes: BTreeSet<String>,
30171}
30172
30173impl<'a, C> common::CallBuilder for ProjectZoneOperationGetCall<'a, C> {}
30174
30175impl<'a, C> ProjectZoneOperationGetCall<'a, C>
30176where
30177 C: common::Connector,
30178{
30179 /// Perform the operation you have build so far.
30180 pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
30181 use std::borrow::Cow;
30182 use std::io::{Read, Seek};
30183
30184 use common::{url::Params, ToParts};
30185 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30186
30187 let mut dd = common::DefaultDelegate;
30188 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30189 dlg.begin(common::MethodInfo {
30190 id: "container.projects.zones.operations.get",
30191 http_method: hyper::Method::GET,
30192 });
30193
30194 for &field in ["alt", "projectId", "zone", "operationId", "name"].iter() {
30195 if self._additional_params.contains_key(field) {
30196 dlg.finished(false);
30197 return Err(common::Error::FieldClash(field));
30198 }
30199 }
30200
30201 let mut params = Params::with_capacity(6 + self._additional_params.len());
30202 params.push("projectId", self._project_id);
30203 params.push("zone", self._zone);
30204 params.push("operationId", self._operation_id);
30205 if let Some(value) = self._name.as_ref() {
30206 params.push("name", value);
30207 }
30208
30209 params.extend(self._additional_params.iter());
30210
30211 params.push("alt", "json");
30212 let mut url = self.hub._base_url.clone()
30213 + "v1/projects/{projectId}/zones/{zone}/operations/{operationId}";
30214 if self._scopes.is_empty() {
30215 self._scopes
30216 .insert(Scope::CloudPlatform.as_ref().to_string());
30217 }
30218
30219 #[allow(clippy::single_element_loop)]
30220 for &(find_this, param_name) in [
30221 ("{projectId}", "projectId"),
30222 ("{zone}", "zone"),
30223 ("{operationId}", "operationId"),
30224 ]
30225 .iter()
30226 {
30227 url = params.uri_replacement(url, param_name, find_this, false);
30228 }
30229 {
30230 let to_remove = ["operationId", "zone", "projectId"];
30231 params.remove_params(&to_remove);
30232 }
30233
30234 let url = params.parse_with_url(&url);
30235
30236 loop {
30237 let token = match self
30238 .hub
30239 .auth
30240 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30241 .await
30242 {
30243 Ok(token) => token,
30244 Err(e) => match dlg.token(e) {
30245 Ok(token) => token,
30246 Err(e) => {
30247 dlg.finished(false);
30248 return Err(common::Error::MissingToken(e));
30249 }
30250 },
30251 };
30252 let mut req_result = {
30253 let client = &self.hub.client;
30254 dlg.pre_request();
30255 let mut req_builder = hyper::Request::builder()
30256 .method(hyper::Method::GET)
30257 .uri(url.as_str())
30258 .header(USER_AGENT, self.hub._user_agent.clone());
30259
30260 if let Some(token) = token.as_ref() {
30261 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30262 }
30263
30264 let request = req_builder
30265 .header(CONTENT_LENGTH, 0_u64)
30266 .body(common::to_body::<String>(None));
30267
30268 client.request(request.unwrap()).await
30269 };
30270
30271 match req_result {
30272 Err(err) => {
30273 if let common::Retry::After(d) = dlg.http_error(&err) {
30274 sleep(d).await;
30275 continue;
30276 }
30277 dlg.finished(false);
30278 return Err(common::Error::HttpError(err));
30279 }
30280 Ok(res) => {
30281 let (mut parts, body) = res.into_parts();
30282 let mut body = common::Body::new(body);
30283 if !parts.status.is_success() {
30284 let bytes = common::to_bytes(body).await.unwrap_or_default();
30285 let error = serde_json::from_str(&common::to_string(&bytes));
30286 let response = common::to_response(parts, bytes.into());
30287
30288 if let common::Retry::After(d) =
30289 dlg.http_failure(&response, error.as_ref().ok())
30290 {
30291 sleep(d).await;
30292 continue;
30293 }
30294
30295 dlg.finished(false);
30296
30297 return Err(match error {
30298 Ok(value) => common::Error::BadRequest(value),
30299 _ => common::Error::Failure(response),
30300 });
30301 }
30302 let response = {
30303 let bytes = common::to_bytes(body).await.unwrap_or_default();
30304 let encoded = common::to_string(&bytes);
30305 match serde_json::from_str(&encoded) {
30306 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30307 Err(error) => {
30308 dlg.response_json_decode_error(&encoded, &error);
30309 return Err(common::Error::JsonDecodeError(
30310 encoded.to_string(),
30311 error,
30312 ));
30313 }
30314 }
30315 };
30316
30317 dlg.finished(true);
30318 return Ok(response);
30319 }
30320 }
30321 }
30322 }
30323
30324 /// 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.
30325 ///
30326 /// Sets the *project id* path property to the given value.
30327 ///
30328 /// Even though the property as already been set when instantiating this call,
30329 /// we provide this method for API completeness.
30330 pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
30331 self._project_id = new_value.to_string();
30332 self
30333 }
30334 /// 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.
30335 ///
30336 /// Sets the *zone* path property to the given value.
30337 ///
30338 /// Even though the property as already been set when instantiating this call,
30339 /// we provide this method for API completeness.
30340 pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
30341 self._zone = new_value.to_string();
30342 self
30343 }
30344 /// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
30345 ///
30346 /// Sets the *operation id* path property to the given value.
30347 ///
30348 /// Even though the property as already been set when instantiating this call,
30349 /// we provide this method for API completeness.
30350 pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
30351 self._operation_id = new_value.to_string();
30352 self
30353 }
30354 /// The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
30355 ///
30356 /// Sets the *name* query property to the given value.
30357 pub fn name(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
30358 self._name = Some(new_value.to_string());
30359 self
30360 }
30361 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30362 /// while executing the actual API request.
30363 ///
30364 /// ````text
30365 /// It should be used to handle progress information, and to implement a certain level of resilience.
30366 /// ````
30367 ///
30368 /// Sets the *delegate* property to the given value.
30369 pub fn delegate(
30370 mut self,
30371 new_value: &'a mut dyn common::Delegate,
30372 ) -> ProjectZoneOperationGetCall<'a, C> {
30373 self._delegate = Some(new_value);
30374 self
30375 }
30376
30377 /// Set any additional parameter of the query string used in the request.
30378 /// It should be used to set parameters which are not yet available through their own
30379 /// setters.
30380 ///
30381 /// Please note that this method must not be used to set any of the known parameters
30382 /// which have their own setter method. If done anyway, the request will fail.
30383 ///
30384 /// # Additional Parameters
30385 ///
30386 /// * *$.xgafv* (query-string) - V1 error format.
30387 /// * *access_token* (query-string) - OAuth access token.
30388 /// * *alt* (query-string) - Data format for response.
30389 /// * *callback* (query-string) - JSONP
30390 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30391 /// * *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.
30392 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30393 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30394 /// * *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.
30395 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30396 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30397 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationGetCall<'a, C>
30398 where
30399 T: AsRef<str>,
30400 {
30401 self._additional_params
30402 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30403 self
30404 }
30405
30406 /// Identifies the authorization scope for the method you are building.
30407 ///
30408 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30409 /// [`Scope::CloudPlatform`].
30410 ///
30411 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30412 /// tokens for more than one scope.
30413 ///
30414 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30415 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30416 /// sufficient, a read-write scope will do as well.
30417 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationGetCall<'a, C>
30418 where
30419 St: AsRef<str>,
30420 {
30421 self._scopes.insert(String::from(scope.as_ref()));
30422 self
30423 }
30424 /// Identifies the authorization scope(s) for the method you are building.
30425 ///
30426 /// See [`Self::add_scope()`] for details.
30427 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationGetCall<'a, C>
30428 where
30429 I: IntoIterator<Item = St>,
30430 St: AsRef<str>,
30431 {
30432 self._scopes
30433 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30434 self
30435 }
30436
30437 /// Removes all scopes, and no default scope will be used either.
30438 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30439 /// for details).
30440 pub fn clear_scopes(mut self) -> ProjectZoneOperationGetCall<'a, C> {
30441 self._scopes.clear();
30442 self
30443 }
30444}
30445
30446/// Lists all operations in a project in a specific zone or all zones.
30447///
30448/// A builder for the *zones.operations.list* method supported by a *project* resource.
30449/// It is not used directly, but through a [`ProjectMethods`] instance.
30450///
30451/// # Example
30452///
30453/// Instantiate a resource method builder
30454///
30455/// ```test_harness,no_run
30456/// # extern crate hyper;
30457/// # extern crate hyper_rustls;
30458/// # extern crate google_container1 as container1;
30459/// # async fn dox() {
30460/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30461///
30462/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30463/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30464/// # .with_native_roots()
30465/// # .unwrap()
30466/// # .https_only()
30467/// # .enable_http2()
30468/// # .build();
30469///
30470/// # let executor = hyper_util::rt::TokioExecutor::new();
30471/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30472/// # secret,
30473/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30474/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30475/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30476/// # ),
30477/// # ).build().await.unwrap();
30478///
30479/// # let client = hyper_util::client::legacy::Client::builder(
30480/// # hyper_util::rt::TokioExecutor::new()
30481/// # )
30482/// # .build(
30483/// # hyper_rustls::HttpsConnectorBuilder::new()
30484/// # .with_native_roots()
30485/// # .unwrap()
30486/// # .https_or_http()
30487/// # .enable_http2()
30488/// # .build()
30489/// # );
30490/// # let mut hub = Container::new(client, auth);
30491/// // You can configure optional parameters by calling the respective setters at will, and
30492/// // execute the final call using `doit()`.
30493/// // Values shown here are possibly random and not representative !
30494/// let result = hub.projects().zones_operations_list("projectId", "zone")
30495/// .parent("dolores")
30496/// .doit().await;
30497/// # }
30498/// ```
30499pub struct ProjectZoneOperationListCall<'a, C>
30500where
30501 C: 'a,
30502{
30503 hub: &'a Container<C>,
30504 _project_id: String,
30505 _zone: String,
30506 _parent: Option<String>,
30507 _delegate: Option<&'a mut dyn common::Delegate>,
30508 _additional_params: HashMap<String, String>,
30509 _scopes: BTreeSet<String>,
30510}
30511
30512impl<'a, C> common::CallBuilder for ProjectZoneOperationListCall<'a, C> {}
30513
30514impl<'a, C> ProjectZoneOperationListCall<'a, C>
30515where
30516 C: common::Connector,
30517{
30518 /// Perform the operation you have build so far.
30519 pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
30520 use std::borrow::Cow;
30521 use std::io::{Read, Seek};
30522
30523 use common::{url::Params, ToParts};
30524 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30525
30526 let mut dd = common::DefaultDelegate;
30527 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30528 dlg.begin(common::MethodInfo {
30529 id: "container.projects.zones.operations.list",
30530 http_method: hyper::Method::GET,
30531 });
30532
30533 for &field in ["alt", "projectId", "zone", "parent"].iter() {
30534 if self._additional_params.contains_key(field) {
30535 dlg.finished(false);
30536 return Err(common::Error::FieldClash(field));
30537 }
30538 }
30539
30540 let mut params = Params::with_capacity(5 + self._additional_params.len());
30541 params.push("projectId", self._project_id);
30542 params.push("zone", self._zone);
30543 if let Some(value) = self._parent.as_ref() {
30544 params.push("parent", value);
30545 }
30546
30547 params.extend(self._additional_params.iter());
30548
30549 params.push("alt", "json");
30550 let mut url =
30551 self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/operations";
30552 if self._scopes.is_empty() {
30553 self._scopes
30554 .insert(Scope::CloudPlatform.as_ref().to_string());
30555 }
30556
30557 #[allow(clippy::single_element_loop)]
30558 for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
30559 url = params.uri_replacement(url, param_name, find_this, false);
30560 }
30561 {
30562 let to_remove = ["zone", "projectId"];
30563 params.remove_params(&to_remove);
30564 }
30565
30566 let url = params.parse_with_url(&url);
30567
30568 loop {
30569 let token = match self
30570 .hub
30571 .auth
30572 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30573 .await
30574 {
30575 Ok(token) => token,
30576 Err(e) => match dlg.token(e) {
30577 Ok(token) => token,
30578 Err(e) => {
30579 dlg.finished(false);
30580 return Err(common::Error::MissingToken(e));
30581 }
30582 },
30583 };
30584 let mut req_result = {
30585 let client = &self.hub.client;
30586 dlg.pre_request();
30587 let mut req_builder = hyper::Request::builder()
30588 .method(hyper::Method::GET)
30589 .uri(url.as_str())
30590 .header(USER_AGENT, self.hub._user_agent.clone());
30591
30592 if let Some(token) = token.as_ref() {
30593 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30594 }
30595
30596 let request = req_builder
30597 .header(CONTENT_LENGTH, 0_u64)
30598 .body(common::to_body::<String>(None));
30599
30600 client.request(request.unwrap()).await
30601 };
30602
30603 match req_result {
30604 Err(err) => {
30605 if let common::Retry::After(d) = dlg.http_error(&err) {
30606 sleep(d).await;
30607 continue;
30608 }
30609 dlg.finished(false);
30610 return Err(common::Error::HttpError(err));
30611 }
30612 Ok(res) => {
30613 let (mut parts, body) = res.into_parts();
30614 let mut body = common::Body::new(body);
30615 if !parts.status.is_success() {
30616 let bytes = common::to_bytes(body).await.unwrap_or_default();
30617 let error = serde_json::from_str(&common::to_string(&bytes));
30618 let response = common::to_response(parts, bytes.into());
30619
30620 if let common::Retry::After(d) =
30621 dlg.http_failure(&response, error.as_ref().ok())
30622 {
30623 sleep(d).await;
30624 continue;
30625 }
30626
30627 dlg.finished(false);
30628
30629 return Err(match error {
30630 Ok(value) => common::Error::BadRequest(value),
30631 _ => common::Error::Failure(response),
30632 });
30633 }
30634 let response = {
30635 let bytes = common::to_bytes(body).await.unwrap_or_default();
30636 let encoded = common::to_string(&bytes);
30637 match serde_json::from_str(&encoded) {
30638 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30639 Err(error) => {
30640 dlg.response_json_decode_error(&encoded, &error);
30641 return Err(common::Error::JsonDecodeError(
30642 encoded.to_string(),
30643 error,
30644 ));
30645 }
30646 }
30647 };
30648
30649 dlg.finished(true);
30650 return Ok(response);
30651 }
30652 }
30653 }
30654 }
30655
30656 /// 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.
30657 ///
30658 /// Sets the *project id* path property to the given value.
30659 ///
30660 /// Even though the property as already been set when instantiating this call,
30661 /// we provide this method for API completeness.
30662 pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
30663 self._project_id = new_value.to_string();
30664 self
30665 }
30666 /// 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.
30667 ///
30668 /// Sets the *zone* path property to the given value.
30669 ///
30670 /// Even though the property as already been set when instantiating this call,
30671 /// we provide this method for API completeness.
30672 pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
30673 self._zone = new_value.to_string();
30674 self
30675 }
30676 /// The parent (project and location) where the operations will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
30677 ///
30678 /// Sets the *parent* query property to the given value.
30679 pub fn parent(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
30680 self._parent = Some(new_value.to_string());
30681 self
30682 }
30683 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
30684 /// while executing the actual API request.
30685 ///
30686 /// ````text
30687 /// It should be used to handle progress information, and to implement a certain level of resilience.
30688 /// ````
30689 ///
30690 /// Sets the *delegate* property to the given value.
30691 pub fn delegate(
30692 mut self,
30693 new_value: &'a mut dyn common::Delegate,
30694 ) -> ProjectZoneOperationListCall<'a, C> {
30695 self._delegate = Some(new_value);
30696 self
30697 }
30698
30699 /// Set any additional parameter of the query string used in the request.
30700 /// It should be used to set parameters which are not yet available through their own
30701 /// setters.
30702 ///
30703 /// Please note that this method must not be used to set any of the known parameters
30704 /// which have their own setter method. If done anyway, the request will fail.
30705 ///
30706 /// # Additional Parameters
30707 ///
30708 /// * *$.xgafv* (query-string) - V1 error format.
30709 /// * *access_token* (query-string) - OAuth access token.
30710 /// * *alt* (query-string) - Data format for response.
30711 /// * *callback* (query-string) - JSONP
30712 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
30713 /// * *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.
30714 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
30715 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
30716 /// * *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.
30717 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
30718 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
30719 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationListCall<'a, C>
30720 where
30721 T: AsRef<str>,
30722 {
30723 self._additional_params
30724 .insert(name.as_ref().to_string(), value.as_ref().to_string());
30725 self
30726 }
30727
30728 /// Identifies the authorization scope for the method you are building.
30729 ///
30730 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
30731 /// [`Scope::CloudPlatform`].
30732 ///
30733 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
30734 /// tokens for more than one scope.
30735 ///
30736 /// Usually there is more than one suitable scope to authorize an operation, some of which may
30737 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
30738 /// sufficient, a read-write scope will do as well.
30739 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationListCall<'a, C>
30740 where
30741 St: AsRef<str>,
30742 {
30743 self._scopes.insert(String::from(scope.as_ref()));
30744 self
30745 }
30746 /// Identifies the authorization scope(s) for the method you are building.
30747 ///
30748 /// See [`Self::add_scope()`] for details.
30749 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationListCall<'a, C>
30750 where
30751 I: IntoIterator<Item = St>,
30752 St: AsRef<str>,
30753 {
30754 self._scopes
30755 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
30756 self
30757 }
30758
30759 /// Removes all scopes, and no default scope will be used either.
30760 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
30761 /// for details).
30762 pub fn clear_scopes(mut self) -> ProjectZoneOperationListCall<'a, C> {
30763 self._scopes.clear();
30764 self
30765 }
30766}
30767
30768/// Returns configuration info about the Google Kubernetes Engine service.
30769///
30770/// A builder for the *zones.getServerconfig* method supported by a *project* resource.
30771/// It is not used directly, but through a [`ProjectMethods`] instance.
30772///
30773/// # Example
30774///
30775/// Instantiate a resource method builder
30776///
30777/// ```test_harness,no_run
30778/// # extern crate hyper;
30779/// # extern crate hyper_rustls;
30780/// # extern crate google_container1 as container1;
30781/// # async fn dox() {
30782/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
30783///
30784/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
30785/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
30786/// # .with_native_roots()
30787/// # .unwrap()
30788/// # .https_only()
30789/// # .enable_http2()
30790/// # .build();
30791///
30792/// # let executor = hyper_util::rt::TokioExecutor::new();
30793/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
30794/// # secret,
30795/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
30796/// # yup_oauth2::client::CustomHyperClientBuilder::from(
30797/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
30798/// # ),
30799/// # ).build().await.unwrap();
30800///
30801/// # let client = hyper_util::client::legacy::Client::builder(
30802/// # hyper_util::rt::TokioExecutor::new()
30803/// # )
30804/// # .build(
30805/// # hyper_rustls::HttpsConnectorBuilder::new()
30806/// # .with_native_roots()
30807/// # .unwrap()
30808/// # .https_or_http()
30809/// # .enable_http2()
30810/// # .build()
30811/// # );
30812/// # let mut hub = Container::new(client, auth);
30813/// // You can configure optional parameters by calling the respective setters at will, and
30814/// // execute the final call using `doit()`.
30815/// // Values shown here are possibly random and not representative !
30816/// let result = hub.projects().zones_get_serverconfig("projectId", "zone")
30817/// .name("dolor")
30818/// .doit().await;
30819/// # }
30820/// ```
30821pub struct ProjectZoneGetServerconfigCall<'a, C>
30822where
30823 C: 'a,
30824{
30825 hub: &'a Container<C>,
30826 _project_id: String,
30827 _zone: String,
30828 _name: Option<String>,
30829 _delegate: Option<&'a mut dyn common::Delegate>,
30830 _additional_params: HashMap<String, String>,
30831 _scopes: BTreeSet<String>,
30832}
30833
30834impl<'a, C> common::CallBuilder for ProjectZoneGetServerconfigCall<'a, C> {}
30835
30836impl<'a, C> ProjectZoneGetServerconfigCall<'a, C>
30837where
30838 C: common::Connector,
30839{
30840 /// Perform the operation you have build so far.
30841 pub async fn doit(mut self) -> common::Result<(common::Response, ServerConfig)> {
30842 use std::borrow::Cow;
30843 use std::io::{Read, Seek};
30844
30845 use common::{url::Params, ToParts};
30846 use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
30847
30848 let mut dd = common::DefaultDelegate;
30849 let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
30850 dlg.begin(common::MethodInfo {
30851 id: "container.projects.zones.getServerconfig",
30852 http_method: hyper::Method::GET,
30853 });
30854
30855 for &field in ["alt", "projectId", "zone", "name"].iter() {
30856 if self._additional_params.contains_key(field) {
30857 dlg.finished(false);
30858 return Err(common::Error::FieldClash(field));
30859 }
30860 }
30861
30862 let mut params = Params::with_capacity(5 + self._additional_params.len());
30863 params.push("projectId", self._project_id);
30864 params.push("zone", self._zone);
30865 if let Some(value) = self._name.as_ref() {
30866 params.push("name", value);
30867 }
30868
30869 params.extend(self._additional_params.iter());
30870
30871 params.push("alt", "json");
30872 let mut url =
30873 self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/serverconfig";
30874 if self._scopes.is_empty() {
30875 self._scopes
30876 .insert(Scope::CloudPlatform.as_ref().to_string());
30877 }
30878
30879 #[allow(clippy::single_element_loop)]
30880 for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
30881 url = params.uri_replacement(url, param_name, find_this, false);
30882 }
30883 {
30884 let to_remove = ["zone", "projectId"];
30885 params.remove_params(&to_remove);
30886 }
30887
30888 let url = params.parse_with_url(&url);
30889
30890 loop {
30891 let token = match self
30892 .hub
30893 .auth
30894 .get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
30895 .await
30896 {
30897 Ok(token) => token,
30898 Err(e) => match dlg.token(e) {
30899 Ok(token) => token,
30900 Err(e) => {
30901 dlg.finished(false);
30902 return Err(common::Error::MissingToken(e));
30903 }
30904 },
30905 };
30906 let mut req_result = {
30907 let client = &self.hub.client;
30908 dlg.pre_request();
30909 let mut req_builder = hyper::Request::builder()
30910 .method(hyper::Method::GET)
30911 .uri(url.as_str())
30912 .header(USER_AGENT, self.hub._user_agent.clone());
30913
30914 if let Some(token) = token.as_ref() {
30915 req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
30916 }
30917
30918 let request = req_builder
30919 .header(CONTENT_LENGTH, 0_u64)
30920 .body(common::to_body::<String>(None));
30921
30922 client.request(request.unwrap()).await
30923 };
30924
30925 match req_result {
30926 Err(err) => {
30927 if let common::Retry::After(d) = dlg.http_error(&err) {
30928 sleep(d).await;
30929 continue;
30930 }
30931 dlg.finished(false);
30932 return Err(common::Error::HttpError(err));
30933 }
30934 Ok(res) => {
30935 let (mut parts, body) = res.into_parts();
30936 let mut body = common::Body::new(body);
30937 if !parts.status.is_success() {
30938 let bytes = common::to_bytes(body).await.unwrap_or_default();
30939 let error = serde_json::from_str(&common::to_string(&bytes));
30940 let response = common::to_response(parts, bytes.into());
30941
30942 if let common::Retry::After(d) =
30943 dlg.http_failure(&response, error.as_ref().ok())
30944 {
30945 sleep(d).await;
30946 continue;
30947 }
30948
30949 dlg.finished(false);
30950
30951 return Err(match error {
30952 Ok(value) => common::Error::BadRequest(value),
30953 _ => common::Error::Failure(response),
30954 });
30955 }
30956 let response = {
30957 let bytes = common::to_bytes(body).await.unwrap_or_default();
30958 let encoded = common::to_string(&bytes);
30959 match serde_json::from_str(&encoded) {
30960 Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
30961 Err(error) => {
30962 dlg.response_json_decode_error(&encoded, &error);
30963 return Err(common::Error::JsonDecodeError(
30964 encoded.to_string(),
30965 error,
30966 ));
30967 }
30968 }
30969 };
30970
30971 dlg.finished(true);
30972 return Ok(response);
30973 }
30974 }
30975 }
30976 }
30977
30978 /// 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.
30979 ///
30980 /// Sets the *project id* path property to the given value.
30981 ///
30982 /// Even though the property as already been set when instantiating this call,
30983 /// we provide this method for API completeness.
30984 pub fn project_id(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
30985 self._project_id = new_value.to_string();
30986 self
30987 }
30988 /// 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.
30989 ///
30990 /// Sets the *zone* path property to the given value.
30991 ///
30992 /// Even though the property as already been set when instantiating this call,
30993 /// we provide this method for API completeness.
30994 pub fn zone(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
30995 self._zone = new_value.to_string();
30996 self
30997 }
30998 /// The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
30999 ///
31000 /// Sets the *name* query property to the given value.
31001 pub fn name(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
31002 self._name = Some(new_value.to_string());
31003 self
31004 }
31005 /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
31006 /// while executing the actual API request.
31007 ///
31008 /// ````text
31009 /// It should be used to handle progress information, and to implement a certain level of resilience.
31010 /// ````
31011 ///
31012 /// Sets the *delegate* property to the given value.
31013 pub fn delegate(
31014 mut self,
31015 new_value: &'a mut dyn common::Delegate,
31016 ) -> ProjectZoneGetServerconfigCall<'a, C> {
31017 self._delegate = Some(new_value);
31018 self
31019 }
31020
31021 /// Set any additional parameter of the query string used in the request.
31022 /// It should be used to set parameters which are not yet available through their own
31023 /// setters.
31024 ///
31025 /// Please note that this method must not be used to set any of the known parameters
31026 /// which have their own setter method. If done anyway, the request will fail.
31027 ///
31028 /// # Additional Parameters
31029 ///
31030 /// * *$.xgafv* (query-string) - V1 error format.
31031 /// * *access_token* (query-string) - OAuth access token.
31032 /// * *alt* (query-string) - Data format for response.
31033 /// * *callback* (query-string) - JSONP
31034 /// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
31035 /// * *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.
31036 /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
31037 /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
31038 /// * *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.
31039 /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
31040 /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
31041 pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneGetServerconfigCall<'a, C>
31042 where
31043 T: AsRef<str>,
31044 {
31045 self._additional_params
31046 .insert(name.as_ref().to_string(), value.as_ref().to_string());
31047 self
31048 }
31049
31050 /// Identifies the authorization scope for the method you are building.
31051 ///
31052 /// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
31053 /// [`Scope::CloudPlatform`].
31054 ///
31055 /// The `scope` will be added to a set of scopes. This is important as one can maintain access
31056 /// tokens for more than one scope.
31057 ///
31058 /// Usually there is more than one suitable scope to authorize an operation, some of which may
31059 /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
31060 /// sufficient, a read-write scope will do as well.
31061 pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneGetServerconfigCall<'a, C>
31062 where
31063 St: AsRef<str>,
31064 {
31065 self._scopes.insert(String::from(scope.as_ref()));
31066 self
31067 }
31068 /// Identifies the authorization scope(s) for the method you are building.
31069 ///
31070 /// See [`Self::add_scope()`] for details.
31071 pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneGetServerconfigCall<'a, C>
31072 where
31073 I: IntoIterator<Item = St>,
31074 St: AsRef<str>,
31075 {
31076 self._scopes
31077 .extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
31078 self
31079 }
31080
31081 /// Removes all scopes, and no default scope will be used either.
31082 /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
31083 /// for details).
31084 pub fn clear_scopes(mut self) -> ProjectZoneGetServerconfigCall<'a, C> {
31085 self._scopes.clear();
31086 self
31087 }
31088}