use std::collections::HashMap; use std::cell::RefCell; use std::default::Default; use std::collections::BTreeSet; use std::error::Error as StdError; use serde_json as json; use std::io; use std::fs; use std::mem; use hyper::client::connect; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::time::sleep; use tower_service; use serde::{Serialize, Deserialize}; use crate::{client, client::GetToken, client::serde_with}; // ############## // UTILITIES ### // ############ /// Identifies the an OAuth2 authorization scope. /// A scope is needed when requesting an /// [authorization token](https://developers.google.com/youtube/v3/guides/authentication). #[derive(PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Clone, Copy)] pub enum Scope { /// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. CloudPlatform, /// View your data across Google Cloud services and see the email address of your Google Account CloudPlatformReadOnly, /// View your DNS records hosted by Google Cloud DNS NdevClouddnReadonly, /// View and manage your DNS records hosted by Google Cloud DNS NdevClouddnReadwrite, } impl AsRef for Scope { fn as_ref(&self) -> &str { match *self { 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::NdevClouddnReadonly } } // ######## // HUB ### // ###### /// Central instance to access all Dns related resource activities /// /// # Examples /// /// Instantiate a new hub /// /// ```test_harness,no_run /// extern crate hyper; /// extern crate hyper_rustls; /// extern crate google_dns1 as dns1; /// use dns1::{Result, Error}; /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// // Get an ApplicationSecret instance by some means. It contains the `client_id` and /// // `client_secret`, among other things. /// let secret: oauth2::ApplicationSecret = Default::default(); /// // Instantiate the authenticator. It will choose a suitable authentication flow for you, /// // unless you replace `None` with the desired Flow. /// // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about /// // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and /// // retrieve them from storage. /// let auth = 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().unwrap().https_or_http().enable_http1().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") /// .page_token("takimata") /// .max_results(-52) /// .dns_name("duo") /// .doit().await; /// /// match result { /// Err(e) => match e { /// // The Error enum provides details about what exactly happened. /// // You can also just use its `Debug`, `Display` or `Error` traits /// Error::HttpError(_) /// |Error::Io(_) /// |Error::MissingAPIKey /// |Error::MissingToken(_) /// |Error::Cancelled /// |Error::UploadSizeLimitExceeded(_, _) /// |Error::Failure(_) /// |Error::BadRequest(_) /// |Error::FieldClash(_) /// |Error::JsonDecodeError(_, _) => println!("{}", e), /// }, /// Ok(res) => println!("Success: {:?}", res), /// } /// # } /// ``` #[derive(Clone)] pub struct Dns { pub client: hyper::Client, pub auth: Box, _user_agent: String, _base_url: String, _root_url: String, } impl<'a, S> client::Hub for Dns {} impl<'a, S> Dns { pub fn new(client: hyper::Client, auth: A) -> Dns { Dns { client, auth: Box::new(auth), _user_agent: "google-api-rust-client/5.0.5".to_string(), _base_url: "https://dns.googleapis.com/".to_string(), _root_url: "https://dns.googleapis.com/".to_string(), } } 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/5.0.5`. /// /// Returns the previously set user-agent. pub fn user_agent(&mut self, agent_name: String) -> String { mem::replace(&mut self._user_agent, agent_name) } /// Set the base url to use in all requests to the server. /// It defaults to `https://dns.googleapis.com/`. /// /// Returns the previously set base url. pub fn base_url(&mut self, new_base_url: String) -> String { mem::replace(&mut self._base_url, new_base_url) } /// Set the root url to use in all requests to the server. /// It defaults to `https://dns.googleapis.com/`. /// /// Returns the previously set root url. pub fn root_url(&mut self, new_root_url: String) -> String { mem::replace(&mut self._root_url, new_root_url) } } // ############ // SCHEMAS ### // ########## /// 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*). /// /// * [create changes](ChangeCreateCall) (request|response) /// * [get changes](ChangeGetCall) (response) /// * [list changes](ChangeListCall) (none) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 Change {} impl client::Resource for Change {} impl client::ResponseResult for Change {} /// 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*). /// /// * [list changes](ChangeListCall) (response) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ChangesListResponse { /// The requested changes. pub changes: Option>, /// Type of resource. pub kind: Option, /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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 ChangesListResponse {} /// 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*). /// /// * [get dns keys](DnsKeyGetCall) (response) /// * [list dns keys](DnsKeyListCall) (none) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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, /// 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::Resource for DnsKey {} impl client::ResponseResult for DnsKey {} /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 DnsKeyDigest {} /// 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 DnsKeySpec {} /// The response to a request to enumerate DnsKeys in a ManagedZone. /// /// # 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct DnsKeysListResponse { /// The requested resources. #[serde(rename="dnsKeys")] pub dns_keys: Option>, /// Type of resource. pub kind: Option, /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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 DnsKeysListResponse {} /// Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec. Example (Comparison): title: "Summary size limit" description: "Determines if a summary is less than 100 chars" expression: "document.summary.size() < 100" Example (Equality): title: "Requestor is owner" description: "Determines if requestor is the document owner" expression: "document.owner == request.auth.claims.email" Example (Logic): title: "Public documents" description: "Determine whether the document should be publicly visible" expression: "document.type != 'private' && document.type != 'internal'" Example (Data Manipulation): title: "Notification string" description: "Create a notification string with a timestamp." expression: "'New message received at ' + string(document.create_time)" The exact variables and functions that may be referenced within an expression are determined by the service that evaluates it. See the service documentation for additional information. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Expr { /// Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. pub description: Option, /// Textual representation of an expression in Common Expression Language syntax. pub expression: Option, /// Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. pub location: Option, /// Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. pub title: Option, } impl client::Part for Expr {} /// Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1AuditConfig { /// The configuration for logging of each type of permission. #[serde(rename="auditLogConfigs")] pub audit_log_configs: Option>, /// Specifies a service that will be enabled for audit logging. For example, `storage.googleapis.com`, `cloudsql.googleapis.com`. `allServices` is a special value that covers all services. pub service: Option, } impl client::Part for GoogleIamV1AuditConfig {} /// Provides the configuration for logging a type of permissions. Example: { "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" } ] } This enables 'DATA_READ' and 'DATA_WRITE' logging, while exempting jose@example.com from DATA_READ logging. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1AuditLogConfig { /// Specifies the identities that do not cause logging for this type of permission. Follows the same format of Binding.members. #[serde(rename="exemptedMembers")] pub exempted_members: Option>, /// The log type that this config enables. #[serde(rename="logType")] pub log_type: Option, } impl client::Part for GoogleIamV1AuditLogConfig {} /// Associates `members`, or principals, with a `role`. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1Binding { /// The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). pub condition: Option, /// Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`. pub members: Option>, /// Role that is assigned to the list of `members`, or principals. For example, `roles/viewer`, `roles/editor`, or `roles/owner`. For an overview of the IAM roles and permissions, see the [IAM documentation](https://cloud.google.com/iam/docs/roles-overview). For a list of the available pre-defined roles, see [here](https://cloud.google.com/iam/docs/understanding-roles). pub role: Option, } impl client::Part for GoogleIamV1Binding {} /// Request message for `GetIamPolicy` method. /// /// # 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 iam policy managed zones](ManagedZoneGetIamPolicyCall) (request) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1GetIamPolicyRequest { /// OPTIONAL: A `GetPolicyOptions` object for specifying options to `GetIamPolicy`. pub options: Option, } impl client::RequestValue for GoogleIamV1GetIamPolicyRequest {} /// Encapsulates settings provided to GetIamPolicy. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1GetPolicyOptions { /// Optional. The maximum policy version that will be used to format the policy. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional role bindings must specify version 3. Policies with no conditional role bindings may specify any valid value or leave the field unset. The policy in the response might use the policy version that you specified, or it might use a lower policy version. For example, if you specify version 3, but the policy has no conditional role bindings, the response uses version 1. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). #[serde(rename="requestedPolicyVersion")] pub requested_policy_version: Option, } impl client::Part for GoogleIamV1GetPolicyOptions {} /// An Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources. A `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role. For some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). **JSON example:** `{ "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }` **YAML example:** `bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3` For a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/). /// /// # 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 iam policy managed zones](ManagedZoneGetIamPolicyCall) (response) /// * [set iam policy managed zones](ManagedZoneSetIamPolicyCall) (response) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1Policy { /// Specifies cloud audit logging configuration for this policy. #[serde(rename="auditConfigs")] pub audit_configs: Option>, /// Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`. pub bindings: Option>, /// `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. #[serde_as(as = "Option<::client::serde::standard_base64::Wrapper>")] pub etag: Option>, /// Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). pub version: Option, } impl client::ResponseResult for GoogleIamV1Policy {} /// Request message for `SetIamPolicy` method. /// /// # 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*). /// /// * [set iam policy managed zones](ManagedZoneSetIamPolicyCall) (request) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1SetIamPolicyRequest { /// REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them. pub policy: Option, /// OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: `paths: "bindings, etag"` #[serde(rename="updateMask")] pub update_mask: Option, } impl client::RequestValue for GoogleIamV1SetIamPolicyRequest {} /// Request message for `TestIamPermissions` method. /// /// # 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*). /// /// * [test iam permissions managed zones](ManagedZoneTestIamPermissionCall) (request) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1TestIamPermissionsRequest { /// The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). pub permissions: Option>, } impl client::RequestValue for GoogleIamV1TestIamPermissionsRequest {} /// Response message for `TestIamPermissions` method. /// /// # 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*). /// /// * [test iam permissions managed zones](ManagedZoneTestIamPermissionCall) (response) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct GoogleIamV1TestIamPermissionsResponse { /// A subset of `TestPermissionsRequest.permissions` that the caller is allowed. pub permissions: Option>, } impl client::ResponseResult for GoogleIamV1TestIamPermissionsResponse {} /// 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. /// /// # 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) /// * [get iam policy managed zones](ManagedZoneGetIamPolicyCall) (none) /// * [list managed zones](ManagedZoneListCall) (none) /// * [patch managed zones](ManagedZonePatchCall) (request) /// * [set iam policy managed zones](ManagedZoneSetIamPolicyCall) (none) /// * [test iam permissions managed zones](ManagedZoneTestIamPermissionCall) (none) /// * [update managed zones](ManagedZoneUpdateCall) (request) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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) #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")] 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, /// 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::RequestValue for ManagedZone {} impl client::Resource for ManagedZone {} impl client::ResponseResult for ManagedZone {} /// Cloud Logging configurations for publicly visible zones. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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, /// IPv6 address of a target name server. Does not accept both fields (ipv4 & ipv6) being populated. Public preview as of November 2022. #[serde(rename="ipv6Address")] pub ipv6_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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManagedZoneOperationsListResponse { /// Type of resource. pub kind: Option, /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ManagedZonesListResponse { /// Type of resource. pub kind: Option, /// The managed zone resources. #[serde(rename="managedZones")] pub managed_zones: Option>, /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PoliciesListResponse { /// Type of resource. pub kind: Option, /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PoliciesPatchResponse { /// 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct PoliciesUpdateResponse { /// 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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). #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")] pub id: Option, /// no description provided pub kind: Option, /// User-assigned name for this policy. pub name: Option, /// List of network names specifying networks to which this policy is applied. pub networks: Option>, } impl client::RequestValue for Policy {} impl client::ResponseResult for Policy {} /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 PolicyAlternativeNameServerConfig {} /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 queries to. #[serde(rename="ipv4Address")] pub ipv4_address: Option, /// IPv6 address to forward to. Does not accept both fields (ipv4 & ipv6) being populated. Public preview as of November 2022. #[serde(rename="ipv6Address")] pub ipv6_address: Option, /// no description provided pub kind: Option, } impl client::Part for PolicyAlternativeNameServerConfigTargetNameServer {} /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 PolicyNetwork {} /// 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. /// /// # 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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). #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")] 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct Quota { /// Maximum allowed number of DnsKeys per ManagedZone. #[serde(rename="dnsKeysPerManagedZone")] pub dns_keys_per_managed_zone: Option, /// Maximum allowed number of GKE clusters to which a privately scoped zone can be attached. #[serde(rename="gkeClustersPerManagedZone")] pub gke_clusters_per_managed_zone: Option, /// Maximum allowed number of GKE clusters per policy. #[serde(rename="gkeClustersPerPolicy")] pub gke_clusters_per_policy: Option, /// Maximum allowed number of GKE clusters per response policy. #[serde(rename="gkeClustersPerResponsePolicy")] pub gke_clusters_per_response_policy: 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 GKE cluster. #[serde(rename="managedZonesPerGkeCluster")] pub managed_zones_per_gke_cluster: Option, /// Maximum allowed number of managed zones which can be attached to a network. #[serde(rename="managedZonesPerNetwork")] pub managed_zones_per_network: Option, /// Maximum number of nameservers per delegation, meant to prevent abuse #[serde(rename="nameserversPerDelegation")] pub nameservers_per_delegation: 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 networks per response policy. #[serde(rename="networksPerResponsePolicy")] pub networks_per_response_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 response policies per project. #[serde(rename="responsePolicies")] pub response_policies: Option, /// Maximum allowed number of rules per response policy. #[serde(rename="responsePolicyRulesPerResponsePolicy")] pub response_policy_rules_per_response_policy: 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 Quota {} /// 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicy { /// no description provided pub geo: Option, /// no description provided pub kind: Option, /// no description provided #[serde(rename="primaryBackup")] pub primary_backup: Option, /// no description provided pub wrr: Option, } impl client::Part for RRSetRoutingPolicy {} /// 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicyGeoPolicy { /// Without fencing, if health check fails for all configured items in the current geo bucket, we failover to the next nearest geo bucket. With fencing, if health checking is enabled, as long as some targets in the current geo bucket are healthy, we return only the healthy targets. However, if all targets are unhealthy, we don't failover to the next nearest bucket; instead, we return all the items in the current bucket even when all targets are unhealthy. #[serde(rename="enableFencing")] pub enable_fencing: Option, /// 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 RRSetRoutingPolicyGeoPolicy {} /// ResourceRecordSet data for one geo location. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicyGeoPolicyGeoPolicyItem { /// For A and AAAA types only. Endpoints to return in the query result only if they are healthy. These can be specified along with `rrdata` within this item. #[serde(rename="healthCheckedTargets")] pub health_checked_targets: Option, /// 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. If health checked targets are provided for DNSSEC enabled zones, there's a restriction of 1 IP address per item. #[serde(rename="signatureRrdatas")] pub signature_rrdatas: Option>, } impl client::Part for RRSetRoutingPolicyGeoPolicyGeoPolicyItem {} /// HealthCheckTargets describes endpoints to health-check when responding to Routing Policy queries. Only the healthy endpoints will be included in the response. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicyHealthCheckTargets { /// Configuration for internal load balancers to be health checked. #[serde(rename="internalLoadBalancers")] pub internal_load_balancers: Option>, } impl client::Part for RRSetRoutingPolicyHealthCheckTargets {} /// The configuration for an individual load balancer to health check. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicyLoadBalancerTarget { /// The frontend IP address of the load balancer to health check. #[serde(rename="ipAddress")] pub ip_address: Option, /// The protocol of the load balancer to health check. #[serde(rename="ipProtocol")] pub ip_protocol: Option, /// no description provided pub kind: Option, /// The type of load balancer specified by this target. This value must match the configuration of the load balancer located at the LoadBalancerTarget's IP address, port, and region. Use the following: - *regionalL4ilb*: for a regional internal passthrough Network Load Balancer. - *regionalL7ilb*: for a regional internal Application Load Balancer. - *globalL7ilb*: for a global internal Application Load Balancer. #[serde(rename="loadBalancerType")] pub load_balancer_type: Option, /// The fully qualified URL of the network that the load balancer is attached to. This should be formatted like `https://www.googleapis.com/compute/v1/projects/{project}/global/networks/{network}`. #[serde(rename="networkUrl")] pub network_url: Option, /// The configured port of the load balancer. pub port: Option, /// The project ID in which the load balancer is located. pub project: Option, /// The region in which the load balancer is located. pub region: Option, } impl client::Part for RRSetRoutingPolicyLoadBalancerTarget {} /// Configures a RRSetRoutingPolicy such that all queries are responded with the primary_targets if they are healthy. And if all of them are unhealthy, then we fallback to a geo localized policy. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicyPrimaryBackupPolicy { /// Backup targets provide a regional failover policy for the otherwise global primary targets. If serving state is set to `BACKUP`, this policy essentially becomes a geo routing policy. #[serde(rename="backupGeoTargets")] pub backup_geo_targets: Option, /// no description provided pub kind: Option, /// Endpoints that are health checked before making the routing decision. Unhealthy endpoints are omitted from the results. If all endpoints are unhealthy, we serve a response based on the `backup_geo_targets`. #[serde(rename="primaryTargets")] pub primary_targets: Option, /// When serving state is `PRIMARY`, this field provides the option of sending a small percentage of the traffic to the backup targets. #[serde(rename="trickleTraffic")] pub trickle_traffic: Option, } impl client::Part for RRSetRoutingPolicyPrimaryBackupPolicy {} /// 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicyWrrPolicy { /// no description provided pub items: Option>, /// no description provided pub kind: Option, } impl client::Part for RRSetRoutingPolicyWrrPolicy {} /// 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct RRSetRoutingPolicyWrrPolicyWrrPolicyItem { /// Endpoints that are health checked before making the routing decision. The unhealthy endpoints are omitted from the result. If all endpoints within a bucket are unhealthy, we choose a different bucket (sampled with respect to its weight) for responding. If DNSSEC is enabled for this zone, only one of `rrdata` or `health_checked_targets` can be set. #[serde(rename="healthCheckedTargets")] pub health_checked_targets: Option, /// 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 address per item. #[serde(rename="signatureRrdatas")] pub signature_rrdatas: Option>, /// The weight corresponding to this `WrrPolicyItem` object. When multiple `WrrPolicyItem` objects are configured, the probability of returning an `WrrPolicyItem` object's data is proportional to its weight relative to the sum of weights configured for all items. This weight must be non-negative. pub weight: Option, } impl client::Part for RRSetRoutingPolicyWrrPolicyWrrPolicyItem {} /// A unit of data that is returned by the DNS servers. /// /// # 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceRecordSet { /// no description provided pub kind: Option, /// For example, www.example.com. pub name: Option, /// Configures dynamic query responses based on either the geo location of the querying user or a weighted round robin based routing policy. A valid `ResourceRecordSet` contains only `rrdata` (for static resolution) or a `routing_policy` (for dynamic resolution). #[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::RequestValue for ResourceRecordSet {} impl client::Resource for ResourceRecordSet {} impl client::ResponseResult for ResourceRecordSet {} /// 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*). /// /// * [delete resource record sets](ResourceRecordSetDeleteCall) (response) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceRecordSetsDeleteResponse { _never_set: Option } impl client::ResponseResult for ResourceRecordSetsDeleteResponse {} /// 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResourceRecordSetsListResponse { /// Type of resource. pub kind: Option, /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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 {} /// 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResponsePoliciesListResponse { /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResponsePoliciesPatchResponse { /// 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResponsePoliciesUpdateResponse { /// 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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). #[serde_as(as = "Option<::client::serde_with::DisplayFromStr>")] pub id: Option, /// no description provided pub kind: Option, /// User labels. pub labels: 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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 ResponsePolicyGKECluster {} /// There is no detailed description. /// /// This type is not used in any activity, and only used as *part* of another schema. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 ResponsePolicyNetwork {} /// 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) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[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. /// #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] 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 ResponsePolicyRuleLocalData {} /// 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 policy rules](ResponsePolicyRuleListCall) (response) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResponsePolicyRulesListResponse { /// This field indicates that more results are available beyond the last page displayed. To fetch the results, make another list request and use this value as your page token. This lets you retrieve the complete contents of a very large collection 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 can't 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::ResponseResult for ResponsePolicyRulesListResponse {} /// 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 policy rules](ResponsePolicyRulePatchCall) (response) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResponsePolicyRulesPatchResponse { /// no description provided #[serde(rename="responsePolicyRule")] pub response_policy_rule: Option, } impl client::ResponseResult for ResponsePolicyRulesPatchResponse {} /// 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 policy rules](ResponsePolicyRuleUpdateCall) (response) #[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] #[serde_with::serde_as(crate = "::client::serde_with")] #[derive(Default, Clone, Debug, Serialize, Deserialize)] pub struct ResponsePolicyRulesUpdateResponse { /// no description provided #[serde(rename="responsePolicyRule")] pub response_policy_rule: Option, } impl client::ResponseResult for ResponsePolicyRulesUpdateResponse {} // ################### // MethodBuilders ### // ################# /// A builder providing access to all methods supported on *change* 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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().build()), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* /// // like `create(...)`, `get(...)` and `list(...)` /// // to build up your call. /// let rb = hub.changes(); /// # } /// ``` pub struct ChangeMethods<'a, S> where S: 'a { hub: &'a Dns, } impl<'a, S> client::MethodsBuilder for ChangeMethods<'a, S> {} impl<'a, S> ChangeMethods<'a, S> { /// Create a builder to help you perform the following task: /// /// Atomically updates the ResourceRecordSet collection. /// /// # Arguments /// /// * `request` - No description provided. /// * `project` - Identifies the project addressed by this request. /// * `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, managed_zone: &str) -> ChangeCreateCall<'a, S> { ChangeCreateCall { hub: self.hub, _request: request, _project: project.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 Change. /// /// # Arguments /// /// * `project` - Identifies the project addressed by this request. /// * `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, managed_zone: &str, change_id: &str) -> ChangeGetCall<'a, S> { ChangeGetCall { hub: self.hub, _project: project.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(), } } /// Create a builder to help you perform the following task: /// /// Enumerates Changes to a ResourceRecordSet collection. /// /// # Arguments /// /// * `project` - Identifies the project addressed by this request. /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. pub fn list(&self, project: &str, managed_zone: &str) -> ChangeListCall<'a, S> { ChangeListCall { hub: self.hub, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().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. /// * `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, managed_zone: &str, dns_key_id: &str) -> DnsKeyGetCall<'a, S> { DnsKeyGetCall { hub: self.hub, _project: project.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. /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. pub fn list(&self, project: &str, managed_zone: &str) -> DnsKeyListCall<'a, S> { DnsKeyListCall { hub: self.hub, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().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. /// * `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, managed_zone: &str, operation: &str) -> ManagedZoneOperationGetCall<'a, S> { ManagedZoneOperationGetCall { hub: self.hub, _project: project.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. /// * `managedZone` - Identifies the managed zone addressed by this request. pub fn list(&self, project: &str, managed_zone: &str) -> ManagedZoneOperationListCall<'a, S> { ManagedZoneOperationListCall { hub: self.hub, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().build()), auth); /// // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* /// // like `create(...)`, `delete(...)`, `get(...)`, `get_iam_policy(...)`, `list(...)`, `patch(...)`, `set_iam_policy(...)`, `test_iam_permissions(...)` 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. pub fn create(&self, request: ManagedZone, project: &str) -> ManagedZoneCreateCall<'a, S> { ManagedZoneCreateCall { hub: self.hub, _request: request, _project: project.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. /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. pub fn delete(&self, project: &str, managed_zone: &str) -> ManagedZoneDeleteCall<'a, S> { ManagedZoneDeleteCall { hub: self.hub, _project: project.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. /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. pub fn get(&self, project: &str, managed_zone: &str) -> ManagedZoneGetCall<'a, S> { ManagedZoneGetCall { hub: self.hub, _project: project.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: /// /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. /// /// # Arguments /// /// * `request` - No description provided. /// * `resource` - REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field. pub fn get_iam_policy(&self, request: GoogleIamV1GetIamPolicyRequest, resource: &str) -> ManagedZoneGetIamPolicyCall<'a, S> { ManagedZoneGetIamPolicyCall { hub: self.hub, _request: request, _resource: resource.to_string(), _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. pub fn list(&self, project: &str) -> ManagedZoneListCall<'a, S> { ManagedZoneListCall { hub: self.hub, _project: project.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. /// * `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, managed_zone: &str) -> ManagedZonePatchCall<'a, S> { ManagedZonePatchCall { hub: self.hub, _request: request, _project: project.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: /// /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. /// /// # Arguments /// /// * `request` - No description provided. /// * `resource` - REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field. pub fn set_iam_policy(&self, request: GoogleIamV1SetIamPolicyRequest, resource: &str) -> ManagedZoneSetIamPolicyCall<'a, S> { ManagedZoneSetIamPolicyCall { hub: self.hub, _request: request, _resource: resource.to_string(), _delegate: Default::default(), _additional_params: Default::default(), _scopes: Default::default(), } } /// Create a builder to help you perform the following task: /// /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this returns an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning. /// /// # Arguments /// /// * `request` - No description provided. /// * `resource` - REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field. pub fn test_iam_permissions(&self, request: GoogleIamV1TestIamPermissionsRequest, resource: &str) -> ManagedZoneTestIamPermissionCall<'a, S> { ManagedZoneTestIamPermissionCall { hub: self.hub, _request: request, _resource: resource.to_string(), _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. /// * `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, managed_zone: &str) -> ManagedZoneUpdateCall<'a, S> { ManagedZoneUpdateCall { hub: self.hub, _request: request, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().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. pub fn create(&self, request: Policy, project: &str) -> PolicyCreateCall<'a, S> { PolicyCreateCall { hub: self.hub, _request: request, _project: project.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. /// * `policy` - User given friendly name of the policy addressed by this request. pub fn delete(&self, project: &str, policy: &str) -> PolicyDeleteCall<'a, S> { PolicyDeleteCall { hub: self.hub, _project: project.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. /// * `policy` - User given friendly name of the policy addressed by this request. pub fn get(&self, project: &str, policy: &str) -> PolicyGetCall<'a, S> { PolicyGetCall { hub: self.hub, _project: project.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. pub fn list(&self, project: &str) -> PolicyListCall<'a, S> { PolicyListCall { hub: self.hub, _project: project.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. /// * `policy` - User given friendly name of the policy addressed by this request. pub fn patch(&self, request: Policy, project: &str, policy: &str) -> PolicyPatchCall<'a, S> { PolicyPatchCall { hub: self.hub, _request: request, _project: project.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. /// * `policy` - User given friendly name of the policy addressed by this request. pub fn update(&self, request: Policy, project: &str, policy: &str) -> PolicyUpdateCall<'a, S> { PolicyUpdateCall { hub: self.hub, _request: request, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().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. pub fn get(&self, project: &str) -> ProjectGetCall<'a, S> { ProjectGetCall { hub: self.hub, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().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. /// * `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, managed_zone: &str) -> ResourceRecordSetCreateCall<'a, S> { ResourceRecordSetCreateCall { hub: self.hub, _request: request, _project: project.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. /// * `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, managed_zone: &str, name: &str, type_: &str) -> ResourceRecordSetDeleteCall<'a, S> { ResourceRecordSetDeleteCall { hub: self.hub, _project: project.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. /// * `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, managed_zone: &str, name: &str, type_: &str) -> ResourceRecordSetGetCall<'a, S> { ResourceRecordSetGetCall { hub: self.hub, _project: project.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. /// * `managedZone` - Identifies the managed zone addressed by this request. Can be the managed zone name or ID. pub fn list(&self, project: &str, managed_zone: &str) -> ResourceRecordSetListCall<'a, S> { ResourceRecordSetListCall { hub: self.hub, _project: project.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. /// * `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, managed_zone: &str, name: &str, type_: &str) -> ResourceRecordSetPatchCall<'a, S> { ResourceRecordSetPatchCall { hub: self.hub, _request: request, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().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. pub fn create(&self, request: ResponsePolicy, project: &str) -> ResponsePolicyCreateCall<'a, S> { ResponsePolicyCreateCall { hub: self.hub, _request: request, _project: project.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. /// * `responsePolicy` - User assigned name of the Response Policy addressed by this request. pub fn delete(&self, project: &str, response_policy: &str) -> ResponsePolicyDeleteCall<'a, S> { ResponsePolicyDeleteCall { hub: self.hub, _project: project.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. /// * `responsePolicy` - User assigned name of the Response Policy addressed by this request. pub fn get(&self, project: &str, response_policy: &str) -> ResponsePolicyGetCall<'a, S> { ResponsePolicyGetCall { hub: self.hub, _project: project.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. pub fn list(&self, project: &str) -> ResponsePolicyListCall<'a, S> { ResponsePolicyListCall { hub: self.hub, _project: project.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. /// * `responsePolicy` - User assigned name of the response policy addressed by this request. pub fn patch(&self, request: ResponsePolicy, project: &str, response_policy: &str) -> ResponsePolicyPatchCall<'a, S> { ResponsePolicyPatchCall { hub: self.hub, _request: request, _project: project.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. /// * `responsePolicy` - User assigned name of the Response Policy addressed by this request. pub fn update(&self, request: ResponsePolicy, project: &str, response_policy: &str) -> ResponsePolicyUpdateCall<'a, S> { ResponsePolicyUpdateCall { hub: self.hub, _request: request, _project: project.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_dns1 as dns1; /// /// # async fn dox() { /// use std::default::Default; /// use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// 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().unwrap().https_or_http().enable_http1().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. /// * `responsePolicy` - User assigned name of the Response Policy containing the Response Policy Rule. pub fn create(&self, request: ResponsePolicyRule, project: &str, response_policy: &str) -> ResponsePolicyRuleCreateCall<'a, S> { ResponsePolicyRuleCreateCall { hub: self.hub, _request: request, _project: project.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. /// * `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, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRuleDeleteCall<'a, S> { ResponsePolicyRuleDeleteCall { hub: self.hub, _project: project.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. /// * `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, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRuleGetCall<'a, S> { ResponsePolicyRuleGetCall { hub: self.hub, _project: project.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. /// * `responsePolicy` - User assigned name of the Response Policy to list. pub fn list(&self, project: &str, response_policy: &str) -> ResponsePolicyRuleListCall<'a, S> { ResponsePolicyRuleListCall { hub: self.hub, _project: project.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. /// * `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, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRulePatchCall<'a, S> { ResponsePolicyRulePatchCall { hub: self.hub, _request: request, _project: project.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. /// * `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, response_policy: &str, response_policy_rule: &str) -> ResponsePolicyRuleUpdateCall<'a, S> { ResponsePolicyRuleUpdateCall { hub: self.hub, _request: request, _project: project.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(), } } } // ################### // CallBuilders ### // ################# /// Atomically updates the ResourceRecordSet collection. /// /// A builder for the *create* 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_dns1 as dns1; /// use dns1::api::Change; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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 = 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.changes().create(req, "project", "managedZone") /// .client_operation_id("Lorem") /// .doit().await; /// # } /// ``` pub struct ChangeCreateCall<'a, S> where S: 'a { hub: &'a Dns, _request: Change, _project: String, _managed_zone: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for ChangeCreateCall<'a, S> {} 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, Change)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.changes.create", http_method: hyper::Method::POST }); for &field in ["alt", "project", "managedZone", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/changes"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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: Change) -> ChangeCreateCall<'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) -> ChangeCreateCall<'a, S> { self._project = 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 /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ChangeCreateCall<'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) -> ChangeCreateCall<'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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ChangeCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ChangeCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ChangeCreateCall<'a, S> { self._scopes.clear(); self } } /// Fetches the representation of an existing Change. /// /// A builder for the *get* 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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().get("project", "managedZone", "changeId") /// .client_operation_id("ea") /// .doit().await; /// # } /// ``` pub struct ChangeGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _change_id: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for ChangeGetCall<'a, S> {} 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, Change)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.changes.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "changeId", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); params.push("changeId", self._change_id); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/changes/{changeId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone"), ("{changeId}", "changeId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["changeId", "managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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) -> ChangeGetCall<'a, S> { self._project = 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 /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ChangeGetCall<'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) -> ChangeGetCall<'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 of 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. /// /// 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: St) -> ChangeGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ChangeGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ChangeGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .sort_order("amet") /// .sort_by("duo") /// .page_token("ipsum") /// .max_results(-93) /// .doit().await; /// # } /// ``` pub struct ChangeListCall<'a, S> where S: 'a { hub: &'a Dns, _project: 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: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.changes.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "sortOrder", "sortBy", "pageToken", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(8 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._sort_order.as_ref() { params.push("sortOrder", value); } if let Some(value) = self._sort_by.as_ref() { params.push("sortBy", value); } if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/changes"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ChangeListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ChangeListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ChangeListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone", "dnsKeyId") /// .digest_type("est") /// .client_operation_id("ipsum") /// .doit().await; /// # } /// ``` pub struct DnsKeyGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: 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: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.dnsKeys.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "dnsKeyId", "digestType", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); params.push("dnsKeyId", self._dns_key_id); if let Some(value) = self._digest_type.as_ref() { params.push("digestType", value); } if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/dnsKeys/{dnsKeyId}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone"), ("{dnsKeyId}", "dnsKeyId")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["dnsKeyId", "managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> DnsKeyGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> DnsKeyGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> DnsKeyGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .page_token("gubergren") /// .max_results(-17) /// .digest_type("dolor") /// .doit().await; /// # } /// ``` pub struct DnsKeyListCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _page_token: Option, _max_results: Option, _digest_type: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.dnsKeys.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "pageToken", "maxResults", "digestType"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } if let Some(value) = self._digest_type.as_ref() { params.push("digestType", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/dnsKeys"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> DnsKeyListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> DnsKeyListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> DnsKeyListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone", "operation") /// .client_operation_id("sed") /// .doit().await; /// # } /// ``` pub struct ManagedZoneOperationGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _operation: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZoneOperations.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "operation", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); params.push("operation", self._operation); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/operations/{operation}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone"), ("{operation}", "operation")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["operation", "managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ManagedZoneOperationGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneOperationGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneOperationGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .sort_by("no") /// .page_token("Stet") /// .max_results(-13) /// .doit().await; /// # } /// ``` pub struct ManagedZoneOperationListCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _sort_by: Option, _page_token: Option, _max_results: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZoneOperations.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "sortBy", "pageToken", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._sort_by.as_ref() { params.push("sortBy", value); } if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/operations"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ManagedZoneOperationListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneOperationListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneOperationListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ManagedZone; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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") /// .client_operation_id("sed") /// .doit().await; /// # } /// ``` pub struct ManagedZoneCreateCall<'a, S> where S: 'a { hub: &'a Dns, _request: ManagedZone, _project: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.create", http_method: hyper::Method::POST }); for &field in ["alt", "project", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ManagedZoneCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneCreateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .client_operation_id("vero") /// .doit().await; /// # } /// ``` pub struct ManagedZoneDeleteCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.delete", http_method: hyper::Method::DELETE }); for &field in ["project", "managedZone", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ManagedZoneDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneDeleteCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .client_operation_id("duo") /// .doit().await; /// # } /// ``` pub struct ManagedZoneGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ManagedZoneGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneGetCall<'a, S> { self._scopes.clear(); self } } /// Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set. /// /// A builder for the *getIamPolicy* 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_dns1 as dns1; /// use dns1::api::GoogleIamV1GetIamPolicyRequest; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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 = GoogleIamV1GetIamPolicyRequest::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().get_iam_policy(req, "resource") /// .doit().await; /// # } /// ``` pub struct ManagedZoneGetIamPolicyCall<'a, S> where S: 'a { hub: &'a Dns, _request: GoogleIamV1GetIamPolicyRequest, _resource: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for ManagedZoneGetIamPolicyCall<'a, S> {} impl<'a, S> ManagedZoneGetIamPolicyCall<'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, GoogleIamV1Policy)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.getIamPolicy", http_method: hyper::Method::POST }); for &field in ["alt", "resource"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("resource", self._resource); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/{+resource}:getIamPolicy"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{+resource}", "resource")].iter() { url = params.uri_replacement(url, param_name, find_this, true); } { let to_remove = ["resource"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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: GoogleIamV1GetIamPolicyRequest) -> ManagedZoneGetIamPolicyCall<'a, S> { self._request = new_value; self } /// REQUIRED: The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field. /// /// Sets the *resource* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ManagedZoneGetIamPolicyCall<'a, S> { self._resource = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneGetIamPolicyCall<'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) -> ManagedZoneGetIamPolicyCall<'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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ManagedZoneGetIamPolicyCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneGetIamPolicyCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneGetIamPolicyCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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") /// .page_token("voluptua.") /// .max_results(-2) /// .dns_name("consetetur") /// .doit().await; /// # } /// ``` pub struct ManagedZoneListCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _page_token: Option, _max_results: Option, _dns_name: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "pageToken", "maxResults", "dnsName"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } if let Some(value) = self._dns_name.as_ref() { params.push("dnsName", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ManagedZoneListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ManagedZone; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .client_operation_id("et") /// .doit().await; /// # } /// ``` pub struct ManagedZonePatchCall<'a, S> where S: 'a { hub: &'a Dns, _request: ManagedZone, _project: String, _managed_zone: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "project", "managedZone", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ManagedZonePatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZonePatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZonePatchCall<'a, S> { self._scopes.clear(); self } } /// Sets the access control policy on the specified resource. Replaces any existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. /// /// A builder for the *setIamPolicy* 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_dns1 as dns1; /// use dns1::api::GoogleIamV1SetIamPolicyRequest; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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 = GoogleIamV1SetIamPolicyRequest::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().set_iam_policy(req, "resource") /// .doit().await; /// # } /// ``` pub struct ManagedZoneSetIamPolicyCall<'a, S> where S: 'a { hub: &'a Dns, _request: GoogleIamV1SetIamPolicyRequest, _resource: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for ManagedZoneSetIamPolicyCall<'a, S> {} impl<'a, S> ManagedZoneSetIamPolicyCall<'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, GoogleIamV1Policy)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.setIamPolicy", http_method: hyper::Method::POST }); for &field in ["alt", "resource"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("resource", self._resource); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/{+resource}:setIamPolicy"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{+resource}", "resource")].iter() { url = params.uri_replacement(url, param_name, find_this, true); } { let to_remove = ["resource"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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: GoogleIamV1SetIamPolicyRequest) -> ManagedZoneSetIamPolicyCall<'a, S> { self._request = new_value; self } /// REQUIRED: The resource for which the policy is being specified. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field. /// /// Sets the *resource* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ManagedZoneSetIamPolicyCall<'a, S> { self._resource = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneSetIamPolicyCall<'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) -> ManagedZoneSetIamPolicyCall<'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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ManagedZoneSetIamPolicyCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneSetIamPolicyCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneSetIamPolicyCall<'a, S> { self._scopes.clear(); self } } /// Returns permissions that a caller has on the specified resource. If the resource does not exist, this returns an empty set of permissions, not a `NOT_FOUND` error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning. /// /// A builder for the *testIamPermissions* 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_dns1 as dns1; /// use dns1::api::GoogleIamV1TestIamPermissionsRequest; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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 = GoogleIamV1TestIamPermissionsRequest::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().test_iam_permissions(req, "resource") /// .doit().await; /// # } /// ``` pub struct ManagedZoneTestIamPermissionCall<'a, S> where S: 'a { hub: &'a Dns, _request: GoogleIamV1TestIamPermissionsRequest, _resource: String, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } impl<'a, S> client::CallBuilder for ManagedZoneTestIamPermissionCall<'a, S> {} impl<'a, S> ManagedZoneTestIamPermissionCall<'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, GoogleIamV1TestIamPermissionsResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.testIamPermissions", http_method: hyper::Method::POST }); for &field in ["alt", "resource"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("resource", self._resource); params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/{+resource}:testIamPermissions"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{+resource}", "resource")].iter() { url = params.uri_replacement(url, param_name, find_this, true); } { let to_remove = ["resource"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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: GoogleIamV1TestIamPermissionsRequest) -> ManagedZoneTestIamPermissionCall<'a, S> { self._request = new_value; self } /// REQUIRED: The resource for which the policy detail is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field. /// /// Sets the *resource* path property to the given value. /// /// Even though the property as already been set when instantiating this call, /// we provide this method for API completeness. pub fn resource(mut self, new_value: &str) -> ManagedZoneTestIamPermissionCall<'a, S> { self._resource = new_value.to_string(); self } /// The delegate implementation is consulted whenever there is an intermediate result, or if something goes wrong /// while executing the actual API request. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn client::Delegate) -> ManagedZoneTestIamPermissionCall<'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) -> ManagedZoneTestIamPermissionCall<'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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ManagedZoneTestIamPermissionCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneTestIamPermissionCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneTestIamPermissionCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ManagedZone; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .client_operation_id("duo") /// .doit().await; /// # } /// ``` pub struct ManagedZoneUpdateCall<'a, S> where S: 'a { hub: &'a Dns, _request: ManagedZone, _project: String, _managed_zone: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.managedZones.update", http_method: hyper::Method::PUT }); for &field in ["alt", "project", "managedZone", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ManagedZoneUpdateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ManagedZoneUpdateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ManagedZoneUpdateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::Policy; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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") /// .client_operation_id("vero") /// .doit().await; /// # } /// ``` pub struct PolicyCreateCall<'a, S> where S: 'a { hub: &'a Dns, _request: Policy, _project: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.policies.create", http_method: hyper::Method::POST }); for &field in ["alt", "project", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/policies"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> PolicyCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> PolicyCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> PolicyCreateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "policy") /// .client_operation_id("vero") /// .doit().await; /// # } /// ``` pub struct PolicyDeleteCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.policies.delete", http_method: hyper::Method::DELETE }); for &field in ["project", "policy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("project", self._project); params.push("policy", self._policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/policies/{policy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{policy}", "policy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["policy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> PolicyDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> PolicyDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> PolicyDeleteCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "policy") /// .client_operation_id("diam") /// .doit().await; /// # } /// ``` pub struct PolicyGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.policies.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "policy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); params.push("policy", self._policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/policies/{policy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{policy}", "policy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["policy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> PolicyGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> PolicyGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> PolicyGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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") /// .page_token("ipsum") /// .max_results(-23) /// .doit().await; /// # } /// ``` pub struct PolicyListCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _page_token: Option, _max_results: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.policies.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "pageToken", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/policies"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> PolicyListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> PolicyListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> PolicyListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::Policy; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "policy") /// .client_operation_id("voluptua.") /// .doit().await; /// # } /// ``` pub struct PolicyPatchCall<'a, S> where S: 'a { hub: &'a Dns, _request: Policy, _project: String, _policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.policies.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "project", "policy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("policy", self._policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/policies/{policy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{policy}", "policy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["policy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> PolicyPatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> PolicyPatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> PolicyPatchCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::Policy; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "policy") /// .client_operation_id("consetetur") /// .doit().await; /// # } /// ``` pub struct PolicyUpdateCall<'a, S> where S: 'a { hub: &'a Dns, _request: Policy, _project: String, _policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.policies.update", http_method: hyper::Method::PUT }); for &field in ["alt", "project", "policy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("policy", self._policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/policies/{policy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{policy}", "policy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["policy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> PolicyUpdateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> PolicyUpdateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> PolicyUpdateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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") /// .client_operation_id("sed") /// .doit().await; /// # } /// ``` pub struct ProjectGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.projects.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("project", self._project); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ProjectGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ProjectGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ProjectGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResourceRecordSet; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .client_operation_id("gubergren") /// .doit().await; /// # } /// ``` pub struct ResourceRecordSetCreateCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResourceRecordSet, _project: String, _managed_zone: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.create", http_method: hyper::Method::POST }); for &field in ["alt", "project", "managedZone", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/rrsets"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResourceRecordSetCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResourceRecordSetCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResourceRecordSetCreateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone", "name", "type") /// .client_operation_id("dolore") /// .doit().await; /// # } /// ``` pub struct ResourceRecordSetDeleteCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _name: String, _type_: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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<(hyper::Response, ResourceRecordSetsDeleteResponse)> { use std::io::{Read, Seek}; use hyper::header::{CONTENT_TYPE, CONTENT_LENGTH, AUTHORIZATION, USER_AGENT, LOCATION}; use client::{ToParts, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.delete", http_method: hyper::Method::DELETE }); for &field in ["alt", "project", "managedZone", "name", "type", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); params.push("name", self._name); params.push("type", self._type_); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/rrsets/{name}/{type}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone"), ("{name}", "name"), ("{type}", "type")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["type", "name", "managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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) -> ResourceRecordSetDeleteCall<'a, S> { self._project = 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResourceRecordSetDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResourceRecordSetDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResourceRecordSetDeleteCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone", "name", "type") /// .client_operation_id("sadipscing") /// .doit().await; /// # } /// ``` pub struct ResourceRecordSetGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _managed_zone: String, _name: String, _type_: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "name", "type", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); params.push("name", self._name); params.push("type", self._type_); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/rrsets/{name}/{type}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone"), ("{name}", "name"), ("{type}", "type")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["type", "name", "managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ResourceRecordSetGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResourceRecordSetGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResourceRecordSetGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone") /// .type_("no") /// .page_token("est") /// .name("At") /// .max_results(-43) /// .doit().await; /// # } /// ``` pub struct ResourceRecordSetListCall<'a, S> where S: 'a { hub: &'a Dns, _project: 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: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "managedZone", "type", "pageToken", "name", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(8 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); if let Some(value) = self._type_.as_ref() { params.push("type", value); } if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._name.as_ref() { params.push("name", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/rrsets"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ResourceRecordSetListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResourceRecordSetListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResourceRecordSetListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResourceRecordSet; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "managedZone", "name", "type") /// .client_operation_id("ipsum") /// .doit().await; /// # } /// ``` pub struct ResourceRecordSetPatchCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResourceRecordSet, _project: String, _managed_zone: String, _name: String, _type_: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.resourceRecordSets.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "project", "managedZone", "name", "type", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(8 + self._additional_params.len()); params.push("project", self._project); params.push("managedZone", self._managed_zone); params.push("name", self._name); params.push("type", self._type_); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/managedZones/{managedZone}/rrsets/{name}/{type}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{managedZone}", "managedZone"), ("{name}", "name"), ("{type}", "type")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["type", "name", "managedZone", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResourceRecordSetPatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResourceRecordSetPatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResourceRecordSetPatchCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResponsePolicy; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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") /// .client_operation_id("sanctus") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyCreateCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResponsePolicy, _project: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicies.create", http_method: hyper::Method::POST }); for &field in ["alt", "project", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyCreateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy") /// .client_operation_id("sed") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyDeleteCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _response_policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicies.delete", http_method: hyper::Method::DELETE }); for &field in ["project", "responsePolicy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(4 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyDeleteCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy") /// .client_operation_id("dolores") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _response_policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicies.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "responsePolicy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ResponsePolicyGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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") /// .page_token("sed") /// .max_results(-11) /// .doit().await; /// # } /// ``` pub struct ResponsePolicyListCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _page_token: Option, _max_results: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicies.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "pageToken", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ResponsePolicyListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResponsePolicy; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy") /// .client_operation_id("sed") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyPatchCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResponsePolicy, _project: String, _response_policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicies.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "project", "responsePolicy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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) -> 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyPatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyPatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyPatchCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResponsePolicy; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy") /// .client_operation_id("At") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyUpdateCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResponsePolicy, _project: String, _response_policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicies.update", http_method: hyper::Method::PUT }); for &field in ["alt", "project", "responsePolicy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyUpdateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyUpdateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyUpdateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResponsePolicyRule; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy") /// .client_operation_id("dolores") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyRuleCreateCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResponsePolicyRule, _project: String, _response_policy: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.create", http_method: hyper::Method::POST }); for &field in ["alt", "project", "responsePolicy", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}/rules"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyRuleCreateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyRuleCreateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyRuleCreateCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy", "responsePolicyRule") /// .client_operation_id("amet") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyRuleDeleteCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _response_policy: String, _response_policy_rule: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.delete", http_method: hyper::Method::DELETE }); for &field in ["project", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(5 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); params.push("responsePolicyRule", self._response_policy_rule); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicyRule", "responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::DELETE) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyRuleDeleteCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyRuleDeleteCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyRuleDeleteCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy", "responsePolicyRule") /// .client_operation_id("consetetur") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyRuleGetCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _response_policy: String, _response_policy_rule: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.get", http_method: hyper::Method::GET }); for &field in ["alt", "project", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); params.push("responsePolicyRule", self._response_policy_rule); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicyRule", "responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ResponsePolicyRuleGetCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyRuleGetCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyRuleGetCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy") /// .page_token("est") /// .max_results(-82) /// .doit().await; /// # } /// ``` pub struct ResponsePolicyRuleListCall<'a, S> where S: 'a { hub: &'a Dns, _project: String, _response_policy: String, _page_token: Option, _max_results: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.list", http_method: hyper::Method::GET }); for &field in ["alt", "project", "responsePolicy", "pageToken", "maxResults"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(6 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); if let Some(value) = self._page_token.as_ref() { params.push("pageToken", value); } if let Some(value) = self._max_results.as_ref() { params.push("maxResults", value.to_string()); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}/rules"; if self._scopes.is_empty() { self._scopes.insert(Scope::NdevClouddnReadonly.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); loop { let token = match self.hub.auth.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; let mut req_result = { let client = &self.hub.client; dlg.pre_request(); let mut req_builder = hyper::Request::builder() .method(hyper::Method::GET) .uri(url.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_LENGTH, 0_u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of 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. /// /// 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: St) -> ResponsePolicyRuleListCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyRuleListCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyRuleListCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResponsePolicyRule; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy", "responsePolicyRule") /// .client_operation_id("est") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyRulePatchCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResponsePolicyRule, _project: String, _response_policy: String, _response_policy_rule: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.patch", http_method: hyper::Method::PATCH }); for &field in ["alt", "project", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); params.push("responsePolicyRule", self._response_policy_rule); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicyRule", "responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyRulePatchCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyRulePatchCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyRulePatchCall<'a, S> { self._scopes.clear(); 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_dns1 as dns1; /// use dns1::api::ResponsePolicyRule; /// # async fn dox() { /// # use std::default::Default; /// # use dns1::{Dns, oauth2, hyper, hyper_rustls, chrono, FieldMask}; /// /// # 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().unwrap().https_or_http().enable_http1().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", "responsePolicy", "responsePolicyRule") /// .client_operation_id("Lorem") /// .doit().await; /// # } /// ``` pub struct ResponsePolicyRuleUpdateCall<'a, S> where S: 'a { hub: &'a Dns, _request: ResponsePolicyRule, _project: String, _response_policy: String, _response_policy_rule: String, _client_operation_id: Option, _delegate: Option<&'a mut dyn client::Delegate>, _additional_params: HashMap, _scopes: BTreeSet } 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, url::Params}; use std::borrow::Cow; let mut dd = client::DefaultDelegate; let mut dlg: &mut dyn client::Delegate = self._delegate.unwrap_or(&mut dd); dlg.begin(client::MethodInfo { id: "dns.responsePolicyRules.update", http_method: hyper::Method::PUT }); for &field in ["alt", "project", "responsePolicy", "responsePolicyRule", "clientOperationId"].iter() { if self._additional_params.contains_key(field) { dlg.finished(false); return Err(client::Error::FieldClash(field)); } } let mut params = Params::with_capacity(7 + self._additional_params.len()); params.push("project", self._project); params.push("responsePolicy", self._response_policy); params.push("responsePolicyRule", self._response_policy_rule); if let Some(value) = self._client_operation_id.as_ref() { params.push("clientOperationId", value); } params.extend(self._additional_params.iter()); params.push("alt", "json"); let mut url = self.hub._base_url.clone() + "dns/v1/projects/{project}/responsePolicies/{responsePolicy}/rules/{responsePolicyRule}"; if self._scopes.is_empty() { self._scopes.insert(Scope::CloudPlatform.as_ref().to_string()); } for &(find_this, param_name) in [("{project}", "project"), ("{responsePolicy}", "responsePolicy"), ("{responsePolicyRule}", "responsePolicyRule")].iter() { url = params.uri_replacement(url, param_name, find_this, false); } { let to_remove = ["responsePolicyRule", "responsePolicy", "project"]; params.remove_params(&to_remove); } let url = params.parse_with_url(&url); let mut json_mime_type = mime::APPLICATION_JSON; let mut request_value_reader = { let mut value = 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.get_token(&self._scopes.iter().map(String::as_str).collect::>()[..]).await { Ok(token) => token, Err(e) => { match dlg.token(e) { Ok(token) => token, Err(e) => { dlg.finished(false); return Err(client::Error::MissingToken(e)); } } } }; 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.as_str()) .header(USER_AGENT, self.hub._user_agent.clone()); if let Some(token) = token.as_ref() { req_builder = req_builder.header(AUTHORIZATION, format!("Bearer {}", token)); } let request = req_builder .header(CONTENT_TYPE, json_mime_type.to_string()) .header(CONTENT_LENGTH, request_size as u64) .body(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).await; 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).await; 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 } /// 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. /// /// ````text /// It should be used to handle progress information, and to implement a certain level of resilience. /// ```` /// /// Sets the *delegate* property to the given value. pub fn delegate(mut self, new_value: &'a mut dyn 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 of the default [`Scope`] variant /// [`Scope::CloudPlatform`]. /// /// The `scope` will be added to a set of scopes. This is important as one can maintain access /// tokens for more than one scope. /// /// Usually there is more than one suitable scope to authorize an operation, some of which may /// encompass more rights than others. For example, for listing resources, a *read-only* scope will be /// sufficient, a read-write scope will do as well. pub fn add_scope(mut self, scope: St) -> ResponsePolicyRuleUpdateCall<'a, S> where St: AsRef { self._scopes.insert(String::from(scope.as_ref())); self } /// Identifies the authorization scope(s) for the method you are building. /// /// See [`Self::add_scope()`] for details. pub fn add_scopes(mut self, scopes: I) -> ResponsePolicyRuleUpdateCall<'a, S> where I: IntoIterator, St: AsRef { self._scopes .extend(scopes.into_iter().map(|s| String::from(s.as_ref()))); self } /// Removes all scopes, and no default scope will be used either. /// In this case, you have to specify your API-key using the `key` parameter (see [`Self::param()`] /// for details). pub fn clear_scopes(mut self) -> ResponsePolicyRuleUpdateCall<'a, S> { self._scopes.clear(); self } }