#![allow(clippy::ptr_arg)]
use std::collections::{BTreeSet, HashMap};
use tokio::time::sleep;
// ##############
// UTILITIES ###
// ############
/// Identifies the an OAuth2 authorization scope.
/// A scope is needed when requesting an
/// [authorization token](https://developers.google.com/youtube/v3/guides/authentication).
#[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
pub enum Scope {
/// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
CloudPlatform,
}
impl AsRef<str> for Scope {
fn as_ref(&self) -> &str {
match *self {
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
}
}
}
#[allow(clippy::derivable_impls)]
impl Default for Scope {
fn default() -> Scope {
Scope::CloudPlatform
}
}
// ########
// HUB ###
// ######
/// Central instance to access all Container related resource activities
///
/// # Examples
///
/// Instantiate a new hub
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_container1 as container1;
/// use container1::{Result, Error};
/// # async fn dox() {
/// use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
/// // `client_secret`, among other things.
/// let secret: yup_oauth2::ApplicationSecret = Default::default();
/// // Instantiate the authenticator. It will choose a suitable authentication flow for you,
/// // unless you replace `None` with the desired Flow.
/// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about
/// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and
/// // retrieve them from storage.
/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// .with_native_roots()
/// .unwrap()
/// .https_only()
/// .enable_http2()
/// .build();
///
/// let executor = hyper_util::rt::TokioExecutor::new();
/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// secret,
/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// yup_oauth2::client::CustomHyperClientBuilder::from(
/// hyper_util::client::legacy::Client::builder(executor).build(connector),
/// ),
/// ).build().await.unwrap();
///
/// let client = hyper_util::client::legacy::Client::builder(
/// hyper_util::rt::TokioExecutor::new()
/// )
/// .build(
/// hyper_rustls::HttpsConnectorBuilder::new()
/// .with_native_roots()
/// .unwrap()
/// .https_or_http()
/// .enable_http2()
/// .build()
/// );
/// let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_delete("name")
/// .zone("duo")
/// .project_id("ipsum")
/// .node_pool_id("gubergren")
/// .cluster_id("Lorem")
/// .doit().await;
///
/// match result {
/// Err(e) => match e {
/// // The Error enum provides details about what exactly happened.
/// // You can also just use its `Debug`, `Display` or `Error` traits
/// Error::HttpError(_)
/// |Error::Io(_)
/// |Error::MissingAPIKey
/// |Error::MissingToken(_)
/// |Error::Cancelled
/// |Error::UploadSizeLimitExceeded(_, _)
/// |Error::Failure(_)
/// |Error::BadRequest(_)
/// |Error::FieldClash(_)
/// |Error::JsonDecodeError(_, _) => println!("{}", e),
/// },
/// Ok(res) => println!("Success: {:?}", res),
/// }
/// # }
/// ```
#[derive(Clone)]
pub struct Container<C> {
pub client: common::Client<C>,
pub auth: Box<dyn common::GetToken>,
_user_agent: String,
_base_url: String,
_root_url: String,
}
impl<C> common::Hub for Container<C> {}
impl<'a, C> Container<C> {
pub fn new<A: 'static + common::GetToken>(client: common::Client<C>, auth: A) -> Container<C> {
Container {
client,
auth: Box::new(auth),
_user_agent: "google-api-rust-client/7.0.0".to_string(),
_base_url: "https://container.googleapis.com/".to_string(),
_root_url: "https://container.googleapis.com/".to_string(),
}
}
pub fn projects(&'a self) -> ProjectMethods<'a, C> {
ProjectMethods { hub: self }
}
/// Set the user-agent header field to use in all requests to the server.
/// It defaults to `google-api-rust-client/7.0.0`.
///
/// Returns the previously set user-agent.
pub fn user_agent(&mut self, agent_name: String) -> String {
std::mem::replace(&mut self._user_agent, agent_name)
}
/// Set the base url to use in all requests to the server.
/// It defaults to `https://container.googleapis.com/`.
///
/// Returns the previously set base url.
pub fn base_url(&mut self, new_base_url: String) -> String {
std::mem::replace(&mut self._base_url, new_base_url)
}
/// Set the root url to use in all requests to the server.
/// It defaults to `https://container.googleapis.com/`.
///
/// Returns the previously set root url.
pub fn root_url(&mut self, new_root_url: String) -> String {
std::mem::replace(&mut self._root_url, new_root_url)
}
}
// ############
// SCHEMAS ###
// ##########
/// AcceleratorConfig represents a Hardware Accelerator request.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AcceleratorConfig {
/// The number of the accelerator cards exposed to an instance.
#[serde(rename = "acceleratorCount")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub accelerator_count: Option<i64>,
/// The accelerator type resource name. List of supported accelerators [here](https://cloud.google.com/compute/docs/gpus)
#[serde(rename = "acceleratorType")]
pub accelerator_type: Option<String>,
/// The configuration for auto installation of GPU driver.
#[serde(rename = "gpuDriverInstallationConfig")]
pub gpu_driver_installation_config: Option<GPUDriverInstallationConfig>,
/// 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).
#[serde(rename = "gpuPartitionSize")]
pub gpu_partition_size: Option<String>,
/// The configuration for GPU sharing options.
#[serde(rename = "gpuSharingConfig")]
pub gpu_sharing_config: Option<GPUSharingConfig>,
}
impl common::Part for AcceleratorConfig {}
/// AdditionalIPRangesConfig is the configuration for individual additional subnetwork attached to the cluster
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AdditionalIPRangesConfig {
/// 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
#[serde(rename = "podIpv4RangeNames")]
pub pod_ipv4_range_names: Option<Vec<String>>,
/// 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
pub subnetwork: Option<String>,
}
impl common::Part for AdditionalIPRangesConfig {}
/// AdditionalNodeNetworkConfig is the configuration for additional node networks within the NodeNetworkConfig message
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AdditionalNodeNetworkConfig {
/// Name of the VPC where the additional interface belongs
pub network: Option<String>,
/// Name of the subnetwork where the additional interface belongs
pub subnetwork: Option<String>,
}
impl common::Part for AdditionalNodeNetworkConfig {}
/// AdditionalPodNetworkConfig is the configuration for additional pod networks within the NodeNetworkConfig message
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AdditionalPodNetworkConfig {
/// The maximum number of pods per node which use this pod network.
#[serde(rename = "maxPodsPerNode")]
pub max_pods_per_node: Option<MaxPodsConstraint>,
/// The name of the network attachment for pods to communicate to; cannot be specified along with subnetwork or secondary_pod_range.
#[serde(rename = "networkAttachment")]
pub network_attachment: Option<String>,
/// The name of the secondary range on the subnet which provides IP address for this pod range.
#[serde(rename = "secondaryPodRange")]
pub secondary_pod_range: Option<String>,
/// Name of the subnetwork where the additional pod network belongs.
pub subnetwork: Option<String>,
}
impl common::Part for AdditionalPodNetworkConfig {}
/// AdditionalPodRangesConfig is the configuration for additional pod secondary ranges supporting the ClusterUpdate message.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AdditionalPodRangesConfig {
/// Output only. Information for additional pod range.
#[serde(rename = "podRangeInfo")]
pub pod_range_info: Option<Vec<RangeInfo>>,
/// Name for pod secondary ipv4 range which has the actual range defined ahead.
#[serde(rename = "podRangeNames")]
pub pod_range_names: Option<Vec<String>>,
}
impl common::Part for AdditionalPodRangesConfig {}
/// Configuration for the addons that can be automatically spun up in the cluster, enabling additional functionality.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AddonsConfig {
/// Configuration for the Cloud Run addon, which allows the user to use a managed Knative service.
#[serde(rename = "cloudRunConfig")]
pub cloud_run_config: Option<CloudRunConfig>,
/// Configuration for the ConfigConnector add-on, a Kubernetes extension to manage hosted Google Cloud services through the Kubernetes API.
#[serde(rename = "configConnectorConfig")]
pub config_connector_config: Option<ConfigConnectorConfig>,
/// Configuration for NodeLocalDNS, a dns cache running on cluster nodes
#[serde(rename = "dnsCacheConfig")]
pub dns_cache_config: Option<DnsCacheConfig>,
/// Configuration for the Compute Engine Persistent Disk CSI driver.
#[serde(rename = "gcePersistentDiskCsiDriverConfig")]
pub gce_persistent_disk_csi_driver_config: Option<GcePersistentDiskCsiDriverConfig>,
/// Configuration for the Filestore CSI driver.
#[serde(rename = "gcpFilestoreCsiDriverConfig")]
pub gcp_filestore_csi_driver_config: Option<GcpFilestoreCsiDriverConfig>,
/// Configuration for the Cloud Storage Fuse CSI driver.
#[serde(rename = "gcsFuseCsiDriverConfig")]
pub gcs_fuse_csi_driver_config: Option<GcsFuseCsiDriverConfig>,
/// Configuration for the Backup for GKE agent addon.
#[serde(rename = "gkeBackupAgentConfig")]
pub gke_backup_agent_config: Option<GkeBackupAgentConfig>,
/// Configuration for the High Scale Checkpointing add-on.
#[serde(rename = "highScaleCheckpointingConfig")]
pub high_scale_checkpointing_config: Option<HighScaleCheckpointingConfig>,
/// 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.
#[serde(rename = "horizontalPodAutoscaling")]
pub horizontal_pod_autoscaling: Option<HorizontalPodAutoscaling>,
/// Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.
#[serde(rename = "httpLoadBalancing")]
pub http_load_balancing: Option<HttpLoadBalancing>,
/// 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
#[serde(rename = "kubernetesDashboard")]
pub kubernetes_dashboard: Option<KubernetesDashboard>,
/// Configuration for the Lustre CSI driver.
#[serde(rename = "lustreCsiDriverConfig")]
pub lustre_csi_driver_config: Option<LustreCsiDriverConfig>,
/// 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.
#[serde(rename = "networkPolicyConfig")]
pub network_policy_config: Option<NetworkPolicyConfig>,
/// Configuration for the Cloud Storage Parallelstore CSI driver.
#[serde(rename = "parallelstoreCsiDriverConfig")]
pub parallelstore_csi_driver_config: Option<ParallelstoreCsiDriverConfig>,
/// Optional. Configuration for Ray Operator addon.
#[serde(rename = "rayOperatorConfig")]
pub ray_operator_config: Option<RayOperatorConfig>,
/// Optional. Configuration for the StatefulHA add-on.
#[serde(rename = "statefulHaConfig")]
pub stateful_ha_config: Option<StatefulHAConfig>,
}
impl common::Part for AddonsConfig {}
/// AdvancedDatapathObservabilityConfig specifies configuration of observability features of advanced datapath.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AdvancedDatapathObservabilityConfig {
/// Expose flow metrics on nodes
#[serde(rename = "enableMetrics")]
pub enable_metrics: Option<bool>,
/// Enable Relay component
#[serde(rename = "enableRelay")]
pub enable_relay: Option<bool>,
/// Method used to make Relay available
#[serde(rename = "relayMode")]
pub relay_mode: Option<String>,
}
impl common::Part for AdvancedDatapathObservabilityConfig {}
/// Specifies options for controlling advanced machine features.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AdvancedMachineFeatures {
/// Whether or not to enable nested virtualization (defaults to false).
#[serde(rename = "enableNestedVirtualization")]
pub enable_nested_virtualization: Option<bool>,
/// Type of Performance Monitoring Unit (PMU) requested on node pool instances. If unset, PMU will not be available to the node.
#[serde(rename = "performanceMonitoringUnit")]
pub performance_monitoring_unit: Option<String>,
/// 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.
#[serde(rename = "threadsPerCore")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub threads_per_core: Option<i64>,
}
impl common::Part for AdvancedMachineFeatures {}
/// AnonymousAuthenticationConfig defines the settings needed to limit endpoints that allow anonymous authentication.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AnonymousAuthenticationConfig {
/// Defines the mode of limiting anonymous access in the cluster.
pub mode: Option<String>,
}
impl common::Part for AnonymousAuthenticationConfig {}
/// Configuration for returning group information from authenticators.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AuthenticatorGroupsConfig {
/// Whether this cluster should return group membership lookups during authentication using a group of security groups.
pub enabled: Option<bool>,
/// The name of the security group-of-groups to be used. Only relevant if enabled = true.
#[serde(rename = "securityGroup")]
pub security_group: Option<String>,
}
impl common::Part for AuthenticatorGroupsConfig {}
/// AutoIpamConfig contains all information related to Auto IPAM
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AutoIpamConfig {
/// The flag that enables Auto IPAM on this cluster
pub enabled: Option<bool>,
}
impl common::Part for AutoIpamConfig {}
/// AutoMonitoringConfig defines the configuration for GKE Workload Auto-Monitoring.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AutoMonitoringConfig {
/// Scope for GKE Workload Auto-Monitoring.
pub scope: Option<String>,
}
impl common::Part for AutoMonitoringConfig {}
/// AutoUpgradeOptions defines the set of options for the user to control how the Auto Upgrades will proceed.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AutoUpgradeOptions {
/// 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.
#[serde(rename = "autoUpgradeStartTime")]
pub auto_upgrade_start_time: Option<String>,
/// Output only. This field is set when upgrades are about to commence with the description of the upgrade.
pub description: Option<String>,
}
impl common::Part for AutoUpgradeOptions {}
/// Autopilot is the configuration for Autopilot settings on the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Autopilot {
/// Enable Autopilot
pub enabled: Option<bool>,
/// PrivilegedAdmissionConfig is the configuration related to privileged admission control.
#[serde(rename = "privilegedAdmissionConfig")]
pub privileged_admission_config: Option<PrivilegedAdmissionConfig>,
/// WorkloadPolicyConfig is the configuration related to GCW workload policy
#[serde(rename = "workloadPolicyConfig")]
pub workload_policy_config: Option<WorkloadPolicyConfig>,
}
impl common::Part for Autopilot {}
/// AutopilotCompatibilityIssue contains information about a specific compatibility issue with Autopilot mode.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AutopilotCompatibilityIssue {
/// The constraint type of the issue.
#[serde(rename = "constraintType")]
pub constraint_type: Option<String>,
/// The description of the issue.
pub description: Option<String>,
/// A URL to a public documentation, which addresses resolving this issue.
#[serde(rename = "documentationUrl")]
pub documentation_url: Option<String>,
/// The incompatibility type of this issue.
#[serde(rename = "incompatibilityType")]
pub incompatibility_type: Option<String>,
/// The last time when this issue was observed.
#[serde(rename = "lastObservation")]
pub last_observation: Option<chrono::DateTime<chrono::offset::Utc>>,
/// The name of the resources which are subject to this issue.
pub subjects: Option<Vec<String>>,
}
impl common::Part for AutopilotCompatibilityIssue {}
/// AutopilotConfig contains configuration of autopilot feature for this nodepool.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AutopilotConfig {
/// Denotes that nodes belonging to this node pool are Autopilot nodes.
pub enabled: Option<bool>,
}
impl common::Part for AutopilotConfig {}
/// AutoprovisioningNodePoolDefaults contains defaults for a node pool created by NAP.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AutoprovisioningNodePoolDefaults {
/// 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
#[serde(rename = "bootDiskKmsKey")]
pub boot_disk_kms_key: Option<String>,
/// 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.
#[serde(rename = "diskSizeGb")]
pub disk_size_gb: Option<i32>,
/// 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'
#[serde(rename = "diskType")]
pub disk_type: Option<String>,
/// 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.
#[serde(rename = "imageType")]
pub image_type: Option<String>,
/// DEPRECATED. Use NodePoolAutoConfig.NodeKubeletConfig instead.
#[serde(rename = "insecureKubeletReadonlyPortEnabled")]
pub insecure_kubelet_readonly_port_enabled: Option<bool>,
/// Specifies the node management options for NAP created node-pools.
pub management: Option<NodeManagement>,
/// 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.
#[serde(rename = "minCpuPlatform")]
pub min_cpu_platform: Option<String>,
/// Scopes that are used by NAP when creating node pools.
#[serde(rename = "oauthScopes")]
pub oauth_scopes: Option<Vec<String>>,
/// The Google Cloud Platform Service Account to be used by the node VMs.
#[serde(rename = "serviceAccount")]
pub service_account: Option<String>,
/// Shielded Instance options.
#[serde(rename = "shieldedInstanceConfig")]
pub shielded_instance_config: Option<ShieldedInstanceConfig>,
/// Specifies the upgrade settings for NAP created node pools
#[serde(rename = "upgradeSettings")]
pub upgrade_settings: Option<UpgradeSettings>,
}
impl common::Part for AutoprovisioningNodePoolDefaults {}
/// Autoscaled rollout policy utilizes the cluster autoscaler during blue-green upgrade to scale both the blue and green pools.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct AutoscaledRolloutPolicy {
/// 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.
#[serde(rename = "waitForDrainDuration")]
#[serde_as(as = "Option<common::serde::duration::Wrapper>")]
pub wait_for_drain_duration: Option<chrono::Duration>,
}
impl common::Part for AutoscaledRolloutPolicy {}
/// Best effort provisioning.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct BestEffortProvisioning {
/// 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
pub enabled: Option<bool>,
/// 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.
#[serde(rename = "minProvisionNodes")]
pub min_provision_nodes: Option<i32>,
}
impl common::Part for BestEffortProvisioning {}
/// Parameters for using BigQuery as the destination of resource usage export.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct BigQueryDestination {
/// The ID of a BigQuery Dataset.
#[serde(rename = "datasetId")]
pub dataset_id: Option<String>,
}
impl common::Part for BigQueryDestination {}
/// Configuration for Binary Authorization.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct BinaryAuthorization {
/// 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.
pub enabled: Option<bool>,
/// Mode of operation for binauthz policy evaluation. If unspecified, defaults to DISABLED.
#[serde(rename = "evaluationMode")]
pub evaluation_mode: Option<String>,
}
impl common::Part for BinaryAuthorization {}
/// Information relevant to blue-green upgrade.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct BlueGreenInfo {
/// The resource URLs of the \[managed instance groups\] (/compute/docs/instance-groups/creating-groups-of-managed-instances) associated with blue pool.
#[serde(rename = "blueInstanceGroupUrls")]
pub blue_instance_group_urls: Option<Vec<String>>,
/// Time to start deleting blue pool to complete blue-green upgrade, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
#[serde(rename = "bluePoolDeletionStartTime")]
pub blue_pool_deletion_start_time: Option<String>,
/// The resource URLs of the \[managed instance groups\] (/compute/docs/instance-groups/creating-groups-of-managed-instances) associated with green pool.
#[serde(rename = "greenInstanceGroupUrls")]
pub green_instance_group_urls: Option<Vec<String>>,
/// Version of green pool.
#[serde(rename = "greenPoolVersion")]
pub green_pool_version: Option<String>,
/// Current blue-green upgrade phase.
pub phase: Option<String>,
}
impl common::Part for BlueGreenInfo {}
/// Settings for blue-green upgrade.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct BlueGreenSettings {
/// Autoscaled policy for cluster autoscaler enabled blue-green upgrade.
#[serde(rename = "autoscaledRolloutPolicy")]
pub autoscaled_rollout_policy: Option<AutoscaledRolloutPolicy>,
/// Time needed after draining entire blue pool. After this period, blue pool will be cleaned up.
#[serde(rename = "nodePoolSoakDuration")]
#[serde_as(as = "Option<common::serde::duration::Wrapper>")]
pub node_pool_soak_duration: Option<chrono::Duration>,
/// Standard policy for the blue-green upgrade.
#[serde(rename = "standardRolloutPolicy")]
pub standard_rollout_policy: Option<StandardRolloutPolicy>,
}
impl common::Part for BlueGreenSettings {}
/// BootDisk specifies the boot disk configuration for nodepools.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct BootDisk {
/// Disk type of the boot disk. (i.e. Hyperdisk-Balanced, PD-Balanced, etc.)
#[serde(rename = "diskType")]
pub disk_type: Option<String>,
/// For Hyperdisk-Balanced only, the provisioned IOPS config value.
#[serde(rename = "provisionedIops")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub provisioned_iops: Option<i64>,
/// For Hyperdisk-Balanced only, the provisioned throughput config value.
#[serde(rename = "provisionedThroughput")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub provisioned_throughput: Option<i64>,
/// Disk size in GB. Replaces NodeConfig.disk_size_gb
#[serde(rename = "sizeGb")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub size_gb: Option<i64>,
}
impl common::Part for BootDisk {}
/// CancelOperationRequest cancels a single operation.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (request)
/// * [zones operations cancel projects](ProjectZoneOperationCancelCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CancelOperationRequest {
/// The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
pub name: Option<String>,
/// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
#[serde(rename = "operationId")]
pub operation_id: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for CancelOperationRequest {}
/// CertificateAuthorityDomainConfig configures one or more fully qualified domain names (FQDN) to a specific certificate.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CertificateAuthorityDomainConfig {
/// List of fully qualified domain names (FQDN). Specifying port is supported. Wildcards are NOT supported. Examples: - my.customdomain.com - 10.0.1.2:5000
pub fqdns: Option<Vec<String>>,
/// Secret Manager certificate configuration.
#[serde(rename = "gcpSecretManagerCertificateConfig")]
pub gcp_secret_manager_certificate_config: Option<GCPSecretManagerCertificateConfig>,
}
impl common::Part for CertificateAuthorityDomainConfig {}
/// CertificateConfig configures certificate for the registry.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CertificateConfig {
/// 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"
#[serde(rename = "gcpSecretManagerSecretUri")]
pub gcp_secret_manager_secret_uri: Option<String>,
}
impl common::Part for CertificateConfig {}
/// CertificateConfigPair configures pairs of certificates, which is used for client certificate and key pairs under a registry.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CertificateConfigPair {
/// Cert configures the client certificate.
pub cert: Option<CertificateConfig>,
/// Key configures the client private key. Optional.
pub key: Option<CertificateConfig>,
}
impl common::Part for CertificateConfigPair {}
/// CheckAutopilotCompatibilityResponse has a list of compatibility issues.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters check autopilot compatibility projects](ProjectLocationClusterCheckAutopilotCompatibilityCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CheckAutopilotCompatibilityResponse {
/// The list of issues for the given operation.
pub issues: Option<Vec<AutopilotCompatibilityIssue>>,
/// The summary of the autopilot compatibility response.
pub summary: Option<String>,
}
impl common::ResponseResult for CheckAutopilotCompatibilityResponse {}
/// CidrBlock contains an optional name and one CIDR block.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CidrBlock {
/// cidr_block must be specified in CIDR notation.
#[serde(rename = "cidrBlock")]
pub cidr_block: Option<String>,
/// display_name is an optional field for users to identify CIDR blocks.
#[serde(rename = "displayName")]
pub display_name: Option<String>,
}
impl common::Part for CidrBlock {}
/// Configuration for client certificates on the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ClientCertificateConfig {
/// Issue a client certificate.
#[serde(rename = "issueClientCertificate")]
pub issue_client_certificate: Option<bool>,
}
impl common::Part for ClientCertificateConfig {}
/// Configuration options for the Cloud Run feature.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CloudRunConfig {
/// Whether Cloud Run addon is enabled for this cluster.
pub disabled: Option<bool>,
/// Which load balancer type is installed for Cloud Run.
#[serde(rename = "loadBalancerType")]
pub load_balancer_type: Option<String>,
}
impl common::Part for CloudRunConfig {}
/// A Google Kubernetes Engine cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters get projects](ProjectLocationClusterGetCall) (response)
/// * [zones clusters get projects](ProjectZoneClusterGetCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Cluster {
/// Configurations for the various addons available to run in the cluster.
#[serde(rename = "addonsConfig")]
pub addons_config: Option<AddonsConfig>,
/// 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")
#[serde(rename = "alphaClusterFeatureGates")]
pub alpha_cluster_feature_gates: Option<Vec<String>>,
/// Configuration for limiting anonymous access to all endpoints except the health checks.
#[serde(rename = "anonymousAuthenticationConfig")]
pub anonymous_authentication_config: Option<AnonymousAuthenticationConfig>,
/// Configuration controlling RBAC group membership information.
#[serde(rename = "authenticatorGroupsConfig")]
pub authenticator_groups_config: Option<AuthenticatorGroupsConfig>,
/// Autopilot configuration for the cluster.
pub autopilot: Option<Autopilot>,
/// Cluster-level autoscaling configuration.
pub autoscaling: Option<ClusterAutoscaling>,
/// Configuration for Binary Authorization.
#[serde(rename = "binaryAuthorization")]
pub binary_authorization: Option<BinaryAuthorization>,
/// 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`.
#[serde(rename = "clusterIpv4Cidr")]
pub cluster_ipv4_cidr: Option<String>,
/// Enable/Disable Compliance Posture features for the cluster.
#[serde(rename = "compliancePostureConfig")]
pub compliance_posture_config: Option<CompliancePostureConfig>,
/// Which conditions caused the current cluster state.
pub conditions: Option<Vec<StatusCondition>>,
/// Configuration of Confidential Nodes. All the nodes in the cluster will be Confidential VM once enabled.
#[serde(rename = "confidentialNodes")]
pub confidential_nodes: Option<ConfidentialNodes>,
/// Configuration for all cluster's control plane endpoints.
#[serde(rename = "controlPlaneEndpointsConfig")]
pub control_plane_endpoints_config: Option<ControlPlaneEndpointsConfig>,
/// Configuration for the fine-grained cost management feature.
#[serde(rename = "costManagementConfig")]
pub cost_management_config: Option<CostManagementConfig>,
/// Output only. The time the cluster was created, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
#[serde(rename = "createTime")]
pub create_time: Option<String>,
/// Output only. The current software version of the master endpoint.
#[serde(rename = "currentMasterVersion")]
pub current_master_version: Option<String>,
/// Output only. The number of nodes currently in the cluster. Deprecated. Call Kubernetes API directly to retrieve node information.
#[serde(rename = "currentNodeCount")]
pub current_node_count: Option<i32>,
/// 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.
#[serde(rename = "currentNodeVersion")]
pub current_node_version: Option<String>,
/// Configuration of etcd encryption.
#[serde(rename = "databaseEncryption")]
pub database_encryption: Option<DatabaseEncryption>,
/// 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.
#[serde(rename = "defaultMaxPodsConstraint")]
pub default_max_pods_constraint: Option<MaxPodsConstraint>,
/// An optional description of this cluster.
pub description: Option<String>,
/// Beta APIs Config
#[serde(rename = "enableK8sBetaApis")]
pub enable_k8s_beta_apis: Option<K8sBetaAPIConfig>,
/// 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.
#[serde(rename = "enableKubernetesAlpha")]
pub enable_kubernetes_alpha: Option<bool>,
/// 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.
#[serde(rename = "enableTpu")]
pub enable_tpu: Option<bool>,
/// 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.
pub endpoint: Option<String>,
/// GKE Enterprise Configuration. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
#[serde(rename = "enterpriseConfig")]
pub enterprise_config: Option<EnterpriseConfig>,
/// 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.
pub etag: Option<String>,
/// Output only. The time the cluster will be automatically deleted in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
#[serde(rename = "expireTime")]
pub expire_time: Option<String>,
/// Fleet information for the cluster.
pub fleet: Option<Fleet>,
/// Configuration for GKE auto upgrades.
#[serde(rename = "gkeAutoUpgradeConfig")]
pub gke_auto_upgrade_config: Option<GkeAutoUpgradeConfig>,
/// Output only. Unique id for the cluster.
pub id: Option<String>,
/// Configuration for Identity Service component.
#[serde(rename = "identityServiceConfig")]
pub identity_service_config: Option<IdentityServiceConfig>,
/// 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
#[serde(rename = "initialClusterVersion")]
pub initial_cluster_version: Option<String>,
/// 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.
#[serde(rename = "initialNodeCount")]
pub initial_node_count: Option<i32>,
/// Output only. Deprecated. Use node_pools.instance_group_urls.
#[serde(rename = "instanceGroupUrls")]
pub instance_group_urls: Option<Vec<String>>,
/// Configuration for cluster IP allocation.
#[serde(rename = "ipAllocationPolicy")]
pub ip_allocation_policy: Option<IPAllocationPolicy>,
/// The fingerprint of the set of labels for this cluster.
#[serde(rename = "labelFingerprint")]
pub label_fingerprint: Option<String>,
/// Configuration for the legacy ABAC authorization mode.
#[serde(rename = "legacyAbac")]
pub legacy_abac: Option<LegacyAbac>,
/// 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.
pub location: Option<String>,
/// 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.
pub locations: Option<Vec<String>>,
/// Logging configuration for the cluster.
#[serde(rename = "loggingConfig")]
pub logging_config: Option<LoggingConfig>,
/// 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.
#[serde(rename = "loggingService")]
pub logging_service: Option<String>,
/// Configure the maintenance policy for this cluster.
#[serde(rename = "maintenancePolicy")]
pub maintenance_policy: Option<MaintenancePolicy>,
/// Configuration for Managed OpenTelemetry pipeline.
#[serde(rename = "managedOpentelemetryConfig")]
pub managed_opentelemetry_config: Option<ManagedOpenTelemetryConfig>,
/// 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.
#[serde(rename = "masterAuth")]
pub master_auth: Option<MasterAuth>,
/// The configuration options for master authorized networks feature. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.authorized_networks_config instead.
#[serde(rename = "masterAuthorizedNetworksConfig")]
pub master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
/// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
#[serde(rename = "meshCertificates")]
pub mesh_certificates: Option<MeshCertificates>,
/// Monitoring configuration for the cluster.
#[serde(rename = "monitoringConfig")]
pub monitoring_config: Option<MonitoringConfig>,
/// 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.
#[serde(rename = "monitoringService")]
pub monitoring_service: Option<String>,
/// 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.
pub name: Option<String>,
/// 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.
pub network: Option<String>,
/// Configuration for cluster networking.
#[serde(rename = "networkConfig")]
pub network_config: Option<NetworkConfig>,
/// Configuration options for the NetworkPolicy feature.
#[serde(rename = "networkPolicy")]
pub network_policy: Option<NetworkPolicy>,
/// 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.
#[serde(rename = "nodeConfig")]
pub node_config: Option<NodeConfig>,
/// 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.
#[serde(rename = "nodeIpv4CidrSize")]
pub node_ipv4_cidr_size: Option<i32>,
/// Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
#[serde(rename = "nodePoolAutoConfig")]
pub node_pool_auto_config: Option<NodePoolAutoConfig>,
/// Default NodePool settings for the entire cluster. These settings are overridden if specified on the specific NodePool object.
#[serde(rename = "nodePoolDefaults")]
pub node_pool_defaults: Option<NodePoolDefaults>,
/// The node pools associated with this cluster. This field should not be set if "node_config" or "initial_node_count" are specified.
#[serde(rename = "nodePools")]
pub node_pools: Option<Vec<NodePool>>,
/// Notification configuration of the cluster.
#[serde(rename = "notificationConfig")]
pub notification_config: Option<NotificationConfig>,
/// 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.
#[serde(rename = "parentProductConfig")]
pub parent_product_config: Option<ParentProductConfig>,
/// The config for pod autoscaling.
#[serde(rename = "podAutoscaling")]
pub pod_autoscaling: Option<PodAutoscaling>,
/// Configuration for private cluster.
#[serde(rename = "privateClusterConfig")]
pub private_cluster_config: Option<PrivateClusterConfig>,
/// RBACBindingConfig allows user to restrict ClusterRoleBindings an RoleBindings that can be created.
#[serde(rename = "rbacBindingConfig")]
pub rbac_binding_config: Option<RBACBindingConfig>,
/// 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.
#[serde(rename = "releaseChannel")]
pub release_channel: Option<ReleaseChannel>,
/// The resource labels for the cluster to use to annotate any related Google Compute Engine resources.
#[serde(rename = "resourceLabels")]
pub resource_labels: Option<HashMap<String, String>>,
/// Configuration for exporting resource usages. Resource usage export is disabled when this config is unspecified.
#[serde(rename = "resourceUsageExportConfig")]
pub resource_usage_export_config: Option<ResourceUsageExportConfig>,
/// Output only. Reserved for future use.
#[serde(rename = "satisfiesPzi")]
pub satisfies_pzi: Option<bool>,
/// Output only. Reserved for future use.
#[serde(rename = "satisfiesPzs")]
pub satisfies_pzs: Option<bool>,
/// Secret CSI driver configuration.
#[serde(rename = "secretManagerConfig")]
pub secret_manager_config: Option<SecretManagerConfig>,
/// Enable/Disable Security Posture API features for the cluster.
#[serde(rename = "securityPostureConfig")]
pub security_posture_config: Option<SecurityPostureConfig>,
/// Output only. Server-defined URL for the resource.
#[serde(rename = "selfLink")]
pub self_link: Option<String>,
/// 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.
#[serde(rename = "servicesIpv4Cidr")]
pub services_ipv4_cidr: Option<String>,
/// Shielded Nodes configuration.
#[serde(rename = "shieldedNodes")]
pub shielded_nodes: Option<ShieldedNodes>,
/// Output only. The current status of this cluster.
pub status: Option<String>,
/// Output only. Deprecated. Use conditions instead. Additional information about the current status of this cluster, if available.
#[serde(rename = "statusMessage")]
pub status_message: Option<String>,
/// The name of the Google Compute Engine [subnetwork](https://cloud.google.com/compute/docs/subnetworks) to which the cluster is connected.
pub subnetwork: Option<String>,
/// 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.
#[serde(rename = "tpuIpv4CidrBlock")]
pub tpu_ipv4_cidr_block: Option<String>,
/// The Custom keys configuration for the cluster.
#[serde(rename = "userManagedKeysConfig")]
pub user_managed_keys_config: Option<UserManagedKeysConfig>,
/// Cluster-level Vertical Pod Autoscaling configuration.
#[serde(rename = "verticalPodAutoscaling")]
pub vertical_pod_autoscaling: Option<VerticalPodAutoscaling>,
/// Configuration for the use of Kubernetes Service Accounts in IAM policies.
#[serde(rename = "workloadIdentityConfig")]
pub workload_identity_config: Option<WorkloadIdentityConfig>,
/// 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.
pub zone: Option<String>,
}
impl common::ResponseResult for Cluster {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ClusterAutoscaling {
/// 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.
#[serde(rename = "autoprovisioningLocations")]
pub autoprovisioning_locations: Option<Vec<String>>,
/// AutoprovisioningNodePoolDefaults contains defaults for a node pool created by NAP.
#[serde(rename = "autoprovisioningNodePoolDefaults")]
pub autoprovisioning_node_pool_defaults: Option<AutoprovisioningNodePoolDefaults>,
/// Defines autoscaling behaviour.
#[serde(rename = "autoscalingProfile")]
pub autoscaling_profile: Option<String>,
/// Default compute class is a configuration for default compute class.
#[serde(rename = "defaultComputeClassConfig")]
pub default_compute_class_config: Option<DefaultComputeClassConfig>,
/// Enables automatic node pool creation and deletion.
#[serde(rename = "enableNodeAutoprovisioning")]
pub enable_node_autoprovisioning: Option<bool>,
/// Contains global constraints regarding minimum and maximum amount of resources in the cluster.
#[serde(rename = "resourceLimits")]
pub resource_limits: Option<Vec<ResourceLimit>>,
}
impl common::Part for ClusterAutoscaling {}
/// Configuration of network bandwidth tiers
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ClusterNetworkPerformanceConfig {
/// Specifies the total network bandwidth tier for NodePools in the cluster.
#[serde(rename = "totalEgressBandwidthTier")]
pub total_egress_bandwidth_tier: Option<String>,
}
impl common::Part for ClusterNetworkPerformanceConfig {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ClusterUpdate {
/// The additional pod ranges to be added to the cluster. These pod ranges can be used by node pools to allocate pod IPs.
#[serde(rename = "additionalPodRangesConfig")]
pub additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
/// The desired config for additional subnetworks attached to the cluster.
#[serde(rename = "desiredAdditionalIpRangesConfig")]
pub desired_additional_ip_ranges_config: Option<DesiredAdditionalIPRangesConfig>,
/// Configurations for the various addons available to run in the cluster.
#[serde(rename = "desiredAddonsConfig")]
pub desired_addons_config: Option<AddonsConfig>,
/// Configuration for limiting anonymous access to all endpoints except the health checks.
#[serde(rename = "desiredAnonymousAuthenticationConfig")]
pub desired_anonymous_authentication_config: Option<AnonymousAuthenticationConfig>,
/// The desired authenticator groups config for the cluster.
#[serde(rename = "desiredAuthenticatorGroupsConfig")]
pub desired_authenticator_groups_config: Option<AuthenticatorGroupsConfig>,
/// AutoIpamConfig contains all information related to Auto IPAM
#[serde(rename = "desiredAutoIpamConfig")]
pub desired_auto_ipam_config: Option<AutoIpamConfig>,
/// WorkloadPolicyConfig is the configuration related to GCW workload policy
#[serde(rename = "desiredAutopilotWorkloadPolicyConfig")]
pub desired_autopilot_workload_policy_config: Option<WorkloadPolicyConfig>,
/// The desired configuration options for the Binary Authorization feature.
#[serde(rename = "desiredBinaryAuthorization")]
pub desired_binary_authorization: Option<BinaryAuthorization>,
/// Cluster-level autoscaling configuration.
#[serde(rename = "desiredClusterAutoscaling")]
pub desired_cluster_autoscaling: Option<ClusterAutoscaling>,
/// Enable/Disable Compliance Posture features for the cluster.
#[serde(rename = "desiredCompliancePostureConfig")]
pub desired_compliance_posture_config: Option<CompliancePostureConfig>,
/// The desired containerd config for the cluster.
#[serde(rename = "desiredContainerdConfig")]
pub desired_containerd_config: Option<ContainerdConfig>,
/// Control plane endpoints configuration.
#[serde(rename = "desiredControlPlaneEndpointsConfig")]
pub desired_control_plane_endpoints_config: Option<ControlPlaneEndpointsConfig>,
/// The desired configuration for the fine-grained cost management feature.
#[serde(rename = "desiredCostManagementConfig")]
pub desired_cost_management_config: Option<CostManagementConfig>,
/// Configuration of etcd encryption.
#[serde(rename = "desiredDatabaseEncryption")]
pub desired_database_encryption: Option<DatabaseEncryption>,
/// The desired datapath provider for the cluster.
#[serde(rename = "desiredDatapathProvider")]
pub desired_datapath_provider: Option<String>,
/// Override the default setting of whether future created nodes have private IP addresses only, namely NetworkConfig.default_enable_private_nodes
#[serde(rename = "desiredDefaultEnablePrivateNodes")]
pub desired_default_enable_private_nodes: Option<bool>,
/// The desired status of whether to disable default sNAT for this cluster.
#[serde(rename = "desiredDefaultSnatStatus")]
pub desired_default_snat_status: Option<DefaultSnatStatus>,
/// Enable/Disable L4 LB VPC firewall reconciliation for the cluster.
#[serde(rename = "desiredDisableL4LbFirewallReconciliation")]
pub desired_disable_l4_lb_firewall_reconciliation: Option<bool>,
/// DNSConfig contains clusterDNS config for this cluster.
#[serde(rename = "desiredDnsConfig")]
pub desired_dns_config: Option<DNSConfig>,
/// Enable/Disable Cilium Clusterwide Network Policy for the cluster.
#[serde(rename = "desiredEnableCiliumClusterwideNetworkPolicy")]
pub desired_enable_cilium_clusterwide_network_policy: Option<bool>,
/// Enable/Disable FQDN Network Policy for the cluster.
#[serde(rename = "desiredEnableFqdnNetworkPolicy")]
pub desired_enable_fqdn_network_policy: Option<bool>,
/// Enable/Disable Multi-Networking for the cluster
#[serde(rename = "desiredEnableMultiNetworking")]
pub desired_enable_multi_networking: Option<bool>,
/// 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.
#[serde(rename = "desiredEnablePrivateEndpoint")]
pub desired_enable_private_endpoint: Option<bool>,
/// The desired enterprise configuration for the cluster. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
#[serde(rename = "desiredEnterpriseConfig")]
pub desired_enterprise_config: Option<DesiredEnterpriseConfig>,
/// The desired fleet configuration for the cluster.
#[serde(rename = "desiredFleet")]
pub desired_fleet: Option<Fleet>,
/// The desired config of Gateway API on this cluster.
#[serde(rename = "desiredGatewayApiConfig")]
pub desired_gateway_api_config: Option<GatewayAPIConfig>,
/// The desired GCFS config for the cluster
#[serde(rename = "desiredGcfsConfig")]
pub desired_gcfs_config: Option<GcfsConfig>,
/// The desired Identity Service component configuration.
#[serde(rename = "desiredIdentityServiceConfig")]
pub desired_identity_service_config: Option<IdentityServiceConfig>,
/// The desired image type for the node pool. NOTE: Set the "desired_node_pool" field as well.
#[serde(rename = "desiredImageType")]
pub desired_image_type: Option<String>,
/// Specify the details of in-transit encryption.
#[serde(rename = "desiredInTransitEncryptionConfig")]
pub desired_in_transit_encryption_config: Option<String>,
/// The desired config of Intra-node visibility.
#[serde(rename = "desiredIntraNodeVisibilityConfig")]
pub desired_intra_node_visibility_config: Option<IntraNodeVisibilityConfig>,
/// Desired Beta APIs to be enabled for cluster.
#[serde(rename = "desiredK8sBetaApis")]
pub desired_k8s_beta_apis: Option<K8sBetaAPIConfig>,
/// The desired L4 Internal Load Balancer Subsetting configuration.
#[serde(rename = "desiredL4ilbSubsettingConfig")]
pub desired_l4ilb_subsetting_config: Option<ILBSubsettingConfig>,
/// 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.
#[serde(rename = "desiredLocations")]
pub desired_locations: Option<Vec<String>>,
/// The desired logging configuration.
#[serde(rename = "desiredLoggingConfig")]
pub desired_logging_config: Option<LoggingConfig>,
/// 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.
#[serde(rename = "desiredLoggingService")]
pub desired_logging_service: Option<String>,
/// The desired managed open telemetry configuration.
#[serde(rename = "desiredManagedOpentelemetryConfig")]
pub desired_managed_opentelemetry_config: Option<ManagedOpenTelemetryConfig>,
/// The desired configuration options for master authorized networks feature. Deprecated: Use desired_control_plane_endpoints_config.ip_endpoints_config.authorized_networks_config instead.
#[serde(rename = "desiredMasterAuthorizedNetworksConfig")]
pub desired_master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
/// 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
#[serde(rename = "desiredMasterVersion")]
pub desired_master_version: Option<String>,
/// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
#[serde(rename = "desiredMeshCertificates")]
pub desired_mesh_certificates: Option<MeshCertificates>,
/// The desired monitoring configuration.
#[serde(rename = "desiredMonitoringConfig")]
pub desired_monitoring_config: Option<MonitoringConfig>,
/// 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.
#[serde(rename = "desiredMonitoringService")]
pub desired_monitoring_service: Option<String>,
/// The desired network performance config.
#[serde(rename = "desiredNetworkPerformanceConfig")]
pub desired_network_performance_config: Option<ClusterNetworkPerformanceConfig>,
/// The desired network tier configuration for the cluster.
#[serde(rename = "desiredNetworkTierConfig")]
pub desired_network_tier_config: Option<NetworkTierConfig>,
/// The desired node kubelet config for the cluster.
#[serde(rename = "desiredNodeKubeletConfig")]
pub desired_node_kubelet_config: Option<NodeKubeletConfig>,
/// The desired node kubelet config for all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
#[serde(rename = "desiredNodePoolAutoConfigKubeletConfig")]
pub desired_node_pool_auto_config_kubelet_config: Option<NodeKubeletConfig>,
/// 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.
#[serde(rename = "desiredNodePoolAutoConfigLinuxNodeConfig")]
pub desired_node_pool_auto_config_linux_node_config: Option<LinuxNodeConfig>,
/// The desired network tags that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
#[serde(rename = "desiredNodePoolAutoConfigNetworkTags")]
pub desired_node_pool_auto_config_network_tags: Option<NetworkTags>,
/// The desired resource manager tags that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
#[serde(rename = "desiredNodePoolAutoConfigResourceManagerTags")]
pub desired_node_pool_auto_config_resource_manager_tags: Option<ResourceManagerTags>,
/// 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.
#[serde(rename = "desiredNodePoolAutoscaling")]
pub desired_node_pool_autoscaling: Option<NodePoolAutoscaling>,
/// 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.
#[serde(rename = "desiredNodePoolId")]
pub desired_node_pool_id: Option<String>,
/// The desired node pool logging configuration defaults for the cluster.
#[serde(rename = "desiredNodePoolLoggingConfig")]
pub desired_node_pool_logging_config: Option<NodePoolLoggingConfig>,
/// 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
#[serde(rename = "desiredNodeVersion")]
pub desired_node_version: Option<String>,
/// The desired notification configuration.
#[serde(rename = "desiredNotificationConfig")]
pub desired_notification_config: Option<NotificationConfig>,
/// The desired parent product config for the cluster.
#[serde(rename = "desiredParentProductConfig")]
pub desired_parent_product_config: Option<ParentProductConfig>,
/// The desired config for pod autoscaling.
#[serde(rename = "desiredPodAutoscaling")]
pub desired_pod_autoscaling: Option<PodAutoscaling>,
/// 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.
#[serde(rename = "desiredPrivateClusterConfig")]
pub desired_private_cluster_config: Option<PrivateClusterConfig>,
/// The desired state of IPv6 connectivity to Google Services.
#[serde(rename = "desiredPrivateIpv6GoogleAccess")]
pub desired_private_ipv6_google_access: Option<String>,
/// The desired privileged admission config for the cluster.
#[serde(rename = "desiredPrivilegedAdmissionConfig")]
pub desired_privileged_admission_config: Option<PrivilegedAdmissionConfig>,
/// RBACBindingConfig allows user to restrict ClusterRoleBindings an RoleBindings that can be created.
#[serde(rename = "desiredRbacBindingConfig")]
pub desired_rbac_binding_config: Option<RBACBindingConfig>,
/// The desired release channel configuration.
#[serde(rename = "desiredReleaseChannel")]
pub desired_release_channel: Option<ReleaseChannel>,
/// The desired configuration for exporting resource usage.
#[serde(rename = "desiredResourceUsageExportConfig")]
pub desired_resource_usage_export_config: Option<ResourceUsageExportConfig>,
/// Enable/Disable Secret Manager Config.
#[serde(rename = "desiredSecretManagerConfig")]
pub desired_secret_manager_config: Option<SecretManagerConfig>,
/// Enable/Disable Security Posture API features for the cluster.
#[serde(rename = "desiredSecurityPostureConfig")]
pub desired_security_posture_config: Option<SecurityPostureConfig>,
/// ServiceExternalIPsConfig specifies the config for the use of Services with ExternalIPs field.
#[serde(rename = "desiredServiceExternalIpsConfig")]
pub desired_service_external_ips_config: Option<ServiceExternalIPsConfig>,
/// Configuration for Shielded Nodes.
#[serde(rename = "desiredShieldedNodes")]
pub desired_shielded_nodes: Option<ShieldedNodes>,
/// 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.
#[serde(rename = "desiredStackType")]
pub desired_stack_type: Option<String>,
/// The desired user managed keys config for the cluster.
#[serde(rename = "desiredUserManagedKeysConfig")]
pub desired_user_managed_keys_config: Option<UserManagedKeysConfig>,
/// Cluster-level Vertical Pod Autoscaling configuration.
#[serde(rename = "desiredVerticalPodAutoscaling")]
pub desired_vertical_pod_autoscaling: Option<VerticalPodAutoscaling>,
/// Configuration for Workload Identity.
#[serde(rename = "desiredWorkloadIdentityConfig")]
pub desired_workload_identity_config: Option<WorkloadIdentityConfig>,
/// Kubernetes open source beta apis enabled on the cluster. Only beta apis
#[serde(rename = "enableK8sBetaApis")]
pub enable_k8s_beta_apis: Option<K8sBetaAPIConfig>,
/// 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.
pub etag: Option<String>,
/// Configuration for GKE auto upgrade.
#[serde(rename = "gkeAutoUpgradeConfig")]
pub gke_auto_upgrade_config: Option<GkeAutoUpgradeConfig>,
/// 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.
#[serde(rename = "removedAdditionalPodRangesConfig")]
pub removed_additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
/// The Custom keys configuration for the cluster. This field is deprecated. Use ClusterUpdate.desired_user_managed_keys_config instead.
#[serde(rename = "userManagedKeysConfig")]
pub user_managed_keys_config: Option<UserManagedKeysConfig>,
}
impl common::Part for ClusterUpdate {}
/// ClusterUpgradeInfo contains the upgrade information of a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters fetch cluster upgrade info projects](ProjectLocationClusterFetchClusterUpgradeInfoCall) (response)
/// * [zones clusters fetch cluster upgrade info projects](ProjectZoneClusterFetchClusterUpgradeInfoCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ClusterUpgradeInfo {
/// The auto upgrade status.
#[serde(rename = "autoUpgradeStatus")]
pub auto_upgrade_status: Option<Vec<String>>,
/// The cluster's current minor version's end of extended support timestamp.
#[serde(rename = "endOfExtendedSupportTimestamp")]
pub end_of_extended_support_timestamp: Option<String>,
/// The cluster's current minor version's end of standard support timestamp.
#[serde(rename = "endOfStandardSupportTimestamp")]
pub end_of_standard_support_timestamp: Option<String>,
/// minor_target_version indicates the target version for minor upgrade.
#[serde(rename = "minorTargetVersion")]
pub minor_target_version: Option<String>,
/// patch_target_version indicates the target version for patch upgrade.
#[serde(rename = "patchTargetVersion")]
pub patch_target_version: Option<String>,
/// The auto upgrade paused reason.
#[serde(rename = "pausedReason")]
pub paused_reason: Option<Vec<String>>,
/// The list of past auto upgrades.
#[serde(rename = "upgradeDetails")]
pub upgrade_details: Option<Vec<UpgradeDetails>>,
}
impl common::ResponseResult for ClusterUpgradeInfo {}
/// CompleteIPRotationRequest moves the cluster master back into single-IP mode.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters complete ip rotation projects](ProjectLocationClusterCompleteIpRotationCall) (request)
/// * [zones clusters complete ip rotation projects](ProjectZoneClusterCompleteIpRotationCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CompleteIPRotationRequest {
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for CompleteIPRotationRequest {}
/// CompleteNodePoolUpgradeRequest sets the name of target node pool to complete upgrade.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools complete upgrade projects](ProjectLocationClusterNodePoolCompleteUpgradeCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CompleteNodePoolUpgradeRequest {
_never_set: Option<bool>,
}
impl common::RequestValue for CompleteNodePoolUpgradeRequest {}
/// CompliancePostureConfig defines the settings needed to enable/disable features for the Compliance Posture.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CompliancePostureConfig {
/// List of enabled compliance standards.
#[serde(rename = "complianceStandards")]
pub compliance_standards: Option<Vec<ComplianceStandard>>,
/// Defines the enablement mode for Compliance Posture.
pub mode: Option<String>,
}
impl common::Part for CompliancePostureConfig {}
/// Defines the details of a compliance standard.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ComplianceStandard {
/// Name of the compliance standard.
pub standard: Option<String>,
}
impl common::Part for ComplianceStandard {}
/// ConfidentialNodes is configuration for the confidential nodes feature, which makes nodes run on confidential VMs.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ConfidentialNodes {
/// Defines the type of technology used by the confidential node.
#[serde(rename = "confidentialInstanceType")]
pub confidential_instance_type: Option<String>,
/// Whether Confidential Nodes feature is enabled.
pub enabled: Option<bool>,
}
impl common::Part for ConfidentialNodes {}
/// Configuration options for the Config Connector add-on.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ConfigConnectorConfig {
/// Whether Cloud Connector is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for ConfigConnectorConfig {}
/// Parameters for controlling consumption metering.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ConsumptionMeteringConfig {
/// Whether to enable consumption metering for this cluster. If enabled, a second BigQuery table will be created to hold resource consumption records.
pub enabled: Option<bool>,
}
impl common::Part for ConsumptionMeteringConfig {}
/// ContainerdConfig contains configuration to customize containerd.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ContainerdConfig {
/// PrivateRegistryAccessConfig is used to configure access configuration for private container registries.
#[serde(rename = "privateRegistryAccessConfig")]
pub private_registry_access_config: Option<PrivateRegistryAccessConfig>,
/// RegistryHostConfig configures containerd registry host configuration. Each registry_hosts represents a hosts.toml file. At most 25 registry_hosts are allowed.
#[serde(rename = "registryHosts")]
pub registry_hosts: Option<Vec<RegistryHostConfig>>,
/// Optional. WritableCgroups defines writable cgroups configuration for the node pool.
#[serde(rename = "writableCgroups")]
pub writable_cgroups: Option<WritableCgroups>,
}
impl common::Part for ContainerdConfig {}
/// Configuration for all of the cluster's control plane endpoints.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ControlPlaneEndpointsConfig {
/// DNS endpoint configuration.
#[serde(rename = "dnsEndpointConfig")]
pub dns_endpoint_config: Option<DNSEndpointConfig>,
/// IP endpoints configuration.
#[serde(rename = "ipEndpointsConfig")]
pub ip_endpoints_config: Option<IPEndpointsConfig>,
}
impl common::Part for ControlPlaneEndpointsConfig {}
/// Configuration for fine-grained cost management feature.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CostManagementConfig {
/// Whether the feature is enabled or not.
pub enabled: Option<bool>,
}
impl common::Part for CostManagementConfig {}
/// CreateClusterRequest creates a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (request)
/// * [zones clusters create projects](ProjectZoneClusterCreateCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CreateClusterRequest {
/// Required. A [cluster resource](https://cloud.google.com/container-engine/reference/rest/v1/projects.locations.clusters)
pub cluster: Option<Cluster>,
/// The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
pub parent: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for CreateClusterRequest {}
/// CreateNodePoolRequest creates a node pool for a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools create projects](ProjectLocationClusterNodePoolCreateCall) (request)
/// * [zones clusters node pools create projects](ProjectZoneClusterNodePoolCreateCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct CreateNodePoolRequest {
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// Required. The node pool to create.
#[serde(rename = "nodePool")]
pub node_pool: Option<NodePool>,
/// The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
pub parent: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for CreateNodePoolRequest {}
/// DNSConfig contains the desired set of options for configuring clusterDNS.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DNSConfig {
/// Optional. The domain used in Additive VPC scope.
#[serde(rename = "additiveVpcScopeDnsDomain")]
pub additive_vpc_scope_dns_domain: Option<String>,
/// cluster_dns indicates which in-cluster DNS provider should be used.
#[serde(rename = "clusterDns")]
pub cluster_dns: Option<String>,
/// cluster_dns_domain is the suffix used for all cluster service records.
#[serde(rename = "clusterDnsDomain")]
pub cluster_dns_domain: Option<String>,
/// cluster_dns_scope indicates the scope of access to cluster DNS records.
#[serde(rename = "clusterDnsScope")]
pub cluster_dns_scope: Option<String>,
}
impl common::Part for DNSConfig {}
/// Describes the configuration of a DNS endpoint.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DNSEndpointConfig {
/// Controls whether user traffic is allowed over this endpoint. Note that Google-managed services may still use the endpoint even if this is false.
#[serde(rename = "allowExternalTraffic")]
pub allow_external_traffic: Option<bool>,
/// Controls whether the k8s certs auth is allowed via DNS.
#[serde(rename = "enableK8sCertsViaDns")]
pub enable_k8s_certs_via_dns: Option<bool>,
/// Controls whether the k8s token auth is allowed via DNS.
#[serde(rename = "enableK8sTokensViaDns")]
pub enable_k8s_tokens_via_dns: Option<bool>,
/// 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.
pub endpoint: Option<String>,
}
impl common::Part for DNSEndpointConfig {}
/// Time window specified for daily maintenance operations.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DailyMaintenanceWindow {
/// 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".
pub duration: Option<String>,
/// 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.
#[serde(rename = "startTime")]
pub start_time: Option<String>,
}
impl common::Part for DailyMaintenanceWindow {}
/// Configuration of etcd encryption.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DatabaseEncryption {
/// Output only. The current state of etcd encryption.
#[serde(rename = "currentState")]
pub current_state: Option<String>,
/// 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.
#[serde(rename = "decryptionKeys")]
pub decryption_keys: Option<Vec<String>>,
/// 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
#[serde(rename = "keyName")]
pub key_name: Option<String>,
/// Output only. Records errors seen during DatabaseEncryption update operations.
#[serde(rename = "lastOperationErrors")]
pub last_operation_errors: Option<Vec<OperationError>>,
/// The desired state of etcd encryption.
pub state: Option<String>,
}
impl common::Part for DatabaseEncryption {}
/// DefaultComputeClassConfig defines default compute class configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DefaultComputeClassConfig {
/// Enables default compute class.
pub enabled: Option<bool>,
}
impl common::Part for DefaultComputeClassConfig {}
/// DefaultSnatStatus contains the desired state of whether default sNAT should be disabled on the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DefaultSnatStatus {
/// Disables cluster default sNAT rules.
pub disabled: Option<bool>,
}
impl common::Part for DefaultSnatStatus {}
/// DesiredAdditionalIPRangesConfig is a wrapper used for cluster update operation and contains multiple AdditionalIPRangesConfigs.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DesiredAdditionalIPRangesConfig {
/// List of additional IP ranges configs where each AdditionalIPRangesConfig corresponds to one subnetwork's IP ranges
#[serde(rename = "additionalIpRangesConfigs")]
pub additional_ip_ranges_configs: Option<Vec<AdditionalIPRangesConfig>>,
}
impl common::Part for DesiredAdditionalIPRangesConfig {}
/// DesiredEnterpriseConfig is a wrapper used for updating enterprise_config. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DesiredEnterpriseConfig {
/// desired_tier specifies the desired tier of the cluster.
#[serde(rename = "desiredTier")]
pub desired_tier: Option<String>,
}
impl common::Part for DesiredEnterpriseConfig {}
/// Configuration for NodeLocal DNSCache
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct DnsCacheConfig {
/// Whether NodeLocal DNSCache is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for DnsCacheConfig {}
/// 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); }
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools complete upgrade projects](ProjectLocationClusterNodePoolCompleteUpgradeCall) (response)
/// * [locations operations cancel projects](ProjectLocationOperationCancelCall) (response)
/// * [zones operations cancel projects](ProjectZoneOperationCancelCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Empty {
_never_set: Option<bool>,
}
impl common::ResponseResult for Empty {}
/// EnterpriseConfig is the cluster enterprise configuration. Deprecated: GKE Enterprise features are now available without an Enterprise tier.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct EnterpriseConfig {
/// Output only. cluster_tier indicates the effective tier of the cluster.
#[serde(rename = "clusterTier")]
pub cluster_tier: Option<String>,
/// desired_tier specifies the desired tier of the cluster.
#[serde(rename = "desiredTier")]
pub desired_tier: Option<String>,
}
impl common::Part for EnterpriseConfig {}
/// EphemeralStorageLocalSsdConfig contains configuration for the node ephemeral storage using Local SSDs.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct EphemeralStorageLocalSsdConfig {
/// Number of local SSDs to use for GKE Data Cache.
#[serde(rename = "dataCacheCount")]
pub data_cache_count: Option<i32>,
/// 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.
#[serde(rename = "localSsdCount")]
pub local_ssd_count: Option<i32>,
}
impl common::Part for EphemeralStorageLocalSsdConfig {}
/// Eviction grace periods are grace periods for each eviction signal.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct EvictionGracePeriod {
/// 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
#[serde(rename = "imagefsAvailable")]
pub imagefs_available: Option<String>,
/// 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
#[serde(rename = "imagefsInodesFree")]
pub imagefs_inodes_free: Option<String>,
/// 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
#[serde(rename = "memoryAvailable")]
pub memory_available: Option<String>,
/// 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
#[serde(rename = "nodefsAvailable")]
pub nodefs_available: Option<String>,
/// 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
#[serde(rename = "nodefsInodesFree")]
pub nodefs_inodes_free: Option<String>,
/// 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
#[serde(rename = "pidAvailable")]
pub pid_available: Option<String>,
}
impl common::Part for EvictionGracePeriod {}
/// Eviction minimum reclaims are the resource amounts of minimum reclaims for each eviction signal.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct EvictionMinimumReclaim {
/// 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
#[serde(rename = "imagefsAvailable")]
pub imagefs_available: Option<String>,
/// 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
#[serde(rename = "imagefsInodesFree")]
pub imagefs_inodes_free: Option<String>,
/// 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
#[serde(rename = "memoryAvailable")]
pub memory_available: Option<String>,
/// 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
#[serde(rename = "nodefsAvailable")]
pub nodefs_available: Option<String>,
/// 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
#[serde(rename = "nodefsInodesFree")]
pub nodefs_inodes_free: Option<String>,
/// 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
#[serde(rename = "pidAvailable")]
pub pid_available: Option<String>,
}
impl common::Part for EvictionMinimumReclaim {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct EvictionSignals {
/// 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
#[serde(rename = "imagefsAvailable")]
pub imagefs_available: Option<String>,
/// 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
#[serde(rename = "imagefsInodesFree")]
pub imagefs_inodes_free: Option<String>,
/// 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
#[serde(rename = "memoryAvailable")]
pub memory_available: Option<String>,
/// 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
#[serde(rename = "nodefsAvailable")]
pub nodefs_available: Option<String>,
/// 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
#[serde(rename = "nodefsInodesFree")]
pub nodefs_inodes_free: Option<String>,
/// 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
#[serde(rename = "pidAvailable")]
pub pid_available: Option<String>,
}
impl common::Part for EvictionSignals {}
/// Configuration of Fast Socket feature.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct FastSocket {
/// Whether Fast Socket features are enabled in the node pool.
pub enabled: Option<bool>,
}
impl common::Part for FastSocket {}
/// 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
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Filter {
/// Event types to allowlist.
#[serde(rename = "eventType")]
pub event_type: Option<Vec<String>>,
}
impl common::Part for Filter {}
/// Fleet is the fleet configuration for the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Fleet {
/// Output only. The full resource name of the registered fleet membership of the cluster, in the format `//gkehub.googleapis.com/projects/*/locations/*/memberships/*`.
pub membership: Option<String>,
/// The type of the cluster's fleet membership.
#[serde(rename = "membershipType")]
pub membership_type: Option<String>,
/// Output only. Whether the cluster has been registered through the fleet API.
#[serde(rename = "preRegistered")]
pub pre_registered: Option<bool>,
/// 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.
pub project: Option<String>,
}
impl common::Part for Fleet {}
/// GCPSecretManagerCertificateConfig configures a secret from [Secret Manager](https://cloud.google.com/secret-manager).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GCPSecretManagerCertificateConfig {
/// Secret URI, in the form "projects/$PROJECT_ID/secrets/$SECRET_NAME/versions/$VERSION". Version can be fixed (e.g. "2") or "latest"
#[serde(rename = "secretUri")]
pub secret_uri: Option<String>,
}
impl common::Part for GCPSecretManagerCertificateConfig {}
/// GPUDriverInstallationConfig specifies the version of GPU driver to be auto installed.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GPUDriverInstallationConfig {
/// Mode for how the GPU driver is installed.
#[serde(rename = "gpuDriverVersion")]
pub gpu_driver_version: Option<String>,
}
impl common::Part for GPUDriverInstallationConfig {}
/// GPUSharingConfig represents the GPU sharing configuration for Hardware Accelerators.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GPUSharingConfig {
/// The type of GPU sharing strategy to enable on the GPU node.
#[serde(rename = "gpuSharingStrategy")]
pub gpu_sharing_strategy: Option<String>,
/// The max number of containers that can share a physical GPU.
#[serde(rename = "maxSharedClientsPerGpu")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub max_shared_clients_per_gpu: Option<i64>,
}
impl common::Part for GPUSharingConfig {}
/// GatewayAPIConfig contains the desired config of Gateway API on this cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GatewayAPIConfig {
/// The Gateway API release channel to use for Gateway API.
pub channel: Option<String>,
}
impl common::Part for GatewayAPIConfig {}
/// Configuration for the Compute Engine PD CSI driver.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GcePersistentDiskCsiDriverConfig {
/// Whether the Compute Engine PD CSI driver is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for GcePersistentDiskCsiDriverConfig {}
/// GcfsConfig contains configurations of Google Container File System (image streaming).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GcfsConfig {
/// Whether to use GCFS.
pub enabled: Option<bool>,
}
impl common::Part for GcfsConfig {}
/// Configuration for the Filestore CSI driver.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GcpFilestoreCsiDriverConfig {
/// Whether the Filestore CSI driver is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for GcpFilestoreCsiDriverConfig {}
/// Configuration for the Cloud Storage Fuse CSI driver.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GcsFuseCsiDriverConfig {
/// Whether the Cloud Storage Fuse CSI driver is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for GcsFuseCsiDriverConfig {}
/// GetJSONWebKeysResponse is a valid JSON Web Key Set as specified in rfc 7517
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters get jwks projects](ProjectLocationClusterGetJwkCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GetJSONWebKeysResponse {
/// For HTTP requests, this field is automatically extracted into the Cache-Control HTTP header.
#[serde(rename = "cacheHeader")]
pub cache_header: Option<HttpCacheControlResponseHeader>,
/// The public component of the keys used by the cluster to sign token requests.
pub keys: Option<Vec<Jwk>>,
}
impl common::ResponseResult for GetJSONWebKeysResponse {}
/// GetOpenIDConfigResponse is an OIDC discovery document for the cluster. See the OpenID Connect Discovery 1.0 specification for details.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters well-known get openid-configuration projects](ProjectLocationClusterWellKnownGetOpenidConfigurationCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GetOpenIDConfigResponse {
/// For HTTP requests, this field is automatically extracted into the Cache-Control HTTP header.
#[serde(rename = "cacheHeader")]
pub cache_header: Option<HttpCacheControlResponseHeader>,
/// Supported claims.
pub claims_supported: Option<Vec<String>>,
/// Supported grant types.
pub grant_types: Option<Vec<String>>,
/// supported ID Token signing Algorithms.
pub id_token_signing_alg_values_supported: Option<Vec<String>>,
/// OIDC Issuer.
pub issuer: Option<String>,
/// JSON Web Key uri.
pub jwks_uri: Option<String>,
/// Supported response types.
pub response_types_supported: Option<Vec<String>>,
/// Supported subject types.
pub subject_types_supported: Option<Vec<String>>,
}
impl common::ResponseResult for GetOpenIDConfigResponse {}
/// GkeAutoUpgradeConfig is the configuration for GKE auto upgrades.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GkeAutoUpgradeConfig {
/// PatchMode specifies how auto upgrade patch builds should be selected.
#[serde(rename = "patchMode")]
pub patch_mode: Option<String>,
}
impl common::Part for GkeAutoUpgradeConfig {}
/// Configuration for the Backup for GKE Agent.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct GkeBackupAgentConfig {
/// Whether the Backup for GKE agent is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for GkeBackupAgentConfig {}
/// Configuration for the High Scale Checkpointing.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct HighScaleCheckpointingConfig {
/// Whether the High Scale Checkpointing is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for HighScaleCheckpointingConfig {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct HorizontalPodAutoscaling {
/// Whether the Horizontal Pod Autoscaling feature is enabled in the cluster. When enabled, it ensures that metrics are collected into Stackdriver Monitoring.
pub disabled: Option<bool>,
}
impl common::Part for HorizontalPodAutoscaling {}
/// HostConfig configures the registry host under a given Server.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct HostConfig {
/// CA configures the registry host certificate.
pub ca: Option<Vec<CertificateConfig>>,
/// 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.
pub capabilities: Option<Vec<String>>,
/// Client configures the registry host client certificate and key.
pub client: Option<Vec<CertificateConfigPair>>,
/// 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.
#[serde(rename = "dialTimeout")]
#[serde_as(as = "Option<common::serde::duration::Wrapper>")]
pub dial_timeout: Option<chrono::Duration>,
/// Header configures the registry host headers.
pub header: Option<Vec<RegistryHeader>>,
/// 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
pub host: Option<String>,
/// 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.
#[serde(rename = "overridePath")]
pub override_path: Option<bool>,
}
impl common::Part for HostConfig {}
/// RFC-2616: cache control support
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct HttpCacheControlResponseHeader {
/// 14.6 response cache age, in seconds since the response is generated
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub age: Option<i64>,
/// 14.9 request and response directives
pub directive: Option<String>,
/// 14.21 response cache expires, in RFC 1123 date format
pub expires: Option<String>,
}
impl common::Part for HttpCacheControlResponseHeader {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct HttpLoadBalancing {
/// 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.
pub disabled: Option<bool>,
}
impl common::Part for HttpLoadBalancing {}
/// Hugepages amount in both 2m and 1g size
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct HugepagesConfig {
/// Optional. Amount of 1G hugepages
#[serde(rename = "hugepageSize1g")]
pub hugepage_size1g: Option<i32>,
/// Optional. Amount of 2M hugepages
#[serde(rename = "hugepageSize2m")]
pub hugepage_size2m: Option<i32>,
}
impl common::Part for HugepagesConfig {}
/// ILBSubsettingConfig contains the desired config of L4 Internal LoadBalancer subsetting on this cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ILBSubsettingConfig {
/// Enables l4 ILB subsetting for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for ILBSubsettingConfig {}
/// Configuration for controlling how IPs are allocated in the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct IPAllocationPolicy {
/// 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.
#[serde(rename = "additionalIpRangesConfigs")]
pub additional_ip_ranges_configs: Option<Vec<AdditionalIPRangesConfig>>,
/// 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.
#[serde(rename = "additionalPodRangesConfig")]
pub additional_pod_ranges_config: Option<AdditionalPodRangesConfig>,
/// Optional. AutoIpamConfig contains all information related to Auto IPAM
#[serde(rename = "autoIpamConfig")]
pub auto_ipam_config: Option<AutoIpamConfig>,
/// This field is deprecated, use cluster_ipv4_cidr_block.
#[serde(rename = "clusterIpv4Cidr")]
pub cluster_ipv4_cidr: Option<String>,
/// 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.
#[serde(rename = "clusterIpv4CidrBlock")]
pub cluster_ipv4_cidr_block: Option<String>,
/// 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.
#[serde(rename = "clusterSecondaryRangeName")]
pub cluster_secondary_range_name: Option<String>,
/// Whether a new subnetwork will be created automatically for the cluster. This field is only applicable when `use_ip_aliases` is true.
#[serde(rename = "createSubnetwork")]
pub create_subnetwork: Option<bool>,
/// 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.
#[serde(rename = "defaultPodIpv4RangeUtilization")]
pub default_pod_ipv4_range_utilization: Option<f64>,
/// The ipv6 access type (internal or external) when create_subnetwork is true
#[serde(rename = "ipv6AccessType")]
pub ipv6_access_type: Option<String>,
/// 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.
#[serde(rename = "networkTierConfig")]
pub network_tier_config: Option<NetworkTierConfig>,
/// This field is deprecated, use node_ipv4_cidr_block.
#[serde(rename = "nodeIpv4Cidr")]
pub node_ipv4_cidr: Option<String>,
/// 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.
#[serde(rename = "nodeIpv4CidrBlock")]
pub node_ipv4_cidr_block: Option<String>,
/// [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.
#[serde(rename = "podCidrOverprovisionConfig")]
pub pod_cidr_overprovision_config: Option<PodCIDROverprovisionConfig>,
/// This field is deprecated, use services_ipv4_cidr_block.
#[serde(rename = "servicesIpv4Cidr")]
pub services_ipv4_cidr: Option<String>,
/// 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.
#[serde(rename = "servicesIpv4CidrBlock")]
pub services_ipv4_cidr_block: Option<String>,
/// Output only. The services IPv6 CIDR block for the cluster.
#[serde(rename = "servicesIpv6CidrBlock")]
pub services_ipv6_cidr_block: Option<String>,
/// 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.
#[serde(rename = "servicesSecondaryRangeName")]
pub services_secondary_range_name: Option<String>,
/// The IP stack type of the cluster
#[serde(rename = "stackType")]
pub stack_type: Option<String>,
/// Output only. The subnet's IPv6 CIDR block used by nodes and pods.
#[serde(rename = "subnetIpv6CidrBlock")]
pub subnet_ipv6_cidr_block: Option<String>,
/// 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.
#[serde(rename = "subnetworkName")]
pub subnetwork_name: Option<String>,
/// 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.
#[serde(rename = "tpuIpv4CidrBlock")]
pub tpu_ipv4_cidr_block: Option<String>,
/// 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
#[serde(rename = "useIpAliases")]
pub use_ip_aliases: Option<bool>,
/// 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
#[serde(rename = "useRoutes")]
pub use_routes: Option<bool>,
}
impl common::Part for IPAllocationPolicy {}
/// IP endpoints configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct IPEndpointsConfig {
/// 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.
#[serde(rename = "authorizedNetworksConfig")]
pub authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
/// 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.
#[serde(rename = "enablePublicEndpoint")]
pub enable_public_endpoint: Option<bool>,
/// Controls whether to allow direct IP access.
pub enabled: Option<bool>,
/// 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.
#[serde(rename = "globalAccess")]
pub global_access: Option<bool>,
/// Output only. The internal IP address of this cluster's control plane. Only populated if enabled.
#[serde(rename = "privateEndpoint")]
pub private_endpoint: Option<String>,
/// 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.
#[serde(rename = "privateEndpointSubnetwork")]
pub private_endpoint_subnetwork: Option<String>,
/// Output only. The external IP address of this cluster's control plane. Only populated if enabled.
#[serde(rename = "publicEndpoint")]
pub public_endpoint: Option<String>,
}
impl common::Part for IPEndpointsConfig {}
/// IdentityServiceConfig is configuration for Identity Service which allows customers to use external identity providers with the K8S API
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct IdentityServiceConfig {
/// Whether to enable the Identity Service component
pub enabled: Option<bool>,
}
impl common::Part for IdentityServiceConfig {}
/// IntraNodeVisibilityConfig contains the desired config of the intra-node visibility on this cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct IntraNodeVisibilityConfig {
/// Enables intra node visibility for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for IntraNodeVisibilityConfig {}
/// Jwk is a JSON Web Key as specified in RFC 7517
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Jwk {
/// Algorithm.
pub alg: Option<String>,
/// Used for ECDSA keys.
pub crv: Option<String>,
/// Used for RSA keys.
pub e: Option<String>,
/// Key ID.
pub kid: Option<String>,
/// Key Type.
pub kty: Option<String>,
/// Used for RSA keys.
pub n: Option<String>,
/// Permitted uses for the public keys.
#[serde(rename = "use")]
pub use_: Option<String>,
/// Used for ECDSA keys.
pub x: Option<String>,
/// Used for ECDSA keys.
pub y: Option<String>,
}
impl common::Part for Jwk {}
/// K8sBetaAPIConfig , configuration for beta APIs
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct K8sBetaAPIConfig {
/// Enabled k8s beta APIs.
#[serde(rename = "enabledApis")]
pub enabled_apis: Option<Vec<String>>,
}
impl common::Part for K8sBetaAPIConfig {}
/// Configuration for the Kubernetes Dashboard.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct KubernetesDashboard {
/// Whether the Kubernetes Dashboard is enabled for this cluster.
pub disabled: Option<bool>,
}
impl common::Part for KubernetesDashboard {}
/// Configuration for the legacy Attribute Based Access Control authorization mode.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct LegacyAbac {
/// 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.
pub enabled: Option<bool>,
}
impl common::Part for LegacyAbac {}
/// Parameters that can be configured on Linux nodes.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct LinuxNodeConfig {
/// cgroup_mode specifies the cgroup mode to be used on the node.
#[serde(rename = "cgroupMode")]
pub cgroup_mode: Option<String>,
/// Optional. Amounts for 2M and 1G hugepages
pub hugepages: Option<HugepagesConfig>,
/// 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.
#[serde(rename = "nodeKernelModuleLoading")]
pub node_kernel_module_loading: Option<NodeKernelModuleLoading>,
/// 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
pub sysctls: Option<HashMap<String, String>>,
/// 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.
#[serde(rename = "transparentHugepageDefrag")]
pub transparent_hugepage_defrag: Option<String>,
/// 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.
#[serde(rename = "transparentHugepageEnabled")]
pub transparent_hugepage_enabled: Option<String>,
}
impl common::Part for LinuxNodeConfig {}
/// ListClustersResponse is the result of ListClustersRequest.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters list projects](ProjectLocationClusterListCall) (response)
/// * [zones clusters list projects](ProjectZoneClusterListCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ListClustersResponse {
/// A list of clusters in the project in the specified zone, or across all ones.
pub clusters: Option<Vec<Cluster>>,
/// If any zones are listed here, the list of clusters returned may be missing those zones.
#[serde(rename = "missingZones")]
pub missing_zones: Option<Vec<String>>,
}
impl common::ResponseResult for ListClustersResponse {}
/// ListNodePoolsResponse is the result of ListNodePoolsRequest.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools list projects](ProjectLocationClusterNodePoolListCall) (response)
/// * [zones clusters node pools list projects](ProjectZoneClusterNodePoolListCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ListNodePoolsResponse {
/// A list of node pools for a cluster.
#[serde(rename = "nodePools")]
pub node_pools: Option<Vec<NodePool>>,
}
impl common::ResponseResult for ListNodePoolsResponse {}
/// ListOperationsResponse is the result of ListOperationsRequest.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations operations list projects](ProjectLocationOperationListCall) (response)
/// * [zones operations list projects](ProjectZoneOperationListCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ListOperationsResponse {
/// If any zones are listed here, the list of operations returned may be missing the operations from those zones.
#[serde(rename = "missingZones")]
pub missing_zones: Option<Vec<String>>,
/// A list of operations in the project in the specified zone.
pub operations: Option<Vec<Operation>>,
}
impl common::ResponseResult for ListOperationsResponse {}
/// ListUsableSubnetworksResponse is the response of ListUsableSubnetworksRequest.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [aggregated usable subnetworks list projects](ProjectAggregatedUsableSubnetworkListCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ListUsableSubnetworksResponse {
/// 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.
#[serde(rename = "nextPageToken")]
pub next_page_token: Option<String>,
/// A list of usable subnetworks in the specified network project.
pub subnetworks: Option<Vec<UsableSubnetwork>>,
}
impl common::ResponseResult for ListUsableSubnetworksResponse {}
/// LocalNvmeSsdBlockConfig contains configuration for using raw-block local NVMe SSDs
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct LocalNvmeSsdBlockConfig {
/// 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.
#[serde(rename = "localSsdCount")]
pub local_ssd_count: Option<i32>,
}
impl common::Part for LocalNvmeSsdBlockConfig {}
/// LoggingComponentConfig is cluster logging component configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct LoggingComponentConfig {
/// Select components to collect logs. An empty set would disable all logging.
#[serde(rename = "enableComponents")]
pub enable_components: Option<Vec<String>>,
}
impl common::Part for LoggingComponentConfig {}
/// LoggingConfig is cluster logging configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct LoggingConfig {
/// Logging components configuration
#[serde(rename = "componentConfig")]
pub component_config: Option<LoggingComponentConfig>,
}
impl common::Part for LoggingConfig {}
/// LoggingVariantConfig specifies the behaviour of the logging component.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct LoggingVariantConfig {
/// Logging variant deployed on nodes.
pub variant: Option<String>,
}
impl common::Part for LoggingVariantConfig {}
/// Configuration for the Lustre CSI driver.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct LustreCsiDriverConfig {
/// 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.
#[serde(rename = "enableLegacyLustrePort")]
pub enable_legacy_lustre_port: Option<bool>,
/// Whether the Lustre CSI driver is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for LustreCsiDriverConfig {}
/// Represents the Maintenance exclusion option.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MaintenanceExclusionOptions {
/// EndTimeBehavior specifies the behavior of the exclusion end time.
#[serde(rename = "endTimeBehavior")]
pub end_time_behavior: Option<String>,
/// Scope specifies the upgrade scope which upgrades are blocked by the exclusion.
pub scope: Option<String>,
}
impl common::Part for MaintenanceExclusionOptions {}
/// MaintenancePolicy defines the maintenance policy to be used for the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MaintenancePolicy {
/// 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.
#[serde(rename = "resourceVersion")]
pub resource_version: Option<String>,
/// Specifies the maintenance window in which maintenance may be performed.
pub window: Option<MaintenanceWindow>,
}
impl common::Part for MaintenancePolicy {}
/// MaintenanceWindow defines the maintenance window to be used for the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MaintenanceWindow {
/// DailyMaintenanceWindow specifies a daily maintenance operation window.
#[serde(rename = "dailyMaintenanceWindow")]
pub daily_maintenance_window: Option<DailyMaintenanceWindow>,
/// Exceptions to maintenance window. Non-emergency maintenance should not occur in these windows.
#[serde(rename = "maintenanceExclusions")]
pub maintenance_exclusions: Option<HashMap<String, TimeWindow>>,
/// 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.
#[serde(rename = "recurringWindow")]
pub recurring_window: Option<RecurringTimeWindow>,
}
impl common::Part for MaintenanceWindow {}
/// ManagedOpenTelemetryConfig is the configuration for the GKE Managed OpenTelemetry pipeline.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ManagedOpenTelemetryConfig {
/// Scope of the Managed OpenTelemetry pipeline.
pub scope: Option<String>,
}
impl common::Part for ManagedOpenTelemetryConfig {}
/// ManagedPrometheusConfig defines the configuration for Google Cloud Managed Service for Prometheus.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ManagedPrometheusConfig {
/// GKE Workload Auto-Monitoring Configuration.
#[serde(rename = "autoMonitoringConfig")]
pub auto_monitoring_config: Option<AutoMonitoringConfig>,
/// Enable Managed Collection.
pub enabled: Option<bool>,
}
impl common::Part for ManagedPrometheusConfig {}
/// The authentication information for accessing the master endpoint. Authentication can be done using HTTP basic auth or using client certificates.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MasterAuth {
/// Output only. Base64-encoded public certificate used by clients to authenticate to the cluster endpoint. Issued only if client_certificate_config is set.
#[serde(rename = "clientCertificate")]
pub client_certificate: Option<String>,
/// Configuration for client certificate authentication on the cluster. For clusters before v1.12, if no configuration is specified, a client certificate is issued.
#[serde(rename = "clientCertificateConfig")]
pub client_certificate_config: Option<ClientCertificateConfig>,
/// Output only. Base64-encoded private key used by clients to authenticate to the cluster endpoint.
#[serde(rename = "clientKey")]
pub client_key: Option<String>,
/// Output only. Base64-encoded public certificate that is the root of trust for the cluster.
#[serde(rename = "clusterCaCertificate")]
pub cluster_ca_certificate: Option<String>,
/// 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
pub password: Option<String>,
/// 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
pub username: Option<String>,
}
impl common::Part for MasterAuth {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MasterAuthorizedNetworksConfig {
/// cidr_blocks define up to 50 external networks that could access Kubernetes master through HTTPS.
#[serde(rename = "cidrBlocks")]
pub cidr_blocks: Option<Vec<CidrBlock>>,
/// Whether or not master authorized networks is enabled.
pub enabled: Option<bool>,
/// Whether master is accessible via Google Compute Engine Public IP addresses.
#[serde(rename = "gcpPublicCidrsAccessEnabled")]
pub gcp_public_cidrs_access_enabled: Option<bool>,
/// Whether master authorized networks is enforced on private endpoint or not.
#[serde(rename = "privateEndpointEnforcementEnabled")]
pub private_endpoint_enforcement_enabled: Option<bool>,
}
impl common::Part for MasterAuthorizedNetworksConfig {}
/// Constraints applied to pods.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MaxPodsConstraint {
/// Constraint enforced on the max num of pods per node.
#[serde(rename = "maxPodsPerNode")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub max_pods_per_node: Option<i64>,
}
impl common::Part for MaxPodsConstraint {}
/// 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/).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MemoryManager {
/// 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.
pub policy: Option<String>,
}
impl common::Part for MemoryManager {}
/// Configuration for issuance of mTLS keys and certificates to Kubernetes pods.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MeshCertificates {
/// 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).
#[serde(rename = "enableCertificates")]
pub enable_certificates: Option<bool>,
}
impl common::Part for MeshCertificates {}
/// Progress metric is (string, int|float|string) pair.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Metric {
/// For metrics with floating point value.
#[serde(rename = "doubleValue")]
pub double_value: Option<f64>,
/// For metrics with integer value.
#[serde(rename = "intValue")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub int_value: Option<i64>,
/// Required. Metric name, e.g., "nodes total", "percent done".
pub name: Option<String>,
/// For metrics with custom values (ratios, visual progress, etc.).
#[serde(rename = "stringValue")]
pub string_value: Option<String>,
}
impl common::Part for Metric {}
/// MonitoringComponentConfig is cluster monitoring component configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MonitoringComponentConfig {
/// Select components to collect metrics. An empty set would disable all monitoring.
#[serde(rename = "enableComponents")]
pub enable_components: Option<Vec<String>>,
}
impl common::Part for MonitoringComponentConfig {}
/// MonitoringConfig is cluster monitoring configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct MonitoringConfig {
/// Configuration of Advanced Datapath Observability features.
#[serde(rename = "advancedDatapathObservabilityConfig")]
pub advanced_datapath_observability_config: Option<AdvancedDatapathObservabilityConfig>,
/// Monitoring components configuration
#[serde(rename = "componentConfig")]
pub component_config: Option<MonitoringComponentConfig>,
/// Enable Google Cloud Managed Service for Prometheus in the cluster.
#[serde(rename = "managedPrometheusConfig")]
pub managed_prometheus_config: Option<ManagedPrometheusConfig>,
}
impl common::Part for MonitoringConfig {}
/// NetworkConfig reports the relative names of network & subnetwork.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NetworkConfig {
/// The desired datapath provider for this cluster. By default, uses the IPTables-based kube-proxy implementation.
#[serde(rename = "datapathProvider")]
pub datapath_provider: Option<String>,
/// 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
#[serde(rename = "defaultEnablePrivateNodes")]
pub default_enable_private_nodes: Option<bool>,
/// 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.
#[serde(rename = "defaultSnatStatus")]
pub default_snat_status: Option<DefaultSnatStatus>,
/// Disable L4 load balancer VPC firewalls to enable firewall policies.
#[serde(rename = "disableL4LbFirewallReconciliation")]
pub disable_l4_lb_firewall_reconciliation: Option<bool>,
/// DNSConfig contains clusterDNS config for this cluster.
#[serde(rename = "dnsConfig")]
pub dns_config: Option<DNSConfig>,
/// Whether CiliumClusterwideNetworkPolicy is enabled on this cluster.
#[serde(rename = "enableCiliumClusterwideNetworkPolicy")]
pub enable_cilium_clusterwide_network_policy: Option<bool>,
/// Whether FQDN Network Policy is enabled on this cluster.
#[serde(rename = "enableFqdnNetworkPolicy")]
pub enable_fqdn_network_policy: Option<bool>,
/// Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network.
#[serde(rename = "enableIntraNodeVisibility")]
pub enable_intra_node_visibility: Option<bool>,
/// Whether L4ILB Subsetting is enabled for this cluster.
#[serde(rename = "enableL4ilbSubsetting")]
pub enable_l4ilb_subsetting: Option<bool>,
/// Whether multi-networking is enabled for this cluster.
#[serde(rename = "enableMultiNetworking")]
pub enable_multi_networking: Option<bool>,
/// GatewayAPIConfig contains the desired config of Gateway API on this cluster.
#[serde(rename = "gatewayApiConfig")]
pub gateway_api_config: Option<GatewayAPIConfig>,
/// Specify the details of in-transit encryption. Now named inter-node transparent encryption.
#[serde(rename = "inTransitEncryptionConfig")]
pub in_transit_encryption_config: Option<String>,
/// 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
pub network: Option<String>,
/// Network bandwidth tier configuration.
#[serde(rename = "networkPerformanceConfig")]
pub network_performance_config: Option<ClusterNetworkPerformanceConfig>,
/// 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)
#[serde(rename = "privateIpv6GoogleAccess")]
pub private_ipv6_google_access: Option<String>,
/// ServiceExternalIPsConfig specifies if services with externalIPs field are blocked or not.
#[serde(rename = "serviceExternalIpsConfig")]
pub service_external_ips_config: Option<ServiceExternalIPsConfig>,
/// 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
pub subnetwork: Option<String>,
}
impl common::Part for NetworkConfig {}
/// Configuration of all network bandwidth tiers
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NetworkPerformanceConfig {
/// Specifies the total network bandwidth tier for the NodePool.
#[serde(rename = "totalEgressBandwidthTier")]
pub total_egress_bandwidth_tier: Option<String>,
}
impl common::Part for NetworkPerformanceConfig {}
/// Configuration options for the NetworkPolicy feature. https://kubernetes.io/docs/concepts/services-networking/networkpolicies/
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NetworkPolicy {
/// Whether network policy is enabled on the cluster.
pub enabled: Option<bool>,
/// The selected network policy provider.
pub provider: Option<String>,
}
impl common::Part for NetworkPolicy {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NetworkPolicyConfig {
/// Whether NetworkPolicy is enabled for this cluster.
pub disabled: Option<bool>,
}
impl common::Part for NetworkPolicyConfig {}
/// Collection of Compute Engine network tags that can be applied to a node's underlying VM instance.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NetworkTags {
/// List of network tags.
pub tags: Option<Vec<String>>,
}
impl common::Part for NetworkTags {}
/// NetworkTierConfig contains network tier information.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NetworkTierConfig {
/// Network tier configuration.
#[serde(rename = "networkTier")]
pub network_tier: Option<String>,
}
impl common::Part for NetworkTierConfig {}
/// 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).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeAffinity {
/// Key for NodeAffinity.
pub key: Option<String>,
/// Operator for NodeAffinity.
pub operator: Option<String>,
/// Values for NodeAffinity.
pub values: Option<Vec<String>>,
}
impl common::Part for NodeAffinity {}
/// Parameters that describe the nodes in a cluster. GKE Autopilot clusters do not recognize parameters in `NodeConfig`. Use AutoprovisioningNodePoolDefaults instead.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeConfig {
/// 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.
pub accelerators: Option<Vec<AcceleratorConfig>>,
/// Advanced features for the Compute Engine VM.
#[serde(rename = "advancedMachineFeatures")]
pub advanced_machine_features: Option<AdvancedMachineFeatures>,
/// The boot disk configuration for the node pool.
#[serde(rename = "bootDisk")]
pub boot_disk: Option<BootDisk>,
/// 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
#[serde(rename = "bootDiskKmsKey")]
pub boot_disk_kms_key: Option<String>,
/// Confidential nodes config. All the nodes in the node pool will be Confidential VM once enabled.
#[serde(rename = "confidentialNodes")]
pub confidential_nodes: Option<ConfidentialNodes>,
/// Parameters for containerd customization.
#[serde(rename = "containerdConfig")]
pub containerd_config: Option<ContainerdConfig>,
/// 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.
#[serde(rename = "diskSizeGb")]
pub disk_size_gb: Option<i32>,
/// 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'
#[serde(rename = "diskType")]
pub disk_type: Option<String>,
/// 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.
#[serde(rename = "effectiveCgroupMode")]
pub effective_cgroup_mode: Option<String>,
/// Optional. Reserved for future use.
#[serde(rename = "enableConfidentialStorage")]
pub enable_confidential_storage: Option<bool>,
/// Parameters for the node ephemeral storage using Local SSDs. If unspecified, ephemeral storage is backed by the boot disk.
#[serde(rename = "ephemeralStorageLocalSsdConfig")]
pub ephemeral_storage_local_ssd_config: Option<EphemeralStorageLocalSsdConfig>,
/// Enable or disable NCCL fast socket for the node pool.
#[serde(rename = "fastSocket")]
pub fast_socket: Option<FastSocket>,
/// Flex Start flag for enabling Flex Start VM.
#[serde(rename = "flexStart")]
pub flex_start: Option<bool>,
/// Google Container File System (image streaming) configs.
#[serde(rename = "gcfsConfig")]
pub gcfs_config: Option<GcfsConfig>,
/// Enable or disable gvnic in the node pool.
pub gvnic: Option<VirtualNIC>,
/// 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.
#[serde(rename = "imageType")]
pub image_type: Option<String>,
/// Node kubelet configs.
#[serde(rename = "kubeletConfig")]
pub kubelet_config: Option<NodeKubeletConfig>,
/// 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/
pub labels: Option<HashMap<String, String>>,
/// Parameters that can be configured on Linux nodes.
#[serde(rename = "linuxNodeConfig")]
pub linux_node_config: Option<LinuxNodeConfig>,
/// Parameters for using raw-block Local NVMe SSDs.
#[serde(rename = "localNvmeSsdBlockConfig")]
pub local_nvme_ssd_block_config: Option<LocalNvmeSsdBlockConfig>,
/// 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.
#[serde(rename = "localSsdCount")]
pub local_ssd_count: Option<i32>,
/// Specifies which method should be used for encrypting the Local SSDs attached to the node.
#[serde(rename = "localSsdEncryptionMode")]
pub local_ssd_encryption_mode: Option<String>,
/// Logging configuration.
#[serde(rename = "loggingConfig")]
pub logging_config: Option<NodePoolLoggingConfig>,
/// 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`.
#[serde(rename = "machineType")]
pub machine_type: Option<String>,
/// The maximum duration for the nodes to exist. If unspecified, the nodes can exist indefinitely.
#[serde(rename = "maxRunDuration")]
#[serde_as(as = "Option<common::serde::duration::Wrapper>")]
pub max_run_duration: Option<chrono::Duration>,
/// 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.
pub metadata: Option<HashMap<String, String>>,
/// 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)
#[serde(rename = "minCpuPlatform")]
pub min_cpu_platform: Option<String>,
/// 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).
#[serde(rename = "nodeGroup")]
pub node_group: Option<String>,
/// 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.
#[serde(rename = "oauthScopes")]
pub oauth_scopes: Option<Vec<String>>,
/// 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.
pub preemptible: Option<bool>,
/// 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.
#[serde(rename = "reservationAffinity")]
pub reservation_affinity: Option<ReservationAffinity>,
/// The resource labels for the node pool to use to annotate any related Google Compute Engine resources.
#[serde(rename = "resourceLabels")]
pub resource_labels: Option<HashMap<String, String>>,
/// A map of resource manager tag keys and values to be attached to the nodes.
#[serde(rename = "resourceManagerTags")]
pub resource_manager_tags: Option<ResourceManagerTags>,
/// Sandbox configuration for this node.
#[serde(rename = "sandboxConfig")]
pub sandbox_config: Option<SandboxConfig>,
/// Secondary boot disk update strategy.
#[serde(rename = "secondaryBootDiskUpdateStrategy")]
pub secondary_boot_disk_update_strategy: Option<SecondaryBootDiskUpdateStrategy>,
/// List of secondary boot disks attached to the nodes.
#[serde(rename = "secondaryBootDisks")]
pub secondary_boot_disks: Option<Vec<SecondaryBootDisk>>,
/// 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.
#[serde(rename = "serviceAccount")]
pub service_account: Option<String>,
/// Shielded Instance options.
#[serde(rename = "shieldedInstanceConfig")]
pub shielded_instance_config: Option<ShieldedInstanceConfig>,
/// Parameters for node pools to be backed by shared sole tenant node groups.
#[serde(rename = "soleTenantConfig")]
pub sole_tenant_config: Option<SoleTenantConfig>,
/// Spot flag for enabling Spot VM, which is a rebrand of the existing preemptible flag.
pub spot: Option<bool>,
/// List of Storage Pools where boot disks are provisioned.
#[serde(rename = "storagePools")]
pub storage_pools: Option<Vec<String>>,
/// 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.
pub tags: Option<Vec<String>>,
/// 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/
pub taints: Option<Vec<NodeTaint>>,
/// Parameters that can be configured on Windows nodes.
#[serde(rename = "windowsNodeConfig")]
pub windows_node_config: Option<WindowsNodeConfig>,
/// The workload metadata configuration for this node.
#[serde(rename = "workloadMetadataConfig")]
pub workload_metadata_config: Option<WorkloadMetadataConfig>,
}
impl common::Part for NodeConfig {}
/// Subset of NodeConfig message that has defaults.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeConfigDefaults {
/// Parameters for containerd customization.
#[serde(rename = "containerdConfig")]
pub containerd_config: Option<ContainerdConfig>,
/// GCFS (Google Container File System, also known as Riptide) options.
#[serde(rename = "gcfsConfig")]
pub gcfs_config: Option<GcfsConfig>,
/// Logging configuration for node pools.
#[serde(rename = "loggingConfig")]
pub logging_config: Option<NodePoolLoggingConfig>,
/// NodeKubeletConfig controls the defaults for new node-pools. Currently only `insecure_kubelet_readonly_port_enabled` can be set here.
#[serde(rename = "nodeKubeletConfig")]
pub node_kubelet_config: Option<NodeKubeletConfig>,
}
impl common::Part for NodeConfigDefaults {}
/// NodeDrainConfig contains the node drain related configurations for this nodepool.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeDrainConfig {
/// Whether to respect PDB during node pool deletion.
#[serde(rename = "respectPdbDuringNodePoolDeletion")]
pub respect_pdb_during_node_pool_deletion: Option<bool>,
}
impl common::Part for NodeDrainConfig {}
/// Configuration for kernel module loading on nodes.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeKernelModuleLoading {
/// Set the node module loading policy for nodes in the node pool.
pub policy: Option<String>,
}
impl common::Part for NodeKernelModuleLoading {}
/// Node kubelet configs.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeKubeletConfig {
/// 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.
#[serde(rename = "allowedUnsafeSysctls")]
pub allowed_unsafe_sysctls: Option<Vec<String>>,
/// 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.
#[serde(rename = "containerLogMaxFiles")]
pub container_log_max_files: Option<i32>,
/// 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.
#[serde(rename = "containerLogMaxSize")]
pub container_log_max_size: Option<String>,
/// 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.
#[serde(rename = "cpuCfsQuota")]
pub cpu_cfs_quota: Option<bool>,
/// 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.
#[serde(rename = "cpuCfsQuotaPeriod")]
pub cpu_cfs_quota_period: Option<String>,
/// 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.
#[serde(rename = "cpuManagerPolicy")]
pub cpu_manager_policy: Option<String>,
/// 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].
#[serde(rename = "evictionMaxPodGracePeriodSeconds")]
pub eviction_max_pod_grace_period_seconds: Option<i32>,
/// 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.
#[serde(rename = "evictionMinimumReclaim")]
pub eviction_minimum_reclaim: Option<EvictionMinimumReclaim>,
/// 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.
#[serde(rename = "evictionSoft")]
pub eviction_soft: Option<EvictionSignals>,
/// 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.
#[serde(rename = "evictionSoftGracePeriod")]
pub eviction_soft_grace_period: Option<EvictionGracePeriod>,
/// 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.
#[serde(rename = "imageGcHighThresholdPercent")]
pub image_gc_high_threshold_percent: Option<i32>,
/// 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.
#[serde(rename = "imageGcLowThresholdPercent")]
pub image_gc_low_threshold_percent: Option<i32>,
/// 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.
#[serde(rename = "imageMaximumGcAge")]
pub image_maximum_gc_age: Option<String>,
/// 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.
#[serde(rename = "imageMinimumGcAge")]
pub image_minimum_gc_age: Option<String>,
/// Enable or disable Kubelet read only port.
#[serde(rename = "insecureKubeletReadonlyPortEnabled")]
pub insecure_kubelet_readonly_port_enabled: Option<bool>,
/// 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.
#[serde(rename = "maxParallelImagePulls")]
pub max_parallel_image_pulls: Option<i32>,
/// Optional. Controls NUMA-aware Memory Manager configuration on the node. For more information, see: https://kubernetes.io/docs/tasks/administer-cluster/memory-manager/
#[serde(rename = "memoryManager")]
pub memory_manager: Option<MemoryManager>,
/// 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.
#[serde(rename = "podPidsLimit")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub pod_pids_limit: Option<i64>,
/// 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.
#[serde(rename = "singleProcessOomKill")]
pub single_process_oom_kill: Option<bool>,
/// Optional. Controls Topology Manager configuration on the node. For more information, see: https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/
#[serde(rename = "topologyManager")]
pub topology_manager: Option<TopologyManager>,
}
impl common::Part for NodeKubeletConfig {}
/// Collection of node-level [Kubernetes labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeLabels {
/// Map of node label keys and node label values.
pub labels: Option<HashMap<String, String>>,
}
impl common::Part for NodeLabels {}
/// NodeManagement defines the set of node management services turned on for the node pool.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeManagement {
/// 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.
#[serde(rename = "autoRepair")]
pub auto_repair: Option<bool>,
/// 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.
#[serde(rename = "autoUpgrade")]
pub auto_upgrade: Option<bool>,
/// Specifies the Auto Upgrade knobs for the node pool.
#[serde(rename = "upgradeOptions")]
pub upgrade_options: Option<AutoUpgradeOptions>,
}
impl common::Part for NodeManagement {}
/// Parameters for node pool-level network config.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeNetworkConfig {
/// We specify the additional node networks for this node pool using this list. Each node network corresponds to an additional interface
#[serde(rename = "additionalNodeNetworkConfigs")]
pub additional_node_network_configs: Option<Vec<AdditionalNodeNetworkConfig>>,
/// 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
#[serde(rename = "additionalPodNetworkConfigs")]
pub additional_pod_network_configs: Option<Vec<AdditionalPodNetworkConfig>>,
/// 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.
#[serde(rename = "createPodRange")]
pub create_pod_range: Option<bool>,
/// 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
#[serde(rename = "enablePrivateNodes")]
pub enable_private_nodes: Option<bool>,
/// Network bandwidth tier configuration.
#[serde(rename = "networkPerformanceConfig")]
pub network_performance_config: Option<NetworkPerformanceConfig>,
/// 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.
#[serde(rename = "networkTierConfig")]
pub network_tier_config: Option<NetworkTierConfig>,
/// [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.
#[serde(rename = "podCidrOverprovisionConfig")]
pub pod_cidr_overprovision_config: Option<PodCIDROverprovisionConfig>,
/// 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.
#[serde(rename = "podIpv4CidrBlock")]
pub pod_ipv4_cidr_block: Option<String>,
/// 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.
#[serde(rename = "podIpv4RangeUtilization")]
pub pod_ipv4_range_utilization: Option<f64>,
/// 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.
#[serde(rename = "podRange")]
pub pod_range: Option<String>,
/// 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.
pub subnetwork: Option<String>,
}
impl common::Part for NodeNetworkConfig {}
/// 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.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools get projects](ProjectLocationClusterNodePoolGetCall) (response)
/// * [zones clusters node pools get projects](ProjectZoneClusterNodePoolGetCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodePool {
/// Specifies the autopilot configuration for this node pool. This field is exclusively reserved for Cluster Autoscaler.
#[serde(rename = "autopilotConfig")]
pub autopilot_config: Option<AutopilotConfig>,
/// Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid configuration is present.
pub autoscaling: Option<NodePoolAutoscaling>,
/// Enable best effort provisioning for nodes
#[serde(rename = "bestEffortProvisioning")]
pub best_effort_provisioning: Option<BestEffortProvisioning>,
/// Which conditions caused the current node pool state.
pub conditions: Option<Vec<StatusCondition>>,
/// The node configuration of the pool.
pub config: Option<NodeConfig>,
/// 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.
pub etag: Option<String>,
/// 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.
#[serde(rename = "initialNodeCount")]
pub initial_node_count: Option<i32>,
/// 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.
#[serde(rename = "instanceGroupUrls")]
pub instance_group_urls: Option<Vec<String>>,
/// 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.
pub locations: Option<Vec<String>>,
/// NodeManagement configuration for this NodePool.
pub management: Option<NodeManagement>,
/// The constraint on the maximum number of pods that can be run simultaneously on a node in the node pool.
#[serde(rename = "maxPodsConstraint")]
pub max_pods_constraint: Option<MaxPodsConstraint>,
/// The name of the node pool.
pub name: Option<String>,
/// Networking configuration for this NodePool. If specified, it overrides the cluster-level defaults.
#[serde(rename = "networkConfig")]
pub network_config: Option<NodeNetworkConfig>,
/// Specifies the node drain configuration for this node pool.
#[serde(rename = "nodeDrainConfig")]
pub node_drain_config: Option<NodeDrainConfig>,
/// Specifies the node placement policy.
#[serde(rename = "placementPolicy")]
pub placement_policy: Option<PlacementPolicy>,
/// Output only. The pod CIDR block size per node in this node pool.
#[serde(rename = "podIpv4CidrSize")]
pub pod_ipv4_cidr_size: Option<i32>,
/// Specifies the configuration of queued provisioning.
#[serde(rename = "queuedProvisioning")]
pub queued_provisioning: Option<QueuedProvisioning>,
/// Output only. Server-defined URL for the resource.
#[serde(rename = "selfLink")]
pub self_link: Option<String>,
/// Output only. The status of the nodes in this pool instance.
pub status: Option<String>,
/// Output only. Deprecated. Use conditions instead. Additional information about the current status of this node pool instance, if available.
#[serde(rename = "statusMessage")]
pub status_message: Option<String>,
/// Output only. Update info contains relevant information during a node pool update.
#[serde(rename = "updateInfo")]
pub update_info: Option<UpdateInfo>,
/// Upgrade settings control disruption and speed of the upgrade.
#[serde(rename = "upgradeSettings")]
pub upgrade_settings: Option<UpgradeSettings>,
/// 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).
pub version: Option<String>,
}
impl common::ResponseResult for NodePool {}
/// Node pool configs that apply to all auto-provisioned node pools in autopilot clusters and node auto-provisioning enabled clusters.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodePoolAutoConfig {
/// Output only. Configuration options for Linux nodes.
#[serde(rename = "linuxNodeConfig")]
pub linux_node_config: Option<LinuxNodeConfig>,
/// 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.
#[serde(rename = "networkTags")]
pub network_tags: Option<NetworkTags>,
/// NodeKubeletConfig controls the defaults for autoprovisioned node-pools. Currently only `insecure_kubelet_readonly_port_enabled` can be set here.
#[serde(rename = "nodeKubeletConfig")]
pub node_kubelet_config: Option<NodeKubeletConfig>,
/// Resource manager tag keys and values to be attached to the nodes for managing Compute Engine firewalls using Network Firewall Policies.
#[serde(rename = "resourceManagerTags")]
pub resource_manager_tags: Option<ResourceManagerTags>,
}
impl common::Part for NodePoolAutoConfig {}
/// NodePoolAutoscaling contains information required by cluster autoscaler to adjust the size of the node pool to the current cluster usage.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodePoolAutoscaling {
/// Can this node pool be deleted automatically.
pub autoprovisioned: Option<bool>,
/// Is autoscaling enabled for this node pool.
pub enabled: Option<bool>,
/// Location policy used when scaling up a nodepool.
#[serde(rename = "locationPolicy")]
pub location_policy: Option<String>,
/// 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.
#[serde(rename = "maxNodeCount")]
pub max_node_count: Option<i32>,
/// 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.
#[serde(rename = "minNodeCount")]
pub min_node_count: Option<i32>,
/// 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.
#[serde(rename = "totalMaxNodeCount")]
pub total_max_node_count: Option<i32>,
/// 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.
#[serde(rename = "totalMinNodeCount")]
pub total_min_node_count: Option<i32>,
}
impl common::Part for NodePoolAutoscaling {}
/// Subset of Nodepool message that has defaults.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodePoolDefaults {
/// Subset of NodeConfig message that has defaults.
#[serde(rename = "nodeConfigDefaults")]
pub node_config_defaults: Option<NodeConfigDefaults>,
}
impl common::Part for NodePoolDefaults {}
/// NodePoolLoggingConfig specifies logging configuration for nodepools.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodePoolLoggingConfig {
/// Logging variant configuration.
#[serde(rename = "variantConfig")]
pub variant_config: Option<LoggingVariantConfig>,
}
impl common::Part for NodePoolLoggingConfig {}
/// NodePoolUpgradeInfo contains the upgrade information of a nodepool.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools fetch node pool upgrade info projects](ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall) (response)
/// * [zones clusters node pools fetch node pool upgrade info projects](ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodePoolUpgradeInfo {
/// The auto upgrade status.
#[serde(rename = "autoUpgradeStatus")]
pub auto_upgrade_status: Option<Vec<String>>,
/// The nodepool's current minor version's end of extended support timestamp.
#[serde(rename = "endOfExtendedSupportTimestamp")]
pub end_of_extended_support_timestamp: Option<String>,
/// The nodepool's current minor version's end of standard support timestamp.
#[serde(rename = "endOfStandardSupportTimestamp")]
pub end_of_standard_support_timestamp: Option<String>,
/// minor_target_version indicates the target version for minor upgrade.
#[serde(rename = "minorTargetVersion")]
pub minor_target_version: Option<String>,
/// patch_target_version indicates the target version for patch upgrade.
#[serde(rename = "patchTargetVersion")]
pub patch_target_version: Option<String>,
/// The auto upgrade paused reason.
#[serde(rename = "pausedReason")]
pub paused_reason: Option<Vec<String>>,
/// The list of past auto upgrades.
#[serde(rename = "upgradeDetails")]
pub upgrade_details: Option<Vec<UpgradeDetails>>,
}
impl common::ResponseResult for NodePoolUpgradeInfo {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeTaint {
/// Effect for taint.
pub effect: Option<String>,
/// Key for taint.
pub key: Option<String>,
/// Value for taint.
pub value: Option<String>,
}
impl common::Part for NodeTaint {}
/// Collection of Kubernetes [node taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NodeTaints {
/// List of node taints.
pub taints: Option<Vec<NodeTaint>>,
}
impl common::Part for NodeTaints {}
/// NotificationConfig is the configuration of notifications.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct NotificationConfig {
/// Notification config for Pub/Sub.
pub pubsub: Option<PubSub>,
}
impl common::Part for NotificationConfig {}
/// This operation resource represents operations that may have happened or are happening on the cluster. All fields are output only.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools create projects](ProjectLocationClusterNodePoolCreateCall) (response)
/// * [locations clusters node pools delete projects](ProjectLocationClusterNodePoolDeleteCall) (response)
/// * [locations clusters node pools rollback projects](ProjectLocationClusterNodePoolRollbackCall) (response)
/// * [locations clusters node pools set autoscaling projects](ProjectLocationClusterNodePoolSetAutoscalingCall) (response)
/// * [locations clusters node pools set management projects](ProjectLocationClusterNodePoolSetManagementCall) (response)
/// * [locations clusters node pools set size projects](ProjectLocationClusterNodePoolSetSizeCall) (response)
/// * [locations clusters node pools update projects](ProjectLocationClusterNodePoolUpdateCall) (response)
/// * [locations clusters complete ip rotation projects](ProjectLocationClusterCompleteIpRotationCall) (response)
/// * [locations clusters create projects](ProjectLocationClusterCreateCall) (response)
/// * [locations clusters delete projects](ProjectLocationClusterDeleteCall) (response)
/// * [locations clusters set addons projects](ProjectLocationClusterSetAddonCall) (response)
/// * [locations clusters set legacy abac projects](ProjectLocationClusterSetLegacyAbacCall) (response)
/// * [locations clusters set locations projects](ProjectLocationClusterSetLocationCall) (response)
/// * [locations clusters set logging projects](ProjectLocationClusterSetLoggingCall) (response)
/// * [locations clusters set maintenance policy projects](ProjectLocationClusterSetMaintenancePolicyCall) (response)
/// * [locations clusters set master auth projects](ProjectLocationClusterSetMasterAuthCall) (response)
/// * [locations clusters set monitoring projects](ProjectLocationClusterSetMonitoringCall) (response)
/// * [locations clusters set network policy projects](ProjectLocationClusterSetNetworkPolicyCall) (response)
/// * [locations clusters set resource labels projects](ProjectLocationClusterSetResourceLabelCall) (response)
/// * [locations clusters start ip rotation projects](ProjectLocationClusterStartIpRotationCall) (response)
/// * [locations clusters update projects](ProjectLocationClusterUpdateCall) (response)
/// * [locations clusters update master projects](ProjectLocationClusterUpdateMasterCall) (response)
/// * [locations operations get projects](ProjectLocationOperationGetCall) (response)
/// * [zones clusters node pools autoscaling projects](ProjectZoneClusterNodePoolAutoscalingCall) (response)
/// * [zones clusters node pools create projects](ProjectZoneClusterNodePoolCreateCall) (response)
/// * [zones clusters node pools delete projects](ProjectZoneClusterNodePoolDeleteCall) (response)
/// * [zones clusters node pools rollback projects](ProjectZoneClusterNodePoolRollbackCall) (response)
/// * [zones clusters node pools set management projects](ProjectZoneClusterNodePoolSetManagementCall) (response)
/// * [zones clusters node pools set size projects](ProjectZoneClusterNodePoolSetSizeCall) (response)
/// * [zones clusters node pools update projects](ProjectZoneClusterNodePoolUpdateCall) (response)
/// * [zones clusters addons projects](ProjectZoneClusterAddonCall) (response)
/// * [zones clusters complete ip rotation projects](ProjectZoneClusterCompleteIpRotationCall) (response)
/// * [zones clusters create projects](ProjectZoneClusterCreateCall) (response)
/// * [zones clusters delete projects](ProjectZoneClusterDeleteCall) (response)
/// * [zones clusters legacy abac projects](ProjectZoneClusterLegacyAbacCall) (response)
/// * [zones clusters locations projects](ProjectZoneClusterLocationCall) (response)
/// * [zones clusters logging projects](ProjectZoneClusterLoggingCall) (response)
/// * [zones clusters master projects](ProjectZoneClusterMasterCall) (response)
/// * [zones clusters monitoring projects](ProjectZoneClusterMonitoringCall) (response)
/// * [zones clusters resource labels projects](ProjectZoneClusterResourceLabelCall) (response)
/// * [zones clusters set maintenance policy projects](ProjectZoneClusterSetMaintenancePolicyCall) (response)
/// * [zones clusters set master auth projects](ProjectZoneClusterSetMasterAuthCall) (response)
/// * [zones clusters set network policy projects](ProjectZoneClusterSetNetworkPolicyCall) (response)
/// * [zones clusters start ip rotation projects](ProjectZoneClusterStartIpRotationCall) (response)
/// * [zones clusters update projects](ProjectZoneClusterUpdateCall) (response)
/// * [zones operations get projects](ProjectZoneOperationGetCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Operation {
/// Which conditions caused the current cluster state. Deprecated. Use field error instead.
#[serde(rename = "clusterConditions")]
pub cluster_conditions: Option<Vec<StatusCondition>>,
/// Output only. Detailed operation progress, if available.
pub detail: Option<String>,
/// Output only. The time the operation completed, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
#[serde(rename = "endTime")]
pub end_time: Option<String>,
/// The error result of the operation in case of failure.
pub error: Option<Status>,
/// 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.
pub location: Option<String>,
/// Output only. The server-assigned ID for the operation.
pub name: Option<String>,
/// Which conditions caused the current node pool state. Deprecated. Use field error instead.
#[serde(rename = "nodepoolConditions")]
pub nodepool_conditions: Option<Vec<StatusCondition>>,
/// Output only. The operation type.
#[serde(rename = "operationType")]
pub operation_type: Option<String>,
/// Output only. Progress information for an operation.
pub progress: Option<OperationProgress>,
/// Output only. Server-defined URI for the operation. Example: `https://container.googleapis.com/v1alpha1/projects/123/locations/us-central1/operations/operation-123`.
#[serde(rename = "selfLink")]
pub self_link: Option<String>,
/// Output only. The time the operation started, in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
#[serde(rename = "startTime")]
pub start_time: Option<String>,
/// Output only. The current status of the operation.
pub status: Option<String>,
/// Output only. If an error has occurred, a textual description of the error. Deprecated. Use the field error instead.
#[serde(rename = "statusMessage")]
pub status_message: Option<String>,
/// 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`
#[serde(rename = "targetLink")]
pub target_link: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::ResponseResult for Operation {}
/// OperationError records errors seen from CloudKMS keys encountered during updates to DatabaseEncryption configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct OperationError {
/// Description of the error seen during the operation.
#[serde(rename = "errorMessage")]
pub error_message: Option<String>,
/// CloudKMS key resource that had the error.
#[serde(rename = "keyName")]
pub key_name: Option<String>,
/// Time when the CloudKMS error was seen.
pub timestamp: Option<chrono::DateTime<chrono::offset::Utc>>,
}
impl common::Part for OperationError {}
/// Information about operation (or operation stage) progress.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct OperationProgress {
/// 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}]
pub metrics: Option<Vec<Metric>>,
/// A non-parameterized string describing an operation stage. Unset for single-stage operations.
pub name: Option<String>,
/// Substages of an operation or a stage.
pub stages: Option<Vec<OperationProgress>>,
/// Status of an operation stage. Unset for single-stage operations.
pub status: Option<String>,
}
impl common::Part for OperationProgress {}
/// Configuration for the Cloud Storage Parallelstore CSI driver.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ParallelstoreCsiDriverConfig {
/// Whether the Cloud Storage Parallelstore CSI driver is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for ParallelstoreCsiDriverConfig {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ParentProductConfig {
/// Labels contain the configuration of the parent product.
pub labels: Option<HashMap<String, String>>,
/// Name of the parent product associated with the cluster.
#[serde(rename = "productName")]
pub product_name: Option<String>,
}
impl common::Part for ParentProductConfig {}
/// PlacementPolicy defines the placement policy used by the node pool.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PlacementPolicy {
/// 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.
#[serde(rename = "policyName")]
pub policy_name: Option<String>,
/// Optional. TPU placement topology for pod slice node pool. https://cloud.google.com/tpu/docs/types-topologies#tpu_topologies
#[serde(rename = "tpuTopology")]
pub tpu_topology: Option<String>,
/// The type of placement.
#[serde(rename = "type")]
pub type_: Option<String>,
}
impl common::Part for PlacementPolicy {}
/// PodAutoscaling is used for configuration of parameters for workload autoscaling.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PodAutoscaling {
/// Selected Horizontal Pod Autoscaling profile.
#[serde(rename = "hpaProfile")]
pub hpa_profile: Option<String>,
}
impl common::Part for PodAutoscaling {}
/// [PRIVATE FIELD] Config for pod CIDR size overprovisioning.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PodCIDROverprovisionConfig {
/// Whether Pod CIDR overprovisioning is disabled. Note: Pod CIDR overprovisioning is enabled by default.
pub disable: Option<bool>,
}
impl common::Part for PodCIDROverprovisionConfig {}
/// Configuration options for private clusters.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PrivateClusterConfig {
/// 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.
#[serde(rename = "enablePrivateEndpoint")]
pub enable_private_endpoint: Option<bool>,
/// 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.
#[serde(rename = "enablePrivateNodes")]
pub enable_private_nodes: Option<bool>,
/// Controls master global access settings. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.enable_global_access instead.
#[serde(rename = "masterGlobalAccessConfig")]
pub master_global_access_config: Option<PrivateClusterMasterGlobalAccessConfig>,
/// 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.
#[serde(rename = "masterIpv4CidrBlock")]
pub master_ipv4_cidr_block: Option<String>,
/// Output only. The peering name in the customer VPC used by this cluster.
#[serde(rename = "peeringName")]
pub peering_name: Option<String>,
/// Output only. The internal IP address of this cluster's master endpoint. Deprecated: Use ControlPlaneEndpointsConfig.IPEndpointsConfig.private_endpoint instead.
#[serde(rename = "privateEndpoint")]
pub private_endpoint: Option<String>,
/// 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.
#[serde(rename = "privateEndpointSubnetwork")]
pub private_endpoint_subnetwork: Option<String>,
/// Output only. The external IP address of this cluster's master endpoint. Deprecated:Use ControlPlaneEndpointsConfig.IPEndpointsConfig.public_endpoint instead.
#[serde(rename = "publicEndpoint")]
pub public_endpoint: Option<String>,
}
impl common::Part for PrivateClusterConfig {}
/// Configuration for controlling master global access settings.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PrivateClusterMasterGlobalAccessConfig {
/// Whenever master is accessible globally or not.
pub enabled: Option<bool>,
}
impl common::Part for PrivateClusterMasterGlobalAccessConfig {}
/// PrivateRegistryAccessConfig contains access configuration for private container registries.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PrivateRegistryAccessConfig {
/// Private registry access configuration.
#[serde(rename = "certificateAuthorityDomainConfig")]
pub certificate_authority_domain_config: Option<Vec<CertificateAuthorityDomainConfig>>,
/// Private registry access is enabled.
pub enabled: Option<bool>,
}
impl common::Part for PrivateRegistryAccessConfig {}
/// PrivilegedAdmissionConfig stores the list of authorized allowlist paths for the cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PrivilegedAdmissionConfig {
/// 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.
#[serde(rename = "allowlistPaths")]
pub allowlist_paths: Option<Vec<String>>,
}
impl common::Part for PrivilegedAdmissionConfig {}
/// Pub/Sub specific notification config.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct PubSub {
/// Enable notifications for Pub/Sub.
pub enabled: Option<bool>,
/// 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
pub filter: Option<Filter>,
/// The desired Pub/Sub topic to which notifications will be sent by GKE. Format is `projects/{project}/topics/{topic}`.
pub topic: Option<String>,
}
impl common::Part for PubSub {}
/// QueuedProvisioning defines the queued provisioning used by the node pool.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct QueuedProvisioning {
/// Denotes that this nodepool is QRM specific, meaning nodes can be only obtained through queuing via the Cluster Autoscaler ProvisioningRequest API.
pub enabled: Option<bool>,
}
impl common::Part for QueuedProvisioning {}
/// RBACBindingConfig allows user to restrict ClusterRoleBindings an RoleBindings that can be created.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RBACBindingConfig {
/// Setting this to true will allow any ClusterRoleBinding and RoleBinding with subjects system:authenticated.
#[serde(rename = "enableInsecureBindingSystemAuthenticated")]
pub enable_insecure_binding_system_authenticated: Option<bool>,
/// Setting this to true will allow any ClusterRoleBinding and RoleBinding with subjets system:anonymous or system:unauthenticated.
#[serde(rename = "enableInsecureBindingSystemUnauthenticated")]
pub enable_insecure_binding_system_unauthenticated: Option<bool>,
}
impl common::Part for RBACBindingConfig {}
/// RangeInfo contains the range name and the range utilization by this cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RangeInfo {
/// Output only. Name of a range.
#[serde(rename = "rangeName")]
pub range_name: Option<String>,
/// Output only. The utilization of the range.
pub utilization: Option<f64>,
}
impl common::Part for RangeInfo {}
/// RayClusterLoggingConfig specifies configuration of Ray logging.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RayClusterLoggingConfig {
/// Enable log collection for Ray clusters.
pub enabled: Option<bool>,
}
impl common::Part for RayClusterLoggingConfig {}
/// RayClusterMonitoringConfig specifies monitoring configuration for Ray clusters.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RayClusterMonitoringConfig {
/// Enable metrics collection for Ray clusters.
pub enabled: Option<bool>,
}
impl common::Part for RayClusterMonitoringConfig {}
/// Configuration options for the Ray Operator add-on.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RayOperatorConfig {
/// Whether the Ray Operator addon is enabled for this cluster.
pub enabled: Option<bool>,
/// Optional. Logging configuration for Ray clusters.
#[serde(rename = "rayClusterLoggingConfig")]
pub ray_cluster_logging_config: Option<RayClusterLoggingConfig>,
/// Optional. Monitoring configuration for Ray clusters.
#[serde(rename = "rayClusterMonitoringConfig")]
pub ray_cluster_monitoring_config: Option<RayClusterMonitoringConfig>,
}
impl common::Part for RayOperatorConfig {}
/// Represents an arbitrary window of time that recurs.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RecurringTimeWindow {
/// 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.
pub recurrence: Option<String>,
/// The window of the first recurrence.
pub window: Option<TimeWindow>,
}
impl common::Part for RecurringTimeWindow {}
/// RegistryHeader configures headers for the registry.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RegistryHeader {
/// Key configures the header key.
pub key: Option<String>,
/// Value configures the header value.
pub value: Option<Vec<String>>,
}
impl common::Part for RegistryHeader {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RegistryHostConfig {
/// HostConfig configures a list of host-specific configurations for the server. Each server can have at most 10 host configurations.
pub hosts: Option<Vec<HostConfig>>,
/// 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
pub server: Option<String>,
}
impl common::Part for RegistryHostConfig {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ReleaseChannel {
/// channel specifies which release channel the cluster is subscribed to.
pub channel: Option<String>,
}
impl common::Part for ReleaseChannel {}
/// ReleaseChannelConfig exposes configuration for a release channel.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ReleaseChannelConfig {
/// The release channel this configuration applies to.
pub channel: Option<String>,
/// The default version for newly created clusters on the channel.
#[serde(rename = "defaultVersion")]
pub default_version: Option<String>,
/// The auto upgrade target version for clusters on the channel.
#[serde(rename = "upgradeTargetVersion")]
pub upgrade_target_version: Option<String>,
/// List of valid versions for the channel.
#[serde(rename = "validVersions")]
pub valid_versions: Option<Vec<String>>,
}
impl common::Part for ReleaseChannelConfig {}
/// [ReservationAffinity](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources) is the configuration of desired reservation which instances could take capacity from.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ReservationAffinity {
/// Corresponds to the type of reservation consumption.
#[serde(rename = "consumeReservationType")]
pub consume_reservation_type: Option<String>,
/// 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.
pub key: Option<String>,
/// Corresponds to the label value(s) of reservation resource(s).
pub values: Option<Vec<String>>,
}
impl common::Part for ReservationAffinity {}
/// Collection of [Resource Manager labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ResourceLabels {
/// Map of node label keys and node label values.
pub labels: Option<HashMap<String, String>>,
}
impl common::Part for ResourceLabels {}
/// Contains information about amount of some resource in the cluster. For memory, value should be in GB.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ResourceLimit {
/// Maximum amount of the resource in the cluster.
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub maximum: Option<i64>,
/// Minimum amount of the resource in the cluster.
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub minimum: Option<i64>,
/// Resource name "cpu", "memory" or gpu-specific string.
#[serde(rename = "resourceType")]
pub resource_type: Option<String>,
}
impl common::Part for ResourceLimit {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ResourceManagerTags {
/// 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}`
pub tags: Option<HashMap<String, String>>,
}
impl common::Part for ResourceManagerTags {}
/// Configuration for exporting cluster resource usages.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ResourceUsageExportConfig {
/// Configuration to use BigQuery as usage export destination.
#[serde(rename = "bigqueryDestination")]
pub bigquery_destination: Option<BigQueryDestination>,
/// Configuration to enable resource consumption metering.
#[serde(rename = "consumptionMeteringConfig")]
pub consumption_metering_config: Option<ConsumptionMeteringConfig>,
/// Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic.
#[serde(rename = "enableNetworkEgressMetering")]
pub enable_network_egress_metering: Option<bool>,
}
impl common::Part for ResourceUsageExportConfig {}
/// RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed NodePool upgrade. This will be an no-op if the last upgrade successfully completed.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools rollback projects](ProjectLocationClusterNodePoolRollbackCall) (request)
/// * [zones clusters node pools rollback projects](ProjectZoneClusterNodePoolRollbackCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RollbackNodePoolUpgradeRequest {
/// Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub name: Option<String>,
/// Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
#[serde(rename = "nodePoolId")]
pub node_pool_id: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// Option for rollback to ignore the PodDisruptionBudget. Default value is false.
#[serde(rename = "respectPdb")]
pub respect_pdb: Option<bool>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for RollbackNodePoolUpgradeRequest {}
/// RotationConfig is config for secret manager auto rotation.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct RotationConfig {
/// Whether the rotation is enabled.
pub enabled: Option<bool>,
/// The interval between two consecutive rotations. Default rotation interval is 2 minutes.
#[serde(rename = "rotationInterval")]
#[serde_as(as = "Option<common::serde::duration::Wrapper>")]
pub rotation_interval: Option<chrono::Duration>,
}
impl common::Part for RotationConfig {}
/// SandboxConfig contains configurations of the sandbox to use for the node.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SandboxConfig {
/// Type of the sandbox to use for the node.
#[serde(rename = "type")]
pub type_: Option<String>,
}
impl common::Part for SandboxConfig {}
/// SecondaryBootDisk represents a persistent disk attached to a node with special configurations based on its mode.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SecondaryBootDisk {
/// Fully-qualified resource ID for an existing disk image.
#[serde(rename = "diskImage")]
pub disk_image: Option<String>,
/// Disk mode (container image cache, etc.)
pub mode: Option<String>,
}
impl common::Part for SecondaryBootDisk {}
/// SecondaryBootDiskUpdateStrategy is a placeholder which will be extended in the future to define different options for updating secondary boot disks.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SecondaryBootDiskUpdateStrategy {
_never_set: Option<bool>,
}
impl common::Part for SecondaryBootDiskUpdateStrategy {}
/// SecretManagerConfig is config for secret manager enablement.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SecretManagerConfig {
/// Enable/Disable Secret Manager Config.
pub enabled: Option<bool>,
/// Rotation config for secret manager.
#[serde(rename = "rotationConfig")]
pub rotation_config: Option<RotationConfig>,
}
impl common::Part for SecretManagerConfig {}
/// SecurityPostureConfig defines the flags needed to enable/disable features for the Security Posture API.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SecurityPostureConfig {
/// Sets which mode to use for Security Posture features.
pub mode: Option<String>,
/// Sets which mode to use for vulnerability scanning.
#[serde(rename = "vulnerabilityMode")]
pub vulnerability_mode: Option<String>,
}
impl common::Part for SecurityPostureConfig {}
/// Kubernetes Engine service configuration.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations get server config projects](ProjectLocationGetServerConfigCall) (response)
/// * [zones get serverconfig projects](ProjectZoneGetServerconfigCall) (response)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ServerConfig {
/// List of release channel configurations.
pub channels: Option<Vec<ReleaseChannelConfig>>,
/// Version of Kubernetes the service deploys by default.
#[serde(rename = "defaultClusterVersion")]
pub default_cluster_version: Option<String>,
/// Default image type.
#[serde(rename = "defaultImageType")]
pub default_image_type: Option<String>,
/// List of valid image types.
#[serde(rename = "validImageTypes")]
pub valid_image_types: Option<Vec<String>>,
/// List of valid master versions, in descending order.
#[serde(rename = "validMasterVersions")]
pub valid_master_versions: Option<Vec<String>>,
/// List of valid node upgrade target versions, in descending order.
#[serde(rename = "validNodeVersions")]
pub valid_node_versions: Option<Vec<String>>,
}
impl common::ResponseResult for ServerConfig {}
/// Config to block services with externalIPs field.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ServiceExternalIPsConfig {
/// Whether Services with ExternalIPs field are allowed or not.
pub enabled: Option<bool>,
}
impl common::Part for ServiceExternalIPsConfig {}
/// SetAddonsConfigRequest sets the addons associated with the cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set addons projects](ProjectLocationClusterSetAddonCall) (request)
/// * [zones clusters addons projects](ProjectZoneClusterAddonCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetAddonsConfigRequest {
/// Required. The desired configurations for the various addons available to run in the cluster.
#[serde(rename = "addonsConfig")]
pub addons_config: Option<AddonsConfig>,
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetAddonsConfigRequest {}
/// 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
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set resource labels projects](ProjectLocationClusterSetResourceLabelCall) (request)
/// * [zones clusters resource labels projects](ProjectZoneClusterResourceLabelCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetLabelsRequest {
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// 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.
#[serde(rename = "labelFingerprint")]
pub label_fingerprint: Option<String>,
/// The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// Required. The labels to set for that cluster.
#[serde(rename = "resourceLabels")]
pub resource_labels: Option<HashMap<String, String>>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetLabelsRequest {}
/// SetLegacyAbacRequest enables or disables the ABAC authorization mechanism for a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set legacy abac projects](ProjectLocationClusterSetLegacyAbacCall) (request)
/// * [zones clusters legacy abac projects](ProjectZoneClusterLegacyAbacCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetLegacyAbacRequest {
/// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// Required. Whether ABAC authorization will be enabled in the cluster.
pub enabled: Option<bool>,
/// The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetLegacyAbacRequest {}
/// SetLocationsRequest sets the locations of the cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set locations projects](ProjectLocationClusterSetLocationCall) (request)
/// * [zones clusters locations projects](ProjectZoneClusterLocationCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetLocationsRequest {
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// 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.
pub locations: Option<Vec<String>>,
/// The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetLocationsRequest {}
/// SetLoggingServiceRequest sets the logging service of a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set logging projects](ProjectLocationClusterSetLoggingCall) (request)
/// * [zones clusters logging projects](ProjectZoneClusterLoggingCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetLoggingServiceRequest {
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// 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.
#[serde(rename = "loggingService")]
pub logging_service: Option<String>,
/// The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetLoggingServiceRequest {}
/// SetMaintenancePolicyRequest sets the maintenance policy for a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set maintenance policy projects](ProjectLocationClusterSetMaintenancePolicyCall) (request)
/// * [zones clusters set maintenance policy projects](ProjectZoneClusterSetMaintenancePolicyCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetMaintenancePolicyRequest {
/// Required. The name of the cluster to update.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// Required. The maintenance policy to be set for the cluster. An empty field clears the existing maintenance policy.
#[serde(rename = "maintenancePolicy")]
pub maintenance_policy: Option<MaintenancePolicy>,
/// The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
pub zone: Option<String>,
}
impl common::RequestValue for SetMaintenancePolicyRequest {}
/// SetMasterAuthRequest updates the admin password of a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set master auth projects](ProjectLocationClusterSetMasterAuthCall) (request)
/// * [zones clusters set master auth projects](ProjectZoneClusterSetMasterAuthCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetMasterAuthRequest {
/// Required. The exact form of action to be taken on the master auth.
pub action: Option<String>,
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// Required. A description of the update.
pub update: Option<MasterAuth>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetMasterAuthRequest {}
/// SetMonitoringServiceRequest sets the monitoring service of a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set monitoring projects](ProjectLocationClusterSetMonitoringCall) (request)
/// * [zones clusters monitoring projects](ProjectZoneClusterMonitoringCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetMonitoringServiceRequest {
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// 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.
#[serde(rename = "monitoringService")]
pub monitoring_service: Option<String>,
/// The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetMonitoringServiceRequest {}
/// SetNetworkPolicyRequest enables/disables network policy for a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters set network policy projects](ProjectLocationClusterSetNetworkPolicyCall) (request)
/// * [zones clusters set network policy projects](ProjectZoneClusterSetNetworkPolicyCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetNetworkPolicyRequest {
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// Required. Configuration options for the NetworkPolicy feature.
#[serde(rename = "networkPolicy")]
pub network_policy: Option<NetworkPolicy>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetNetworkPolicyRequest {}
/// SetNodePoolAutoscalingRequest sets the autoscaler settings of a node pool.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools set autoscaling projects](ProjectLocationClusterNodePoolSetAutoscalingCall) (request)
/// * [zones clusters node pools autoscaling projects](ProjectZoneClusterNodePoolAutoscalingCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetNodePoolAutoscalingRequest {
/// Required. Autoscaling configuration for the node pool.
pub autoscaling: Option<NodePoolAutoscaling>,
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub name: Option<String>,
/// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "nodePoolId")]
pub node_pool_id: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetNodePoolAutoscalingRequest {}
/// SetNodePoolManagementRequest sets the node management properties of a node pool.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools set management projects](ProjectLocationClusterNodePoolSetManagementCall) (request)
/// * [zones clusters node pools set management projects](ProjectZoneClusterNodePoolSetManagementCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetNodePoolManagementRequest {
/// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// Required. NodeManagement configuration for the node pool.
pub management: Option<NodeManagement>,
/// The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub name: Option<String>,
/// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
#[serde(rename = "nodePoolId")]
pub node_pool_id: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetNodePoolManagementRequest {}
/// SetNodePoolSizeRequest sets the size of a node pool.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools set size projects](ProjectLocationClusterNodePoolSetSizeCall) (request)
/// * [zones clusters node pools set size projects](ProjectZoneClusterNodePoolSetSizeCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SetNodePoolSizeRequest {
/// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub name: Option<String>,
/// Required. The desired node count for the pool.
#[serde(rename = "nodeCount")]
pub node_count: Option<i32>,
/// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
#[serde(rename = "nodePoolId")]
pub node_pool_id: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for SetNodePoolSizeRequest {}
/// A set of Shielded Instance options.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ShieldedInstanceConfig {
/// 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.
#[serde(rename = "enableIntegrityMonitoring")]
pub enable_integrity_monitoring: Option<bool>,
/// 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.
#[serde(rename = "enableSecureBoot")]
pub enable_secure_boot: Option<bool>,
}
impl common::Part for ShieldedInstanceConfig {}
/// Configuration of Shielded Nodes feature.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ShieldedNodes {
/// Whether Shielded Nodes features are enabled on all nodes in this cluster.
pub enabled: Option<bool>,
}
impl common::Part for ShieldedNodes {}
/// SoleTenantConfig contains the NodeAffinities to specify what shared sole tenant node groups should back the node pool.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct SoleTenantConfig {
/// 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.
#[serde(rename = "minNodeCpus")]
pub min_node_cpus: Option<i32>,
/// NodeAffinities used to match to a shared sole tenant node group.
#[serde(rename = "nodeAffinities")]
pub node_affinities: Option<Vec<NodeAffinity>>,
}
impl common::Part for SoleTenantConfig {}
/// Standard rollout policy is the default policy for blue-green.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct StandardRolloutPolicy {
/// Number of blue nodes to drain in a batch.
#[serde(rename = "batchNodeCount")]
pub batch_node_count: Option<i32>,
/// Percentage of the blue pool nodes to drain in a batch. The range of this field should be (0.0, 1.0].
#[serde(rename = "batchPercentage")]
pub batch_percentage: Option<f32>,
/// Soak time after each batch gets drained. Default to zero.
#[serde(rename = "batchSoakDuration")]
#[serde_as(as = "Option<common::serde::duration::Wrapper>")]
pub batch_soak_duration: Option<chrono::Duration>,
}
impl common::Part for StandardRolloutPolicy {}
/// StartIPRotationRequest creates a new IP for the cluster and then performs a node upgrade on each node pool to point to the new IP.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters start ip rotation projects](ProjectLocationClusterStartIpRotationCall) (request)
/// * [zones clusters start ip rotation projects](ProjectZoneClusterStartIpRotationCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct StartIPRotationRequest {
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// Whether to rotate credentials during IP rotation.
#[serde(rename = "rotateCredentials")]
pub rotate_credentials: Option<bool>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for StartIPRotationRequest {}
/// Configuration for the Stateful HA add-on.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct StatefulHAConfig {
/// Whether the Stateful HA add-on is enabled for this cluster.
pub enabled: Option<bool>,
}
impl common::Part for StatefulHAConfig {}
/// 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).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct Status {
/// The status code, which should be an enum value of google.rpc.Code.
pub code: Option<i32>,
/// A list of messages that carry the error details. There is a common set of message types for APIs to use.
pub details: Option<Vec<HashMap<String, serde_json::Value>>>,
/// 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.
pub message: Option<String>,
}
impl common::Part for Status {}
/// StatusCondition describes why a cluster or a node pool has a certain status (e.g., ERROR or DEGRADED).
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct StatusCondition {
/// Canonical code of the condition.
#[serde(rename = "canonicalCode")]
pub canonical_code: Option<String>,
/// Machine-friendly representation of the condition Deprecated. Use canonical_code instead.
pub code: Option<String>,
/// Human-friendly representation of the condition
pub message: Option<String>,
}
impl common::Part for StatusCondition {}
/// Represents an arbitrary window of time.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct TimeWindow {
/// The time that the window ends. The end time should take place after the start time.
#[serde(rename = "endTime")]
pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
/// MaintenanceExclusionOptions provides maintenance exclusion related options.
#[serde(rename = "maintenanceExclusionOptions")]
pub maintenance_exclusion_options: Option<MaintenanceExclusionOptions>,
/// The time that the window first starts.
#[serde(rename = "startTime")]
pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
}
impl common::Part for TimeWindow {}
/// TopologyManager defines the configuration options for Topology Manager feature. See https://kubernetes.io/docs/tasks/administer-cluster/topology-manager/
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct TopologyManager {
/// 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).
pub policy: Option<String>,
/// 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
pub scope: Option<String>,
}
impl common::Part for TopologyManager {}
/// UpdateClusterRequest updates the settings of a cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters update projects](ProjectLocationClusterUpdateCall) (request)
/// * [zones clusters update projects](ProjectZoneClusterUpdateCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UpdateClusterRequest {
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// Required. A description of the update.
pub update: Option<ClusterUpdate>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for UpdateClusterRequest {}
/// UpdateInfo contains resource (instance groups, etc), status and other intermediate information relevant to a node pool upgrade.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UpdateInfo {
/// Information of a blue-green upgrade.
#[serde(rename = "blueGreenInfo")]
pub blue_green_info: Option<BlueGreenInfo>,
}
impl common::Part for UpdateInfo {}
/// UpdateMasterRequest updates the master of the cluster.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters update master projects](ProjectLocationClusterUpdateMasterCall) (request)
/// * [zones clusters master projects](ProjectZoneClusterMasterCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UpdateMasterRequest {
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// 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
#[serde(rename = "masterVersion")]
pub master_version: Option<String>,
/// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
pub name: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for UpdateMasterRequest {}
/// UpdateNodePoolRequests update a node pool’s image and/or version.
///
/// # Activities
///
/// This type is used in activities, which are methods you may call on this type or where this type is involved in.
/// The list links the activity name, along with information about where it is used (one of *request* and *response*).
///
/// * [locations clusters node pools update projects](ProjectLocationClusterNodePoolUpdateCall) (request)
/// * [zones clusters node pools update projects](ProjectZoneClusterNodePoolUpdateCall) (request)
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UpdateNodePoolRequest {
/// 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.
pub accelerators: Option<Vec<AcceleratorConfig>>,
/// 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.
#[serde(rename = "bootDisk")]
pub boot_disk: Option<BootDisk>,
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "clusterId")]
pub cluster_id: Option<String>,
/// Confidential nodes config. All the nodes in the node pool will be Confidential VM once enabled.
#[serde(rename = "confidentialNodes")]
pub confidential_nodes: Option<ConfidentialNodes>,
/// The desired containerd config for nodes in the node pool. Initiates an upgrade operation that recreates the nodes with the new config.
#[serde(rename = "containerdConfig")]
pub containerd_config: Option<ContainerdConfig>,
/// 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.
#[serde(rename = "diskSizeGb")]
#[serde_as(as = "Option<serde_with::DisplayFromStr>")]
pub disk_size_gb: Option<i64>,
/// 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.
#[serde(rename = "diskType")]
pub disk_type: Option<String>,
/// 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.
pub etag: Option<String>,
/// Enable or disable NCCL fast socket for the node pool.
#[serde(rename = "fastSocket")]
pub fast_socket: Option<FastSocket>,
/// Flex Start flag for enabling Flex Start VM.
#[serde(rename = "flexStart")]
pub flex_start: Option<bool>,
/// GCFS config.
#[serde(rename = "gcfsConfig")]
pub gcfs_config: Option<GcfsConfig>,
/// Enable or disable gvnic on the node pool.
pub gvnic: Option<VirtualNIC>,
/// 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.
#[serde(rename = "imageType")]
pub image_type: Option<String>,
/// Node kubelet configs.
#[serde(rename = "kubeletConfig")]
pub kubelet_config: Option<NodeKubeletConfig>,
/// 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.
pub labels: Option<NodeLabels>,
/// Parameters that can be configured on Linux nodes.
#[serde(rename = "linuxNodeConfig")]
pub linux_node_config: Option<LinuxNodeConfig>,
/// 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.
pub locations: Option<Vec<String>>,
/// Logging configuration.
#[serde(rename = "loggingConfig")]
pub logging_config: Option<NodePoolLoggingConfig>,
/// 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.
#[serde(rename = "machineType")]
pub machine_type: Option<String>,
/// The maximum duration for the nodes to exist. If unspecified, the nodes can exist indefinitely.
#[serde(rename = "maxRunDuration")]
#[serde_as(as = "Option<common::serde::duration::Wrapper>")]
pub max_run_duration: Option<chrono::Duration>,
/// The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub name: Option<String>,
/// The desired node drain configuration for nodes in the node pool.
#[serde(rename = "nodeDrainConfig")]
pub node_drain_config: Option<NodeDrainConfig>,
/// Node network config.
#[serde(rename = "nodeNetworkConfig")]
pub node_network_config: Option<NodeNetworkConfig>,
/// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
#[serde(rename = "nodePoolId")]
pub node_pool_id: Option<String>,
/// 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
#[serde(rename = "nodeVersion")]
pub node_version: Option<String>,
/// 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.
#[serde(rename = "projectId")]
pub project_id: Option<String>,
/// Specifies the configuration of queued provisioning.
#[serde(rename = "queuedProvisioning")]
pub queued_provisioning: Option<QueuedProvisioning>,
/// The resource labels for the node pool to use to annotate any related Google Compute Engine resources.
#[serde(rename = "resourceLabels")]
pub resource_labels: Option<ResourceLabels>,
/// 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.
#[serde(rename = "resourceManagerTags")]
pub resource_manager_tags: Option<ResourceManagerTags>,
/// List of Storage Pools where boot disks are provisioned. Existing Storage Pools will be replaced with storage-pools.
#[serde(rename = "storagePools")]
pub storage_pools: Option<Vec<String>>,
/// 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.
pub tags: Option<NetworkTags>,
/// 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.
pub taints: Option<NodeTaints>,
/// Upgrade settings control disruption and speed of the upgrade.
#[serde(rename = "upgradeSettings")]
pub upgrade_settings: Option<UpgradeSettings>,
/// Parameters that can be configured on Windows nodes.
#[serde(rename = "windowsNodeConfig")]
pub windows_node_config: Option<WindowsNodeConfig>,
/// The desired workload metadata config for the node pool.
#[serde(rename = "workloadMetadataConfig")]
pub workload_metadata_config: Option<WorkloadMetadataConfig>,
/// 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.
pub zone: Option<String>,
}
impl common::RequestValue for UpdateNodePoolRequest {}
/// UpgradeDetails contains detailed information of each individual upgrade operation.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UpgradeDetails {
/// The end timestamp of the upgrade.
#[serde(rename = "endTime")]
pub end_time: Option<chrono::DateTime<chrono::offset::Utc>>,
/// The version before the upgrade.
#[serde(rename = "initialVersion")]
pub initial_version: Option<String>,
/// The start timestamp of the upgrade.
#[serde(rename = "startTime")]
pub start_time: Option<chrono::DateTime<chrono::offset::Utc>>,
/// The start type of the upgrade.
#[serde(rename = "startType")]
pub start_type: Option<String>,
/// Output only. The state of the upgrade.
pub state: Option<String>,
/// The version after the upgrade.
#[serde(rename = "targetVersion")]
pub target_version: Option<String>,
}
impl common::Part for UpgradeDetails {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UpgradeSettings {
/// Settings for blue-green upgrade strategy.
#[serde(rename = "blueGreenSettings")]
pub blue_green_settings: Option<BlueGreenSettings>,
/// The maximum number of nodes that can be created beyond the current size of the node pool during the upgrade process.
#[serde(rename = "maxSurge")]
pub max_surge: Option<i32>,
/// The maximum number of nodes that can be simultaneously unavailable during the upgrade process. A node is considered available if its status is Ready.
#[serde(rename = "maxUnavailable")]
pub max_unavailable: Option<i32>,
/// Update strategy of the node pool.
pub strategy: Option<String>,
}
impl common::Part for UpgradeSettings {}
/// UsableSubnetwork resource returns the subnetwork name, its associated network and the primary CIDR range.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UsableSubnetwork {
/// The range of internal addresses that are owned by this subnetwork.
#[serde(rename = "ipCidrRange")]
pub ip_cidr_range: Option<String>,
/// Network Name. Example: projects/my-project/global/networks/my-network
pub network: Option<String>,
/// Secondary IP ranges.
#[serde(rename = "secondaryIpRanges")]
pub secondary_ip_ranges: Option<Vec<UsableSubnetworkSecondaryRange>>,
/// 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.
#[serde(rename = "statusMessage")]
pub status_message: Option<String>,
/// Subnetwork Name. Example: projects/my-project/regions/us-central1/subnetworks/my-subnet
pub subnetwork: Option<String>,
}
impl common::Part for UsableSubnetwork {}
/// Secondary IP range of a usable subnetwork.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UsableSubnetworkSecondaryRange {
/// The range of IP addresses belonging to this subnetwork secondary range.
#[serde(rename = "ipCidrRange")]
pub ip_cidr_range: Option<String>,
/// The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.
#[serde(rename = "rangeName")]
pub range_name: Option<String>,
/// This field is to determine the status of the secondary range programmably.
pub status: Option<String>,
}
impl common::Part for UsableSubnetworkSecondaryRange {}
/// UserManagedKeysConfig holds the resource address to Keys which are used for signing certs and token that are used for communication within cluster.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct UserManagedKeysConfig {
/// The Certificate Authority Service caPool to use for the aggregation CA in this cluster.
#[serde(rename = "aggregationCa")]
pub aggregation_ca: Option<String>,
/// The Certificate Authority Service caPool to use for the cluster CA in this cluster.
#[serde(rename = "clusterCa")]
pub cluster_ca: Option<String>,
/// The Cloud KMS cryptoKey to use for Confidential Hyperdisk on the control plane nodes.
#[serde(rename = "controlPlaneDiskEncryptionKey")]
pub control_plane_disk_encryption_key: Option<String>,
/// Output only. All of the versions of the Cloud KMS cryptoKey that are used by Confidential Hyperdisks on the control plane nodes.
#[serde(rename = "controlPlaneDiskEncryptionKeyVersions")]
pub control_plane_disk_encryption_key_versions: Option<Vec<String>>,
/// Resource path of the Certificate Authority Service caPool to use for the etcd API CA in this cluster.
#[serde(rename = "etcdApiCa")]
pub etcd_api_ca: Option<String>,
/// Resource path of the Certificate Authority Service caPool to use for the etcd peer CA in this cluster.
#[serde(rename = "etcdPeerCa")]
pub etcd_peer_ca: Option<String>,
/// Resource path of the Cloud KMS cryptoKey to use for encryption of internal etcd backups.
#[serde(rename = "gkeopsEtcdBackupEncryptionKey")]
pub gkeops_etcd_backup_encryption_key: Option<String>,
/// 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}`
#[serde(rename = "serviceAccountSigningKeys")]
pub service_account_signing_keys: Option<Vec<String>>,
/// 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}`
#[serde(rename = "serviceAccountVerificationKeys")]
pub service_account_verification_keys: Option<Vec<String>>,
}
impl common::Part for UserManagedKeysConfig {}
/// VerticalPodAutoscaling contains global, per-cluster information required by Vertical Pod Autoscaler to automatically adjust the resources of pods controlled by it.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct VerticalPodAutoscaling {
/// Enables vertical pod autoscaling.
pub enabled: Option<bool>,
}
impl common::Part for VerticalPodAutoscaling {}
/// Configuration of gVNIC feature.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct VirtualNIC {
/// Whether gVNIC features are enabled in the node pool.
pub enabled: Option<bool>,
}
impl common::Part for VirtualNIC {}
/// 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.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct WindowsNodeConfig {
/// OSVersion specifies the Windows node config to be used on the node.
#[serde(rename = "osVersion")]
pub os_version: Option<String>,
}
impl common::Part for WindowsNodeConfig {}
/// Configuration for the use of Kubernetes Service Accounts in IAM policies.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct WorkloadIdentityConfig {
/// The workload pool to attach all Kubernetes service accounts to.
#[serde(rename = "workloadPool")]
pub workload_pool: Option<String>,
}
impl common::Part for WorkloadIdentityConfig {}
/// WorkloadMetadataConfig defines the metadata configuration to expose to workloads on the node pool.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct WorkloadMetadataConfig {
/// Mode is the configuration for how to expose metadata to workloads running on the node pool.
pub mode: Option<String>,
}
impl common::Part for WorkloadMetadataConfig {}
/// WorkloadPolicyConfig is the configuration related to GCW workload policy
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct WorkloadPolicyConfig {
/// If true, workloads can use NET_ADMIN capability.
#[serde(rename = "allowNetAdmin")]
pub allow_net_admin: Option<bool>,
/// If true, enables the GCW Auditor that audits workloads on standard clusters.
#[serde(rename = "autopilotCompatibilityAuditingEnabled")]
pub autopilot_compatibility_auditing_enabled: Option<bool>,
}
impl common::Part for WorkloadPolicyConfig {}
/// Defines writable cgroups configuration.
///
/// This type is not used in any activity, and only used as *part* of another schema.
///
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
#[serde_with::serde_as]
#[derive(Default, Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct WritableCgroups {
/// Optional. Whether writable cgroups is enabled.
pub enabled: Option<bool>,
}
impl common::Part for WritableCgroups {}
// ###################
// MethodBuilders ###
// #################
/// A builder providing access to all methods supported on *project* resources.
/// It is not used directly, but through the [`Container`] hub.
///
/// # Example
///
/// Instantiate a resource builder
///
/// ```test_harness,no_run
/// extern crate hyper;
/// extern crate hyper_rustls;
/// extern crate google_container1 as container1;
///
/// # async fn dox() {
/// use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// let secret: yup_oauth2::ApplicationSecret = Default::default();
/// let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// .with_native_roots()
/// .unwrap()
/// .https_only()
/// .enable_http2()
/// .build();
///
/// let executor = hyper_util::rt::TokioExecutor::new();
/// let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// secret,
/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// yup_oauth2::client::CustomHyperClientBuilder::from(
/// hyper_util::client::legacy::Client::builder(executor).build(connector),
/// ),
/// ).build().await.unwrap();
///
/// let client = hyper_util::client::legacy::Client::builder(
/// hyper_util::rt::TokioExecutor::new()
/// )
/// .build(
/// hyper_rustls::HttpsConnectorBuilder::new()
/// .with_native_roots()
/// .unwrap()
/// .https_or_http()
/// .enable_http2()
/// .build()
/// );
/// let mut hub = Container::new(client, auth);
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
/// // 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(...)`
/// // to build up your call.
/// let rb = hub.projects();
/// # }
/// ```
pub struct ProjectMethods<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
}
impl<'a, C> common::MethodsBuilder for ProjectMethods<'a, C> {}
impl<'a, C> ProjectMethods<'a, C> {
/// Create a builder to help you perform the following task:
///
/// Lists subnetworks that are usable for creating clusters in a project.
///
/// # Arguments
///
/// * `parent` - The parent project where subnetworks are usable. Specified in the format `projects/*`.
pub fn aggregated_usable_subnetworks_list(
&self,
parent: &str,
) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
ProjectAggregatedUsableSubnetworkListCall {
hub: self.hub,
_parent: parent.to_string(),
_page_token: Default::default(),
_page_size: Default::default(),
_filter: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster, node pool id) of the node pool to complete upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub fn locations_clusters_node_pools_complete_upgrade(
&self,
request: CompleteNodePoolUpgradeRequest,
name: &str,
) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
ProjectLocationClusterNodePoolCompleteUpgradeCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a node pool for a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_node_pools_create(
&self,
request: CreateNodePoolRequest,
parent: &str,
) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
ProjectLocationClusterNodePoolCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a node pool from a cluster.
///
/// # Arguments
///
/// * `name` - The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub fn locations_clusters_node_pools_delete(
&self,
name: &str,
) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
ProjectLocationClusterNodePoolDeleteCall {
hub: self.hub,
_name: name.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_node_pool_id: Default::default(),
_cluster_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Fetch upgrade information of a specific nodepool.
///
/// # Arguments
///
/// * `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/*`.
pub fn locations_clusters_node_pools_fetch_node_pool_upgrade_info(
&self,
name: &str,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall {
hub: self.hub,
_name: name.to_string(),
_version: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the requested node pool.
///
/// # Arguments
///
/// * `name` - The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub fn locations_clusters_node_pools_get(
&self,
name: &str,
) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
ProjectLocationClusterNodePoolGetCall {
hub: self.hub,
_name: name.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_node_pool_id: Default::default(),
_cluster_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists the node pools for a cluster.
///
/// # Arguments
///
/// * `parent` - The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_node_pools_list(
&self,
parent: &str,
) -> ProjectLocationClusterNodePoolListCall<'a, C> {
ProjectLocationClusterNodePoolListCall {
hub: self.hub,
_parent: parent.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_cluster_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub fn locations_clusters_node_pools_rollback(
&self,
request: RollbackNodePoolUpgradeRequest,
name: &str,
) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
ProjectLocationClusterNodePoolRollbackCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the autoscaling settings for the specified node pool.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub fn locations_clusters_node_pools_set_autoscaling(
&self,
request: SetNodePoolAutoscalingRequest,
name: &str,
) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
ProjectLocationClusterNodePoolSetAutoscalingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the NodeManagement options for a node pool.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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/*`.
pub fn locations_clusters_node_pools_set_management(
&self,
request: SetNodePoolManagementRequest,
name: &str,
) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
ProjectLocationClusterNodePoolSetManagementCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub fn locations_clusters_node_pools_set_size(
&self,
request: SetNodePoolSizeRequest,
name: &str,
) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
ProjectLocationClusterNodePoolSetSizeCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the version and/or image type for the specified node pool.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
pub fn locations_clusters_node_pools_update(
&self,
request: UpdateNodePoolRequest,
name: &str,
) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
ProjectLocationClusterNodePoolUpdateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `parent` - The cluster (project, location, cluster name) to get the discovery document for. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_well_known_get_openid_configuration(
&self,
parent: &str,
) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
ProjectLocationClusterWellKnownGetOpenidConfigurationCall {
hub: self.hub,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.
///
/// # Arguments
///
/// * `name` - The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_check_autopilot_compatibility(
&self,
name: &str,
) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
ProjectLocationClusterCheckAutopilotCompatibilityCall {
hub: self.hub,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Completes master IP rotation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_complete_ip_rotation(
&self,
request: CompleteIPRotationRequest,
name: &str,
) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
ProjectLocationClusterCompleteIpRotationCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `parent` - The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
pub fn locations_clusters_create(
&self,
request: CreateClusterRequest,
parent: &str,
) -> ProjectLocationClusterCreateCall<'a, C> {
ProjectLocationClusterCreateCall {
hub: self.hub,
_request: request,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `name` - The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_delete(&self, name: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
ProjectLocationClusterDeleteCall {
hub: self.hub,
_name: name.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_cluster_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Fetch upgrade information of a specific cluster.
///
/// # Arguments
///
/// * `name` - Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
pub fn locations_clusters_fetch_cluster_upgrade_info(
&self,
name: &str,
) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
ProjectLocationClusterFetchClusterUpgradeInfoCall {
hub: self.hub,
_name: name.to_string(),
_version: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the details of a specific cluster.
///
/// # Arguments
///
/// * `name` - The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_get(&self, name: &str) -> ProjectLocationClusterGetCall<'a, C> {
ProjectLocationClusterGetCall {
hub: self.hub,
_name: name.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_cluster_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the public component of the cluster signing keys in JSON Web Key format.
///
/// # Arguments
///
/// * `parent` - The cluster (project, location, cluster name) to get keys for. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_get_jwks(
&self,
parent: &str,
) -> ProjectLocationClusterGetJwkCall<'a, C> {
ProjectLocationClusterGetJwkCall {
hub: self.hub,
_parent: parent.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all clusters owned by a project in either the specified zone or all zones.
///
/// # Arguments
///
/// * `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.
pub fn locations_clusters_list(&self, parent: &str) -> ProjectLocationClusterListCall<'a, C> {
ProjectLocationClusterListCall {
hub: self.hub,
_parent: parent.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the addons for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_addons(
&self,
request: SetAddonsConfigRequest,
name: &str,
) -> ProjectLocationClusterSetAddonCall<'a, C> {
ProjectLocationClusterSetAddonCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Enables or disables the ABAC authorization mechanism on a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_legacy_abac(
&self,
request: SetLegacyAbacRequest,
name: &str,
) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
ProjectLocationClusterSetLegacyAbacCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_locations(
&self,
request: SetLocationsRequest,
name: &str,
) -> ProjectLocationClusterSetLocationCall<'a, C> {
ProjectLocationClusterSetLocationCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the logging service for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_logging(
&self,
request: SetLoggingServiceRequest,
name: &str,
) -> ProjectLocationClusterSetLoggingCall<'a, C> {
ProjectLocationClusterSetLoggingCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the maintenance policy for a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_maintenance_policy(
&self,
request: SetMaintenancePolicyRequest,
name: &str,
) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
ProjectLocationClusterSetMaintenancePolicyCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_master_auth(
&self,
request: SetMasterAuthRequest,
name: &str,
) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
ProjectLocationClusterSetMasterAuthCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the monitoring service for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_monitoring(
&self,
request: SetMonitoringServiceRequest,
name: &str,
) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
ProjectLocationClusterSetMonitoringCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Enables or disables Network Policy for a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_network_policy(
&self,
request: SetNetworkPolicyRequest,
name: &str,
) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
ProjectLocationClusterSetNetworkPolicyCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets labels on a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_set_resource_labels(
&self,
request: SetLabelsRequest,
name: &str,
) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
ProjectLocationClusterSetResourceLabelCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Starts master IP rotation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_start_ip_rotation(
&self,
request: StartIPRotationRequest,
name: &str,
) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
ProjectLocationClusterStartIpRotationCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings of a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_update(
&self,
request: UpdateClusterRequest,
name: &str,
) -> ProjectLocationClusterUpdateCall<'a, C> {
ProjectLocationClusterUpdateCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the master for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
pub fn locations_clusters_update_master(
&self,
request: UpdateMasterRequest,
name: &str,
) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
ProjectLocationClusterUpdateMasterCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Cancels the specified operation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `name` - The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
pub fn locations_operations_cancel(
&self,
request: CancelOperationRequest,
name: &str,
) -> ProjectLocationOperationCancelCall<'a, C> {
ProjectLocationOperationCancelCall {
hub: self.hub,
_request: request,
_name: name.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the specified operation.
///
/// # Arguments
///
/// * `name` - The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
pub fn locations_operations_get(&self, name: &str) -> ProjectLocationOperationGetCall<'a, C> {
ProjectLocationOperationGetCall {
hub: self.hub,
_name: name.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_operation_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all operations in a project in a specific zone or all zones.
///
/// # Arguments
///
/// * `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.
pub fn locations_operations_list(
&self,
parent: &str,
) -> ProjectLocationOperationListCall<'a, C> {
ProjectLocationOperationListCall {
hub: self.hub,
_parent: parent.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns configuration info about the Google Kubernetes Engine service.
///
/// # Arguments
///
/// * `name` - The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
pub fn locations_get_server_config(
&self,
name: &str,
) -> ProjectLocationGetServerConfigCall<'a, C> {
ProjectLocationGetServerConfigCall {
hub: self.hub,
_name: name.to_string(),
_zone: Default::default(),
_project_id: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the autoscaling settings for the specified node pool.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
/// * `nodePoolId` - Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_node_pools_autoscaling(
&self,
request: SetNodePoolAutoscalingRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
node_pool_id: &str,
) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
ProjectZoneClusterNodePoolAutoscalingCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_node_pool_id: node_pool_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Creates a node pool for a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
pub fn zones_clusters_node_pools_create(
&self,
request: CreateNodePoolRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
ProjectZoneClusterNodePoolCreateCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Deletes a node pool from a cluster.
///
/// # Arguments
///
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
/// * `nodePoolId` - Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_node_pools_delete(
&self,
project_id: &str,
zone: &str,
cluster_id: &str,
node_pool_id: &str,
) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
ProjectZoneClusterNodePoolDeleteCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_node_pool_id: node_pool_id.to_string(),
_name: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Fetch upgrade information of a specific nodepool.
///
/// # Arguments
///
/// * `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/*`.
pub fn zones_clusters_node_pools_fetch_node_pool_upgrade_info(
&self,
name: &str,
) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall {
hub: self.hub,
_name: name.to_string(),
_version: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Retrieves the requested node pool.
///
/// # Arguments
///
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
/// * `nodePoolId` - Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_node_pools_get(
&self,
project_id: &str,
zone: &str,
cluster_id: &str,
node_pool_id: &str,
) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
ProjectZoneClusterNodePoolGetCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_node_pool_id: node_pool_id.to_string(),
_name: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists the node pools for a cluster.
///
/// # Arguments
///
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
pub fn zones_clusters_node_pools_list(
&self,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterNodePoolListCall<'a, C> {
ProjectZoneClusterNodePoolListCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_parent: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
/// * `nodePoolId` - Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_node_pools_rollback(
&self,
request: RollbackNodePoolUpgradeRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
node_pool_id: &str,
) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
ProjectZoneClusterNodePoolRollbackCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_node_pool_id: node_pool_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the NodeManagement options for a node pool.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
/// * `nodePoolId` - Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_node_pools_set_management(
&self,
request: SetNodePoolManagementRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
node_pool_id: &str,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
ProjectZoneClusterNodePoolSetManagementCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_node_pool_id: node_pool_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
/// * `nodePoolId` - Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_node_pools_set_size(
&self,
request: SetNodePoolSizeRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
node_pool_id: &str,
) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
ProjectZoneClusterNodePoolSetSizeCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_node_pool_id: node_pool_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the version and/or image type for the specified node pool.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
/// * `nodePoolId` - Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_node_pools_update(
&self,
request: UpdateNodePoolRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
node_pool_id: &str,
) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
ProjectZoneClusterNodePoolUpdateCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_node_pool_id: node_pool_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the addons for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_addons(
&self,
request: SetAddonsConfigRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterAddonCall<'a, C> {
ProjectZoneClusterAddonCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Completes master IP rotation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_complete_ip_rotation(
&self,
request: CompleteIPRotationRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
ProjectZoneClusterCompleteIpRotationCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
pub fn zones_clusters_create(
&self,
request: CreateClusterRequest,
project_id: &str,
zone: &str,
) -> ProjectZoneClusterCreateCall<'a, C> {
ProjectZoneClusterCreateCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_delete(
&self,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterDeleteCall<'a, C> {
ProjectZoneClusterDeleteCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_name: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Fetch upgrade information of a specific cluster.
///
/// # Arguments
///
/// * `name` - Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
pub fn zones_clusters_fetch_cluster_upgrade_info(
&self,
name: &str,
) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
ProjectZoneClusterFetchClusterUpgradeInfoCall {
hub: self.hub,
_name: name.to_string(),
_version: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the details of a specific cluster.
///
/// # Arguments
///
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_get(
&self,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterGetCall<'a, C> {
ProjectZoneClusterGetCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_name: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Enables or disables the ABAC authorization mechanism on a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_legacy_abac(
&self,
request: SetLegacyAbacRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
ProjectZoneClusterLegacyAbacCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all clusters owned by a project in either the specified zone or all zones.
///
/// # Arguments
///
/// * `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.
/// * `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.
pub fn zones_clusters_list(
&self,
project_id: &str,
zone: &str,
) -> ProjectZoneClusterListCall<'a, C> {
ProjectZoneClusterListCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_parent: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// 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.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_locations(
&self,
request: SetLocationsRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterLocationCall<'a, C> {
ProjectZoneClusterLocationCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the logging service for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_logging(
&self,
request: SetLoggingServiceRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterLoggingCall<'a, C> {
ProjectZoneClusterLoggingCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the master for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_master(
&self,
request: UpdateMasterRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterMasterCall<'a, C> {
ProjectZoneClusterMasterCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the monitoring service for a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_monitoring(
&self,
request: SetMonitoringServiceRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterMonitoringCall<'a, C> {
ProjectZoneClusterMonitoringCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets labels on a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_resource_labels(
&self,
request: SetLabelsRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterResourceLabelCall<'a, C> {
ProjectZoneClusterResourceLabelCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets the maintenance policy for a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `projectId` - Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
/// * `zone` - Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
/// * `clusterId` - Required. The name of the cluster to update.
pub fn zones_clusters_set_maintenance_policy(
&self,
request: SetMaintenancePolicyRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
ProjectZoneClusterSetMaintenancePolicyCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_set_master_auth(
&self,
request: SetMasterAuthRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
ProjectZoneClusterSetMasterAuthCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Enables or disables Network Policy for a cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_set_network_policy(
&self,
request: SetNetworkPolicyRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
ProjectZoneClusterSetNetworkPolicyCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Starts master IP rotation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_start_ip_rotation(
&self,
request: StartIPRotationRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
ProjectZoneClusterStartIpRotationCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Updates the settings of a specific cluster.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `clusterId` - Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
pub fn zones_clusters_update(
&self,
request: UpdateClusterRequest,
project_id: &str,
zone: &str,
cluster_id: &str,
) -> ProjectZoneClusterUpdateCall<'a, C> {
ProjectZoneClusterUpdateCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_cluster_id: cluster_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Cancels the specified operation.
///
/// # Arguments
///
/// * `request` - No description provided.
/// * `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.
/// * `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.
/// * `operationId` - Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
pub fn zones_operations_cancel(
&self,
request: CancelOperationRequest,
project_id: &str,
zone: &str,
operation_id: &str,
) -> ProjectZoneOperationCancelCall<'a, C> {
ProjectZoneOperationCancelCall {
hub: self.hub,
_request: request,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_operation_id: operation_id.to_string(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Gets the specified operation.
///
/// # Arguments
///
/// * `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.
/// * `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.
/// * `operationId` - Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
pub fn zones_operations_get(
&self,
project_id: &str,
zone: &str,
operation_id: &str,
) -> ProjectZoneOperationGetCall<'a, C> {
ProjectZoneOperationGetCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_operation_id: operation_id.to_string(),
_name: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Lists all operations in a project in a specific zone or all zones.
///
/// # Arguments
///
/// * `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.
/// * `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.
pub fn zones_operations_list(
&self,
project_id: &str,
zone: &str,
) -> ProjectZoneOperationListCall<'a, C> {
ProjectZoneOperationListCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_parent: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
/// Create a builder to help you perform the following task:
///
/// Returns configuration info about the Google Kubernetes Engine service.
///
/// # Arguments
///
/// * `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.
/// * `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.
pub fn zones_get_serverconfig(
&self,
project_id: &str,
zone: &str,
) -> ProjectZoneGetServerconfigCall<'a, C> {
ProjectZoneGetServerconfigCall {
hub: self.hub,
_project_id: project_id.to_string(),
_zone: zone.to_string(),
_name: Default::default(),
_delegate: Default::default(),
_additional_params: Default::default(),
_scopes: Default::default(),
}
}
}
// ###################
// CallBuilders ###
// #################
/// Lists subnetworks that are usable for creating clusters in a project.
///
/// A builder for the *aggregated.usableSubnetworks.list* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().aggregated_usable_subnetworks_list("parent")
/// .page_token("eos")
/// .page_size(-4)
/// .filter("ea")
/// .doit().await;
/// # }
/// ```
pub struct ProjectAggregatedUsableSubnetworkListCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_parent: String,
_page_token: Option<String>,
_page_size: Option<i32>,
_filter: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectAggregatedUsableSubnetworkListCall<'a, C> {}
impl<'a, C> ProjectAggregatedUsableSubnetworkListCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(
mut self,
) -> common::Result<(common::Response, ListUsableSubnetworksResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.aggregated.usableSubnetworks.list",
http_method: hyper::Method::GET,
});
for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("parent", self._parent);
if let Some(value) = self._page_token.as_ref() {
params.push("pageToken", value);
}
if let Some(value) = self._page_size.as_ref() {
params.push("pageSize", value.to_string());
}
if let Some(value) = self._filter.as_ref() {
params.push("filter", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/aggregated/usableSubnetworks";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The parent project where subnetworks are usable. Specified in the format `projects/*`.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// Specifies a page token to use. Set this to the nextPageToken returned by previous list requests to get the next page of results.
///
/// Sets the *page token* query property to the given value.
pub fn page_token(
mut self,
new_value: &str,
) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
self._page_token = Some(new_value.to_string());
self
}
/// 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)
///
/// Sets the *page size* query property to the given value.
pub fn page_size(mut self, new_value: i32) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
self._page_size = Some(new_value);
self
}
/// 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.
///
/// Sets the *filter* query property to the given value.
pub fn filter(mut self, new_value: &str) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
self._filter = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectAggregatedUsableSubnetworkListCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectAggregatedUsableSubnetworkListCall<'a, C> {
self._scopes.clear();
self
}
}
/// CompleteNodePoolUpgrade will signal an on-going node pool upgrade to complete.
///
/// A builder for the *locations.clusters.nodePools.completeUpgrade* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CompleteNodePoolUpgradeRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CompleteNodePoolUpgradeRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_complete_upgrade(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CompleteNodePoolUpgradeRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.completeUpgrade",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:completeUpgrade";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CompleteNodePoolUpgradeRequest,
) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster, node pool id) of the node pool to complete upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolCompleteUpgradeCall<'a, C> {
self._scopes.clear();
self
}
}
/// Creates a node pool for a cluster.
///
/// A builder for the *locations.clusters.nodePools.create* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CreateNodePoolRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CreateNodePoolRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_create(req, "parent")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolCreateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CreateNodePoolRequest,
_parent: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolCreateCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolCreateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.create",
http_method: hyper::Method::POST,
});
for &field in ["alt", "parent"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("parent", self._parent);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CreateNodePoolRequest,
) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
self._request = new_value;
self
}
/// The parent (project, location, cluster name) where the node pool will be created. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolCreateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolCreateCall<'a, C> {
self._scopes.clear();
self
}
}
/// Deletes a node pool from a cluster.
///
/// A builder for the *locations.clusters.nodePools.delete* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_delete("name")
/// .zone("duo")
/// .project_id("ipsum")
/// .node_pool_id("sed")
/// .cluster_id("ut")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolDeleteCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_zone: Option<String>,
_project_id: Option<String>,
_node_pool_id: Option<String>,
_cluster_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolDeleteCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolDeleteCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.delete",
http_method: hyper::Method::DELETE,
});
for &field in [
"alt",
"name",
"zone",
"projectId",
"nodePoolId",
"clusterId",
]
.iter()
{
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
if let Some(value) = self._node_pool_id.as_ref() {
params.push("nodePoolId", value);
}
if let Some(value) = self._cluster_id.as_ref() {
params.push("clusterId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::DELETE)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
self._name = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* query property to the given value.
pub fn node_pool_id(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
self._node_pool_id = Some(new_value.to_string());
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* query property to the given value.
pub fn cluster_id(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
self._cluster_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolDeleteCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolDeleteCall<'a, C> {
self._scopes.clear();
self
}
}
/// Fetch upgrade information of a specific nodepool.
///
/// A builder for the *locations.clusters.nodePools.fetchNodePoolUpgradeInfo* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_fetch_node_pool_upgrade_info("name")
/// .version("rebum.")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_version: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder
for ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
{
}
impl<'a, C> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, NodePoolUpgradeInfo)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.fetchNodePoolUpgradeInfo",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name", "version"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._version.as_ref() {
params.push("version", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchNodePoolUpgradeInfo";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._name = new_value.to_string();
self
}
/// API request version that initiates this operation.
///
/// Sets the *version* query property to the given value.
pub fn version(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._version = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(
mut self,
) -> ProjectLocationClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._scopes.clear();
self
}
}
/// Retrieves the requested node pool.
///
/// A builder for the *locations.clusters.nodePools.get* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_get("name")
/// .zone("ipsum")
/// .project_id("ipsum")
/// .node_pool_id("est")
/// .cluster_id("gubergren")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolGetCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_zone: Option<String>,
_project_id: Option<String>,
_node_pool_id: Option<String>,
_cluster_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolGetCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolGetCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, NodePool)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.get",
http_method: hyper::Method::GET,
});
for &field in [
"alt",
"name",
"zone",
"projectId",
"nodePoolId",
"clusterId",
]
.iter()
{
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
if let Some(value) = self._node_pool_id.as_ref() {
params.push("nodePoolId", value);
}
if let Some(value) = self._cluster_id.as_ref() {
params.push("clusterId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
self._name = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* query property to the given value.
pub fn node_pool_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
self._node_pool_id = Some(new_value.to_string());
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* query property to the given value.
pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
self._cluster_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolGetCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolGetCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolGetCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolGetCall<'a, C> {
self._scopes.clear();
self
}
}
/// Lists the node pools for a cluster.
///
/// A builder for the *locations.clusters.nodePools.list* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_list("parent")
/// .zone("dolor")
/// .project_id("Lorem")
/// .cluster_id("eos")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolListCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_parent: String,
_zone: Option<String>,
_project_id: Option<String>,
_cluster_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolListCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolListCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ListNodePoolsResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.list",
http_method: hyper::Method::GET,
});
for &field in ["alt", "parent", "zone", "projectId", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("parent", self._parent);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
if let Some(value) = self._cluster_id.as_ref() {
params.push("clusterId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
///
/// Sets the *cluster id* query property to the given value.
pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterNodePoolListCall<'a, C> {
self._cluster_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolListCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolListCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolListCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolListCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolListCall<'a, C> {
self._scopes.clear();
self
}
}
/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
///
/// A builder for the *locations.clusters.nodePools.rollback* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::RollbackNodePoolUpgradeRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = RollbackNodePoolUpgradeRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_rollback(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolRollbackCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: RollbackNodePoolUpgradeRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolRollbackCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolRollbackCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.rollback",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:rollback";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: RollbackNodePoolUpgradeRequest,
) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterNodePoolRollbackCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolRollbackCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the autoscaling settings for the specified node pool.
///
/// A builder for the *locations.clusters.nodePools.setAutoscaling* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNodePoolAutoscalingRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNodePoolAutoscalingRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_set_autoscaling(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNodePoolAutoscalingRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.setAutoscaling",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setAutoscaling";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNodePoolAutoscalingRequest,
) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster, node pool) of the node pool to set autoscaler settings. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the NodeManagement options for a node pool.
///
/// A builder for the *locations.clusters.nodePools.setManagement* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNodePoolManagementRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNodePoolManagementRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_set_management(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolSetManagementCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNodePoolManagementRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetManagementCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.setManagement",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setManagement";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNodePoolManagementRequest,
) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster, node pool id) of the node pool to set management properties. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetManagementCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *locations.clusters.nodePools.setSize* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNodePoolSizeRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNodePoolSizeRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_set_size(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolSetSizeCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNodePoolSizeRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolSetSizeCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.setSize",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setSize";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNodePoolSizeRequest,
) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster, node pool id) of the node pool to set size. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolSetSizeCall<'a, C> {
self._scopes.clear();
self
}
}
/// Updates the version and/or image type for the specified node pool.
///
/// A builder for the *locations.clusters.nodePools.update* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::UpdateNodePoolRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = UpdateNodePoolRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_node_pools_update(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterNodePoolUpdateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: UpdateNodePoolRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterNodePoolUpdateCall<'a, C> {}
impl<'a, C> ProjectLocationClusterNodePoolUpdateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.nodePools.update",
http_method: hyper::Method::PUT,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::PUT)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: UpdateNodePoolRequest,
) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster, node pool) of the node pool to update. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterNodePoolUpdateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterNodePoolUpdateCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *locations.clusters.well-known.getOpenid-configuration* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_well_known_get_openid_configuration("parent")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_parent: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, C> common::CallBuilder
for ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
{
}
impl<'a, C> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, GetOpenIDConfigResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.well-known.getOpenid-configuration",
http_method: hyper::Method::GET,
});
for &field in ["alt", "parent"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.push("parent", self._parent);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/.well-known/openid-configuration";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(common::Error::MissingAPIKey);
}
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The cluster (project, location, cluster name) to get the discovery document for. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(
mut self,
new_value: &str,
) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}
/// Checks the cluster compatibility with Autopilot mode, and returns a list of compatibility issues.
///
/// A builder for the *locations.clusters.checkAutopilotCompatibility* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_check_autopilot_compatibility("name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {}
impl<'a, C> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(
mut self,
) -> common::Result<(common::Response, CheckAutopilotCompatibilityResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.checkAutopilotCompatibility",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:checkAutopilotCompatibility";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterCheckAutopilotCompatibilityCall<'a, C> {
self._scopes.clear();
self
}
}
/// Completes master IP rotation.
///
/// A builder for the *locations.clusters.completeIpRotation* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CompleteIPRotationRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CompleteIPRotationRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_complete_ip_rotation(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterCompleteIpRotationCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CompleteIPRotationRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterCompleteIpRotationCall<'a, C> {}
impl<'a, C> ProjectLocationClusterCompleteIpRotationCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.completeIpRotation",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:completeIpRotation";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CompleteIPRotationRequest,
) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterCompleteIpRotationCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterCompleteIpRotationCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *locations.clusters.create* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CreateClusterRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CreateClusterRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_create(req, "parent")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterCreateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CreateClusterRequest,
_parent: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterCreateCall<'a, C> {}
impl<'a, C> ProjectLocationClusterCreateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.create",
http_method: hyper::Method::POST,
});
for &field in ["alt", "parent"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("parent", self._parent);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CreateClusterRequest,
) -> ProjectLocationClusterCreateCall<'a, C> {
self._request = new_value;
self
}
/// The parent (project and location) where the cluster will be created. Specified in the format `projects/*/locations/*`.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterCreateCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterCreateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterCreateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterCreateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterCreateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterCreateCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *locations.clusters.delete* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_delete("name")
/// .zone("et")
/// .project_id("vero")
/// .cluster_id("erat")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterDeleteCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_zone: Option<String>,
_project_id: Option<String>,
_cluster_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterDeleteCall<'a, C> {}
impl<'a, C> ProjectLocationClusterDeleteCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.delete",
http_method: hyper::Method::DELETE,
});
for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
if let Some(value) = self._cluster_id.as_ref() {
params.push("clusterId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::DELETE)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
self._name = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* query property to the given value.
pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterDeleteCall<'a, C> {
self._cluster_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterDeleteCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterDeleteCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterDeleteCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterDeleteCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterDeleteCall<'a, C> {
self._scopes.clear();
self
}
}
/// Fetch upgrade information of a specific cluster.
///
/// A builder for the *locations.clusters.fetchClusterUpgradeInfo* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_fetch_cluster_upgrade_info("name")
/// .version("duo")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_version: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {}
impl<'a, C> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ClusterUpgradeInfo)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.fetchClusterUpgradeInfo",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name", "version"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._version.as_ref() {
params.push("version", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchClusterUpgradeInfo";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
self._name = new_value.to_string();
self
}
/// API request version that initiates this operation.
///
/// Sets the *version* query property to the given value.
pub fn version(
mut self,
new_value: &str,
) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
self._version = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterFetchClusterUpgradeInfoCall<'a, C> {
self._scopes.clear();
self
}
}
/// Gets the details of a specific cluster.
///
/// A builder for the *locations.clusters.get* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_get("name")
/// .zone("et")
/// .project_id("voluptua.")
/// .cluster_id("amet.")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterGetCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_zone: Option<String>,
_project_id: Option<String>,
_cluster_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterGetCall<'a, C> {}
impl<'a, C> ProjectLocationClusterGetCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.get",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
if let Some(value) = self._cluster_id.as_ref() {
params.push("clusterId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
self._name = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* query property to the given value.
pub fn cluster_id(mut self, new_value: &str) -> ProjectLocationClusterGetCall<'a, C> {
self._cluster_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterGetCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterGetCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterGetCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterGetCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterGetCall<'a, C> {
self._scopes.clear();
self
}
}
/// Gets the public component of the cluster signing keys in JSON Web Key format.
///
/// A builder for the *locations.clusters.getJwks* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_get_jwks("parent")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterGetJwkCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_parent: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterGetJwkCall<'a, C> {}
impl<'a, C> ProjectLocationClusterGetJwkCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, GetJSONWebKeysResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.getJwks",
http_method: hyper::Method::GET,
});
for &field in ["alt", "parent"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(3 + self._additional_params.len());
params.push("parent", self._parent);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/jwks";
match dlg.api_key() {
Some(value) => params.push("key", value),
None => {
dlg.finished(false);
return Err(common::Error::MissingAPIKey);
}
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The cluster (project, location, cluster name) to get keys for. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterGetJwkCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterGetJwkCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterGetJwkCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
}
/// Lists all clusters owned by a project in either the specified zone or all zones.
///
/// A builder for the *locations.clusters.list* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_list("parent")
/// .zone("dolor")
/// .project_id("et")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterListCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_parent: String,
_zone: Option<String>,
_project_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterListCall<'a, C> {}
impl<'a, C> ProjectLocationClusterListCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.list",
http_method: hyper::Method::GET,
});
for &field in ["alt", "parent", "zone", "projectId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(5 + self._additional_params.len());
params.push("parent", self._parent);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The parent (project and location) where the clusters will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationClusterListCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterListCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterListCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterListCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterListCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterListCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the addons for a specific cluster.
///
/// A builder for the *locations.clusters.setAddons* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetAddonsConfigRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetAddonsConfigRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_addons(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetAddonCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetAddonsConfigRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetAddonCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetAddonCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setAddons",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setAddons";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetAddonsConfigRequest,
) -> ProjectLocationClusterSetAddonCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster) of the cluster to set addons. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetAddonCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetAddonCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetAddonCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetAddonCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetAddonCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetAddonCall<'a, C> {
self._scopes.clear();
self
}
}
/// Enables or disables the ABAC authorization mechanism on a cluster.
///
/// A builder for the *locations.clusters.setLegacyAbac* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLegacyAbacRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLegacyAbacRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_legacy_abac(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetLegacyAbacCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLegacyAbacRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLegacyAbacCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetLegacyAbacCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setLegacyAbac",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setLegacyAbac";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLegacyAbacRequest,
) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLegacyAbacCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLegacyAbacCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *locations.clusters.setLocations* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLocationsRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLocationsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_locations(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetLocationCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLocationsRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLocationCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetLocationCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setLocations",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setLocations";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLocationsRequest,
) -> ProjectLocationClusterSetLocationCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster) of the cluster to set locations. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLocationCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetLocationCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLocationCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLocationCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLocationCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLocationCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the logging service for a specific cluster.
///
/// A builder for the *locations.clusters.setLogging* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLoggingServiceRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLoggingServiceRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_logging(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetLoggingCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLoggingServiceRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetLoggingCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetLoggingCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setLogging",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setLogging";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLoggingServiceRequest,
) -> ProjectLocationClusterSetLoggingCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster) of the cluster to set logging. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetLoggingCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetLoggingCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetLoggingCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetLoggingCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetLoggingCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetLoggingCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the maintenance policy for a cluster.
///
/// A builder for the *locations.clusters.setMaintenancePolicy* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetMaintenancePolicyRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetMaintenancePolicyRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_maintenance_policy(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetMaintenancePolicyRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setMaintenancePolicy",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setMaintenancePolicy";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetMaintenancePolicyRequest,
) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMaintenancePolicyCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
///
/// A builder for the *locations.clusters.setMasterAuth* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetMasterAuthRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetMasterAuthRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_master_auth(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetMasterAuthCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetMasterAuthRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMasterAuthCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetMasterAuthCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setMasterAuth",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setMasterAuth";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetMasterAuthRequest,
) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster) of the cluster to set auth. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetMasterAuthCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMasterAuthCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the monitoring service for a specific cluster.
///
/// A builder for the *locations.clusters.setMonitoring* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetMonitoringServiceRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetMonitoringServiceRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_monitoring(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetMonitoringCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetMonitoringServiceRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetMonitoringCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetMonitoringCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setMonitoring",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setMonitoring";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetMonitoringServiceRequest,
) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster) of the cluster to set monitoring. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterSetMonitoringCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetMonitoringCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterSetMonitoringCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetMonitoringCall<'a, C> {
self._scopes.clear();
self
}
}
/// Enables or disables Network Policy for a cluster.
///
/// A builder for the *locations.clusters.setNetworkPolicy* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNetworkPolicyRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNetworkPolicyRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_network_policy(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetNetworkPolicyCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNetworkPolicyRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetNetworkPolicyCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setNetworkPolicy",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setNetworkPolicy";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNetworkPolicyRequest,
) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetNetworkPolicyCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets labels on a cluster.
///
/// A builder for the *locations.clusters.setResourceLabels* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLabelsRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLabelsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_set_resource_labels(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterSetResourceLabelCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLabelsRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterSetResourceLabelCall<'a, C> {}
impl<'a, C> ProjectLocationClusterSetResourceLabelCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.setResourceLabels",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:setResourceLabels";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLabelsRequest,
) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster name) of the cluster to set labels. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterSetResourceLabelCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterSetResourceLabelCall<'a, C> {
self._scopes.clear();
self
}
}
/// Starts master IP rotation.
///
/// A builder for the *locations.clusters.startIpRotation* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::StartIPRotationRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = StartIPRotationRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_start_ip_rotation(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterStartIpRotationCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: StartIPRotationRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterStartIpRotationCall<'a, C> {}
impl<'a, C> ProjectLocationClusterStartIpRotationCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.startIpRotation",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:startIpRotation";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: StartIPRotationRequest,
) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterStartIpRotationCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterStartIpRotationCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectLocationClusterStartIpRotationCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterStartIpRotationCall<'a, C> {
self._scopes.clear();
self
}
}
/// Updates the settings of a specific cluster.
///
/// A builder for the *locations.clusters.update* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::UpdateClusterRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = UpdateClusterRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_update(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterUpdateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: UpdateClusterRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterUpdateCall<'a, C> {}
impl<'a, C> ProjectLocationClusterUpdateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.update",
http_method: hyper::Method::PUT,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::PUT)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: UpdateClusterRequest,
) -> ProjectLocationClusterUpdateCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterUpdateCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterUpdateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterUpdateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterUpdateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterUpdateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterUpdateCall<'a, C> {
self._scopes.clear();
self
}
}
/// Updates the master for a specific cluster.
///
/// A builder for the *locations.clusters.updateMaster* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::UpdateMasterRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = UpdateMasterRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_clusters_update_master(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationClusterUpdateMasterCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: UpdateMasterRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationClusterUpdateMasterCall<'a, C> {}
impl<'a, C> ProjectLocationClusterUpdateMasterCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.clusters.updateMaster",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:updateMaster";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: UpdateMasterRequest,
) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, cluster) of the cluster to update. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationClusterUpdateMasterCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationClusterUpdateMasterCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationClusterUpdateMasterCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationClusterUpdateMasterCall<'a, C> {
self._scopes.clear();
self
}
}
/// Cancels the specified operation.
///
/// A builder for the *locations.operations.cancel* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CancelOperationRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CancelOperationRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_operations_cancel(req, "name")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationOperationCancelCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CancelOperationRequest,
_name: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationOperationCancelCall<'a, C> {}
impl<'a, C> ProjectLocationOperationCancelCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.operations.cancel",
http_method: hyper::Method::POST,
});
for &field in ["alt", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CancelOperationRequest,
) -> ProjectLocationOperationCancelCall<'a, C> {
self._request = new_value;
self
}
/// The name (project, location, operation id) of the operation to cancel. Specified in the format `projects/*/locations/*/operations/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationOperationCancelCall<'a, C> {
self._name = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationOperationCancelCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationCancelCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationCancelCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationCancelCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationOperationCancelCall<'a, C> {
self._scopes.clear();
self
}
}
/// Gets the specified operation.
///
/// A builder for the *locations.operations.get* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_operations_get("name")
/// .zone("ipsum")
/// .project_id("accusam")
/// .operation_id("takimata")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationOperationGetCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_zone: Option<String>,
_project_id: Option<String>,
_operation_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationOperationGetCall<'a, C> {}
impl<'a, C> ProjectLocationOperationGetCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.operations.get",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name", "zone", "projectId", "operationId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
if let Some(value) = self._operation_id.as_ref() {
params.push("operationId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
self._name = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
///
/// Sets the *operation id* query property to the given value.
pub fn operation_id(mut self, new_value: &str) -> ProjectLocationOperationGetCall<'a, C> {
self._operation_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationOperationGetCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationGetCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationGetCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationGetCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationOperationGetCall<'a, C> {
self._scopes.clear();
self
}
}
/// Lists all operations in a project in a specific zone or all zones.
///
/// A builder for the *locations.operations.list* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_operations_list("parent")
/// .zone("voluptua.")
/// .project_id("et")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationOperationListCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_parent: String,
_zone: Option<String>,
_project_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationOperationListCall<'a, C> {}
impl<'a, C> ProjectLocationOperationListCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.operations.list",
http_method: hyper::Method::GET,
});
for &field in ["alt", "parent", "zone", "projectId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(5 + self._additional_params.len());
params.push("parent", self._parent);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+parent}/operations";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["parent"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The parent (project and location) where the operations will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
///
/// Sets the *parent* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn parent(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
self._parent = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationOperationListCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationOperationListCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationOperationListCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationOperationListCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationOperationListCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationOperationListCall<'a, C> {
self._scopes.clear();
self
}
}
/// Returns configuration info about the Google Kubernetes Engine service.
///
/// A builder for the *locations.getServerConfig* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().locations_get_server_config("name")
/// .zone("consetetur")
/// .project_id("amet.")
/// .doit().await;
/// # }
/// ```
pub struct ProjectLocationGetServerConfigCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_zone: Option<String>,
_project_id: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectLocationGetServerConfigCall<'a, C> {}
impl<'a, C> ProjectLocationGetServerConfigCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ServerConfig)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.locations.getServerConfig",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name", "zone", "projectId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(5 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._zone.as_ref() {
params.push("zone", value);
}
if let Some(value) = self._project_id.as_ref() {
params.push("projectId", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}/serverConfig";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
self._name = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* query property to the given value.
pub fn zone(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
self._zone = Some(new_value.to_string());
self
}
/// 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.
///
/// Sets the *project id* query property to the given value.
pub fn project_id(mut self, new_value: &str) -> ProjectLocationGetServerConfigCall<'a, C> {
self._project_id = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectLocationGetServerConfigCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectLocationGetServerConfigCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectLocationGetServerConfigCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectLocationGetServerConfigCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectLocationGetServerConfigCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the autoscaling settings for the specified node pool.
///
/// A builder for the *zones.clusters.nodePools.autoscaling* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNodePoolAutoscalingRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNodePoolAutoscalingRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_autoscaling(req, "projectId", "zone", "clusterId", "nodePoolId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNodePoolAutoscalingRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_node_pool_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.autoscaling",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.push("nodePoolId", self._node_pool_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/autoscaling";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
("{nodePoolId}", "nodePoolId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNodePoolAutoscalingRequest,
) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn node_pool_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
self._node_pool_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C> {
self._scopes.clear();
self
}
}
/// Creates a node pool for a cluster.
///
/// A builder for the *zones.clusters.nodePools.create* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CreateNodePoolRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CreateNodePoolRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_create(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolCreateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CreateNodePoolRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolCreateCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolCreateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.create",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CreateNodePoolRequest,
) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolCreateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolCreateCall<'a, C> {
self._scopes.clear();
self
}
}
/// Deletes a node pool from a cluster.
///
/// A builder for the *zones.clusters.nodePools.delete* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_delete("projectId", "zone", "clusterId", "nodePoolId")
/// .name("amet.")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolDeleteCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_cluster_id: String,
_node_pool_id: String,
_name: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolDeleteCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolDeleteCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.delete",
http_method: hyper::Method::DELETE,
});
for &field in [
"alt",
"projectId",
"zone",
"clusterId",
"nodePoolId",
"name",
]
.iter()
{
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.push("nodePoolId", self._node_pool_id);
if let Some(value) = self._name.as_ref() {
params.push("name", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
("{nodePoolId}", "nodePoolId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::DELETE)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// Deprecated. The name of the node pool to delete. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
self._node_pool_id = new_value.to_string();
self
}
/// The name (project, location, cluster, node pool id) of the node pool to delete. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* query property to the given value.
pub fn name(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
self._name = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolDeleteCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolDeleteCall<'a, C> {
self._scopes.clear();
self
}
}
/// Fetch upgrade information of a specific nodepool.
///
/// A builder for the *zones.clusters.nodePools.fetchNodePoolUpgradeInfo* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_fetch_node_pool_upgrade_info("name")
/// .version("sadipscing")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_version: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, NodePoolUpgradeInfo)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.fetchNodePoolUpgradeInfo",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name", "version"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._version.as_ref() {
params.push("version", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchNodePoolUpgradeInfo";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._name = new_value.to_string();
self
}
/// API request version that initiates this operation.
///
/// Sets the *version* query property to the given value.
pub fn version(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._version = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolFetchNodePoolUpgradeInfoCall<'a, C> {
self._scopes.clear();
self
}
}
/// Retrieves the requested node pool.
///
/// A builder for the *zones.clusters.nodePools.get* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_get("projectId", "zone", "clusterId", "nodePoolId")
/// .name("At")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolGetCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_cluster_id: String,
_node_pool_id: String,
_name: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolGetCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolGetCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, NodePool)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.get",
http_method: hyper::Method::GET,
});
for &field in [
"alt",
"projectId",
"zone",
"clusterId",
"nodePoolId",
"name",
]
.iter()
{
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.push("nodePoolId", self._node_pool_id);
if let Some(value) = self._name.as_ref() {
params.push("name", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
("{nodePoolId}", "nodePoolId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// Deprecated. The name of the node pool. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
self._node_pool_id = new_value.to_string();
self
}
/// The name (project, location, cluster, node pool id) of the node pool to get. Specified in the format `projects/*/locations/*/clusters/*/nodePools/*`.
///
/// Sets the *name* query property to the given value.
pub fn name(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
self._name = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolGetCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolGetCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolGetCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolGetCall<'a, C> {
self._scopes.clear();
self
}
}
/// Lists the node pools for a cluster.
///
/// A builder for the *zones.clusters.nodePools.list* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_list("projectId", "zone", "clusterId")
/// .parent("tempor")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolListCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_cluster_id: String,
_parent: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolListCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolListCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ListNodePoolsResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.list",
http_method: hyper::Method::GET,
});
for &field in ["alt", "projectId", "zone", "clusterId", "parent"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
if let Some(value) = self._parent.as_ref() {
params.push("parent", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the parent field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The parent (project, location, cluster name) where the node pools will be listed. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *parent* query property to the given value.
pub fn parent(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C> {
self._parent = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolListCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolListCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolListCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolListCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolListCall<'a, C> {
self._scopes.clear();
self
}
}
/// Rolls back a previously Aborted or Failed NodePool upgrade. This makes no changes if the last upgrade successfully completed.
///
/// A builder for the *zones.clusters.nodePools.rollback* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::RollbackNodePoolUpgradeRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = RollbackNodePoolUpgradeRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_rollback(req, "projectId", "zone", "clusterId", "nodePoolId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolRollbackCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: RollbackNodePoolUpgradeRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_node_pool_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolRollbackCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolRollbackCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.rollback",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.push("nodePoolId", self._node_pool_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}:rollback";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
("{nodePoolId}", "nodePoolId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: RollbackNodePoolUpgradeRequest,
) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to rollback. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// Deprecated. The name of the node pool to rollback. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn node_pool_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
self._node_pool_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolRollbackCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolRollbackCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the NodeManagement options for a node pool.
///
/// A builder for the *zones.clusters.nodePools.setManagement* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNodePoolManagementRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNodePoolManagementRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_set_management(req, "projectId", "zone", "clusterId", "nodePoolId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolSetManagementCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNodePoolManagementRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_node_pool_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolSetManagementCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.setManagement",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.push("nodePoolId", self._node_pool_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setManagement";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
("{nodePoolId}", "nodePoolId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNodePoolManagementRequest,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn node_pool_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
self._node_pool_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *zones.clusters.nodePools.setSize* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNodePoolSizeRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNodePoolSizeRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_set_size(req, "projectId", "zone", "clusterId", "nodePoolId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolSetSizeCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNodePoolSizeRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_node_pool_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolSetSizeCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.setSize",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.push("nodePoolId", self._node_pool_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setSize";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
("{nodePoolId}", "nodePoolId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNodePoolSizeRequest,
) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// Deprecated. The name of the node pool to update. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
self._node_pool_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C> {
self._scopes.clear();
self
}
}
/// Updates the version and/or image type for the specified node pool.
///
/// A builder for the *zones.clusters.nodePools.update* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::UpdateNodePoolRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = UpdateNodePoolRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_node_pools_update(req, "projectId", "zone", "clusterId", "nodePoolId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterNodePoolUpdateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: UpdateNodePoolRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_node_pool_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterNodePoolUpdateCall<'a, C> {}
impl<'a, C> ProjectZoneClusterNodePoolUpdateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.nodePools.update",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(7 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.push("nodePoolId", self._node_pool_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/update";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
("{nodePoolId}", "nodePoolId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["nodePoolId", "clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: UpdateNodePoolRequest,
) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// Deprecated. The name of the node pool to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *node pool id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
self._node_pool_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterNodePoolUpdateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterNodePoolUpdateCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the addons for a specific cluster.
///
/// A builder for the *zones.clusters.addons* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetAddonsConfigRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetAddonsConfigRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_addons(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterAddonCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetAddonsConfigRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterAddonCall<'a, C> {}
impl<'a, C> ProjectZoneClusterAddonCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.addons",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/addons";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetAddonsConfigRequest,
) -> ProjectZoneClusterAddonCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterAddonCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterAddonCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterAddonCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterAddonCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterAddonCall<'a, C> {
self._scopes.clear();
self
}
}
/// Completes master IP rotation.
///
/// A builder for the *zones.clusters.completeIpRotation* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CompleteIPRotationRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CompleteIPRotationRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_complete_ip_rotation(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterCompleteIpRotationCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CompleteIPRotationRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterCompleteIpRotationCall<'a, C> {}
impl<'a, C> ProjectZoneClusterCompleteIpRotationCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.completeIpRotation",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:completeIpRotation";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CompleteIPRotationRequest,
) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterCompleteIpRotationCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterCompleteIpRotationCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *zones.clusters.create* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CreateClusterRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CreateClusterRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_create(req, "projectId", "zone")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterCreateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CreateClusterRequest,
_project_id: String,
_zone: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterCreateCall<'a, C> {}
impl<'a, C> ProjectZoneClusterCreateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.create",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(5 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CreateClusterRequest,
) -> ProjectZoneClusterCreateCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterCreateCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterCreateCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterCreateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterCreateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterCreateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterCreateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterCreateCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *zones.clusters.delete* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_delete("projectId", "zone", "clusterId")
/// .name("et")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterDeleteCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_cluster_id: String,
_name: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterDeleteCall<'a, C> {}
impl<'a, C> ProjectZoneClusterDeleteCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.delete",
http_method: hyper::Method::DELETE,
});
for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
if let Some(value) = self._name.as_ref() {
params.push("name", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::DELETE)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to delete. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The name (project, location, cluster) of the cluster to delete. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* query property to the given value.
pub fn name(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C> {
self._name = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterDeleteCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterDeleteCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterDeleteCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterDeleteCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterDeleteCall<'a, C> {
self._scopes.clear();
self
}
}
/// Fetch upgrade information of a specific cluster.
///
/// A builder for the *zones.clusters.fetchClusterUpgradeInfo* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_fetch_cluster_upgrade_info("name")
/// .version("consetetur")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_name: String,
_version: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {}
impl<'a, C> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ClusterUpgradeInfo)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.fetchClusterUpgradeInfo",
http_method: hyper::Method::GET,
});
for &field in ["alt", "name", "version"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(4 + self._additional_params.len());
params.push("name", self._name);
if let Some(value) = self._version.as_ref() {
params.push("version", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/{+name}:fetchClusterUpgradeInfo";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{+name}", "name")].iter() {
url = params.uri_replacement(url, param_name, find_this, true);
}
{
let to_remove = ["name"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// Required. The name (project, location, cluster) of the cluster to get. Specified in the format `projects/*/locations/*/clusters/*` or `projects/*/zones/*/clusters/*`.
///
/// Sets the *name* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn name(mut self, new_value: &str) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
self._name = new_value.to_string();
self
}
/// API request version that initiates this operation.
///
/// Sets the *version* query property to the given value.
pub fn version(
mut self,
new_value: &str,
) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
self._version = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(
mut self,
scope: St,
) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterFetchClusterUpgradeInfoCall<'a, C> {
self._scopes.clear();
self
}
}
/// Gets the details of a specific cluster.
///
/// A builder for the *zones.clusters.get* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_get("projectId", "zone", "clusterId")
/// .name("aliquyam")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterGetCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_cluster_id: String,
_name: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterGetCall<'a, C> {}
impl<'a, C> ProjectZoneClusterGetCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Cluster)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.get",
http_method: hyper::Method::GET,
});
for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
if let Some(value) = self._name.as_ref() {
params.push("name", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to retrieve. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The name (project, location, cluster) of the cluster to retrieve. Specified in the format `projects/*/locations/*/clusters/*`.
///
/// Sets the *name* query property to the given value.
pub fn name(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C> {
self._name = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterGetCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterGetCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterGetCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterGetCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterGetCall<'a, C> {
self._scopes.clear();
self
}
}
/// Enables or disables the ABAC authorization mechanism on a cluster.
///
/// A builder for the *zones.clusters.legacyAbac* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLegacyAbacRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLegacyAbacRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_legacy_abac(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterLegacyAbacCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLegacyAbacRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterLegacyAbacCall<'a, C> {}
impl<'a, C> ProjectZoneClusterLegacyAbacCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.legacyAbac",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/legacyAbac";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLegacyAbacRequest,
) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to update. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLegacyAbacCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLegacyAbacCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLegacyAbacCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterLegacyAbacCall<'a, C> {
self._scopes.clear();
self
}
}
/// Lists all clusters owned by a project in either the specified zone or all zones.
///
/// A builder for the *zones.clusters.list* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_list("projectId", "zone")
/// .parent("sed")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterListCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_parent: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterListCall<'a, C> {}
impl<'a, C> ProjectZoneClusterListCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ListClustersResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.list",
http_method: hyper::Method::GET,
});
for &field in ["alt", "projectId", "zone", "parent"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(5 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
if let Some(value) = self._parent.as_ref() {
params.push("parent", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// The parent (project and location) where the clusters will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
///
/// Sets the *parent* query property to the given value.
pub fn parent(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C> {
self._parent = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterListCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterListCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterListCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterListCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterListCall<'a, C> {
self._scopes.clear();
self
}
}
/// 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.
///
/// A builder for the *zones.clusters.locations* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLocationsRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLocationsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_locations(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterLocationCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLocationsRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterLocationCall<'a, C> {}
impl<'a, C> ProjectZoneClusterLocationCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.locations",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/locations";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLocationsRequest,
) -> ProjectZoneClusterLocationCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterLocationCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLocationCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLocationCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLocationCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterLocationCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the logging service for a specific cluster.
///
/// A builder for the *zones.clusters.logging* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLoggingServiceRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLoggingServiceRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_logging(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterLoggingCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLoggingServiceRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterLoggingCall<'a, C> {}
impl<'a, C> ProjectZoneClusterLoggingCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.logging",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/logging";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLoggingServiceRequest,
) -> ProjectZoneClusterLoggingCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterLoggingCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterLoggingCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterLoggingCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterLoggingCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterLoggingCall<'a, C> {
self._scopes.clear();
self
}
}
/// Updates the master for a specific cluster.
///
/// A builder for the *zones.clusters.master* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::UpdateMasterRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = UpdateMasterRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_master(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterMasterCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: UpdateMasterRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterMasterCall<'a, C> {}
impl<'a, C> ProjectZoneClusterMasterCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.master",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/master";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: UpdateMasterRequest,
) -> ProjectZoneClusterMasterCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterMasterCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterMasterCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterMasterCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterMasterCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterMasterCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the monitoring service for a specific cluster.
///
/// A builder for the *zones.clusters.monitoring* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetMonitoringServiceRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetMonitoringServiceRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_monitoring(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterMonitoringCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetMonitoringServiceRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterMonitoringCall<'a, C> {}
impl<'a, C> ProjectZoneClusterMonitoringCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.monitoring",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/monitoring";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetMonitoringServiceRequest,
) -> ProjectZoneClusterMonitoringCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterMonitoringCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterMonitoringCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterMonitoringCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterMonitoringCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterMonitoringCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets labels on a cluster.
///
/// A builder for the *zones.clusters.resourceLabels* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetLabelsRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetLabelsRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_resource_labels(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterResourceLabelCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetLabelsRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterResourceLabelCall<'a, C> {}
impl<'a, C> ProjectZoneClusterResourceLabelCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.resourceLabels",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/resourceLabels";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetLabelsRequest,
) -> ProjectZoneClusterResourceLabelCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterResourceLabelCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterResourceLabelCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterResourceLabelCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterResourceLabelCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterResourceLabelCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets the maintenance policy for a cluster.
///
/// A builder for the *zones.clusters.setMaintenancePolicy* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetMaintenancePolicyRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetMaintenancePolicyRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_set_maintenance_policy(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetMaintenancePolicyRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {}
impl<'a, C> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.setMaintenancePolicy",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMaintenancePolicy";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetMaintenancePolicyRequest,
) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
self._request = new_value;
self
}
/// Required. The Google Developers Console [project ID or project number](https://cloud.google.com/resource-manager/docs/creating-managing-projects).
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// Required. The name of the Google Compute Engine [zone](https://cloud.google.com/compute/docs/zones#available) in which the cluster resides.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Required. The name of the cluster to update.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(
mut self,
new_value: &str,
) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(
mut self,
name: T,
value: T,
) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(
mut self,
scopes: I,
) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C> {
self._scopes.clear();
self
}
}
/// Sets master auth materials. Currently supports changing the admin password or a specific cluster, either via password generation or explicitly setting the password.
///
/// A builder for the *zones.clusters.setMasterAuth* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetMasterAuthRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetMasterAuthRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_set_master_auth(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterSetMasterAuthCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetMasterAuthRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterSetMasterAuthCall<'a, C> {}
impl<'a, C> ProjectZoneClusterSetMasterAuthCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.setMasterAuth",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMasterAuth";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetMasterAuthRequest,
) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterSetMasterAuthCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterSetMasterAuthCall<'a, C> {
self._scopes.clear();
self
}
}
/// Enables or disables Network Policy for a cluster.
///
/// A builder for the *zones.clusters.setNetworkPolicy* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::SetNetworkPolicyRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = SetNetworkPolicyRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_set_network_policy(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterSetNetworkPolicyCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: SetNetworkPolicyRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterSetNetworkPolicyCall<'a, C> {}
impl<'a, C> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.setNetworkPolicy",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setNetworkPolicy";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: SetNetworkPolicyRequest,
) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C> {
self._scopes.clear();
self
}
}
/// Starts master IP rotation.
///
/// A builder for the *zones.clusters.startIpRotation* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::StartIPRotationRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = StartIPRotationRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_start_ip_rotation(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterStartIpRotationCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: StartIPRotationRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterStartIpRotationCall<'a, C> {}
impl<'a, C> ProjectZoneClusterStartIpRotationCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.startIpRotation",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:startIpRotation";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: StartIPRotationRequest,
) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterStartIpRotationCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterStartIpRotationCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterStartIpRotationCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterStartIpRotationCall<'a, C> {
self._scopes.clear();
self
}
}
/// Updates the settings of a specific cluster.
///
/// A builder for the *zones.clusters.update* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::UpdateClusterRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = UpdateClusterRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_clusters_update(req, "projectId", "zone", "clusterId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneClusterUpdateCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: UpdateClusterRequest,
_project_id: String,
_zone: String,
_cluster_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneClusterUpdateCall<'a, C> {}
impl<'a, C> ProjectZoneClusterUpdateCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.clusters.update",
http_method: hyper::Method::PUT,
});
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("clusterId", self._cluster_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{clusterId}", "clusterId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["clusterId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::PUT)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: UpdateClusterRequest,
) -> ProjectZoneClusterUpdateCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The name of the cluster to upgrade. This field has been deprecated and replaced by the name field.
///
/// Sets the *cluster id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C> {
self._cluster_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneClusterUpdateCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneClusterUpdateCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneClusterUpdateCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneClusterUpdateCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneClusterUpdateCall<'a, C> {
self._scopes.clear();
self
}
}
/// Cancels the specified operation.
///
/// A builder for the *zones.operations.cancel* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// use container1::api::CancelOperationRequest;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // As the method needs a request, you would usually fill it with the desired information
/// // into the respective structure. Some of the parts shown here might not be applicable !
/// // Values shown here are possibly random and not representative !
/// let mut req = CancelOperationRequest::default();
///
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_operations_cancel(req, "projectId", "zone", "operationId")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneOperationCancelCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_request: CancelOperationRequest,
_project_id: String,
_zone: String,
_operation_id: String,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneOperationCancelCall<'a, C> {}
impl<'a, C> ProjectZoneOperationCancelCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Empty)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.operations.cancel",
http_method: hyper::Method::POST,
});
for &field in ["alt", "projectId", "zone", "operationId"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("operationId", self._operation_id);
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/operations/{operationId}:cancel";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{operationId}", "operationId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["operationId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
let mut json_mime_type = mime::APPLICATION_JSON;
let mut request_value_reader = {
let mut value = serde_json::value::to_value(&self._request).expect("serde to work");
common::remove_json_null_values(&mut value);
let mut dst = std::io::Cursor::new(Vec::with_capacity(128));
serde_json::to_writer(&mut dst, &value).unwrap();
dst
};
let request_size = request_value_reader
.seek(std::io::SeekFrom::End(0))
.unwrap();
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
request_value_reader
.seek(std::io::SeekFrom::Start(0))
.unwrap();
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::POST)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_TYPE, json_mime_type.to_string())
.header(CONTENT_LENGTH, request_size as u64)
.body(common::to_body(
request_value_reader.get_ref().clone().into(),
));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
///
/// Sets the *request* property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn request(
mut self,
new_value: CancelOperationRequest,
) -> ProjectZoneOperationCancelCall<'a, C> {
self._request = new_value;
self
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
///
/// Sets the *operation id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C> {
self._operation_id = new_value.to_string();
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneOperationCancelCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationCancelCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationCancelCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationCancelCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneOperationCancelCall<'a, C> {
self._scopes.clear();
self
}
}
/// Gets the specified operation.
///
/// A builder for the *zones.operations.get* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_operations_get("projectId", "zone", "operationId")
/// .name("aliquyam")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneOperationGetCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_operation_id: String,
_name: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneOperationGetCall<'a, C> {}
impl<'a, C> ProjectZoneOperationGetCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, Operation)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.operations.get",
http_method: hyper::Method::GET,
});
for &field in ["alt", "projectId", "zone", "operationId", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(6 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
params.push("operationId", self._operation_id);
if let Some(value) = self._name.as_ref() {
params.push("name", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url = self.hub._base_url.clone()
+ "v1/projects/{projectId}/zones/{zone}/operations/{operationId}";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [
("{projectId}", "projectId"),
("{zone}", "zone"),
("{operationId}", "operationId"),
]
.iter()
{
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["operationId", "zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// Deprecated. The server-assigned `name` of the operation. This field has been deprecated and replaced by the name field.
///
/// Sets the *operation id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
self._operation_id = new_value.to_string();
self
}
/// The name (project, location, operation id) of the operation to get. Specified in the format `projects/*/locations/*/operations/*`.
///
/// Sets the *name* query property to the given value.
pub fn name(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C> {
self._name = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneOperationGetCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationGetCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationGetCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationGetCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneOperationGetCall<'a, C> {
self._scopes.clear();
self
}
}
/// Lists all operations in a project in a specific zone or all zones.
///
/// A builder for the *zones.operations.list* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_operations_list("projectId", "zone")
/// .parent("dolores")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneOperationListCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_parent: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneOperationListCall<'a, C> {}
impl<'a, C> ProjectZoneOperationListCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ListOperationsResponse)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.operations.list",
http_method: hyper::Method::GET,
});
for &field in ["alt", "projectId", "zone", "parent"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(5 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
if let Some(value) = self._parent.as_ref() {
params.push("parent", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url =
self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/operations";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// The parent (project and location) where the operations will be listed. Specified in the format `projects/*/locations/*`. Location "-" matches all zones and all regions.
///
/// Sets the *parent* query property to the given value.
pub fn parent(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C> {
self._parent = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneOperationListCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneOperationListCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneOperationListCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneOperationListCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneOperationListCall<'a, C> {
self._scopes.clear();
self
}
}
/// Returns configuration info about the Google Kubernetes Engine service.
///
/// A builder for the *zones.getServerconfig* method supported by a *project* resource.
/// It is not used directly, but through a [`ProjectMethods`] instance.
///
/// # Example
///
/// Instantiate a resource method builder
///
/// ```test_harness,no_run
/// # extern crate hyper;
/// # extern crate hyper_rustls;
/// # extern crate google_container1 as container1;
/// # async fn dox() {
/// # use container1::{Container, FieldMask, hyper_rustls, hyper_util, yup_oauth2};
///
/// # let secret: yup_oauth2::ApplicationSecret = Default::default();
/// # let connector = hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_only()
/// # .enable_http2()
/// # .build();
///
/// # let executor = hyper_util::rt::TokioExecutor::new();
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::with_client(
/// # secret,
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
/// # yup_oauth2::client::CustomHyperClientBuilder::from(
/// # hyper_util::client::legacy::Client::builder(executor).build(connector),
/// # ),
/// # ).build().await.unwrap();
///
/// # let client = hyper_util::client::legacy::Client::builder(
/// # hyper_util::rt::TokioExecutor::new()
/// # )
/// # .build(
/// # hyper_rustls::HttpsConnectorBuilder::new()
/// # .with_native_roots()
/// # .unwrap()
/// # .https_or_http()
/// # .enable_http2()
/// # .build()
/// # );
/// # let mut hub = Container::new(client, auth);
/// // You can configure optional parameters by calling the respective setters at will, and
/// // execute the final call using `doit()`.
/// // Values shown here are possibly random and not representative !
/// let result = hub.projects().zones_get_serverconfig("projectId", "zone")
/// .name("dolor")
/// .doit().await;
/// # }
/// ```
pub struct ProjectZoneGetServerconfigCall<'a, C>
where
C: 'a,
{
hub: &'a Container<C>,
_project_id: String,
_zone: String,
_name: Option<String>,
_delegate: Option<&'a mut dyn common::Delegate>,
_additional_params: HashMap<String, String>,
_scopes: BTreeSet<String>,
}
impl<'a, C> common::CallBuilder for ProjectZoneGetServerconfigCall<'a, C> {}
impl<'a, C> ProjectZoneGetServerconfigCall<'a, C>
where
C: common::Connector,
{
/// Perform the operation you have build so far.
pub async fn doit(mut self) -> common::Result<(common::Response, ServerConfig)> {
use std::borrow::Cow;
use std::io::{Read, Seek};
use common::{url::Params, ToParts};
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, LOCATION, USER_AGENT};
let mut dd = common::DefaultDelegate;
let mut dlg: &mut dyn common::Delegate = self._delegate.unwrap_or(&mut dd);
dlg.begin(common::MethodInfo {
id: "container.projects.zones.getServerconfig",
http_method: hyper::Method::GET,
});
for &field in ["alt", "projectId", "zone", "name"].iter() {
if self._additional_params.contains_key(field) {
dlg.finished(false);
return Err(common::Error::FieldClash(field));
}
}
let mut params = Params::with_capacity(5 + self._additional_params.len());
params.push("projectId", self._project_id);
params.push("zone", self._zone);
if let Some(value) = self._name.as_ref() {
params.push("name", value);
}
params.extend(self._additional_params.iter());
params.push("alt", "json");
let mut url =
self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/serverconfig";
if self._scopes.is_empty() {
self._scopes
.insert(Scope::CloudPlatform.as_ref().to_string());
}
#[allow(clippy::single_element_loop)]
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
url = params.uri_replacement(url, param_name, find_this, false);
}
{
let to_remove = ["zone", "projectId"];
params.remove_params(&to_remove);
}
let url = params.parse_with_url(&url);
loop {
let token = match self
.hub
.auth
.get_token(&self._scopes.iter().map(String::as_str).collect::<Vec<_>>()[..])
.await
{
Ok(token) => token,
Err(e) => match dlg.token(e) {
Ok(token) => token,
Err(e) => {
dlg.finished(false);
return Err(common::Error::MissingToken(e));
}
},
};
let mut req_result = {
let client = &self.hub.client;
dlg.pre_request();
let mut req_builder = hyper::Request::builder()
.method(hyper::Method::GET)
.uri(url.as_str())
.header(USER_AGENT, self.hub._user_agent.clone());
if let Some(token) = token.as_ref() {
req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token));
}
let request = req_builder
.header(CONTENT_LENGTH, 0_u64)
.body(common::to_body::<String>(None));
client.request(request.unwrap()).await
};
match req_result {
Err(err) => {
if let common::Retry::After(d) = dlg.http_error(&err) {
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(common::Error::HttpError(err));
}
Ok(res) => {
let (mut parts, body) = res.into_parts();
let mut body = common::Body::new(body);
if !parts.status.is_success() {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let error = serde_json::from_str(&common::to_string(&bytes));
let response = common::to_response(parts, bytes.into());
if let common::Retry::After(d) =
dlg.http_failure(&response, error.as_ref().ok())
{
sleep(d).await;
continue;
}
dlg.finished(false);
return Err(match error {
Ok(value) => common::Error::BadRequest(value),
_ => common::Error::Failure(response),
});
}
let response = {
let bytes = common::to_bytes(body).await.unwrap_or_default();
let encoded = common::to_string(&bytes);
match serde_json::from_str(&encoded) {
Ok(decoded) => (common::to_response(parts, bytes.into()), decoded),
Err(error) => {
dlg.response_json_decode_error(&encoded, &error);
return Err(common::Error::JsonDecodeError(
encoded.to_string(),
error,
));
}
}
};
dlg.finished(true);
return Ok(response);
}
}
}
}
/// 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.
///
/// Sets the *project id* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn project_id(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
self._project_id = new_value.to_string();
self
}
/// 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.
///
/// Sets the *zone* path property to the given value.
///
/// Even though the property as already been set when instantiating this call,
/// we provide this method for API completeness.
pub fn zone(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
self._zone = new_value.to_string();
self
}
/// The name (project and location) of the server config to get, specified in the format `projects/*/locations/*`.
///
/// Sets the *name* query property to the given value.
pub fn name(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C> {
self._name = Some(new_value.to_string());
self
}
/// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong
/// while executing the actual API request.
///
/// ````text
/// It should be used to handle progress information, and to implement a certain level of resilience.
/// ````
///
/// Sets the *delegate* property to the given value.
pub fn delegate(
mut self,
new_value: &'a mut dyn common::Delegate,
) -> ProjectZoneGetServerconfigCall<'a, C> {
self._delegate = Some(new_value);
self
}
/// Set any additional parameter of the query string used in the request.
/// It should be used to set parameters which are not yet available through their own
/// setters.
///
/// Please note that this method must not be used to set any of the known parameters
/// which have their own setter method. If done anyway, the request will fail.
///
/// # Additional Parameters
///
/// * *$.xgafv* (query-string) - V1 error format.
/// * *access_token* (query-string) - OAuth access token.
/// * *alt* (query-string) - Data format for response.
/// * *callback* (query-string) - JSONP
/// * *fields* (query-string) - Selector specifying which fields to include in a partial response.
/// * *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.
/// * *oauth_token* (query-string) - OAuth 2.0 token for the current user.
/// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks.
/// * *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.
/// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart").
/// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart").
pub fn param<T>(mut self, name: T, value: T) -> ProjectZoneGetServerconfigCall<'a, C>
where
T: AsRef<str>,
{
self._additional_params
.insert(name.as_ref().to_string(), value.as_ref().to_string());
self
}
/// Identifies the authorization scope for the method you are building.
///
/// Use this method to actively specify which scope should be used, instead of the default [`Scope`] variant
/// [`Scope::CloudPlatform`].
///
/// The `scope` will be added to a set of scopes. This is important as one can maintain access
/// tokens for more than one scope.
///
/// Usually there is more than one suitable scope to authorize an operation, some of which may
/// encompass more rights than others. For example, for listing resources, a *read-only* scope will be
/// sufficient, a read-write scope will do as well.
pub fn add_scope<St>(mut self, scope: St) -> ProjectZoneGetServerconfigCall<'a, C>
where
St: AsRef<str>,
{
self._scopes.insert(String::from(scope.as_ref()));
self
}
/// Identifies the authorization scope(s) for the method you are building.
///
/// See [`Self::add_scope()`] for details.
pub fn add_scopes<I, St>(mut self, scopes: I) -> ProjectZoneGetServerconfigCall<'a, C>
where
I: IntoIterator<Item = St>,
St: AsRef<str>,
{
self._scopes
.extend(scopes.into_iter().map(|s| String::from(s.as_ref())));
self
}
/// Removes all scopes, and no default scope will be used either.
/// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`]
/// for details).
pub fn clear_scopes(mut self) -> ProjectZoneGetServerconfigCall<'a, C> {
self._scopes.clear();
self
}
}