mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-01 00:51:17 +01:00
22521 lines
1.0 MiB
22521 lines
1.0 MiB
use std::collections::HashMap;
|
|
use std::cell::RefCell;
|
|
use std::default::Default;
|
|
use std::collections::BTreeMap;
|
|
use serde_json as json;
|
|
use std::io;
|
|
use std::fs;
|
|
use std::mem;
|
|
use std::thread::sleep;
|
|
|
|
use crate::client;
|
|
|
|
// ##############
|
|
// 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, Hash)]
|
|
pub enum Scope {
|
|
/// View and manage your data across Google Cloud Platform services
|
|
CloudPlatform,
|
|
}
|
|
|
|
impl AsRef<str> for Scope {
|
|
fn as_ref(&self) -> &str {
|
|
match *self {
|
|
Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform",
|
|
}
|
|
}
|
|
}
|
|
|
|
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 yup_oauth2 as oauth2;
|
|
/// extern crate google_container1 as container1;
|
|
/// use container1::{Result, Error};
|
|
/// # async fn dox() {
|
|
/// use std::default::Default;
|
|
/// use oauth2;
|
|
/// use container1::Container;
|
|
///
|
|
/// // Get an ApplicationSecret instance by some means. It contains the `client_id` and
|
|
/// // `client_secret`, among other things.
|
|
/// let secret: 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 auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// secret,
|
|
/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// ).build().await.unwrap();
|
|
/// let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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),
|
|
/// }
|
|
/// # }
|
|
/// ```
|
|
pub struct Container<> {
|
|
client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>,
|
|
auth: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>,
|
|
_user_agent: String,
|
|
_base_url: String,
|
|
_root_url: String,
|
|
}
|
|
|
|
impl<'a, > client::Hub for Container<> {}
|
|
|
|
impl<'a, > Container<> {
|
|
|
|
pub fn new(client: hyper::Client<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>, hyper::body::Body>, authenticator: oauth2::authenticator::Authenticator<hyper_rustls::HttpsConnector<hyper::client::connect::HttpConnector>>) -> Container<> {
|
|
Container {
|
|
client,
|
|
auth: authenticator,
|
|
_user_agent: "google-api-rust-client/2.0.4".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> {
|
|
ProjectMethods { hub: &self }
|
|
}
|
|
|
|
/// Set the user-agent header field to use in all requests to the server.
|
|
/// It defaults to `google-api-rust-client/2.0.4`.
|
|
///
|
|
/// Returns the previously set user-agent.
|
|
pub fn user_agent(&mut self, agent_name: String) -> String {
|
|
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 {
|
|
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 {
|
|
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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct AcceleratorConfig {
|
|
/// The number of the accelerator cards exposed to an instance.
|
|
#[serde(rename="acceleratorCount")]
|
|
pub accelerator_count: Option<String>,
|
|
/// 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>,
|
|
}
|
|
|
|
impl client::Part for AcceleratorConfig {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 GCP 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 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 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>,
|
|
}
|
|
|
|
impl client::Part for AddonsConfig {}
|
|
|
|
|
|
/// Configuration for returning group information from authenticators.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for AuthenticatorGroupsConfig {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Autopilot {
|
|
/// Enable Autopilot
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for Autopilot {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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>,
|
|
/// Specifies the node management options for NAP created node-pools.
|
|
pub management: Option<NodeManagement>,
|
|
/// 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) 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 client::Part for AutoprovisioningNodePoolDefaults {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct BigQueryDestination {
|
|
/// The ID of a BigQuery Dataset.
|
|
#[serde(rename="datasetId")]
|
|
pub dataset_id: Option<String>,
|
|
}
|
|
|
|
impl client::Part for BigQueryDestination {}
|
|
|
|
|
|
/// Configuration for Binary Authorization.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct BinaryAuthorization {
|
|
/// Enable Binary Authorization for this cluster. If enabled, all container images will be validated by Binary Authorization.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for BinaryAuthorization {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::RequestValue for CancelOperationRequest {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ClientCertificateConfig {
|
|
/// Issue a client certificate.
|
|
#[serde(rename="issueClientCertificate")]
|
|
pub issue_client_certificate: Option<bool>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Cluster {
|
|
/// Configurations for the various addons available to run in the cluster.
|
|
#[serde(rename="addonsConfig")]
|
|
pub addons_config: Option<AddonsConfig>,
|
|
/// 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>,
|
|
/// Which conditions caused the current cluster state.
|
|
pub conditions: Option<Vec<StatusCondition>>,
|
|
/// [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>,
|
|
/// 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.
|
|
#[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>,
|
|
/// [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>,
|
|
/// 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>,
|
|
/// 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>>,
|
|
/// 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>,
|
|
/// 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.
|
|
#[serde(rename="masterAuthorizedNetworksConfig")]
|
|
pub master_authorized_networks_config: Option<MasterAuthorizedNetworksConfig>,
|
|
/// 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>,
|
|
/// 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>,
|
|
/// Configuration for private cluster.
|
|
#[serde(rename="privateClusterConfig")]
|
|
pub private_cluster_config: Option<PrivateClusterConfig>,
|
|
/// Release channel configuration.
|
|
#[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] 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`).
|
|
#[serde(rename="tpuIpv4CidrBlock")]
|
|
pub tpu_ipv4_cidr_block: Option<String>,
|
|
/// Cluster-level Vertical Pod Autoscaling configuration.
|
|
#[serde(rename="verticalPodAutoscaling")]
|
|
pub vertical_pod_autoscaling: Option<VerticalPodAutoscaling>,
|
|
/// Configuration for the use of Kubernetes Service Accounts in GCP 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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>,
|
|
/// 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 client::Part for ClusterAutoscaling {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ClusterUpdate {
|
|
/// Configurations for the various addons available to run in the cluster.
|
|
#[serde(rename="desiredAddonsConfig")]
|
|
pub desired_addons_config: Option<AddonsConfig>,
|
|
/// 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>,
|
|
/// Configuration of etcd encryption.
|
|
#[serde(rename="desiredDatabaseEncryption")]
|
|
pub desired_database_encryption: Option<DatabaseEncryption>,
|
|
/// The desired status of whether to disable default sNAT for this cluster.
|
|
#[serde(rename="desiredDefaultSnatStatus")]
|
|
pub desired_default_snat_status: Option<DefaultSnatStatus>,
|
|
/// 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>,
|
|
/// The desired config of Intra-node visibility.
|
|
#[serde(rename="desiredIntraNodeVisibilityConfig")]
|
|
pub desired_intra_node_visibility_config: Option<IntraNodeVisibilityConfig>,
|
|
/// 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 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 configuration options for master authorized networks feature.
|
|
#[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>,
|
|
/// 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>,
|
|
/// 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 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 private cluster configuration.
|
|
#[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 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>,
|
|
/// Configuration for Shielded Nodes.
|
|
#[serde(rename="desiredShieldedNodes")]
|
|
pub desired_shielded_nodes: Option<ShieldedNodes>,
|
|
/// 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>,
|
|
}
|
|
|
|
impl client::Part for ClusterUpdate {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 id) 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://developers.google.com/console/help/new/#projectnumber). 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 client::RequestValue for CompleteIPRotationRequest {}
|
|
|
|
|
|
/// Configuration options for the Config Connector add-on.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ConfigConnectorConfig {
|
|
/// Whether Cloud Connector is enabled for this cluster.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for ConfigConnectorConfig {}
|
|
|
|
|
|
/// Parameters for controlling consumption metering.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for ConsumptionMeteringConfig {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 id) 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://developers.google.com/console/help/new/#projectnumber). 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 client::RequestValue for CreateNodePoolRequest {}
|
|
|
|
|
|
/// Time window specified for daily maintenance operations.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for DailyMaintenanceWindow {}
|
|
|
|
|
|
/// Configuration of etcd encryption.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct DatabaseEncryption {
|
|
/// 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>,
|
|
/// Denotes the state of etcd encryption.
|
|
pub state: Option<String>,
|
|
}
|
|
|
|
impl client::Part for DatabaseEncryption {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct DefaultSnatStatus {
|
|
/// Disables cluster default sNAT rules.
|
|
pub disabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for DefaultSnatStatus {}
|
|
|
|
|
|
/// Configuration for NodeLocal DNSCache
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct DnsCacheConfig {
|
|
/// Whether NodeLocal DNSCache is enabled for this cluster.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::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); } The JSON representation for `Empty` is empty JSON object `{}`.
|
|
///
|
|
/// # 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) (response)
|
|
/// * [zones operations cancel projects](ProjectZoneOperationCancelCall) (response)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct Empty { _never_set: Option<bool> }
|
|
|
|
impl client::ResponseResult for Empty {}
|
|
|
|
|
|
/// Configuration for the Compute Engine PD CSI driver.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GcePersistentDiskCsiDriverConfig {
|
|
/// Whether the Compute Engine PD CSI driver is enabled for this cluster.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for GcePersistentDiskCsiDriverConfig {}
|
|
|
|
|
|
/// GetJSONWebKeysResponse is a valid JSON Web Key Set as specififed 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GetJSONWebKeysResponse {
|
|
/// OnePlatform automatically extracts this field and uses it to set the HTTP Cache-Control 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct GetOpenIDConfigResponse {
|
|
/// OnePlatform automatically extracts this field and uses it to set the HTTP Cache-Control 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 client::ResponseResult for GetOpenIDConfigResponse {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for HorizontalPodAutoscaling {}
|
|
|
|
|
|
/// RFC-2616: cache control support
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct HttpCacheControlResponseHeader {
|
|
/// 14.6 response cache age, in seconds since the response is generated
|
|
pub age: Option<String>,
|
|
/// 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for HttpLoadBalancing {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct IPAllocationPolicy {
|
|
/// 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>,
|
|
/// 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>,
|
|
/// 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>,
|
|
/// 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>,
|
|
/// 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.
|
|
#[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 client::Part for IPAllocationPolicy {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct IntraNodeVisibilityConfig {
|
|
/// Enables intra node visibility for this cluster.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for Jwk {}
|
|
|
|
|
|
/// Configuration for the Kubernetes Dashboard.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct KubernetesDashboard {
|
|
/// Whether the Kubernetes Dashboard is enabled for this cluster.
|
|
pub disabled: Option<bool>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct LinuxNodeConfig {
|
|
/// The Linux kernel parameters to be applied to the nodes and all pods running on the nodes. The following parameters are supported. net.core.netdev_max_backlog net.core.rmem_max net.core.wmem_default net.core.wmem_max net.core.optmem_max net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem net.ipv4.tcp_tw_reuse
|
|
pub sysctls: Option<HashMap<String, String>>,
|
|
}
|
|
|
|
impl client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ListNodePoolsResponse {
|
|
/// A list of node pools for a cluster.
|
|
#[serde(rename="nodePools")]
|
|
pub node_pools: Option<Vec<NodePool>>,
|
|
}
|
|
|
|
impl client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::ResponseResult for ListUsableSubnetworksResponse {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for MaintenanceWindow {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct MasterAuth {
|
|
/// [Output only] Base64-encoded public certificate used by clients to authenticate to the cluster endpoint.
|
|
#[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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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>,
|
|
}
|
|
|
|
impl client::Part for MasterAuthorizedNetworksConfig {}
|
|
|
|
|
|
/// Constraints applied to pods.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct MaxPodsConstraint {
|
|
/// Constraint enforced on the max num of pods per node.
|
|
#[serde(rename="maxPodsPerNode")]
|
|
pub max_pods_per_node: Option<String>,
|
|
}
|
|
|
|
impl client::Part for MaxPodsConstraint {}
|
|
|
|
|
|
/// Progress metric is (string, int|float|string) pair.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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")]
|
|
pub int_value: Option<String>,
|
|
/// 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 client::Part for Metric {}
|
|
|
|
|
|
/// NetworkConfig reports the relative names of network & subnetwork.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct NetworkConfig {
|
|
/// 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>,
|
|
/// 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>,
|
|
/// 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>,
|
|
/// 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>,
|
|
/// 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 client::Part for NetworkConfig {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct NetworkPolicyConfig {
|
|
/// Whether NetworkPolicy is enabled for this cluster.
|
|
pub disabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for NetworkPolicyConfig {}
|
|
|
|
|
|
/// Parameters that describe the nodes in a cluster.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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>>,
|
|
/// 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 this node. Note that for a given image type, the latest version of it will be used.
|
|
#[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>,
|
|
/// 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>,
|
|
/// 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 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" The following keys are reserved for Windows nodes: - "serial-port-logging-enable" 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 [Google Container Registry](https://cloud.google.com/container-registry/)). If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are enabled, in which case their required scopes will be added.
|
|
#[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>,
|
|
/// Sandbox configuration for this node.
|
|
#[serde(rename="sandboxConfig")]
|
|
pub sandbox_config: Option<SandboxConfig>,
|
|
/// 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>,
|
|
/// 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>>,
|
|
/// The workload metadata configuration for this node.
|
|
#[serde(rename="workloadMetadataConfig")]
|
|
pub workload_metadata_config: Option<WorkloadMetadataConfig>,
|
|
}
|
|
|
|
impl client::Part for NodeConfig {}
|
|
|
|
|
|
/// Node kubelet configs.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct NodeKubeletConfig {
|
|
/// 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.
|
|
#[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>,
|
|
}
|
|
|
|
impl client::Part for NodeKubeletConfig {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for NodeManagement {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct NodePool {
|
|
/// Autoscaler configuration for this NodePool. Autoscaler is enabled only if a valid configuration is present.
|
|
pub autoscaling: Option<NodePoolAutoscaling>,
|
|
/// Which conditions caused the current node pool state.
|
|
pub conditions: Option<Vec<StatusCondition>>,
|
|
/// The node configuration of the pool.
|
|
pub config: Option<NodeConfig>,
|
|
/// 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.
|
|
#[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>,
|
|
/// [Output only] The pod CIDR block size per node in this node pool.
|
|
#[serde(rename="podIpv4CidrSize")]
|
|
pub pod_ipv4_cidr_size: Option<i32>,
|
|
/// [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>,
|
|
/// Upgrade settings control disruption and speed of the upgrade.
|
|
#[serde(rename="upgradeSettings")]
|
|
pub upgrade_settings: Option<UpgradeSettings>,
|
|
/// The version of the Kubernetes of this node.
|
|
pub version: Option<String>,
|
|
}
|
|
|
|
impl client::ResponseResult for NodePool {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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>,
|
|
/// Maximum number of nodes in the NodePool. Must be >= min_node_count. There has to enough quota to scale up the cluster.
|
|
#[serde(rename="maxNodeCount")]
|
|
pub max_node_count: Option<i32>,
|
|
/// Minimum number of nodes in the NodePool. Must be >= 1 and <= max_node_count.
|
|
#[serde(rename="minNodeCount")]
|
|
pub min_node_count: Option<i32>,
|
|
}
|
|
|
|
impl client::Part for NodePoolAutoscaling {}
|
|
|
|
|
|
/// Kubernetes taint is comprised 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for NodeTaint {}
|
|
|
|
|
|
/// NotificationConfig is the configuration of notifications.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct NotificationConfig {
|
|
/// Notification config for Pub/Sub.
|
|
pub pubsub: Option<PubSub>,
|
|
}
|
|
|
|
impl client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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>>,
|
|
/// 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>,
|
|
/// 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>>,
|
|
/// The operation type.
|
|
#[serde(rename="operationType")]
|
|
pub operation_type: Option<String>,
|
|
/// Output only. [Output only] Progress information for an operation.
|
|
pub progress: Option<OperationProgress>,
|
|
/// Server-defined URL for the resource.
|
|
#[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>,
|
|
/// 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>,
|
|
/// Server-defined URL for the target of the operation.
|
|
#[serde(rename="targetLink")]
|
|
pub target_link: Option<String>,
|
|
/// 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 client::ResponseResult for Operation {}
|
|
|
|
|
|
/// Information about operation (or operation stage) progress.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for OperationProgress {}
|
|
|
|
|
|
/// Configuration options for private clusters.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct PrivateClusterConfig {
|
|
/// Whether the master's internal IP address is used as the cluster endpoint.
|
|
#[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.
|
|
#[serde(rename="enablePrivateNodes")]
|
|
pub enable_private_nodes: Option<bool>,
|
|
/// Controls master global access settings.
|
|
#[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.
|
|
#[serde(rename="privateEndpoint")]
|
|
pub private_endpoint: Option<String>,
|
|
/// Output only. The external IP address of this cluster's master endpoint.
|
|
#[serde(rename="publicEndpoint")]
|
|
pub public_endpoint: Option<String>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct PrivateClusterMasterGlobalAccessConfig {
|
|
/// Whenever master is accessible globally or not.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for PrivateClusterMasterGlobalAccessConfig {}
|
|
|
|
|
|
/// Pub/Sub specific notification config.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct PubSub {
|
|
/// Enable notifications for Pub/Sub.
|
|
pub enabled: Option<bool>,
|
|
/// The desired Pub/Sub topic to which notifications will be sent by GKE. Format is `projects/{project}/topics/{topic}`.
|
|
pub topic: Option<String>,
|
|
}
|
|
|
|
impl client::Part for PubSub {}
|
|
|
|
|
|
/// Represents an arbitrary window of time that recurs.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct RecurringTimeWindow {
|
|
/// An RRULE (https://tools.ietf.org/html/rfc5545#section-3.8.5.3) for how this window reccurs. They go on for the span of time between the start and end time. For example, to have something repeat every weekday, you'd use: `FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR` To repeat some window daily (equivalent to the DailyMaintenanceWindow): `FREQ=DAILY` For the first weekend of every month: `FREQ=MONTHLY;BYSETPOS=1;BYDAY=SA,SU` This specifies how frequently the window starts. Eg, if you wanted to have a 9-5 UTC-4 window every weekday, you'd use something like: ``` start time = 2019-01-01T09:00:00-0400 end time = 2019-01-01T17:00:00-0400 recurrence = FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR ``` Windows can span multiple days. Eg, to make the window encompass every weekend from midnight Saturday till the last minute of Sunday UTC: ``` start time = 2019-01-05T00:00:00Z end time = 2019-01-07T23:59:00Z recurrence = FREQ=WEEKLY;BYDAY=SA ``` Note the start and end time's specific dates are largely arbitrary except to specify duration of the window and when it first starts. The FREQ values of HOURLY, MINUTELY, and SECONDLY are not supported.
|
|
pub recurrence: Option<String>,
|
|
/// The window of the first recurrence.
|
|
pub window: Option<TimeWindow>,
|
|
}
|
|
|
|
impl client::Part for RecurringTimeWindow {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ReleaseChannel {
|
|
/// channel specifies which release channel the cluster is subscribed to.
|
|
pub channel: Option<String>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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>,
|
|
/// List of valid versions for the channel.
|
|
#[serde(rename="validVersions")]
|
|
pub valid_versions: Option<Vec<String>>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 "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 client::Part for ReservationAffinity {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ResourceLimit {
|
|
/// Maximum amount of the resource in the cluster.
|
|
pub maximum: Option<String>,
|
|
/// Minimum amount of the resource in the cluster.
|
|
pub minimum: Option<String>,
|
|
/// Resource name "cpu", "memory" or gpu-specific string.
|
|
#[serde(rename="resourceType")]
|
|
pub resource_type: Option<String>,
|
|
}
|
|
|
|
impl client::Part for ResourceLimit {}
|
|
|
|
|
|
/// Configuration for exporting cluster resource usages.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::RequestValue for RollbackNodePoolUpgradeRequest {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct SandboxConfig {
|
|
/// Type of the sandbox to use for the node.
|
|
#[serde(rename="type")]
|
|
pub type_: Option<String>,
|
|
}
|
|
|
|
impl client::Part for SandboxConfig {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::ResponseResult for ServerConfig {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 id) 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://developers.google.com/console/help/new/#projectnumber). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 id) 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 id) 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://support.google.com/cloud/answer/6158840).
|
|
#[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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 id) 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://developers.google.com/console/help/new/#projectnumber). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for ShieldedInstanceConfig {}
|
|
|
|
|
|
/// Configuration of Shielded Nodes feature.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct ShieldedNodes {
|
|
/// Whether Shielded Nodes features are enabled on all nodes in this cluster.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for ShieldedNodes {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 id) 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://developers.google.com/console/help/new/#projectnumber). 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 client::RequestValue for StartIPRotationRequest {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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, String>>>,
|
|
/// 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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<String>,
|
|
/// The time that the window first starts.
|
|
#[serde(rename="startTime")]
|
|
pub start_time: Option<String>,
|
|
}
|
|
|
|
impl client::Part for TimeWindow {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::RequestValue for UpdateClusterRequest {}
|
|
|
|
|
|
/// 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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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://support.google.com/cloud/answer/6158840). 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 client::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)
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct UpdateNodePoolRequest {
|
|
/// 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 image type for the node pool.
|
|
#[serde(rename="imageType")]
|
|
pub image_type: Option<String>,
|
|
/// Node kubelet configs.
|
|
#[serde(rename="kubeletConfig")]
|
|
pub kubelet_config: Option<NodeKubeletConfig>,
|
|
/// 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.
|
|
pub locations: Option<Vec<String>>,
|
|
/// 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>,
|
|
/// 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://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field.
|
|
#[serde(rename="projectId")]
|
|
pub project_id: Option<String>,
|
|
/// Upgrade settings control disruption and speed of the upgrade.
|
|
#[serde(rename="upgradeSettings")]
|
|
pub upgrade_settings: Option<UpgradeSettings>,
|
|
/// 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 client::RequestValue for UpdateNodePoolRequest {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct UpgradeSettings {
|
|
/// 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>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for UsableSubnetworkSecondaryRange {}
|
|
|
|
|
|
/// 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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct VerticalPodAutoscaling {
|
|
/// Enables vertical pod autoscaling.
|
|
pub enabled: Option<bool>,
|
|
}
|
|
|
|
impl client::Part for VerticalPodAutoscaling {}
|
|
|
|
|
|
/// Configuration for the use of Kubernetes Service Accounts in GCP IAM policies.
|
|
///
|
|
/// This type is not used in any activity, and only used as *part* of another schema.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
|
pub struct WorkloadIdentityConfig {
|
|
/// The workload pool to attach all Kubernetes service accounts to.
|
|
#[serde(rename="workloadPool")]
|
|
pub workload_pool: Option<String>,
|
|
}
|
|
|
|
impl client::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.
|
|
///
|
|
#[derive(Default, Clone, Debug, Serialize, 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 client::Part for WorkloadMetadataConfig {}
|
|
|
|
|
|
|
|
// ###################
|
|
// 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 yup_oauth2 as oauth2;
|
|
/// extern crate google_container1 as container1;
|
|
///
|
|
/// # async fn dox() {
|
|
/// use std::default::Default;
|
|
/// use oauth2;
|
|
/// use container1::Container;
|
|
///
|
|
/// let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// secret,
|
|
/// yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// ).build().await.unwrap();
|
|
/// let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), auth);
|
|
/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders*
|
|
/// // like `aggregated_usable_subnetworks_list(...)`, `locations_clusters_complete_ip_rotation(...)`, `locations_clusters_create(...)`, `locations_clusters_delete(...)`, `locations_clusters_get(...)`, `locations_clusters_get_jwks(...)`, `locations_clusters_list(...)`, `locations_clusters_node_pools_create(...)`, `locations_clusters_node_pools_delete(...)`, `locations_clusters_node_pools_get(...)`, `locations_clusters_node_pools_list(...)`, `locations_clusters_node_pools_rollback(...)`, `locations_clusters_node_pools_set_autoscaling(...)`, `locations_clusters_node_pools_set_management(...)`, `locations_clusters_node_pools_set_size(...)`, `locations_clusters_node_pools_update(...)`, `locations_clusters_set_addons(...)`, `locations_clusters_set_legacy_abac(...)`, `locations_clusters_set_locations(...)`, `locations_clusters_set_logging(...)`, `locations_clusters_set_maintenance_policy(...)`, `locations_clusters_set_master_auth(...)`, `locations_clusters_set_monitoring(...)`, `locations_clusters_set_network_policy(...)`, `locations_clusters_set_resource_labels(...)`, `locations_clusters_start_ip_rotation(...)`, `locations_clusters_update(...)`, `locations_clusters_update_master(...)`, `locations_clusters_well_known_get_openid_configuration(...)`, `locations_get_server_config(...)`, `locations_operations_cancel(...)`, `locations_operations_get(...)`, `locations_operations_list(...)`, `zones_clusters_addons(...)`, `zones_clusters_complete_ip_rotation(...)`, `zones_clusters_create(...)`, `zones_clusters_delete(...)`, `zones_clusters_get(...)`, `zones_clusters_legacy_abac(...)`, `zones_clusters_list(...)`, `zones_clusters_locations(...)`, `zones_clusters_logging(...)`, `zones_clusters_master(...)`, `zones_clusters_monitoring(...)`, `zones_clusters_node_pools_autoscaling(...)`, `zones_clusters_node_pools_create(...)`, `zones_clusters_node_pools_delete(...)`, `zones_clusters_node_pools_get(...)`, `zones_clusters_node_pools_list(...)`, `zones_clusters_node_pools_rollback(...)`, `zones_clusters_node_pools_set_management(...)`, `zones_clusters_node_pools_set_size(...)`, `zones_clusters_node_pools_update(...)`, `zones_clusters_resource_labels(...)`, `zones_clusters_set_maintenance_policy(...)`, `zones_clusters_set_master_auth(...)`, `zones_clusters_set_network_policy(...)`, `zones_clusters_start_ip_rotation(...)`, `zones_clusters_update(...)`, `zones_get_serverconfig(...)`, `zones_operations_cancel(...)`, `zones_operations_get(...)` and `zones_operations_list(...)`
|
|
/// // to build up your call.
|
|
/// let rb = hub.projects();
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectMethods<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
}
|
|
|
|
impl<'a> client::MethodsBuilder for ProjectMethods<'a> {}
|
|
|
|
impl<'a> ProjectMethods<'a> {
|
|
|
|
/// 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> {
|
|
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:
|
|
///
|
|
/// Creates a node pool for a cluster.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `parent` - The parent (project, location, cluster id) 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> {
|
|
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> {
|
|
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:
|
|
///
|
|
/// 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> {
|
|
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 id) 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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. This API is not yet intended for general use, and is not available for all clusters.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `parent` - The cluster (project, location, cluster id) 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> {
|
|
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:
|
|
///
|
|
/// Completes master IP rotation.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `request` - No description provided.
|
|
/// * `name` - The name (project, location, cluster id) 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> {
|
|
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> {
|
|
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> {
|
|
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:
|
|
///
|
|
/// 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> {
|
|
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. This API is not yet intended for general use, and is not available for all clusters.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `parent` - The cluster (project, location, cluster id) to get keys for. Specified in the format `projects/*/locations/*/clusters/*`.
|
|
pub fn locations_clusters_get_jwks(&self, parent: &str) -> ProjectLocationClusterGetJwkCall<'a> {
|
|
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> {
|
|
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> {
|
|
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 id) 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> {
|
|
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> {
|
|
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> {
|
|
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 id) 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> {
|
|
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> {
|
|
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> {
|
|
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 id) 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> {
|
|
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 id) 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> {
|
|
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 id) 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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:
|
|
///
|
|
/// Retrieves the requested node pool.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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:
|
|
///
|
|
/// Gets the details of a specific cluster.
|
|
///
|
|
/// # Arguments
|
|
///
|
|
/// * `projectId` - Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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://support.google.com/cloud/answer/6158840).
|
|
/// * `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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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://support.google.com/cloud/answer/6158840). 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> {
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_parent: String,
|
|
_page_token: Option<String>,
|
|
_page_size: Option<i32>,
|
|
_filter: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectAggregatedUsableSubnetworkListCall<'a> {}
|
|
|
|
impl<'a> ProjectAggregatedUsableSubnetworkListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListUsableSubnetworksResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.aggregated.usableSubnetworks.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._page_token {
|
|
params.push(("pageToken", value.to_string()));
|
|
}
|
|
if let Some(value) = self._page_size {
|
|
params.push(("pageSize", value.to_string()));
|
|
}
|
|
if let Some(value) = self._filter {
|
|
params.push(("filter", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "pageToken", "pageSize", "filter"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/aggregated/usableSubnetworks";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectAggregatedUsableSubnetworkListCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectAggregatedUsableSubnetworkListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CreateNodePoolRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CreateNodePoolRequest,
|
|
_parent: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolCreateCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolCreateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.create",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
for &field in ["alt", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The parent (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolCreateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolCreateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("amet")
|
|
/// .project_id("duo")
|
|
/// .node_pool_id("ipsum")
|
|
/// .cluster_id("sed")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationClusterNodePoolDeleteCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_name: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_node_pool_id: Option<String>,
|
|
_cluster_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolDeleteCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolDeleteCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.delete",
|
|
http_method: hyper::Method::DELETE });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._node_pool_id {
|
|
params.push(("nodePoolId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._cluster_id {
|
|
params.push(("clusterId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "zone", "projectId", "nodePoolId", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolDeleteCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolDeleteCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("gubergren")
|
|
/// .project_id("rebum.")
|
|
/// .node_pool_id("est")
|
|
/// .cluster_id("ipsum")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationClusterNodePoolGetCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_name: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_node_pool_id: Option<String>,
|
|
_cluster_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolGetCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolGetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, NodePool)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.get",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._node_pool_id {
|
|
params.push(("nodePoolId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._cluster_id {
|
|
params.push(("clusterId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "zone", "projectId", "nodePoolId", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolGetCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolGetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("est")
|
|
/// .project_id("gubergren")
|
|
/// .cluster_id("ea")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationClusterNodePoolListCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_parent: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_cluster_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolListCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListNodePoolsResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._cluster_id {
|
|
params.push(("clusterId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "zone", "projectId", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/nodePools";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The parent (project, location, cluster id) 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolListCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::RollbackNodePoolUpgradeRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: RollbackNodePoolUpgradeRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolRollbackCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolRollbackCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.rollback",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:rollback";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolRollbackCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolRollbackCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNodePoolAutoscalingRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNodePoolAutoscalingRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolSetAutoscalingCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolSetAutoscalingCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.setAutoscaling",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setAutoscaling";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolSetAutoscalingCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNodePoolManagementRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNodePoolManagementRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolSetManagementCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolSetManagementCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.setManagement",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setManagement";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolSetManagementCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolSetManagementCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNodePoolSizeRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNodePoolSizeRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolSetSizeCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolSetSizeCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.setSize",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setSize";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolSetSizeCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolSetSizeCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::UpdateNodePoolRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: UpdateNodePoolRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterNodePoolUpdateCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterNodePoolUpdateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.nodePools.update",
|
|
http_method: hyper::Method::PUT });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterNodePoolUpdateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterNodePoolUpdateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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. This API is not yet intended for general use, and is not available for all clusters.
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_parent: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GetOpenIDConfigResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.well-known.getOpenid-configuration",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
for &field in ["alt", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/.well-known/openid-configuration";
|
|
|
|
let key = dlg.api_key();
|
|
match key {
|
|
Some(value) => params.push(("key", value)),
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingAPIKey)
|
|
}
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone());
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The cluster (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterWellKnownGetOpenidConfigurationCall<'a> {
|
|
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>
|
|
where T: AsRef<str> {
|
|
self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string());
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CompleteIPRotationRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CompleteIPRotationRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterCompleteIpRotationCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterCompleteIpRotationCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.completeIpRotation",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:completeIpRotation";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The name (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterCompleteIpRotationCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterCompleteIpRotationCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CreateClusterRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CreateClusterRequest,
|
|
_parent: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterCreateCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterCreateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.create",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
for &field in ["alt", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterCreateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterCreateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("kasd")
|
|
/// .project_id("et")
|
|
/// .cluster_id("sed")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationClusterDeleteCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_name: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_cluster_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterDeleteCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterDeleteCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.delete",
|
|
http_method: hyper::Method::DELETE });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._cluster_id {
|
|
params.push(("clusterId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterDeleteCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterDeleteCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("vero")
|
|
/// .cluster_id("erat")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationClusterGetCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_name: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_cluster_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterGetCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterGetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Cluster)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.get",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._cluster_id {
|
|
params.push(("clusterId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "zone", "projectId", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterGetCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterGetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|
|
/// Gets the public component of the cluster signing keys in JSON Web Key format. This API is not yet intended for general use, and is not available for all clusters.
|
|
///
|
|
/// 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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_parent: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterGetJwkCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterGetJwkCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, GetJSONWebKeysResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.getJwks",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
for &field in ["alt", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/jwks";
|
|
|
|
let key = dlg.api_key();
|
|
match key {
|
|
Some(value) => params.push(("key", value)),
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingAPIKey)
|
|
}
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone());
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// The cluster (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterGetJwkCall<'a> {
|
|
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>
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("dolore")
|
|
/// .project_id("et")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationClusterListCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_parent: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterListCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListClustersResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "zone", "projectId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/clusters";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterListCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetAddonsConfigRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetAddonsConfigRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetAddonCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetAddonCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setAddons",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setAddons";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetAddonCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetAddonCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLegacyAbacRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLegacyAbacRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetLegacyAbacCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetLegacyAbacCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setLegacyAbac",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setLegacyAbac";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The name (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetLegacyAbacCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetLegacyAbacCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLocationsRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLocationsRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetLocationCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetLocationCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setLocations",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setLocations";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetLocationCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetLocationCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLoggingServiceRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLoggingServiceRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetLoggingCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetLoggingCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setLogging",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setLogging";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetLoggingCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetLoggingCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetMaintenancePolicyRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetMaintenancePolicyRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetMaintenancePolicyCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetMaintenancePolicyCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setMaintenancePolicy",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setMaintenancePolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The name (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetMaintenancePolicyCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetMaintenancePolicyCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetMasterAuthRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetMasterAuthRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetMasterAuthCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetMasterAuthCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setMasterAuth",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setMasterAuth";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetMasterAuthCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetMasterAuthCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetMonitoringServiceRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetMonitoringServiceRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetMonitoringCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetMonitoringCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setMonitoring",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setMonitoring";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetMonitoringCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetMonitoringCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNetworkPolicyRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNetworkPolicyRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetNetworkPolicyCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetNetworkPolicyCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setNetworkPolicy",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setNetworkPolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The name (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetNetworkPolicyCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetNetworkPolicyCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLabelsRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLabelsRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterSetResourceLabelCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterSetResourceLabelCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.setResourceLabels",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:setResourceLabels";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The name (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterSetResourceLabelCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterSetResourceLabelCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::StartIPRotationRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: StartIPRotationRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterStartIpRotationCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterStartIpRotationCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.startIpRotation",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:startIpRotation";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// The name (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterStartIpRotationCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterStartIpRotationCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::UpdateClusterRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: UpdateClusterRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterUpdateCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterUpdateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.update",
|
|
http_method: hyper::Method::PUT });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterUpdateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterUpdateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::UpdateMasterRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: UpdateMasterRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationClusterUpdateMasterCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationClusterUpdateMasterCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.clusters.updateMaster",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:updateMaster";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationClusterUpdateMasterCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationClusterUpdateMasterCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CancelOperationRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CancelOperationRequest,
|
|
_name: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationOperationCancelCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationOperationCancelCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.operations.cancel",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
for &field in ["alt", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}:cancel";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationOperationCancelCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationOperationCancelCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("Stet")
|
|
/// .project_id("vero")
|
|
/// .operation_id("elitr")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationOperationGetCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_name: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_operation_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationOperationGetCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationOperationGetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.operations.get",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
if let Some(value) = self._operation_id {
|
|
params.push(("operationId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "zone", "projectId", "operationId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationOperationGetCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationOperationGetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("diam")
|
|
/// .project_id("no")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationOperationListCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_parent: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationOperationListCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationOperationListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListOperationsResponse)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.operations.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("parent", self._parent.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "parent", "zone", "projectId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+parent}/operations";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+parent}", "parent")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["parent"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationOperationListCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationOperationListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("accusam")
|
|
/// .project_id("takimata")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectLocationGetServerConfigCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_name: String,
|
|
_zone: Option<String>,
|
|
_project_id: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectLocationGetServerConfigCall<'a> {}
|
|
|
|
impl<'a> ProjectLocationGetServerConfigCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ServerConfig)> {
|
|
use url::percent_encoding::{percent_encode, DEFAULT_ENCODE_SET};
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.locations.getServerConfig",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("name", self._name.to_string()));
|
|
if let Some(value) = self._zone {
|
|
params.push(("zone", value.to_string()));
|
|
}
|
|
if let Some(value) = self._project_id {
|
|
params.push(("projectId", value.to_string()));
|
|
}
|
|
for &field in ["alt", "name", "zone", "projectId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/{+name}/serverConfig";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{+name}", "name")].iter() {
|
|
let mut replace_with = String::new();
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = value.to_string();
|
|
break;
|
|
}
|
|
}
|
|
if find_this.as_bytes()[1] == '+' as u8 {
|
|
replace_with = percent_encode(replace_with.as_bytes(), DEFAULT_ENCODE_SET).to_string();
|
|
}
|
|
url = url.replace(find_this, &replace_with);
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(1);
|
|
for param_name in ["name"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// 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> {
|
|
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> {
|
|
self._zone = Some(new_value.to_string());
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectLocationGetServerConfigCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectLocationGetServerConfigCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNodePoolAutoscalingRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNodePoolAutoscalingRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_node_pool_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolAutoscalingCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolAutoscalingCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.autoscaling",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
params.push(("nodePoolId", self._node_pool_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/autoscaling";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId"), ("{nodePoolId}", "nodePoolId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["nodePoolId", "clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolAutoscalingCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolAutoscalingCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CreateNodePoolRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CreateNodePoolRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolCreateCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolCreateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.create",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolCreateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolCreateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("accusam")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneClusterNodePoolDeleteCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_node_pool_id: String,
|
|
_name: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolDeleteCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolDeleteCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.delete",
|
|
http_method: hyper::Method::DELETE });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
params.push(("nodePoolId", self._node_pool_id.to_string()));
|
|
if let Some(value) = self._name {
|
|
params.push(("name", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId"), ("{nodePoolId}", "nodePoolId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["nodePoolId", "clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolDeleteCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolDeleteCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("voluptua.")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneClusterNodePoolGetCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_node_pool_id: String,
|
|
_name: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolGetCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolGetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, NodePool)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.get",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
params.push(("nodePoolId", self._node_pool_id.to_string()));
|
|
if let Some(value) = self._name {
|
|
params.push(("name", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId"), ("{nodePoolId}", "nodePoolId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["nodePoolId", "clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolGetCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolGetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("Lorem")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneClusterNodePoolListCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_parent: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolListCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListNodePoolsResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
if let Some(value) = self._parent {
|
|
params.push(("parent", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
self._cluster_id = new_value.to_string();
|
|
self
|
|
}
|
|
/// The parent (project, location, cluster id) 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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolListCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::RollbackNodePoolUpgradeRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: RollbackNodePoolUpgradeRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_node_pool_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolRollbackCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolRollbackCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.rollback",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
params.push(("nodePoolId", self._node_pool_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}:rollback";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId"), ("{nodePoolId}", "nodePoolId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["nodePoolId", "clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolRollbackCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolRollbackCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNodePoolManagementRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNodePoolManagementRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_node_pool_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolSetManagementCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolSetManagementCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.setManagement",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
params.push(("nodePoolId", self._node_pool_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setManagement";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId"), ("{nodePoolId}", "nodePoolId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["nodePoolId", "clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolSetManagementCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolSetManagementCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNodePoolSizeRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNodePoolSizeRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_node_pool_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolSetSizeCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolSetSizeCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.setSize",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
params.push(("nodePoolId", self._node_pool_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/setSize";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId"), ("{nodePoolId}", "nodePoolId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["nodePoolId", "clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolSetSizeCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolSetSizeCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::UpdateNodePoolRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: UpdateNodePoolRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_node_pool_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterNodePoolUpdateCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterNodePoolUpdateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.nodePools.update",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
params.push(("nodePoolId", self._node_pool_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "nodePoolId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/nodePools/{nodePoolId}/update";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId"), ("{nodePoolId}", "nodePoolId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(4);
|
|
for param_name in ["nodePoolId", "clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterNodePoolUpdateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterNodePoolUpdateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetAddonsConfigRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetAddonsConfigRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterAddonCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterAddonCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.addons",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/addons";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterAddonCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterAddonCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CompleteIPRotationRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CompleteIPRotationRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterCompleteIpRotationCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterCompleteIpRotationCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.completeIpRotation",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:completeIpRotation";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterCompleteIpRotationCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterCompleteIpRotationCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CreateClusterRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CreateClusterRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterCreateCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterCreateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.create",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
for &field in ["alt", "projectId", "zone"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterCreateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterCreateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("sadipscing")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneClusterDeleteCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_name: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterDeleteCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterDeleteCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.delete",
|
|
http_method: hyper::Method::DELETE });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
if let Some(value) = self._name {
|
|
params.push(("name", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterDeleteCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterDeleteCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("erat")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneClusterGetCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_name: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterGetCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterGetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Cluster)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.get",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
if let Some(value) = self._name {
|
|
params.push(("name", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "clusterId", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterGetCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterGetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLegacyAbacRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLegacyAbacRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterLegacyAbacCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterLegacyAbacCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.legacyAbac",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/legacyAbac";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterLegacyAbacCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterLegacyAbacCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("consetetur")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneClusterListCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_parent: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterListCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListClustersResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
if let Some(value) = self._parent {
|
|
params.push(("parent", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterListCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLocationsRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLocationsRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterLocationCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterLocationCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.locations",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/locations";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterLocationCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterLocationCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLoggingServiceRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLoggingServiceRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterLoggingCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterLoggingCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.logging",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/logging";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterLoggingCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterLoggingCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::UpdateMasterRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: UpdateMasterRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterMasterCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterMasterCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.master",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/master";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterMasterCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterMasterCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetMonitoringServiceRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetMonitoringServiceRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterMonitoringCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterMonitoringCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.monitoring",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/monitoring";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterMonitoringCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterMonitoringCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetLabelsRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetLabelsRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterResourceLabelCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterResourceLabelCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.resourceLabels",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}/resourceLabels";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterResourceLabelCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterResourceLabelCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetMaintenancePolicyRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetMaintenancePolicyRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterSetMaintenancePolicyCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterSetMaintenancePolicyCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.setMaintenancePolicy",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMaintenancePolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Required. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840).
|
|
///
|
|
/// 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterSetMaintenancePolicyCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterSetMaintenancePolicyCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetMasterAuthRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetMasterAuthRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterSetMasterAuthCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterSetMasterAuthCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.setMasterAuth",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setMasterAuth";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterSetMasterAuthCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterSetMasterAuthCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::SetNetworkPolicyRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: SetNetworkPolicyRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterSetNetworkPolicyCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterSetNetworkPolicyCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.setNetworkPolicy",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:setNetworkPolicy";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterSetNetworkPolicyCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterSetNetworkPolicyCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::StartIPRotationRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: StartIPRotationRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterStartIpRotationCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterStartIpRotationCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.startIpRotation",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}:startIpRotation";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterStartIpRotationCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterStartIpRotationCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::UpdateClusterRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: UpdateClusterRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_cluster_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneClusterUpdateCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneClusterUpdateCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.clusters.update",
|
|
http_method: hyper::Method::PUT });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("clusterId", self._cluster_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "clusterId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{clusterId}", "clusterId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["clusterId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneClusterUpdateCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneClusterUpdateCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// use container1::api::CancelOperationRequest;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_request: CancelOperationRequest,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_operation_id: String,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneOperationCancelCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneOperationCancelCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Empty)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.operations.cancel",
|
|
http_method: hyper::Method::POST });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("operationId", self._operation_id.to_string()));
|
|
for &field in ["alt", "projectId", "zone", "operationId"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/operations/{operationId}:cancel";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{operationId}", "operationId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["operationId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
let mut json_mime_type: mime::Mime = "application/json".parse().unwrap();
|
|
let mut request_value_reader =
|
|
{
|
|
let mut value = json::value::to_value(&self._request).expect("serde to work");
|
|
client::remove_json_null_values(&mut value);
|
|
let mut dst = io::Cursor::new(Vec::with_capacity(128));
|
|
json::to_writer(&mut dst, &value).unwrap();
|
|
dst
|
|
};
|
|
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
|
|
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
request_value_reader.seek(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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.header(CONTENT_TYPE, format!("{}", json_mime_type.to_string()))
|
|
.header(CONTENT_LENGTH, request_size as u64)
|
|
.body(hyper::body::Body::from(request_value_reader.get_ref().clone()));
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
///
|
|
/// 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> {
|
|
self._request = new_value;
|
|
self
|
|
}
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneOperationCancelCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneOperationCancelCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("sit")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneOperationGetCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_operation_id: String,
|
|
_name: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneOperationGetCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneOperationGetCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, Operation)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.operations.get",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
params.push(("operationId", self._operation_id.to_string()));
|
|
if let Some(value) = self._name {
|
|
params.push(("name", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "operationId", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/operations/{operationId}";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone"), ("{operationId}", "operationId")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(3);
|
|
for param_name in ["operationId", "zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneOperationGetCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneOperationGetCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("nonumy")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneOperationListCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_parent: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneOperationListCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneOperationListCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ListOperationsResponse)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.operations.list",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
if let Some(value) = self._parent {
|
|
params.push(("parent", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "parent"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/operations";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneOperationListCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneOperationListCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
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 yup_oauth2 as oauth2;
|
|
/// # extern crate google_container1 as container1;
|
|
/// # async fn dox() {
|
|
/// # use std::default::Default;
|
|
/// # use oauth2;
|
|
/// # use container1::Container;
|
|
///
|
|
/// # let secret: oauth2::ApplicationSecret = Default::default();
|
|
/// # let auth = yup_oauth2::InstalledFlowAuthenticator::builder(
|
|
/// # secret,
|
|
/// # yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect,
|
|
/// # ).build().await.unwrap();
|
|
/// # let mut hub = Container::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots()), 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("justo")
|
|
/// .doit().await;
|
|
/// # }
|
|
/// ```
|
|
pub struct ProjectZoneGetServerconfigCall<'a>
|
|
where {
|
|
|
|
hub: &'a Container<>,
|
|
_project_id: String,
|
|
_zone: String,
|
|
_name: Option<String>,
|
|
_delegate: Option<&'a mut dyn client::Delegate>,
|
|
_additional_params: HashMap<String, String>,
|
|
_scopes: BTreeMap<String, ()>
|
|
}
|
|
|
|
impl<'a> client::CallBuilder for ProjectZoneGetServerconfigCall<'a> {}
|
|
|
|
impl<'a> ProjectZoneGetServerconfigCall<'a> {
|
|
|
|
|
|
/// Perform the operation you have build so far.
|
|
pub async fn doit(mut self) -> client::Result<(hyper::Response<hyper::body::Body>, ServerConfig)> {
|
|
use std::io::{Read, Seek};
|
|
use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION};
|
|
use client::ToParts;
|
|
let mut dd = client::DefaultDelegate;
|
|
let mut dlg: &mut dyn client::Delegate = match self._delegate {
|
|
Some(d) => d,
|
|
None => &mut dd
|
|
};
|
|
dlg.begin(client::MethodInfo { id: "container.projects.zones.getServerconfig",
|
|
http_method: hyper::Method::GET });
|
|
let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len());
|
|
params.push(("projectId", self._project_id.to_string()));
|
|
params.push(("zone", self._zone.to_string()));
|
|
if let Some(value) = self._name {
|
|
params.push(("name", value.to_string()));
|
|
}
|
|
for &field in ["alt", "projectId", "zone", "name"].iter() {
|
|
if self._additional_params.contains_key(field) {
|
|
dlg.finished(false);
|
|
return Err(client::Error::FieldClash(field));
|
|
}
|
|
}
|
|
for (name, value) in self._additional_params.iter() {
|
|
params.push((&name, value.clone()));
|
|
}
|
|
|
|
params.push(("alt", "json".to_string()));
|
|
|
|
let mut url = self.hub._base_url.clone() + "v1/projects/{projectId}/zones/{zone}/serverconfig";
|
|
if self._scopes.len() == 0 {
|
|
self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ());
|
|
}
|
|
|
|
for &(find_this, param_name) in [("{projectId}", "projectId"), ("{zone}", "zone")].iter() {
|
|
let mut replace_with: Option<&str> = None;
|
|
for &(name, ref value) in params.iter() {
|
|
if name == param_name {
|
|
replace_with = Some(value);
|
|
break;
|
|
}
|
|
}
|
|
url = url.replace(find_this, replace_with.expect("to find substitution value in params"));
|
|
}
|
|
{
|
|
let mut indices_for_removal: Vec<usize> = Vec::with_capacity(2);
|
|
for param_name in ["zone", "projectId"].iter() {
|
|
if let Some(index) = params.iter().position(|t| &t.0 == param_name) {
|
|
indices_for_removal.push(index);
|
|
}
|
|
}
|
|
for &index in indices_for_removal.iter() {
|
|
params.remove(index);
|
|
}
|
|
}
|
|
|
|
let url = url::Url::parse_with_params(&url, params).unwrap();
|
|
|
|
|
|
|
|
loop {
|
|
let token = match self.hub.auth.token(&self._scopes.keys().collect::<Vec<_>>()[..]).await {
|
|
Ok(token) => token.clone(),
|
|
Err(err) => {
|
|
match dlg.token(&err) {
|
|
Some(token) => token,
|
|
None => {
|
|
dlg.finished(false);
|
|
return Err(client::Error::MissingToken(err))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
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.clone().into_string())
|
|
.header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str()));
|
|
|
|
|
|
let request = req_builder
|
|
.body(hyper::body::Body::empty());
|
|
|
|
client.request(request.unwrap()).await
|
|
|
|
};
|
|
|
|
match req_result {
|
|
Err(err) => {
|
|
if let client::Retry::After(d) = dlg.http_error(&err) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return Err(client::Error::HttpError(err))
|
|
}
|
|
Ok(mut res) => {
|
|
if !res.status().is_success() {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
let json_server_error = json::from_str::<client::JsonServerError>(&res_body_string).ok();
|
|
let server_error = json::from_str::<client::ServerError>(&res_body_string)
|
|
.or_else(|_| json::from_str::<client::ErrorResponse>(&res_body_string).map(|r| r.error))
|
|
.ok();
|
|
|
|
if let client::Retry::After(d) = dlg.http_failure(&res,
|
|
json_server_error,
|
|
server_error) {
|
|
sleep(d);
|
|
continue;
|
|
}
|
|
dlg.finished(false);
|
|
return match json::from_str::<client::ErrorResponse>(&res_body_string){
|
|
Err(_) => Err(client::Error::Failure(res)),
|
|
Ok(serr) => Err(client::Error::BadRequest(serr))
|
|
}
|
|
}
|
|
let result_value = {
|
|
let res_body_string = client::get_body_as_string(res.body_mut()).await;
|
|
|
|
match json::from_str(&res_body_string) {
|
|
Ok(decoded) => (res, decoded),
|
|
Err(err) => {
|
|
dlg.response_json_decode_error(&res_body_string, &err);
|
|
return Err(client::Error::JsonDecodeError(res_body_string, err));
|
|
}
|
|
}
|
|
};
|
|
|
|
dlg.finished(true);
|
|
return Ok(result_value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/// Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). 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> {
|
|
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> {
|
|
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> {
|
|
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.
|
|
///
|
|
/// 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 client::Delegate) -> ProjectZoneGetServerconfigCall<'a> {
|
|
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>
|
|
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 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.
|
|
/// If `None` is specified, then all scopes will be removed and no default scope will be used either.
|
|
/// In that case, you have to specify your API-key using the `key` parameter (see the `param()`
|
|
/// function for details).
|
|
///
|
|
/// 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<T, S>(mut self, scope: T) -> ProjectZoneGetServerconfigCall<'a>
|
|
where T: Into<Option<S>>,
|
|
S: AsRef<str> {
|
|
match scope.into() {
|
|
Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()),
|
|
None => None,
|
|
};
|
|
self
|
|
}
|
|
}
|
|
|
|
|