// DO NOT EDIT ! // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! //! This documentation was generated from *Container* crate version *1.0.7+20171111*, where *20171111* is the exact revision of the *container:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v1.0.7*. //! //! Everything else about the *Container* *v1* API can be found at the //! [official documentation site](https://cloud.google.com/container-engine/). //! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/master/gen/container1). //! # Features //! //! Handle the following *Resources* with ease from the central [hub](struct.Container.html) ... //! //! * projects //! * [*zones clusters addons*](struct.ProjectZoneClusterAddonCall.html), [*zones clusters complete ip rotation*](struct.ProjectZoneClusterCompleteIpRotationCall.html), [*zones clusters create*](struct.ProjectZoneClusterCreateCall.html), [*zones clusters delete*](struct.ProjectZoneClusterDeleteCall.html), [*zones clusters get*](struct.ProjectZoneClusterGetCall.html), [*zones clusters legacy abac*](struct.ProjectZoneClusterLegacyAbacCall.html), [*zones clusters list*](struct.ProjectZoneClusterListCall.html), [*zones clusters locations*](struct.ProjectZoneClusterLocationCall.html), [*zones clusters logging*](struct.ProjectZoneClusterLoggingCall.html), [*zones clusters master*](struct.ProjectZoneClusterMasterCall.html), [*zones clusters monitoring*](struct.ProjectZoneClusterMonitoringCall.html), [*zones clusters node pools autoscaling*](struct.ProjectZoneClusterNodePoolAutoscalingCall.html), [*zones clusters node pools create*](struct.ProjectZoneClusterNodePoolCreateCall.html), [*zones clusters node pools delete*](struct.ProjectZoneClusterNodePoolDeleteCall.html), [*zones clusters node pools get*](struct.ProjectZoneClusterNodePoolGetCall.html), [*zones clusters node pools list*](struct.ProjectZoneClusterNodePoolListCall.html), [*zones clusters node pools rollback*](struct.ProjectZoneClusterNodePoolRollbackCall.html), [*zones clusters node pools set management*](struct.ProjectZoneClusterNodePoolSetManagementCall.html), [*zones clusters node pools set size*](struct.ProjectZoneClusterNodePoolSetSizeCall.html), [*zones clusters node pools update*](struct.ProjectZoneClusterNodePoolUpdateCall.html), [*zones clusters resource labels*](struct.ProjectZoneClusterResourceLabelCall.html), [*zones clusters set maintenance policy*](struct.ProjectZoneClusterSetMaintenancePolicyCall.html), [*zones clusters set master auth*](struct.ProjectZoneClusterSetMasterAuthCall.html), [*zones clusters set network policy*](struct.ProjectZoneClusterSetNetworkPolicyCall.html), [*zones clusters start ip rotation*](struct.ProjectZoneClusterStartIpRotationCall.html), [*zones clusters update*](struct.ProjectZoneClusterUpdateCall.html), [*zones get serverconfig*](struct.ProjectZoneGetServerconfigCall.html), [*zones operations cancel*](struct.ProjectZoneOperationCancelCall.html), [*zones operations get*](struct.ProjectZoneOperationGetCall.html) and [*zones operations list*](struct.ProjectZoneOperationListCall.html) //! //! //! //! //! Not what you are looking for ? Find all other Google APIs in their Rust [documentation index](http://byron.github.io/google-apis-rs). //! //! # Structure of this Library //! //! The API is structured into the following primary items: //! //! * **[Hub](struct.Container.html)** //! * a central object to maintain state and allow accessing all *Activities* //! * creates [*Method Builders*](trait.MethodsBuilder.html) which in turn //! allow access to individual [*Call Builders*](trait.CallBuilder.html) //! * **[Resources](trait.Resource.html)** //! * primary types that you can apply *Activities* to //! * a collection of properties and *Parts* //! * **[Parts](trait.Part.html)** //! * a collection of properties //! * never directly used in *Activities* //! * **[Activities](trait.CallBuilder.html)** //! * operations to apply to *Resources* //! //! All *structures* are marked with applicable traits to further categorize them and ease browsing. //! //! Generally speaking, you can invoke *Activities* like this: //! //! ```Rust,ignore //! let r = hub.resource().activity(...).doit() //! ``` //! //! Or specifically ... //! //! ```ignore //! let r = hub.projects().zones_clusters_node_pools_rollback(...).doit() //! let r = hub.projects().zones_clusters_node_pools_create(...).doit() //! let r = hub.projects().zones_clusters_monitoring(...).doit() //! let r = hub.projects().zones_clusters_delete(...).doit() //! let r = hub.projects().zones_clusters_legacy_abac(...).doit() //! let r = hub.projects().zones_clusters_set_master_auth(...).doit() //! let r = hub.projects().zones_clusters_start_ip_rotation(...).doit() //! let r = hub.projects().zones_clusters_create(...).doit() //! let r = hub.projects().zones_clusters_node_pools_set_management(...).doit() //! let r = hub.projects().zones_operations_get(...).doit() //! let r = hub.projects().zones_clusters_logging(...).doit() //! let r = hub.projects().zones_clusters_update(...).doit() //! let r = hub.projects().zones_clusters_node_pools_autoscaling(...).doit() //! let r = hub.projects().zones_clusters_node_pools_set_size(...).doit() //! let r = hub.projects().zones_clusters_set_maintenance_policy(...).doit() //! let r = hub.projects().zones_clusters_node_pools_delete(...).doit() //! let r = hub.projects().zones_clusters_locations(...).doit() //! let r = hub.projects().zones_clusters_master(...).doit() //! let r = hub.projects().zones_clusters_node_pools_update(...).doit() //! let r = hub.projects().zones_clusters_set_network_policy(...).doit() //! let r = hub.projects().zones_clusters_addons(...).doit() //! let r = hub.projects().zones_clusters_complete_ip_rotation(...).doit() //! let r = hub.projects().zones_clusters_resource_labels(...).doit() //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` //! supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be //! specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired. //! The `doit()` method performs the actual communication with the server and returns the respective result. //! //! # Usage //! //! ## Setting up your Project //! //! To use this library, you would put the following lines into your `Cargo.toml` file: //! //! ```toml //! [dependencies] //! google-container1 = "*" //! ``` //! //! ## A complete example //! //! ```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::RollbackNodePoolUpgradeRequest; //! use container1::{Result, Error}; //! # #[test] fn egal() { //! use std::default::Default; //! use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; //! use container1::Container; //! //! // Get an ApplicationSecret instance by some means. It contains the `client_id` and //! // `client_secret`, among other things. //! let secret: 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 = Authenticator::new(&secret, DefaultAuthenticatorDelegate, //! hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), //! ::default(), None); //! let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); //! //! 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::MissingAPIKey //! |Error::MissingToken(_) //! |Error::Cancelled //! |Error::UploadSizeLimitExceeded(_, _) //! |Error::Failure(_) //! |Error::BadRequest(_) //! |Error::FieldClash(_) //! |Error::JsonDecodeError(_, _) => println!("{}", e), //! }, //! Ok(res) => println!("Success: {:?}", res), //! } //! # } //! ``` //! ## Handling Errors //! //! All errors produced by the system are provided either as [Result](enum.Result.html) enumeration as return value of //! the doit() methods, or handed as possibly intermediate results to either the //! [Hub Delegate](trait.Delegate.html), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). //! //! When delegates handle errors or intermediate values, they may have a chance to instruct the system to retry. This //! makes the system potentially resilient to all kinds of errors. //! //! ## Uploads and Downloads //! If a method supports downloads, the response body, which is part of the [Result](enum.Result.html), should be //! read by you to obtain the media. //! If such a method also supports a [Response Result](trait.ResponseResult.html), it will return that by default. //! You can see it as meta-data for the actual media. To trigger a media download, you will have to set up the builder by making //! this call: `.param("alt", "media")`. //! //! Methods supporting uploads can do so using up to 2 different protocols: //! *simple* and *resumable*. The distinctiveness of each is represented by customized //! `doit(...)` methods, which are then named `upload(...)` and `upload_resumable(...)` respectively. //! //! ## Customization and Callbacks //! //! You may alter the way an `doit()` method is called by providing a [delegate](trait.Delegate.html) to the //! [Method Builder](trait.CallBuilder.html) before making the final `doit()` call. //! Respective methods will be called to provide progress information, as well as determine whether the system should //! retry on failure. //! //! The [delegate trait](trait.Delegate.html) is default-implemented, allowing you to customize it with minimal effort. //! //! ## Optional Parts in Server-Requests //! //! All structures provided by this library are made to be [enocodable](trait.RequestValue.html) and //! [decodable](trait.ResponseResult.html) via *json*. Optionals are used to indicate that partial requests are responses //! are valid. //! Most optionals are are considered [Parts](trait.Part.html) which are identifiable by name, which will be sent to //! the server to indicate either the set parts of the request or the desired parts in the response. //! //! ## Builder Arguments //! //! Using [method builders](trait.CallBuilder.html), you are able to prepare an action call by repeatedly calling it's methods. //! These will always take a single argument, for which the following statements are true. //! //! * [PODs][wiki-pod] are handed by copy //! * strings are passed as `&str` //! * [request values](trait.RequestValue.html) are moved //! //! Arguments will always be copied or cloned into the builder, to make them independent of their original life times. //! //! [wiki-pod]: http://en.wikipedia.org/wiki/Plain_old_data_structure //! [builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern //! [google-go-api]: https://github.com/google/google-api-go-client //! //! // Unused attributes happen thanks to defined, but unused structures // We don't warn about this, as depending on the API, some data structures or facilities are never used. // Instead of pre-determining this, we just disable the lint. It's manually tuned to not have any // unused imports in fully featured APIs. Same with unused_mut ... . #![allow(unused_imports, unused_mut, dead_code)] // DO NOT EDIT ! // This file was generated automatically from 'src/mako/api/lib.rs.mako' // DO NOT EDIT ! #[macro_use] extern crate serde_derive; extern crate hyper; extern crate serde; extern crate serde_json; extern crate yup_oauth2 as oauth2; extern crate mime; extern crate url; mod cmn; use std::collections::HashMap; use std::cell::RefCell; use std::borrow::BorrowMut; 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 std::time::Duration; pub use cmn::{MultiPartReader, ToParts, MethodInfo, Result, Error, CallBuilder, Hub, ReadSeek, Part, ResponseResult, RequestValue, NestedType, Delegate, DefaultDelegate, MethodsBuilder, Resource, ErrorResponse, remove_json_null_values}; // ############## // 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 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::RollbackNodePoolUpgradeRequest; /// use container1::{Result, Error}; /// # #[test] fn egal() { /// use std::default::Default; /// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// use container1::Container; /// /// // Get an ApplicationSecret instance by some means. It contains the `client_id` and /// // `client_secret`, among other things. /// let secret: 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 = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// ::default(), None); /// let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// /// 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::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: RefCell, auth: RefCell, _user_agent: String, _base_url: String, _root_url: String, } impl<'a, C, A> Hub for Container {} impl<'a, C, A> Container where C: BorrowMut, A: oauth2::GetToken { pub fn new(client: C, authenticator: A) -> Container { Container { client: RefCell::new(client), auth: RefCell::new(authenticator), _user_agent: "google-api-rust-client/1.0.7".to_string(), _base_url: "https://container.googleapis.com/".to_string(), _root_url: "https://container.googleapis.com/".to_string(), } } pub fn projects(&'a self) -> ProjectMethods<'a, C, 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/1.0.7`. /// /// 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 ### // ########## /// 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*). /// /// * [zones clusters set maintenance policy projects](struct.ProjectZoneClusterSetMaintenancePolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetMaintenancePolicyRequest { /// The maintenance policy to be set for the cluster. An empty field /// clears the existing maintenance policy. #[serde(rename="maintenancePolicy")] pub maintenance_policy: Option, } impl RequestValue for SetMaintenancePolicyRequest {} /// 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 { /// Master authorized networks is a Beta feature. /// The desired configuration options for master authorized networks feature. #[serde(rename="desiredMasterAuthorizedNetworksConfig")] pub desired_master_authorized_networks_config: Option, /// 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, /// Configurations for the various addons available to run in the cluster. #[serde(rename="desiredAddonsConfig")] pub desired_addons_config: Option, /// The Kubernetes version to change the master to. The only valid value is the /// latest supported version. Use "-" to have the server automatically select /// the latest version. #[serde(rename="desiredMasterVersion")] pub desired_master_version: Option, /// The desired list of Google Compute Engine /// [locations](/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. #[serde(rename="desiredLocations")] pub desired_locations: Option>, /// The Kubernetes version to change the nodes to (typically an /// upgrade). Use `-` to upgrade to the latest version supported by /// the server. #[serde(rename="desiredNodeVersion")] pub desired_node_version: Option, /// The monitoring service the cluster should use to write metrics. /// Currently available options: /// /// * "monitoring.googleapis.com" - the Google Cloud Monitoring service /// * "none" - no metrics will be exported from the cluster #[serde(rename="desiredMonitoringService")] pub desired_monitoring_service: Option, /// 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, /// 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, } impl Part for ClusterUpdate {} /// Container 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*). /// /// * [zones get serverconfig projects](struct.ProjectZoneGetServerconfigCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ServerConfig { /// Version of Kubernetes the service deploys by default. #[serde(rename="defaultClusterVersion")] pub default_cluster_version: Option, /// List of valid node upgrade target versions. #[serde(rename="validNodeVersions")] pub valid_node_versions: Option>, /// List of valid image types. #[serde(rename="validImageTypes")] pub valid_image_types: Option>, /// List of valid master versions. #[serde(rename="validMasterVersions")] pub valid_master_versions: Option>, /// Default image type. #[serde(rename="defaultImageType")] pub default_image_type: Option, } impl ResponseResult for ServerConfig {} /// 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 { /// The name of a Google Compute Engine [machine /// type](/compute/docs/machine-types) (e.g. /// `n1-standard-1`). /// /// If unspecified, the default machine type is /// `n1-standard-1`. #[serde(rename="machineType")] pub machine_type: Option, /// 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>, /// 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, /// 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>, /// The Google Cloud Platform Service Account to be used by the node VMs. If /// no Service Account is specified, the "default" service account is used. #[serde(rename="serviceAccount")] pub service_account: Option, /// 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](/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>, /// 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, /// 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>, /// 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, /// The number of local SSD disks to be attached to the node. /// /// The limit for this value is dependant upon the maximum number of /// disks available on a machine per zone. See: /// https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits /// for more information. #[serde(rename="localSsdCount")] pub local_ssd_count: Option, /// 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, /// 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 four reserved keys: /// "instance-template", "kube-env", "startup-script", and "user-data" /// /// 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>, } impl Part for NodeConfig {} /// 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 description of the upgrade. pub description: Option, /// [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, } impl Part for AutoUpgradeOptions {} /// 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*). /// /// * [zones clusters monitoring projects](struct.ProjectZoneClusterMonitoringCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetMonitoringServiceRequest { /// The monitoring service the cluster should use to write metrics. /// Currently available options: /// /// * "monitoring.googleapis.com" - the Google Cloud Monitoring service /// * "none" - no metrics will be exported from the cluster #[serde(rename="monitoringService")] pub monitoring_service: Option, } impl RequestValue for SetMonitoringServiceRequest {} /// 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*). /// /// * [zones operations cancel projects](struct.ProjectZoneOperationCancelCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Empty { _never_set: Option } impl ResponseResult for Empty {} /// 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*). /// /// * [zones clusters node pools rollback projects](struct.ProjectZoneClusterNodePoolRollbackCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RollbackNodePoolUpgradeRequest { _never_set: Option } impl RequestValue for RollbackNodePoolUpgradeRequest {} /// 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*). /// /// * [zones clusters node pools autoscaling projects](struct.ProjectZoneClusterNodePoolAutoscalingCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetNodePoolAutoscalingRequest { /// Autoscaling configuration for the node pool. pub autoscaling: Option, } impl RequestValue for SetNodePoolAutoscalingRequest {} /// 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, } impl Part for NetworkPolicyConfig {} /// 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 { /// Specifies the maintenance window in which maintenance may be performed. pub window: Option, } impl Part for MaintenancePolicy {} /// 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*). /// /// * [zones clusters create projects](struct.ProjectZoneClusterCreateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateClusterRequest { /// A [cluster /// resource](/container-engine/reference/rest/v1/projects.zones.clusters) pub cluster: Option, } impl RequestValue for CreateClusterRequest {} /// 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*). /// /// * [zones clusters node pools set management projects](struct.ProjectZoneClusterNodePoolSetManagementCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetNodePoolManagementRequest { /// NodeManagement configuration for the node pool. pub management: Option, } impl RequestValue for SetNodePoolManagementRequest {} /// Master authorized networks is a Beta feature. /// 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 { /// Whether or not master authorized networks is enabled. pub enabled: Option, /// cidr_blocks define up to 10 external networks that could access /// Kubernetes master through HTTPS. #[serde(rename="cidrBlocks")] pub cidr_blocks: Option>, } impl Part for MasterAuthorizedNetworksConfig {} /// 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 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, /// 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, /// Configuration for the Kubernetes Dashboard. #[serde(rename="kubernetesDashboard")] pub kubernetes_dashboard: Option, /// 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, } impl Part for AddonsConfig {} /// 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*). /// /// * [zones clusters addons projects](struct.ProjectZoneClusterAddonCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetAddonsConfigRequest { /// The desired configurations for the various addons available to run in the /// cluster. #[serde(rename="addonsConfig")] pub addons_config: Option, } impl 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*). /// /// * [zones clusters resource labels projects](struct.ProjectZoneClusterResourceLabelCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetLabelsRequest { /// The fingerprint of the previous set of labels for this resource, /// used to detect conflicts. The fingerprint is initially generated by /// Container 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, /// The labels to set for that cluster. #[serde(rename="resourceLabels")] pub resource_labels: Option>, } impl RequestValue for SetLabelsRequest {} /// 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, } impl Part for LegacyAbac {} /// 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, /// Specifies the Auto Upgrade knobs for the node pool. #[serde(rename="upgradeOptions")] pub upgrade_options: Option, /// 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, } impl Part for NodeManagement {} /// 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*). /// /// * [zones clusters locations projects](struct.ProjectZoneClusterLocationCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetLocationsRequest { /// The desired list of Google Compute Engine /// [locations](/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>, } impl RequestValue for SetLocationsRequest {} /// 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, /// 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, } impl Part for DailyMaintenanceWindow {} /// 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, } impl Part for KubernetesDashboard {} /// 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*). /// /// * [zones clusters start ip rotation projects](struct.ProjectZoneClusterStartIpRotationCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct StartIPRotationRequest { _never_set: Option } impl RequestValue for StartIPRotationRequest {} /// 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, } impl Part for ClientCertificateConfig {} /// 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*). /// /// * [zones clusters update projects](struct.ProjectZoneClusterUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UpdateClusterRequest { /// A description of the update. pub update: Option, } impl RequestValue for UpdateClusterRequest {} /// 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, } impl Part for HttpLoadBalancing {} /// 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*). /// /// * [zones clusters list projects](struct.ProjectZoneClusterListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListClustersResponse { /// If any zones are listed here, the list of clusters returned /// may be missing those zones. #[serde(rename="missingZones")] pub missing_zones: Option>, /// A list of clusters in the project in the specified zone, or /// across all ones. pub clusters: Option>, } impl ResponseResult for ListClustersResponse {} /// 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 a Heapster pod is running in the cluster, /// which is also used by the Cloud Monitoring service. pub disabled: Option, } impl Part for HorizontalPodAutoscaling {} /// 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*). /// /// * [zones clusters node pools create projects](struct.ProjectZoneClusterNodePoolCreateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CreateNodePoolRequest { /// The node pool to create. #[serde(rename="nodePool")] pub node_pool: Option, } impl RequestValue for CreateNodePoolRequest {} /// 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*). /// /// * [zones clusters node pools update projects](struct.ProjectZoneClusterNodePoolUpdateCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UpdateNodePoolRequest { /// The Kubernetes version to change the nodes to (typically an /// upgrade). Use `-` to upgrade to the latest version supported by /// the server. #[serde(rename="nodeVersion")] pub node_version: Option, /// The desired image type for the node pool. #[serde(rename="imageType")] pub image_type: Option, } impl RequestValue for UpdateNodePoolRequest {} /// 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*). /// /// * [zones clusters logging projects](struct.ProjectZoneClusterLoggingCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetLoggingServiceRequest { /// The logging service the cluster should use to write metrics. /// Currently available options: /// /// * "logging.googleapis.com" - the Google Cloud Logging service /// * "none" - no metrics will be exported from the cluster #[serde(rename="loggingService")] pub logging_service: Option, } impl RequestValue for SetLoggingServiceRequest {} /// 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, } impl Part for MaintenanceWindow {} /// 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*). /// /// * [zones clusters node pools list projects](struct.ProjectZoneClusterNodePoolListCall.html) (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>, } impl ResponseResult for ListNodePoolsResponse {} /// 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*). /// /// * [zones clusters node pools get projects](struct.ProjectZoneClusterNodePoolGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct NodePool { /// [Output only] The status of the nodes in this pool instance. pub status: Option, /// NodeManagement configuration for this NodePool. pub management: Option, /// The name of the node pool. pub name: Option, /// [Output only] The resource URLs of the [managed instance /// groups](/compute/docs/instance-groups/creating-groups-of-managed-instances) /// associated with this node pool. #[serde(rename="instanceGroupUrls")] pub instance_group_urls: Option>, /// Autoscaler configuration for this NodePool. Autoscaler is enabled /// only if a valid configuration is present. pub autoscaling: Option, /// The version of the Kubernetes of this node. pub version: Option, /// The initial node count for the pool. You must ensure that your /// Compute Engine resource quota /// is sufficient for this number of instances. You must also have available /// firewall and routes quota. #[serde(rename="initialNodeCount")] pub initial_node_count: Option, /// [Output only] Additional information about the current status of this /// node pool instance, if available. #[serde(rename="statusMessage")] pub status_message: Option, /// The node configuration of the pool. pub config: Option, /// [Output only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, } impl ResponseResult for NodePool {} /// 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, /// The selected network policy provider. pub provider: Option, } impl Part for NetworkPolicy {} /// 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*). /// /// * [zones clusters complete ip rotation projects](struct.ProjectZoneClusterCompleteIpRotationCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CompleteIPRotationRequest { _never_set: Option } impl RequestValue for CompleteIPRotationRequest {} /// 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*). /// /// * [zones clusters master projects](struct.ProjectZoneClusterMasterCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct UpdateMasterRequest { /// The Kubernetes version to change the master to. The only valid value is the /// latest supported version. Use "-" to have the server automatically select /// the latest version. #[serde(rename="masterVersion")] pub master_version: Option, } impl RequestValue for UpdateMasterRequest {} /// 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*). /// /// * [zones operations list projects](struct.ProjectZoneOperationListCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ListOperationsResponse { /// A list of operations in the project in the specified zone. pub operations: Option>, /// 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>, } impl ResponseResult for ListOperationsResponse {} /// 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*). /// /// * [zones clusters legacy abac projects](struct.ProjectZoneClusterLegacyAbacCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetLegacyAbacRequest { /// Whether ABAC authorization will be enabled in the cluster. pub enabled: Option, } impl RequestValue for SetLegacyAbacRequest {} /// 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, /// The accelerator type resource name. List of supported accelerators /// [here](/compute/docs/gpus/#Introduction) #[serde(rename="acceleratorType")] pub accelerator_type: Option, } impl Part for AcceleratorConfig {} /// 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 { /// Minimum number of nodes in the NodePool. Must be >= 1 and <= /// max_node_count. #[serde(rename="minNodeCount")] pub min_node_count: Option, /// Is autoscaling enabled for this node pool. pub enabled: Option, /// 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, } impl Part for NodePoolAutoscaling {} /// 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 { /// The username to use for HTTP basic authentication to the master endpoint. /// For clusters v1.6.0 and later, you can disable basic authentication by /// providing an empty username. pub username: Option, /// 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. pub password: Option, /// [Output only] Base64-encoded public certificate used by clients to /// authenticate to the cluster endpoint. #[serde(rename="clientCertificate")] pub client_certificate: Option, /// [Output only] Base64-encoded private key used by clients to authenticate /// to the cluster endpoint. #[serde(rename="clientKey")] pub client_key: Option, /// [Output only] Base64-encoded public certificate that is the root of /// trust for the cluster. #[serde(rename="clusterCaCertificate")] pub cluster_ca_certificate: Option, /// Configuration for client certificate authentication on the cluster. If no /// configuration is specified, a client certificate is issued. #[serde(rename="clientCertificateConfig")] pub client_certificate_config: Option, } impl Part for MasterAuth {} /// A Google Container 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*). /// /// * [zones clusters get projects](struct.ProjectZoneClusterGetCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Cluster { /// [Output only] The size of the address space on each node for hosting /// containers. This is provisioned from within the `container_ipv4_cidr` /// range. #[serde(rename="nodeIpv4CidrSize")] pub node_ipv4_cidr_size: Option, /// Configure the maintenance policy for this cluster. #[serde(rename="maintenancePolicy")] pub maintenance_policy: Option, /// Configuration options for the NetworkPolicy feature. #[serde(rename="networkPolicy")] pub network_policy: Option, /// Master authorized networks is a Beta feature. /// The configuration options for master authorized networks feature. #[serde(rename="masterAuthorizedNetworksConfig")] pub master_authorized_networks_config: Option, /// Configurations for the various addons available to run in the cluster. #[serde(rename="addonsConfig")] pub addons_config: Option, /// The list of Google Compute Engine /// [locations](/compute/docs/zones#available) in which the cluster's nodes /// should be located. pub locations: Option>, /// 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, /// The name of the Google Compute Engine /// [network](/compute/docs/networks-and-firewalls#networks) to which the /// cluster is connected. If left unspecified, the `default` network /// will be used. pub network: Option, /// [Output only] The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. pub zone: Option, /// Deprecated. Use node_pools.instance_group_urls. #[serde(rename="instanceGroupUrls")] pub instance_group_urls: Option>, /// Configuration for cluster IP allocation. #[serde(rename="ipAllocationPolicy")] pub ip_allocation_policy: Option, /// [Output only] Additional information about the current status of this /// cluster, if available. #[serde(rename="statusMessage")] pub status_message: Option, /// [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, /// [Output only] The current status of this cluster. pub status: Option, /// An optional description of this cluster. pub description: Option, /// [Output only] 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, /// The fingerprint of the set of labels for this cluster. #[serde(rename="labelFingerprint")] pub label_fingerprint: Option, /// [Output only] The current software version of the master endpoint. #[serde(rename="currentMasterVersion")] pub current_master_version: Option, /// The authentication information for accessing the master endpoint. #[serde(rename="masterAuth")] pub master_auth: Option, /// [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, /// The number of nodes to create in this cluster. You must ensure that your /// Compute Engine resource quota /// 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. #[serde(rename="initialNodeCount")] pub initial_node_count: Option, /// 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>, /// The monitoring service the cluster should use to write metrics. /// Currently available options: /// /// * `monitoring.googleapis.com` - the Google Cloud Monitoring service. /// * `none` - no metrics will be exported from the cluster. /// * if left as an empty string, `monitoring.googleapis.com` will be used. #[serde(rename="monitoringService")] pub monitoring_service: Option, /// [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, /// The name of this cluster. The name must be unique within this project /// and zone, 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, /// [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, /// [Output only] The number of nodes currently in the cluster. #[serde(rename="currentNodeCount")] pub current_node_count: Option, /// The logging service the cluster should use to write logs. /// Currently available options: /// /// * `logging.googleapis.com` - the Google Cloud Logging service. /// * `none` - no logs will be exported from the cluster. /// * if left as an empty string,`logging.googleapis.com` will be used. #[serde(rename="loggingService")] pub logging_service: Option, /// Configuration for the legacy ABAC authorization mode. #[serde(rename="legacyAbac")] pub legacy_abac: Option, /// 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. #[serde(rename="initialClusterVersion")] pub initial_cluster_version: Option, /// Parameters used in creating the cluster's nodes. /// See `nodeConfig` for the description of its properties. /// 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. /// /// If unspecified, the defaults are used. #[serde(rename="nodeConfig")] pub node_config: Option, /// 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, /// The name of the Google Compute Engine /// [subnetwork](/compute/docs/subnetworks) to which the /// cluster is connected. pub subnetwork: Option, /// The resource labels for the cluster to use to annotate any related /// Google Compute Engine resources. #[serde(rename="resourceLabels")] pub resource_labels: Option>, /// [Output only] Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, } impl ResponseResult for Cluster {} /// 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*). /// /// * [zones clusters set master auth projects](struct.ProjectZoneClusterSetMasterAuthCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetMasterAuthRequest { /// The exact form of action to be taken on the master auth. pub action: Option, /// A description of the update. pub update: Option, } impl RequestValue for SetMasterAuthRequest {} /// 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*). /// /// * [zones clusters set network policy projects](struct.ProjectZoneClusterSetNetworkPolicyCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetNetworkPolicyRequest { /// Configuration options for the NetworkPolicy feature. #[serde(rename="networkPolicy")] pub network_policy: Option, } impl RequestValue for SetNetworkPolicyRequest {} /// 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 { /// 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, /// Whether alias IPs will be used for pod IPs in the cluster. #[serde(rename="useIpAliases")] pub use_ip_aliases: Option, /// This field is deprecated, use node_ipv4_cidr_block. #[serde(rename="nodeIpv4Cidr")] pub node_ipv4_cidr: Option, /// 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, /// 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, /// 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, /// 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, /// This field is deprecated, use cluster_ipv4_cidr_block. #[serde(rename="clusterIpv4Cidr")] pub cluster_ipv4_cidr: Option, /// 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, /// 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, /// This field is deprecated, use services_ipv4_cidr_block. #[serde(rename="servicesIpv4Cidr")] pub services_ipv4_cidr: Option, } impl Part for IPAllocationPolicy {} /// 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*). /// /// * [zones operations cancel projects](struct.ProjectZoneOperationCancelCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct CancelOperationRequest { _never_set: Option } impl RequestValue for CancelOperationRequest {} /// SetNodePoolSizeRequest sets the size 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*). /// /// * [zones clusters node pools set size projects](struct.ProjectZoneClusterNodePoolSetSizeCall.html) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct SetNodePoolSizeRequest { /// The desired node count for the pool. #[serde(rename="nodeCount")] pub node_count: Option, } impl RequestValue for SetNodePoolSizeRequest {} /// 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*). /// /// * [zones clusters node pools rollback projects](struct.ProjectZoneClusterNodePoolRollbackCall.html) (response) /// * [zones clusters node pools create projects](struct.ProjectZoneClusterNodePoolCreateCall.html) (response) /// * [zones clusters monitoring projects](struct.ProjectZoneClusterMonitoringCall.html) (response) /// * [zones clusters delete projects](struct.ProjectZoneClusterDeleteCall.html) (response) /// * [zones clusters legacy abac projects](struct.ProjectZoneClusterLegacyAbacCall.html) (response) /// * [zones clusters set master auth projects](struct.ProjectZoneClusterSetMasterAuthCall.html) (response) /// * [zones clusters start ip rotation projects](struct.ProjectZoneClusterStartIpRotationCall.html) (response) /// * [zones clusters create projects](struct.ProjectZoneClusterCreateCall.html) (response) /// * [zones clusters node pools set management projects](struct.ProjectZoneClusterNodePoolSetManagementCall.html) (response) /// * [zones operations get projects](struct.ProjectZoneOperationGetCall.html) (response) /// * [zones clusters logging projects](struct.ProjectZoneClusterLoggingCall.html) (response) /// * [zones clusters update projects](struct.ProjectZoneClusterUpdateCall.html) (response) /// * [zones clusters node pools autoscaling projects](struct.ProjectZoneClusterNodePoolAutoscalingCall.html) (response) /// * [zones clusters node pools set size projects](struct.ProjectZoneClusterNodePoolSetSizeCall.html) (response) /// * [zones clusters set maintenance policy projects](struct.ProjectZoneClusterSetMaintenancePolicyCall.html) (response) /// * [zones clusters node pools delete projects](struct.ProjectZoneClusterNodePoolDeleteCall.html) (response) /// * [zones clusters locations projects](struct.ProjectZoneClusterLocationCall.html) (response) /// * [zones clusters master projects](struct.ProjectZoneClusterMasterCall.html) (response) /// * [zones clusters node pools update projects](struct.ProjectZoneClusterNodePoolUpdateCall.html) (response) /// * [zones clusters set network policy projects](struct.ProjectZoneClusterSetNetworkPolicyCall.html) (response) /// * [zones clusters addons projects](struct.ProjectZoneClusterAddonCall.html) (response) /// * [zones clusters complete ip rotation projects](struct.ProjectZoneClusterCompleteIpRotationCall.html) (response) /// * [zones clusters resource labels projects](struct.ProjectZoneClusterResourceLabelCall.html) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Operation { /// The current status of the operation. pub status: Option, /// If an error has occurred, a textual description of the error. #[serde(rename="statusMessage")] pub status_message: Option, /// [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, /// The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the operation /// is taking place. pub zone: Option, /// Detailed operation progress, if available. pub detail: Option, /// Server-defined URL for the target of the operation. #[serde(rename="targetLink")] pub target_link: Option, /// The operation type. #[serde(rename="operationType")] pub operation_type: Option, /// [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, /// Server-defined URL for the resource. #[serde(rename="selfLink")] pub self_link: Option, /// The server-assigned ID for the operation. pub name: Option, } impl ResponseResult for Operation {} /// 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 { /// display_name is an optional field for users to identify CIDR blocks. #[serde(rename="displayName")] pub display_name: Option, /// cidr_block must be specified in CIDR notation. #[serde(rename="cidrBlock")] pub cidr_block: Option, } impl Part for CidrBlock {} // ################### // 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; /// /// # #[test] fn egal() { /// use std::default::Default; /// use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// use container1::Container; /// /// let secret: ApplicationSecret = Default::default(); /// let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// ::default(), None); /// let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* /// // like `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, C, A> where C: 'a, A: 'a { hub: &'a Container, } impl<'a, C, A> MethodsBuilder for ProjectMethods<'a, C, A> {} impl<'a, C, A> ProjectMethods<'a, C, A> { /// Create a builder to help you perform the following task: /// /// Cancels the specified operation. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the operation resides. /// * `operationId` - The server-assigned `name` of the operation. pub fn zones_operations_cancel(&self, request: CancelOperationRequest, project_id: &str, zone: &str, operation_id: &str) -> ProjectZoneOperationCancelCall<'a, C, 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(), _scopes: Default::default(), _additional_params: 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` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. pub fn zones_clusters_node_pools_create(&self, request: CreateNodePoolRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Sets the monitoring service of a specific cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. pub fn zones_clusters_monitoring(&self, request: SetMonitoringServiceRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterMonitoringCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Roll back the previously Aborted or Failed NodePool upgrade. /// This will be an no-op if the last upgrade successfully completed. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to rollback. /// * `nodePoolId` - The name of the node pool to rollback. pub fn zones_clusters_node_pools_rollback(&self, request: RollbackNodePoolUpgradeRequest, project_id: &str, zone: &str, cluster_id: &str, node_pool_id: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, 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(), _scopes: Default::default(), _additional_params: 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 /// (e.g. load balancer resources) will not be deleted if they weren't present /// at the initial create time. /// /// # Arguments /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to delete. pub fn zones_clusters_delete(&self, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterDeleteCall<'a, C, A> { ProjectZoneClusterDeleteCall { hub: self.hub, _project_id: project_id.to_string(), _zone: zone.to_string(), _cluster_id: cluster_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Returns configuration info about the Container Engine service. /// /// # Arguments /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine [zone](/compute/docs/zones#available) /// to return operations for. pub fn zones_get_serverconfig(&self, project_id: &str, zone: &str) -> ProjectZoneGetServerconfigCall<'a, C, A> { ProjectZoneGetServerconfigCall { hub: self.hub, _project_id: project_id.to_string(), _zone: zone.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: 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` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to update. pub fn zones_clusters_legacy_abac(&self, request: SetLegacyAbacRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterLegacyAbacCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Sets the addons of a specific cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. pub fn zones_clusters_addons(&self, request: SetAddonsConfigRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterAddonCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Start master IP rotation. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. pub fn zones_clusters_start_ip_rotation(&self, request: StartIPRotationRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C, 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(), _scopes: Default::default(), _additional_params: 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](/compute/docs/networks-and-firewalls#networks). /// /// One firewall is added for the cluster. After cluster creation, /// the cluster 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 is being used by the cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. pub fn zones_clusters_create(&self, request: CreateClusterRequest, project_id: &str, zone: &str) -> ProjectZoneClusterCreateCall<'a, C, A> { ProjectZoneClusterCreateCall { hub: self.hub, _request: request, _project_id: project_id.to_string(), _zone: zone.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: 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` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to update. /// * `nodePoolId` - The name of the node pool to update. pub fn zones_clusters_node_pools_set_management(&self, request: SetNodePoolManagementRequest, project_id: &str, zone: &str, cluster_id: &str, node_pool_id: &str) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Lists the node pools for a cluster. /// /// # Arguments /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. pub fn zones_clusters_node_pools_list(&self, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterNodePoolListCall<'a, C, A> { ProjectZoneClusterNodePoolListCall { hub: self.hub, _project_id: project_id.to_string(), _zone: zone.to_string(), _cluster_id: cluster_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets the specified operation. /// /// # Arguments /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `operationId` - The server-assigned `name` of the operation. pub fn zones_operations_get(&self, project_id: &str, zone: &str, operation_id: &str) -> ProjectZoneOperationGetCall<'a, C, A> { ProjectZoneOperationGetCall { hub: self.hub, _project_id: project_id.to_string(), _zone: zone.to_string(), _operation_id: operation_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Sets the logging service of a specific cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. pub fn zones_clusters_logging(&self, request: SetLoggingServiceRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterLoggingCall<'a, C, 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(), _scopes: Default::default(), _additional_params: 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` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. pub fn zones_clusters_update(&self, request: UpdateClusterRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterUpdateCall<'a, C, 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(), _scopes: 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 /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides, or "-" for all zones. pub fn zones_clusters_list(&self, project_id: &str, zone: &str) -> ProjectZoneClusterListCall<'a, C, A> { ProjectZoneClusterListCall { hub: self.hub, _project_id: project_id.to_string(), _zone: zone.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Sets the autoscaling settings of a specific node pool. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. /// * `nodePoolId` - The name of the node pool to upgrade. pub fn zones_clusters_node_pools_autoscaling(&self, request: SetNodePoolAutoscalingRequest, project_id: &str, zone: &str, cluster_id: &str, node_pool_id: &str) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Sets the size of a specific node pool. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to update. /// * `nodePoolId` - The name of the node pool to update. pub fn zones_clusters_node_pools_set_size(&self, request: SetNodePoolSizeRequest, project_id: &str, zone: &str, cluster_id: &str, node_pool_id: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, 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(), _scopes: Default::default(), _additional_params: 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` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to update. pub fn zones_clusters_set_maintenance_policy(&self, request: SetMaintenancePolicyRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Deletes a node pool from a cluster. /// /// # Arguments /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. /// * `nodePoolId` - The name of the node pool to delete. pub fn zones_clusters_node_pools_delete(&self, project_id: &str, zone: &str, cluster_id: &str, node_pool_id: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, 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(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Sets the locations of a specific cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. pub fn zones_clusters_locations(&self, request: SetLocationsRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterLocationCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Gets the details of a specific cluster. /// /// # Arguments /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to retrieve. pub fn zones_clusters_get(&self, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterGetCall<'a, C, A> { ProjectZoneClusterGetCall { hub: self.hub, _project_id: project_id.to_string(), _zone: zone.to_string(), _cluster_id: cluster_id.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Updates the master of a specific cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. pub fn zones_clusters_master(&self, request: UpdateMasterRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterMasterCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Updates the version and/or image type of a specific node pool. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. /// * `nodePoolId` - The name of the node pool to upgrade. pub fn zones_clusters_node_pools_update(&self, request: UpdateNodePoolRequest, project_id: &str, zone: &str, cluster_id: &str, node_pool_id: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Enables/Disables Network Policy for a cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. pub fn zones_clusters_set_network_policy(&self, request: SetNetworkPolicyRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Retrieves the node pool requested. /// /// # Arguments /// /// * `projectId` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. /// * `nodePoolId` - The name of the node pool. pub fn zones_clusters_node_pools_get(&self, project_id: &str, zone: &str, cluster_id: &str, node_pool_id: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C, 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(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Used to set master auth materials. Currently supports :- /// Changing the admin password of a specific cluster. /// This can be either via password generation or explicitly set the password. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster to upgrade. pub fn zones_clusters_set_master_auth(&self, request: SetMasterAuthRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C, 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(), _scopes: 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. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. pub fn zones_clusters_complete_ip_rotation(&self, request: CompleteIPRotationRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterCompleteIpRotationCall<'a, C, 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(), _scopes: Default::default(), _additional_params: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Sets labels on a cluster. /// /// # Arguments /// /// * `request` - No description provided. /// * `projectId` - The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// * `zone` - The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// * `clusterId` - The name of the cluster. pub fn zones_clusters_resource_labels(&self, request: SetLabelsRequest, project_id: &str, zone: &str, cluster_id: &str) -> ProjectZoneClusterResourceLabelCall<'a, C, 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(), _scopes: Default::default(), _additional_params: 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` - The Google Developers Console [project ID or project /// number](https://support.google.com/cloud/answer/6158840). /// * `zone` - The name of the Google Compute Engine [zone](/compute/docs/zones#available) /// to return operations for, or `-` for all zones. pub fn zones_operations_list(&self, project_id: &str, zone: &str) -> ProjectZoneOperationListCall<'a, C, A> { ProjectZoneOperationListCall { hub: self.hub, _project_id: project_id.to_string(), _zone: zone.to_string(), _delegate: Default::default(), _scopes: Default::default(), _additional_params: Default::default(), } } } // ################### // CallBuilders ### // ################# /// 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::CancelOperationRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneOperationCancelCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: CancelOperationRequest, _project_id: String, _zone: String, _operation_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneOperationCancelCall<'a, C, A> {} impl<'a, C, A> ProjectZoneOperationCancelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Empty)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.operations.cancel", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneOperationCancelCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the operation 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) -> ProjectZoneOperationCancelCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The server-assigned `name` of the operation. /// /// Sets the *operation id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationCancelCall<'a, C, 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 Delegate) -> ProjectZoneOperationCancelCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneOperationCancelCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneOperationCancelCall<'a, C, A> where T: Into>, S: AsRef { 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::CreateNodePoolRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: CreateNodePoolRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolCreateCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.create", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolCreateCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolCreateCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolCreateCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolCreateCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolCreateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Sets the monitoring service of 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::SetMonitoringServiceRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterMonitoringCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetMonitoringServiceRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterMonitoringCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterMonitoringCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.monitoring", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterMonitoringCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterMonitoringCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMonitoringCall<'a, C, 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 Delegate) -> ProjectZoneClusterMonitoringCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterMonitoringCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterMonitoringCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Roll back the previously Aborted or Failed NodePool upgrade. /// This will be an no-op 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::RollbackNodePoolUpgradeRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolRollbackCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: RollbackNodePoolUpgradeRequest, _project_id: String, _zone: String, _cluster_id: String, _node_pool_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolRollbackCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.rollback", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to rollback. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> { self._cluster_id = new_value.to_string(); self } /// The name of the node pool to rollback. /// /// Sets the *node pool id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolRollbackCall<'a, C, A> where T: Into>, S: AsRef { 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 /// (e.g. load balancer resources) will not be deleted if they weren't present /// at the initial create time. /// /// 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneClusterDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterDeleteCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.delete", http_method: hyper::method::Method::Delete }); 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())); 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// 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) -> ProjectZoneClusterDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterDeleteCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to delete. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterDeleteCall<'a, C, 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 Delegate) -> ProjectZoneClusterDeleteCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterDeleteCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Returns configuration info about the Container 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneGetServerconfigCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneGetServerconfigCall<'a, C, A> {} impl<'a, C, A> ProjectZoneGetServerconfigCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, ServerConfig)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.getServerconfig", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// 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) -> ProjectZoneGetServerconfigCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine [zone](/compute/docs/zones#available) /// to return operations for. /// /// Sets the *zone* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ProjectZoneGetServerconfigCall<'a, C, 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 Delegate) -> ProjectZoneGetServerconfigCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneGetServerconfigCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneGetServerconfigCall<'a, C, A> where T: Into>, S: AsRef { 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::SetLegacyAbacRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterLegacyAbacCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetLegacyAbacRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterLegacyAbacCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterLegacyAbacCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.legacyAbac", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterLegacyAbacCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterLegacyAbacCall<'a, C, A> { self._zone = new_value.to_string(); self } /// 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) -> ProjectZoneClusterLegacyAbacCall<'a, C, 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 Delegate) -> ProjectZoneClusterLegacyAbacCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterLegacyAbacCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterLegacyAbacCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Sets the addons of 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::SetAddonsConfigRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterAddonCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetAddonsConfigRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterAddonCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterAddonCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.addons", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterAddonCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterAddonCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterAddonCall<'a, C, 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 Delegate) -> ProjectZoneClusterAddonCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterAddonCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterAddonCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Start 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::StartIPRotationRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterStartIpRotationCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: StartIPRotationRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterStartIpRotationCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterStartIpRotationCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.startIpRotation", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterStartIpRotationCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterStartIpRotationCall<'a, C, 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 Delegate) -> ProjectZoneClusterStartIpRotationCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterStartIpRotationCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterStartIpRotationCall<'a, C, A> where T: Into>, S: AsRef { 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](/compute/docs/networks-and-firewalls#networks). /// /// One firewall is added for the cluster. After cluster creation, /// the cluster 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 is being used by the cluster. /// /// 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::CreateClusterRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterCreateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: CreateClusterRequest, _project_id: String, _zone: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterCreateCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterCreateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.create", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterCreateCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterCreateCall<'a, C, 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 Delegate) -> ProjectZoneClusterCreateCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterCreateCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterCreateCall<'a, C, A> where T: Into>, S: AsRef { 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::SetNodePoolManagementRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetNodePoolManagementRequest, _project_id: String, _zone: String, _cluster_id: String, _node_pool_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.setManagement", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> { self._zone = new_value.to_string(); self } /// 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) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> { self._cluster_id = new_value.to_string(); self } /// The name of the node pool to update. /// /// Sets the *node pool id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolSetManagementCall<'a, C, A> where T: Into>, S: AsRef { 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolListCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, ListNodePoolsResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.list", http_method: hyper::method::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())); 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolListCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolListCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolListCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolListCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolListCall<'a, C, A> where T: Into>, S: AsRef { 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneOperationGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _operation_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneOperationGetCall<'a, C, A> {} impl<'a, C, A> ProjectZoneOperationGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.operations.get", http_method: hyper::method::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())); 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// 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) -> ProjectZoneOperationGetCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneOperationGetCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The server-assigned `name` of the operation. /// /// Sets the *operation id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn operation_id(mut self, new_value: &str) -> ProjectZoneOperationGetCall<'a, C, 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 Delegate) -> ProjectZoneOperationGetCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneOperationGetCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneOperationGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Sets the logging service of 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::SetLoggingServiceRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterLoggingCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetLoggingServiceRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterLoggingCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterLoggingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.logging", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterLoggingCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterLoggingCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLoggingCall<'a, C, 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 Delegate) -> ProjectZoneClusterLoggingCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterLoggingCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterLoggingCall<'a, C, A> where T: Into>, S: AsRef { 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::UpdateClusterRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterUpdateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: UpdateClusterRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterUpdateCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.update", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Put, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterUpdateCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterUpdateCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterUpdateCall<'a, C, 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 Delegate) -> ProjectZoneClusterUpdateCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterUpdateCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterUpdateCall<'a, C, A> where T: Into>, S: AsRef { 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneClusterListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterListCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, ListClustersResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// 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) -> ProjectZoneClusterListCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides, or "-" for all zones. /// /// Sets the *zone* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterListCall<'a, C, 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 Delegate) -> ProjectZoneClusterListCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterListCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Sets the autoscaling settings of a specific 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::SetNodePoolAutoscalingRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetNodePoolAutoscalingRequest, _project_id: String, _zone: String, _cluster_id: String, _node_pool_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.autoscaling", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> { self._cluster_id = new_value.to_string(); self } /// The name of the node pool to upgrade. /// /// Sets the *node pool id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolAutoscalingCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Sets the size of a specific node pool. /// /// 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::SetNodePoolSizeRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetNodePoolSizeRequest, _project_id: String, _zone: String, _cluster_id: String, _node_pool_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.setSize", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> { self._zone = new_value.to_string(); self } /// 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) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> { self._cluster_id = new_value.to_string(); self } /// The name of the node pool to update. /// /// Sets the *node pool id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolSetSizeCall<'a, C, A> where T: Into>, S: AsRef { 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::SetMaintenancePolicyRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetMaintenancePolicyRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.setMaintenancePolicy", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/compute/docs/zones#available) in which the cluster /// resides. /// /// Sets the *zone* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to update. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, 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 Delegate) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterSetMaintenancePolicyCall<'a, C, A> where T: Into>, S: AsRef { 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolDeleteCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _cluster_id: String, _node_pool_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolDeleteCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.delete", http_method: hyper::method::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())); 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Delete, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> { self._cluster_id = new_value.to_string(); self } /// The name of the node pool to delete. /// /// Sets the *node pool id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolDeleteCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Sets the locations of a specific cluster. /// /// 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::SetLocationsRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterLocationCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetLocationsRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterLocationCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterLocationCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.locations", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterLocationCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterLocationCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterLocationCall<'a, C, 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 Delegate) -> ProjectZoneClusterLocationCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterLocationCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterLocationCall<'a, C, A> where T: Into>, S: AsRef { 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneClusterGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterGetCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Cluster)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.get", http_method: hyper::method::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())); 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// 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) -> ProjectZoneClusterGetCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterGetCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to retrieve. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterGetCall<'a, C, 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 Delegate) -> ProjectZoneClusterGetCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterGetCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Updates the master of 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::UpdateMasterRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterMasterCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: UpdateMasterRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterMasterCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterMasterCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.master", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterMasterCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterMasterCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterMasterCall<'a, C, 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 Delegate) -> ProjectZoneClusterMasterCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterMasterCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterMasterCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Updates the version and/or image type of a specific 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::UpdateNodePoolRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolUpdateCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: UpdateNodePoolRequest, _project_id: String, _zone: String, _cluster_id: String, _node_pool_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolUpdateCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.update", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> { self._cluster_id = new_value.to_string(); self } /// The name of the node pool to upgrade. /// /// Sets the *node pool id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolUpdateCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Enables/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::SetNetworkPolicyRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetNetworkPolicyRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.setNetworkPolicy", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C, 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 Delegate) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterSetNetworkPolicyCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Retrieves the node pool requested. /// /// 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneClusterNodePoolGetCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _cluster_id: String, _node_pool_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterNodePoolGetCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterNodePoolGetCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, NodePool)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.nodePools.get", http_method: hyper::method::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())); 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterNodePoolGetCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C, A> { self._cluster_id = new_value.to_string(); self } /// The name of the node pool. /// /// Sets the *node pool id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn node_pool_id(mut self, new_value: &str) -> ProjectZoneClusterNodePoolGetCall<'a, C, 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 Delegate) -> ProjectZoneClusterNodePoolGetCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterNodePoolGetCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterNodePoolGetCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } } /// Used to set master auth materials. Currently supports :- /// Changing the admin password of a specific cluster. /// This can be either via password generation or explicitly set 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::SetMasterAuthRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterSetMasterAuthCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetMasterAuthRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterSetMasterAuthCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterSetMasterAuthCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.setMasterAuth", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// 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) -> ProjectZoneClusterSetMasterAuthCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterSetMasterAuthCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster to upgrade. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterSetMasterAuthCall<'a, C, 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 Delegate) -> ProjectZoneClusterSetMasterAuthCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterSetMasterAuthCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterSetMasterAuthCall<'a, C, A> where T: Into>, S: AsRef { 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::CompleteIPRotationRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterCompleteIpRotationCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: CompleteIPRotationRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterCompleteIpRotationCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.completeIpRotation", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterCompleteIpRotationCall<'a, C, 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 Delegate) -> ProjectZoneClusterCompleteIpRotationCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterCompleteIpRotationCall<'a, C, A> where T: Into>, S: AsRef { 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::SetLabelsRequest; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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(); /// # } /// ``` pub struct ProjectZoneClusterResourceLabelCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _request: SetLabelsRequest, _project_id: String, _zone: String, _cluster_id: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneClusterResourceLabelCall<'a, C, A> {} impl<'a, C, A> ProjectZoneClusterResourceLabelCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, Operation)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.clusters.resourceLabels", http_method: hyper::method::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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default()); let mut request_value_reader = { let mut value = json::value::to_value(&self._request).expect("serde to work"); 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.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Post, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()) .header(ContentType(json_mime_type.clone())) .header(ContentLength(request_size as u64)) .body(&mut request_value_reader); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, 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, C, A> { self._request = new_value; self } /// The Google Developers Console [project ID or project /// number](https://developers.google.com/console/help/new/#projectnumber). /// /// Sets the *project id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn project_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine /// [zone](/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) -> ProjectZoneClusterResourceLabelCall<'a, C, A> { self._zone = new_value.to_string(); self } /// The name of the cluster. /// /// Sets the *cluster id* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn cluster_id(mut self, new_value: &str) -> ProjectZoneClusterResourceLabelCall<'a, C, 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 Delegate) -> ProjectZoneClusterResourceLabelCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneClusterResourceLabelCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneClusterResourceLabelCall<'a, C, A> where T: Into>, S: AsRef { 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; /// # #[test] fn egal() { /// # use std::default::Default; /// # use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage}; /// # use container1::Container; /// /// # let secret: ApplicationSecret = Default::default(); /// # let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate, /// # hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), /// # ::default(), None); /// # let mut hub = Container::new(hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())), 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") /// .doit(); /// # } /// ``` pub struct ProjectZoneOperationListCall<'a, C, A> where C: 'a, A: 'a { hub: &'a Container, _project_id: String, _zone: String, _delegate: Option<&'a mut Delegate>, _additional_params: HashMap, _scopes: BTreeMap } impl<'a, C, A> CallBuilder for ProjectZoneOperationListCall<'a, C, A> {} impl<'a, C, A> ProjectZoneOperationListCall<'a, C, A> where C: BorrowMut, A: oauth2::GetToken { /// Perform the operation you have build so far. pub fn doit(mut self) -> Result<(hyper::client::Response, ListOperationsResponse)> { use std::io::{Read, Seek}; use hyper::header::{ContentType, ContentLength, Authorization, Bearer, UserAgent, Location}; let mut dd = DefaultDelegate; let mut dlg: &mut Delegate = match self._delegate { Some(d) => d, None => &mut dd }; dlg.begin(MethodInfo { id: "container.projects.zones.operations.list", http_method: hyper::method::Method::Get }); let mut params: Vec<(&str, String)> = Vec::with_capacity((4 + 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(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 = 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); } } if params.len() > 0 { url.push('?'); url.push_str(&url::form_urlencoded::serialize(params)); } loop { let token = match self.hub.auth.borrow_mut().token(self._scopes.keys()) { Ok(token) => token, Err(err) => { match dlg.token(&*err) { Some(token) => token, None => { dlg.finished(false); return Err(Error::MissingToken(err)) } } } }; let auth_header = Authorization(Bearer { token: token.access_token }); let mut req_result = { let mut client = &mut *self.hub.client.borrow_mut(); let mut req = client.borrow_mut().request(hyper::method::Method::Get, &url) .header(UserAgent(self.hub._user_agent.clone())) .header(auth_header.clone()); dlg.pre_request(); req.send() }; match req_result { Err(err) => { if let oauth2::Retry::After(d) = dlg.http_error(&err) { sleep(d); continue; } dlg.finished(false); return Err(Error::HttpError(err)) } Ok(mut res) => { if !res.status.is_success() { let mut json_err = String::new(); res.read_to_string(&mut json_err).unwrap(); if let oauth2::Retry::After(d) = dlg.http_failure(&res, json::from_str(&json_err).ok(), json::from_str(&json_err).ok()) { sleep(d); continue; } dlg.finished(false); return match json::from_str::(&json_err){ Err(_) => Err(Error::Failure(res)), Ok(serr) => Err(Error::BadRequest(serr)) } } let result_value = { let mut json_response = String::new(); res.read_to_string(&mut json_response).unwrap(); match json::from_str(&json_response) { Ok(decoded) => (res, decoded), Err(err) => { dlg.response_json_decode_error(&json_response, &err); return Err(Error::JsonDecodeError(json_response, err)); } } }; dlg.finished(true); return Ok(result_value) } } } } /// 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) -> ProjectZoneOperationListCall<'a, C, A> { self._project_id = new_value.to_string(); self } /// The name of the Google Compute Engine [zone](/compute/docs/zones#available) /// to return operations for, or `-` for all zones. /// /// Sets the *zone* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn zone(mut self, new_value: &str) -> ProjectZoneOperationListCall<'a, C, 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 Delegate) -> ProjectZoneOperationListCall<'a, C, 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 paramters /// which have their own setter method. If done anyway, the request will fail. /// /// # Additional Parameters /// /// * *bearer_token* (query-string) - OAuth bearer token. /// * *pp* (query-boolean) - Pretty-print response. /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). /// * *access_token* (query-string) - OAuth access token. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *callback* (query-string) - JSONP /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. /// * *alt* (query-string) - Data format for response. /// * *$.xgafv* (query-string) - V1 error format. pub fn param(mut self, name: T, value: T) -> ProjectZoneOperationListCall<'a, C, A> where T: AsRef { 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(mut self, scope: T) -> ProjectZoneOperationListCall<'a, C, A> where T: Into>, S: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, }; self } }