From 1738a9eeac86e9dfbb5d8fec0af52ece1945d15c Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 14 Sep 2022 09:16:18 +0800 Subject: [PATCH] update docs1 to latest version Strange this didn't happen when regenerating all APIs. --- gen/docs1/Cargo.toml | 21 +- gen/docs1/LICENSE.md | 2 +- gen/docs1/README.md | 101 +- gen/docs1/src/api.rs | 16824 ++++++++++++++++++++++++++++++-------- gen/docs1/src/client.rs | 38 +- gen/docs1/src/lib.rs | 68 +- 6 files changed, 13454 insertions(+), 3600 deletions(-) diff --git a/gen/docs1/Cargo.toml b/gen/docs1/Cargo.toml index 602c9f5bb9..ade576e4c1 100644 --- a/gen/docs1/Cargo.toml +++ b/gen/docs1/Cargo.toml @@ -1,17 +1,17 @@ # DO NOT EDIT ! -# This file was generated automatically from 'src/mako/Cargo.toml.mako' +# This file was generated automatically from 'src/generator/templates/Cargo.toml.mako' # DO NOT EDIT ! [package] -name = "google-docs1" -version = "3.1.0+20220301" +name = "google-dns2" +version = "4.0.1+20220217" authors = ["Sebastian Thiel "] -description = "A complete library to interact with Docs (protocol v1)" -repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/docs1" -homepage = "https://developers.google.com/docs/" -documentation = "https://docs.rs/google-docs1/3.1.0+20220301" +description = "A complete library to interact with Dns (protocol v2)" +repository = "https://github.com/Byron/google-apis-rs/tree/main/gen/dns2" +homepage = "https://cloud.google.com/dns/docs" +documentation = "https://docs.rs/google-dns2/4.0.1+20220217" license = "MIT" -keywords = ["docs", "google", "protocol", "web", "api"] +keywords = ["dns", "google", "protocol", "web", "api"] autobins = false edition = "2018" @@ -22,9 +22,12 @@ mime = "^ 0.2.0" serde = "^ 1.0" serde_json = "^ 1.0" serde_derive = "^ 1.0" -yup-oauth2 = "^ 6.6" +yup-oauth2 = "^ 7.0" itertools = "^ 0.10" hyper = "^ 0.14" +http = "^0.2" +tokio = "^1.0" +tower-service = "^0.3.1" url = "= 1.7" diff --git a/gen/docs1/LICENSE.md b/gen/docs1/LICENSE.md index d2306e20eb..63756554ea 100644 --- a/gen/docs1/LICENSE.md +++ b/gen/docs1/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) diff --git a/gen/docs1/README.md b/gen/docs1/README.md index 1af5b4b420..e107e85e06 100644 --- a/gen/docs1/README.md +++ b/gen/docs1/README.md @@ -1,20 +1,36 @@ -The `google-docs1` library allows access to all features of the *Google Docs* service. +The `google-dns2` library allows access to all features of the *Google Dns* service. -This documentation was generated from *Docs* crate version *3.1.0+20220301*, where *20220301* is the exact revision of the *docs:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v3.1.0*. +This documentation was generated from *Dns* crate version *4.0.1+20220217*, where *20220217* is the exact revision of the *dns:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v4.0.1*. -Everything else about the *Docs* *v1* API can be found at the -[official documentation site](https://developers.google.com/docs/). +Everything else about the *Dns* *v2* API can be found at the +[official documentation site](https://cloud.google.com/dns/docs). # Features -Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/Docs) ... +Handle the following *Resources* with ease from the central [hub](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/Dns) ... -* [documents](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/api::Document) - * [*batch update*](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/api::DocumentBatchUpdateCall), [*create*](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/api::DocumentCreateCall) and [*get*](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/api::DocumentGetCall) +* [changes](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::Change) + * [*create*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ChangeCreateCall), [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ChangeGetCall) and [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ChangeListCall) +* [dns keys](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::DnsKey) + * [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::DnsKeyGetCall) and [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::DnsKeyListCall) +* managed zone operations + * [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZoneOperationGetCall) and [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZoneOperationListCall) +* [managed zones](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZone) + * [*create*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZoneCreateCall), [*delete*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZoneDeleteCall), [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZoneGetCall), [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZoneListCall), [*patch*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZonePatchCall) and [*update*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ManagedZoneUpdateCall) +* [policies](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::Policy) + * [*create*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::PolicyCreateCall), [*delete*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::PolicyDeleteCall), [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::PolicyGetCall), [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::PolicyListCall), [*patch*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::PolicyPatchCall) and [*update*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::PolicyUpdateCall) +* [projects](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::Project) + * [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ProjectGetCall) +* [resource record sets](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResourceRecordSet) + * [*create*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResourceRecordSetCreateCall), [*delete*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResourceRecordSetDeleteCall), [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResourceRecordSetGetCall), [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResourceRecordSetListCall) and [*patch*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResourceRecordSetPatchCall) +* [response policies](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicy) + * [*create*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyCreateCall), [*delete*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyDeleteCall), [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyGetCall), [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyListCall), [*patch*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyPatchCall) and [*update*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyUpdateCall) +* [response policy rules](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyRule) + * [*create*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyRuleCreateCall), [*delete*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyRuleDeleteCall), [*get*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyRuleGetCall), [*list*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyRuleListCall), [*patch*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyRulePatchCall) and [*update*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/api::ResponsePolicyRuleUpdateCall) @@ -23,17 +39,17 @@ Handle the following *Resources* with ease from the central [hub](https://docs.r The API is structured into the following primary items: -* **[Hub](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/Docs)** +* **[Hub](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/Dns)** * a central object to maintain state and allow accessing all *Activities* - * creates [*Method Builders*](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::MethodsBuilder) which in turn - allow access to individual [*Call Builders*](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::CallBuilder) -* **[Resources](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Resource)** + * creates [*Method Builders*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::MethodsBuilder) which in turn + allow access to individual [*Call Builders*](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::CallBuilder) +* **[Resources](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Resource)** * primary types that you can apply *Activities* to * a collection of properties and *Parts* - * **[Parts](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Part)** + * **[Parts](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Part)** * a collection of properties * never directly used in *Activities* -* **[Activities](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::CallBuilder)** +* **[Activities](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::CallBuilder)** * operations to apply to *Resources* All *structures* are marked with applicable traits to further categorize them and ease browsing. @@ -47,9 +63,12 @@ let r = hub.resource().activity(...).doit().await Or specifically ... ```ignore -let r = hub.documents().batch_update(...).doit().await -let r = hub.documents().create(...).doit().await -let r = hub.documents().get(...).doit().await +let r = hub.managed_zones().create(...).doit().await +let r = hub.managed_zones().delete(...).doit().await +let r = hub.managed_zones().get(...).doit().await +let r = hub.managed_zones().list(...).doit().await +let r = hub.managed_zones().patch(...).doit().await +let r = hub.managed_zones().update(...).doit().await ``` The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -65,7 +84,7 @@ To use this library, you would put the following lines into your `Cargo.toml` fi ```toml [dependencies] -google-docs1 = "*" +google-dns2 = "*" serde = "^1.0" serde_json = "^1.0" ``` @@ -75,11 +94,10 @@ serde_json = "^1.0" ```Rust extern crate hyper; extern crate hyper_rustls; -extern crate google_docs1 as docs1; -use docs1::api::BatchUpdateDocumentRequest; -use docs1::{Result, Error}; +extern crate google_dns2 as dns2; +use dns2::{Result, Error}; use std::default::Default; -use docs1::{Docs, oauth2, hyper, hyper_rustls}; +use dns2::{Dns, oauth2, hyper, hyper_rustls}; // Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things. @@ -93,16 +111,14 @@ let auth = oauth2::InstalledFlowAuthenticator::builder( secret, oauth2::InstalledFlowReturnMethod::HTTPRedirect, ).build().await.unwrap(); -let mut hub = Docs::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = BatchUpdateDocumentRequest::default(); - +let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.documents().batch_update(req, "documentId") +let result = hub.managed_zones().list("project", "location") + .page_token("no") + .max_results(-55) + .dns_name("voluptua.") .doit().await; match result { @@ -126,17 +142,17 @@ match result { ``` ## Handling Errors -All errors produced by the system are provided either as [Result](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Result) enumeration as return value of +All errors produced by the system are provided either as [Result](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Result) enumeration as return value of the doit() methods, or handed as possibly intermediate results to either the -[Hub Delegate](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Delegate), or the [Authenticator Delegate](https://docs.rs/yup-oauth2/*/yup_oauth2/trait.AuthenticatorDelegate.html). +[Hub Delegate](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Delegate), 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](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Result), should be +If a method supports downloads, the response body, which is part of the [Result](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Result), should be read by you to obtain the media. -If such a method also supports a [Response Result](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::ResponseResult), it will return that by default. +If such a method also supports a [Response Result](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::ResponseResult), 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")`. @@ -146,29 +162,29 @@ Methods supporting uploads can do so using up to 2 different protocols: ## Customization and Callbacks -You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Delegate) to the -[Method Builder](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::CallBuilder) before making the final `doit()` call. +You may alter the way an `doit()` method is called by providing a [delegate](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Delegate) to the +[Method Builder](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::CallBuilder) 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](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Delegate) is default-implemented, allowing you to customize it with minimal effort. +The [delegate trait](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Delegate) 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 [encodable](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::RequestValue) and -[decodable](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses +All structures provided by this library are made to be [encodable](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::RequestValue) and +[decodable](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::ResponseResult) via *json*. Optionals are used to indicate that partial requests are responses are valid. -Most optionals are are considered [Parts](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::Part) which are identifiable by name, which will be sent to +Most optionals are are considered [Parts](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::Part) 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](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::CallBuilder), you are able to prepare an action call by repeatedly calling it's methods. +Using [method builders](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::CallBuilder), 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](https://docs.rs/google-docs1/3.1.0+20220301/google_docs1/client::RequestValue) are moved +* [request values](https://docs.rs/google-dns2/4.0.1+20220217/google_dns2/client::RequestValue) are moved Arguments will always be copied or cloned into the builder, to make them independent of their original life times. @@ -177,8 +193,9 @@ Arguments will always be copied or cloned into the builder, to make them indepen [google-go-api]: https://github.com/google/google-api-go-client # License -The **docs1** library was generated by Sebastian Thiel, and is placed +The **dns2** library was generated by Sebastian Thiel, and is placed under the *MIT* license. You can read the full text at the repository's [license file][repo-license]. [repo-license]: https://github.com/Byron/google-apis-rsblob/main/LICENSE.md + diff --git a/gen/docs1/src/api.rs b/gen/docs1/src/api.rs index 386f321c76..911354a7dc 100644 --- a/gen/docs1/src/api.rs +++ b/gen/docs1/src/api.rs @@ -2,12 +2,17 @@ use std::collections::HashMap; use std::cell::RefCell; use std::default::Default; use std::collections::BTreeMap; +use std::error::Error as StdError; use serde_json as json; use std::io; use std::fs; use std::mem; use std::thread::sleep; +use http::Uri; +use hyper::client::connect; +use tokio::io::{AsyncRead, AsyncWrite}; +use tower_service; use crate::client; // ############## @@ -19,37 +24,33 @@ use crate::client; /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Hash)] pub enum Scope { - /// See, edit, create, and delete all your Google Docs documents - Document, + /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. + CloudPlatform, - /// See all your Google Docs documents - DocumentReadonly, + /// View your data across Google Cloud services and see the email address of your Google Account + CloudPlatformReadOnly, - /// See, edit, create, and delete all of your Google Drive files - Drive, + /// View your DNS records hosted by Google Cloud DNS + NdevClouddnReadonly, - /// See, edit, create, and delete only the specific Google Drive files you use with this app - DriveFile, - - /// See and download all your Google Drive files - DriveReadonly, + /// View and manage your DNS records hosted by Google Cloud DNS + NdevClouddnReadwrite, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { - Scope::Document => "https://www.googleapis.com/auth/documents", - Scope::DocumentReadonly => "https://www.googleapis.com/auth/documents.readonly", - Scope::Drive => "https://www.googleapis.com/auth/drive", - Scope::DriveFile => "https://www.googleapis.com/auth/drive.file", - Scope::DriveReadonly => "https://www.googleapis.com/auth/drive.readonly", + Scope::CloudPlatform => "https://www.googleapis.com/auth/cloud-platform", + Scope::CloudPlatformReadOnly => "https://www.googleapis.com/auth/cloud-platform.read-only", + Scope::NdevClouddnReadonly => "https://www.googleapis.com/auth/ndev.clouddns.readonly", + Scope::NdevClouddnReadwrite => "https://www.googleapis.com/auth/ndev.clouddns.readwrite", } } } impl Default for Scope { fn default() -> Scope { - Scope::DocumentReadonly + Scope::NdevClouddnReadonly } } @@ -59,7 +60,7 @@ impl Default for Scope { // HUB ### // ###### -/// Central instance to access all Docs related resource activities +/// Central instance to access all Dns related resource activities /// /// # Examples /// @@ -68,12 +69,11 @@ impl Default for Scope { /// ```test_harness,no_run /// extern crate hyper; /// extern crate hyper_rustls; -/// extern crate google_docs1 as docs1; -/// use docs1::api::BatchUpdateDocumentRequest; -/// use docs1::{Result, Error}; +/// extern crate google_dns2 as dns2; +/// use dns2::{Result, Error}; /// # async fn dox() { /// use std::default::Default; -/// use docs1::{Docs, oauth2, hyper, hyper_rustls}; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; /// /// // Get an ApplicationSecret instance by some means. It contains the `client_id` and /// // `client_secret`, among other things. @@ -87,16 +87,14 @@ impl Default for Scope { /// secret, /// oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// ).build().await.unwrap(); -/// let mut hub = Docs::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = BatchUpdateDocumentRequest::default(); -/// +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.documents().batch_update(req, "documentId") +/// let result = hub.managed_zones().list("project", "location") +/// .page_token("ipsum") +/// .max_results(-62) +/// .dns_name("Lorem") /// .doit().await; /// /// match result { @@ -119,34 +117,58 @@ impl Default for Scope { /// # } /// ``` #[derive(Clone)] -pub struct Docs<> { - pub client: hyper::Client, hyper::body::Body>, - pub auth: oauth2::authenticator::Authenticator>, +pub struct Dns { + pub client: hyper::Client, + pub auth: oauth2::authenticator::Authenticator, _user_agent: String, _base_url: String, _root_url: String, } -impl<'a, > client::Hub for Docs<> {} +impl<'a, S> client::Hub for Dns {} -impl<'a, > Docs<> { +impl<'a, S> Dns { - pub fn new(client: hyper::Client, hyper::body::Body>, authenticator: oauth2::authenticator::Authenticator>) -> Docs<> { - Docs { + pub fn new(client: hyper::Client, authenticator: oauth2::authenticator::Authenticator) -> Dns { + Dns { client, auth: authenticator, - _user_agent: "google-api-rust-client/3.1.0".to_string(), - _base_url: "https://docs.googleapis.com/".to_string(), - _root_url: "https://docs.googleapis.com/".to_string(), + _user_agent: "google-api-rust-client/4.0.1".to_string(), + _base_url: "https://dns.googleapis.com/".to_string(), + _root_url: "https://dns.googleapis.com/".to_string(), } } - pub fn documents(&'a self) -> DocumentMethods<'a> { - DocumentMethods { hub: &self } + pub fn changes(&'a self) -> ChangeMethods<'a, S> { + ChangeMethods { hub: &self } + } + pub fn dns_keys(&'a self) -> DnsKeyMethods<'a, S> { + DnsKeyMethods { hub: &self } + } + pub fn managed_zone_operations(&'a self) -> ManagedZoneOperationMethods<'a, S> { + ManagedZoneOperationMethods { hub: &self } + } + pub fn managed_zones(&'a self) -> ManagedZoneMethods<'a, S> { + ManagedZoneMethods { hub: &self } + } + pub fn policies(&'a self) -> PolicyMethods<'a, S> { + PolicyMethods { hub: &self } + } + pub fn projects(&'a self) -> ProjectMethods<'a, S> { + ProjectMethods { hub: &self } + } + pub fn resource_record_sets(&'a self) -> ResourceRecordSetMethods<'a, S> { + ResourceRecordSetMethods { hub: &self } + } + pub fn response_policies(&'a self) -> ResponsePolicyMethods<'a, S> { + ResponsePolicyMethods { hub: &self } + } + pub fn response_policy_rules(&'a self) -> ResponsePolicyRuleMethods<'a, S> { + ResponsePolicyRuleMethods { hub: &self } } /// Set the user-agent header field to use in all requests to the server. - /// It defaults to `google-api-rust-client/3.1.0`. + /// It defaults to `google-api-rust-client/4.0.1`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { @@ -154,7 +176,7 @@ impl<'a, > Docs<> { } /// Set the base url to use in all requests to the server. - /// It defaults to `https://docs.googleapis.com/`. + /// It defaults to `https://dns.googleapis.com/`. /// /// Returns the previously set base url. pub fn base_url(&mut self, new_base_url: String) -> String { @@ -162,7 +184,7 @@ impl<'a, > Docs<> { } /// Set the root url to use in all requests to the server. - /// It defaults to `https://docs.googleapis.com/`. + /// It defaults to `https://dns.googleapis.com/`. /// /// Returns the previously set root url. pub fn root_url(&mut self, new_root_url: String) -> String { @@ -174,3326 +196,1222 @@ impl<'a, > Docs<> { // ############ // SCHEMAS ### // ########## -/// A ParagraphElement representing a spot in the text that is dynamically replaced with content that can change over time, like a page number. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct AutoText { - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. An AutoText may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this AutoText, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this AutoText. - #[serde(rename="textStyle")] - pub text_style: Option, - /// The type of this auto text. - #[serde(rename="type")] - pub type_: Option, -} - -impl client::Part for AutoText {} - - -/// Represents the background of a document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Background { - /// The background color. - pub color: Option, -} - -impl client::Part for Background {} - - -/// A mask that indicates which of the fields on the base Background have been changed in this suggestion. For any field set to true, the Backgound has a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BackgroundSuggestionState { - /// Indicates whether the current background color has been modified in this suggestion. - #[serde(rename="backgroundColorSuggested")] - pub background_color_suggested: Option, -} - -impl client::Part for BackgroundSuggestionState {} - - -/// Request message for BatchUpdateDocument. +/// A Change represents a set of ResourceRecordSet additions and deletions applied atomically to a ManagedZone. ResourceRecordSets within a ManagedZone are modified by creating a new Change element in the Changes collection. In turn the Changes collection also records the past modifications to the ResourceRecordSets in a ManagedZone. The current state of the ManagedZone is the sum effect of applying all Change elements in the Changes collection in sequence. /// /// # 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*). /// -/// * [batch update documents](DocumentBatchUpdateCall) (request) +/// * [create changes](ChangeCreateCall) (request|response) +/// * [get changes](ChangeGetCall) (response) +/// * [list changes](ChangeListCall) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchUpdateDocumentRequest { - /// A list of updates to apply to the document. - pub requests: Option>, - /// Provides control over how write requests are executed. - #[serde(rename="writeControl")] - pub write_control: Option, +pub struct Change { + /// Which ResourceRecordSets to add? + pub additions: Option>, + /// Which ResourceRecordSets to remove? Must match existing data exactly. + pub deletions: Option>, + /// Unique identifier for the resource; defined by the server (output only). + pub id: Option, + /// If the DNS queries for the zone will be served. + #[serde(rename="isServing")] + pub is_serving: Option, + /// no description provided + pub kind: Option, + /// The time that this operation was started by the server (output only). This is in RFC3339 text format. + #[serde(rename="startTime")] + pub start_time: Option, + /// Status of the operation (output only). A status of "done" means that the request to update the authoritative servers has been sent, but the servers might not be updated yet. + pub status: Option, } -impl client::RequestValue for BatchUpdateDocumentRequest {} +impl client::RequestValue for Change {} +impl client::Resource for Change {} +impl client::ResponseResult for Change {} -/// Response message from a BatchUpdateDocument request. +/// The response to a request to enumerate Changes to a ResourceRecordSets collection. /// /// # 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*). /// -/// * [batch update documents](DocumentBatchUpdateCall) (response) +/// * [list changes](ChangeListCall) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BatchUpdateDocumentResponse { - /// The ID of the document to which the updates were applied to. - #[serde(rename="documentId")] - pub document_id: Option, - /// The reply of the updates. This maps 1:1 with the updates, although replies to some requests may be empty. - pub replies: Option>, - /// The updated write control after applying the request. - #[serde(rename="writeControl")] - pub write_control: Option, +pub struct ChangesListResponse { + /// The requested changes. + pub changes: Option>, + /// no description provided + pub header: Option, + /// Type of resource. + pub kind: Option, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. This lets you retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned are an inconsistent view of the collection. You cannot retrieve a "snapshot" of collections larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, } -impl client::ResponseResult for BatchUpdateDocumentResponse {} +impl client::ResponseResult for ChangesListResponse {} -/// The document body. The body typically contains the full document contents except for headers, footers and footnotes. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Body { - /// The contents of the body. The indexes for the body's content begin at zero. - pub content: Option>, -} - -impl client::Part for Body {} - - -/// Describes the bullet of a paragraph. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Bullet { - /// The ID of the list this paragraph belongs to. - #[serde(rename="listId")] - pub list_id: Option, - /// The nesting level of this paragraph in the list. - #[serde(rename="nestingLevel")] - pub nesting_level: Option, - /// The paragraph specific text style applied to this bullet. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for Bullet {} - - -/// A mask that indicates which of the fields on the base Bullet have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct BulletSuggestionState { - /// Indicates if there was a suggested change to the list_id. - #[serde(rename="listIdSuggested")] - pub list_id_suggested: Option, - /// Indicates if there was a suggested change to the nesting_level. - #[serde(rename="nestingLevelSuggested")] - pub nesting_level_suggested: Option, - /// A mask that indicates which of the fields in text style have been changed in this suggestion. - #[serde(rename="textStyleSuggestionState")] - pub text_style_suggestion_state: Option, -} - -impl client::Part for BulletSuggestionState {} - - -/// A solid color. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Color { - /// The RGB color value. - #[serde(rename="rgbColor")] - pub rgb_color: Option, -} - -impl client::Part for Color {} - - -/// A ParagraphElement representing a column break. A column break makes the subsequent text start at the top of the next column. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ColumnBreak { - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A ColumnBreak may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this ColumnBreak, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this ColumnBreak. Similar to text content, like text runs and footnote references, the text style of a column break can affect content layout as well as the styling of text inserted adjacent to it. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for ColumnBreak {} - - -/// Creates a Footer. The new footer is applied to the SectionStyle at the location of the SectionBreak if specificed, otherwise it is applied to the DocumentStyle. If a footer of the specified type already exists, a 400 bad request error is returned. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateFooterRequest { - /// The location of the SectionBreak immediately preceding the section whose SectionStyle this footer should belong to. If this is unset or refers to the first section break in the document, the footer applies to the document style. - #[serde(rename="sectionBreakLocation")] - pub section_break_location: Option, - /// The type of footer to create. - #[serde(rename="type")] - pub type_: Option, -} - -impl client::Part for CreateFooterRequest {} - - -/// The result of creating a footer. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateFooterResponse { - /// The ID of the created footer. - #[serde(rename="footerId")] - pub footer_id: Option, -} - -impl client::Part for CreateFooterResponse {} - - -/// Creates a Footnote segment and inserts a new FootnoteReference to it at the given location. The new Footnote segment will contain a space followed by a newline character. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateFootnoteRequest { - /// Inserts the footnote reference at the end of the document body. Footnote references cannot be inserted inside a header, footer or footnote. Since footnote references can only be inserted in the body, the segment ID field must be empty. - #[serde(rename="endOfSegmentLocation")] - pub end_of_segment_location: Option, - /// Inserts the footnote reference at a specific index in the document. The footnote reference must be inserted inside the bounds of an existing Paragraph. For instance, it cannot be inserted at a table's start index (i.e. between the table and its preceding paragraph). Footnote references cannot be inserted inside an equation, header, footer or footnote. Since footnote references can only be inserted in the body, the segment ID field must be empty. - pub location: Option, -} - -impl client::Part for CreateFootnoteRequest {} - - -/// The result of creating a footnote. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateFootnoteResponse { - /// The ID of the created footnote. - #[serde(rename="footnoteId")] - pub footnote_id: Option, -} - -impl client::Part for CreateFootnoteResponse {} - - -/// Creates a Header. The new header is applied to the SectionStyle at the location of the SectionBreak if specificed, otherwise it is applied to the DocumentStyle. If a header of the specified type already exists, a 400 bad request error is returned. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateHeaderRequest { - /// The location of the SectionBreak which begins the section this header should belong to. If `section_break_location' is unset or if it refers to the first section break in the document body, the header applies to the DocumentStyle - #[serde(rename="sectionBreakLocation")] - pub section_break_location: Option, - /// The type of header to create. - #[serde(rename="type")] - pub type_: Option, -} - -impl client::Part for CreateHeaderRequest {} - - -/// The result of creating a header. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateHeaderResponse { - /// The ID of the created header. - #[serde(rename="headerId")] - pub header_id: Option, -} - -impl client::Part for CreateHeaderResponse {} - - -/// Creates a NamedRange referencing the given range. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateNamedRangeRequest { - /// The name of the NamedRange. Names do not need to be unique. Names must be at least 1 character and no more than 256 characters, measured in UTF-16 code units. - pub name: Option, - /// The range to apply the name to. - pub range: Option, -} - -impl client::Part for CreateNamedRangeRequest {} - - -/// The result of creating a named range. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateNamedRangeResponse { - /// The ID of the created named range. - #[serde(rename="namedRangeId")] - pub named_range_id: Option, -} - -impl client::Part for CreateNamedRangeResponse {} - - -/// Creates bullets for all of the paragraphs that overlap with the given range. The nesting level of each paragraph will be determined by counting leading tabs in front of each paragraph. To avoid excess space between the bullet and the corresponding paragraph, these leading tabs are removed by this request. This may change the indices of parts of the text. If the paragraph immediately before paragraphs being updated is in a list with a matching preset, the paragraphs being updated are added to that preceding list. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CreateParagraphBulletsRequest { - /// The kinds of bullet glyphs to be used. - #[serde(rename="bulletPreset")] - pub bullet_preset: Option, - /// The range to apply the bullet preset to. - pub range: Option, -} - -impl client::Part for CreateParagraphBulletsRequest {} - - -/// The crop properties of an image. The crop rectangle is represented using fractional offsets from the original content's four edges. - If the offset is in the interval (0, 1), the corresponding edge of crop rectangle is positioned inside of the image's original bounding rectangle. - If the offset is negative or greater than 1, the corresponding edge of crop rectangle is positioned outside of the image's original bounding rectangle. - If all offsets and rotation angle are 0, the image is not cropped. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CropProperties { - /// The clockwise rotation angle of the crop rectangle around its center, in radians. Rotation is applied after the offsets. - pub angle: Option, - /// The offset specifies how far inwards the bottom edge of the crop rectangle is from the bottom edge of the original content as a fraction of the original content's height. - #[serde(rename="offsetBottom")] - pub offset_bottom: Option, - /// The offset specifies how far inwards the left edge of the crop rectangle is from the left edge of the original content as a fraction of the original content's width. - #[serde(rename="offsetLeft")] - pub offset_left: Option, - /// The offset specifies how far inwards the right edge of the crop rectangle is from the right edge of the original content as a fraction of the original content's width. - #[serde(rename="offsetRight")] - pub offset_right: Option, - /// The offset specifies how far inwards the top edge of the crop rectangle is from the top edge of the original content as a fraction of the original content's height. - #[serde(rename="offsetTop")] - pub offset_top: Option, -} - -impl client::Part for CropProperties {} - - -/// A mask that indicates which of the fields on the base CropProperties have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct CropPropertiesSuggestionState { - /// Indicates if there was a suggested change to angle. - #[serde(rename="angleSuggested")] - pub angle_suggested: Option, - /// Indicates if there was a suggested change to offset_bottom. - #[serde(rename="offsetBottomSuggested")] - pub offset_bottom_suggested: Option, - /// Indicates if there was a suggested change to offset_left. - #[serde(rename="offsetLeftSuggested")] - pub offset_left_suggested: Option, - /// Indicates if there was a suggested change to offset_right. - #[serde(rename="offsetRightSuggested")] - pub offset_right_suggested: Option, - /// Indicates if there was a suggested change to offset_top. - #[serde(rename="offsetTopSuggested")] - pub offset_top_suggested: Option, -} - -impl client::Part for CropPropertiesSuggestionState {} - - -/// Deletes content from the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteContentRangeRequest { - /// The range of content to delete. Deleting text that crosses a paragraph boundary may result in changes to paragraph styles, lists, positioned objects and bookmarks as the two paragraphs are merged. Attempting to delete certain ranges can result in an invalid document structure in which case a 400 bad request error is returned. Some examples of invalid delete requests include: * Deleting one code unit of a surrogate pair. * Deleting the last newline character of a Body, Header, Footer, Footnote, TableCell or TableOfContents. * Deleting the start or end of a Table, TableOfContents or Equation without deleting the entire element. * Deleting the newline character before a Table, TableOfContents or SectionBreak without deleting the element. * Deleting individual rows or cells of a table. Deleting the content within a table cell is allowed. - pub range: Option, -} - -impl client::Part for DeleteContentRangeRequest {} - - -/// Deletes a Footer from the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteFooterRequest { - /// The id of the footer to delete. If this footer is defined on DocumentStyle, the reference to this footer is removed, resulting in no footer of that type for the first section of the document. If this footer is defined on a SectionStyle, the reference to this footer is removed and the footer of that type is now continued from the previous section. - #[serde(rename="footerId")] - pub footer_id: Option, -} - -impl client::Part for DeleteFooterRequest {} - - -/// Deletes a Header from the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteHeaderRequest { - /// The id of the header to delete. If this header is defined on DocumentStyle, the reference to this header is removed, resulting in no header of that type for the first section of the document. If this header is defined on a SectionStyle, the reference to this header is removed and the header of that type is now continued from the previous section. - #[serde(rename="headerId")] - pub header_id: Option, -} - -impl client::Part for DeleteHeaderRequest {} - - -/// Deletes a NamedRange. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteNamedRangeRequest { - /// The name of the range(s) to delete. All named ranges with the given name will be deleted. - pub name: Option, - /// The ID of the named range to delete. - #[serde(rename="namedRangeId")] - pub named_range_id: Option, -} - -impl client::Part for DeleteNamedRangeRequest {} - - -/// Deletes bullets from all of the paragraphs that overlap with the given range. The nesting level of each paragraph will be visually preserved by adding indent to the start of the corresponding paragraph. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteParagraphBulletsRequest { - /// The range to delete bullets from. - pub range: Option, -} - -impl client::Part for DeleteParagraphBulletsRequest {} - - -/// Deletes a PositionedObject from the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeletePositionedObjectRequest { - /// The ID of the positioned object to delete. - #[serde(rename="objectId")] - pub object_id: Option, -} - -impl client::Part for DeletePositionedObjectRequest {} - - -/// Deletes a column from a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteTableColumnRequest { - /// The reference table cell location from which the column will be deleted. The column this cell spans will be deleted. If this is a merged cell that spans multiple columns, all columns that the cell spans will be deleted. If no columns remain in the table after this deletion, the whole table is deleted. - #[serde(rename="tableCellLocation")] - pub table_cell_location: Option, -} - -impl client::Part for DeleteTableColumnRequest {} - - -/// Deletes a row from a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DeleteTableRowRequest { - /// The reference table cell location from which the row will be deleted. The row this cell spans will be deleted. If this is a merged cell that spans multiple rows, all rows that the cell spans will be deleted. If no rows remain in the table after this deletion, the whole table is deleted. - #[serde(rename="tableCellLocation")] - pub table_cell_location: Option, -} - -impl client::Part for DeleteTableRowRequest {} - - -/// A magnitude in a single direction in the specified units. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Dimension { - /// The magnitude. - pub magnitude: Option, - /// The units for magnitude. - pub unit: Option, -} - -impl client::Part for Dimension {} - - -/// A Google Docs document. +/// A DNSSEC key pair. /// /// # 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*). /// -/// * [batch update documents](DocumentBatchUpdateCall) (none) -/// * [create documents](DocumentCreateCall) (request|response) -/// * [get documents](DocumentGetCall) (response) +/// * [get dns keys](DnsKeyGetCall) (response) +/// * [list dns keys](DnsKeyListCall) (none) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Document { - /// Output only. The main body of the document. - pub body: Option, - /// Output only. The ID of the document. - #[serde(rename="documentId")] - pub document_id: Option, - /// Output only. The style of the document. - #[serde(rename="documentStyle")] - pub document_style: Option, - /// Output only. The footers in the document, keyed by footer ID. - pub footers: Option>, - /// Output only. The footnotes in the document, keyed by footnote ID. - pub footnotes: Option>, - /// Output only. The headers in the document, keyed by header ID. - pub headers: Option>, - /// Output only. The inline objects in the document, keyed by object ID. - #[serde(rename="inlineObjects")] - pub inline_objects: Option>, - /// Output only. The lists in the document, keyed by list ID. - pub lists: Option>, - /// Output only. The named ranges in the document, keyed by name. - #[serde(rename="namedRanges")] - pub named_ranges: Option>, - /// Output only. The named styles of the document. - #[serde(rename="namedStyles")] - pub named_styles: Option, - /// Output only. The positioned objects in the document, keyed by object ID. - #[serde(rename="positionedObjects")] - pub positioned_objects: Option>, - /// Output only. The revision ID of the document. Can be used in update requests to specify which revision of a document to apply updates to and how the request should behave if the document has been edited since that revision. Only populated if the user has edit access to the document. The format of the revision ID may change over time, so it should be treated opaquely. A returned revision ID is only guaranteed to be valid for 24 hours after it has been returned and cannot be shared across users. If the revision ID is unchanged between calls, then the document has not changed. Conversely, a changed ID (for the same document and user) usually means the document has been updated; however, a changed ID can also be due to internal factors such as ID format changes. - #[serde(rename="revisionId")] - pub revision_id: Option, - /// Output only. The suggested changes to the style of the document, keyed by suggestion ID. - #[serde(rename="suggestedDocumentStyleChanges")] - pub suggested_document_style_changes: Option>, - /// Output only. The suggested changes to the named styles of the document, keyed by suggestion ID. - #[serde(rename="suggestedNamedStylesChanges")] - pub suggested_named_styles_changes: Option>, - /// Output only. The suggestions view mode applied to the document. Note: When editing a document, changes must be based on a document with SUGGESTIONS_INLINE. - #[serde(rename="suggestionsViewMode")] - pub suggestions_view_mode: Option, - /// The title of the document. - pub title: Option, -} - -impl client::RequestValue for Document {} -impl client::Resource for Document {} -impl client::ResponseResult for Document {} - - -/// The style of the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DocumentStyle { - /// The background of the document. Documents cannot have a transparent background color. - pub background: Option, - /// The ID of the default footer. If not set, there is no default footer. This property is read-only. - #[serde(rename="defaultFooterId")] - pub default_footer_id: Option, - /// The ID of the default header. If not set, there is no default header. This property is read-only. - #[serde(rename="defaultHeaderId")] - pub default_header_id: Option, - /// The ID of the footer used only for even pages. The value of use_even_page_header_footer determines whether to use the default_footer_id or this value for the footer on even pages. If not set, there is no even page footer. This property is read-only. - #[serde(rename="evenPageFooterId")] - pub even_page_footer_id: Option, - /// The ID of the header used only for even pages. The value of use_even_page_header_footer determines whether to use the default_header_id or this value for the header on even pages. If not set, there is no even page header. This property is read-only. - #[serde(rename="evenPageHeaderId")] - pub even_page_header_id: Option, - /// The ID of the footer used only for the first page. If not set then a unique footer for the first page does not exist. The value of use_first_page_header_footer determines whether to use the default_footer_id or this value for the footer on the first page. If not set, there is no first page footer. This property is read-only. - #[serde(rename="firstPageFooterId")] - pub first_page_footer_id: Option, - /// The ID of the header used only for the first page. If not set then a unique header for the first page does not exist. The value of use_first_page_header_footer determines whether to use the default_header_id or this value for the header on the first page. If not set, there is no first page header. This property is read-only. - #[serde(rename="firstPageHeaderId")] - pub first_page_header_id: Option, - /// The bottom page margin. Updating the bottom page margin on the document style clears the bottom page margin on all section styles. - #[serde(rename="marginBottom")] - pub margin_bottom: Option, - /// The amount of space between the bottom of the page and the contents of the footer. - #[serde(rename="marginFooter")] - pub margin_footer: Option, - /// The amount of space between the top of the page and the contents of the header. - #[serde(rename="marginHeader")] - pub margin_header: Option, - /// The left page margin. Updating the left page margin on the document style clears the left page margin on all section styles. It may also cause columns to resize in all sections. - #[serde(rename="marginLeft")] - pub margin_left: Option, - /// The right page margin. Updating the right page margin on the document style clears the right page margin on all section styles. It may also cause columns to resize in all sections. - #[serde(rename="marginRight")] - pub margin_right: Option, - /// The top page margin. Updating the top page margin on the document style clears the top page margin on all section styles. - #[serde(rename="marginTop")] - pub margin_top: Option, - /// The page number from which to start counting the number of pages. - #[serde(rename="pageNumberStart")] - pub page_number_start: Option, - /// The size of a page in the document. - #[serde(rename="pageSize")] - pub page_size: Option, - /// Indicates whether DocumentStyle margin_header, SectionStyle margin_header and DocumentStyle margin_footer, SectionStyle margin_footer are respected. When false, the default values in the Docs editor for header and footer margin are used. This property is read-only. - #[serde(rename="useCustomHeaderFooterMargins")] - pub use_custom_header_footer_margins: Option, - /// Indicates whether to use the even page header / footer IDs for the even pages. - #[serde(rename="useEvenPageHeaderFooter")] - pub use_even_page_header_footer: Option, - /// Indicates whether to use the first page header / footer IDs for the first page. - #[serde(rename="useFirstPageHeaderFooter")] - pub use_first_page_header_footer: Option, -} - -impl client::Part for DocumentStyle {} - - -/// A mask that indicates which of the fields on the base DocumentStyle have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct DocumentStyleSuggestionState { - /// A mask that indicates which of the fields in background have been changed in this suggestion. - #[serde(rename="backgroundSuggestionState")] - pub background_suggestion_state: Option, - /// Indicates if there was a suggested change to default_footer_id. - #[serde(rename="defaultFooterIdSuggested")] - pub default_footer_id_suggested: Option, - /// Indicates if there was a suggested change to default_header_id. - #[serde(rename="defaultHeaderIdSuggested")] - pub default_header_id_suggested: Option, - /// Indicates if there was a suggested change to even_page_footer_id. - #[serde(rename="evenPageFooterIdSuggested")] - pub even_page_footer_id_suggested: Option, - /// Indicates if there was a suggested change to even_page_header_id. - #[serde(rename="evenPageHeaderIdSuggested")] - pub even_page_header_id_suggested: Option, - /// Indicates if there was a suggested change to first_page_footer_id. - #[serde(rename="firstPageFooterIdSuggested")] - pub first_page_footer_id_suggested: Option, - /// Indicates if there was a suggested change to first_page_header_id. - #[serde(rename="firstPageHeaderIdSuggested")] - pub first_page_header_id_suggested: Option, - /// Indicates if there was a suggested change to margin_bottom. - #[serde(rename="marginBottomSuggested")] - pub margin_bottom_suggested: Option, - /// Indicates if there was a suggested change to margin_footer. - #[serde(rename="marginFooterSuggested")] - pub margin_footer_suggested: Option, - /// Indicates if there was a suggested change to margin_header. - #[serde(rename="marginHeaderSuggested")] - pub margin_header_suggested: Option, - /// Indicates if there was a suggested change to margin_left. - #[serde(rename="marginLeftSuggested")] - pub margin_left_suggested: Option, - /// Indicates if there was a suggested change to margin_right. - #[serde(rename="marginRightSuggested")] - pub margin_right_suggested: Option, - /// Indicates if there was a suggested change to margin_top. - #[serde(rename="marginTopSuggested")] - pub margin_top_suggested: Option, - /// Indicates if there was a suggested change to page_number_start. - #[serde(rename="pageNumberStartSuggested")] - pub page_number_start_suggested: Option, - /// A mask that indicates which of the fields in size have been changed in this suggestion. - #[serde(rename="pageSizeSuggestionState")] - pub page_size_suggestion_state: Option, - /// Indicates if there was a suggested change to use_custom_header_footer_margins. - #[serde(rename="useCustomHeaderFooterMarginsSuggested")] - pub use_custom_header_footer_margins_suggested: Option, - /// Indicates if there was a suggested change to use_even_page_header_footer. - #[serde(rename="useEvenPageHeaderFooterSuggested")] - pub use_even_page_header_footer_suggested: Option, - /// Indicates if there was a suggested change to use_first_page_header_footer. - #[serde(rename="useFirstPageHeaderFooterSuggested")] - pub use_first_page_header_footer_suggested: Option, -} - -impl client::Part for DocumentStyleSuggestionState {} - - -/// The properties of an embedded drawing. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EmbeddedDrawingProperties { _never_set: Option } - -impl client::Part for EmbeddedDrawingProperties {} - - -/// A mask that indicates which of the fields on the base EmbeddedDrawingProperties have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EmbeddedDrawingPropertiesSuggestionState { _never_set: Option } - -impl client::Part for EmbeddedDrawingPropertiesSuggestionState {} - - -/// An embedded object in the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EmbeddedObject { - /// The description of the embedded object. The `title` and `description` are both combined to display alt text. +pub struct DnsKey { + /// String mnemonic specifying the DNSSEC algorithm of this key. Immutable after creation time. + pub algorithm: Option, + /// The time that this resource was created in the control plane. This is in RFC3339 text format. Output only. + #[serde(rename="creationTime")] + pub creation_time: Option, + /// A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the resource's function. pub description: Option, - /// The properties of an embedded drawing. - #[serde(rename="embeddedDrawingProperties")] - pub embedded_drawing_properties: Option, - /// The border of the embedded object. - #[serde(rename="embeddedObjectBorder")] - pub embedded_object_border: Option, - /// The properties of an image. - #[serde(rename="imageProperties")] - pub image_properties: Option, - /// A reference to the external linked source content. For example, it contains a reference to the source Sheets chart when the embedded object is a linked chart. If unset, then the embedded object is not linked. - #[serde(rename="linkedContentReference")] - pub linked_content_reference: Option, - /// The bottom margin of the embedded object. - #[serde(rename="marginBottom")] - pub margin_bottom: Option, - /// The left margin of the embedded object. - #[serde(rename="marginLeft")] - pub margin_left: Option, - /// The right margin of the embedded object. - #[serde(rename="marginRight")] - pub margin_right: Option, - /// The top margin of the embedded object. - #[serde(rename="marginTop")] - pub margin_top: Option, - /// The visible size of the image after cropping. - pub size: Option, - /// The title of the embedded object. The `title` and `description` are both combined to display alt text. - pub title: Option, + /// Cryptographic hashes of the DNSKEY resource record associated with this DnsKey. These digests are needed to construct a DS record that points at this DNS key. Output only. + pub digests: Option>, + /// Unique identifier for the resource; defined by the server (output only). + pub id: Option, + /// Active keys are used to sign subsequent changes to the ManagedZone. Inactive keys are still present as DNSKEY Resource Records for the use of resolvers validating existing signatures. + #[serde(rename="isActive")] + pub is_active: Option, + /// Length of the key in bits. Specified at creation time, and then immutable. + #[serde(rename="keyLength")] + pub key_length: Option, + /// The key tag is a non-cryptographic hash of the a DNSKEY resource record associated with this DnsKey. The key tag can be used to identify a DNSKEY more quickly (but it is not a unique identifier). In particular, the key tag is used in a parent zone's DS record to point at the DNSKEY in this child ManagedZone. The key tag is a number in the range [0, 65535] and the algorithm to calculate it is specified in RFC4034 Appendix B. Output only. + #[serde(rename="keyTag")] + pub key_tag: Option, + /// no description provided + pub kind: Option, + /// Base64 encoded public half of this key. Output only. + #[serde(rename="publicKey")] + pub public_key: Option, + /// One of "KEY_SIGNING" or "ZONE_SIGNING". Keys of type KEY_SIGNING have the Secure Entry Point flag set and, when active, are used to sign only resource record sets of type DNSKEY. Otherwise, the Secure Entry Point flag is cleared, and this key is used to sign only resource record sets of other types. Immutable after creation time. + #[serde(rename="type")] + pub type_: Option, } -impl client::Part for EmbeddedObject {} +impl client::Resource for DnsKey {} +impl client::ResponseResult for DnsKey {} -/// A border around an EmbeddedObject. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EmbeddedObjectBorder { - /// The color of the border. - pub color: Option, - /// The dash style of the border. - #[serde(rename="dashStyle")] - pub dash_style: Option, - /// The property state of the border property. - #[serde(rename="propertyState")] - pub property_state: Option, - /// The width of the border. - pub width: Option, +pub struct DnsKeyDigest { + /// The base-16 encoded bytes of this digest. Suitable for use in a DS resource record. + pub digest: Option, + /// Specifies the algorithm used to calculate this digest. + #[serde(rename="type")] + pub type_: Option, } -impl client::Part for EmbeddedObjectBorder {} +impl client::Part for DnsKeyDigest {} -/// A mask that indicates which of the fields on the base EmbeddedObjectBorder have been changed in this suggestion. For any field set to true, there is a new suggested value. +/// Parameters for DnsKey key generation. Used for generating initial keys for a new ManagedZone and as default when adding a new DnsKey. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EmbeddedObjectBorderSuggestionState { - /// Indicates if there was a suggested change to color. - #[serde(rename="colorSuggested")] - pub color_suggested: Option, - /// Indicates if there was a suggested change to dash_style. - #[serde(rename="dashStyleSuggested")] - pub dash_style_suggested: Option, - /// Indicates if there was a suggested change to property_state. - #[serde(rename="propertyStateSuggested")] - pub property_state_suggested: Option, - /// Indicates if there was a suggested change to width. - #[serde(rename="widthSuggested")] - pub width_suggested: Option, +pub struct DnsKeySpec { + /// String mnemonic specifying the DNSSEC algorithm of this key. + pub algorithm: Option, + /// Length of the keys in bits. + #[serde(rename="keyLength")] + pub key_length: Option, + /// Specifies whether this is a key signing key (KSK) or a zone signing key (ZSK). Key signing keys have the Secure Entry Point flag set and, when active, are only used to sign resource record sets of type DNSKEY. Zone signing keys do not have the Secure Entry Point flag set and are used to sign all other types of resource record sets. + #[serde(rename="keyType")] + pub key_type: Option, + /// no description provided + pub kind: Option, } -impl client::Part for EmbeddedObjectBorderSuggestionState {} +impl client::Part for DnsKeySpec {} -/// A mask that indicates which of the fields on the base EmbeddedObject have been changed in this suggestion. For any field set to true, there is a new suggested value. +/// The response to a request to enumerate DnsKeys in a ManagedZone. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # 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*). +/// +/// * [list dns keys](DnsKeyListCall) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EmbeddedObjectSuggestionState { - /// Indicates if there was a suggested change to description. - #[serde(rename="descriptionSuggested")] - pub description_suggested: Option, - /// A mask that indicates which of the fields in embedded_drawing_properties have been changed in this suggestion. - #[serde(rename="embeddedDrawingPropertiesSuggestionState")] - pub embedded_drawing_properties_suggestion_state: Option, - /// A mask that indicates which of the fields in embedded_object_border have been changed in this suggestion. - #[serde(rename="embeddedObjectBorderSuggestionState")] - pub embedded_object_border_suggestion_state: Option, - /// A mask that indicates which of the fields in image_properties have been changed in this suggestion. - #[serde(rename="imagePropertiesSuggestionState")] - pub image_properties_suggestion_state: Option, - /// A mask that indicates which of the fields in linked_content_reference have been changed in this suggestion. - #[serde(rename="linkedContentReferenceSuggestionState")] - pub linked_content_reference_suggestion_state: Option, - /// Indicates if there was a suggested change to margin_bottom. - #[serde(rename="marginBottomSuggested")] - pub margin_bottom_suggested: Option, - /// Indicates if there was a suggested change to margin_left. - #[serde(rename="marginLeftSuggested")] - pub margin_left_suggested: Option, - /// Indicates if there was a suggested change to margin_right. - #[serde(rename="marginRightSuggested")] - pub margin_right_suggested: Option, - /// Indicates if there was a suggested change to margin_top. - #[serde(rename="marginTopSuggested")] - pub margin_top_suggested: Option, - /// A mask that indicates which of the fields in size have been changed in this suggestion. - #[serde(rename="sizeSuggestionState")] - pub size_suggestion_state: Option, - /// Indicates if there was a suggested change to title. - #[serde(rename="titleSuggested")] - pub title_suggested: Option, +pub struct DnsKeysListResponse { + /// The requested resources. + #[serde(rename="dnsKeys")] + pub dns_keys: Option>, + /// no description provided + pub header: Option, + /// Type of resource. + pub kind: Option, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. In this way you can retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned are an inconsistent view of the collection. There is no way to retrieve a "snapshot" of collections larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, } -impl client::Part for EmbeddedObjectSuggestionState {} +impl client::ResponseResult for DnsKeysListResponse {} -/// Location at the end of a body, header, footer or footnote. The location is immediately before the last newline in the document segment. +/// A zone is a subtree of the DNS namespace under one administrative responsibility. A ManagedZone is a resource that represents a DNS zone hosted by the Cloud DNS service. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # 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*). +/// +/// * [create managed zones](ManagedZoneCreateCall) (request|response) +/// * [delete managed zones](ManagedZoneDeleteCall) (none) +/// * [get managed zones](ManagedZoneGetCall) (response) +/// * [list managed zones](ManagedZoneListCall) (none) +/// * [patch managed zones](ManagedZonePatchCall) (request) +/// * [update managed zones](ManagedZoneUpdateCall) (request) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct EndOfSegmentLocation { - /// The ID of the header, footer or footnote the location is in. An empty segment ID signifies the document's body. - #[serde(rename="segmentId")] - pub segment_id: Option, -} - -impl client::Part for EndOfSegmentLocation {} - - -/// A ParagraphElement representing an equation. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Equation { - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A Equation may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, -} - -impl client::Part for Equation {} - - -/// A document footer. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Footer { - /// The contents of the footer. The indexes for a footer's content begin at zero. - pub content: Option>, - /// The ID of the footer. - #[serde(rename="footerId")] - pub footer_id: Option, -} - -impl client::Part for Footer {} - - -/// A document footnote. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Footnote { - /// The contents of the footnote. The indexes for a footnote's content begin at zero. - pub content: Option>, - /// The ID of the footnote. - #[serde(rename="footnoteId")] - pub footnote_id: Option, -} - -impl client::Part for Footnote {} - - -/// A ParagraphElement representing a footnote reference. A footnote reference is the inline content rendered with a number and is used to identify the footnote. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct FootnoteReference { - /// The ID of the footnote that contains the content of this footnote reference. - #[serde(rename="footnoteId")] - pub footnote_id: Option, - /// The rendered number of this footnote. - #[serde(rename="footnoteNumber")] - pub footnote_number: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A FootnoteReference may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this FootnoteReference, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this FootnoteReference. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for FootnoteReference {} - - -/// A document header. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Header { - /// The contents of the header. The indexes for a header's content begin at zero. - pub content: Option>, - /// The ID of the header. - #[serde(rename="headerId")] - pub header_id: Option, -} - -impl client::Part for Header {} - - -/// A ParagraphElement representing a horizontal line. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct HorizontalRule { - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A HorizontalRule may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this HorizontalRule, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this HorizontalRule. Similar to text content, like text runs and footnote references, the text style of a horizontal rule can affect content layout as well as the styling of text inserted adjacent to it. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for HorizontalRule {} - - -/// The properties of an image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImageProperties { - /// The clockwise rotation angle of the image, in radians. - pub angle: Option, - /// The brightness effect of the image. The value should be in the interval [-1.0, 1.0], where 0 means no effect. - pub brightness: Option, - /// A URI to the image with a default lifetime of 30 minutes. This URI is tagged with the account of the requester. Anyone with the URI effectively accesses the image as the original requester. Access to the image may be lost if the document's sharing settings change. - #[serde(rename="contentUri")] - pub content_uri: Option, - /// The contrast effect of the image. The value should be in the interval [-1.0, 1.0], where 0 means no effect. - pub contrast: Option, - /// The crop properties of the image. - #[serde(rename="cropProperties")] - pub crop_properties: Option, - /// The source URI is the URI used to insert the image. The source URI can be empty. - #[serde(rename="sourceUri")] - pub source_uri: Option, - /// The transparency effect of the image. The value should be in the interval [0.0, 1.0], where 0 means no effect and 1 means completely transparent. - pub transparency: Option, -} - -impl client::Part for ImageProperties {} - - -/// A mask that indicates which of the fields on the base ImageProperties have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ImagePropertiesSuggestionState { - /// Indicates if there was a suggested change to angle. - #[serde(rename="angleSuggested")] - pub angle_suggested: Option, - /// Indicates if there was a suggested change to brightness. - #[serde(rename="brightnessSuggested")] - pub brightness_suggested: Option, - /// Indicates if there was a suggested change to content_uri. - #[serde(rename="contentUriSuggested")] - pub content_uri_suggested: Option, - /// Indicates if there was a suggested change to contrast. - #[serde(rename="contrastSuggested")] - pub contrast_suggested: Option, - /// A mask that indicates which of the fields in crop_properties have been changed in this suggestion. - #[serde(rename="cropPropertiesSuggestionState")] - pub crop_properties_suggestion_state: Option, - /// Indicates if there was a suggested change to source_uri. - #[serde(rename="sourceUriSuggested")] - pub source_uri_suggested: Option, - /// Indicates if there was a suggested change to transparency. - #[serde(rename="transparencySuggested")] - pub transparency_suggested: Option, -} - -impl client::Part for ImagePropertiesSuggestionState {} - - -/// An object that appears inline with text. An InlineObject contains an EmbeddedObject such as an image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InlineObject { - /// The properties of this inline object. - #[serde(rename="inlineObjectProperties")] - pub inline_object_properties: Option, - /// The ID of this inline object. - #[serde(rename="objectId")] - pub object_id: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested changes to the inline object properties, keyed by suggestion ID. - #[serde(rename="suggestedInlineObjectPropertiesChanges")] - pub suggested_inline_object_properties_changes: Option>, - /// The suggested insertion ID. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionId")] - pub suggested_insertion_id: Option, -} - -impl client::Part for InlineObject {} - - -/// A ParagraphElement that contains an InlineObject. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InlineObjectElement { - /// The ID of the InlineObject this element contains. - #[serde(rename="inlineObjectId")] - pub inline_object_id: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. An InlineObjectElement may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this InlineObject, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this InlineObjectElement. Similar to text content, like text runs and footnote references, the text style of an inline object element can affect content layout as well as the styling of text inserted adjacent to it. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for InlineObjectElement {} - - -/// Properties of an InlineObject. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InlineObjectProperties { - /// The embedded object of this inline object. - #[serde(rename="embeddedObject")] - pub embedded_object: Option, -} - -impl client::Part for InlineObjectProperties {} - - -/// A mask that indicates which of the fields on the base InlineObjectProperties have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InlineObjectPropertiesSuggestionState { - /// A mask that indicates which of the fields in embedded_object have been changed in this suggestion. - #[serde(rename="embeddedObjectSuggestionState")] - pub embedded_object_suggestion_state: Option, -} - -impl client::Part for InlineObjectPropertiesSuggestionState {} - - -/// Inserts an InlineObject containing an image at the given location. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertInlineImageRequest { - /// Inserts the text at the end of a header, footer or the document body. Inline images cannot be inserted inside a footnote. - #[serde(rename="endOfSegmentLocation")] - pub end_of_segment_location: Option, - /// Inserts the image at a specific index in the document. The image must be inserted inside the bounds of an existing Paragraph. For instance, it cannot be inserted at a table's start index (i.e. between the table and its preceding paragraph). Inline images cannot be inserted inside a footnote or equation. - pub location: Option, - /// The size that the image should appear as in the document. This property is optional and the final size of the image in the document is determined by the following rules: * If neither width nor height is specified, then a default size of the image is calculated based on its resolution. * If one dimension is specified then the other dimension is calculated to preserve the aspect ratio of the image. * If both width and height are specified, the image is scaled to fit within the provided dimensions while maintaining its aspect ratio. - #[serde(rename="objectSize")] - pub object_size: Option, - /// The image URI. The image is fetched once at insertion time and a copy is stored for display inside the document. Images must be less than 50MB in size, cannot exceed 25 megapixels, and must be in one of PNG, JPEG, or GIF format. The provided URI can be at most 2 kB in length. The URI itself is saved with the image, and exposed via the ImageProperties.content_uri field. - pub uri: Option, -} - -impl client::Part for InsertInlineImageRequest {} - - -/// The result of inserting an inline image. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertInlineImageResponse { - /// The ID of the created InlineObject. - #[serde(rename="objectId")] - pub object_id: Option, -} - -impl client::Part for InsertInlineImageResponse {} - - -/// The result of inserting an embedded Google Sheets chart. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertInlineSheetsChartResponse { - /// The object ID of the inserted chart. - #[serde(rename="objectId")] - pub object_id: Option, -} - -impl client::Part for InsertInlineSheetsChartResponse {} - - -/// Inserts a page break followed by a newline at the specified location. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertPageBreakRequest { - /// Inserts the page break at the end of the document body. Page breaks cannot be inserted inside a footnote, header or footer. Since page breaks can only be inserted inside the body, the segment ID field must be empty. - #[serde(rename="endOfSegmentLocation")] - pub end_of_segment_location: Option, - /// Inserts the page break at a specific index in the document. The page break must be inserted inside the bounds of an existing Paragraph. For instance, it cannot be inserted at a table's start index (i.e. between the table and its preceding paragraph). Page breaks cannot be inserted inside a table, equation, footnote, header or footer. Since page breaks can only be inserted inside the body, the segment ID field must be empty. - pub location: Option, -} - -impl client::Part for InsertPageBreakRequest {} - - -/// Inserts a section break at the given location. A newline character will be inserted before the section break. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertSectionBreakRequest { - /// Inserts a newline and a section break at the end of the document body. Section breaks cannot be inserted inside a footnote, header or footer. Because section breaks can only be inserted inside the body, the segment ID field must be empty. - #[serde(rename="endOfSegmentLocation")] - pub end_of_segment_location: Option, - /// Inserts a newline and a section break at a specific index in the document. The section break must be inserted inside the bounds of an existing Paragraph. For instance, it cannot be inserted at a table's start index (i.e. between the table and its preceding paragraph). Section breaks cannot be inserted inside a table, equation, footnote, header, or footer. Since section breaks can only be inserted inside the body, the segment ID field must be empty. - pub location: Option, - /// The type of section to insert. - #[serde(rename="sectionType")] - pub section_type: Option, -} - -impl client::Part for InsertSectionBreakRequest {} - - -/// Inserts an empty column into a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertTableColumnRequest { - /// Whether to insert new column to the right of the reference cell location. - `True`: insert to the right. - `False`: insert to the left. - #[serde(rename="insertRight")] - pub insert_right: Option, - /// The reference table cell location from which columns will be inserted. A new column will be inserted to the left (or right) of the column where the reference cell is. If the reference cell is a merged cell, a new column will be inserted to the left (or right) of the merged cell. - #[serde(rename="tableCellLocation")] - pub table_cell_location: Option, -} - -impl client::Part for InsertTableColumnRequest {} - - -/// Inserts a table at the specified location. A newline character will be inserted before the inserted table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertTableRequest { - /// The number of columns in the table. - pub columns: Option, - /// Inserts the table at the end of the given header, footer or document body. A newline character will be inserted before the inserted table. Tables cannot be inserted inside a footnote. - #[serde(rename="endOfSegmentLocation")] - pub end_of_segment_location: Option, - /// Inserts the table at a specific model index. A newline character will be inserted before the inserted table, therefore the table start index will be at the specified location index + 1. The table must be inserted inside the bounds of an existing Paragraph. For instance, it cannot be inserted at a table's start index (i.e. between an existing table and its preceding paragraph). Tables cannot be inserted inside a footnote or equation. - pub location: Option, - /// The number of rows in the table. - pub rows: Option, -} - -impl client::Part for InsertTableRequest {} - - -/// Inserts an empty row into a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertTableRowRequest { - /// Whether to insert new row below the reference cell location. - `True`: insert below the cell. - `False`: insert above the cell. - #[serde(rename="insertBelow")] - pub insert_below: Option, - /// The reference table cell location from which rows will be inserted. A new row will be inserted above (or below) the row where the reference cell is. If the reference cell is a merged cell, a new row will be inserted above (or below) the merged cell. - #[serde(rename="tableCellLocation")] - pub table_cell_location: Option, -} - -impl client::Part for InsertTableRowRequest {} - - -/// Inserts text at the specified location. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct InsertTextRequest { - /// Inserts the text at the end of a header, footer, footnote or the document body. - #[serde(rename="endOfSegmentLocation")] - pub end_of_segment_location: Option, - /// Inserts the text at a specific index in the document. Text must be inserted inside the bounds of an existing Paragraph. For instance, text cannot be inserted at a table's start index (i.e. between the table and its preceding paragraph). The text must be inserted in the preceding paragraph. - pub location: Option, - /// The text to be inserted. Inserting a newline character will implicitly create a new Paragraph at that index. The paragraph style of the new paragraph will be copied from the paragraph at the current insertion index, including lists and bullets. Text styles for inserted text will be determined automatically, generally preserving the styling of neighboring text. In most cases, the text style for the inserted text will match the text immediately before the insertion index. Some control characters (U+0000-U+0008, U+000C-U+001F) and characters from the Unicode Basic Multilingual Plane Private Use Area (U+E000-U+F8FF) will be stripped out of the inserted text. - pub text: Option, -} - -impl client::Part for InsertTextRequest {} - - -/// A reference to another portion of a document or an external URL resource. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Link { - /// The ID of a bookmark in this document. - #[serde(rename="bookmarkId")] - pub bookmark_id: Option, - /// The ID of a heading in this document. - #[serde(rename="headingId")] - pub heading_id: Option, - /// An external URL. - pub url: Option, -} - -impl client::Part for Link {} - - -/// A reference to the external linked source content. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LinkedContentReference { - /// A reference to the linked chart. - #[serde(rename="sheetsChartReference")] - pub sheets_chart_reference: Option, -} - -impl client::Part for LinkedContentReference {} - - -/// A mask that indicates which of the fields on the base LinkedContentReference have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct LinkedContentReferenceSuggestionState { - /// A mask that indicates which of the fields in sheets_chart_reference have been changed in this suggestion. - #[serde(rename="sheetsChartReferenceSuggestionState")] - pub sheets_chart_reference_suggestion_state: Option, -} - -impl client::Part for LinkedContentReferenceSuggestionState {} - - -/// A List represents the list attributes for a group of paragraphs that all belong to the same list. A paragraph that is part of a list has a reference to the list's ID in its bullet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct List { - /// The properties of the list. - #[serde(rename="listProperties")] - pub list_properties: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this list. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion ID. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionId")] - pub suggested_insertion_id: Option, - /// The suggested changes to the list properties, keyed by suggestion ID. - #[serde(rename="suggestedListPropertiesChanges")] - pub suggested_list_properties_changes: Option>, -} - -impl client::Part for List {} - - -/// The properties of a list which describe the look and feel of bullets belonging to paragraphs associated with a list. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListProperties { - /// Describes the properties of the bullets at the associated level. A list has at most nine levels of nesting with nesting level 0 corresponding to the top-most level and nesting level 8 corresponding to the most nested level. The nesting levels are returned in ascending order with the least nested returned first. - #[serde(rename="nestingLevels")] - pub nesting_levels: Option>, -} - -impl client::Part for ListProperties {} - - -/// A mask that indicates which of the fields on the base ListProperties have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ListPropertiesSuggestionState { - /// A mask that indicates which of the fields on the corresponding NestingLevel in nesting_levels have been changed in this suggestion. The nesting level suggestion states are returned in ascending order of the nesting level with the least nested returned first. - #[serde(rename="nestingLevelsSuggestionStates")] - pub nesting_levels_suggestion_states: Option>, -} - -impl client::Part for ListPropertiesSuggestionState {} - - -/// A particular location in the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Location { - /// The zero-based index, in UTF-16 code units. The index is relative to the beginning of the segment specified by segment_id. - pub index: Option, - /// The ID of the header, footer or footnote the location is in. An empty segment ID signifies the document's body. - #[serde(rename="segmentId")] - pub segment_id: Option, -} - -impl client::Part for Location {} - - -/// Merges cells in a Table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct MergeTableCellsRequest { - /// The table range specifying which cells of the table to merge. Any text in the cells being merged will be concatenated and stored in the "head" cell of the range. This is the upper-left cell of the range when the content direction is left to right, and the upper-right cell of the range otherwise. If the range is non-rectangular (which can occur in some cases where the range covers cells that are already merged or where the table is non-rectangular), a 400 bad request error is returned. - #[serde(rename="tableRange")] - pub table_range: Option, -} - -impl client::Part for MergeTableCellsRequest {} - - -/// A collection of Ranges with the same named range ID. Named ranges allow developers to associate parts of a document with an arbitrary user-defined label so their contents can be programmatically read or edited at a later time. A document can contain multiple named ranges with the same name, but every named range has a unique ID. A named range is created with a single Range, and content inserted inside a named range generally expands that range. However, certain document changes can cause the range to be split into multiple ranges. Named ranges are not private. All applications and collaborators that have access to the document can see its named ranges. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NamedRange { - /// The name of the named range. +pub struct ManagedZone { + /// no description provided + #[serde(rename="cloudLoggingConfig")] + pub cloud_logging_config: Option, + /// The time that this resource was created on the server. This is in RFC3339 text format. Output only. + #[serde(rename="creationTime")] + pub creation_time: Option, + /// A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the managed zone's function. + pub description: Option, + /// The DNS name of this managed zone, for instance "example.com.". + #[serde(rename="dnsName")] + pub dns_name: Option, + /// DNSSEC configuration. + #[serde(rename="dnssecConfig")] + pub dnssec_config: Option, + /// The presence for this field indicates that outbound forwarding is enabled for this zone. The value of this field contains the set of destinations to forward to. + #[serde(rename="forwardingConfig")] + pub forwarding_config: Option, + /// Unique identifier for the resource; defined by the server (output only) + pub id: Option, + /// no description provided + pub kind: Option, + /// User labels. + pub labels: Option>, + /// User assigned name for this resource. Must be unique within the project. The name must be 1-63 characters long, must begin with a letter, end with a letter or digit, and only contain lowercase letters, digits or dashes. pub name: Option, - /// The ID of the named range. - #[serde(rename="namedRangeId")] - pub named_range_id: Option, - /// The ranges that belong to this named range. - pub ranges: Option>, + /// Optionally specifies the NameServerSet for this ManagedZone. A NameServerSet is a set of DNS name servers that all host the same ManagedZones. Most users leave this field unset. If you need to use this field, contact your account team. + #[serde(rename="nameServerSet")] + pub name_server_set: Option, + /// Delegate your managed_zone to these virtual name servers; defined by the server (output only) + #[serde(rename="nameServers")] + pub name_servers: Option>, + /// The presence of this field indicates that DNS Peering is enabled for this zone. The value of this field contains the network to peer with. + #[serde(rename="peeringConfig")] + pub peering_config: Option, + /// For privately visible zones, the set of Virtual Private Cloud resources that the zone is visible from. + #[serde(rename="privateVisibilityConfig")] + pub private_visibility_config: Option, + /// The presence of this field indicates that this is a managed reverse lookup zone and Cloud DNS resolves reverse lookup queries using automatically configured records for VPC resources. This only applies to networks listed under private_visibility_config. + #[serde(rename="reverseLookupConfig")] + pub reverse_lookup_config: Option, + /// This field links to the associated service directory namespace. Do not set this field for public zones or forwarding zones. + #[serde(rename="serviceDirectoryConfig")] + pub service_directory_config: Option, + /// The zone's visibility: public zones are exposed to the Internet, while private zones are visible only to Virtual Private Cloud resources. + pub visibility: Option, } -impl client::Part for NamedRange {} +impl client::RequestValue for ManagedZone {} +impl client::Resource for ManagedZone {} +impl client::ResponseResult for ManagedZone {} -/// A collection of all the NamedRanges in the document that share a given name. +/// Cloud Logging configurations for publicly visible zones. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NamedRanges { - /// The name that all the named ranges share. +pub struct ManagedZoneCloudLoggingConfig { + /// If set, enable query logging for this ManagedZone. False by default, making logging opt-in. + #[serde(rename="enableLogging")] + pub enable_logging: Option, + /// no description provided + pub kind: Option, +} + +impl client::Part for ManagedZoneCloudLoggingConfig {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZoneDnsSecConfig { + /// Specifies parameters for generating initial DnsKeys for this ManagedZone. Can only be changed while the state is OFF. + #[serde(rename="defaultKeySpecs")] + pub default_key_specs: Option>, + /// no description provided + pub kind: Option, + /// Specifies the mechanism for authenticated denial-of-existence responses. Can only be changed while the state is OFF. + #[serde(rename="nonExistence")] + pub non_existence: Option, + /// Specifies whether DNSSEC is enabled, and what mode it is in. + pub state: Option, +} + +impl client::Part for ManagedZoneDnsSecConfig {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZoneForwardingConfig { + /// no description provided + pub kind: Option, + /// List of target name servers to forward to. Cloud DNS selects the best available name server if more than one target is given. + #[serde(rename="targetNameServers")] + pub target_name_servers: Option>, +} + +impl client::Part for ManagedZoneForwardingConfig {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZoneForwardingConfigNameServerTarget { + /// Forwarding path for this NameServerTarget. If unset or set to DEFAULT, Cloud DNS makes forwarding decisions based on IP address ranges; that is, RFC1918 addresses go to the VPC network, non-RFC1918 addresses go to the internet. When set to PRIVATE, Cloud DNS always sends queries through the VPC network for this target. + #[serde(rename="forwardingPath")] + pub forwarding_path: Option, + /// IPv4 address of a target name server. + #[serde(rename="ipv4Address")] + pub ipv4_address: Option, + /// no description provided + pub kind: Option, +} + +impl client::Part for ManagedZoneForwardingConfigNameServerTarget {} + + +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [list managed zone operations](ManagedZoneOperationListCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZoneOperationsListResponse { + /// no description provided + pub header: Option, + /// no description provided + pub kind: Option, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. This lets you retrieve the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned are an inconsistent view of the collection. You cannot retrieve a consistent snapshot of a collection larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The operation resources. + pub operations: Option>, +} + +impl client::ResponseResult for ManagedZoneOperationsListResponse {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonePeeringConfig { + /// no description provided + pub kind: Option, + /// The network with which to peer. + #[serde(rename="targetNetwork")] + pub target_network: Option, +} + +impl client::Part for ManagedZonePeeringConfig {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonePeeringConfigTargetNetwork { + /// The time at which the zone was deactivated, in RFC 3339 date-time format. An empty string indicates that the peering connection is active. The producer network can deactivate a zone. The zone is automatically deactivated if the producer network that the zone targeted is deleted. Output only. + #[serde(rename="deactivateTime")] + pub deactivate_time: Option, + /// no description provided + pub kind: Option, + /// The fully qualified URL of the VPC network to forward queries to. This should be formatted like https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network} + #[serde(rename="networkUrl")] + pub network_url: Option, +} + +impl client::Part for ManagedZonePeeringConfigTargetNetwork {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonePrivateVisibilityConfig { + /// The list of Google Kubernetes Engine clusters that can see this zone. + #[serde(rename="gkeClusters")] + pub gke_clusters: Option>, + /// no description provided + pub kind: Option, + /// The list of VPC networks that can see this zone. + pub networks: Option>, +} + +impl client::Part for ManagedZonePrivateVisibilityConfig {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonePrivateVisibilityConfigGKECluster { + /// The resource name of the cluster to bind this ManagedZone to. This should be specified in the format like: projects/*/locations/*/clusters/*. This is referenced from GKE projects.locations.clusters.get API: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/get + #[serde(rename="gkeClusterName")] + pub gke_cluster_name: Option, + /// no description provided + pub kind: Option, +} + +impl client::Part for ManagedZonePrivateVisibilityConfigGKECluster {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonePrivateVisibilityConfigNetwork { + /// no description provided + pub kind: Option, + /// The fully qualified URL of the VPC network to bind to. Format this URL like https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network} + #[serde(rename="networkUrl")] + pub network_url: Option, +} + +impl client::Part for ManagedZonePrivateVisibilityConfigNetwork {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZoneReverseLookupConfig { + /// no description provided + pub kind: Option, +} + +impl client::Part for ManagedZoneReverseLookupConfig {} + + +/// Contains information about Service Directory-backed zones. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZoneServiceDirectoryConfig { + /// no description provided + pub kind: Option, + /// Contains information about the namespace associated with the zone. + pub namespace: Option, +} + +impl client::Part for ManagedZoneServiceDirectoryConfig {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZoneServiceDirectoryConfigNamespace { + /// The time that the namespace backing this zone was deleted; an empty string if it still exists. This is in RFC3339 text format. Output only. + #[serde(rename="deletionTime")] + pub deletion_time: Option, + /// no description provided + pub kind: Option, + /// The fully qualified URL of the namespace associated with the zone. Format must be https://servicedirectory.googleapis.com/v1/projects/{project}/locations/{location}/namespaces/{namespace} + #[serde(rename="namespaceUrl")] + pub namespace_url: Option, +} + +impl client::Part for ManagedZoneServiceDirectoryConfigNamespace {} + + +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [list managed zones](ManagedZoneListCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ManagedZonesListResponse { + /// no description provided + pub header: Option, + /// Type of resource. + pub kind: Option, + /// The managed zone resources. + #[serde(rename="managedZones")] + pub managed_zones: Option>, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. This lets you the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned are an inconsistent view of the collection. You cannot retrieve a consistent snapshot of a collection larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, +} + +impl client::ResponseResult for ManagedZonesListResponse {} + + +/// An operation represents a successful mutation performed on a Cloud DNS resource. Operations provide: - An audit log of server resource mutations. - A way to recover/retry API calls in the case where the response is never received by the caller. Use the caller specified client_operation_id. +/// +/// # 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*). +/// +/// * [get managed zone operations](ManagedZoneOperationGetCall) (response) +/// * [patch managed zones](ManagedZonePatchCall) (response) +/// * [update managed zones](ManagedZoneUpdateCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Operation { + /// Only populated if the operation targeted a DnsKey (output only). + #[serde(rename="dnsKeyContext")] + pub dns_key_context: Option, + /// Unique identifier for the resource. This is the client_operation_id if the client specified it when the mutation was initiated, otherwise, it is generated by the server. The name must be 1-63 characters long and match the regular expression [-a-z0-9]? (output only) + pub id: Option, + /// no description provided + pub kind: Option, + /// The time that this operation was started by the server. This is in RFC3339 text format (output only). + #[serde(rename="startTime")] + pub start_time: Option, + /// Status of the operation. Can be one of the following: "PENDING" or "DONE" (output only). A status of "DONE" means that the request to update the authoritative servers has been sent, but the servers might not be updated yet. + pub status: Option, + /// Type of the operation. Operations include insert, update, and delete (output only). + #[serde(rename="type")] + pub type_: Option, + /// User who requested the operation, for example: user@example.com. cloud-dns-system for operations automatically done by the system. (output only) + pub user: Option, + /// Only populated if the operation targeted a ManagedZone (output only). + #[serde(rename="zoneContext")] + pub zone_context: Option, +} + +impl client::ResponseResult for Operation {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationDnsKeyContext { + /// The post-operation DnsKey resource. + #[serde(rename="newValue")] + pub new_value: Option, + /// The pre-operation DnsKey resource. + #[serde(rename="oldValue")] + pub old_value: Option, +} + +impl client::Part for OperationDnsKeyContext {} + + +/// There is no detailed description. +/// +/// This type is not used in any activity, and only used as *part* of another schema. +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct OperationManagedZoneContext { + /// The post-operation ManagedZone resource. + #[serde(rename="newValue")] + pub new_value: Option, + /// The pre-operation ManagedZone resource. + #[serde(rename="oldValue")] + pub old_value: Option, +} + +impl client::Part for OperationManagedZoneContext {} + + +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [list policies](PolicyListCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PoliciesListResponse { + /// no description provided + pub header: Option, + /// Type of resource. + pub kind: Option, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. This lets you the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned are an inconsistent view of the collection. You cannot retrieve a consistent snapshot of a collection larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The policy resources. + pub policies: Option>, +} + +impl client::ResponseResult for PoliciesListResponse {} + + +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [patch policies](PolicyPatchCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PoliciesPatchResponse { + /// no description provided + pub header: Option, + /// no description provided + pub policy: Option, +} + +impl client::ResponseResult for PoliciesPatchResponse {} + + +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [update policies](PolicyUpdateCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct PoliciesUpdateResponse { + /// no description provided + pub header: Option, + /// no description provided + pub policy: Option, +} + +impl client::ResponseResult for PoliciesUpdateResponse {} + + +/// A policy is a collection of DNS rules applied to one or more Virtual Private Cloud resources. +/// +/// # 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*). +/// +/// * [create policies](PolicyCreateCall) (request|response) +/// * [get policies](PolicyGetCall) (response) +/// * [patch policies](PolicyPatchCall) (request) +/// * [update policies](PolicyUpdateCall) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Policy { + /// Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. + #[serde(rename="alternativeNameServerConfig")] + pub alternative_name_server_config: Option, + /// A mutable string of at most 1024 characters associated with this resource for the user's convenience. Has no effect on the policy's function. + pub description: Option, + /// Allows networks bound to this policy to receive DNS queries sent by VMs or applications over VPN connections. When enabled, a virtual IP address is allocated from each of the subnetworks that are bound to this policy. + #[serde(rename="enableInboundForwarding")] + pub enable_inbound_forwarding: Option, + /// Controls whether logging is enabled for the networks bound to this policy. Defaults to no logging if not set. + #[serde(rename="enableLogging")] + pub enable_logging: Option, + /// Unique identifier for the resource; defined by the server (output only). + pub id: Option, + /// no description provided + pub kind: Option, + /// User-assigned name for this policy. pub name: Option, - /// The NamedRanges that share the same name. - #[serde(rename="namedRanges")] - pub named_ranges: Option>, + /// List of network names specifying networks to which this policy is applied. + pub networks: Option>, } -impl client::Part for NamedRanges {} +impl client::RequestValue for Policy {} +impl client::ResponseResult for Policy {} -/// A named style. Paragraphs in the document can inherit their TextStyle and ParagraphStyle from this named style when they have the same named style type. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NamedStyle { - /// The type of this named style. - #[serde(rename="namedStyleType")] - pub named_style_type: Option, - /// The paragraph style of this named style. - #[serde(rename="paragraphStyle")] - pub paragraph_style: Option, - /// The text style of this named style. - #[serde(rename="textStyle")] - pub text_style: Option, +pub struct PolicyAlternativeNameServerConfig { + /// no description provided + pub kind: Option, + /// Sets an alternative name server for the associated networks. When specified, all DNS queries are forwarded to a name server that you choose. Names such as .internal are not available when an alternative name server is specified. + #[serde(rename="targetNameServers")] + pub target_name_servers: Option>, } -impl client::Part for NamedStyle {} +impl client::Part for PolicyAlternativeNameServerConfig {} -/// A suggestion state of a NamedStyle message. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NamedStyleSuggestionState { - /// The named style type that this suggestion state corresponds to. This field is provided as a convenience for matching the NamedStyleSuggestionState with its corresponding NamedStyle. - #[serde(rename="namedStyleType")] - pub named_style_type: Option, - /// A mask that indicates which of the fields in paragraph style have been changed in this suggestion. - #[serde(rename="paragraphStyleSuggestionState")] - pub paragraph_style_suggestion_state: Option, - /// A mask that indicates which of the fields in text style have been changed in this suggestion. - #[serde(rename="textStyleSuggestionState")] - pub text_style_suggestion_state: Option, +pub struct PolicyAlternativeNameServerConfigTargetNameServer { + /// Forwarding path for this TargetNameServer. If unset or set to DEFAULT, Cloud DNS makes forwarding decisions based on address ranges; that is, RFC1918 addresses go to the VPC network, non-RFC1918 addresses go to the internet. When set to PRIVATE, Cloud DNS always sends queries through the VPC network for this target. + #[serde(rename="forwardingPath")] + pub forwarding_path: Option, + /// IPv4 address to forward to. + #[serde(rename="ipv4Address")] + pub ipv4_address: Option, + /// no description provided + pub kind: Option, } -impl client::Part for NamedStyleSuggestionState {} +impl client::Part for PolicyAlternativeNameServerConfigTargetNameServer {} -/// The named styles. Paragraphs in the document can inherit their TextStyle and ParagraphStyle from these named styles. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NamedStyles { - /// The named styles. There is an entry for each of the possible named style types. - pub styles: Option>, +pub struct PolicyNetwork { + /// no description provided + pub kind: Option, + /// The fully qualified URL of the VPC network to bind to. This should be formatted like https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network} + #[serde(rename="networkUrl")] + pub network_url: Option, } -impl client::Part for NamedStyles {} +impl client::Part for PolicyNetwork {} -/// The suggestion state of a NamedStyles message. +/// A project resource. The project is a top level container for resources including Cloud DNS ManagedZones. Projects can be created only in the APIs console. Next tag: 7. +/// +/// # 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*). +/// +/// * [get projects](ProjectGetCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct Project { + /// User assigned unique identifier for the resource (output only). + pub id: Option, + /// no description provided + pub kind: Option, + /// Unique numeric identifier for the resource; defined by the server (output only). + pub number: Option, + /// Quotas assigned to this project (output only). + pub quota: Option, +} + +impl client::Resource for Project {} +impl client::ResponseResult for Project {} + + +/// Limits associated with a Project. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NamedStylesSuggestionState { - /// A mask that indicates which of the fields on the corresponding NamedStyle in styles have been changed in this suggestion. The order of these named style suggestion states match the order of the corresponding named style within the named styles suggestion. - #[serde(rename="stylesSuggestionStates")] - pub styles_suggestion_states: Option>, +pub struct Quota { + /// Maximum allowed number of DnsKeys per ManagedZone. + #[serde(rename="dnsKeysPerManagedZone")] + pub dns_keys_per_managed_zone: Option, + /// Maximum allowed number of items per routing policy. + #[serde(rename="itemsPerRoutingPolicy")] + pub items_per_routing_policy: Option, + /// no description provided + pub kind: Option, + /// Maximum allowed number of managed zones in the project. + #[serde(rename="managedZones")] + pub managed_zones: Option, + /// Maximum allowed number of managed zones which can be attached to a network. + #[serde(rename="managedZonesPerNetwork")] + pub managed_zones_per_network: Option, + /// Maximum allowed number of networks to which a privately scoped zone can be attached. + #[serde(rename="networksPerManagedZone")] + pub networks_per_managed_zone: Option, + /// Maximum allowed number of networks per policy. + #[serde(rename="networksPerPolicy")] + pub networks_per_policy: Option, + /// Maximum allowed number of consumer peering zones per target network owned by this producer project + #[serde(rename="peeringZonesPerTargetNetwork")] + pub peering_zones_per_target_network: Option, + /// Maximum allowed number of policies per project. + pub policies: Option, + /// Maximum allowed number of ResourceRecords per ResourceRecordSet. + #[serde(rename="resourceRecordsPerRrset")] + pub resource_records_per_rrset: Option, + /// Maximum allowed number of ResourceRecordSets to add per ChangesCreateRequest. + #[serde(rename="rrsetAdditionsPerChange")] + pub rrset_additions_per_change: Option, + /// Maximum allowed number of ResourceRecordSets to delete per ChangesCreateRequest. + #[serde(rename="rrsetDeletionsPerChange")] + pub rrset_deletions_per_change: Option, + /// Maximum allowed number of ResourceRecordSets per zone in the project. + #[serde(rename="rrsetsPerManagedZone")] + pub rrsets_per_managed_zone: Option, + /// Maximum allowed number of target name servers per managed forwarding zone. + #[serde(rename="targetNameServersPerManagedZone")] + pub target_name_servers_per_managed_zone: Option, + /// Maximum allowed number of alternative target name servers per policy. + #[serde(rename="targetNameServersPerPolicy")] + pub target_name_servers_per_policy: Option, + /// Maximum allowed size for total rrdata in one ChangesCreateRequest in bytes. + #[serde(rename="totalRrdataSizePerChange")] + pub total_rrdata_size_per_change: Option, + /// DNSSEC algorithm and key length types that can be used for DnsKeys. + #[serde(rename="whitelistedKeySpecs")] + pub whitelisted_key_specs: Option>, } -impl client::Part for NamedStylesSuggestionState {} +impl client::Part for Quota {} -/// Contains properties describing the look and feel of a list bullet at a given level of nesting. +/// A RRSetRoutingPolicy represents ResourceRecordSet data that is returned dynamically with the response varying based on configured properties such as geolocation or by weighted random selection. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NestingLevel { - /// The alignment of the bullet within the space allotted for rendering the bullet. - #[serde(rename="bulletAlignment")] - pub bullet_alignment: Option, - /// The format string used by bullets at this level of nesting. The glyph format contains one or more placeholders, and these placeholder are replaced with the appropriate values depending on the glyph_type or glyph_symbol. The placeholders follow the pattern `%[nesting_level]`. Furthermore, placeholders can have prefixes and suffixes. Thus, the glyph format follows the pattern `%[nesting_level]`. Note that the prefix and suffix are optional and can be arbitrary strings. For example, the glyph format `%0.` indicates that the rendered glyph will replace the placeholder with the corresponding glyph for nesting level 0 followed by a period as the suffix. So a list with a glyph type of UPPER_ALPHA and glyph format `%0.` at nesting level 0 will result in a list with rendered glyphs `A.` `B.` `C.` The glyph format can contain placeholders for the current nesting level as well as placeholders for parent nesting levels. For example, a list can have a glyph format of `%0.` at nesting level 0 and a glyph format of `%0.%1.` at nesting level 1. Assuming both nesting levels have DECIMAL glyph types, this would result in a list with rendered glyphs `1.` `2.` ` 2.1.` ` 2.2.` `3.` For nesting levels that are ordered, the string that replaces a placeholder in the glyph format for a particular paragraph depends on the paragraph's order within the list. - #[serde(rename="glyphFormat")] - pub glyph_format: Option, - /// A custom glyph symbol used by bullets when paragraphs at this level of nesting are unordered. The glyph symbol replaces placeholders within the glyph_format. For example, if the glyph_symbol is the solid circle corresponding to Unicode U+25cf code point and the glyph_format is `%0`, the rendered glyph would be the solid circle. - #[serde(rename="glyphSymbol")] - pub glyph_symbol: Option, - /// The type of glyph used by bullets when paragraphs at this level of nesting are ordered. The glyph type determines the type of glyph used to replace placeholders within the glyph_format when paragraphs at this level of nesting are ordered. For example, if the nesting level is 0, the glyph_format is `%0.` and the glyph type is DECIMAL, then the rendered glyph would replace the placeholder `%0` in the glyph format with a number corresponding to list item's order within the list. - #[serde(rename="glyphType")] - pub glyph_type: Option, - /// The amount of indentation for the first line of paragraphs at this level of nesting. - #[serde(rename="indentFirstLine")] - pub indent_first_line: Option, - /// The amount of indentation for paragraphs at this level of nesting. Applied to the side that corresponds to the start of the text, based on the paragraph's content direction. - #[serde(rename="indentStart")] - pub indent_start: Option, - /// The number of the first list item at this nesting level. A value of 0 is treated as a value of 1 for lettered lists and roman numeraled lists, i.e. for values of both 0 and 1, lettered and roman numeraled lists will begin at `a` and `i` respectively. This value is ignored for nesting levels with unordered glyphs. - #[serde(rename="startNumber")] - pub start_number: Option, - /// The text style of bullets at this level of nesting. - #[serde(rename="textStyle")] - pub text_style: Option, +pub struct RRSetRoutingPolicy { + /// no description provided + pub geo: Option, + /// no description provided + pub kind: Option, + /// no description provided + pub wrr: Option, } -impl client::Part for NestingLevel {} +impl client::Part for RRSetRoutingPolicy {} -/// A mask that indicates which of the fields on the base NestingLevel have been changed in this suggestion. For any field set to true, there is a new suggested value. +/// Configures a RRSetRoutingPolicy that routes based on the geo location of the querying user. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct NestingLevelSuggestionState { - /// Indicates if there was a suggested change to bullet_alignment. - #[serde(rename="bulletAlignmentSuggested")] - pub bullet_alignment_suggested: Option, - /// Indicates if there was a suggested change to glyph_format. - #[serde(rename="glyphFormatSuggested")] - pub glyph_format_suggested: Option, - /// Indicates if there was a suggested change to glyph_symbol. - #[serde(rename="glyphSymbolSuggested")] - pub glyph_symbol_suggested: Option, - /// Indicates if there was a suggested change to glyph_type. - #[serde(rename="glyphTypeSuggested")] - pub glyph_type_suggested: Option, - /// Indicates if there was a suggested change to indent_first_line. - #[serde(rename="indentFirstLineSuggested")] - pub indent_first_line_suggested: Option, - /// Indicates if there was a suggested change to indent_start. - #[serde(rename="indentStartSuggested")] - pub indent_start_suggested: Option, - /// Indicates if there was a suggested change to start_number. - #[serde(rename="startNumberSuggested")] - pub start_number_suggested: Option, - /// A mask that indicates which of the fields in text style have been changed in this suggestion. - #[serde(rename="textStyleSuggestionState")] - pub text_style_suggestion_state: Option, +pub struct RRSetRoutingPolicyGeoPolicy { + /// The primary geo routing configuration. If there are multiple items with the same location, an error is returned instead. + pub items: Option>, + /// no description provided + pub kind: Option, } -impl client::Part for NestingLevelSuggestionState {} +impl client::Part for RRSetRoutingPolicyGeoPolicy {} -/// A collection of object IDs. +/// ResourceRecordSet data for one geo location. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ObjectReferences { - /// The object IDs. - #[serde(rename="objectIds")] - pub object_ids: Option>, +pub struct RRSetRoutingPolicyGeoPolicyGeoPolicyItem { + /// no description provided + pub kind: Option, + /// The geo-location granularity is a GCP region. This location string should correspond to a GCP region. e.g. "us-east1", "southamerica-east1", "asia-east1", etc. + pub location: Option, + /// no description provided + pub rrdatas: Option>, + /// DNSSEC generated signatures for all the rrdata within this item. Note that if health checked targets are provided for DNSSEC enabled zones, there's a restriction of 1 ip per item. . + #[serde(rename="signatureRrdatas")] + pub signature_rrdatas: Option>, } -impl client::Part for ObjectReferences {} +impl client::Part for RRSetRoutingPolicyGeoPolicyGeoPolicyItem {} -/// A color that can either be fully opaque or fully transparent. +/// Configures a RRSetRoutingPolicy that routes in a weighted round robin fashion. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct OptionalColor { - /// If set, this will be used as an opaque color. If unset, this represents a transparent color. - pub color: Option, +pub struct RRSetRoutingPolicyWrrPolicy { + /// no description provided + pub items: Option>, + /// no description provided + pub kind: Option, } -impl client::Part for OptionalColor {} +impl client::Part for RRSetRoutingPolicyWrrPolicy {} -/// A ParagraphElement representing a page break. A page break makes the subsequent text start at the top of the next page. +/// A routing block which contains the routing information for one WRR item. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PageBreak { - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A PageBreak may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this PageBreak, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this PageBreak. Similar to text content, like text runs and footnote references, the text style of a page break can affect content layout as well as the styling of text inserted adjacent to it. - #[serde(rename="textStyle")] - pub text_style: Option, +pub struct RRSetRoutingPolicyWrrPolicyWrrPolicyItem { + /// no description provided + pub kind: Option, + /// no description provided + pub rrdatas: Option>, + /// DNSSEC generated signatures for all the rrdata within this item. Note that if health checked targets are provided for DNSSEC enabled zones, there's a restriction of 1 ip per item. . + #[serde(rename="signatureRrdatas")] + pub signature_rrdatas: Option>, + /// The weight corresponding to this subset of rrdata. When multiple WeightedRoundRobinPolicyItems are configured, the probability of returning an rrset is proportional to its weight relative to the sum of weights configured for all items. This weight should be non-negative. + pub weight: Option, } -impl client::Part for PageBreak {} +impl client::Part for RRSetRoutingPolicyWrrPolicyWrrPolicyItem {} -/// A StructuralElement representing a paragraph. A paragraph is a range of content that is terminated with a newline character. +/// A unit of data that is returned by the DNS servers. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # 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*). +/// +/// * [create resource record sets](ResourceRecordSetCreateCall) (request|response) +/// * [delete resource record sets](ResourceRecordSetDeleteCall) (none) +/// * [get resource record sets](ResourceRecordSetGetCall) (response) +/// * [list resource record sets](ResourceRecordSetListCall) (none) +/// * [patch resource record sets](ResourceRecordSetPatchCall) (request|response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Paragraph { - /// The bullet for this paragraph. If not present, the paragraph does not belong to a list. - pub bullet: Option, - /// The content of the paragraph broken down into its component parts. - pub elements: Option>, - /// The style of this paragraph. - #[serde(rename="paragraphStyle")] - pub paragraph_style: Option, - /// The IDs of the positioned objects tethered to this paragraph. - #[serde(rename="positionedObjectIds")] - pub positioned_object_ids: Option>, - /// The suggested changes to this paragraph's bullet. - #[serde(rename="suggestedBulletChanges")] - pub suggested_bullet_changes: Option>, - /// The suggested paragraph style changes to this paragraph, keyed by suggestion ID. - #[serde(rename="suggestedParagraphStyleChanges")] - pub suggested_paragraph_style_changes: Option>, - /// The IDs of the positioned objects that are suggested to be attached to this paragraph, keyed by suggestion ID. - #[serde(rename="suggestedPositionedObjectIds")] - pub suggested_positioned_object_ids: Option>, -} - -impl client::Part for Paragraph {} - - -/// A border around a paragraph. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ParagraphBorder { - /// The color of the border. - pub color: Option, - /// The dash style of the border. - #[serde(rename="dashStyle")] - pub dash_style: Option, - /// The padding of the border. - pub padding: Option, - /// The width of the border. - pub width: Option, -} - -impl client::Part for ParagraphBorder {} - - -/// A ParagraphElement describes content within a Paragraph. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ParagraphElement { - /// An auto text paragraph element. - #[serde(rename="autoText")] - pub auto_text: Option, - /// A column break paragraph element. - #[serde(rename="columnBreak")] - pub column_break: Option, - /// The zero-base end index of this paragraph element, exclusive, in UTF-16 code units. - #[serde(rename="endIndex")] - pub end_index: Option, - /// An equation paragraph element. - pub equation: Option, - /// A footnote reference paragraph element. - #[serde(rename="footnoteReference")] - pub footnote_reference: Option, - /// A horizontal rule paragraph element. - #[serde(rename="horizontalRule")] - pub horizontal_rule: Option, - /// An inline object paragraph element. - #[serde(rename="inlineObjectElement")] - pub inline_object_element: Option, - /// A page break paragraph element. - #[serde(rename="pageBreak")] - pub page_break: Option, - /// A paragraph element that links to a person or email address. - pub person: Option, - /// A paragraph element that links to a Google resource (such as a file in Drive, a Youtube video, a Calendar event, etc.) - #[serde(rename="richLink")] - pub rich_link: Option, - /// The zero-based start index of this paragraph element, in UTF-16 code units. - #[serde(rename="startIndex")] - pub start_index: Option, - /// A text run paragraph element. - #[serde(rename="textRun")] - pub text_run: Option, -} - -impl client::Part for ParagraphElement {} - - -/// Styles that apply to a whole paragraph. Inherited paragraph styles are represented as unset fields in this message. A paragraph style's parent depends on where the paragraph style is defined: * The ParagraphStyle on a Paragraph inherits from the paragraph's corresponding named style type. * The ParagraphStyle on a named style inherits from the normal text named style. * The ParagraphStyle of the normal text named style inherits from the default paragraph style in the Docs editor. * The ParagraphStyle on a Paragraph element that is contained in a table may inherit its paragraph style from the table style. If the paragraph style does not inherit from a parent, unsetting fields will revert the style to a value matching the defaults in the Docs editor. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ParagraphStyle { - /// The text alignment for this paragraph. - pub alignment: Option, - /// Whether to avoid widows and orphans for the paragraph. If unset, the value is inherited from the parent. - #[serde(rename="avoidWidowAndOrphan")] - pub avoid_widow_and_orphan: Option, - /// The border between this paragraph and the next and previous paragraphs. If unset, the value is inherited from the parent. The between border is rendered when the adjacent paragraph has the same border and indent properties. Paragraph borders cannot be partially updated. When making changes to a paragraph border the new border must be specified in its entirety. - #[serde(rename="borderBetween")] - pub border_between: Option, - /// The border at the bottom of this paragraph. If unset, the value is inherited from the parent. The bottom border is rendered when the paragraph below has different border and indent properties. Paragraph borders cannot be partially updated. When making changes to a paragraph border the new border must be specified in its entirety. - #[serde(rename="borderBottom")] - pub border_bottom: Option, - /// The border to the left of this paragraph. If unset, the value is inherited from the parent. Paragraph borders cannot be partially updated. When making changes to a paragraph border the new border must be specified in its entirety. - #[serde(rename="borderLeft")] - pub border_left: Option, - /// The border to the right of this paragraph. If unset, the value is inherited from the parent. Paragraph borders cannot be partially updated. When making changes to a paragraph border the new border must be specified in its entirety. - #[serde(rename="borderRight")] - pub border_right: Option, - /// The border at the top of this paragraph. If unset, the value is inherited from the parent. The top border is rendered when the paragraph above has different border and indent properties. Paragraph borders cannot be partially updated. When making changes to a paragraph border the new border must be specified in its entirety. - #[serde(rename="borderTop")] - pub border_top: Option, - /// The text direction of this paragraph. If unset, the value defaults to LEFT_TO_RIGHT since paragraph direction is not inherited. - pub direction: Option, - /// The heading ID of the paragraph. If empty, then this paragraph is not a heading. This property is read-only. - #[serde(rename="headingId")] - pub heading_id: Option, - /// The amount of indentation for the paragraph on the side that corresponds to the end of the text, based on the current paragraph direction. If unset, the value is inherited from the parent. - #[serde(rename="indentEnd")] - pub indent_end: Option, - /// The amount of indentation for the first line of the paragraph. If unset, the value is inherited from the parent. - #[serde(rename="indentFirstLine")] - pub indent_first_line: Option, - /// The amount of indentation for the paragraph on the side that corresponds to the start of the text, based on the current paragraph direction. If unset, the value is inherited from the parent. - #[serde(rename="indentStart")] - pub indent_start: Option, - /// Whether all lines of the paragraph should be laid out on the same page or column if possible. If unset, the value is inherited from the parent. - #[serde(rename="keepLinesTogether")] - pub keep_lines_together: Option, - /// Whether at least a part of this paragraph should be laid out on the same page or column as the next paragraph if possible. If unset, the value is inherited from the parent. - #[serde(rename="keepWithNext")] - pub keep_with_next: Option, - /// The amount of space between lines, as a percentage of normal, where normal is represented as 100.0. If unset, the value is inherited from the parent. - #[serde(rename="lineSpacing")] - pub line_spacing: Option, - /// The named style type of the paragraph. Since updating the named style type affects other properties within ParagraphStyle, the named style type is applied before the other properties are updated. - #[serde(rename="namedStyleType")] - pub named_style_type: Option, - /// The shading of the paragraph. If unset, the value is inherited from the parent. - pub shading: Option, - /// The amount of extra space above the paragraph. If unset, the value is inherited from the parent. - #[serde(rename="spaceAbove")] - pub space_above: Option, - /// The amount of extra space below the paragraph. If unset, the value is inherited from the parent. - #[serde(rename="spaceBelow")] - pub space_below: Option, - /// The spacing mode for the paragraph. - #[serde(rename="spacingMode")] - pub spacing_mode: Option, - /// A list of the tab stops for this paragraph. The list of tab stops is not inherited. This property is read-only. - #[serde(rename="tabStops")] - pub tab_stops: Option>, -} - -impl client::Part for ParagraphStyle {} - - -/// A mask that indicates which of the fields on the base ParagraphStyle have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ParagraphStyleSuggestionState { - /// Indicates if there was a suggested change to alignment. - #[serde(rename="alignmentSuggested")] - pub alignment_suggested: Option, - /// Indicates if there was a suggested change to avoid_widow_and_orphan. - #[serde(rename="avoidWidowAndOrphanSuggested")] - pub avoid_widow_and_orphan_suggested: Option, - /// Indicates if there was a suggested change to border_between. - #[serde(rename="borderBetweenSuggested")] - pub border_between_suggested: Option, - /// Indicates if there was a suggested change to border_bottom. - #[serde(rename="borderBottomSuggested")] - pub border_bottom_suggested: Option, - /// Indicates if there was a suggested change to border_left. - #[serde(rename="borderLeftSuggested")] - pub border_left_suggested: Option, - /// Indicates if there was a suggested change to border_right. - #[serde(rename="borderRightSuggested")] - pub border_right_suggested: Option, - /// Indicates if there was a suggested change to border_top. - #[serde(rename="borderTopSuggested")] - pub border_top_suggested: Option, - /// Indicates if there was a suggested change to direction. - #[serde(rename="directionSuggested")] - pub direction_suggested: Option, - /// Indicates if there was a suggested change to heading_id. - #[serde(rename="headingIdSuggested")] - pub heading_id_suggested: Option, - /// Indicates if there was a suggested change to indent_end. - #[serde(rename="indentEndSuggested")] - pub indent_end_suggested: Option, - /// Indicates if there was a suggested change to indent_first_line. - #[serde(rename="indentFirstLineSuggested")] - pub indent_first_line_suggested: Option, - /// Indicates if there was a suggested change to indent_start. - #[serde(rename="indentStartSuggested")] - pub indent_start_suggested: Option, - /// Indicates if there was a suggested change to keep_lines_together. - #[serde(rename="keepLinesTogetherSuggested")] - pub keep_lines_together_suggested: Option, - /// Indicates if there was a suggested change to keep_with_next. - #[serde(rename="keepWithNextSuggested")] - pub keep_with_next_suggested: Option, - /// Indicates if there was a suggested change to line_spacing. - #[serde(rename="lineSpacingSuggested")] - pub line_spacing_suggested: Option, - /// Indicates if there was a suggested change to named_style_type. - #[serde(rename="namedStyleTypeSuggested")] - pub named_style_type_suggested: Option, - /// A mask that indicates which of the fields in shading have been changed in this suggestion. - #[serde(rename="shadingSuggestionState")] - pub shading_suggestion_state: Option, - /// Indicates if there was a suggested change to space_above. - #[serde(rename="spaceAboveSuggested")] - pub space_above_suggested: Option, - /// Indicates if there was a suggested change to space_below. - #[serde(rename="spaceBelowSuggested")] - pub space_below_suggested: Option, - /// Indicates if there was a suggested change to spacing_mode. - #[serde(rename="spacingModeSuggested")] - pub spacing_mode_suggested: Option, -} - -impl client::Part for ParagraphStyleSuggestionState {} - - -/// A person or email address mentioned in a document. These mentions behave as a single, immutable element containing the person's name or email address. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Person { - /// Output only. The unique ID of this link. - #[serde(rename="personId")] - pub person_id: Option, - /// Output only. The properties of this Person. This field is always present. - #[serde(rename="personProperties")] - pub person_properties: Option, - /// IDs for suggestions that remove this person link from the document. A Person might have multiple deletion IDs if, for example, multiple users suggest to delete it. If empty, then this person link isn't suggested for deletion. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// IDs for suggestions that insert this person link into the document. A Person might have multiple insertion IDs if it is a nested suggested change (a suggestion within a suggestion made by a different user, for example). If empty, then this person link isn't a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this Person, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this Person. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for Person {} - - -/// Properties specific to a linked Person. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PersonProperties { - /// Output only. The email address linked to this Person. This field is always present. - pub email: Option, - /// Output only. The name of the person if it is displayed in the link text instead of the person's email address. +pub struct ResourceRecordSet { + /// no description provided + pub kind: Option, + /// For example, www.example.com. pub name: Option, + /// Configures dynamic query responses based on geo location of querying user or a weighted round robin based routing policy. A ResourceRecordSet should only have either rrdata (static) or routing_policy (dynamic). An error is returned otherwise. + #[serde(rename="routingPolicy")] + pub routing_policy: Option, + /// As defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1) -- see examples. + pub rrdatas: Option>, + /// As defined in RFC 4034 (section 3.2). + #[serde(rename="signatureRrdatas")] + pub signature_rrdatas: Option>, + /// Number of seconds that this ResourceRecordSet can be cached by resolvers. + pub ttl: Option, + /// The identifier of a supported record type. See the list of Supported DNS record types. + #[serde(rename="type")] + pub type_: Option, } -impl client::Part for PersonProperties {} +impl client::RequestValue for ResourceRecordSet {} +impl client::Resource for ResourceRecordSet {} +impl client::ResponseResult for ResourceRecordSet {} -/// An object that is tethered to a Paragraph and positioned relative to the beginning of the paragraph. A PositionedObject contains an EmbeddedObject such as an image. +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [list resource record sets](ResourceRecordSetListCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResourceRecordSetsListResponse { + /// no description provided + pub header: Option, + /// Type of resource. + pub kind: Option, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your pagination token. This lets you retrieve complete contents of even larger collections, one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of elements returned are an inconsistent view of the collection. You cannot retrieve a consistent snapshot of a collection larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The resource record set resources. + pub rrsets: Option>, +} + +impl client::ResponseResult for ResourceRecordSetsListResponse {} + + +/// Elements common to every response. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PositionedObject { - /// The ID of this positioned object. - #[serde(rename="objectId")] - pub object_id: Option, - /// The properties of this positioned object. - #[serde(rename="positionedObjectProperties")] - pub positioned_object_properties: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion ID. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionId")] - pub suggested_insertion_id: Option, - /// The suggested changes to the positioned object properties, keyed by suggestion ID. - #[serde(rename="suggestedPositionedObjectPropertiesChanges")] - pub suggested_positioned_object_properties_changes: Option>, +pub struct ResponseHeader { + /// For mutating operation requests that completed successfully. This is the client_operation_id if the client specified it, otherwise it is generated by the server (output only). + #[serde(rename="operationId")] + pub operation_id: Option, } -impl client::Part for PositionedObject {} +impl client::Part for ResponseHeader {} -/// The positioning of a PositionedObject. The positioned object is positioned relative to the beginning of the Paragraph it is tethered to. +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [list response policies](ResponsePolicyListCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResponsePoliciesListResponse { + /// no description provided + pub header: Option, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. This lets you the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned are an inconsistent view of the collection. You cannot retrieve a consistent snapshot of a collection larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The Response Policy resources. + #[serde(rename="responsePolicies")] + pub response_policies: Option>, +} + +impl client::ResponseResult for ResponsePoliciesListResponse {} + + +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [patch response policies](ResponsePolicyPatchCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResponsePoliciesPatchResponse { + /// no description provided + pub header: Option, + /// no description provided + #[serde(rename="responsePolicy")] + pub response_policy: Option, +} + +impl client::ResponseResult for ResponsePoliciesPatchResponse {} + + +/// There is no detailed description. +/// +/// # 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*). +/// +/// * [update response policies](ResponsePolicyUpdateCall) (response) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResponsePoliciesUpdateResponse { + /// no description provided + pub header: Option, + /// no description provided + #[serde(rename="responsePolicy")] + pub response_policy: Option, +} + +impl client::ResponseResult for ResponsePoliciesUpdateResponse {} + + +/// A Response Policy is a collection of selectors that apply to queries made against one or more Virtual Private Cloud networks. +/// +/// # 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*). +/// +/// * [create response policies](ResponsePolicyCreateCall) (request|response) +/// * [get response policies](ResponsePolicyGetCall) (response) +/// * [patch response policies](ResponsePolicyPatchCall) (request) +/// * [update response policies](ResponsePolicyUpdateCall) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResponsePolicy { + /// User-provided description for this Response Policy. + pub description: Option, + /// The list of Google Kubernetes Engine clusters to which this response policy is applied. + #[serde(rename="gkeClusters")] + pub gke_clusters: Option>, + /// Unique identifier for the resource; defined by the server (output only). + pub id: Option, + /// no description provided + pub kind: Option, + /// List of network names specifying networks to which this policy is applied. + pub networks: Option>, + /// User assigned name for this Response Policy. + #[serde(rename="responsePolicyName")] + pub response_policy_name: Option, +} + +impl client::RequestValue for ResponsePolicy {} +impl client::ResponseResult for ResponsePolicy {} + + +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PositionedObjectPositioning { - /// The layout of this positioned object. - pub layout: Option, - /// The offset of the left edge of the positioned object relative to the beginning of the Paragraph it is tethered to. The exact positioning of the object can depend on other content in the document and the document's styling. - #[serde(rename="leftOffset")] - pub left_offset: Option, - /// The offset of the top edge of the positioned object relative to the beginning of the Paragraph it is tethered to. The exact positioning of the object can depend on other content in the document and the document's styling. - #[serde(rename="topOffset")] - pub top_offset: Option, +pub struct ResponsePolicyGKECluster { + /// The resource name of the cluster to bind this response policy to. This should be specified in the format like: projects/*/locations/*/clusters/*. This is referenced from GKE projects.locations.clusters.get API: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.locations.clusters/get + #[serde(rename="gkeClusterName")] + pub gke_cluster_name: Option, + /// no description provided + pub kind: Option, } -impl client::Part for PositionedObjectPositioning {} +impl client::Part for ResponsePolicyGKECluster {} -/// A mask that indicates which of the fields on the base PositionedObjectPositioning have been changed in this suggestion. For any field set to true, there is a new suggested value. +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PositionedObjectPositioningSuggestionState { - /// Indicates if there was a suggested change to layout. - #[serde(rename="layoutSuggested")] - pub layout_suggested: Option, - /// Indicates if there was a suggested change to left_offset. - #[serde(rename="leftOffsetSuggested")] - pub left_offset_suggested: Option, - /// Indicates if there was a suggested change to top_offset. - #[serde(rename="topOffsetSuggested")] - pub top_offset_suggested: Option, +pub struct ResponsePolicyNetwork { + /// no description provided + pub kind: Option, + /// The fully qualified URL of the VPC network to bind to. This should be formatted like https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network} + #[serde(rename="networkUrl")] + pub network_url: Option, } -impl client::Part for PositionedObjectPositioningSuggestionState {} +impl client::Part for ResponsePolicyNetwork {} -/// Properties of a PositionedObject. +/// A Response Policy Rule is a selector that applies its behavior to queries that match the selector. Selectors are DNS names, which may be wildcards or exact matches. Each DNS query subject to a Response Policy matches at most one ResponsePolicyRule, as identified by the dns_name field with the longest matching suffix. +/// +/// # 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*). +/// +/// * [create response policy rules](ResponsePolicyRuleCreateCall) (request|response) +/// * [delete response policy rules](ResponsePolicyRuleDeleteCall) (none) +/// * [get response policy rules](ResponsePolicyRuleGetCall) (response) +/// * [list response policy rules](ResponsePolicyRuleListCall) (none) +/// * [patch response policy rules](ResponsePolicyRulePatchCall) (request) +/// * [update response policy rules](ResponsePolicyRuleUpdateCall) (request) +/// +#[derive(Default, Clone, Debug, Serialize, Deserialize)] +pub struct ResponsePolicyRule { + /// Answer this query with a behavior rather than DNS data. + pub behavior: Option, + /// The DNS name (wildcard or exact) to apply this rule to. Must be unique within the Response Policy Rule. + #[serde(rename="dnsName")] + pub dns_name: Option, + /// no description provided + pub kind: Option, + /// Answer this query directly with DNS data. These ResourceRecordSets override any other DNS behavior for the matched name; in particular they override private zones, the public internet, and GCP internal DNS. No SOA nor NS types are allowed. + #[serde(rename="localData")] + pub local_data: Option, + /// An identifier for this rule. Must be unique with the ResponsePolicy. + #[serde(rename="ruleName")] + pub rule_name: Option, +} + +impl client::RequestValue for ResponsePolicyRule {} +impl client::Resource for ResponsePolicyRule {} +impl client::ResponseResult for ResponsePolicyRule {} + + +/// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PositionedObjectProperties { - /// The embedded object of this positioned object. - #[serde(rename="embeddedObject")] - pub embedded_object: Option, - /// The positioning of this positioned object relative to the newline of the Paragraph that references this positioned object. - pub positioning: Option, +pub struct ResponsePolicyRuleLocalData { + /// All resource record sets for this selector, one per resource record type. The name must match the dns_name. + #[serde(rename="localDatas")] + pub local_datas: Option>, } -impl client::Part for PositionedObjectProperties {} +impl client::Part for ResponsePolicyRuleLocalData {} -/// A mask that indicates which of the fields on the base PositionedObjectProperties have been changed in this suggestion. For any field set to true, there is a new suggested value. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # 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*). +/// +/// * [list response policy rules](ResponsePolicyRuleListCall) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct PositionedObjectPropertiesSuggestionState { - /// A mask that indicates which of the fields in embedded_object have been changed in this suggestion. - #[serde(rename="embeddedObjectSuggestionState")] - pub embedded_object_suggestion_state: Option, - /// A mask that indicates which of the fields in positioning have been changed in this suggestion. - #[serde(rename="positioningSuggestionState")] - pub positioning_suggestion_state: Option, +pub struct ResponsePolicyRulesListResponse { + /// no description provided + pub header: Option, + /// The presence of this field indicates that there exist more results following your last page of results in pagination order. To fetch them, make another list request using this value as your page token. This lets you the complete contents of even very large collections one page at a time. However, if the contents of the collection change between the first and last paginated list request, the set of all elements returned are an inconsistent view of the collection. You cannot retrieve a consistent snapshot of a collection larger than the maximum page size. + #[serde(rename="nextPageToken")] + pub next_page_token: Option, + /// The Response Policy Rule resources. + #[serde(rename="responsePolicyRules")] + pub response_policy_rules: Option>, } -impl client::Part for PositionedObjectPropertiesSuggestionState {} +impl client::ResponseResult for ResponsePolicyRulesListResponse {} -/// Specifies a contiguous range of text. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # 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*). +/// +/// * [patch response policy rules](ResponsePolicyRulePatchCall) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Range { - /// The zero-based end index of this range, exclusive, in UTF-16 code units. In all current uses, an end index must be provided. This field is an Int32Value in order to accommodate future use cases with open-ended ranges. - #[serde(rename="endIndex")] - pub end_index: Option, - /// The ID of the header, footer or footnote that this range is contained in. An empty segment ID signifies the document's body. - #[serde(rename="segmentId")] - pub segment_id: Option, - /// The zero-based start index of this range, in UTF-16 code units. In all current uses, a start index must be provided. This field is an Int32Value in order to accommodate future use cases with open-ended ranges. - #[serde(rename="startIndex")] - pub start_index: Option, +pub struct ResponsePolicyRulesPatchResponse { + /// no description provided + pub header: Option, + /// no description provided + #[serde(rename="responsePolicyRule")] + pub response_policy_rule: Option, } -impl client::Part for Range {} +impl client::ResponseResult for ResponsePolicyRulesPatchResponse {} -/// Replaces all instances of text matching a criteria with replace text. +/// There is no detailed description. /// -/// This type is not used in any activity, and only used as *part* of another schema. +/// # 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*). +/// +/// * [update response policy rules](ResponsePolicyRuleUpdateCall) (response) /// #[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReplaceAllTextRequest { - /// Finds text in the document matching this substring. - #[serde(rename="containsText")] - pub contains_text: Option, - /// The text that will replace the matched text. - #[serde(rename="replaceText")] - pub replace_text: Option, +pub struct ResponsePolicyRulesUpdateResponse { + /// no description provided + pub header: Option, + /// no description provided + #[serde(rename="responsePolicyRule")] + pub response_policy_rule: Option, } -impl client::Part for ReplaceAllTextRequest {} - - -/// The result of replacing text. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReplaceAllTextResponse { - /// The number of occurrences changed by replacing all text. - #[serde(rename="occurrencesChanged")] - pub occurrences_changed: Option, -} - -impl client::Part for ReplaceAllTextResponse {} - - -/// Replaces an existing image with a new image. Replacing an image removes some image effects from the existing image in order to mirror the behavior of the Docs editor. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReplaceImageRequest { - /// The ID of the existing image that will be replaced. - #[serde(rename="imageObjectId")] - pub image_object_id: Option, - /// The replacement method. - #[serde(rename="imageReplaceMethod")] - pub image_replace_method: Option, - /// The URI of the new image. The image is fetched once at insertion time and a copy is stored for display inside the document. Images must be less than 50MB in size, cannot exceed 25 megapixels, and must be in one of PNG, JPEG, or GIF format. The provided URI can be at most 2 kB in length. The URI itself is saved with the image, and exposed via the ImageProperties.source_uri field. - pub uri: Option, -} - -impl client::Part for ReplaceImageRequest {} - - -/// Replaces the contents of the specified NamedRange or NamedRanges with the given replacement content. Note that an individual NamedRange may consist of multiple discontinuous ranges. In this case, only the content in the first range will be replaced. The other ranges and their content will be deleted. In cases where replacing or deleting any ranges would result in an invalid document structure, a 400 bad request error is returned. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ReplaceNamedRangeContentRequest { - /// The ID of the named range whose content will be replaced. If there is no named range with the given ID a 400 bad request error is returned. - #[serde(rename="namedRangeId")] - pub named_range_id: Option, - /// The name of the NamedRanges whose content will be replaced. If there are multiple named ranges with the given name, then the content of each one will be replaced. If there are no named ranges with the given name, then the request will be a no-op. - #[serde(rename="namedRangeName")] - pub named_range_name: Option, - /// Replaces the content of the specified named range(s) with the given text. - pub text: Option, -} - -impl client::Part for ReplaceNamedRangeContentRequest {} - - -/// A single update to apply to a document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Request { - /// Creates a footer. - #[serde(rename="createFooter")] - pub create_footer: Option, - /// Creates a footnote. - #[serde(rename="createFootnote")] - pub create_footnote: Option, - /// Creates a header. - #[serde(rename="createHeader")] - pub create_header: Option, - /// Creates a named range. - #[serde(rename="createNamedRange")] - pub create_named_range: Option, - /// Creates bullets for paragraphs. - #[serde(rename="createParagraphBullets")] - pub create_paragraph_bullets: Option, - /// Deletes content from the document. - #[serde(rename="deleteContentRange")] - pub delete_content_range: Option, - /// Deletes a footer from the document. - #[serde(rename="deleteFooter")] - pub delete_footer: Option, - /// Deletes a header from the document. - #[serde(rename="deleteHeader")] - pub delete_header: Option, - /// Deletes a named range. - #[serde(rename="deleteNamedRange")] - pub delete_named_range: Option, - /// Deletes bullets from paragraphs. - #[serde(rename="deleteParagraphBullets")] - pub delete_paragraph_bullets: Option, - /// Deletes a positioned object from the document. - #[serde(rename="deletePositionedObject")] - pub delete_positioned_object: Option, - /// Deletes a column from a table. - #[serde(rename="deleteTableColumn")] - pub delete_table_column: Option, - /// Deletes a row from a table. - #[serde(rename="deleteTableRow")] - pub delete_table_row: Option, - /// Inserts an inline image at the specified location. - #[serde(rename="insertInlineImage")] - pub insert_inline_image: Option, - /// Inserts a page break at the specified location. - #[serde(rename="insertPageBreak")] - pub insert_page_break: Option, - /// Inserts a section break at the specified location. - #[serde(rename="insertSectionBreak")] - pub insert_section_break: Option, - /// Inserts a table at the specified location. - #[serde(rename="insertTable")] - pub insert_table: Option, - /// Inserts an empty column into a table. - #[serde(rename="insertTableColumn")] - pub insert_table_column: Option, - /// Inserts an empty row into a table. - #[serde(rename="insertTableRow")] - pub insert_table_row: Option, - /// Inserts text at the specified location. - #[serde(rename="insertText")] - pub insert_text: Option, - /// Merges cells in a table. - #[serde(rename="mergeTableCells")] - pub merge_table_cells: Option, - /// Replaces all instances of the specified text. - #[serde(rename="replaceAllText")] - pub replace_all_text: Option, - /// Replaces an image in the document. - #[serde(rename="replaceImage")] - pub replace_image: Option, - /// Replaces the content in a named range. - #[serde(rename="replaceNamedRangeContent")] - pub replace_named_range_content: Option, - /// Unmerges cells in a table. - #[serde(rename="unmergeTableCells")] - pub unmerge_table_cells: Option, - /// Updates the style of the document. - #[serde(rename="updateDocumentStyle")] - pub update_document_style: Option, - /// Updates the paragraph style at the specified range. - #[serde(rename="updateParagraphStyle")] - pub update_paragraph_style: Option, - /// Updates the section style of the specified range. - #[serde(rename="updateSectionStyle")] - pub update_section_style: Option, - /// Updates the style of table cells. - #[serde(rename="updateTableCellStyle")] - pub update_table_cell_style: Option, - /// Updates the properties of columns in a table. - #[serde(rename="updateTableColumnProperties")] - pub update_table_column_properties: Option, - /// Updates the row style in a table. - #[serde(rename="updateTableRowStyle")] - pub update_table_row_style: Option, - /// Updates the text style at the specified range. - #[serde(rename="updateTextStyle")] - pub update_text_style: Option, -} - -impl client::Part for Request {} - - -/// A single response from an update. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Response { - /// The result of creating a footer. - #[serde(rename="createFooter")] - pub create_footer: Option, - /// The result of creating a footnote. - #[serde(rename="createFootnote")] - pub create_footnote: Option, - /// The result of creating a header. - #[serde(rename="createHeader")] - pub create_header: Option, - /// The result of creating a named range. - #[serde(rename="createNamedRange")] - pub create_named_range: Option, - /// The result of inserting an inline image. - #[serde(rename="insertInlineImage")] - pub insert_inline_image: Option, - /// The result of inserting an inline Google Sheets chart. - #[serde(rename="insertInlineSheetsChart")] - pub insert_inline_sheets_chart: Option, - /// The result of replacing text. - #[serde(rename="replaceAllText")] - pub replace_all_text: Option, -} - -impl client::Part for Response {} - - -/// An RGB color. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RgbColor { - /// The blue component of the color, from 0.0 to 1.0. - pub blue: Option, - /// The green component of the color, from 0.0 to 1.0. - pub green: Option, - /// The red component of the color, from 0.0 to 1.0. - pub red: Option, -} - -impl client::Part for RgbColor {} - - -/// A link to a Google resource (e.g., a file in Drive, a YouTube video, a Calendar event, etc.). -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RichLink { - /// Output only. The ID of this link. - #[serde(rename="richLinkId")] - pub rich_link_id: Option, - /// Output only. The properties of this RichLink. This field is always present. - #[serde(rename="richLinkProperties")] - pub rich_link_properties: Option, - /// IDs for suggestions that remove this link from the document. A RichLink might have multiple deletion IDs if, for example, multiple users suggest to delete it. If empty, then this person link isn't suggested for deletion. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// IDs for suggestions that insert this link into the document. A RichLink might have multiple insertion IDs if it is a nested suggested change (a suggestion within a suggestion made by a different user, for example). If empty, then this person link isn't a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this RichLink, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this RichLink. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for RichLink {} - - -/// Properties specific to a RichLink. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct RichLinkProperties { - /// Output only. The [MIME type](https://developers.google.com/drive/api/v3/mime-types) of the RichLink, if there is one (i.e., when it is a file in Drive). - #[serde(rename="mimeType")] - pub mime_type: Option, - /// Output only. The title of the RichLink as displayed in the link. This title matches the title of the linked resource at the time of the insertion or last update of the link. This field is always present. - pub title: Option, - /// Output only. The URI to the RichLink. This is always present. - pub uri: Option, -} - -impl client::Part for RichLinkProperties {} - - -/// A StructuralElement representing a section break. A section is a range of content which has the same SectionStyle. A section break represents the start of a new section, and the section style applies to the section after the section break. The document body always begins with a section break. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SectionBreak { - /// The style of the section after this section break. - #[serde(rename="sectionStyle")] - pub section_style: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A SectionBreak may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, -} - -impl client::Part for SectionBreak {} - - -/// Properties that apply to a section's column. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SectionColumnProperties { - /// The padding at the end of the column. - #[serde(rename="paddingEnd")] - pub padding_end: Option, - /// Output only. The width of the column. - pub width: Option, -} - -impl client::Part for SectionColumnProperties {} - - -/// The styling that applies to a section. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SectionStyle { - /// The section's columns properties. If empty, the section contains one column with the default properties in the Docs editor. A section can be updated to have no more than three columns. When updating this property, setting a concrete value is required. Unsetting this property will result in a 400 bad request error. - #[serde(rename="columnProperties")] - pub column_properties: Option>, - /// The style of column separators. This style can be set even when there is one column in the section. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="columnSeparatorStyle")] - pub column_separator_style: Option, - /// The content direction of this section. If unset, the value defaults to LEFT_TO_RIGHT. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="contentDirection")] - pub content_direction: Option, - /// The ID of the default footer. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's default_footer_id. This property is read-only. - #[serde(rename="defaultFooterId")] - pub default_footer_id: Option, - /// The ID of the default header. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's default_header_id. This property is read-only. - #[serde(rename="defaultHeaderId")] - pub default_header_id: Option, - /// The ID of the footer used only for even pages. If the value of DocumentStyle's use_even_page_header_footer is true, this value is used for the footers on even pages in the section. If it is false, the footers on even pages uses the default_footer_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's even_page_footer_id. This property is read-only. - #[serde(rename="evenPageFooterId")] - pub even_page_footer_id: Option, - /// The ID of the header used only for even pages. If the value of DocumentStyle's use_even_page_header_footer is true, this value is used for the headers on even pages in the section. If it is false, the headers on even pages uses the default_header_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's even_page_header_id. This property is read-only. - #[serde(rename="evenPageHeaderId")] - pub even_page_header_id: Option, - /// The ID of the footer used only for the first page of the section. If use_first_page_header_footer is true, this value is used for the footer on the first page of the section. If it is false, the footer on the first page of the section uses the default_footer_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's first_page_footer_id. This property is read-only. - #[serde(rename="firstPageFooterId")] - pub first_page_footer_id: Option, - /// The ID of the header used only for the first page of the section. If use_first_page_header_footer is true, this value is used for the header on the first page of the section. If it is false, the header on the first page of the section uses the default_header_id. If unset, the value inherits from the previous SectionBreak's SectionStyle. If the value is unset in the first SectionBreak, it inherits from DocumentStyle's first_page_header_id. This property is read-only. - #[serde(rename="firstPageHeaderId")] - pub first_page_header_id: Option, - /// The bottom page margin of the section. If unset, uses margin_bottom from DocumentStyle. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="marginBottom")] - pub margin_bottom: Option, - /// The footer margin of the section. If unset, uses margin_footer from DocumentStyle. If updated, use_custom_header_footer_margins is set to true on DocumentStyle. The value of use_custom_header_footer_margins on DocumentStyle indicates if a footer margin is being respected for this section When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="marginFooter")] - pub margin_footer: Option, - /// The header margin of the section. If unset, uses margin_header from DocumentStyle. If updated, use_custom_header_footer_margins is set to true on DocumentStyle. The value of use_custom_header_footer_margins on DocumentStyle indicates if a header margin is being respected for this section. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="marginHeader")] - pub margin_header: Option, - /// The left page margin of the section. If unset, uses margin_left from DocumentStyle. Updating left margin causes columns in this section to resize. Since the margin affects column width, it is applied before column properties. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="marginLeft")] - pub margin_left: Option, - /// The right page margin of the section. If unset, uses margin_right from DocumentStyle. Updating right margin causes columns in this section to resize. Since the margin affects column width, it is applied before column properties. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="marginRight")] - pub margin_right: Option, - /// The top page margin of the section. If unset, uses margin_top from DocumentStyle. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="marginTop")] - pub margin_top: Option, - /// The page number from which to start counting the number of pages for this section. If unset, page numbering continues from the previous section. If the value is unset in the first SectionBreak, refer to DocumentStyle's page_number_start. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="pageNumberStart")] - pub page_number_start: Option, - /// Output only. The type of section. - #[serde(rename="sectionType")] - pub section_type: Option, - /// Indicates whether to use the first page header / footer IDs for the first page of the section. If unset, it inherits from DocumentStyle's use_first_page_header_footer for the first section. If the value is unset for subsequent sectors, it should be interpreted as false. When updating this property, setting a concrete value is required. Unsetting this property results in a 400 bad request error. - #[serde(rename="useFirstPageHeaderFooter")] - pub use_first_page_header_footer: Option, -} - -impl client::Part for SectionStyle {} - - -/// The shading of a paragraph. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Shading { - /// The background color of this paragraph shading. - #[serde(rename="backgroundColor")] - pub background_color: Option, -} - -impl client::Part for Shading {} - - -/// A mask that indicates which of the fields on the base Shading have been changed in this suggested change. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct ShadingSuggestionState { - /// Indicates if there was a suggested change to the Shading. - #[serde(rename="backgroundColorSuggested")] - pub background_color_suggested: Option, -} - -impl client::Part for ShadingSuggestionState {} - - -/// A reference to a linked chart embedded from Google Sheets. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SheetsChartReference { - /// The ID of the specific chart in the Google Sheets spreadsheet that is embedded. - #[serde(rename="chartId")] - pub chart_id: Option, - /// The ID of the Google Sheets spreadsheet that contains the source chart. - #[serde(rename="spreadsheetId")] - pub spreadsheet_id: Option, -} - -impl client::Part for SheetsChartReference {} - - -/// A mask that indicates which of the fields on the base SheetsChartReference have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SheetsChartReferenceSuggestionState { - /// Indicates if there was a suggested change to chart_id. - #[serde(rename="chartIdSuggested")] - pub chart_id_suggested: Option, - /// Indicates if there was a suggested change to spreadsheet_id. - #[serde(rename="spreadsheetIdSuggested")] - pub spreadsheet_id_suggested: Option, -} - -impl client::Part for SheetsChartReferenceSuggestionState {} - - -/// A width and height. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Size { - /// The height of the object. - pub height: Option, - /// The width of the object. - pub width: Option, -} - -impl client::Part for Size {} - - -/// A mask that indicates which of the fields on the base Size have been changed in this suggestion. For any field set to true, the Size has a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SizeSuggestionState { - /// Indicates if there was a suggested change to height. - #[serde(rename="heightSuggested")] - pub height_suggested: Option, - /// Indicates if there was a suggested change to width. - #[serde(rename="widthSuggested")] - pub width_suggested: Option, -} - -impl client::Part for SizeSuggestionState {} - - -/// A StructuralElement describes content that provides structure to the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct StructuralElement { - /// The zero-based end index of this structural element, exclusive, in UTF-16 code units. - #[serde(rename="endIndex")] - pub end_index: Option, - /// A paragraph type of structural element. - pub paragraph: Option, - /// A section break type of structural element. - #[serde(rename="sectionBreak")] - pub section_break: Option, - /// The zero-based start index of this structural element, in UTF-16 code units. - #[serde(rename="startIndex")] - pub start_index: Option, - /// A table type of structural element. - pub table: Option, - /// A table of contents type of structural element. - #[serde(rename="tableOfContents")] - pub table_of_contents: Option, -} - -impl client::Part for StructuralElement {} - - -/// A criteria that matches a specific string of text in the document. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SubstringMatchCriteria { - /// Indicates whether the search should respect case: - `True`: the search is case sensitive. - `False`: the search is case insensitive. - #[serde(rename="matchCase")] - pub match_case: Option, - /// The text to search for in the document. - pub text: Option, -} - -impl client::Part for SubstringMatchCriteria {} - - -/// A suggested change to a Bullet. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedBullet { - /// A Bullet that only includes the changes made in this suggestion. This can be used along with the bullet_suggestion_state to see which fields have changed and their new values. - pub bullet: Option, - /// A mask that indicates which of the fields on the base Bullet have been changed in this suggestion. - #[serde(rename="bulletSuggestionState")] - pub bullet_suggestion_state: Option, -} - -impl client::Part for SuggestedBullet {} - - -/// A suggested change to the DocumentStyle. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedDocumentStyle { - /// A DocumentStyle that only includes the changes made in this suggestion. This can be used along with the document_style_suggestion_state to see which fields have changed and their new values. - #[serde(rename="documentStyle")] - pub document_style: Option, - /// A mask that indicates which of the fields on the base DocumentStyle have been changed in this suggestion. - #[serde(rename="documentStyleSuggestionState")] - pub document_style_suggestion_state: Option, -} - -impl client::Part for SuggestedDocumentStyle {} - - -/// A suggested change to InlineObjectProperties. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedInlineObjectProperties { - /// An InlineObjectProperties that only includes the changes made in this suggestion. This can be used along with the inline_object_properties_suggestion_state to see which fields have changed and their new values. - #[serde(rename="inlineObjectProperties")] - pub inline_object_properties: Option, - /// A mask that indicates which of the fields on the base InlineObjectProperties have been changed in this suggestion. - #[serde(rename="inlineObjectPropertiesSuggestionState")] - pub inline_object_properties_suggestion_state: Option, -} - -impl client::Part for SuggestedInlineObjectProperties {} - - -/// A suggested change to ListProperties. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedListProperties { - /// A ListProperties that only includes the changes made in this suggestion. This can be used along with the list_properties_suggestion_state to see which fields have changed and their new values. - #[serde(rename="listProperties")] - pub list_properties: Option, - /// A mask that indicates which of the fields on the base ListProperties have been changed in this suggestion. - #[serde(rename="listPropertiesSuggestionState")] - pub list_properties_suggestion_state: Option, -} - -impl client::Part for SuggestedListProperties {} - - -/// A suggested change to the NamedStyles. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedNamedStyles { - /// A NamedStyles that only includes the changes made in this suggestion. This can be used along with the named_styles_suggestion_state to see which fields have changed and their new values. - #[serde(rename="namedStyles")] - pub named_styles: Option, - /// A mask that indicates which of the fields on the base NamedStyles have been changed in this suggestion. - #[serde(rename="namedStylesSuggestionState")] - pub named_styles_suggestion_state: Option, -} - -impl client::Part for SuggestedNamedStyles {} - - -/// A suggested change to a ParagraphStyle. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedParagraphStyle { - /// A ParagraphStyle that only includes the changes made in this suggestion. This can be used along with the paragraph_suggestion_state to see which fields have changed and their new values. - #[serde(rename="paragraphStyle")] - pub paragraph_style: Option, - /// A mask that indicates which of the fields on the base ParagraphStyle have been changed in this suggestion. - #[serde(rename="paragraphStyleSuggestionState")] - pub paragraph_style_suggestion_state: Option, -} - -impl client::Part for SuggestedParagraphStyle {} - - -/// A suggested change to PositionedObjectProperties. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedPositionedObjectProperties { - /// A PositionedObjectProperties that only includes the changes made in this suggestion. This can be used along with the positioned_object_properties_suggestion_state to see which fields have changed and their new values. - #[serde(rename="positionedObjectProperties")] - pub positioned_object_properties: Option, - /// A mask that indicates which of the fields on the base PositionedObjectProperties have been changed in this suggestion. - #[serde(rename="positionedObjectPropertiesSuggestionState")] - pub positioned_object_properties_suggestion_state: Option, -} - -impl client::Part for SuggestedPositionedObjectProperties {} - - -/// A suggested change to a TableCellStyle. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedTableCellStyle { - /// A TableCellStyle that only includes the changes made in this suggestion. This can be used along with the table_cell_style_suggestion_state to see which fields have changed and their new values. - #[serde(rename="tableCellStyle")] - pub table_cell_style: Option, - /// A mask that indicates which of the fields on the base TableCellStyle have been changed in this suggestion. - #[serde(rename="tableCellStyleSuggestionState")] - pub table_cell_style_suggestion_state: Option, -} - -impl client::Part for SuggestedTableCellStyle {} - - -/// A suggested change to a TableRowStyle. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedTableRowStyle { - /// A TableRowStyle that only includes the changes made in this suggestion. This can be used along with the table_row_style_suggestion_state to see which fields have changed and their new values. - #[serde(rename="tableRowStyle")] - pub table_row_style: Option, - /// A mask that indicates which of the fields on the base TableRowStyle have been changed in this suggestion. - #[serde(rename="tableRowStyleSuggestionState")] - pub table_row_style_suggestion_state: Option, -} - -impl client::Part for SuggestedTableRowStyle {} - - -/// A suggested change to a TextStyle. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct SuggestedTextStyle { - /// A TextStyle that only includes the changes made in this suggestion. This can be used along with the text_style_suggestion_state to see which fields have changed and their new values. - #[serde(rename="textStyle")] - pub text_style: Option, - /// A mask that indicates which of the fields on the base TextStyle have been changed in this suggestion. - #[serde(rename="textStyleSuggestionState")] - pub text_style_suggestion_state: Option, -} - -impl client::Part for SuggestedTextStyle {} - - -/// A tab stop within a paragraph. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TabStop { - /// The alignment of this tab stop. If unset, the value defaults to START. - pub alignment: Option, - /// The offset between this tab stop and the start margin. - pub offset: Option, -} - -impl client::Part for TabStop {} - - -/// A StructuralElement representing a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct Table { - /// Number of columns in the table. It is possible for a table to be non-rectangular, so some rows may have a different number of cells. - pub columns: Option, - /// Number of rows in the table. - pub rows: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A Table may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The contents and style of each row. - #[serde(rename="tableRows")] - pub table_rows: Option>, - /// The style of the table. - #[serde(rename="tableStyle")] - pub table_style: Option, -} - -impl client::Part for Table {} - - -/// The contents and style of a cell in a Table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableCell { - /// The content of the cell. - pub content: Option>, - /// The zero-based end index of this cell, exclusive, in UTF-16 code units. - #[serde(rename="endIndex")] - pub end_index: Option, - /// The zero-based start index of this cell, in UTF-16 code units. - #[serde(rename="startIndex")] - pub start_index: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A TableCell may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested changes to the table cell style, keyed by suggestion ID. - #[serde(rename="suggestedTableCellStyleChanges")] - pub suggested_table_cell_style_changes: Option>, - /// The style of the cell. - #[serde(rename="tableCellStyle")] - pub table_cell_style: Option, -} - -impl client::Part for TableCell {} - - -/// A border around a table cell. Table cell borders cannot be transparent. To hide a table cell border, make its width 0. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableCellBorder { - /// The color of the border. This color cannot be transparent. - pub color: Option, - /// The dash style of the border. - #[serde(rename="dashStyle")] - pub dash_style: Option, - /// The width of the border. - pub width: Option, -} - -impl client::Part for TableCellBorder {} - - -/// Location of a single cell within a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableCellLocation { - /// The zero-based column index. For example, the second column in the table has a column index of 1. - #[serde(rename="columnIndex")] - pub column_index: Option, - /// The zero-based row index. For example, the second row in the table has a row index of 1. - #[serde(rename="rowIndex")] - pub row_index: Option, - /// The location where the table starts in the document. - #[serde(rename="tableStartLocation")] - pub table_start_location: Option, -} - -impl client::Part for TableCellLocation {} - - -/// The style of a TableCell. Inherited table cell styles are represented as unset fields in this message. A table cell style can inherit from the table's style. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableCellStyle { - /// The background color of the cell. - #[serde(rename="backgroundColor")] - pub background_color: Option, - /// The bottom border of the cell. - #[serde(rename="borderBottom")] - pub border_bottom: Option, - /// The left border of the cell. - #[serde(rename="borderLeft")] - pub border_left: Option, - /// The right border of the cell. - #[serde(rename="borderRight")] - pub border_right: Option, - /// The top border of the cell. - #[serde(rename="borderTop")] - pub border_top: Option, - /// The column span of the cell. This property is read-only. - #[serde(rename="columnSpan")] - pub column_span: Option, - /// The alignment of the content in the table cell. The default alignment matches the alignment for newly created table cells in the Docs editor. - #[serde(rename="contentAlignment")] - pub content_alignment: Option, - /// The bottom padding of the cell. - #[serde(rename="paddingBottom")] - pub padding_bottom: Option, - /// The left padding of the cell. - #[serde(rename="paddingLeft")] - pub padding_left: Option, - /// The right padding of the cell. - #[serde(rename="paddingRight")] - pub padding_right: Option, - /// The top padding of the cell. - #[serde(rename="paddingTop")] - pub padding_top: Option, - /// The row span of the cell. This property is read-only. - #[serde(rename="rowSpan")] - pub row_span: Option, -} - -impl client::Part for TableCellStyle {} - - -/// A mask that indicates which of the fields on the base TableCellStyle have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableCellStyleSuggestionState { - /// Indicates if there was a suggested change to background_color. - #[serde(rename="backgroundColorSuggested")] - pub background_color_suggested: Option, - /// Indicates if there was a suggested change to border_bottom. - #[serde(rename="borderBottomSuggested")] - pub border_bottom_suggested: Option, - /// Indicates if there was a suggested change to border_left. - #[serde(rename="borderLeftSuggested")] - pub border_left_suggested: Option, - /// Indicates if there was a suggested change to border_right. - #[serde(rename="borderRightSuggested")] - pub border_right_suggested: Option, - /// Indicates if there was a suggested change to border_top. - #[serde(rename="borderTopSuggested")] - pub border_top_suggested: Option, - /// Indicates if there was a suggested change to column_span. - #[serde(rename="columnSpanSuggested")] - pub column_span_suggested: Option, - /// Indicates if there was a suggested change to content_alignment. - #[serde(rename="contentAlignmentSuggested")] - pub content_alignment_suggested: Option, - /// Indicates if there was a suggested change to padding_bottom. - #[serde(rename="paddingBottomSuggested")] - pub padding_bottom_suggested: Option, - /// Indicates if there was a suggested change to padding_left. - #[serde(rename="paddingLeftSuggested")] - pub padding_left_suggested: Option, - /// Indicates if there was a suggested change to padding_right. - #[serde(rename="paddingRightSuggested")] - pub padding_right_suggested: Option, - /// Indicates if there was a suggested change to padding_top. - #[serde(rename="paddingTopSuggested")] - pub padding_top_suggested: Option, - /// Indicates if there was a suggested change to row_span. - #[serde(rename="rowSpanSuggested")] - pub row_span_suggested: Option, -} - -impl client::Part for TableCellStyleSuggestionState {} - - -/// The properties of a column in a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableColumnProperties { - /// The width of the column. Set when the column's `width_type` is FIXED_WIDTH. - pub width: Option, - /// The width type of the column. - #[serde(rename="widthType")] - pub width_type: Option, -} - -impl client::Part for TableColumnProperties {} - - -/// A StructuralElement representing a table of contents. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableOfContents { - /// The content of the table of contents. - pub content: Option>, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A TableOfContents may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, -} - -impl client::Part for TableOfContents {} - - -/// A table range represents a reference to a subset of a table. It's important to note that the cells specified by a table range do not necessarily form a rectangle. For example, let's say we have a 3 x 3 table where all the cells of the last row are merged together. The table looks like this: [ ] A table range with table cell location = (table_start_location, row = 0, column = 0), row span = 3 and column span = 2 specifies the following cells: x x [ x x x ] -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableRange { - /// The column span of the table range. - #[serde(rename="columnSpan")] - pub column_span: Option, - /// The row span of the table range. - #[serde(rename="rowSpan")] - pub row_span: Option, - /// The cell location where the table range starts. - #[serde(rename="tableCellLocation")] - pub table_cell_location: Option, -} - -impl client::Part for TableRange {} - - -/// The contents and style of a row in a Table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableRow { - /// The zero-based end index of this row, exclusive, in UTF-16 code units. - #[serde(rename="endIndex")] - pub end_index: Option, - /// The zero-based start index of this row, in UTF-16 code units. - #[serde(rename="startIndex")] - pub start_index: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A TableRow may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested style changes to this row, keyed by suggestion ID. - #[serde(rename="suggestedTableRowStyleChanges")] - pub suggested_table_row_style_changes: Option>, - /// The contents and style of each cell in this row. It is possible for a table to be non-rectangular, so some rows may have a different number of cells than other rows in the same table. - #[serde(rename="tableCells")] - pub table_cells: Option>, - /// The style of the table row. - #[serde(rename="tableRowStyle")] - pub table_row_style: Option, -} - -impl client::Part for TableRow {} - - -/// Styles that apply to a table row. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableRowStyle { - /// The minimum height of the row. The row will be rendered in the Docs editor at a height equal to or greater than this value in order to show all the content in the row's cells. - #[serde(rename="minRowHeight")] - pub min_row_height: Option, -} - -impl client::Part for TableRowStyle {} - - -/// A mask that indicates which of the fields on the base TableRowStyle have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableRowStyleSuggestionState { - /// Indicates if there was a suggested change to min_row_height. - #[serde(rename="minRowHeightSuggested")] - pub min_row_height_suggested: Option, -} - -impl client::Part for TableRowStyleSuggestionState {} - - -/// Styles that apply to a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TableStyle { - /// The properties of each column. Note that in Docs, tables contain rows and rows contain cells, similar to HTML. So the properties for a row can be found on the row's table_row_style. - #[serde(rename="tableColumnProperties")] - pub table_column_properties: Option>, -} - -impl client::Part for TableStyle {} - - -/// A ParagraphElement that represents a run of text that all has the same styling. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TextRun { - /// The text of this run. Any non-text elements in the run are replaced with the Unicode character U+E907. - pub content: Option, - /// The suggested deletion IDs. If empty, then there are no suggested deletions of this content. - #[serde(rename="suggestedDeletionIds")] - pub suggested_deletion_ids: Option>, - /// The suggested insertion IDs. A TextRun may have multiple insertion IDs if it is a nested suggested change. If empty, then this is not a suggested insertion. - #[serde(rename="suggestedInsertionIds")] - pub suggested_insertion_ids: Option>, - /// The suggested text style changes to this run, keyed by suggestion ID. - #[serde(rename="suggestedTextStyleChanges")] - pub suggested_text_style_changes: Option>, - /// The text style of this run. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for TextRun {} - - -/// Represents the styling that can be applied to text. Inherited text styles are represented as unset fields in this message. A text style's parent depends on where the text style is defined: * The TextStyle of text in a Paragraph inherits from the paragraph's corresponding named style type. * The TextStyle on a named style inherits from the normal text named style. * The TextStyle of the normal text named style inherits from the default text style in the Docs editor. * The TextStyle on a Paragraph element that is contained in a table may inherit its text style from the table style. If the text style does not inherit from a parent, unsetting fields will revert the style to a value matching the defaults in the Docs editor. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TextStyle { - /// The background color of the text. If set, the color is either an RGB color or transparent, depending on the `color` field. - #[serde(rename="backgroundColor")] - pub background_color: Option, - /// The text's vertical offset from its normal position. Text with `SUPERSCRIPT` or `SUBSCRIPT` baseline offsets is automatically rendered in a smaller font size, computed based on the `font_size` field. The `font_size` itself is not affected by changes in this field. - #[serde(rename="baselineOffset")] - pub baseline_offset: Option, - /// Whether or not the text is rendered as bold. - pub bold: Option, - /// The size of the text's font. - #[serde(rename="fontSize")] - pub font_size: Option, - /// The foreground color of the text. If set, the color is either an RGB color or transparent, depending on the `color` field. - #[serde(rename="foregroundColor")] - pub foreground_color: Option, - /// Whether or not the text is italicized. - pub italic: Option, - /// The hyperlink destination of the text. If unset, there is no link. Links are not inherited from parent text. Changing the link in an update request causes some other changes to the text style of the range: * When setting a link, the text foreground color will be updated to the default link color and the text will be underlined. If these fields are modified in the same request, those values will be used instead of the link defaults. * Setting a link on a text range that overlaps with an existing link will also update the existing link to point to the new URL. * Links are not settable on newline characters. As a result, setting a link on a text range that crosses a paragraph boundary, such as `"ABC\n123"`, will separate the newline character(s) into their own text runs. The link will be applied separately to the runs before and after the newline. * Removing a link will update the text style of the range to match the style of the preceding text (or the default text styles if the preceding text is another link) unless different styles are being set in the same request. - pub link: Option, - /// Whether or not the text is in small capital letters. - #[serde(rename="smallCaps")] - pub small_caps: Option, - /// Whether or not the text is struck through. - pub strikethrough: Option, - /// Whether or not the text is underlined. - pub underline: Option, - /// The font family and rendered weight of the text. If an update request specifies values for both `weighted_font_family` and `bold`, the `weighted_font_family` is applied first, then `bold`. If `weighted_font_family#weight` is not set, it defaults to `400`. If `weighted_font_family` is set, then `weighted_font_family#font_family` must also be set with a non-empty value. Otherwise, a 400 bad request error is returned. - #[serde(rename="weightedFontFamily")] - pub weighted_font_family: Option, -} - -impl client::Part for TextStyle {} - - -/// A mask that indicates which of the fields on the base TextStyle have been changed in this suggestion. For any field set to true, there is a new suggested value. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct TextStyleSuggestionState { - /// Indicates if there was a suggested change to background_color. - #[serde(rename="backgroundColorSuggested")] - pub background_color_suggested: Option, - /// Indicates if there was a suggested change to baseline_offset. - #[serde(rename="baselineOffsetSuggested")] - pub baseline_offset_suggested: Option, - /// Indicates if there was a suggested change to bold. - #[serde(rename="boldSuggested")] - pub bold_suggested: Option, - /// Indicates if there was a suggested change to font_size. - #[serde(rename="fontSizeSuggested")] - pub font_size_suggested: Option, - /// Indicates if there was a suggested change to foreground_color. - #[serde(rename="foregroundColorSuggested")] - pub foreground_color_suggested: Option, - /// Indicates if there was a suggested change to italic. - #[serde(rename="italicSuggested")] - pub italic_suggested: Option, - /// Indicates if there was a suggested change to link. - #[serde(rename="linkSuggested")] - pub link_suggested: Option, - /// Indicates if there was a suggested change to small_caps. - #[serde(rename="smallCapsSuggested")] - pub small_caps_suggested: Option, - /// Indicates if there was a suggested change to strikethrough. - #[serde(rename="strikethroughSuggested")] - pub strikethrough_suggested: Option, - /// Indicates if there was a suggested change to underline. - #[serde(rename="underlineSuggested")] - pub underline_suggested: Option, - /// Indicates if there was a suggested change to weighted_font_family. - #[serde(rename="weightedFontFamilySuggested")] - pub weighted_font_family_suggested: Option, -} - -impl client::Part for TextStyleSuggestionState {} - - -/// Unmerges cells in a Table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UnmergeTableCellsRequest { - /// The table range specifying which cells of the table to unmerge. All merged cells in this range will be unmerged, and cells that are already unmerged will not be affected. If the range has no merged cells, the request will do nothing. If there is text in any of the merged cells, the text will remain in the "head" cell of the resulting block of unmerged cells. The "head" cell is the upper-left cell when the content direction is from left to right, and the upper-right otherwise. - #[serde(rename="tableRange")] - pub table_range: Option, -} - -impl client::Part for UnmergeTableCellsRequest {} - - -/// Updates the DocumentStyle. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateDocumentStyleRequest { - /// The styles to set on the document. Certain document style changes may cause other changes in order to mirror the behavior of the Docs editor. See the documentation of DocumentStyle for more information. - #[serde(rename="documentStyle")] - pub document_style: Option, - /// The fields that should be updated. At least one field must be specified. The root `document_style` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field. For example to update the background, set `fields` to `"background"`. - pub fields: Option, -} - -impl client::Part for UpdateDocumentStyleRequest {} - - -/// Update the styling of all paragraphs that overlap with the given range. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateParagraphStyleRequest { - /// The fields that should be updated. At least one field must be specified. The root `paragraph_style` is implied and should not be specified. For example, to update the paragraph style's alignment property, set `fields` to `"alignment"`. To reset a property to its default value, include its field name in the field mask but leave the field itself unset. - pub fields: Option, - /// The styles to set on the paragraphs. Certain paragraph style changes may cause other changes in order to mirror the behavior of the Docs editor. See the documentation of ParagraphStyle for more information. - #[serde(rename="paragraphStyle")] - pub paragraph_style: Option, - /// The range overlapping the paragraphs to style. - pub range: Option, -} - -impl client::Part for UpdateParagraphStyleRequest {} - - -/// Updates the SectionStyle. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateSectionStyleRequest { - /// The fields that should be updated. At least one field must be specified. The root `section_style` is implied and must not be specified. A single `"*"` can be used as short-hand for listing every field. For example to update the left margin, set `fields` to `"margin_left"`. - pub fields: Option, - /// The range overlapping the sections to style. Because section breaks can only be inserted inside the body, the segment ID field must be empty. - pub range: Option, - /// The styles to be set on the section. Certain section style changes may cause other changes in order to mirror the behavior of the Docs editor. See the documentation of SectionStyle for more information. - #[serde(rename="sectionStyle")] - pub section_style: Option, -} - -impl client::Part for UpdateSectionStyleRequest {} - - -/// Updates the style of a range of table cells. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateTableCellStyleRequest { - /// The fields that should be updated. At least one field must be specified. The root `tableCellStyle` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field. For example to update the table cell background color, set `fields` to `"backgroundColor"`. To reset a property to its default value, include its field name in the field mask but leave the field itself unset. - pub fields: Option, - /// The style to set on the table cells. When updating borders, if a cell shares a border with an adjacent cell, the corresponding border property of the adjacent cell is updated as well. Borders that are merged and invisible are not updated. Since updating a border shared by adjacent cells in the same request can cause conflicting border updates, border updates are applied in the following order: - `border_right` - `border_left` - `border_bottom` - `border_top` - #[serde(rename="tableCellStyle")] - pub table_cell_style: Option, - /// The table range representing the subset of the table to which the updates are applied. - #[serde(rename="tableRange")] - pub table_range: Option, - /// The location where the table starts in the document. When specified, the updates are applied to all the cells in the table. - #[serde(rename="tableStartLocation")] - pub table_start_location: Option, -} - -impl client::Part for UpdateTableCellStyleRequest {} - - -/// Updates the TableColumnProperties of columns in a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateTableColumnPropertiesRequest { - /// The list of zero-based column indices whose property should be updated. If no indices are specified, all columns will be updated. - #[serde(rename="columnIndices")] - pub column_indices: Option>, - /// The fields that should be updated. At least one field must be specified. The root `tableColumnProperties` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field. For example to update the column width, set `fields` to `"width"`. - pub fields: Option, - /// The table column properties to update. If the value of `table_column_properties#width` is less than 5 points (5/72 inch), a 400 bad request error is returned. - #[serde(rename="tableColumnProperties")] - pub table_column_properties: Option, - /// The location where the table starts in the document. - #[serde(rename="tableStartLocation")] - pub table_start_location: Option, -} - -impl client::Part for UpdateTableColumnPropertiesRequest {} - - -/// Updates the TableRowStyle of rows in a table. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateTableRowStyleRequest { - /// The fields that should be updated. At least one field must be specified. The root `tableRowStyle` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field. For example to update the minimum row height, set `fields` to `"min_row_height"`. - pub fields: Option, - /// The list of zero-based row indices whose style should be updated. If no indices are specified, all rows will be updated. - #[serde(rename="rowIndices")] - pub row_indices: Option>, - /// The styles to be set on the rows. - #[serde(rename="tableRowStyle")] - pub table_row_style: Option, - /// The location where the table starts in the document. - #[serde(rename="tableStartLocation")] - pub table_start_location: Option, -} - -impl client::Part for UpdateTableRowStyleRequest {} - - -/// Update the styling of text. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct UpdateTextStyleRequest { - /// The fields that should be updated. At least one field must be specified. The root `text_style` is implied and should not be specified. A single `"*"` can be used as short-hand for listing every field. For example, to update the text style to bold, set `fields` to `"bold"`. To reset a property to its default value, include its field name in the field mask but leave the field itself unset. - pub fields: Option, - /// The range of text to style. The range may be extended to include adjacent newlines. If the range fully contains a paragraph belonging to a list, the paragraph's bullet is also updated with the matching text style. Ranges cannot be inserted inside a relative UpdateTextStyleRequest. - pub range: Option, - /// The styles to set on the text. If the value for a particular style matches that of the parent, that style will be set to inherit. Certain text style changes may cause other changes in order to to mirror the behavior of the Docs editor. See the documentation of TextStyle for more information. - #[serde(rename="textStyle")] - pub text_style: Option, -} - -impl client::Part for UpdateTextStyleRequest {} - - -/// Represents a font family and weight of text. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WeightedFontFamily { - /// The font family of the text. The font family can be any font from the Font menu in Docs or from [Google Fonts] (https://fonts.google.com/). If the font name is unrecognized, the text is rendered in `Arial`. - #[serde(rename="fontFamily")] - pub font_family: Option, - /// The weight of the font. This field can have any value that is a multiple of `100` between `100` and `900`, inclusive. This range corresponds to the numerical values described in the CSS 2.1 Specification, [section 15.6](https://www.w3.org/TR/CSS21/fonts.html#font-boldness), with non-numerical values disallowed. The default value is `400` ("normal"). The font weight makes up just one component of the rendered font weight. The rendered weight is determined by a combination of the `weight` and the text style's resolved `bold` value, after accounting for inheritance: * If the text is bold and the weight is less than `400`, the rendered weight is 400. * If the text is bold and the weight is greater than or equal to `400` but is less than `700`, the rendered weight is `700`. * If the weight is greater than or equal to `700`, the rendered weight is equal to the weight. * If the text is not bold, the rendered weight is equal to the weight. - pub weight: Option, -} - -impl client::Part for WeightedFontFamily {} - - -/// Provides control over how write requests are executed. -/// -/// This type is not used in any activity, and only used as *part* of another schema. -/// -#[derive(Default, Clone, Debug, Serialize, Deserialize)] -pub struct WriteControl { - /// The revision ID of the document that the write request will be applied to. If this is not the latest revision of the document, the request will not be processed and will return a 400 bad request error. When a required revision ID is returned in a response, it indicates the revision ID of the document after the request was applied. - #[serde(rename="requiredRevisionId")] - pub required_revision_id: Option, - /// The target revision ID of the document that the write request will be applied to. If collaborator changes have occurred after the document was read using the API, the changes produced by this write request will be transformed against the collaborator changes. This results in a new revision of the document which incorporates both the changes in the request and the collaborator changes, and the Docs server will resolve conflicting changes. When using `target_revision_id`, the API client can be thought of as another collaborator of the document. The target revision ID may only be used to write to recent versions of a document. If the target revision is too far behind the latest revision, the request will not be processed and will return a 400 bad request error and the request should be retried after reading the latest version of the document. In most cases a `revision_id` will remain valid for use as a target revision for several minutes after it is read, but for frequently-edited documents this window may be shorter. - #[serde(rename="targetRevisionId")] - pub target_revision_id: Option, -} - -impl client::Part for WriteControl {} +impl client::ResponseResult for ResponsePolicyRulesUpdateResponse {} @@ -3501,8 +1419,8 @@ impl client::Part for WriteControl {} // MethodBuilders ### // ################# -/// A builder providing access to all methods supported on *document* resources. -/// It is not used directly, but through the `Docs` hub. +/// A builder providing access to all methods supported on *change* resources. +/// It is not used directly, but through the `Dns` hub. /// /// # Example /// @@ -3511,47 +1429,52 @@ impl client::Part for WriteControl {} /// ```test_harness,no_run /// extern crate hyper; /// extern crate hyper_rustls; -/// extern crate google_docs1 as docs1; +/// extern crate google_dns2 as dns2; /// /// # async fn dox() { /// use std::default::Default; -/// use docs1::{Docs, oauth2, hyper, hyper_rustls}; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; /// /// let secret: oauth2::ApplicationSecret = Default::default(); /// let auth = oauth2::InstalledFlowAuthenticator::builder( /// secret, /// oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// ).build().await.unwrap(); -/// let mut hub = Docs::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* -/// // like `batch_update(...)`, `create(...)` and `get(...)` +/// // like `create(...)`, `get(...)` and `list(...)` /// // to build up your call. -/// let rb = hub.documents(); +/// let rb = hub.changes(); /// # } /// ``` -pub struct DocumentMethods<'a> - where { +pub struct ChangeMethods<'a, S> + where S: 'a { - hub: &'a Docs<>, + hub: &'a Dns, } -impl<'a> client::MethodsBuilder for DocumentMethods<'a> {} +impl<'a, S> client::MethodsBuilder for ChangeMethods<'a, S> {} -impl<'a> DocumentMethods<'a> { +impl<'a, S> ChangeMethods<'a, S> { /// Create a builder to help you perform the following task: /// - /// Applies one or more updates to the document. Each request is validated before being applied. If any request is not valid, then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. Other requests do not need to return information; these each return an empty reply. The order of replies matches that of the requests. For example, suppose you call batchUpdate with four updates, and only the third one returns information. The response would have two empty replies, the reply to the third request, and another empty reply, in that order. Because other users may be editing the document, the document might not exactly reflect your changes: your changes may be altered with respect to collaborator changes. If there are no collaborators, the document should reflect your changes. In any case, the updates in your request are guaranteed to be applied together atomically. + /// Atomically updates the ResourceRecordSet collection. /// /// # Arguments /// /// * `request` - No description provided. - /// * `documentId` - The ID of the document to update. - pub fn batch_update(&self, request: BatchUpdateDocumentRequest, document_id: &str) -> DocumentBatchUpdateCall<'a> { - DocumentBatchUpdateCall { + /// * `project` - Identifies the project addressed by this request. + /// * `location` - No description provided. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn create(&self, request: Change, project: &str, location: &str, managed_zone: &str) -> ChangeCreateCall<'a, S> { + ChangeCreateCall { hub: self.hub, _request: request, - _document_id: document_id.to_string(), + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _client_operation_id: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), @@ -3560,15 +1483,22 @@ impl<'a> DocumentMethods<'a> { /// Create a builder to help you perform the following task: /// - /// Creates a blank document using the title given in the request. Other fields in the request, including any provided content, are ignored. Returns the created document. + /// Fetches the representation of an existing Change. /// /// # Arguments /// - /// * `request` - No description provided. - pub fn create(&self, request: Document) -> DocumentCreateCall<'a> { - DocumentCreateCall { + /// * `project` - Identifies the project addressed by this request. + /// * `location` - No description provided. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// * `changeId` - The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse. + pub fn get(&self, project: &str, location: &str, managed_zone: &str, change_id: &str) -> ChangeGetCall<'a, S> { + ChangeGetCall { hub: self.hub, - _request: request, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _change_id: change_id.to_string(), + _client_operation_id: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), @@ -3577,16 +1507,1150 @@ impl<'a> DocumentMethods<'a> { /// Create a builder to help you perform the following task: /// - /// Gets the latest version of the specified document. + /// Enumerates Changes to a ResourceRecordSet collection. /// /// # Arguments /// - /// * `documentId` - The ID of the document to retrieve. - pub fn get(&self, document_id: &str) -> DocumentGetCall<'a> { - DocumentGetCall { + /// * `project` - Identifies the project addressed by this request. + /// * `location` - No description provided. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn list(&self, project: &str, location: &str, managed_zone: &str) -> ChangeListCall<'a, S> { + ChangeListCall { hub: self.hub, - _document_id: document_id.to_string(), - _suggestions_view_mode: Default::default(), + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _sort_order: Default::default(), + _sort_by: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *dnsKey* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.dns_keys(); +/// # } +/// ``` +pub struct DnsKeyMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for DnsKeyMethods<'a, S> {} + +impl<'a, S> DnsKeyMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing DnsKey. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// * `dnsKeyId` - The identifier of the requested DnsKey. + pub fn get(&self, project: &str, location: &str, managed_zone: &str, dns_key_id: &str) -> DnsKeyGetCall<'a, S> { + DnsKeyGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _dns_key_id: dns_key_id.to_string(), + _digest_type: Default::default(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enumerates DnsKeys to a ResourceRecordSet collection. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn list(&self, project: &str, location: &str, managed_zone: &str) -> DnsKeyListCall<'a, S> { + DnsKeyListCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _digest_type: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *managedZoneOperation* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` and `list(...)` +/// // to build up your call. +/// let rb = hub.managed_zone_operations(); +/// # } +/// ``` +pub struct ManagedZoneOperationMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for ManagedZoneOperationMethods<'a, S> {} + +impl<'a, S> ManagedZoneOperationMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing Operation. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. + /// * `operation` - Identifies the operation addressed by this request (ID of the operation). + pub fn get(&self, project: &str, location: &str, managed_zone: &str, operation: &str) -> ManagedZoneOperationGetCall<'a, S> { + ManagedZoneOperationGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _operation: operation.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enumerates Operations for the given ManagedZone. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. + pub fn list(&self, project: &str, location: &str, managed_zone: &str) -> ManagedZoneOperationListCall<'a, S> { + ManagedZoneOperationListCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _sort_by: Default::default(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *managedZone* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.managed_zones(); +/// # } +/// ``` +pub struct ManagedZoneMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for ManagedZoneMethods<'a, S> {} + +impl<'a, S> ManagedZoneMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a new ManagedZone. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + pub fn create(&self, request: ManagedZone, project: &str, location: &str) -> ManagedZoneCreateCall<'a, S> { + ManagedZoneCreateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a previously created ManagedZone. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn delete(&self, project: &str, location: &str, managed_zone: &str) -> ManagedZoneDeleteCall<'a, S> { + ManagedZoneDeleteCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing ManagedZone. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn get(&self, project: &str, location: &str, managed_zone: &str) -> ManagedZoneGetCall<'a, S> { + ManagedZoneGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enumerates ManagedZones that have been created but not yet deleted. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + pub fn list(&self, project: &str, location: &str) -> ManagedZoneListCall<'a, S> { + ManagedZoneListCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _dns_name: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Applies a partial update to an existing ManagedZone. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn patch(&self, request: ManagedZone, project: &str, location: &str, managed_zone: &str) -> ManagedZonePatchCall<'a, S> { + ManagedZonePatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing ManagedZone. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn update(&self, request: ManagedZone, project: &str, location: &str, managed_zone: &str) -> ManagedZoneUpdateCall<'a, S> { + ManagedZoneUpdateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *policy* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.policies(); +/// # } +/// ``` +pub struct PolicyMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for PolicyMethods<'a, S> {} + +impl<'a, S> PolicyMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a new Policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + pub fn create(&self, request: Policy, project: &str, location: &str) -> PolicyCreateCall<'a, S> { + PolicyCreateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a previously created Policy. Fails if the policy is still being referenced by a network. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `policy` - User given friendly name of the policy addressed by this request. + pub fn delete(&self, project: &str, location: &str, policy: &str) -> PolicyDeleteCall<'a, S> { + PolicyDeleteCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _policy: policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing Policy. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `policy` - User given friendly name of the policy addressed by this request. + pub fn get(&self, project: &str, location: &str, policy: &str) -> PolicyGetCall<'a, S> { + PolicyGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _policy: policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enumerates all Policies associated with a project. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + pub fn list(&self, project: &str, location: &str) -> PolicyListCall<'a, S> { + PolicyListCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Applies a partial update to an existing Policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `policy` - User given friendly name of the policy addressed by this request. + pub fn patch(&self, request: Policy, project: &str, location: &str, policy: &str) -> PolicyPatchCall<'a, S> { + PolicyPatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _policy: policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing Policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `policy` - User given friendly name of the policy addressed by this request. + pub fn update(&self, request: Policy, project: &str, location: &str, policy: &str) -> PolicyUpdateCall<'a, S> { + PolicyUpdateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _policy: policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *project* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `get(...)` +/// // to build up your call. +/// let rb = hub.projects(); +/// # } +/// ``` +pub struct ProjectMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for ProjectMethods<'a, S> {} + +impl<'a, S> ProjectMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing Project. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - No description provided. + pub fn get(&self, project: &str, location: &str) -> ProjectGetCall<'a, S> { + ProjectGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *resourceRecordSet* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)` and `patch(...)` +/// // to build up your call. +/// let rb = hub.resource_record_sets(); +/// # } +/// ``` +pub struct ResourceRecordSetMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for ResourceRecordSetMethods<'a, S> {} + +impl<'a, S> ResourceRecordSetMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a new ResourceRecordSet. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn create(&self, request: ResourceRecordSet, project: &str, location: &str, managed_zone: &str) -> ResourceRecordSetCreateCall<'a, S> { + ResourceRecordSetCreateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a previously created ResourceRecordSet. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// * `name` - Fully qualified domain name. + /// * `type` - RRSet type. + pub fn delete(&self, project: &str, location: &str, managed_zone: &str, name: &str, type_: &str) -> ResourceRecordSetDeleteCall<'a, S> { + ResourceRecordSetDeleteCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _name: name.to_string(), + _type_: type_.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing ResourceRecordSet. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// * `name` - Fully qualified domain name. + /// * `type` - RRSet type. + pub fn get(&self, project: &str, location: &str, managed_zone: &str, name: &str, type_: &str) -> ResourceRecordSetGetCall<'a, S> { + ResourceRecordSetGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _name: name.to_string(), + _type_: type_.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enumerates ResourceRecordSets that you have created but not yet deleted. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + pub fn list(&self, project: &str, location: &str, managed_zone: &str) -> ResourceRecordSetListCall<'a, S> { + ResourceRecordSetListCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _type_: Default::default(), + _page_token: Default::default(), + _name: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Applies a partial update to an existing ResourceRecordSet. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// * `name` - Fully qualified domain name. + /// * `type` - RRSet type. + pub fn patch(&self, request: ResourceRecordSet, project: &str, location: &str, managed_zone: &str, name: &str, type_: &str) -> ResourceRecordSetPatchCall<'a, S> { + ResourceRecordSetPatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _managed_zone: managed_zone.to_string(), + _name: name.to_string(), + _type_: type_.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *responsePolicy* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.response_policies(); +/// # } +/// ``` +pub struct ResponsePolicyMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for ResponsePolicyMethods<'a, S> {} + +impl<'a, S> ResponsePolicyMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a new Response Policy + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource, only applicable in the v APIs. This information will be used for routing and will be part of the resource name. + pub fn create(&self, request: ResponsePolicy, project: &str, location: &str) -> ResponsePolicyCreateCall<'a, S> { + ResponsePolicyCreateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a previously created Response Policy. Fails if the response policy is non-empty or still being referenced by a network. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy addressed by this request. + pub fn delete(&self, project: &str, location: &str, response_policy: &str) -> ResponsePolicyDeleteCall<'a, S> { + ResponsePolicyDeleteCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing Response Policy. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy addressed by this request. + pub fn get(&self, project: &str, location: &str, response_policy: &str) -> ResponsePolicyGetCall<'a, S> { + ResponsePolicyGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enumerates all Response Policies associated with a project. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + pub fn list(&self, project: &str, location: &str) -> ResponsePolicyListCall<'a, S> { + ResponsePolicyListCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Applies a partial update to an existing Response Policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Respones Policy addressed by this request. + pub fn patch(&self, request: ResponsePolicy, project: &str, location: &str, response_policy: &str) -> ResponsePolicyPatchCall<'a, S> { + ResponsePolicyPatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing Response Policy. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy addressed by this request. + pub fn update(&self, request: ResponsePolicy, project: &str, location: &str, response_policy: &str) -> ResponsePolicyUpdateCall<'a, S> { + ResponsePolicyUpdateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } +} + + + +/// A builder providing access to all methods supported on *responsePolicyRule* resources. +/// It is not used directly, but through the `Dns` hub. +/// +/// # Example +/// +/// Instantiate a resource builder +/// +/// ```test_harness,no_run +/// extern crate hyper; +/// extern crate hyper_rustls; +/// extern crate google_dns2 as dns2; +/// +/// # async fn dox() { +/// use std::default::Default; +/// use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// let secret: oauth2::ApplicationSecret = Default::default(); +/// let auth = oauth2::InstalledFlowAuthenticator::builder( +/// secret, +/// oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// ).build().await.unwrap(); +/// let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* +/// // like `create(...)`, `delete(...)`, `get(...)`, `list(...)`, `patch(...)` and `update(...)` +/// // to build up your call. +/// let rb = hub.response_policy_rules(); +/// # } +/// ``` +pub struct ResponsePolicyRuleMethods<'a, S> + where S: 'a { + + hub: &'a Dns, +} + +impl<'a, S> client::MethodsBuilder for ResponsePolicyRuleMethods<'a, S> {} + +impl<'a, S> ResponsePolicyRuleMethods<'a, S> { + + /// Create a builder to help you perform the following task: + /// + /// Creates a new Response Policy Rule. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy containing the Response Policy Rule. + pub fn create(&self, request: ResponsePolicyRule, project: &str, location: &str, response_policy: &str) -> ResponsePolicyRuleCreateCall<'a, S> { + ResponsePolicyRuleCreateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Deletes a previously created Response Policy Rule. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy containing the Response Policy Rule. + /// * `responsePolicyRule` - User assigned name of the Response Policy Rule addressed by this request. + pub fn delete(&self, project: &str, location: &str, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRuleDeleteCall<'a, S> { + ResponsePolicyRuleDeleteCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _response_policy_rule: response_policy_rule.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Fetches the representation of an existing Response Policy Rule. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy containing the Response Policy Rule. + /// * `responsePolicyRule` - User assigned name of the Response Policy Rule addressed by this request. + pub fn get(&self, project: &str, location: &str, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRuleGetCall<'a, S> { + ResponsePolicyRuleGetCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _response_policy_rule: response_policy_rule.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Enumerates all Response Policy Rules associated with a project. + /// + /// # Arguments + /// + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy to list. + pub fn list(&self, project: &str, location: &str, response_policy: &str) -> ResponsePolicyRuleListCall<'a, S> { + ResponsePolicyRuleListCall { + hub: self.hub, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _page_token: Default::default(), + _max_results: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Applies a partial update to an existing Response Policy Rule. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy containing the Response Policy Rule. + /// * `responsePolicyRule` - User assigned name of the Response Policy Rule addressed by this request. + pub fn patch(&self, request: ResponsePolicyRule, project: &str, location: &str, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRulePatchCall<'a, S> { + ResponsePolicyRulePatchCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _response_policy_rule: response_policy_rule.to_string(), + _client_operation_id: Default::default(), + _delegate: Default::default(), + _additional_params: Default::default(), + _scopes: Default::default(), + } + } + + /// Create a builder to help you perform the following task: + /// + /// Updates an existing Response Policy Rule. + /// + /// # Arguments + /// + /// * `request` - No description provided. + /// * `project` - Identifies the project addressed by this request. + /// * `location` - Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// * `responsePolicy` - User assigned name of the Response Policy containing the Response Policy Rule. + /// * `responsePolicyRule` - User assigned name of the Response Policy Rule addressed by this request. + pub fn update(&self, request: ResponsePolicyRule, project: &str, location: &str, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRuleUpdateCall<'a, S> { + ResponsePolicyRuleUpdateCall { + hub: self.hub, + _request: request, + _project: project.to_string(), + _location: location.to_string(), + _response_policy: response_policy.to_string(), + _response_policy_rule: response_policy_rule.to_string(), + _client_operation_id: Default::default(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), @@ -3602,10 +2666,10 @@ impl<'a> DocumentMethods<'a> { // CallBuilders ### // ################# -/// Applies one or more updates to the document. Each request is validated before being applied. If any request is not valid, then the entire request will fail and nothing will be applied. Some requests have replies to give you some information about how they are applied. Other requests do not need to return information; these each return an empty reply. The order of replies matches that of the requests. For example, suppose you call batchUpdate with four updates, and only the third one returns information. The response would have two empty replies, the reply to the third request, and another empty reply, in that order. Because other users may be editing the document, the document might not exactly reflect your changes: your changes may be altered with respect to collaborator changes. If there are no collaborators, the document should reflect your changes. In any case, the updates in your request are guaranteed to be applied together atomically. +/// Atomically updates the ResourceRecordSet collection. /// -/// A builder for the *batchUpdate* method supported by a *document* resource. -/// It is not used directly, but through a `DocumentMethods` instance. +/// A builder for the *create* method supported by a *change* resource. +/// It is not used directly, but through a `ChangeMethods` instance. /// /// # Example /// @@ -3614,48 +2678,58 @@ impl<'a> DocumentMethods<'a> { /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; -/// # extern crate google_docs1 as docs1; -/// use docs1::api::BatchUpdateDocumentRequest; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::Change; /// # async fn dox() { /// # use std::default::Default; -/// # use docs1::{Docs, oauth2, hyper, hyper_rustls}; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); -/// # let mut hub = Docs::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), auth); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = BatchUpdateDocumentRequest::default(); +/// let mut req = Change::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.documents().batch_update(req, "documentId") +/// let result = hub.changes().create(req, "project", "location", "managedZone") +/// .client_operation_id("ea") /// .doit().await; /// # } /// ``` -pub struct DocumentBatchUpdateCall<'a> - where { +pub struct ChangeCreateCall<'a, S> + where S: 'a { - hub: &'a Docs<>, - _request: BatchUpdateDocumentRequest, - _document_id: String, + hub: &'a Dns, + _request: Change, + _project: String, + _location: String, + _managed_zone: String, + _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a> client::CallBuilder for DocumentBatchUpdateCall<'a> {} +impl<'a, S> client::CallBuilder for ChangeCreateCall<'a, S> {} -impl<'a> DocumentBatchUpdateCall<'a> { +impl<'a, S> ChangeCreateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ /// Perform the operation you have build so far. - pub async fn doit(mut self) -> client::Result<(hyper::Response, BatchUpdateDocumentResponse)> { + pub async fn doit(mut self) -> client::Result<(hyper::Response, Change)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::ToParts; @@ -3664,11 +2738,16 @@ impl<'a> DocumentBatchUpdateCall<'a> { Some(d) => d, None => &mut dd }; - dlg.begin(client::MethodInfo { id: "docs.documents.batchUpdate", + dlg.begin(client::MethodInfo { id: "dns.changes.create", http_method: hyper::Method::POST }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("documentId", self._document_id.to_string())); - for &field in ["alt", "documentId"].iter() { + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); @@ -3680,12 +2759,12 @@ impl<'a> DocumentBatchUpdateCall<'a> { params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/documents/{documentId}:batchUpdate"; + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/changes"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::Document.as_ref().to_string(), ()); + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{documentId}", "documentId")].iter() { + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -3696,8 +2775,8 @@ impl<'a> DocumentBatchUpdateCall<'a> { url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["documentId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(3); + for param_name in ["managedZone", "location", "project"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -3807,18 +2886,44 @@ impl<'a> DocumentBatchUpdateCall<'a> { /// /// 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: BatchUpdateDocumentRequest) -> DocumentBatchUpdateCall<'a> { + pub fn request(mut self, new_value: Change) -> ChangeCreateCall<'a, S> { self._request = new_value; self } - /// The ID of the document to update. + /// Identifies the project addressed by this request. /// - /// Sets the *document id* path property to the given value. + /// Sets the *project* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn document_id(mut self, new_value: &str) -> DocumentBatchUpdateCall<'a> { - self._document_id = new_value.to_string(); + pub fn project(mut self, new_value: &str) -> ChangeCreateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ChangeCreateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ChangeCreateCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ChangeCreateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -3827,7 +2932,7 @@ impl<'a> DocumentBatchUpdateCall<'a> { /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DocumentBatchUpdateCall<'a> { + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ChangeCreateCall<'a, S> { self._delegate = Some(new_value); self } @@ -3852,7 +2957,7 @@ impl<'a> DocumentBatchUpdateCall<'a> { /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - pub fn param(mut self, name: T, value: T) -> DocumentBatchUpdateCall<'a> + pub fn param(mut self, name: T, value: T) -> ChangeCreateCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -3861,7 +2966,7 @@ impl<'a> DocumentBatchUpdateCall<'a> { /// 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::Document`. + /// `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. @@ -3872,9 +2977,9 @@ impl<'a> DocumentBatchUpdateCall<'a> { /// 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) -> DocumentBatchUpdateCall<'a> - where T: Into>, - S: AsRef { + pub fn add_scope(mut self, scope: T) -> ChangeCreateCall<'a, S> + where T: Into>, + St: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, @@ -3884,10 +2989,10 @@ impl<'a> DocumentBatchUpdateCall<'a> { } -/// Creates a blank document using the title given in the request. Other fields in the request, including any provided content, are ignored. Returns the created document. +/// Fetches the representation of an existing Change. /// -/// A builder for the *create* method supported by a *document* resource. -/// It is not used directly, but through a `DocumentMethods` instance. +/// A builder for the *get* method supported by a *change* resource. +/// It is not used directly, but through a `ChangeMethods` instance. /// /// # Example /// @@ -3896,47 +3001,52 @@ impl<'a> DocumentBatchUpdateCall<'a> { /// ```test_harness,no_run /// # extern crate hyper; /// # extern crate hyper_rustls; -/// # extern crate google_docs1 as docs1; -/// use docs1::api::Document; +/// # extern crate google_dns2 as dns2; /// # async fn dox() { /// # use std::default::Default; -/// # use docs1::{Docs, oauth2, hyper, hyper_rustls}; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; /// /// # let secret: oauth2::ApplicationSecret = Default::default(); /// # let auth = oauth2::InstalledFlowAuthenticator::builder( /// # secret, /// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, /// # ).build().await.unwrap(); -/// # let mut hub = Docs::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = Document::default(); -/// +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.documents().create(req) +/// let result = hub.changes().get("project", "location", "managedZone", "changeId") +/// .client_operation_id("ipsum") /// .doit().await; /// # } /// ``` -pub struct DocumentCreateCall<'a> - where { +pub struct ChangeGetCall<'a, S> + where S: 'a { - hub: &'a Docs<>, - _request: Document, + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _change_id: String, + _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeMap } -impl<'a> client::CallBuilder for DocumentCreateCall<'a> {} +impl<'a, S> client::CallBuilder for ChangeGetCall<'a, S> {} -impl<'a> DocumentCreateCall<'a> { +impl<'a, S> ChangeGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ /// Perform the operation you have build so far. - pub async fn doit(mut self) -> client::Result<(hyper::Response, Document)> { + pub async fn doit(mut self) -> client::Result<(hyper::Response, Change)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::ToParts; @@ -3945,259 +3055,17 @@ impl<'a> DocumentCreateCall<'a> { Some(d) => d, None => &mut dd }; - dlg.begin(client::MethodInfo { id: "docs.documents.create", - http_method: hyper::Method::POST }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(3 + self._additional_params.len()); - for &field in ["alt"].iter() { - if self._additional_params.contains_key(field) { - dlg.finished(false); - return Err(client::Error::FieldClash(field)); - } - } - for (name, value) in self._additional_params.iter() { - params.push((&name, value.clone())); - } - - params.push(("alt", "json".to_string())); - - let mut url = self.hub._base_url.clone() + "v1/documents"; - if self._scopes.len() == 0 { - self._scopes.insert(Scope::Document.as_ref().to_string(), ()); - } - - - let url = url::Url::parse_with_params(&url, params).unwrap(); - - let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); - let mut request_value_reader = - { - let mut value = json::value::to_value(&self._request).expect("serde to work"); - client::remove_json_null_values(&mut value); - let mut dst = io::Cursor::new(Vec::with_capacity(128)); - json::to_writer(&mut dst, &value).unwrap(); - dst - }; - let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - - - loop { - let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { - Ok(token) => token.clone(), - Err(err) => { - match dlg.token(&err) { - Some(token) => token, - None => { - dlg.finished(false); - return Err(client::Error::MissingToken(err)) - } - } - } - }; - request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); - let mut req_result = { - let client = &self.hub.client; - dlg.pre_request(); - let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string()) - .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); - - - let request = req_builder - .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) - .header(CONTENT_LENGTH, request_size as u64) - .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); - - client.request(request.unwrap()).await - - }; - - match req_result { - Err(err) => { - if let client::Retry::After(d) = dlg.http_error(&err) { - sleep(d); - continue; - } - dlg.finished(false); - return Err(client::Error::HttpError(err)) - } - Ok(mut res) => { - if !res.status().is_success() { - let res_body_string = client::get_body_as_string(res.body_mut()).await; - let (parts, _) = res.into_parts(); - let body = hyper::Body::from(res_body_string.clone()); - let restored_response = hyper::Response::from_parts(parts, body); - - let server_response = json::from_str::(&res_body_string).ok(); - - if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { - sleep(d); - continue; - } - - dlg.finished(false); - - return match server_response { - Some(error_value) => Err(client::Error::BadRequest(error_value)), - None => Err(client::Error::Failure(restored_response)), - } - } - let result_value = { - let res_body_string = client::get_body_as_string(res.body_mut()).await; - - match json::from_str(&res_body_string) { - Ok(decoded) => (res, decoded), - Err(err) => { - dlg.response_json_decode_error(&res_body_string, &err); - return Err(client::Error::JsonDecodeError(res_body_string, err)); - } - } - }; - - dlg.finished(true); - return Ok(result_value) - } - } - } - } - - - /// - /// Sets the *request* property to the given value. - /// - /// Even though the property as already been set when instantiating this call, - /// we provide this method for API completeness. - pub fn request(mut self, new_value: Document) -> DocumentCreateCall<'a> { - self._request = new_value; - self - } - /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong - /// while executing the actual API request. - /// - /// It should be used to handle progress information, and to implement a certain level of resilience. - /// - /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DocumentCreateCall<'a> { - self._delegate = Some(new_value); - self - } - - /// Set any additional parameter of the query string used in the request. - /// It should be used to set parameters which are not yet available through their own - /// setters. - /// - /// Please note that this method must not be used to set any of the known parameters - /// which have their own setter method. If done anyway, the request will fail. - /// - /// # Additional Parameters - /// - /// * *$.xgafv* (query-string) - V1 error format. - /// * *access_token* (query-string) - OAuth access token. - /// * *alt* (query-string) - Data format for response. - /// * *callback* (query-string) - JSONP - /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. - /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. - /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. - /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). - /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - pub fn param(mut self, name: T, value: T) -> DocumentCreateCall<'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::Document`. - /// - /// 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) -> DocumentCreateCall<'a> - where T: Into>, - S: AsRef { - match scope.into() { - Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), - None => None, - }; - self - } -} - - -/// Gets the latest version of the specified document. -/// -/// A builder for the *get* method supported by a *document* resource. -/// It is not used directly, but through a `DocumentMethods` instance. -/// -/// # Example -/// -/// Instantiate a resource method builder -/// -/// ```test_harness,no_run -/// # extern crate hyper; -/// # extern crate hyper_rustls; -/// # extern crate google_docs1 as docs1; -/// # async fn dox() { -/// # use std::default::Default; -/// # use docs1::{Docs, oauth2, hyper, hyper_rustls}; -/// -/// # let secret: oauth2::ApplicationSecret = Default::default(); -/// # let auth = oauth2::InstalledFlowAuthenticator::builder( -/// # secret, -/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, -/// # ).build().await.unwrap(); -/// # let mut hub = Docs::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.documents().get("documentId") -/// .suggestions_view_mode("At") -/// .doit().await; -/// # } -/// ``` -pub struct DocumentGetCall<'a> - where { - - hub: &'a Docs<>, - _document_id: String, - _suggestions_view_mode: Option, - _delegate: Option<&'a mut dyn client::Delegate>, - _additional_params: HashMap, - _scopes: BTreeMap -} - -impl<'a> client::CallBuilder for DocumentGetCall<'a> {} - -impl<'a> DocumentGetCall<'a> { - - - /// Perform the operation you have build so far. - pub async fn doit(mut self) -> client::Result<(hyper::Response, Document)> { - use std::io::{Read, Seek}; - use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; - use client::ToParts; - let mut dd = client::DefaultDelegate; - let mut dlg: &mut dyn client::Delegate = match self._delegate { - Some(d) => d, - None => &mut dd - }; - dlg.begin(client::MethodInfo { id: "docs.documents.get", + dlg.begin(client::MethodInfo { id: "dns.changes.get", http_method: hyper::Method::GET }); - let mut params: Vec<(&str, String)> = Vec::with_capacity(4 + self._additional_params.len()); - params.push(("documentId", self._document_id.to_string())); - if let Some(value) = self._suggestions_view_mode { - params.push(("suggestionsViewMode", value.to_string())); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + params.push(("changeId", self._change_id.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); } - for &field in ["alt", "documentId", "suggestionsViewMode"].iter() { + for &field in ["alt", "project", "location", "managedZone", "changeId", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); @@ -4209,12 +3077,12 @@ impl<'a> DocumentGetCall<'a> { params.push(("alt", "json".to_string())); - let mut url = self.hub._base_url.clone() + "v1/documents/{documentId}"; + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/changes/{changeId}"; if self._scopes.len() == 0 { - self._scopes.insert(Scope::DocumentReadonly.as_ref().to_string(), ()); + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); } - for &(find_this, param_name) in [("{documentId}", "documentId")].iter() { + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone"), ("{changeId}", "changeId")].iter() { let mut replace_with: Option<&str> = None; for &(name, ref value) in params.iter() { if name == param_name { @@ -4225,8 +3093,8 @@ impl<'a> DocumentGetCall<'a> { url = url.replace(find_this, replace_with.expect("to find substitution value in params")); } { - let mut indices_for_removal: Vec = Vec::with_capacity(1); - for param_name in ["documentId"].iter() { + let mut indices_for_removal: Vec = Vec::with_capacity(4); + for param_name in ["changeId", "managedZone", "location", "project"].iter() { if let Some(index) = params.iter().position(|t| &t.0 == param_name) { indices_for_removal.push(index); } @@ -4317,21 +3185,50 @@ impl<'a> DocumentGetCall<'a> { } - /// The ID of the document to retrieve. + /// Identifies the project addressed by this request. /// - /// Sets the *document id* path property to the given value. + /// Sets the *project* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. - pub fn document_id(mut self, new_value: &str) -> DocumentGetCall<'a> { - self._document_id = new_value.to_string(); + pub fn project(mut self, new_value: &str) -> ChangeGetCall<'a, S> { + self._project = new_value.to_string(); self } - /// The suggestions view mode to apply to the document. This allows viewing the document with all suggestions inline, accepted or rejected. If one is not specified, DEFAULT_FOR_CURRENT_ACCESS is used. /// - /// Sets the *suggestions view mode* query property to the given value. - pub fn suggestions_view_mode(mut self, new_value: &str) -> DocumentGetCall<'a> { - self._suggestions_view_mode = Some(new_value.to_string()); + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ChangeGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ChangeGetCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// The identifier of the requested change, from a previous ResourceRecordSetsChangeResponse. + /// + /// Sets the *change 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 change_id(mut self, new_value: &str) -> ChangeGetCall<'a, S> { + self._change_id = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ChangeGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong @@ -4340,7 +3237,7 @@ impl<'a> DocumentGetCall<'a> { /// It should be used to handle progress information, and to implement a certain level of resilience. /// /// Sets the *delegate* property to the given value. - pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DocumentGetCall<'a> { + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ChangeGetCall<'a, S> { self._delegate = Some(new_value); self } @@ -4365,7 +3262,7 @@ impl<'a> DocumentGetCall<'a> { /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). - pub fn param(mut self, name: T, value: T) -> DocumentGetCall<'a> + pub fn param(mut self, name: T, value: T) -> ChangeGetCall<'a, S> where T: AsRef { self._additional_params.insert(name.as_ref().to_string(), value.as_ref().to_string()); self @@ -4374,7 +3271,7 @@ impl<'a> DocumentGetCall<'a> { /// 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::DocumentReadonly`. + /// `Scope::NdevClouddnReadonly`. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. @@ -4385,9 +3282,10914 @@ impl<'a> DocumentGetCall<'a> { /// 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) -> DocumentGetCall<'a> - where T: Into>, - S: AsRef { + pub fn add_scope(mut self, scope: T) -> ChangeGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates Changes to a ResourceRecordSet collection. +/// +/// A builder for the *list* method supported by a *change* resource. +/// It is not used directly, but through a `ChangeMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.changes().list("project", "location", "managedZone") +/// .sort_order("rebum.") +/// .sort_by("est") +/// .page_token("ipsum") +/// .max_results(-50) +/// .doit().await; +/// # } +/// ``` +pub struct ChangeListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _sort_order: Option, + _sort_by: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ChangeListCall<'a, S> {} + +impl<'a, S> ChangeListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ChangesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.changes.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._sort_order { + params.push(("sortOrder", value.to_string())); + } + if let Some(value) = self._sort_by { + params.push(("sortBy", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "sortOrder", "sortBy", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/changes"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ChangeListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ChangeListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ChangeListCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Sorting order direction: 'ascending' or 'descending'. + /// + /// Sets the *sort order* query property to the given value. + pub fn sort_order(mut self, new_value: &str) -> ChangeListCall<'a, S> { + self._sort_order = Some(new_value.to_string()); + self + } + /// Sorting criterion. The only supported value is change sequence. + /// + /// Sets the *sort by* query property to the given value. + pub fn sort_by(mut self, new_value: &str) -> ChangeListCall<'a, S> { + self._sort_by = Some(new_value.to_string()); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ChangeListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ChangeListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ChangeListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ChangeListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ChangeListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing DnsKey. +/// +/// A builder for the *get* method supported by a *dnsKey* resource. +/// It is not used directly, but through a `DnsKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.dns_keys().get("project", "location", "managedZone", "dnsKeyId") +/// .digest_type("Lorem") +/// .client_operation_id("eos") +/// .doit().await; +/// # } +/// ``` +pub struct DnsKeyGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _dns_key_id: String, + _digest_type: Option, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for DnsKeyGetCall<'a, S> {} + +impl<'a, S> DnsKeyGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, DnsKey)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.dnsKeys.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + params.push(("dnsKeyId", self._dns_key_id.to_string())); + if let Some(value) = self._digest_type { + params.push(("digestType", value.to_string())); + } + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "dnsKeyId", "digestType", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/dnsKeys/{dnsKeyId}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone"), ("{dnsKeyId}", "dnsKeyId")].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 ["dnsKeyId", "managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> DnsKeyGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> DnsKeyGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> DnsKeyGetCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// The identifier of the requested DnsKey. + /// + /// Sets the *dns key 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 dns_key_id(mut self, new_value: &str) -> DnsKeyGetCall<'a, S> { + self._dns_key_id = new_value.to_string(); + self + } + /// An optional comma-separated list of digest types to compute and display for key signing keys. If omitted, the recommended digest type is computed and displayed. + /// + /// Sets the *digest type* query property to the given value. + pub fn digest_type(mut self, new_value: &str) -> DnsKeyGetCall<'a, S> { + self._digest_type = Some(new_value.to_string()); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> DnsKeyGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DnsKeyGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> DnsKeyGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> DnsKeyGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates DnsKeys to a ResourceRecordSet collection. +/// +/// A builder for the *list* method supported by a *dnsKey* resource. +/// It is not used directly, but through a `DnsKeyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.dns_keys().list("project", "location", "managedZone") +/// .page_token("sed") +/// .max_results(-61) +/// .digest_type("Stet") +/// .doit().await; +/// # } +/// ``` +pub struct DnsKeyListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _page_token: Option, + _max_results: Option, + _digest_type: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for DnsKeyListCall<'a, S> {} + +impl<'a, S> DnsKeyListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, DnsKeysListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.dnsKeys.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._digest_type { + params.push(("digestType", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "pageToken", "maxResults", "digestType"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/dnsKeys"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> DnsKeyListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> DnsKeyListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> DnsKeyListCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> DnsKeyListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> DnsKeyListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// An optional comma-separated list of digest types to compute and display for key signing keys. If omitted, the recommended digest type is computed and displayed. + /// + /// Sets the *digest type* query property to the given value. + pub fn digest_type(mut self, new_value: &str) -> DnsKeyListCall<'a, S> { + self._digest_type = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> DnsKeyListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> DnsKeyListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> DnsKeyListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing Operation. +/// +/// A builder for the *get* method supported by a *managedZoneOperation* resource. +/// It is not used directly, but through a `ManagedZoneOperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.managed_zone_operations().get("project", "location", "managedZone", "operation") +/// .client_operation_id("et") +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZoneOperationGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _operation: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZoneOperationGetCall<'a, S> {} + +impl<'a, S> ManagedZoneOperationGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZoneOperations.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + params.push(("operation", self._operation.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "operation", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/operations/{operation}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone"), ("{operation}", "operation")].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 ["operation", "managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZoneOperationGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZoneOperationGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ManagedZoneOperationGetCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Identifies the operation addressed by this request (ID of the operation). + /// + /// Sets the *operation* path property to 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(mut self, new_value: &str) -> ManagedZoneOperationGetCall<'a, S> { + self._operation = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneOperationGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneOperationGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZoneOperationGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ManagedZoneOperationGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates Operations for the given ManagedZone. +/// +/// A builder for the *list* method supported by a *managedZoneOperation* resource. +/// It is not used directly, but through a `ManagedZoneOperationMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.managed_zone_operations().list("project", "location", "managedZone") +/// .sort_by("duo") +/// .page_token("dolore") +/// .max_results(-22) +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZoneOperationListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _sort_by: Option, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZoneOperationListCall<'a, S> {} + +impl<'a, S> ManagedZoneOperationListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ManagedZoneOperationsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZoneOperations.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._sort_by { + params.push(("sortBy", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "sortBy", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/operations"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZoneOperationListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZoneOperationListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ManagedZoneOperationListCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Sorting criterion. The only supported values are START_TIME and ID. + /// + /// Sets the *sort by* query property to the given value. + pub fn sort_by(mut self, new_value: &str) -> ManagedZoneOperationListCall<'a, S> { + self._sort_by = Some(new_value.to_string()); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ManagedZoneOperationListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ManagedZoneOperationListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneOperationListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZoneOperationListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ManagedZoneOperationListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new ManagedZone. +/// +/// A builder for the *create* method supported by a *managedZone* resource. +/// It is not used directly, but through a `ManagedZoneMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ManagedZone; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ManagedZone::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.managed_zones().create(req, "project", "location") +/// .client_operation_id("consetetur") +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZoneCreateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ManagedZone, + _project: String, + _location: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZoneCreateCall<'a, S> {} + +impl<'a, S> ManagedZoneCreateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ManagedZone)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZones.create", + http_method: hyper::Method::POST }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location")].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 ["location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ManagedZone) -> ManagedZoneCreateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZoneCreateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZoneCreateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneCreateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneCreateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZoneCreateCall<'a, S> + 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) -> ManagedZoneCreateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a previously created ManagedZone. +/// +/// A builder for the *delete* method supported by a *managedZone* resource. +/// It is not used directly, but through a `ManagedZoneMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.managed_zones().delete("project", "location", "managedZone") +/// .client_operation_id("et") +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZoneDeleteCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZoneDeleteCall<'a, S> {} + +impl<'a, S> ManagedZoneDeleteCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZones.delete", + http_method: hyper::Method::DELETE }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["project", "location", "managedZone", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::DELETE).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZoneDeleteCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZoneDeleteCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ManagedZoneDeleteCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneDeleteCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneDeleteCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZoneDeleteCall<'a, S> + 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) -> ManagedZoneDeleteCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing ManagedZone. +/// +/// A builder for the *get* method supported by a *managedZone* resource. +/// It is not used directly, but through a `ManagedZoneMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.managed_zones().get("project", "location", "managedZone") +/// .client_operation_id("duo") +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZoneGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZoneGetCall<'a, S> {} + +impl<'a, S> ManagedZoneGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ManagedZone)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZones.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZoneGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZoneGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ManagedZoneGetCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZoneGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ManagedZoneGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates ManagedZones that have been created but not yet deleted. +/// +/// A builder for the *list* method supported by a *managedZone* resource. +/// It is not used directly, but through a `ManagedZoneMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.managed_zones().list("project", "location") +/// .page_token("invidunt") +/// .max_results(-65) +/// .dns_name("vero") +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZoneListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _page_token: Option, + _max_results: Option, + _dns_name: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZoneListCall<'a, S> {} + +impl<'a, S> ManagedZoneListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ManagedZonesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZones.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + if let Some(value) = self._dns_name { + params.push(("dnsName", value.to_string())); + } + for &field in ["alt", "project", "location", "pageToken", "maxResults", "dnsName"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location")].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 ["location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZoneListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZoneListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ManagedZoneListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ManagedZoneListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// Restricts the list to return only zones with this domain name. + /// + /// Sets the *dns name* query property to the given value. + pub fn dns_name(mut self, new_value: &str) -> ManagedZoneListCall<'a, S> { + self._dns_name = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZoneListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ManagedZoneListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Applies a partial update to an existing ManagedZone. +/// +/// A builder for the *patch* method supported by a *managedZone* resource. +/// It is not used directly, but through a `ManagedZoneMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ManagedZone; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ManagedZone::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.managed_zones().patch(req, "project", "location", "managedZone") +/// .client_operation_id("no") +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZonePatchCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ManagedZone, + _project: String, + _location: String, + _managed_zone: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZonePatchCall<'a, S> {} + +impl<'a, S> ManagedZonePatchCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZones.patch", + http_method: hyper::Method::PATCH }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PATCH).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ManagedZone) -> ManagedZonePatchCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZonePatchCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZonePatchCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ManagedZonePatchCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ManagedZonePatchCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZonePatchCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZonePatchCall<'a, S> + 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) -> ManagedZonePatchCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing ManagedZone. +/// +/// A builder for the *update* method supported by a *managedZone* resource. +/// It is not used directly, but through a `ManagedZoneMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ManagedZone; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ManagedZone::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.managed_zones().update(req, "project", "location", "managedZone") +/// .client_operation_id("consetetur") +/// .doit().await; +/// # } +/// ``` +pub struct ManagedZoneUpdateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ManagedZone, + _project: String, + _location: String, + _managed_zone: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ManagedZoneUpdateCall<'a, S> {} + +impl<'a, S> ManagedZoneUpdateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, Operation)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.managedZones.update", + http_method: hyper::Method::PUT }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PUT).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ManagedZone) -> ManagedZoneUpdateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ManagedZoneUpdateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ManagedZoneUpdateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ManagedZoneUpdateCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ManagedZoneUpdateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneUpdateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ManagedZoneUpdateCall<'a, S> + 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) -> ManagedZoneUpdateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new Policy. +/// +/// A builder for the *create* method supported by a *policy* resource. +/// It is not used directly, but through a `PolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::Policy; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = Policy::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.policies().create(req, "project", "location") +/// .client_operation_id("erat") +/// .doit().await; +/// # } +/// ``` +pub struct PolicyCreateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: Policy, + _project: String, + _location: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for PolicyCreateCall<'a, S> {} + +impl<'a, S> PolicyCreateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.policies.create", + http_method: hyper::Method::POST }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/policies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location")].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 ["location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Policy) -> PolicyCreateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> PolicyCreateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> PolicyCreateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> PolicyCreateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PolicyCreateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> PolicyCreateCall<'a, S> + 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) -> PolicyCreateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a previously created Policy. Fails if the policy is still being referenced by a network. +/// +/// A builder for the *delete* method supported by a *policy* resource. +/// It is not used directly, but through a `PolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.policies().delete("project", "location", "policy") +/// .client_operation_id("takimata") +/// .doit().await; +/// # } +/// ``` +pub struct PolicyDeleteCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for PolicyDeleteCall<'a, S> {} + +impl<'a, S> PolicyDeleteCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.policies.delete", + http_method: hyper::Method::DELETE }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("policy", self._policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["project", "location", "policy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/policies/{policy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{policy}", "policy")].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 ["policy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::DELETE).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> PolicyDeleteCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> PolicyDeleteCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User given friendly name of the policy addressed by this request. + /// + /// Sets the *policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn policy(mut self, new_value: &str) -> PolicyDeleteCall<'a, S> { + self._policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> PolicyDeleteCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PolicyDeleteCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> PolicyDeleteCall<'a, S> + 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) -> PolicyDeleteCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing Policy. +/// +/// A builder for the *get* method supported by a *policy* resource. +/// It is not used directly, but through a `PolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.policies().get("project", "location", "policy") +/// .client_operation_id("accusam") +/// .doit().await; +/// # } +/// ``` +pub struct PolicyGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for PolicyGetCall<'a, S> {} + +impl<'a, S> PolicyGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, Policy)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.policies.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("policy", self._policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "policy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/policies/{policy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{policy}", "policy")].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 ["policy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> PolicyGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> PolicyGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User given friendly name of the policy addressed by this request. + /// + /// Sets the *policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn policy(mut self, new_value: &str) -> PolicyGetCall<'a, S> { + self._policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> PolicyGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PolicyGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> PolicyGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> PolicyGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates all Policies associated with a project. +/// +/// A builder for the *list* method supported by a *policy* resource. +/// It is not used directly, but through a `PolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.policies().list("project", "location") +/// .page_token("dolore") +/// .max_results(-34) +/// .doit().await; +/// # } +/// ``` +pub struct PolicyListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for PolicyListCall<'a, S> {} + +impl<'a, S> PolicyListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, PoliciesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.policies.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "project", "location", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/policies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location")].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 ["location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> PolicyListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> PolicyListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> PolicyListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> PolicyListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PolicyListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> PolicyListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> PolicyListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Applies a partial update to an existing Policy. +/// +/// A builder for the *patch* method supported by a *policy* resource. +/// It is not used directly, but through a `PolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::Policy; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = Policy::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.policies().patch(req, "project", "location", "policy") +/// .client_operation_id("sadipscing") +/// .doit().await; +/// # } +/// ``` +pub struct PolicyPatchCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: Policy, + _project: String, + _location: String, + _policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for PolicyPatchCall<'a, S> {} + +impl<'a, S> PolicyPatchCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, PoliciesPatchResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.policies.patch", + http_method: hyper::Method::PATCH }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("policy", self._policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "policy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/policies/{policy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{policy}", "policy")].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 ["policy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PATCH).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Policy) -> PolicyPatchCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> PolicyPatchCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> PolicyPatchCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User given friendly name of the policy addressed by this request. + /// + /// Sets the *policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn policy(mut self, new_value: &str) -> PolicyPatchCall<'a, S> { + self._policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> PolicyPatchCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PolicyPatchCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> PolicyPatchCall<'a, S> + 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) -> PolicyPatchCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing Policy. +/// +/// A builder for the *update* method supported by a *policy* resource. +/// It is not used directly, but through a `PolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::Policy; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = Policy::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.policies().update(req, "project", "location", "policy") +/// .client_operation_id("est") +/// .doit().await; +/// # } +/// ``` +pub struct PolicyUpdateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: Policy, + _project: String, + _location: String, + _policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for PolicyUpdateCall<'a, S> {} + +impl<'a, S> PolicyUpdateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, PoliciesUpdateResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.policies.update", + http_method: hyper::Method::PUT }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("policy", self._policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "policy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/policies/{policy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{policy}", "policy")].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 ["policy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PUT).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: Policy) -> PolicyUpdateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> PolicyUpdateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> PolicyUpdateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User given friendly name of the policy addressed by this request. + /// + /// Sets the *policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn policy(mut self, new_value: &str) -> PolicyUpdateCall<'a, S> { + self._policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> PolicyUpdateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> PolicyUpdateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> PolicyUpdateCall<'a, S> + 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) -> PolicyUpdateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing Project. +/// +/// A builder for the *get* method supported by a *project* resource. +/// It is not used directly, but through a `ProjectMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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().get("project", "location") +/// .client_operation_id("sit") +/// .doit().await; +/// # } +/// ``` +pub struct ProjectGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ProjectGetCall<'a, S> {} + +impl<'a, S> ProjectGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, Project)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.projects.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location")].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 ["location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ProjectGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ProjectGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ProjectGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ProjectGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ProjectGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ProjectGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new ResourceRecordSet. +/// +/// A builder for the *create* method supported by a *resourceRecordSet* resource. +/// It is not used directly, but through a `ResourceRecordSetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResourceRecordSet; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResourceRecordSet::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.resource_record_sets().create(req, "project", "location", "managedZone") +/// .client_operation_id("ipsum") +/// .doit().await; +/// # } +/// ``` +pub struct ResourceRecordSetCreateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResourceRecordSet, + _project: String, + _location: String, + _managed_zone: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResourceRecordSetCreateCall<'a, S> {} + +impl<'a, S> ResourceRecordSetCreateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResourceRecordSet)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.create", + http_method: hyper::Method::POST }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/rrsets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResourceRecordSet) -> ResourceRecordSetCreateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResourceRecordSetCreateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResourceRecordSetCreateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ResourceRecordSetCreateCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResourceRecordSetCreateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResourceRecordSetCreateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResourceRecordSetCreateCall<'a, S> + 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) -> ResourceRecordSetCreateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a previously created ResourceRecordSet. +/// +/// A builder for the *delete* method supported by a *resourceRecordSet* resource. +/// It is not used directly, but through a `ResourceRecordSetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.resource_record_sets().delete("project", "location", "managedZone", "name", "type") +/// .client_operation_id("diam") +/// .doit().await; +/// # } +/// ``` +pub struct ResourceRecordSetDeleteCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _name: String, + _type_: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResourceRecordSetDeleteCall<'a, S> {} + +impl<'a, S> ResourceRecordSetDeleteCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.delete", + http_method: hyper::Method::DELETE }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + params.push(("name", self._name.to_string())); + params.push(("type", self._type_.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["project", "location", "managedZone", "name", "type", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/rrsets/{name}/{type}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone"), ("{name}", "name"), ("{type}", "type")].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(5); + for param_name in ["type", "name", "managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::DELETE).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResourceRecordSetDeleteCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResourceRecordSetDeleteCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ResourceRecordSetDeleteCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Fully qualified domain name. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ResourceRecordSetDeleteCall<'a, S> { + self._name = new_value.to_string(); + self + } + /// RRSet type. + /// + /// Sets the *type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn type_(mut self, new_value: &str) -> ResourceRecordSetDeleteCall<'a, S> { + self._type_ = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResourceRecordSetDeleteCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResourceRecordSetDeleteCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResourceRecordSetDeleteCall<'a, S> + 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) -> ResourceRecordSetDeleteCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing ResourceRecordSet. +/// +/// A builder for the *get* method supported by a *resourceRecordSet* resource. +/// It is not used directly, but through a `ResourceRecordSetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.resource_record_sets().get("project", "location", "managedZone", "name", "type") +/// .client_operation_id("et") +/// .doit().await; +/// # } +/// ``` +pub struct ResourceRecordSetGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _name: String, + _type_: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResourceRecordSetGetCall<'a, S> {} + +impl<'a, S> ResourceRecordSetGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResourceRecordSet)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + params.push(("name", self._name.to_string())); + params.push(("type", self._type_.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "name", "type", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/rrsets/{name}/{type}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone"), ("{name}", "name"), ("{type}", "type")].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(5); + for param_name in ["type", "name", "managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResourceRecordSetGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResourceRecordSetGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ResourceRecordSetGetCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Fully qualified domain name. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ResourceRecordSetGetCall<'a, S> { + self._name = new_value.to_string(); + self + } + /// RRSet type. + /// + /// Sets the *type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn type_(mut self, new_value: &str) -> ResourceRecordSetGetCall<'a, S> { + self._type_ = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResourceRecordSetGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResourceRecordSetGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResourceRecordSetGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ResourceRecordSetGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates ResourceRecordSets that you have created but not yet deleted. +/// +/// A builder for the *list* method supported by a *resourceRecordSet* resource. +/// It is not used directly, but through a `ResourceRecordSetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.resource_record_sets().list("project", "location", "managedZone") +/// .type_("nonumy") +/// .page_token("At") +/// .name("sadipscing") +/// .max_results(-32) +/// .doit().await; +/// # } +/// ``` +pub struct ResourceRecordSetListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _managed_zone: String, + _type_: Option, + _page_token: Option, + _name: Option, + _max_results: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResourceRecordSetListCall<'a, S> {} + +impl<'a, S> ResourceRecordSetListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResourceRecordSetsListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + if let Some(value) = self._type_ { + params.push(("type", value.to_string())); + } + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._name { + params.push(("name", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "type", "pageToken", "name", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/rrsets"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone")].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 ["managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Restricts the list to return only records of this type. If present, the "name" parameter must also be present. + /// + /// Sets the *type* query property to the given value. + pub fn type_(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, S> { + self._type_ = Some(new_value.to_string()); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Restricts the list to return only records with this fully qualified domain name. + /// + /// Sets the *name* query property to the given value. + pub fn name(mut self, new_value: &str) -> ResourceRecordSetListCall<'a, S> { + self._name = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ResourceRecordSetListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResourceRecordSetListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResourceRecordSetListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ResourceRecordSetListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Applies a partial update to an existing ResourceRecordSet. +/// +/// A builder for the *patch* method supported by a *resourceRecordSet* resource. +/// It is not used directly, but through a `ResourceRecordSetMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResourceRecordSet; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResourceRecordSet::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.resource_record_sets().patch(req, "project", "location", "managedZone", "name", "type") +/// .client_operation_id("est") +/// .doit().await; +/// # } +/// ``` +pub struct ResourceRecordSetPatchCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResourceRecordSet, + _project: String, + _location: String, + _managed_zone: String, + _name: String, + _type_: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResourceRecordSetPatchCall<'a, S> {} + +impl<'a, S> ResourceRecordSetPatchCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResourceRecordSet)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.patch", + http_method: hyper::Method::PATCH }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(9 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("managedZone", self._managed_zone.to_string())); + params.push(("name", self._name.to_string())); + params.push(("type", self._type_.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "managedZone", "name", "type", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/managedZones/{managedZone}/rrsets/{name}/{type}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{managedZone}", "managedZone"), ("{name}", "name"), ("{type}", "type")].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(5); + for param_name in ["type", "name", "managedZone", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PATCH).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResourceRecordSet) -> ResourceRecordSetPatchCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResourceRecordSetPatchCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResourceRecordSetPatchCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Identifies the managed zone addressed by this request. Can be the managed zone name or ID. + /// + /// Sets the *managed 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 managed_zone(mut self, new_value: &str) -> ResourceRecordSetPatchCall<'a, S> { + self._managed_zone = new_value.to_string(); + self + } + /// Fully qualified domain name. + /// + /// Sets the *name* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn name(mut self, new_value: &str) -> ResourceRecordSetPatchCall<'a, S> { + self._name = new_value.to_string(); + self + } + /// RRSet type. + /// + /// Sets the *type* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn type_(mut self, new_value: &str) -> ResourceRecordSetPatchCall<'a, S> { + self._type_ = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResourceRecordSetPatchCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResourceRecordSetPatchCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResourceRecordSetPatchCall<'a, S> + 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) -> ResourceRecordSetPatchCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new Response Policy +/// +/// A builder for the *create* method supported by a *responsePolicy* resource. +/// It is not used directly, but through a `ResponsePolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResponsePolicy; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResponsePolicy::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.response_policies().create(req, "project", "location") +/// .client_operation_id("consetetur") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyCreateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResponsePolicy, + _project: String, + _location: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyCreateCall<'a, S> {} + +impl<'a, S> ResponsePolicyCreateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePolicy)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicies.create", + http_method: hyper::Method::POST }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location")].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 ["location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResponsePolicy) -> ResponsePolicyCreateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyCreateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource, only applicable in the v APIs. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyCreateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyCreateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyCreateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyCreateCall<'a, S> + 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) -> ResponsePolicyCreateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a previously created Response Policy. Fails if the response policy is non-empty or still being referenced by a network. +/// +/// A builder for the *delete* method supported by a *responsePolicy* resource. +/// It is not used directly, but through a `ResponsePolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.response_policies().delete("project", "location", "responsePolicy") +/// .client_operation_id("aliquyam") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyDeleteCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _response_policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyDeleteCall<'a, S> {} + +impl<'a, S> ResponsePolicyDeleteCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicies.delete", + http_method: hyper::Method::DELETE }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(5 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["project", "location", "responsePolicy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy")].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 ["responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::DELETE).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyDeleteCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyDeleteCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy addressed by this request. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyDeleteCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyDeleteCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyDeleteCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyDeleteCall<'a, S> + 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) -> ResponsePolicyDeleteCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing Response Policy. +/// +/// A builder for the *get* method supported by a *responsePolicy* resource. +/// It is not used directly, but through a `ResponsePolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.response_policies().get("project", "location", "responsePolicy") +/// .client_operation_id("est") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _response_policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyGetCall<'a, S> {} + +impl<'a, S> ResponsePolicyGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePolicy)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicies.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy")].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 ["responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy addressed by this request. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyGetCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ResponsePolicyGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates all Response Policies associated with a project. +/// +/// A builder for the *list* method supported by a *responsePolicy* resource. +/// It is not used directly, but through a `ResponsePolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.response_policies().list("project", "location") +/// .page_token("eos") +/// .max_results(-56) +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyListCall<'a, S> {} + +impl<'a, S> ResponsePolicyListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePoliciesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicies.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "project", "location", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location")].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 ["location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ResponsePolicyListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ResponsePolicyListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ResponsePolicyListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Applies a partial update to an existing Response Policy. +/// +/// A builder for the *patch* method supported by a *responsePolicy* resource. +/// It is not used directly, but through a `ResponsePolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResponsePolicy; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResponsePolicy::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.response_policies().patch(req, "project", "location", "responsePolicy") +/// .client_operation_id("eos") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyPatchCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResponsePolicy, + _project: String, + _location: String, + _response_policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyPatchCall<'a, S> {} + +impl<'a, S> ResponsePolicyPatchCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePoliciesPatchResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicies.patch", + http_method: hyper::Method::PATCH }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy")].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 ["responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PATCH).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResponsePolicy) -> ResponsePolicyPatchCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyPatchCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyPatchCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Respones Policy addressed by this request. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyPatchCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyPatchCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyPatchCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyPatchCall<'a, S> + 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) -> ResponsePolicyPatchCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing Response Policy. +/// +/// A builder for the *update* method supported by a *responsePolicy* resource. +/// It is not used directly, but through a `ResponsePolicyMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResponsePolicy; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResponsePolicy::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.response_policies().update(req, "project", "location", "responsePolicy") +/// .client_operation_id("At") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyUpdateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResponsePolicy, + _project: String, + _location: String, + _response_policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyUpdateCall<'a, S> {} + +impl<'a, S> ResponsePolicyUpdateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePoliciesUpdateResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicies.update", + http_method: hyper::Method::PUT }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy")].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 ["responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PUT).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResponsePolicy) -> ResponsePolicyUpdateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyUpdateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyUpdateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy addressed by this request. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyUpdateCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyUpdateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyUpdateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyUpdateCall<'a, S> + 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) -> ResponsePolicyUpdateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Creates a new Response Policy Rule. +/// +/// A builder for the *create* method supported by a *responsePolicyRule* resource. +/// It is not used directly, but through a `ResponsePolicyRuleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResponsePolicyRule; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResponsePolicyRule::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.response_policy_rules().create(req, "project", "location", "responsePolicy") +/// .client_operation_id("accusam") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyRuleCreateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResponsePolicyRule, + _project: String, + _location: String, + _response_policy: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyRuleCreateCall<'a, S> {} + +impl<'a, S> ResponsePolicyRuleCreateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePolicyRule)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.create", + http_method: hyper::Method::POST }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}/rules"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy")].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 ["responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::POST).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResponsePolicyRule) -> ResponsePolicyRuleCreateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyRuleCreateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyRuleCreateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy containing the Response Policy Rule. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyRuleCreateCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyRuleCreateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyRuleCreateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyRuleCreateCall<'a, S> + 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) -> ResponsePolicyRuleCreateCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Deletes a previously created Response Policy Rule. +/// +/// A builder for the *delete* method supported by a *responsePolicyRule* resource. +/// It is not used directly, but through a `ResponsePolicyRuleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.response_policy_rules().delete("project", "location", "responsePolicy", "responsePolicyRule") +/// .client_operation_id("accusam") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyRuleDeleteCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _response_policy: String, + _response_policy_rule: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyRuleDeleteCall<'a, S> {} + +impl<'a, S> ResponsePolicyRuleDeleteCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.delete", + http_method: hyper::Method::DELETE }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(6 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + params.push(("responsePolicyRule", self._response_policy_rule.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["project", "location", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].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 ["responsePolicyRule", "responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::DELETE).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = res; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyRuleDeleteCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyRuleDeleteCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy containing the Response Policy Rule. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyRuleDeleteCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// User assigned name of the Response Policy Rule addressed by this request. + /// + /// Sets the *response policy rule* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy_rule(mut self, new_value: &str) -> ResponsePolicyRuleDeleteCall<'a, S> { + self._response_policy_rule = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyRuleDeleteCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyRuleDeleteCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyRuleDeleteCall<'a, S> + 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) -> ResponsePolicyRuleDeleteCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Fetches the representation of an existing Response Policy Rule. +/// +/// A builder for the *get* method supported by a *responsePolicyRule* resource. +/// It is not used directly, but through a `ResponsePolicyRuleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.response_policy_rules().get("project", "location", "responsePolicy", "responsePolicyRule") +/// .client_operation_id("At") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyRuleGetCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _response_policy: String, + _response_policy_rule: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyRuleGetCall<'a, S> {} + +impl<'a, S> ResponsePolicyRuleGetCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePolicyRule)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.get", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + params.push(("responsePolicyRule", self._response_policy_rule.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].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 ["responsePolicyRule", "responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyRuleGetCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyRuleGetCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy containing the Response Policy Rule. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyRuleGetCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// User assigned name of the Response Policy Rule addressed by this request. + /// + /// Sets the *response policy rule* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy_rule(mut self, new_value: &str) -> ResponsePolicyRuleGetCall<'a, S> { + self._response_policy_rule = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyRuleGetCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyRuleGetCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyRuleGetCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ResponsePolicyRuleGetCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Enumerates all Response Policy Rules associated with a project. +/// +/// A builder for the *list* method supported by a *responsePolicyRule* resource. +/// It is not used directly, but through a `ResponsePolicyRuleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.response_policy_rules().list("project", "location", "responsePolicy") +/// .page_token("erat") +/// .max_results(-10) +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyRuleListCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _project: String, + _location: String, + _response_policy: String, + _page_token: Option, + _max_results: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyRuleListCall<'a, S> {} + +impl<'a, S> ResponsePolicyRuleListCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePolicyRulesListResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.list", + http_method: hyper::Method::GET }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(7 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + if let Some(value) = self._page_token { + params.push(("pageToken", value.to_string())); + } + if let Some(value) = self._max_results { + params.push(("maxResults", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "pageToken", "maxResults"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}/rules"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy")].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 ["responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::GET).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .body(hyper::body::Body::empty()); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyRuleListCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyRuleListCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy to list. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyRuleListCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// Optional. A tag returned by a previous list request that was truncated. Use this parameter to continue a previous list request. + /// + /// Sets the *page token* query property to the given value. + pub fn page_token(mut self, new_value: &str) -> ResponsePolicyRuleListCall<'a, S> { + self._page_token = Some(new_value.to_string()); + self + } + /// Optional. Maximum number of results to be returned. If unspecified, the server decides how many results to return. + /// + /// Sets the *max results* query property to the given value. + pub fn max_results(mut self, new_value: i32) -> ResponsePolicyRuleListCall<'a, S> { + self._max_results = Some(new_value); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyRuleListCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyRuleListCall<'a, S> + 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::NdevClouddnReadonly`. + /// + /// 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) -> ResponsePolicyRuleListCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Applies a partial update to an existing Response Policy Rule. +/// +/// A builder for the *patch* method supported by a *responsePolicyRule* resource. +/// It is not used directly, but through a `ResponsePolicyRuleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResponsePolicyRule; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResponsePolicyRule::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.response_policy_rules().patch(req, "project", "location", "responsePolicy", "responsePolicyRule") +/// .client_operation_id("sea") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyRulePatchCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResponsePolicyRule, + _project: String, + _location: String, + _response_policy: String, + _response_policy_rule: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyRulePatchCall<'a, S> {} + +impl<'a, S> ResponsePolicyRulePatchCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePolicyRulesPatchResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.patch", + http_method: hyper::Method::PATCH }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + params.push(("responsePolicyRule", self._response_policy_rule.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].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 ["responsePolicyRule", "responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PATCH).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResponsePolicyRule) -> ResponsePolicyRulePatchCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyRulePatchCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyRulePatchCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy containing the Response Policy Rule. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyRulePatchCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// User assigned name of the Response Policy Rule addressed by this request. + /// + /// Sets the *response policy rule* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy_rule(mut self, new_value: &str) -> ResponsePolicyRulePatchCall<'a, S> { + self._response_policy_rule = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyRulePatchCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyRulePatchCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyRulePatchCall<'a, S> + 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) -> ResponsePolicyRulePatchCall<'a, S> + where T: Into>, + St: AsRef { + match scope.into() { + Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), + None => None, + }; + self + } +} + + +/// Updates an existing Response Policy Rule. +/// +/// A builder for the *update* method supported by a *responsePolicyRule* resource. +/// It is not used directly, but through a `ResponsePolicyRuleMethods` instance. +/// +/// # Example +/// +/// Instantiate a resource method builder +/// +/// ```test_harness,no_run +/// # extern crate hyper; +/// # extern crate hyper_rustls; +/// # extern crate google_dns2 as dns2; +/// use dns2::api::ResponsePolicyRule; +/// # async fn dox() { +/// # use std::default::Default; +/// # use dns2::{Dns, oauth2, hyper, hyper_rustls}; +/// +/// # let secret: oauth2::ApplicationSecret = Default::default(); +/// # let auth = oauth2::InstalledFlowAuthenticator::builder( +/// # secret, +/// # oauth2::InstalledFlowReturnMethod::HTTPRedirect, +/// # ).build().await.unwrap(); +/// # let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = ResponsePolicyRule::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.response_policy_rules().update(req, "project", "location", "responsePolicy", "responsePolicyRule") +/// .client_operation_id("At") +/// .doit().await; +/// # } +/// ``` +pub struct ResponsePolicyRuleUpdateCall<'a, S> + where S: 'a { + + hub: &'a Dns, + _request: ResponsePolicyRule, + _project: String, + _location: String, + _response_policy: String, + _response_policy_rule: String, + _client_operation_id: Option, + _delegate: Option<&'a mut dyn client::Delegate>, + _additional_params: HashMap, + _scopes: BTreeMap +} + +impl<'a, S> client::CallBuilder for ResponsePolicyRuleUpdateCall<'a, S> {} + +impl<'a, S> ResponsePolicyRuleUpdateCall<'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ + + + /// Perform the operation you have build so far. + pub async fn doit(mut self) -> client::Result<(hyper::Response, ResponsePolicyRulesUpdateResponse)> { + use std::io::{Read, Seek}; + use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; + use client::ToParts; + let mut dd = client::DefaultDelegate; + let mut dlg: &mut dyn client::Delegate = match self._delegate { + Some(d) => d, + None => &mut dd + }; + dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.update", + http_method: hyper::Method::PUT }); + let mut params: Vec<(&str, String)> = Vec::with_capacity(8 + self._additional_params.len()); + params.push(("project", self._project.to_string())); + params.push(("location", self._location.to_string())); + params.push(("responsePolicy", self._response_policy.to_string())); + params.push(("responsePolicyRule", self._response_policy_rule.to_string())); + if let Some(value) = self._client_operation_id { + params.push(("clientOperationId", value.to_string())); + } + for &field in ["alt", "project", "location", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { + if self._additional_params.contains_key(field) { + dlg.finished(false); + return Err(client::Error::FieldClash(field)); + } + } + for (name, value) in self._additional_params.iter() { + params.push((&name, value.clone())); + } + + params.push(("alt", "json".to_string())); + + let mut url = self.hub._base_url.clone() + "dns/v2/projects/{project}/locations/{location}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; + if self._scopes.len() == 0 { + self._scopes.insert(Scope::CloudPlatform.as_ref().to_string(), ()); + } + + for &(find_this, param_name) in [("{project}", "project"), ("{location}", "location"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].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 ["responsePolicyRule", "responsePolicy", "location", "project"].iter() { + if let Some(index) = params.iter().position(|t| &t.0 == param_name) { + indices_for_removal.push(index); + } + } + for &index in indices_for_removal.iter() { + params.remove(index); + } + } + + let url = url::Url::parse_with_params(&url, params).unwrap(); + + let mut json_mime_type: mime::Mime = "application/json".parse().unwrap(); + let mut request_value_reader = + { + let mut value = json::value::to_value(&self._request).expect("serde to work"); + client::remove_json_null_values(&mut value); + let mut dst = io::Cursor::new(Vec::with_capacity(128)); + json::to_writer(&mut dst, &value).unwrap(); + dst + }; + let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap(); + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + + + loop { + let token = match self.hub.auth.token(&self._scopes.keys().collect::>()[..]).await { + Ok(token) => token.clone(), + Err(err) => { + match dlg.token(&err) { + Some(token) => token, + None => { + dlg.finished(false); + return Err(client::Error::MissingToken(err)) + } + } + } + }; + request_value_reader.seek(io::SeekFrom::Start(0)).unwrap(); + let mut req_result = { + let client = &self.hub.client; + dlg.pre_request(); + let mut req_builder = hyper::Request::builder().method(hyper::Method::PUT).uri(url.clone().into_string()) + .header(USER_AGENT, self.hub._user_agent.clone()) .header(AUTHORIZATION, format!("Bearer {}", token.as_str())); + + + let request = req_builder + .header(CONTENT_TYPE, format!("{}", json_mime_type.to_string())) + .header(CONTENT_LENGTH, request_size as u64) + .body(hyper::body::Body::from(request_value_reader.get_ref().clone())); + + client.request(request.unwrap()).await + + }; + + match req_result { + Err(err) => { + if let client::Retry::After(d) = dlg.http_error(&err) { + sleep(d); + continue; + } + dlg.finished(false); + return Err(client::Error::HttpError(err)) + } + Ok(mut res) => { + if !res.status().is_success() { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + let (parts, _) = res.into_parts(); + let body = hyper::Body::from(res_body_string.clone()); + let restored_response = hyper::Response::from_parts(parts, body); + + let server_response = json::from_str::(&res_body_string).ok(); + + if let client::Retry::After(d) = dlg.http_failure(&restored_response, server_response.clone()) { + sleep(d); + continue; + } + + dlg.finished(false); + + return match server_response { + Some(error_value) => Err(client::Error::BadRequest(error_value)), + None => Err(client::Error::Failure(restored_response)), + } + } + let result_value = { + let res_body_string = client::get_body_as_string(res.body_mut()).await; + + match json::from_str(&res_body_string) { + Ok(decoded) => (res, decoded), + Err(err) => { + dlg.response_json_decode_error(&res_body_string, &err); + return Err(client::Error::JsonDecodeError(res_body_string, err)); + } + } + }; + + dlg.finished(true); + return Ok(result_value) + } + } + } + } + + + /// + /// Sets the *request* property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn request(mut self, new_value: ResponsePolicyRule) -> ResponsePolicyRuleUpdateCall<'a, S> { + self._request = new_value; + self + } + /// Identifies the project addressed by this request. + /// + /// Sets the *project* path property to 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(mut self, new_value: &str) -> ResponsePolicyRuleUpdateCall<'a, S> { + self._project = new_value.to_string(); + self + } + /// Specifies the location of the resource. This information will be used for routing and will be part of the resource name. + /// + /// Sets the *location* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn location(mut self, new_value: &str) -> ResponsePolicyRuleUpdateCall<'a, S> { + self._location = new_value.to_string(); + self + } + /// User assigned name of the Response Policy containing the Response Policy Rule. + /// + /// Sets the *response policy* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy(mut self, new_value: &str) -> ResponsePolicyRuleUpdateCall<'a, S> { + self._response_policy = new_value.to_string(); + self + } + /// User assigned name of the Response Policy Rule addressed by this request. + /// + /// Sets the *response policy rule* path property to the given value. + /// + /// Even though the property as already been set when instantiating this call, + /// we provide this method for API completeness. + pub fn response_policy_rule(mut self, new_value: &str) -> ResponsePolicyRuleUpdateCall<'a, S> { + self._response_policy_rule = new_value.to_string(); + self + } + /// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection. + /// + /// Sets the *client operation id* query property to the given value. + pub fn client_operation_id(mut self, new_value: &str) -> ResponsePolicyRuleUpdateCall<'a, S> { + self._client_operation_id = Some(new_value.to_string()); + self + } + /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong + /// while executing the actual API request. + /// + /// It should be used to handle progress information, and to implement a certain level of resilience. + /// + /// Sets the *delegate* property to the given value. + pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ResponsePolicyRuleUpdateCall<'a, S> { + self._delegate = Some(new_value); + self + } + + /// Set any additional parameter of the query string used in the request. + /// It should be used to set parameters which are not yet available through their own + /// setters. + /// + /// Please note that this method must not be used to set any of the known parameters + /// which have their own setter method. If done anyway, the request will fail. + /// + /// # Additional Parameters + /// + /// * *$.xgafv* (query-string) - V1 error format. + /// * *access_token* (query-string) - OAuth access token. + /// * *alt* (query-string) - Data format for response. + /// * *callback* (query-string) - JSONP + /// * *fields* (query-string) - Selector specifying which fields to include in a partial response. + /// * *key* (query-string) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. + /// * *oauth_token* (query-string) - OAuth 2.0 token for the current user. + /// * *prettyPrint* (query-boolean) - Returns response with indentations and line breaks. + /// * *quotaUser* (query-string) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. + /// * *uploadType* (query-string) - Legacy upload protocol for media (e.g. "media", "multipart"). + /// * *upload_protocol* (query-string) - Upload protocol for media (e.g. "raw", "multipart"). + pub fn param(mut self, name: T, value: T) -> ResponsePolicyRuleUpdateCall<'a, S> + 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) -> ResponsePolicyRuleUpdateCall<'a, S> + where T: Into>, + St: AsRef { match scope.into() { Some(scope) => self._scopes.insert(scope.as_ref().to_string(), ()), None => None, diff --git a/gen/docs1/src/client.rs b/gen/docs1/src/client.rs index 00a357e930..ae3618a136 100644 --- a/gen/docs1/src/client.rs +++ b/gen/docs1/src/client.rs @@ -1,6 +1,7 @@ // COPY OF 'src/rust/api/client.rs' // DO NOT EDIT use std::error; +use std::error::Error as StdError; use std::fmt::{self, Display}; use std::io::{self, Cursor, Read, Seek, SeekFrom, Write}; use std::str::FromStr; @@ -9,7 +10,10 @@ use std::time::Duration; use itertools::Itertools; +use hyper::http::Uri; + use hyper::body::Buf; +use hyper::client::connect; use hyper::header::{HeaderMap, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, USER_AGENT}; use hyper::Method; use hyper::StatusCode; @@ -18,6 +22,9 @@ use mime::{Attr, Mime, SubLevel, TopLevel, Value}; use serde_json as json; +use tokio::io::{AsyncRead, AsyncWrite}; +use tower_service; + const LINE_ENDING: &str = "\r\n"; pub enum Retry { @@ -566,9 +573,15 @@ impl RangeResponseHeader { } /// A utility type to perform a resumable upload from start to end. -pub struct ResumableUploadHelper<'a, A: 'a> { +pub struct ResumableUploadHelper<'a, A: 'a, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ pub client: &'a hyper::client::Client< - hyper_rustls::HttpsConnector, + S, hyper::body::Body, >, pub delegate: &'a mut dyn Delegate, @@ -582,7 +595,13 @@ pub struct ResumableUploadHelper<'a, A: 'a> { pub content_length: u64, } -impl<'a, A> ResumableUploadHelper<'a, A> { +impl<'a, A, S> ResumableUploadHelper<'a, A, S> +where + S: tower_service::Service + Clone + Send + Sync + 'static, + S::Response: hyper::client::connect::Connection + AsyncRead + AsyncWrite + Send + Unpin + 'static, + S::Future: Send + Unpin + 'static, + S::Error: Into>, +{ async fn query_transfer_status( &mut self, ) -> std::result::Result>> { @@ -697,14 +716,11 @@ impl<'a, A> ResumableUploadHelper<'a, A> { } let (res_parts, res_body) = res.into_parts(); - let res_body_string: String = String::from_utf8( - hyper::body::to_bytes(res_body) - .await - .unwrap() - .into_iter() - .collect(), - ) - .unwrap(); + let res_body = match hyper::body::to_bytes(res_body).await { + Ok(res_body) => res_body.into_iter().collect(), + Err(err) => return Some(Err(err)), + }; + let res_body_string: String = String::from_utf8(res_body).unwrap(); let reconstructed_result = hyper::Response::from_parts(res_parts, res_body_string.clone().into()); diff --git a/gen/docs1/src/lib.rs b/gen/docs1/src/lib.rs index acd592d713..ae30b329cd 100644 --- a/gen/docs1/src/lib.rs +++ b/gen/docs1/src/lib.rs @@ -1,18 +1,34 @@ // DO NOT EDIT ! -// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako' // DO NOT EDIT ! -//! This documentation was generated from *Docs* crate version *3.1.0+20220301*, where *20220301* is the exact revision of the *docs:v1* schema built by the [mako](http://www.makotemplates.org/) code generator *v3.1.0*. +//! This documentation was generated from *Dns* crate version *4.0.1+20220217*, where *20220217* is the exact revision of the *dns:v2* schema built by the [mako](http://www.makotemplates.org/) code generator *v4.0.1*. //! -//! Everything else about the *Docs* *v1* API can be found at the -//! [official documentation site](https://developers.google.com/docs/). -//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/docs1). +//! Everything else about the *Dns* *v2* API can be found at the +//! [official documentation site](https://cloud.google.com/dns/docs). +//! The original source code is [on github](https://github.com/Byron/google-apis-rs/tree/main/gen/dns2). //! # Features //! -//! Handle the following *Resources* with ease from the central [hub](Docs) ... +//! Handle the following *Resources* with ease from the central [hub](Dns) ... //! -//! * [documents](api::Document) -//! * [*batch update*](api::DocumentBatchUpdateCall), [*create*](api::DocumentCreateCall) and [*get*](api::DocumentGetCall) +//! * [changes](api::Change) +//! * [*create*](api::ChangeCreateCall), [*get*](api::ChangeGetCall) and [*list*](api::ChangeListCall) +//! * [dns keys](api::DnsKey) +//! * [*get*](api::DnsKeyGetCall) and [*list*](api::DnsKeyListCall) +//! * managed zone operations +//! * [*get*](api::ManagedZoneOperationGetCall) and [*list*](api::ManagedZoneOperationListCall) +//! * [managed zones](api::ManagedZone) +//! * [*create*](api::ManagedZoneCreateCall), [*delete*](api::ManagedZoneDeleteCall), [*get*](api::ManagedZoneGetCall), [*list*](api::ManagedZoneListCall), [*patch*](api::ManagedZonePatchCall) and [*update*](api::ManagedZoneUpdateCall) +//! * [policies](api::Policy) +//! * [*create*](api::PolicyCreateCall), [*delete*](api::PolicyDeleteCall), [*get*](api::PolicyGetCall), [*list*](api::PolicyListCall), [*patch*](api::PolicyPatchCall) and [*update*](api::PolicyUpdateCall) +//! * [projects](api::Project) +//! * [*get*](api::ProjectGetCall) +//! * [resource record sets](api::ResourceRecordSet) +//! * [*create*](api::ResourceRecordSetCreateCall), [*delete*](api::ResourceRecordSetDeleteCall), [*get*](api::ResourceRecordSetGetCall), [*list*](api::ResourceRecordSetListCall) and [*patch*](api::ResourceRecordSetPatchCall) +//! * [response policies](api::ResponsePolicy) +//! * [*create*](api::ResponsePolicyCreateCall), [*delete*](api::ResponsePolicyDeleteCall), [*get*](api::ResponsePolicyGetCall), [*list*](api::ResponsePolicyListCall), [*patch*](api::ResponsePolicyPatchCall) and [*update*](api::ResponsePolicyUpdateCall) +//! * [response policy rules](api::ResponsePolicyRule) +//! * [*create*](api::ResponsePolicyRuleCreateCall), [*delete*](api::ResponsePolicyRuleDeleteCall), [*get*](api::ResponsePolicyRuleGetCall), [*list*](api::ResponsePolicyRuleListCall), [*patch*](api::ResponsePolicyRulePatchCall) and [*update*](api::ResponsePolicyRuleUpdateCall) //! //! //! @@ -23,7 +39,7 @@ //! //! The API is structured into the following primary items: //! -//! * **[Hub](Docs)** +//! * **[Hub](Dns)** //! * a central object to maintain state and allow accessing all *Activities* //! * creates [*Method Builders*](client::MethodsBuilder) which in turn //! allow access to individual [*Call Builders*](client::CallBuilder) @@ -47,9 +63,12 @@ //! Or specifically ... //! //! ```ignore -//! let r = hub.documents().batch_update(...).doit().await -//! let r = hub.documents().create(...).doit().await -//! let r = hub.documents().get(...).doit().await +//! let r = hub.managed_zones().create(...).doit().await +//! let r = hub.managed_zones().delete(...).doit().await +//! let r = hub.managed_zones().get(...).doit().await +//! let r = hub.managed_zones().list(...).doit().await +//! let r = hub.managed_zones().patch(...).doit().await +//! let r = hub.managed_zones().update(...).doit().await //! ``` //! //! The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities` @@ -65,7 +84,7 @@ //! //! ```toml //! [dependencies] -//! google-docs1 = "*" +//! google-dns2 = "*" //! serde = "^1.0" //! serde_json = "^1.0" //! ``` @@ -75,12 +94,11 @@ //! ```test_harness,no_run //! extern crate hyper; //! extern crate hyper_rustls; -//! extern crate google_docs1 as docs1; -//! use docs1::api::BatchUpdateDocumentRequest; -//! use docs1::{Result, Error}; +//! extern crate google_dns2 as dns2; +//! use dns2::{Result, Error}; //! # async fn dox() { //! use std::default::Default; -//! use docs1::{Docs, oauth2, hyper, hyper_rustls}; +//! use dns2::{Dns, oauth2, hyper, hyper_rustls}; //! //! // Get an ApplicationSecret instance by some means. It contains the `client_id` and //! // `client_secret`, among other things. @@ -94,16 +112,14 @@ //! secret, //! oauth2::InstalledFlowReturnMethod::HTTPRedirect, //! ).build().await.unwrap(); -//! let mut hub = Docs::new(hyper::Client::builder().build(hyper_rustls::HttpsConnector::with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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 = BatchUpdateDocumentRequest::default(); -//! +//! let mut hub = Dns::new(hyper::Client::builder().build(hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build()), 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.documents().batch_update(req, "documentId") +//! let result = hub.managed_zones().list("project", "location") +//! .page_token("sed") +//! .max_results(-2) +//! .dns_name("takimata") //! .doit().await; //! //! match result { @@ -186,7 +202,7 @@ #![allow(unused_imports, unused_mut, dead_code)] // DO NOT EDIT ! -// This file was generated automatically from 'src/mako/api/lib.rs.mako' +// This file was generated automatically from 'src/generator/templates/api/lib.rs.mako' // DO NOT EDIT ! #[macro_use] @@ -206,5 +222,5 @@ pub mod api; pub mod client; // Re-export the hub type and some basic client structs -pub use api::Docs; +pub use api::Dns; pub use client::{Result, Error, Delegate};